forked from organicmaps/organicmaps
[Tizen] Add main form with main menu.
This commit is contained in:
parent
e5f9397458
commit
ece424e74b
4 changed files with 304 additions and 141 deletions
|
@ -29,15 +29,15 @@ public:
|
|||
virtual result OnInitializing(void);
|
||||
virtual void OnFormBackRequested(Tizen::Ui::Controls::Form & source);
|
||||
virtual void OnActionPerformed(const Tizen::Ui::Control & source, int actionId);
|
||||
//IListViewItemProvider
|
||||
virtual Tizen::Ui::Controls::ListItemBase * CreateItem (int index, float itemWidth);
|
||||
virtual bool DeleteItem (int index, Tizen::Ui::Controls::ListItemBase * pItem, float itemWidth);
|
||||
virtual int GetItemCount(void);
|
||||
// ISceneEventListener
|
||||
virtual void OnSceneActivatedN(const Tizen::Ui::Scenes::SceneId & previousSceneId,
|
||||
const Tizen::Ui::Scenes::SceneId & currentSceneId, Tizen::Base::Collection::IList * pArgs);
|
||||
virtual void OnSceneDeactivated(const Tizen::Ui::Scenes::SceneId & currentSceneId,
|
||||
const Tizen::Ui::Scenes::SceneId & nextSceneId);
|
||||
//IListViewItemProvider
|
||||
virtual Tizen::Ui::Controls::ListItemBase * CreateItem (int index, float itemWidth);
|
||||
virtual bool DeleteItem (int index, Tizen::Ui::Controls::ListItemBase * pItem, float itemWidth);
|
||||
virtual int GetItemCount(void);
|
||||
// IListViewItemEventListener
|
||||
virtual void OnListViewContextItemStateChanged(Tizen::Ui::Controls::ListView & listView, int index, int elementId, Tizen::Ui::Controls::ListContextItemStatus state);
|
||||
virtual void OnListViewItemStateChanged(Tizen::Ui::Controls::ListView & listView, int index, int elementId, Tizen::Ui::Controls::ListItemStatus status);
|
||||
|
@ -58,9 +58,9 @@ private:
|
|||
enum
|
||||
{
|
||||
ID_FORMAT_STRING = 500,
|
||||
ID_FORMAT_FLAG = 501,
|
||||
ID_FORMAT_STATUS = 502,
|
||||
ID_FORMAT_DOWNLOADING_PROGR = 503
|
||||
ID_FORMAT_FLAG,
|
||||
ID_FORMAT_STATUS,
|
||||
ID_FORMAT_DOWNLOADING_PROGR
|
||||
} EEventIDs;
|
||||
|
||||
map<storage::TIndex, Tizen::Graphics::Bitmap const *> m_flags;
|
||||
|
|
|
@ -16,8 +16,10 @@ class MapsWithMeForm
|
|||
, public Tizen::Ui::IActionEventListener
|
||||
, public Tizen::Locations::ILocationProviderListener
|
||||
, public Tizen::Ui::Controls::IFormBackEventListener
|
||||
{
|
||||
public:
|
||||
, public Tizen::Ui::Controls::IListViewItemProviderF
|
||||
, public Tizen::Ui::Controls::IListViewItemEventListener
|
||||
{
|
||||
public:
|
||||
MapsWithMeForm();
|
||||
virtual ~MapsWithMeForm(void);
|
||||
|
||||
|
@ -53,26 +55,50 @@ public:
|
|||
// IFormBackEventListener
|
||||
virtual void OnFormBackRequested(Tizen::Ui::Controls::Form& source);
|
||||
|
||||
void UpdateButtons();
|
||||
private:
|
||||
//IListViewItemProvider
|
||||
virtual Tizen::Ui::Controls::ListItemBase * CreateItem (int index, float itemWidth);
|
||||
virtual bool DeleteItem (int index, Tizen::Ui::Controls::ListItemBase * pItem, float itemWidth);
|
||||
virtual int GetItemCount(void);
|
||||
// IListViewItemEventListener
|
||||
virtual void OnListViewContextItemStateChanged(Tizen::Ui::Controls::ListView & listView, int index, int elementId, Tizen::Ui::Controls::ListContextItemStatus state);
|
||||
virtual void OnListViewItemStateChanged(Tizen::Ui::Controls::ListView & listView, int index, int elementId, Tizen::Ui::Controls::ListItemStatus status);
|
||||
virtual void OnListViewItemSwept(Tizen::Ui::Controls::ListView & listView, int index, Tizen::Ui::Controls::SweepDirection direction);
|
||||
virtual void OnListViewItemLongPressed(Tizen::Ui::Controls::ListView & listView, int index, int elementId, bool & invokeListViewItemCallback);
|
||||
|
||||
void UpdateButtons();
|
||||
void ShowSplitPanel();
|
||||
void HideSplitPanel();
|
||||
|
||||
private:
|
||||
bool m_locationEnabled;
|
||||
std::vector<std::pair<double, double> > m_prev_pts;
|
||||
|
||||
static const int ID_BUTTON_GPS = 101;
|
||||
static const int ID_BUTTON_SETTINGS = 102;
|
||||
static const int ID_BUTTON_SCALE_PLUS = 103;
|
||||
static const int ID_BUTTON_SCALE_MINUS = 104;
|
||||
static const int ID_BUTTON_DOWNLOAD = 105;
|
||||
enum
|
||||
{
|
||||
ID_GPS = 101,
|
||||
ID_SEARCH,
|
||||
ID_MENU,
|
||||
ID_STAR,
|
||||
ID_BUTTON_SCALE_PLUS,
|
||||
ID_BUTTON_SCALE_MINUS
|
||||
} EEventIDs;
|
||||
|
||||
enum
|
||||
{
|
||||
eDownloadProVer = 0,
|
||||
eDownloadMaps,
|
||||
eSettings,
|
||||
eSharePlace
|
||||
} EMainMenuItems;
|
||||
|
||||
Tizen::Locations::LocationProvider * m_pLocProvider;
|
||||
Tizen::Ui::Controls::Label * m_pLabel;
|
||||
Tizen::Ui::Controls::Button * m_pButtonGPS;
|
||||
Tizen::Ui::Controls::Button * m_pButtonSettings;
|
||||
|
||||
Tizen::Ui::Controls::Button * m_pButtonScalePlus;
|
||||
Tizen::Ui::Controls::Button * m_pButtonScaleMinus;
|
||||
|
||||
Tizen::Ui::Controls::SplitPanel * m_pSplitPanel;
|
||||
Tizen::Ui::Controls::Panel* m_pFirstPanel;
|
||||
Tizen::Ui::Controls::Panel* m_pSecondPanel;
|
||||
|
||||
tizen::Framework * m_pFramework;
|
||||
};
|
||||
};
|
||||
|
|
|
@ -33,11 +33,11 @@ Framework::Framework(Tizen::Ui::Controls::Form * form)
|
|||
::Framework * pFramework = GetInstance();
|
||||
VideoTimer1 * m_VideoTimer = new VideoTimer1(bind(&Framework::Draw, this));
|
||||
RenderPolicy::Params params;
|
||||
params.m_screenHeight = form->GetClientAreaBounds().height;
|
||||
params.m_screenHeight = form->GetBounds().height - form->GetClientAreaBounds().y;
|
||||
params.m_screenWidth = form->GetClientAreaBounds().width;
|
||||
params.m_useDefaultFB = true;
|
||||
params.m_skinName = "basic.skn";
|
||||
params.m_density = graphics::EDensityHDPI; // todo
|
||||
params.m_density = graphics::EDensityXHDPI; // todo
|
||||
params.m_videoTimer = m_VideoTimer;
|
||||
params.m_primaryRC = static_pointer_cast<graphics::RenderContext>(m_context);
|
||||
|
||||
|
|
|
@ -2,17 +2,22 @@
|
|||
#include "MapsWithMeApp.h"
|
||||
#include "Framework.hpp"
|
||||
#include "SceneRegister.hpp"
|
||||
#include "AppResourceId.h"
|
||||
|
||||
#include "../../../map/framework.hpp"
|
||||
#include "../../../gui/controller.hpp"
|
||||
#include "../../../platform/tizen_utils.hpp"
|
||||
#include "../../../platform/settings.hpp"
|
||||
|
||||
#include <FUi.h>
|
||||
#include <FBase.h>
|
||||
#include <FMedia.h>
|
||||
#include <FGraphics.h>
|
||||
#include "Utils.hpp"
|
||||
|
||||
using namespace Tizen::Ui;
|
||||
using namespace Tizen::Ui::Controls;
|
||||
using namespace Tizen::Ui::Scenes;
|
||||
using namespace Tizen::Graphics;
|
||||
using namespace Tizen::Media;
|
||||
using namespace Tizen::Base;
|
||||
|
@ -20,13 +25,9 @@ using namespace Tizen::Base::Collection;
|
|||
using namespace Tizen::Base::Utility;
|
||||
using namespace Tizen::Locations;
|
||||
using namespace Tizen::App;
|
||||
using namespace Tizen::Ui::Scenes;
|
||||
|
||||
MapsWithMeForm::MapsWithMeForm()
|
||||
:m_pLocProvider(0),
|
||||
m_pLabel(0),
|
||||
m_pButtonGPS(0),
|
||||
m_pButtonSettings(0),
|
||||
m_pFramework(0)
|
||||
{
|
||||
SetMultipointTouchEnabled(true);
|
||||
|
@ -47,59 +48,40 @@ MapsWithMeForm::~MapsWithMeForm(void)
|
|||
|
||||
bool MapsWithMeForm::Initialize(void)
|
||||
{
|
||||
Construct(Tizen::Ui::Controls::FORM_STYLE_NORMAL | FORM_STYLE_PORTRAIT_INDICATOR);
|
||||
Construct(IDF_MAIN_FORM);
|
||||
return true;
|
||||
}
|
||||
|
||||
result MapsWithMeForm::OnInitializing(void)
|
||||
{
|
||||
int width;
|
||||
int height;
|
||||
width = GetClientAreaBounds().width;
|
||||
height = GetClientAreaBounds().height;
|
||||
// Create a Label
|
||||
m_pLabel = new Label();
|
||||
m_pLabel->Construct(Rectangle(width / 4, 10, width *3/4, 120), L"GPS off");
|
||||
m_pLabel->SetTextVerticalAlignment(ALIGNMENT_MIDDLE);
|
||||
m_pLabel->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
|
||||
AddControl(m_pLabel);
|
||||
// Create a Button GPS
|
||||
m_pButtonGPS = new Button();
|
||||
m_pButtonGPS->Construct(Rectangle(50, height -150, 100, 100));
|
||||
m_pButtonGPS->SetText(L"GPS\noff");
|
||||
m_pButtonGPS->SetActionId(ID_BUTTON_GPS);
|
||||
m_pButtonGPS->AddActionEventListener(*this);
|
||||
AddControl(m_pButtonGPS);
|
||||
Footer* pFooter = GetFooter();
|
||||
|
||||
// Create a Button Settings
|
||||
m_pButtonSettings = new Button();
|
||||
m_pButtonSettings->Construct(Rectangle(width - 150, height -150, 100, 100));
|
||||
m_pButtonSettings->SetText(L"Set\ntings");
|
||||
m_pButtonSettings->SetActionId(ID_BUTTON_SETTINGS);
|
||||
m_pButtonSettings->AddActionEventListener(*this);
|
||||
AddControl(m_pButtonSettings);
|
||||
FooterItem footerItem;
|
||||
footerItem.Construct(ID_GPS);
|
||||
footerItem.SetIcon(FOOTER_ITEM_STATUS_NORMAL, GetBitmap(IDB_MY_POSITION_NORMAL));
|
||||
FooterItem footerItem1;
|
||||
footerItem1.Construct(ID_SEARCH);
|
||||
footerItem1.SetIcon(FOOTER_ITEM_STATUS_NORMAL, GetBitmap(IDB_SEARCH));
|
||||
FooterItem footerItem2;
|
||||
footerItem2.Construct(ID_STAR);
|
||||
footerItem2.SetIcon(FOOTER_ITEM_STATUS_NORMAL, GetBitmap(IDB_STAR));
|
||||
FooterItem footerItem3;
|
||||
footerItem3.Construct(ID_MENU);
|
||||
footerItem3.SetIcon(FOOTER_ITEM_STATUS_NORMAL, GetBitmap(IDB_MENU));
|
||||
|
||||
// Create a Button Download
|
||||
Button * pButtonDownload = new Button();
|
||||
pButtonDownload->Construct(Rectangle(width - 270, height -150, 100, 100));
|
||||
pButtonDownload->SetText(L"Down\nload");
|
||||
pButtonDownload->SetActionId(ID_BUTTON_DOWNLOAD);
|
||||
pButtonDownload->AddActionEventListener(*this);
|
||||
AddControl(pButtonDownload);
|
||||
|
||||
m_pButtonScalePlus = new Button();
|
||||
m_pButtonScalePlus->Construct(Rectangle(width - 150, height / 2, 100, 100));
|
||||
m_pButtonScalePlus->SetText(L"+");
|
||||
pFooter->AddItem(footerItem);
|
||||
pFooter->AddItem(footerItem1);
|
||||
pFooter->AddItem(footerItem2);
|
||||
pFooter->AddItem(footerItem3);
|
||||
pFooter->AddActionEventListener(*this);
|
||||
|
||||
m_pButtonScalePlus = static_cast<Button *>(GetControl(IDC_ZOOM_IN, true));
|
||||
m_pButtonScalePlus->SetActionId(ID_BUTTON_SCALE_PLUS);
|
||||
m_pButtonScalePlus->AddActionEventListener(*this);
|
||||
AddControl(m_pButtonScalePlus);
|
||||
|
||||
m_pButtonScaleMinus = new Button();
|
||||
m_pButtonScaleMinus->Construct(Rectangle(width - 150,( height / 2) + 120, 100, 100));
|
||||
m_pButtonScaleMinus->SetText(L"-");
|
||||
m_pButtonScaleMinus = static_cast<Button *>(GetControl(IDC_ZOOM_OUT, true));
|
||||
m_pButtonScaleMinus->SetActionId(ID_BUTTON_SCALE_MINUS);
|
||||
m_pButtonScaleMinus->AddActionEventListener(*this);
|
||||
AddControl(m_pButtonScaleMinus);
|
||||
|
||||
UpdateButtons();
|
||||
m_locationEnabled = false;
|
||||
|
@ -115,7 +97,7 @@ void MapsWithMeForm::OnActionPerformed(Tizen::Ui::Control const & source, int ac
|
|||
::Framework * pFramework = tizen::Framework::GetInstance();
|
||||
switch(actionId)
|
||||
{
|
||||
case ID_BUTTON_GPS:
|
||||
case ID_GPS:
|
||||
{
|
||||
m_locationEnabled = !m_locationEnabled;
|
||||
if (m_locationEnabled)
|
||||
|
@ -129,8 +111,6 @@ void MapsWithMeForm::OnActionPerformed(Tizen::Ui::Control const & source, int ac
|
|||
}
|
||||
int updateInterval = 1;
|
||||
m_pLocProvider->StartLocationUpdatesByInterval(updateInterval);
|
||||
m_pLabel->SetText(L"GPS ENABLED");
|
||||
m_pButtonGPS->SetText(L"GPS\nON");
|
||||
pFramework->StartLocation();
|
||||
}
|
||||
else
|
||||
|
@ -139,9 +119,9 @@ void MapsWithMeForm::OnActionPerformed(Tizen::Ui::Control const & source, int ac
|
|||
delete m_pLocProvider;
|
||||
m_pLocProvider = 0;
|
||||
pFramework->StopLocation();
|
||||
m_pLabel->SetText(L"GPS off");
|
||||
m_pButtonGPS->SetText(L"GPS\noff");
|
||||
|
||||
}
|
||||
UpdateButtons();
|
||||
break;
|
||||
}
|
||||
case ID_BUTTON_SCALE_PLUS:
|
||||
|
@ -150,22 +130,17 @@ void MapsWithMeForm::OnActionPerformed(Tizen::Ui::Control const & source, int ac
|
|||
case ID_BUTTON_SCALE_MINUS:
|
||||
pFramework->ScaleDefault(false);
|
||||
break;
|
||||
case ID_BUTTON_SETTINGS:
|
||||
case ID_STAR:
|
||||
{
|
||||
SceneManager * pSceneManager = SceneManager::GetInstance();
|
||||
pSceneManager->GoForward(ForwardSceneTransition(SCENE_SETTINGS, SCENE_TRANSITION_ANIMATION_TYPE_LEFT, SCENE_HISTORY_OPTION_ADD_HISTORY, SCENE_DESTROY_OPTION_KEEP));
|
||||
break;
|
||||
}
|
||||
case ID_BUTTON_DOWNLOAD:
|
||||
case ID_MENU:
|
||||
{
|
||||
ShowSplitPanel();
|
||||
break;
|
||||
}
|
||||
case ID_SEARCH:
|
||||
{
|
||||
ArrayList * pList = new ArrayList;
|
||||
pList->Construct();
|
||||
pList->Add(new Integer(storage::TIndex::INVALID));
|
||||
pList->Add(new Integer(storage::TIndex::INVALID));
|
||||
|
||||
SceneManager * pSceneManager = SceneManager::GetInstance();
|
||||
pSceneManager->GoForward(ForwardSceneTransition(SCENE_DOWNLOAD_GROUP,
|
||||
SCENE_TRANSITION_ANIMATION_TYPE_LEFT, SCENE_HISTORY_OPTION_ADD_HISTORY, SCENE_DESTROY_OPTION_KEEP), pList);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -187,7 +162,31 @@ int ConverToSecondsFrom1970(DateTime const & time)
|
|||
|
||||
return difftime(mktime(&cur_t),mktime(&y1970));
|
||||
}
|
||||
|
||||
typedef vector<pair<double, double> > TPointPairs;
|
||||
|
||||
TPointPairs GetTouchedPoints(Rectangle const & rect)
|
||||
{
|
||||
TPointPairs res;
|
||||
IListT<TouchEventInfo *> * pList = TouchEventManager::GetInstance()->GetTouchInfoListN();
|
||||
if (pList)
|
||||
{
|
||||
int count = pList->GetCount();
|
||||
for (int i = 0; i < count; ++i)
|
||||
{
|
||||
TouchEventInfo * pTouchInfo;
|
||||
pList->GetAt(i, pTouchInfo);
|
||||
Point pt = pTouchInfo->GetCurrentPosition();
|
||||
res.push_back(std::make_pair(pt.x - rect.x, pt.y - rect.y));
|
||||
}
|
||||
|
||||
pList->RemoveAll();
|
||||
delete pList;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
}
|
||||
using namespace detail;
|
||||
|
||||
void MapsWithMeForm::OnLocationUpdated(const Tizen::Locations::Location& location)
|
||||
{
|
||||
|
@ -213,17 +212,6 @@ void MapsWithMeForm::OnLocationUpdated(const Tizen::Locations::Location& locatio
|
|||
else
|
||||
info.m_speed = -1;
|
||||
|
||||
static int count = 0;
|
||||
count++;
|
||||
String s = "LocationUpdated ";
|
||||
s.Append(count);
|
||||
s.Append("\nLat:");
|
||||
s.Append(info.m_latitude);
|
||||
s.Append(" Lon:");
|
||||
s.Append(info.m_longitude);
|
||||
s.Append("\nAccuracy:");
|
||||
s.Append(info.m_horizontalAccuracy);
|
||||
m_pLabel->SetText(s);
|
||||
pFramework->OnLocationUpdate(info);
|
||||
Draw();
|
||||
}
|
||||
|
@ -250,58 +238,41 @@ void MapsWithMeForm::OnAccuracyChanged(Tizen::Locations::LocationAccuracy accura
|
|||
|
||||
result MapsWithMeForm::OnDraw(void)
|
||||
{
|
||||
// m_pFramework->Draw();
|
||||
return E_SUCCESS;
|
||||
}
|
||||
|
||||
namespace detail
|
||||
{
|
||||
std::vector<std::pair<double, double> > GetTouchedPoints(Tizen::Graphics::Rectangle const & rect)
|
||||
{
|
||||
std::vector<std::pair<double, double> > res;
|
||||
IListT<TouchEventInfo *> * pList = TouchEventManager::GetInstance()->GetTouchInfoListN();
|
||||
if (pList)
|
||||
{
|
||||
int count = pList->GetCount();
|
||||
for (int i = 0; i < count; ++i)
|
||||
{
|
||||
|
||||
TouchEventInfo * pTouchInfo;
|
||||
pList->GetAt(i, pTouchInfo);
|
||||
Point pt = pTouchInfo->GetCurrentPosition();
|
||||
res.push_back(std::make_pair(pt.x - rect.x, pt.y - rect.y));
|
||||
}
|
||||
|
||||
pList->RemoveAll();
|
||||
delete pList;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
}
|
||||
|
||||
void MapsWithMeForm::OnTouchPressed(Tizen::Ui::Control const & source,
|
||||
Tizen::Graphics::Point const & currentPosition,
|
||||
Point const & currentPosition,
|
||||
Tizen::Ui::TouchEventInfo const & touchInfo)
|
||||
{
|
||||
std::vector<std::pair<double, double> > pts = detail::GetTouchedPoints(GetClientAreaBounds());
|
||||
|
||||
::Framework * pFramework = tizen::Framework::GetInstance();
|
||||
if (!pFramework->GetGuiController()->OnTapStarted(m2::PointD(pts[0].first, pts[0].second)))
|
||||
if (&source == m_pFirstPanel)
|
||||
{
|
||||
if (pts.size() == 1)
|
||||
pFramework->StartDrag(DragEvent(pts[0].first, pts[0].second));
|
||||
else if (pts.size() > 1)
|
||||
pFramework->StartScale(ScaleEvent(pts[0].first, pts[0].second, pts[1].first, pts[1].second));
|
||||
HideSplitPanel();
|
||||
}
|
||||
else
|
||||
{
|
||||
TPointPairs pts = detail::GetTouchedPoints(GetClientAreaBounds());
|
||||
|
||||
std::swap(m_prev_pts, pts);
|
||||
::Framework * pFramework = tizen::Framework::GetInstance();
|
||||
if (!pFramework->GetGuiController()->OnTapStarted(m2::PointD(pts[0].first, pts[0].second)))
|
||||
{
|
||||
if (pts.size() == 1)
|
||||
pFramework->StartDrag(DragEvent(pts[0].first, pts[0].second));
|
||||
else if (pts.size() > 1)
|
||||
pFramework->StartScale(ScaleEvent(pts[0].first, pts[0].second, pts[1].first, pts[1].second));
|
||||
}
|
||||
|
||||
std::swap(m_prev_pts, pts);
|
||||
}
|
||||
}
|
||||
|
||||
void MapsWithMeForm::OnTouchMoved(Tizen::Ui::Control const & source,
|
||||
Tizen::Graphics::Point const & currentPosition,
|
||||
Point const & currentPosition,
|
||||
Tizen::Ui::TouchEventInfo const & touchInfo)
|
||||
{
|
||||
std::vector<std::pair<double, double> > pts = detail::GetTouchedPoints(GetClientAreaBounds());
|
||||
if (&source != this)
|
||||
return;
|
||||
TPointPairs pts = detail::GetTouchedPoints(GetClientAreaBounds());
|
||||
::Framework * pFramework = tizen::Framework::GetInstance();
|
||||
|
||||
if (!pFramework->GetGuiController()->OnTapMoved(m2::PointD(pts[0].first, pts[0].second)))
|
||||
|
@ -329,10 +300,12 @@ void MapsWithMeForm::OnTouchMoved(Tizen::Ui::Control const & source,
|
|||
}
|
||||
|
||||
void MapsWithMeForm::OnTouchReleased(Tizen::Ui::Control const & source,
|
||||
Tizen::Graphics::Point const & currentPosition,
|
||||
Point const & currentPosition,
|
||||
Tizen::Ui::TouchEventInfo const & touchInfo)
|
||||
{
|
||||
std::vector<std::pair<double, double> > pts = detail::GetTouchedPoints(GetClientAreaBounds());
|
||||
if (&source != this)
|
||||
return;
|
||||
TPointPairs pts = detail::GetTouchedPoints(GetClientAreaBounds());
|
||||
::Framework * pFramework = tizen::Framework::GetInstance();
|
||||
|
||||
//using prev_pts because pts contains not all points
|
||||
|
@ -350,22 +323,71 @@ void MapsWithMeForm::OnTouchReleased(Tizen::Ui::Control const & source,
|
|||
}
|
||||
|
||||
void MapsWithMeForm::OnTouchFocusIn(Tizen::Ui::Control const & source,
|
||||
Tizen::Graphics::Point const & currentPosition,
|
||||
Point const & currentPosition,
|
||||
Tizen::Ui::TouchEventInfo const & touchInfo)
|
||||
{
|
||||
}
|
||||
|
||||
void MapsWithMeForm::OnTouchFocusOut(Tizen::Ui::Control const & source,
|
||||
Tizen::Graphics::Point const & currentPosition,
|
||||
Point const & currentPosition,
|
||||
Tizen::Ui::TouchEventInfo const & touchInfo)
|
||||
{
|
||||
}
|
||||
|
||||
void MapsWithMeForm::OnFormBackRequested(Tizen::Ui::Controls::Form& source)
|
||||
void MapsWithMeForm::ShowSplitPanel()
|
||||
{
|
||||
UiApp * pApp = UiApp::GetInstance();
|
||||
AppAssert(pApp);
|
||||
pApp->Terminate();
|
||||
m_pSplitPanel = new (std::nothrow) SplitPanel();
|
||||
SetActionBarsVisible(FORM_ACTION_BAR_FOOTER, false);
|
||||
Rectangle rect = GetClientAreaBounds();
|
||||
rect.y = 0;
|
||||
|
||||
m_pSplitPanel->Construct(rect,
|
||||
SPLIT_PANEL_DIVIDER_STYLE_FIXED, SPLIT_PANEL_DIVIDER_DIRECTION_HORIZONTAL);
|
||||
m_pFirstPanel = new Panel();
|
||||
m_pFirstPanel->Construct(rect);
|
||||
m_pFirstPanel->SetBackgroundColor(Color(0,0,0, 100));
|
||||
m_pFirstPanel->AddTouchEventListener(*this);
|
||||
|
||||
m_pSecondPanel = new Panel();
|
||||
m_pSecondPanel->Construct(rect);
|
||||
m_pSecondPanel->SetBackgroundColor(Color::GetColor(COLOR_ID_BLUE));
|
||||
|
||||
m_pSplitPanel->SetDividerPosition(rect.height - 112 * GetItemCount());
|
||||
m_pSplitPanel->SetPane(m_pFirstPanel, SPLIT_PANEL_PANE_ORDER_FIRST);
|
||||
m_pSplitPanel->SetPane(m_pSecondPanel, SPLIT_PANEL_PANE_ORDER_SECOND);
|
||||
|
||||
ListView * pList = new ListView();
|
||||
pList->Construct(Rectangle(0,0,rect.width, 112 * GetItemCount()));
|
||||
pList->SetItemProvider(*this);
|
||||
pList->AddListViewItemEventListener(*this);
|
||||
|
||||
m_pSecondPanel->AddControl(pList);
|
||||
AddControl(m_pSplitPanel);
|
||||
}
|
||||
|
||||
void MapsWithMeForm::HideSplitPanel()
|
||||
{
|
||||
if (m_pSplitPanel)
|
||||
{
|
||||
RemoveControl(m_pSplitPanel);
|
||||
SetActionBarsVisible(FORM_ACTION_BAR_FOOTER, true);
|
||||
m_pSplitPanel = 0;
|
||||
}
|
||||
UpdateButtons();
|
||||
}
|
||||
|
||||
void MapsWithMeForm::OnFormBackRequested(Form& source)
|
||||
{
|
||||
if (m_pSplitPanel)
|
||||
{
|
||||
HideSplitPanel();
|
||||
}
|
||||
else
|
||||
{
|
||||
UiApp * pApp = UiApp::GetInstance();
|
||||
AppAssert(pApp);
|
||||
pApp->Terminate();
|
||||
}
|
||||
}
|
||||
|
||||
void MapsWithMeForm::UpdateButtons()
|
||||
|
@ -376,5 +398,120 @@ void MapsWithMeForm::UpdateButtons()
|
|||
|
||||
m_pButtonScalePlus->SetShowState(bEnableScaleButtons);
|
||||
m_pButtonScaleMinus->SetShowState(bEnableScaleButtons);
|
||||
|
||||
Footer* pFooter = GetFooter();
|
||||
FooterItem footerItem;
|
||||
footerItem.Construct(ID_GPS);
|
||||
if (m_locationEnabled)
|
||||
footerItem.SetIcon(FOOTER_ITEM_STATUS_NORMAL, GetBitmap(IDB_MY_POSITION_PRESSED));
|
||||
else
|
||||
footerItem.SetIcon(FOOTER_ITEM_STATUS_NORMAL, GetBitmap(IDB_MY_POSITION_NORMAL));
|
||||
|
||||
pFooter->SetItemAt (0, footerItem);
|
||||
Invalidate(true);
|
||||
}
|
||||
|
||||
ListItemBase * MapsWithMeForm::CreateItem (int index, float itemWidth)
|
||||
{
|
||||
CustomItem* pItem = new CustomItem();
|
||||
ListAnnexStyle style = LIST_ANNEX_STYLE_NORMAL;
|
||||
pItem->Construct(Dimension(itemWidth,112), style);
|
||||
Color const white(0xFF, 0xFF, 0xFF);
|
||||
Color const green(0, 0xFF, 0);
|
||||
FloatRectangle const rectImg(20.0f, 27.0f, 60, 60.0f);
|
||||
FloatRectangle const rectTxt(100, 25, 650, 50);
|
||||
|
||||
int fontSize = 34;
|
||||
switch (index)
|
||||
{
|
||||
case eDownloadProVer:
|
||||
{
|
||||
pItem->AddElement(rectImg, 0, *GetBitmap(IDB_MWM_PRO), null, null);
|
||||
pItem->AddElement(rectTxt, 1, GetString(IDS_BECOME_A_PRO), fontSize, green, green, green);
|
||||
}
|
||||
break;
|
||||
case eDownloadMaps:
|
||||
{
|
||||
pItem->AddElement(rectImg, 0, *GetBitmap(IDB_DOWNLOAD_MAP), null, null);
|
||||
pItem->AddElement(rectTxt, 1, GetString(IDS_DOWNLOAD_MAPS), fontSize, white, white, white);
|
||||
}
|
||||
break;
|
||||
case eSettings:
|
||||
{
|
||||
pItem->AddElement(rectImg, 0, *GetBitmap(IDB_SETTINGS), null, null);
|
||||
pItem->AddElement(rectTxt, 1, GetString(IDS_SETTINGS), fontSize, white, white, white);
|
||||
}
|
||||
break;
|
||||
case eSharePlace:
|
||||
{
|
||||
pItem->AddElement(rectImg, 0, *GetBitmap(IDB_SHARE), null, null);
|
||||
pItem->AddElement(rectTxt, 1, GetString(IDS_SHARE_MY_LOCATION), fontSize, white, white, white);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return pItem;
|
||||
}
|
||||
bool MapsWithMeForm::DeleteItem (int index, ListItemBase * pItem, float itemWidth)
|
||||
{
|
||||
delete pItem;
|
||||
return true;
|
||||
}
|
||||
int MapsWithMeForm::GetItemCount(void)
|
||||
{
|
||||
return 4;
|
||||
}
|
||||
|
||||
void MapsWithMeForm::OnListViewContextItemStateChanged(ListView & listView, int index, int elementId, ListContextItemStatus state)
|
||||
{
|
||||
|
||||
}
|
||||
void MapsWithMeForm::OnListViewItemStateChanged(ListView & listView, int index, int elementId, ListItemStatus status)
|
||||
{
|
||||
switch (index)
|
||||
{
|
||||
case eDownloadProVer:
|
||||
{
|
||||
|
||||
}
|
||||
break;
|
||||
case eDownloadMaps:
|
||||
{
|
||||
HideSplitPanel();
|
||||
ArrayList * pList = new ArrayList;
|
||||
pList->Construct();
|
||||
pList->Add(new Integer(storage::TIndex::INVALID));
|
||||
pList->Add(new Integer(storage::TIndex::INVALID));
|
||||
|
||||
SceneManager * pSceneManager = SceneManager::GetInstance();
|
||||
pSceneManager->GoForward(ForwardSceneTransition(SCENE_DOWNLOAD_GROUP,
|
||||
SCENE_TRANSITION_ANIMATION_TYPE_LEFT, SCENE_HISTORY_OPTION_ADD_HISTORY, SCENE_DESTROY_OPTION_KEEP), pList);
|
||||
}
|
||||
break;
|
||||
case eSettings:
|
||||
{
|
||||
HideSplitPanel();
|
||||
SceneManager * pSceneManager = SceneManager::GetInstance();
|
||||
pSceneManager->GoForward(ForwardSceneTransition(SCENE_SETTINGS,
|
||||
SCENE_TRANSITION_ANIMATION_TYPE_LEFT, SCENE_HISTORY_OPTION_ADD_HISTORY, SCENE_DESTROY_OPTION_KEEP));
|
||||
}
|
||||
break;
|
||||
case eSharePlace:
|
||||
{
|
||||
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
void MapsWithMeForm::OnListViewItemSwept(ListView & listView, int index, SweepDirection direction)
|
||||
{
|
||||
|
||||
}
|
||||
void MapsWithMeForm::OnListViewItemLongPressed(ListView & listView, int index, int elementId, bool & invokeListViewItemCallback)
|
||||
{
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue