forked from organicmaps/organicmaps
[Tizen] Add bookmarks forms and panels.
This commit is contained in:
parent
7ff76c755d
commit
a29e476d90
14 changed files with 1586 additions and 39 deletions
43
tizen/MapsWithMe/inc/BMCategoriesForm.hpp
Normal file
43
tizen/MapsWithMe/inc/BMCategoriesForm.hpp
Normal file
|
@ -0,0 +1,43 @@
|
|||
#pragma once
|
||||
|
||||
#include <FUi.h>
|
||||
|
||||
class BMCategoriesForm: public Tizen::Ui::Controls::Form
|
||||
, public Tizen::Ui::Controls::IFormBackEventListener
|
||||
, public Tizen::Ui::IActionEventListener
|
||||
, public Tizen::Ui::Controls::IListViewItemProviderF
|
||||
, public Tizen::Ui::Controls::IListViewItemEventListener
|
||||
{
|
||||
public:
|
||||
BMCategoriesForm();
|
||||
virtual ~BMCategoriesForm(void);
|
||||
|
||||
bool Initialize(void);
|
||||
virtual result OnInitializing(void);
|
||||
//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) {}
|
||||
|
||||
virtual void OnFormBackRequested(Tizen::Ui::Controls::Form & source);
|
||||
virtual void OnActionPerformed(Tizen::Ui::Control const & source, int actionId);
|
||||
|
||||
void UpdateState();
|
||||
enum EElementID
|
||||
{
|
||||
ID_EYE,
|
||||
ID_DELETE,
|
||||
ID_NAME,
|
||||
ID_SIZE,
|
||||
ID_DELETE_TXT,
|
||||
ID_EDIT
|
||||
};
|
||||
|
||||
bool m_bEditState;
|
||||
int m_categoryToDelete;
|
||||
};
|
107
tizen/MapsWithMe/inc/BookMarkSplitPanel.hpp
Normal file
107
tizen/MapsWithMe/inc/BookMarkSplitPanel.hpp
Normal file
|
@ -0,0 +1,107 @@
|
|||
#pragma once
|
||||
|
||||
#include <FUi.h>
|
||||
|
||||
class UserMark;
|
||||
class MapsWithMeForm;
|
||||
|
||||
class BookMarkSplitPanel: public Tizen::Ui::Controls::SplitPanel
|
||||
, public Tizen::Ui::IActionEventListener
|
||||
, public Tizen::Ui::ITouchEventListener
|
||||
, public Tizen::Ui::Controls::IListViewItemProviderF
|
||||
, public Tizen::Ui::Controls::IListViewItemEventListener
|
||||
, public Tizen::Ui::ITextEventListener
|
||||
{
|
||||
public:
|
||||
BookMarkSplitPanel();
|
||||
virtual ~BookMarkSplitPanel(void);
|
||||
|
||||
void Enable();
|
||||
void Disable();
|
||||
|
||||
bool Construct(Tizen::Graphics::FloatRectangle const & rect);
|
||||
void SetMainForm(MapsWithMeForm * pMainForm);
|
||||
// IActionEventListener
|
||||
virtual void OnActionPerformed(Tizen::Ui::Control const & source, int actionId);
|
||||
// ITouchEventListener
|
||||
virtual void OnTouchFocusIn (Tizen::Ui::Control const & source,
|
||||
Tizen::Graphics::Point const & currentPosition,
|
||||
Tizen::Ui::TouchEventInfo const & touchInfo){}
|
||||
virtual void OnTouchFocusOut (Tizen::Ui::Control const & source,
|
||||
Tizen::Graphics::Point const & currentPosition,
|
||||
Tizen::Ui::TouchEventInfo const & touchInfo){}
|
||||
virtual void OnTouchMoved (Tizen::Ui::Control const & source,
|
||||
Tizen::Graphics::Point const & currentPosition,
|
||||
Tizen::Ui::TouchEventInfo const & touchInfo){}
|
||||
virtual void OnTouchPressed (Tizen::Ui::Control const & source,
|
||||
Tizen::Graphics::Point const & currentPosition,
|
||||
Tizen::Ui::TouchEventInfo const & touchInfo);
|
||||
virtual void OnTouchReleased (Tizen::Ui::Control const & source,
|
||||
Tizen::Graphics::Point const & currentPosition,
|
||||
Tizen::Ui::TouchEventInfo const & touchInfo){}
|
||||
virtual void OnTouchLongPressed(Tizen::Ui::Control const & source,
|
||||
Tizen::Graphics::Point const & currentPosition,
|
||||
Tizen::Ui::TouchEventInfo const & touchInfo){}
|
||||
|
||||
//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);
|
||||
|
||||
Tizen::Ui::Controls::ListItemBase * CreateHeaderItem (float itemWidth);
|
||||
Tizen::Ui::Controls::ListItemBase * CreateSettingsItem (float itemWidth);
|
||||
Tizen::Ui::Controls::ListItemBase * CreateGroupItem (float itemWidth);
|
||||
Tizen::Ui::Controls::ListItemBase * CreateMessageItem (float itemWidth);
|
||||
|
||||
// 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){}
|
||||
// Tizen::Ui::ITextEventListener
|
||||
virtual void OnTextValueChangeCanceled (Tizen::Ui::Control const & source);
|
||||
virtual void OnTextValueChanged (Tizen::Ui::Control const & source);
|
||||
|
||||
Tizen::Base::String GetHeaderText() const;
|
||||
Tizen::Base::String GetDistanceText() const;
|
||||
Tizen::Base::String GetCountryText() const;
|
||||
Tizen::Base::String GetLocationText() const;
|
||||
Tizen::Base::String GetGroupText() const;
|
||||
Tizen::Base::String GetMessageText() const;
|
||||
|
||||
void UpdateState();
|
||||
UserMark const * GetCurMark() const;
|
||||
bool IsBookMark() const;
|
||||
private:
|
||||
|
||||
enum EButtons
|
||||
{
|
||||
EDIT_BUTTON = 0,
|
||||
STAR_BUTTON,
|
||||
COMPAS_BACKGROUND_IMG,
|
||||
COMPAS_IMG,
|
||||
COLOR_IMG,
|
||||
DISTANCE_TXT,
|
||||
COUNTRY_TXT,
|
||||
POSITION_TXT,
|
||||
GROUP_TXT,
|
||||
MESSAGE_TXT
|
||||
};
|
||||
|
||||
enum EItems
|
||||
{
|
||||
HEADER_ITEM = 0,
|
||||
SETTINGS_ITEM,
|
||||
GROUP_ITEM,
|
||||
MESSAGE_ITEM
|
||||
};
|
||||
|
||||
Tizen::Ui::Controls::Button * m_pButton;
|
||||
Tizen::Ui::Controls::Panel * m_pSecondPanel;
|
||||
Tizen::Ui::Controls::Label * m_pLabel;
|
||||
Tizen::Ui::Controls::EditArea * m_pMessageEdit;
|
||||
Tizen::Ui::Controls::EditArea * m_pDummyMessageEdit;
|
||||
|
||||
Tizen::Ui::Controls::ListView * m_pList;
|
||||
MapsWithMeForm * m_pMainForm;
|
||||
};
|
59
tizen/MapsWithMe/inc/CategoryForm.hpp
Normal file
59
tizen/MapsWithMe/inc/CategoryForm.hpp
Normal file
|
@ -0,0 +1,59 @@
|
|||
#pragma once
|
||||
|
||||
#include <FUi.h>
|
||||
|
||||
class CategoryForm: public Tizen::Ui::Controls::Form
|
||||
, public Tizen::Ui::Controls::IFormBackEventListener
|
||||
, public Tizen::Ui::IActionEventListener
|
||||
, public Tizen::Ui::Controls::IListViewItemProviderF
|
||||
, public Tizen::Ui::Controls::IListViewItemEventListener
|
||||
, public Tizen::Ui::Scenes::ISceneEventListener
|
||||
, public Tizen::Ui::ITextEventListener
|
||||
{
|
||||
public:
|
||||
CategoryForm();
|
||||
virtual ~CategoryForm(void);
|
||||
|
||||
bool Initialize(void);
|
||||
virtual result OnInitializing(void);
|
||||
//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) {}
|
||||
// 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){}
|
||||
// Tizen::Ui::ITextEventListener
|
||||
virtual void OnTextValueChangeCanceled (Tizen::Ui::Control const & source){}
|
||||
virtual void OnTextValueChanged (Tizen::Ui::Control const & source);
|
||||
|
||||
virtual void OnFormBackRequested(Tizen::Ui::Controls::Form & source);
|
||||
virtual void OnActionPerformed(Tizen::Ui::Control const & source, int actionId);
|
||||
|
||||
void UpdateState();
|
||||
enum EElementID
|
||||
{
|
||||
ID_DELETE,
|
||||
ID_COLOR,
|
||||
ID_NAME,
|
||||
ID_DISTANCE,
|
||||
ID_DELETE_TXT
|
||||
};
|
||||
enum EActionID
|
||||
{
|
||||
ID_VISIBILITY_ON,
|
||||
ID_VISIBILITY_OFF,
|
||||
ID_EDIT
|
||||
};
|
||||
|
||||
bool m_bEditState;
|
||||
int m_itemToDelete;
|
||||
int m_curCategory;
|
||||
};
|
|
@ -4,12 +4,16 @@
|
|||
#include <FUiITouchEventListener.h>
|
||||
#include <FLocations.h>
|
||||
#include "../../../std/vector.hpp"
|
||||
#include "../../../map/user_mark.hpp"
|
||||
|
||||
namespace tizen
|
||||
{
|
||||
class Framework;
|
||||
}
|
||||
|
||||
class UserMarkPanel;
|
||||
class BookMarkSplitPanel;
|
||||
|
||||
class MapsWithMeForm
|
||||
: public Tizen::Ui::Controls::Form
|
||||
, public Tizen::Ui::ITouchEventListener
|
||||
|
@ -18,6 +22,7 @@ class MapsWithMeForm
|
|||
, public Tizen::Ui::Controls::IFormBackEventListener
|
||||
, public Tizen::Ui::Controls::IListViewItemProviderF
|
||||
, public Tizen::Ui::Controls::IListViewItemEventListener
|
||||
, public Tizen::Ui::Scenes::ISceneEventListener
|
||||
{
|
||||
public:
|
||||
MapsWithMeForm();
|
||||
|
@ -43,6 +48,9 @@ public:
|
|||
virtual void OnTouchReleased (Tizen::Ui::Control const & source,
|
||||
Tizen::Graphics::Point const & currentPosition,
|
||||
Tizen::Ui::TouchEventInfo const & touchInfo);
|
||||
virtual void OnTouchLongPressed(Tizen::Ui::Control const & source,
|
||||
Tizen::Graphics::Point const & currentPosition,
|
||||
Tizen::Ui::TouchEventInfo const & touchInfo);
|
||||
|
||||
// IActionEventListener
|
||||
virtual void OnActionPerformed(Tizen::Ui::Control const & source, int actionId);
|
||||
|
@ -60,14 +68,37 @@ public:
|
|||
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 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);
|
||||
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){}
|
||||
// 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){}
|
||||
|
||||
//IUserMarkListener
|
||||
void OnUserMark(UserMarkCopy * pCopy);
|
||||
void OnDismissListener();
|
||||
|
||||
void UpdateButtons();
|
||||
|
||||
void CreateSplitPanel();
|
||||
void ShowSplitPanel();
|
||||
void HideSplitPanel();
|
||||
bool m_splitPanelEnabled;
|
||||
|
||||
void CreateBookMarkPanel();
|
||||
void ShowBookMarkPanel();
|
||||
void HideBookMarkPanel();
|
||||
bool m_bookMarkPanelEnabled;
|
||||
|
||||
void CreateBookMarkSplitPanel();
|
||||
void ShowBookMarkSplitPanel();
|
||||
void HideBookMarkSplitPanel();
|
||||
void UpdateBookMarkSplitPanelState();
|
||||
bool m_bookMArkSplitPanelEnabled;
|
||||
|
||||
private:
|
||||
bool m_locationEnabled;
|
||||
|
@ -85,7 +116,7 @@ private:
|
|||
|
||||
enum EMainMenuItems
|
||||
{
|
||||
eDownloadProVer = 0,
|
||||
//eDownloadProVer = 0,
|
||||
eDownloadMaps,
|
||||
eSettings,
|
||||
eSharePlace
|
||||
|
@ -100,5 +131,11 @@ private:
|
|||
Tizen::Ui::Controls::Panel* m_pFirstPanel;
|
||||
Tizen::Ui::Controls::Panel* m_pSecondPanel;
|
||||
|
||||
UserMarkPanel * m_userMarkPanel;
|
||||
BookMarkSplitPanel * m_bookMarkSplitPanel;
|
||||
|
||||
tizen::Framework * m_pFramework;
|
||||
|
||||
bool m_wasLongPress;
|
||||
pair<double, double> m_startTouchPoint;
|
||||
};
|
||||
|
|
34
tizen/MapsWithMe/inc/SelectBMCategoryForm.hpp
Normal file
34
tizen/MapsWithMe/inc/SelectBMCategoryForm.hpp
Normal file
|
@ -0,0 +1,34 @@
|
|||
#pragma once
|
||||
|
||||
#include <FUi.h>
|
||||
namespace bookmark
|
||||
{
|
||||
class BookMarkManager;
|
||||
}
|
||||
|
||||
class SelectBMCategoryForm: public Tizen::Ui::Controls::Form
|
||||
, public Tizen::Ui::Controls::IFormBackEventListener
|
||||
, public Tizen::Ui::Controls::IListViewItemProviderF
|
||||
, public Tizen::Ui::Controls::IListViewItemEventListener
|
||||
, public Tizen::Ui::ITextEventListener
|
||||
{
|
||||
public:
|
||||
SelectBMCategoryForm();
|
||||
virtual ~SelectBMCategoryForm(void);
|
||||
|
||||
bool Initialize(void);
|
||||
virtual result OnInitializing(void);
|
||||
virtual void OnFormBackRequested(Tizen::Ui::Controls::Form & source);
|
||||
//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) {}
|
||||
// ITextEventListener
|
||||
virtual void OnTextValueChangeCanceled (Tizen::Ui::Control const & source);
|
||||
virtual void OnTextValueChanged (Tizen::Ui::Control const & source);
|
||||
};
|
30
tizen/MapsWithMe/inc/SelectColorForm.hpp
Normal file
30
tizen/MapsWithMe/inc/SelectColorForm.hpp
Normal file
|
@ -0,0 +1,30 @@
|
|||
#pragma once
|
||||
|
||||
#include <FUi.h>
|
||||
|
||||
class SelectColorForm: public Tizen::Ui::Controls::Form
|
||||
, public Tizen::Ui::Controls::IFormBackEventListener
|
||||
, public Tizen::Ui::IActionEventListener
|
||||
{
|
||||
public:
|
||||
SelectColorForm();
|
||||
virtual ~SelectColorForm(void);
|
||||
|
||||
bool Initialize(void);
|
||||
virtual result OnInitializing(void);
|
||||
virtual void OnFormBackRequested(Tizen::Ui::Controls::Form & source);
|
||||
virtual void OnActionPerformed(Tizen::Ui::Control const & source, int actionId);
|
||||
|
||||
private:
|
||||
enum EActionId
|
||||
{
|
||||
ID_RED,
|
||||
ID_BLUE,
|
||||
ID_BROWN,
|
||||
ID_GREEN,
|
||||
ID_ORANGE,
|
||||
ID_PINK,
|
||||
ID_PURPLE,
|
||||
ID_YELLOW
|
||||
};
|
||||
};
|
52
tizen/MapsWithMe/inc/UserMarkPanel.hpp
Normal file
52
tizen/MapsWithMe/inc/UserMarkPanel.hpp
Normal file
|
@ -0,0 +1,52 @@
|
|||
#pragma once
|
||||
|
||||
#include <FUi.h>
|
||||
|
||||
class UserMark;
|
||||
class MapsWithMeForm;
|
||||
|
||||
class UserMarkPanel: public Tizen::Ui::Controls::Panel
|
||||
, public Tizen::Ui::IActionEventListener
|
||||
, public Tizen::Ui::ITouchEventListener
|
||||
{
|
||||
public:
|
||||
UserMarkPanel();
|
||||
virtual ~UserMarkPanel(void);
|
||||
void Enable();
|
||||
void Disable();
|
||||
|
||||
bool Construct(const Tizen::Graphics::FloatRectangle& rect);
|
||||
void SetMainForm(MapsWithMeForm * pMainForm);
|
||||
// IActionEventListener
|
||||
virtual void OnActionPerformed(Tizen::Ui::Control const & source, int actionId);
|
||||
// ITouchEventListener
|
||||
virtual void OnTouchFocusIn (Tizen::Ui::Control const & source,
|
||||
Tizen::Graphics::Point const & currentPosition,
|
||||
Tizen::Ui::TouchEventInfo const & touchInfo){}
|
||||
virtual void OnTouchFocusOut (Tizen::Ui::Control const & source,
|
||||
Tizen::Graphics::Point const & currentPosition,
|
||||
Tizen::Ui::TouchEventInfo const & touchInfo){}
|
||||
virtual void OnTouchMoved (Tizen::Ui::Control const & source,
|
||||
Tizen::Graphics::Point const & currentPosition,
|
||||
Tizen::Ui::TouchEventInfo const & touchInfo){}
|
||||
virtual void OnTouchPressed (Tizen::Ui::Control const & source,
|
||||
Tizen::Graphics::Point const & currentPosition,
|
||||
Tizen::Ui::TouchEventInfo const & touchInfo);
|
||||
virtual void OnTouchReleased (Tizen::Ui::Control const & source,
|
||||
Tizen::Graphics::Point const & currentPosition,
|
||||
Tizen::Ui::TouchEventInfo const & touchInfo){}
|
||||
virtual void OnTouchLongPressed(Tizen::Ui::Control const & source,
|
||||
Tizen::Graphics::Point const & currentPosition,
|
||||
Tizen::Ui::TouchEventInfo const & touchInfo){}
|
||||
|
||||
void UpdateState();
|
||||
UserMark const * GetCurMark();
|
||||
private:
|
||||
MapsWithMeForm * m_pMainForm;
|
||||
Tizen::Ui::Controls::Label * m_pLabel;
|
||||
Tizen::Ui::Controls::Button * m_pButton;
|
||||
enum EActions
|
||||
{
|
||||
ID_STAR
|
||||
};
|
||||
};
|
167
tizen/MapsWithMe/src/BMCategoriesForm.cpp
Normal file
167
tizen/MapsWithMe/src/BMCategoriesForm.cpp
Normal file
|
@ -0,0 +1,167 @@
|
|||
#include "BMCategoriesForm.hpp"
|
||||
#include "SceneRegister.hpp"
|
||||
#include "AppResourceId.h"
|
||||
#include "Utils.hpp"
|
||||
#include "Framework.hpp"
|
||||
#include "Constants.hpp"
|
||||
#include "BookMarkUtils.hpp"
|
||||
#include "../../../map/framework.hpp"
|
||||
#include "../../../platform/settings.hpp"
|
||||
#include "../../../platform/tizen_utils.hpp"
|
||||
#include "../../../base/logging.hpp"
|
||||
|
||||
using namespace Tizen::Base;
|
||||
using namespace Tizen::Ui::Controls;
|
||||
using namespace Tizen::Ui::Scenes;
|
||||
using namespace Tizen::Graphics;
|
||||
using namespace Tizen::Base::Collection;
|
||||
using namespace consts;
|
||||
using namespace bookmark;
|
||||
|
||||
BMCategoriesForm::BMCategoriesForm()
|
||||
{
|
||||
}
|
||||
|
||||
BMCategoriesForm::~BMCategoriesForm(void)
|
||||
{
|
||||
}
|
||||
|
||||
bool BMCategoriesForm::Initialize(void)
|
||||
{
|
||||
Construct(IDF_BMCATEGORIES_FORM);
|
||||
return true;
|
||||
}
|
||||
|
||||
result BMCategoriesForm::OnInitializing(void)
|
||||
{
|
||||
m_bEditState = false;
|
||||
m_categoryToDelete = -1;
|
||||
|
||||
ListView * pList = static_cast<ListView *>(GetControl(IDC_LISTVIEW, true));
|
||||
pList->SetItemProvider(*this);
|
||||
pList->AddListViewItemEventListener(*this);
|
||||
|
||||
GetHeader()->AddActionEventListener(*this);
|
||||
|
||||
SetFormBackEventListener(this);
|
||||
UpdateState();
|
||||
return E_SUCCESS;
|
||||
}
|
||||
|
||||
void BMCategoriesForm::OnActionPerformed(Tizen::Ui::Control const & source, int actionId)
|
||||
{
|
||||
switch(actionId)
|
||||
{
|
||||
case ID_EDIT:
|
||||
{
|
||||
m_bEditState = !m_bEditState;
|
||||
m_categoryToDelete = -1;
|
||||
UpdateState();
|
||||
break;
|
||||
}
|
||||
}
|
||||
Invalidate(true);
|
||||
}
|
||||
|
||||
void BMCategoriesForm::OnFormBackRequested(Tizen::Ui::Controls::Form & source)
|
||||
{
|
||||
SceneManager * pSceneManager = SceneManager::GetInstance();
|
||||
pSceneManager->GoBackward(BackwardSceneTransition(SCENE_TRANSITION_ANIMATION_TYPE_RIGHT));
|
||||
}
|
||||
|
||||
ListItemBase * BMCategoriesForm::CreateItem (int index, float itemWidth)
|
||||
{
|
||||
CustomItem * pItem = new CustomItem();
|
||||
|
||||
BookMarkManager & mngr = GetBMMnger();
|
||||
pItem->Construct(FloatDimension(itemWidth, lstItmHght), LIST_ANNEX_STYLE_NORMAL);
|
||||
|
||||
int addWdth = 0;
|
||||
bool bShowDelete = index == m_categoryToDelete;
|
||||
if (m_bEditState)
|
||||
{
|
||||
FloatRectangle imgRect(btwWdth, topHght, imgWdth, imgHght);
|
||||
pItem->AddElement(imgRect, ID_DELETE, *GetBitmap(bShowDelete ? IDB_BOOKMARK_DELETE_CUR : IDB_BOOKMARK_DELETE), null, null);
|
||||
addWdth = btwWdth + imgWdth;
|
||||
}
|
||||
|
||||
FloatRectangle imgRect(addWdth + btwWdth, topHght, imgWdth, imgHght);
|
||||
pItem->AddElement(imgRect, ID_EYE, *GetBitmap(mngr.IsCategoryVisible(index) ? IDB_EYE : IDB_EMPTY), null, null);
|
||||
int beg = addWdth + btwWdth + imgWdth + btwWdth;
|
||||
int end = 2 * btwWdth + (bShowDelete ? deleteWidth : imgWdth);
|
||||
String itemText = mngr.GetCategoryName(index);
|
||||
pItem->AddElement(FloatRectangle(beg, topHght, itemWidth - beg - end, imgHght), ID_NAME, itemText, mainFontSz, gray, gray, gray);
|
||||
if (bShowDelete)
|
||||
{
|
||||
pItem->AddElement(FloatRectangle(itemWidth - end + btwWdth, topHght, deleteWidth, imgHght), ID_DELETE_TXT, "Delete", mainFontSz, red, red, red);
|
||||
}
|
||||
else
|
||||
{
|
||||
int count = mngr.GetCategorySize(index);
|
||||
String sz;
|
||||
sz.Append(count);
|
||||
pItem->AddElement(FloatRectangle(itemWidth - btwWdth - imgWdth, topHght, imgWdth, imgHght), ID_SIZE, sz, mainFontSz, gray, gray, gray);
|
||||
}
|
||||
|
||||
return pItem;
|
||||
}
|
||||
|
||||
void BMCategoriesForm::OnListViewItemStateChanged(Tizen::Ui::Controls::ListView & listView, int index, int elementId, Tizen::Ui::Controls::ListItemStatus status)
|
||||
{
|
||||
BookMarkManager & mngr = GetBMMnger();
|
||||
if (elementId == ID_EYE)
|
||||
{
|
||||
bool bVisible = mngr.IsCategoryVisible(index);
|
||||
mngr.SetCategoryVisible(index, !bVisible);
|
||||
}
|
||||
if (elementId == ID_DELETE)
|
||||
{
|
||||
if (m_categoryToDelete == index)
|
||||
m_categoryToDelete = -1;
|
||||
else
|
||||
m_categoryToDelete = index;
|
||||
}
|
||||
if (elementId == ID_DELETE_TXT)
|
||||
{
|
||||
mngr.DeleteCategory(index);
|
||||
m_categoryToDelete = -1;
|
||||
}
|
||||
|
||||
if (elementId == ID_NAME || elementId == ID_SIZE)
|
||||
{
|
||||
ArrayList * pList = new ArrayList;
|
||||
pList->Construct();
|
||||
pList->Add(new Integer(index));
|
||||
SceneManager * pSceneManager = SceneManager::GetInstance();
|
||||
pSceneManager->GoForward(ForwardSceneTransition(SCENE_CATEGORY,
|
||||
SCENE_TRANSITION_ANIMATION_TYPE_LEFT, SCENE_HISTORY_OPTION_ADD_HISTORY, SCENE_DESTROY_OPTION_DESTROY), pList);
|
||||
return;
|
||||
}
|
||||
UpdateState();
|
||||
}
|
||||
|
||||
void BMCategoriesForm::UpdateState()
|
||||
{
|
||||
ListView * pList = static_cast<ListView *>(GetControl(IDC_LISTVIEW, true));
|
||||
pList->UpdateList();
|
||||
|
||||
Header* pHeader = GetHeader();
|
||||
|
||||
ButtonItem buttonItem;
|
||||
buttonItem.Construct(BUTTON_ITEM_STYLE_TEXT, ID_EDIT);
|
||||
buttonItem.SetText(m_bEditState ? GetString(IDS_DONE): GetString(IDS_EDIT));
|
||||
|
||||
pHeader->SetButton(BUTTON_POSITION_RIGHT, buttonItem);
|
||||
Invalidate(true);
|
||||
}
|
||||
|
||||
bool BMCategoriesForm::DeleteItem (int index, Tizen::Ui::Controls::ListItemBase * pItem, float itemWidth)
|
||||
{
|
||||
delete pItem;
|
||||
return true;
|
||||
}
|
||||
|
||||
int BMCategoriesForm::GetItemCount(void)
|
||||
{
|
||||
return GetBMMnger().GetCategoriesCount();
|
||||
}
|
347
tizen/MapsWithMe/src/BookMarkSplitPanel.cpp
Normal file
347
tizen/MapsWithMe/src/BookMarkSplitPanel.cpp
Normal file
|
@ -0,0 +1,347 @@
|
|||
#include "BookMarkSplitPanel.hpp"
|
||||
#include "SceneRegister.hpp"
|
||||
#include "MapsWithMeForm.hpp"
|
||||
#include "AppResourceId.h"
|
||||
#include "Constants.hpp"
|
||||
#include "Utils.hpp"
|
||||
#include "MapsWithMeForm.hpp"
|
||||
#include "BookMarkUtils.hpp"
|
||||
|
||||
#include "../../../map/framework.hpp"
|
||||
#include "../../../platform/settings.hpp"
|
||||
#include "../../../platform/tizen_utils.hpp"
|
||||
#include "../../../base/logging.hpp"
|
||||
#include "../../../std/sstream.hpp"
|
||||
|
||||
using namespace Tizen::Base;
|
||||
using namespace Tizen::Ui::Controls;
|
||||
using namespace Tizen::Ui::Scenes;
|
||||
using namespace Tizen::Graphics;
|
||||
using namespace consts;
|
||||
using namespace bookmark;
|
||||
|
||||
BookMarkSplitPanel::BookMarkSplitPanel()
|
||||
:m_pMainForm(0)
|
||||
{
|
||||
}
|
||||
|
||||
BookMarkSplitPanel::~BookMarkSplitPanel(void)
|
||||
{
|
||||
}
|
||||
|
||||
bool BookMarkSplitPanel::Construct(const Tizen::Graphics::FloatRectangle& rect)
|
||||
{
|
||||
SplitPanel::Construct(rect, SPLIT_PANEL_DIVIDER_STYLE_FIXED, SPLIT_PANEL_DIVIDER_DIRECTION_HORIZONTAL);
|
||||
|
||||
Panel * m_pFirstPanel = new Panel();
|
||||
FloatRectangle firstRect = rect;
|
||||
firstRect.height /=2;
|
||||
m_pFirstPanel->Construct(firstRect);
|
||||
|
||||
m_pFirstPanel->SetBackgroundColor(green);
|
||||
m_pButton = new Button;
|
||||
m_pButton->Construct(FloatRectangle(btwWdth, btwWdth, rect.width - 2 * btwWdth, lstItmHght - 2 * btwWdth));
|
||||
m_pButton->SetColor(BUTTON_STATUS_NORMAL ,green);
|
||||
m_pButton->SetColor(BUTTON_STATUS_PRESSED ,green);
|
||||
m_pButton->SetText(GetString(IDS_SHARE));
|
||||
m_pButton->SetTextColor(white);
|
||||
m_pButton->SetActionId(100);
|
||||
m_pButton->AddActionEventListener(*this);
|
||||
|
||||
m_pLabel = new Label();
|
||||
m_pLabel->Construct(Rectangle(btwWdth, btwWdth, rect.width - 2 * btnSz - btwWdth, markPanelHeight - 2 * btwWdth), GetHeaderText());
|
||||
m_pLabel->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
|
||||
m_pLabel->SetTextVerticalAlignment(ALIGNMENT_TOP);
|
||||
m_pLabel->SetTextColor(white);
|
||||
m_pLabel->AddTouchEventListener(*this);
|
||||
|
||||
m_pList = new ListView();
|
||||
m_pList->Construct(firstRect, true, SCROLL_STYLE_FIXED);
|
||||
m_pList->SetItemProvider(*this);
|
||||
m_pList->AddListViewItemEventListener(*this);
|
||||
m_pList->SetBackgroundColor(green);
|
||||
|
||||
m_pMessageEdit = new EditArea();
|
||||
m_pMessageEdit->Construct(Rectangle(0, allItemsHeight - messageItemHeight + btwWdth,
|
||||
rect.width - btnSz - btwWdth, messageItemHeight - 2 * btwWdth));
|
||||
m_pMessageEdit->SetShowState(false);
|
||||
m_pMessageEdit->AddTextEventListener(*this);
|
||||
m_pMessageEdit->SetMargin(EDIT_MARGIN_TYPE_HORIZONTAL, 0);
|
||||
m_pMessageEdit->SetMargin(EDIT_MARGIN_TYPE_VERTICAL, 0);
|
||||
m_pMessageEdit->SetColor(EDIT_STATUS_NORMAL, green);
|
||||
m_pMessageEdit->SetColor(EDIT_STATUS_PRESSED, green);
|
||||
m_pMessageEdit->SetColor(EDIT_STATUS_HIGHLIGHTED, green);
|
||||
m_pMessageEdit->SetTextColor(EDIT_TEXT_COLOR_NORMAL, white);
|
||||
m_pMessageEdit->SetTextColor(EDIT_TEXT_COLOR_HIGHLIGHTED, white);
|
||||
|
||||
m_pDummyMessageEdit = new EditArea();
|
||||
m_pDummyMessageEdit->Construct(Rectangle(0, headerSettingsHeight + btwWdth,
|
||||
rect.width - btnSz - btwWdth, messageItemHeight - 2 * btwWdth));
|
||||
m_pDummyMessageEdit->SetShowState(false);
|
||||
|
||||
m_pFirstPanel->AddControl(m_pButton);
|
||||
m_pFirstPanel->AddControl(m_pList);
|
||||
m_pFirstPanel->AddControl(m_pLabel);
|
||||
m_pFirstPanel->AddControl(m_pMessageEdit);
|
||||
m_pFirstPanel->AddControl(m_pDummyMessageEdit);
|
||||
|
||||
m_pSecondPanel = new Panel();
|
||||
m_pSecondPanel->Construct(rect);
|
||||
m_pSecondPanel->SetBackgroundColor(Color(0,0,0, 100));
|
||||
m_pSecondPanel->AddTouchEventListener(*this);
|
||||
|
||||
SetDividerPosition(rect.height / 2);
|
||||
SetPane(m_pFirstPanel, SPLIT_PANEL_PANE_ORDER_FIRST);
|
||||
SetPane(m_pSecondPanel, SPLIT_PANEL_PANE_ORDER_SECOND);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void BookMarkSplitPanel::SetMainForm(MapsWithMeForm * pMainForm)
|
||||
{
|
||||
m_pMainForm = pMainForm;
|
||||
}
|
||||
|
||||
void BookMarkSplitPanel::OnTouchPressed (Tizen::Ui::Control const & source,
|
||||
Tizen::Graphics::Point const & currentPosition,
|
||||
Tizen::Ui::TouchEventInfo const & touchInfo)
|
||||
{
|
||||
if (m_pMainForm)
|
||||
m_pMainForm->OnFormBackRequested(*m_pMainForm);
|
||||
}
|
||||
|
||||
void BookMarkSplitPanel::Enable()
|
||||
{
|
||||
UpdateState();
|
||||
SetShowState(true);
|
||||
|
||||
}
|
||||
|
||||
void BookMarkSplitPanel::Disable()
|
||||
{
|
||||
SetShowState(false);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void BookMarkSplitPanel::OnActionPerformed(Tizen::Ui::Control const & source, int actionId)
|
||||
{
|
||||
// switch(actionId)
|
||||
// {
|
||||
// case 100:
|
||||
// {
|
||||
//
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
// Invalidate(true);
|
||||
}
|
||||
|
||||
Tizen::Ui::Controls::ListItemBase * BookMarkSplitPanel::CreateHeaderItem (float itemWidth)
|
||||
{
|
||||
CustomItem * pItem = new CustomItem();
|
||||
|
||||
pItem->Construct(FloatDimension(itemWidth, headerItemHeight), LIST_ANNEX_STYLE_NORMAL);
|
||||
FloatRectangle imgRect(itemWidth - btwWdth - btnSz, btwWdth, btnSz, btnSz);
|
||||
if (IsBookMark())
|
||||
{
|
||||
FloatRectangle editRect = imgRect;
|
||||
editRect.x -= btnSz;
|
||||
editRect.height = editBtnSz;
|
||||
editRect.width = editBtnSz;
|
||||
pItem->AddElement(editRect, EDIT_BUTTON, *GetBitmap(IDB_PLACE_PAGE_EDIT_BUTTON), null, null);
|
||||
pItem->AddElement(imgRect, STAR_BUTTON, *GetBitmap(IDB_PLACE_PAGE_BUTTON_SELECTED), null, null);
|
||||
}
|
||||
else
|
||||
{
|
||||
pItem->AddElement(imgRect, STAR_BUTTON, *GetBitmap(IDB_PLACE_PAGE_BUTTON), null, null);
|
||||
}
|
||||
|
||||
return pItem;
|
||||
}
|
||||
Tizen::Ui::Controls::ListItemBase * BookMarkSplitPanel::CreateSettingsItem (float itemWidth)
|
||||
{
|
||||
BookMarkManager & mngr = GetBMMnger();
|
||||
CustomItem * pItem = new CustomItem();
|
||||
|
||||
pItem->Construct(FloatDimension(itemWidth, settingsItemHeight), LIST_ANNEX_STYLE_NORMAL);
|
||||
|
||||
FloatRectangle imgRect(btwWdth, topHght, imgWdth, imgHght);
|
||||
pItem->AddElement(imgRect, COMPAS_BACKGROUND_IMG, *GetBitmap(IDB_PLACE_PAGE_COMPASS), null, null);
|
||||
pItem->AddElement(imgRect, COMPAS_IMG, *GetBitmap(IDB_PLACE_PAGE_COMPASS_BACKGROUND), null, null);
|
||||
if (IsBookMark())
|
||||
{
|
||||
FloatRectangle colorImgRect(imgRect);
|
||||
colorImgRect.x = itemWidth - btwWdth - imgWdth;
|
||||
EColor color = mngr.GetCurBookMarkColor();
|
||||
pItem->AddElement(colorImgRect, COLOR_IMG, *GetBitmap(GetColorPPBM(color)), null, null);
|
||||
}
|
||||
FloatRectangle txtRect = imgRect;
|
||||
txtRect.width = itemWidth - 2 * imgWdth - 4 * btwWdth;
|
||||
txtRect.x = imgWdth + 2 * btwWdth;
|
||||
pItem->AddElement(txtRect, DISTANCE_TXT, GetDistanceText(), mainFontSz, white, white, white);
|
||||
txtRect.x = btwWdth;
|
||||
txtRect.y += imgHght;
|
||||
txtRect.width = itemWidth - 2 * btwWdth;
|
||||
pItem->AddElement(txtRect, COUNTRY_TXT, GetCountryText(), mediumFontSz, white, white, white);
|
||||
txtRect.y += imgHght;
|
||||
pItem->AddElement(txtRect, POSITION_TXT, GetLocationText(), mainFontSz, white, white, white);
|
||||
|
||||
|
||||
return pItem;
|
||||
}
|
||||
Tizen::Ui::Controls::ListItemBase * BookMarkSplitPanel::CreateGroupItem (float itemWidth)
|
||||
{
|
||||
CustomItem * pItem = new CustomItem();
|
||||
pItem->Construct(FloatDimension(itemWidth, groupItemHeight), LIST_ANNEX_STYLE_NORMAL);
|
||||
|
||||
FloatRectangle imgRect(itemWidth - editBtnSz - btwWdth, btwWdth, editBtnSz, editBtnSz);
|
||||
pItem->AddElement(imgRect, EDIT_BUTTON, *GetBitmap(IDB_PLACE_PAGE_EDIT_BUTTON), null, null);
|
||||
pItem->AddElement(FloatRectangle(btwWdth, topHght, itemWidth, imgHght), GROUP_TXT, GetGroupText(), mainFontSz, white, white, white);
|
||||
|
||||
return pItem;
|
||||
}
|
||||
Tizen::Ui::Controls::ListItemBase * BookMarkSplitPanel::CreateMessageItem (float itemWidth)
|
||||
{
|
||||
CustomItem * pItem = new CustomItem();
|
||||
pItem->Construct(FloatDimension(itemWidth, messageItemHeight), LIST_ANNEX_STYLE_NORMAL);
|
||||
|
||||
FloatRectangle imgRect(itemWidth - editBtnSz - btwWdth, btwWdth, editBtnSz, editBtnSz);
|
||||
pItem->AddElement(imgRect, EDIT_BUTTON, *GetBitmap(IDB_PLACE_PAGE_EDIT_BUTTON), null, null);
|
||||
|
||||
return pItem;
|
||||
}
|
||||
|
||||
Tizen::Ui::Controls::ListItemBase * BookMarkSplitPanel::CreateItem (int index, float itemWidth)
|
||||
{
|
||||
switch(index)
|
||||
{
|
||||
case HEADER_ITEM: return CreateHeaderItem(itemWidth);
|
||||
case SETTINGS_ITEM: return CreateSettingsItem(itemWidth);
|
||||
case GROUP_ITEM: return CreateGroupItem(itemWidth);
|
||||
case MESSAGE_ITEM: return CreateMessageItem(itemWidth);
|
||||
};
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void BookMarkSplitPanel::UpdateState()
|
||||
{
|
||||
m_pLabel->SetText(GetHeaderText());
|
||||
int const listSz = IsBookMark() ? allItemsHeight : headerSettingsHeight;
|
||||
m_pList->SetSize(m_pList->GetWidth(), listSz);
|
||||
m_pList->UpdateList();
|
||||
m_pButton->SetPosition(btwWdth, listSz + btwWdth);
|
||||
m_pDummyMessageEdit->SetFocus();
|
||||
m_pMessageEdit->SetShowState(IsBookMark());
|
||||
BookMarkManager & mngr = GetBMMnger();
|
||||
if (!mngr.GetBookMarkMessage().IsEmpty())
|
||||
m_pMessageEdit->SetText(mngr.GetBookMarkMessage());
|
||||
else
|
||||
m_pMessageEdit->SetText(GetString(IDS_BOOKMARKS));
|
||||
SetDividerPosition(listSz + lstItmHght);
|
||||
Invalidate(true);
|
||||
}
|
||||
|
||||
bool BookMarkSplitPanel::DeleteItem (int index, Tizen::Ui::Controls::ListItemBase * pItem, float itemWidth)
|
||||
{
|
||||
delete pItem;
|
||||
pItem = null;
|
||||
return true;
|
||||
}
|
||||
int BookMarkSplitPanel::GetItemCount(void)
|
||||
{
|
||||
return IsBookMark() ? 4 : 2;
|
||||
}
|
||||
// IListViewItemEventListener
|
||||
void BookMarkSplitPanel::OnListViewItemStateChanged(Tizen::Ui::Controls::ListView & listView, int index, int elementId, Tizen::Ui::Controls::ListItemStatus status)
|
||||
{
|
||||
if (index == HEADER_ITEM && elementId == STAR_BUTTON)
|
||||
{
|
||||
BookMarkManager & mngr = GetBMMnger();
|
||||
if (IsBookMark())
|
||||
{
|
||||
mngr.RemoveCurBookMark();
|
||||
}
|
||||
else
|
||||
{
|
||||
mngr.AddCurMarkToBookMarks();
|
||||
}
|
||||
}
|
||||
if (index == GROUP_ITEM)
|
||||
{
|
||||
SceneManager * pSceneManager = SceneManager::GetInstance();
|
||||
pSceneManager->GoForward(ForwardSceneTransition(SCENE_SELECT_BM_CATEGORY,
|
||||
SCENE_TRANSITION_ANIMATION_TYPE_LEFT, SCENE_HISTORY_OPTION_ADD_HISTORY, SCENE_DESTROY_OPTION_KEEP));
|
||||
}
|
||||
if (index == SETTINGS_ITEM && elementId == COLOR_IMG)
|
||||
{
|
||||
SceneManager * pSceneManager = SceneManager::GetInstance();
|
||||
pSceneManager->GoForward(ForwardSceneTransition(SCENE_SELECT_COLOR,
|
||||
SCENE_TRANSITION_ANIMATION_TYPE_LEFT, SCENE_HISTORY_OPTION_ADD_HISTORY, SCENE_DESTROY_OPTION_KEEP));
|
||||
}
|
||||
|
||||
UpdateState();
|
||||
}
|
||||
|
||||
Tizen::Base::String BookMarkSplitPanel::GetHeaderText() const
|
||||
{
|
||||
String res = GetMarkName(GetCurMark());
|
||||
res.Append("\n");
|
||||
res.Append(GetMarkType(GetCurMark()));
|
||||
return res;
|
||||
}
|
||||
|
||||
Tizen::Base::String BookMarkSplitPanel::GetDistanceText() const
|
||||
{
|
||||
return GetDistance(GetCurMark());
|
||||
}
|
||||
|
||||
Tizen::Base::String BookMarkSplitPanel::GetCountryText() const
|
||||
{
|
||||
return GetMarkCountry(GetCurMark());
|
||||
}
|
||||
|
||||
Tizen::Base::String BookMarkSplitPanel::GetLocationText() const
|
||||
{
|
||||
if (!GetCurMark())
|
||||
return "";
|
||||
double lat, lon;
|
||||
GetCurMark()->GetLatLon(lat, lon);
|
||||
ostringstream os;
|
||||
os << std::fixed;
|
||||
os << std::setprecision(7);
|
||||
os << lat << ", " << lon;
|
||||
return os.str().c_str();
|
||||
}
|
||||
|
||||
Tizen::Base::String BookMarkSplitPanel::GetGroupText() const
|
||||
{
|
||||
return GetBMMnger().GetCurrentCategoryName();
|
||||
}
|
||||
|
||||
Tizen::Base::String BookMarkSplitPanel::GetMessageText() const
|
||||
{
|
||||
return GetBMMnger().GetBookMarkMessage();
|
||||
}
|
||||
|
||||
bool BookMarkSplitPanel::IsBookMark() const
|
||||
{
|
||||
return bookmark::IsBookMark(GetCurMark());
|
||||
}
|
||||
|
||||
UserMark const * BookMarkSplitPanel::GetCurMark() const
|
||||
{
|
||||
return GetBMMnger().GetCurMark();
|
||||
}
|
||||
|
||||
void BookMarkSplitPanel::OnTextValueChangeCanceled (Tizen::Ui::Control const & source)
|
||||
{
|
||||
UpdateState();
|
||||
}
|
||||
|
||||
void BookMarkSplitPanel::OnTextValueChanged (Tizen::Ui::Control const & source)
|
||||
{
|
||||
GetBMMnger().SetBookMarkMessage(m_pMessageEdit->GetText());
|
||||
UpdateState();
|
||||
}
|
211
tizen/MapsWithMe/src/CategoryForm.cpp
Normal file
211
tizen/MapsWithMe/src/CategoryForm.cpp
Normal file
|
@ -0,0 +1,211 @@
|
|||
#include "CategoryForm.hpp"
|
||||
#include "SceneRegister.hpp"
|
||||
#include "MapsWithMeForm.hpp"
|
||||
#include "AppResourceId.h"
|
||||
#include "Utils.hpp"
|
||||
#include "Framework.hpp"
|
||||
#include "Constants.hpp"
|
||||
#include "BookMarkUtils.hpp"
|
||||
#include "../../../map/framework.hpp"
|
||||
#include "../../../platform/settings.hpp"
|
||||
#include "../../../platform/tizen_utils.hpp"
|
||||
#include "../../../base/logging.hpp"
|
||||
|
||||
using namespace Tizen::Base;
|
||||
using namespace Tizen::Ui::Controls;
|
||||
using namespace Tizen::Ui::Scenes;
|
||||
using namespace Tizen::Graphics;
|
||||
using namespace consts;
|
||||
using namespace bookmark;
|
||||
|
||||
CategoryForm::CategoryForm()
|
||||
{
|
||||
}
|
||||
|
||||
CategoryForm::~CategoryForm(void)
|
||||
{
|
||||
}
|
||||
|
||||
bool CategoryForm::Initialize(void)
|
||||
{
|
||||
Construct(IDF_CATEGORY_FORM);
|
||||
return true;
|
||||
}
|
||||
|
||||
result CategoryForm::OnInitializing(void)
|
||||
{
|
||||
m_bEditState = false;
|
||||
m_itemToDelete = -1;
|
||||
m_curCategory = -1;
|
||||
|
||||
ListView * pList = static_cast<ListView *>(GetControl(IDC_LISTVIEW, true));
|
||||
pList->SetItemProvider(*this);
|
||||
pList->AddListViewItemEventListener(*this);
|
||||
GetHeader()->AddActionEventListener(*this);
|
||||
|
||||
EditField * pEditName = static_cast<EditField *>(GetControl(IDC_EDITFIELD_NAME, true));
|
||||
pEditName->AddTextEventListener(*this);
|
||||
|
||||
SetFormBackEventListener(this);
|
||||
UpdateState();
|
||||
return E_SUCCESS;
|
||||
}
|
||||
|
||||
void CategoryForm::OnActionPerformed(Tizen::Ui::Control const & source, int actionId)
|
||||
{
|
||||
BookMarkManager & mngr = GetBMMnger();
|
||||
switch(actionId)
|
||||
{
|
||||
case ID_EDIT:
|
||||
{
|
||||
m_bEditState = !m_bEditState;
|
||||
m_itemToDelete = -1;
|
||||
UpdateState();
|
||||
break;
|
||||
}
|
||||
case ID_VISIBILITY_ON:
|
||||
{
|
||||
mngr.SetCategoryVisible(m_curCategory, true);
|
||||
break;
|
||||
}
|
||||
case ID_VISIBILITY_OFF:
|
||||
{
|
||||
mngr.SetCategoryVisible(m_curCategory, false);
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
Invalidate(true);
|
||||
}
|
||||
|
||||
void CategoryForm::OnFormBackRequested(Tizen::Ui::Controls::Form & source)
|
||||
{
|
||||
SceneManager * pSceneManager = SceneManager::GetInstance();
|
||||
pSceneManager->GoBackward(BackwardSceneTransition(SCENE_TRANSITION_ANIMATION_TYPE_RIGHT));
|
||||
}
|
||||
|
||||
ListItemBase * CategoryForm::CreateItem (int index, float itemWidth)
|
||||
{
|
||||
Bookmark const * pBMark = GetBMMnger().GetBookMark(m_curCategory, index);
|
||||
String itemText = pBMark->GetName().c_str();
|
||||
CustomItem * pItem = new CustomItem();
|
||||
|
||||
pItem->Construct(FloatDimension(itemWidth, lstItmHght), LIST_ANNEX_STYLE_NORMAL);
|
||||
|
||||
int addWdth = 0;
|
||||
bool bShowDelete = index == m_itemToDelete;
|
||||
if (m_bEditState)
|
||||
{
|
||||
FloatRectangle imgRect(btwWdth, topHght, imgWdth, imgHght);
|
||||
if (bShowDelete)
|
||||
pItem->AddElement(imgRect, ID_DELETE, *GetBitmap(IDB_BOOKMARK_DELETE_CUR), null, null);
|
||||
else
|
||||
pItem->AddElement(imgRect, ID_DELETE, *GetBitmap(IDB_BOOKMARK_DELETE), null, null);
|
||||
addWdth = btwWdth + imgWdth;
|
||||
}
|
||||
|
||||
FloatRectangle imgRect(addWdth + btwWdth, topHght, imgWdth, imgHght);
|
||||
EColor color = fromstringToColor(pBMark->GetType());
|
||||
pItem->AddElement(imgRect, ID_COLOR, *GetBitmap(GetColorBM(color)), null, null);
|
||||
int beg = addWdth + btwWdth + imgWdth + btwWdth;
|
||||
int end = 2 * btwWdth + (bShowDelete ? deleteWidth : distanceWidth);
|
||||
pItem->AddElement(FloatRectangle(beg, topHght, itemWidth - beg - end, imgHght), ID_NAME, itemText, mainFontSz, gray, gray, gray);
|
||||
if (bShowDelete)
|
||||
{
|
||||
pItem->AddElement(FloatRectangle(itemWidth - end + btwWdth, topHght, deleteWidth, imgHght), ID_DELETE_TXT, GetString(IDS_DELETE), mainFontSz, red, red, red);
|
||||
}
|
||||
else
|
||||
{
|
||||
String dst = GetDistance(pBMark);
|
||||
pItem->AddElement(FloatRectangle(itemWidth - btwWdth - distanceWidth, topHght, distanceWidth, imgHght), ID_DISTANCE, dst, mainFontSz, gray, gray, gray);
|
||||
}
|
||||
|
||||
return pItem;
|
||||
}
|
||||
|
||||
void CategoryForm::OnListViewItemStateChanged(Tizen::Ui::Controls::ListView & listView, int index, int elementId, Tizen::Ui::Controls::ListItemStatus status)
|
||||
{
|
||||
BookMarkManager & mngr = GetBMMnger();
|
||||
if (elementId == ID_DELETE)
|
||||
{
|
||||
if (m_itemToDelete == index)
|
||||
m_itemToDelete = -1;
|
||||
else
|
||||
m_itemToDelete = index;
|
||||
}
|
||||
if (elementId == ID_DELETE_TXT)
|
||||
{
|
||||
mngr.DeleteBookMark(m_curCategory, index);
|
||||
m_itemToDelete = -1;
|
||||
}
|
||||
if (elementId == ID_NAME || elementId == ID_DISTANCE)
|
||||
{
|
||||
mngr.ShowBookMark(m_curCategory, index);
|
||||
SceneManager * pSceneManager = SceneManager::GetInstance();
|
||||
pSceneManager->ClearSceneHistory();
|
||||
pSceneManager->GoForward(ForwardSceneTransition(SCENE_MAP,
|
||||
SCENE_TRANSITION_ANIMATION_TYPE_RIGHT, SCENE_HISTORY_OPTION_NO_HISTORY, SCENE_DESTROY_OPTION_DESTROY));
|
||||
}
|
||||
UpdateState();
|
||||
}
|
||||
|
||||
void CategoryForm::UpdateState()
|
||||
{
|
||||
BookMarkManager & mngr = GetBMMnger();
|
||||
ListView * pList = static_cast<ListView *>(GetControl(IDC_LISTVIEW, true));
|
||||
pList->SetSize(pList->GetWidth(), GetItemCount() * lstItmHght);
|
||||
pList->UpdateList();
|
||||
|
||||
CheckButton * pShowOnOffCB = static_cast<CheckButton *>(GetControl(IDC_CHECKBUTTON_SHOW_ON_MAP, true));
|
||||
pShowOnOffCB->SetSelected(mngr.IsCategoryVisible(m_curCategory));
|
||||
pShowOnOffCB->SetActionId(ID_VISIBILITY_ON, ID_VISIBILITY_OFF);
|
||||
pShowOnOffCB->AddActionEventListener(*this);
|
||||
|
||||
EditField * pEditName = static_cast<EditField *>(GetControl(IDC_EDITFIELD_NAME, true));
|
||||
pEditName->SetText(mngr.GetCategoryName(m_curCategory));
|
||||
GetHeader()->SetTitleText(mngr.GetCategoryName(m_curCategory));
|
||||
Header* pHeader = GetHeader();
|
||||
|
||||
ButtonItem buttonItem;
|
||||
buttonItem.Construct(BUTTON_ITEM_STYLE_TEXT, ID_EDIT);
|
||||
buttonItem.SetText(m_bEditState ? GetString(IDS_DONE): GetString(IDS_EDIT));
|
||||
|
||||
pHeader->SetButton(BUTTON_POSITION_RIGHT, buttonItem);
|
||||
Invalidate(true);
|
||||
}
|
||||
|
||||
void CategoryForm::OnTextValueChanged (Tizen::Ui::Control const & source)
|
||||
{
|
||||
EditField * pEditName = static_cast<EditField *>(GetControl(IDC_EDITFIELD_NAME, true));
|
||||
GetBMMnger().SetCategoryName(m_curCategory, pEditName->GetText());
|
||||
UpdateState();
|
||||
}
|
||||
|
||||
bool CategoryForm::DeleteItem (int index, Tizen::Ui::Controls::ListItemBase * pItem, float itemWidth)
|
||||
{
|
||||
delete pItem;
|
||||
return true;
|
||||
}
|
||||
|
||||
int CategoryForm::GetItemCount(void)
|
||||
{
|
||||
if (m_curCategory < 0)
|
||||
return 0;
|
||||
return GetFramework()->GetBmCategory(m_curCategory)->GetBookmarksCount();
|
||||
}
|
||||
|
||||
void CategoryForm::OnSceneActivatedN(const Tizen::Ui::Scenes::SceneId& previousSceneId,
|
||||
const Tizen::Ui::Scenes::SceneId& currentSceneId, Tizen::Base::Collection::IList* pArgs)
|
||||
{
|
||||
m_curCategory = -1;
|
||||
if (pArgs != null)
|
||||
{
|
||||
if (pArgs->GetCount() == 1)
|
||||
{
|
||||
Integer * pCategoryIndex = dynamic_cast<Integer *>(pArgs->GetAt(0));
|
||||
m_curCategory = pCategoryIndex->value;
|
||||
}
|
||||
}
|
||||
|
||||
UpdateState();
|
||||
}
|
|
@ -5,15 +5,21 @@
|
|||
#include "AppResourceId.h"
|
||||
|
||||
#include "../../../map/framework.hpp"
|
||||
#include "../../../map/balloon_manager.hpp"
|
||||
#include "../../../gui/controller.hpp"
|
||||
#include "../../../platform/tizen_utils.hpp"
|
||||
#include "../../../platform/settings.hpp"
|
||||
#include "../../../std/bind.hpp"
|
||||
|
||||
#include <FUi.h>
|
||||
#include <FBase.h>
|
||||
#include <FMedia.h>
|
||||
#include <FGraphics.h>
|
||||
#include "Utils.hpp"
|
||||
#include "Constants.hpp"
|
||||
#include "UserMarkPanel.hpp"
|
||||
#include "BookMarkSplitPanel.hpp"
|
||||
#include "BookMarkUtils.hpp"
|
||||
|
||||
using namespace Tizen::Ui;
|
||||
using namespace Tizen::Ui::Controls;
|
||||
|
@ -25,9 +31,12 @@ using namespace Tizen::Base::Collection;
|
|||
using namespace Tizen::Base::Utility;
|
||||
using namespace Tizen::Locations;
|
||||
using namespace Tizen::App;
|
||||
using namespace consts;
|
||||
|
||||
MapsWithMeForm::MapsWithMeForm()
|
||||
:m_pLocProvider(0),
|
||||
m_userMarkPanel(0),
|
||||
m_bookMarkSplitPanel(0),
|
||||
m_pFramework(0)
|
||||
{
|
||||
SetMultipointTouchEnabled(true);
|
||||
|
@ -83,12 +92,26 @@ result MapsWithMeForm::OnInitializing(void)
|
|||
m_pButtonScaleMinus->SetActionId(ID_BUTTON_SCALE_MINUS);
|
||||
m_pButtonScaleMinus->AddActionEventListener(*this);
|
||||
|
||||
UpdateButtons();
|
||||
m_locationEnabled = false;
|
||||
|
||||
SetFormBackEventListener(this);
|
||||
|
||||
CreateBookMarkPanel();
|
||||
CreateSplitPanel();
|
||||
CreateBookMarkSplitPanel();
|
||||
|
||||
HideSplitPanel();
|
||||
HideBookMarkPanel();
|
||||
HideBookMarkSplitPanel();
|
||||
|
||||
|
||||
m_pFramework = new tizen::Framework(this);
|
||||
PinClickManager & pinManager = m_pFramework->GetInstance()->GetBalloonManager();
|
||||
pinManager.ConnectUserMarkListener(bind(&MapsWithMeForm::OnUserMark, this, _1));
|
||||
pinManager.ConnectDismissListener(bind(&MapsWithMeForm::OnDismissListener, this));
|
||||
|
||||
UpdateButtons();
|
||||
|
||||
return E_SUCCESS;
|
||||
}
|
||||
|
||||
|
@ -132,6 +155,9 @@ void MapsWithMeForm::OnActionPerformed(Tizen::Ui::Control const & source, int ac
|
|||
break;
|
||||
case ID_STAR:
|
||||
{
|
||||
SceneManager * pSceneManager = SceneManager::GetInstance();
|
||||
pSceneManager->GoForward(ForwardSceneTransition(SCENE_BMCATEGORIES,
|
||||
SCENE_TRANSITION_ANIMATION_TYPE_LEFT, SCENE_HISTORY_OPTION_ADD_HISTORY, SCENE_DESTROY_OPTION_KEEP));
|
||||
break;
|
||||
}
|
||||
case ID_MENU:
|
||||
|
@ -192,6 +218,7 @@ TPointPairs GetTouchedPoints(Rectangle const & rect)
|
|||
}
|
||||
}
|
||||
using namespace detail;
|
||||
using bookmark::BookMarkManager;
|
||||
|
||||
void MapsWithMeForm::OnLocationUpdated(const Tizen::Locations::Location& location)
|
||||
{
|
||||
|
@ -251,15 +278,18 @@ void MapsWithMeForm::OnTouchPressed(Tizen::Ui::Control const & source,
|
|||
Point const & currentPosition,
|
||||
Tizen::Ui::TouchEventInfo const & touchInfo)
|
||||
{
|
||||
if (&source == m_pFirstPanel)
|
||||
if (m_splitPanelEnabled)
|
||||
{
|
||||
HideSplitPanel();
|
||||
}
|
||||
else
|
||||
{
|
||||
m_wasLongPress = false;
|
||||
TPointPairs pts = detail::GetTouchedPoints(GetClientAreaBounds());
|
||||
|
||||
::Framework * pFramework = tizen::Framework::GetInstance();
|
||||
// pFramework->GetBalloonManager().OnShowMark(pFramework->GetUserMark(m2::PointD(pts[0].first, pts[0].second), false));
|
||||
|
||||
m_startTouchPoint = make_pair(pts[0].first, pts[0].second);
|
||||
if (!pFramework->GetGuiController()->OnTapStarted(m2::PointD(pts[0].first, pts[0].second)))
|
||||
{
|
||||
if (pts.size() == 1)
|
||||
|
@ -272,6 +302,32 @@ void MapsWithMeForm::OnTouchPressed(Tizen::Ui::Control const & source,
|
|||
}
|
||||
}
|
||||
|
||||
void MapsWithMeForm::OnUserMark(UserMarkCopy * pCopy)
|
||||
{
|
||||
BookMarkManager::GetInstance().ActivateBookMark(pCopy);
|
||||
ShowBookMarkPanel();
|
||||
}
|
||||
|
||||
void MapsWithMeForm::OnDismissListener()
|
||||
{
|
||||
LOG(LINFO, ("OnDismissListener"));
|
||||
HideBookMarkPanel();
|
||||
GetFramework()->ActivateUserMark(0);
|
||||
}
|
||||
|
||||
void MapsWithMeForm::OnTouchLongPressed(Tizen::Ui::Control const & source,
|
||||
Tizen::Graphics::Point const & currentPosition,
|
||||
Tizen::Ui::TouchEventInfo const & touchInfo)
|
||||
{
|
||||
m_wasLongPress = true;
|
||||
TPointPairs pts = detail::GetTouchedPoints(GetClientAreaBounds());
|
||||
if (pts.size() > 0)
|
||||
{
|
||||
::Framework * pFramework = tizen::Framework::GetInstance();
|
||||
pFramework->GetBalloonManager().OnShowMark(pFramework->GetUserMark(m2::PointD(pts[0].first, pts[0].second), true));
|
||||
}
|
||||
}
|
||||
|
||||
void MapsWithMeForm::OnTouchMoved(Tizen::Ui::Control const & source,
|
||||
Point const & currentPosition,
|
||||
Tizen::Ui::TouchEventInfo const & touchInfo)
|
||||
|
@ -314,9 +370,17 @@ void MapsWithMeForm::OnTouchReleased(Tizen::Ui::Control const & source,
|
|||
TPointPairs pts = detail::GetTouchedPoints(GetClientAreaBounds());
|
||||
::Framework * pFramework = tizen::Framework::GetInstance();
|
||||
|
||||
|
||||
//using prev_pts because pts contains not all points
|
||||
if (!m_prev_pts.empty())
|
||||
{
|
||||
pair<double, double> cur = make_pair(m_prev_pts[0].first, m_prev_pts[0].second);
|
||||
double dist = sqrt(pow(cur.first - m_startTouchPoint.first, 2) + pow(cur.second - m_startTouchPoint.second, 2));
|
||||
if (dist < 20 && !m_wasLongPress)
|
||||
{
|
||||
::Framework * pFramework = tizen::Framework::GetInstance();
|
||||
pFramework->GetBalloonManager().OnShowMark(pFramework->GetUserMark(m2::PointD(m_startTouchPoint.first, m_startTouchPoint.second), false));
|
||||
}
|
||||
if (!pFramework->GetGuiController()->OnTapEnded(m2::PointD(m_prev_pts[0].first, m_prev_pts[0].second)))
|
||||
{
|
||||
if (m_prev_pts.size() == 1)
|
||||
|
@ -340,7 +404,7 @@ void MapsWithMeForm::OnTouchFocusOut(Tizen::Ui::Control const & source,
|
|||
{
|
||||
}
|
||||
|
||||
void MapsWithMeForm::ShowSplitPanel()
|
||||
void MapsWithMeForm::CreateSplitPanel()
|
||||
{
|
||||
m_pSplitPanel = new SplitPanel();
|
||||
SetActionBarsVisible(FORM_ACTION_BAR_FOOTER, false);
|
||||
|
@ -356,7 +420,7 @@ void MapsWithMeForm::ShowSplitPanel()
|
|||
|
||||
m_pSecondPanel = new Panel();
|
||||
m_pSecondPanel->Construct(rect);
|
||||
m_pSecondPanel->SetBackgroundColor(Color::GetColor(COLOR_ID_BLUE));
|
||||
m_pSecondPanel->SetBackgroundColor(mainMenuGray);
|
||||
|
||||
m_pSplitPanel->SetDividerPosition(rect.height - 112 * GetItemCount());
|
||||
m_pSplitPanel->SetPane(m_pFirstPanel, SPLIT_PANEL_PANE_ORDER_FIRST);
|
||||
|
@ -371,23 +435,95 @@ void MapsWithMeForm::ShowSplitPanel()
|
|||
AddControl(m_pSplitPanel);
|
||||
}
|
||||
|
||||
void MapsWithMeForm::ShowSplitPanel()
|
||||
{
|
||||
m_splitPanelEnabled = true;
|
||||
SetActionBarsVisible(FORM_ACTION_BAR_FOOTER, false);
|
||||
m_pSplitPanel->SetShowState(true);
|
||||
UpdateButtons();
|
||||
}
|
||||
|
||||
void MapsWithMeForm::HideSplitPanel()
|
||||
{
|
||||
if (m_pSplitPanel)
|
||||
{
|
||||
RemoveControl(m_pSplitPanel);
|
||||
SetActionBarsVisible(FORM_ACTION_BAR_FOOTER, true);
|
||||
m_pSplitPanel = 0;
|
||||
}
|
||||
m_splitPanelEnabled = false;
|
||||
m_pSplitPanel->SetShowState(false);
|
||||
SetActionBarsVisible(FORM_ACTION_BAR_FOOTER, true);
|
||||
UpdateButtons();
|
||||
}
|
||||
|
||||
void MapsWithMeForm::CreateBookMarkPanel()
|
||||
{
|
||||
m_userMarkPanel = new UserMarkPanel();
|
||||
FloatRectangle rect = GetClientAreaBoundsF();
|
||||
rect.height = markPanelHeight;
|
||||
rect.y = 0;
|
||||
m_userMarkPanel->Construct(rect);
|
||||
m_userMarkPanel->SetMainForm(this);
|
||||
m_userMarkPanel->Enable();
|
||||
AddControl(m_userMarkPanel);
|
||||
}
|
||||
|
||||
void MapsWithMeForm::ShowBookMarkPanel()
|
||||
{
|
||||
m_bookMarkPanelEnabled = true;
|
||||
m_userMarkPanel->Enable();
|
||||
}
|
||||
|
||||
void MapsWithMeForm::HideBookMarkPanel()
|
||||
{
|
||||
m_bookMarkPanelEnabled = false;
|
||||
m_userMarkPanel->Disable();
|
||||
}
|
||||
|
||||
void MapsWithMeForm::CreateBookMarkSplitPanel()
|
||||
{
|
||||
SetActionBarsVisible(FORM_ACTION_BAR_FOOTER, false);
|
||||
m_bookMarkSplitPanel = new BookMarkSplitPanel();
|
||||
FloatRectangle rect = GetClientAreaBoundsF();
|
||||
rect.y = 0;
|
||||
m_bookMarkSplitPanel->Construct(rect);
|
||||
m_bookMarkSplitPanel->SetMainForm(this);
|
||||
m_bookMarkSplitPanel->Enable();
|
||||
AddControl(m_bookMarkSplitPanel);
|
||||
}
|
||||
|
||||
void MapsWithMeForm::ShowBookMarkSplitPanel()
|
||||
{
|
||||
HideBookMarkPanel();
|
||||
m_bookMArkSplitPanelEnabled = true;
|
||||
m_bookMarkSplitPanel->Enable();
|
||||
SetActionBarsVisible(FORM_ACTION_BAR_FOOTER, false);
|
||||
UpdateButtons();
|
||||
}
|
||||
|
||||
void MapsWithMeForm::HideBookMarkSplitPanel()
|
||||
{
|
||||
m_bookMArkSplitPanelEnabled = false;
|
||||
m_bookMarkSplitPanel->Disable();
|
||||
SetActionBarsVisible(FORM_ACTION_BAR_FOOTER, true);
|
||||
UpdateButtons();
|
||||
}
|
||||
|
||||
void MapsWithMeForm::UpdateBookMarkSplitPanelState()
|
||||
{
|
||||
m_bookMarkSplitPanel->UpdateState();
|
||||
}
|
||||
|
||||
void MapsWithMeForm::OnFormBackRequested(Form& source)
|
||||
{
|
||||
if (m_pSplitPanel)
|
||||
if (m_splitPanelEnabled)
|
||||
{
|
||||
HideSplitPanel();
|
||||
}
|
||||
else if (m_bookMarkPanelEnabled)
|
||||
{
|
||||
HideBookMarkPanel();
|
||||
}
|
||||
else if (m_bookMArkSplitPanelEnabled)
|
||||
{
|
||||
HideBookMarkSplitPanel();
|
||||
ShowBookMarkPanel();
|
||||
}
|
||||
else
|
||||
{
|
||||
UiApp * pApp = UiApp::GetInstance();
|
||||
|
@ -410,6 +546,8 @@ void MapsWithMeForm::UpdateButtons()
|
|||
footerItem.Construct(ID_GPS);
|
||||
footerItem.SetIcon(FOOTER_ITEM_STATUS_NORMAL, GetBitmap(m_locationEnabled ? IDB_MY_POSITION_PRESSED : IDB_MY_POSITION_NORMAL));
|
||||
pFooter->SetItemAt (0, footerItem);
|
||||
UpdateBookMarkSplitPanelState();
|
||||
|
||||
Invalidate(true);
|
||||
}
|
||||
|
||||
|
@ -423,13 +561,13 @@ ListItemBase * MapsWithMeForm::CreateItem (int index, float itemWidth)
|
|||
FloatRectangle const rectImg(20.0f, 27.0f, 60, 60.0f);
|
||||
FloatRectangle const rectTxt(100, 25, 650, 50);
|
||||
|
||||
int fontSize = 34;
|
||||
int fontSize = mediumFontSz;
|
||||
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 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);
|
||||
|
@ -457,23 +595,18 @@ bool MapsWithMeForm::DeleteItem (int index, ListItemBase * pItem, float itemWid
|
|||
|
||||
int MapsWithMeForm::GetItemCount(void)
|
||||
{
|
||||
return 4;
|
||||
}
|
||||
|
||||
void MapsWithMeForm::OnListViewContextItemStateChanged(ListView & listView, int index, int elementId, ListContextItemStatus state)
|
||||
{
|
||||
|
||||
return 3;
|
||||
}
|
||||
|
||||
void MapsWithMeForm::OnListViewItemStateChanged(ListView & listView, int index, int elementId, ListItemStatus status)
|
||||
{
|
||||
switch (index)
|
||||
{
|
||||
case eDownloadProVer:
|
||||
{
|
||||
|
||||
}
|
||||
break;
|
||||
// case eDownloadProVer:
|
||||
// {
|
||||
//
|
||||
// }
|
||||
// break;
|
||||
case eDownloadMaps:
|
||||
{
|
||||
HideSplitPanel();
|
||||
|
@ -505,12 +638,11 @@ void MapsWithMeForm::OnListViewItemStateChanged(ListView & listView, int index,
|
|||
}
|
||||
}
|
||||
|
||||
void MapsWithMeForm::OnListViewItemSwept(ListView & listView, int index, SweepDirection direction)
|
||||
void MapsWithMeForm::OnSceneActivatedN(const Tizen::Ui::Scenes::SceneId& previousSceneId,
|
||||
const Tizen::Ui::Scenes::SceneId& currentSceneId, Tizen::Base::Collection::IList* pArgs)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void MapsWithMeForm::OnListViewItemLongPressed(ListView & listView, int index, int elementId, bool & invokeListViewItemCallback)
|
||||
{
|
||||
|
||||
if (currentSceneId == SceneManager::GetInstance()->GetCurrentScene()->GetSceneId())
|
||||
{
|
||||
UpdateButtons();
|
||||
}
|
||||
}
|
||||
|
|
102
tizen/MapsWithMe/src/SelectBMCategoryForm.cpp
Normal file
102
tizen/MapsWithMe/src/SelectBMCategoryForm.cpp
Normal file
|
@ -0,0 +1,102 @@
|
|||
#include "SelectBMCategoryForm.hpp"
|
||||
#include "SceneRegister.hpp"
|
||||
#include "MapsWithMeForm.hpp"
|
||||
#include "AppResourceId.h"
|
||||
#include "Utils.hpp"
|
||||
#include "Constants.hpp"
|
||||
#include "BookMarkUtils.hpp"
|
||||
#include "../../../map/framework.hpp"
|
||||
#include "../../../platform/settings.hpp"
|
||||
#include "../../../platform/tizen_utils.hpp"
|
||||
#include "../../../base/logging.hpp"
|
||||
|
||||
using namespace Tizen::Base;
|
||||
using namespace Tizen::Ui::Controls;
|
||||
using namespace Tizen::Ui::Scenes;
|
||||
using namespace Tizen::Graphics;
|
||||
using namespace consts;
|
||||
using namespace bookmark;
|
||||
|
||||
SelectBMCategoryForm::SelectBMCategoryForm()
|
||||
{
|
||||
}
|
||||
|
||||
SelectBMCategoryForm::~SelectBMCategoryForm(void)
|
||||
{
|
||||
}
|
||||
|
||||
bool SelectBMCategoryForm::Initialize(void)
|
||||
{
|
||||
Construct(IDF_SELECT_BM_CATEGORY_FORM);
|
||||
return true;
|
||||
}
|
||||
|
||||
result SelectBMCategoryForm::OnInitializing(void)
|
||||
{
|
||||
EditField * pEditField = static_cast<EditField*>(GetControl(IDC_EDITFIELD, true));
|
||||
pEditField->AddTextEventListener(*this);
|
||||
|
||||
ListView * pList = static_cast<ListView *>(GetControl(IDC_LISTVIEW, true));
|
||||
pList->SetItemProvider(*this);
|
||||
pList->AddListViewItemEventListener(*this);
|
||||
SetFormBackEventListener(this);
|
||||
|
||||
return E_SUCCESS;
|
||||
}
|
||||
|
||||
void SelectBMCategoryForm::OnFormBackRequested(Tizen::Ui::Controls::Form & source)
|
||||
{
|
||||
SceneManager * pSceneManager = SceneManager::GetInstance();
|
||||
pSceneManager->GoBackward(BackwardSceneTransition(SCENE_TRANSITION_ANIMATION_TYPE_RIGHT));
|
||||
}
|
||||
|
||||
ListItemBase * SelectBMCategoryForm::CreateItem(int index, float itemWidth)
|
||||
{
|
||||
String itemText = GetBMMnger().GetCategoryName(index);
|
||||
CustomItem * pItem = new CustomItem();
|
||||
|
||||
pItem->Construct(FloatDimension(itemWidth, lstItmHght), LIST_ANNEX_STYLE_NORMAL);
|
||||
FloatRectangle imgRect(btwWdth, topHght, imgWdth, imgHght);
|
||||
pItem->AddElement(FloatRectangle(btwWdth, topHght, itemWidth - 2 * btwWdth - imgWdth, imgHght), 1, itemText, mainFontSz, black, black, black);
|
||||
if(index == GetBMMnger().GetCurrentCategory())
|
||||
pItem->AddElement(FloatRectangle(itemWidth - btwWdth - imgWdth, topHght, imgWdth, imgHght), 0, *GetBitmap(IDB_V));
|
||||
|
||||
return pItem;
|
||||
}
|
||||
|
||||
void SelectBMCategoryForm::OnListViewItemStateChanged(Tizen::Ui::Controls::ListView & listView, int index, int elementId, Tizen::Ui::Controls::ListItemStatus status)
|
||||
{
|
||||
GetBMMnger().SetNewCurBookMarkCategory(index);
|
||||
SceneManager * pSceneManager = SceneManager::GetInstance();
|
||||
pSceneManager->GoBackward(BackwardSceneTransition(SCENE_TRANSITION_ANIMATION_TYPE_RIGHT));
|
||||
}
|
||||
|
||||
bool SelectBMCategoryForm::DeleteItem(int index, Tizen::Ui::Controls::ListItemBase * pItem, float itemWidth)
|
||||
{
|
||||
delete pItem;
|
||||
return true;
|
||||
}
|
||||
|
||||
int SelectBMCategoryForm::GetItemCount(void)
|
||||
{
|
||||
return GetBMMnger().GetCategoriesCount();
|
||||
}
|
||||
|
||||
void SelectBMCategoryForm::OnTextValueChangeCanceled(Tizen::Ui::Control const & source)
|
||||
{
|
||||
EditField * pEditField = static_cast<EditField *>(GetControl(IDC_EDITFIELD, true));
|
||||
pEditField->SetText("");
|
||||
Invalidate(true);
|
||||
}
|
||||
|
||||
void SelectBMCategoryForm::OnTextValueChanged(Tizen::Ui::Control const & source)
|
||||
{
|
||||
EditField * pEditField = static_cast<EditField *>(GetControl(IDC_EDITFIELD, true));
|
||||
int iNewCat = GetBMMnger().AddCategory(pEditField->GetText());
|
||||
if (iNewCat >= 0)
|
||||
GetBMMnger().SetNewCurBookMarkCategory(iNewCat);
|
||||
pEditField->SetText("");
|
||||
ListView * pList = static_cast<ListView *>(GetControl(IDC_LISTVIEW, true));
|
||||
pList->UpdateList();
|
||||
Invalidate(true);
|
||||
}
|
105
tizen/MapsWithMe/src/SelectColorForm.cpp
Normal file
105
tizen/MapsWithMe/src/SelectColorForm.cpp
Normal file
|
@ -0,0 +1,105 @@
|
|||
#include "SelectColorForm.hpp"
|
||||
#include "SceneRegister.hpp"
|
||||
#include "MapsWithMeForm.hpp"
|
||||
#include "AppResourceId.h"
|
||||
#include "Utils.hpp"
|
||||
#include "BookMarkUtils.hpp"
|
||||
|
||||
#include "../../../base/logging.hpp"
|
||||
#include "../../../platform/settings.hpp"
|
||||
#include "../../../platform/tizen_utils.hpp"
|
||||
|
||||
using namespace Tizen::Base;
|
||||
using namespace Tizen::Ui::Controls;
|
||||
using namespace Tizen::Ui::Scenes;
|
||||
using namespace bookmark;
|
||||
|
||||
SelectColorForm::SelectColorForm()
|
||||
{
|
||||
}
|
||||
|
||||
SelectColorForm::~SelectColorForm(void)
|
||||
{
|
||||
}
|
||||
|
||||
bool SelectColorForm::Initialize(void)
|
||||
{
|
||||
Construct(IDF_SELECT_COLOR_FORM);
|
||||
return true;
|
||||
}
|
||||
|
||||
result SelectColorForm::OnInitializing(void)
|
||||
{
|
||||
Button * pButtonRed = static_cast<Button*>(GetControl(IDC_BUTTON_RED, true));
|
||||
Button * pButtonBlue = static_cast<Button*>(GetControl(IDC_BUTTON_BLUE, true));
|
||||
Button * pButtonBrown = static_cast<Button*>(GetControl(IDC_BUTTON_BROWN, true));
|
||||
Button * pButtonGreen = static_cast<Button*>(GetControl(IDC_BUTTON_GREEN, true));
|
||||
Button * pButtonOrange = static_cast<Button*>(GetControl(IDC_BUTTON_ORANGE, true));
|
||||
Button * pButtonPink = static_cast<Button*>(GetControl(IDC_BUTTON_PINK, true));
|
||||
Button * pButtonPurple = static_cast<Button*>(GetControl(IDC_BUTTON_PURPLE, true));
|
||||
Button * pButtonYellow = static_cast<Button*>(GetControl(IDC_BUTTON_YELLOW, true));
|
||||
|
||||
pButtonRed->AddActionEventListener(*this);
|
||||
pButtonBlue->AddActionEventListener(*this);
|
||||
pButtonBrown->AddActionEventListener(*this);
|
||||
pButtonGreen->AddActionEventListener(*this);
|
||||
pButtonOrange->AddActionEventListener(*this);
|
||||
pButtonPink->AddActionEventListener(*this);
|
||||
pButtonPurple->AddActionEventListener(*this);
|
||||
pButtonYellow->AddActionEventListener(*this);
|
||||
|
||||
pButtonRed->SetActionId(ID_RED);
|
||||
pButtonBlue->SetActionId(ID_BLUE);
|
||||
pButtonBrown->SetActionId(ID_BROWN);
|
||||
pButtonGreen->SetActionId(ID_GREEN);
|
||||
pButtonOrange->SetActionId(ID_ORANGE);
|
||||
pButtonPink->SetActionId(ID_PINK);
|
||||
pButtonPurple->SetActionId(ID_PURPLE);
|
||||
pButtonYellow->SetActionId(ID_YELLOW);
|
||||
|
||||
EColor color = BookMarkManager::GetInstance().GetCurBookMarkColor();
|
||||
pButtonRed->SetNormalBackgroundBitmap(*GetBitmap(color == CLR_RED ? IDB_COLOR_SELECT_RED : IDB_COLOR_RED));
|
||||
pButtonRed->SetPressedBackgroundBitmap(*GetBitmap(color == CLR_RED ? IDB_COLOR_SELECT_RED : IDB_COLOR_RED));
|
||||
pButtonBlue->SetNormalBackgroundBitmap(*GetBitmap(color == CLR_BLUE ? IDB_COLOR_SELECT_BLUE : IDB_COLOR_BLUE));
|
||||
pButtonBlue->SetPressedBackgroundBitmap(*GetBitmap(color == CLR_BLUE ? IDB_COLOR_SELECT_BLUE : IDB_COLOR_BLUE));
|
||||
pButtonBrown->SetNormalBackgroundBitmap(*GetBitmap(color == CLR_BROWN ? IDB_COLOR_SELECT_BROWN : IDB_COLOR_BROWN));
|
||||
pButtonBrown->SetPressedBackgroundBitmap(*GetBitmap(color == CLR_BROWN ? IDB_COLOR_SELECT_BROWN : IDB_COLOR_BROWN));
|
||||
pButtonGreen->SetNormalBackgroundBitmap(*GetBitmap(color == CLR_GREEN ? IDB_COLOR_SELECT_GREEN : IDB_COLOR_GREEN));
|
||||
pButtonGreen->SetPressedBackgroundBitmap(*GetBitmap(color == CLR_GREEN ? IDB_COLOR_SELECT_GREEN : IDB_COLOR_GREEN));
|
||||
pButtonOrange->SetNormalBackgroundBitmap(*GetBitmap(color == CLR_ORANGE ? IDB_COLOR_SELECT_ORANGE : IDB_COLOR_ORANGE));
|
||||
pButtonOrange->SetPressedBackgroundBitmap(*GetBitmap(color == CLR_ORANGE ? IDB_COLOR_SELECT_ORANGE : IDB_COLOR_ORANGE));
|
||||
pButtonPink->SetNormalBackgroundBitmap(*GetBitmap(color == CLR_PINK ? IDB_COLOR_SELECT_PINK : IDB_COLOR_PINK));
|
||||
pButtonPink->SetPressedBackgroundBitmap(*GetBitmap(color == CLR_PINK ? IDB_COLOR_SELECT_PINK : IDB_COLOR_PINK));
|
||||
pButtonPurple->SetNormalBackgroundBitmap(*GetBitmap(color == CLR_PURPLE ? IDB_COLOR_SELECT_PURPLE : IDB_COLOR_PURPLE));
|
||||
pButtonPurple->SetPressedBackgroundBitmap(*GetBitmap(color == CLR_PURPLE ? IDB_COLOR_SELECT_PURPLE : IDB_COLOR_PURPLE));
|
||||
pButtonYellow->SetNormalBackgroundBitmap(*GetBitmap(color == CLR_YELLOW ? IDB_COLOR_SELECT_YELLOW : IDB_COLOR_YELLOW));
|
||||
pButtonYellow->SetPressedBackgroundBitmap(*GetBitmap(color == CLR_YELLOW ? IDB_COLOR_SELECT_YELLOW : IDB_COLOR_YELLOW));
|
||||
|
||||
|
||||
SetFormBackEventListener(this);
|
||||
return E_SUCCESS;
|
||||
}
|
||||
|
||||
void SelectColorForm::OnActionPerformed(Tizen::Ui::Control const & source, int actionId)
|
||||
{
|
||||
BookMarkManager & bm = BookMarkManager::GetInstance();
|
||||
switch(actionId)
|
||||
{
|
||||
case ID_RED: bm.SetCurBookMarkColor(CLR_RED); break;
|
||||
case ID_BLUE: bm.SetCurBookMarkColor(CLR_BLUE); break;
|
||||
case ID_BROWN: bm.SetCurBookMarkColor(CLR_BROWN); break;
|
||||
case ID_GREEN: bm.SetCurBookMarkColor(CLR_GREEN); break;
|
||||
case ID_ORANGE: bm.SetCurBookMarkColor(CLR_ORANGE); break;
|
||||
case ID_PINK: bm.SetCurBookMarkColor(CLR_PINK); break;
|
||||
case ID_PURPLE: bm.SetCurBookMarkColor(CLR_PURPLE); break;
|
||||
case ID_YELLOW: bm.SetCurBookMarkColor(CLR_YELLOW); break;
|
||||
}
|
||||
SceneManager * pSceneManager = SceneManager::GetInstance();
|
||||
pSceneManager->GoBackward(BackwardSceneTransition(SCENE_TRANSITION_ANIMATION_TYPE_RIGHT));
|
||||
}
|
||||
|
||||
void SelectColorForm::OnFormBackRequested(Tizen::Ui::Controls::Form & source)
|
||||
{
|
||||
SceneManager * pSceneManager = SceneManager::GetInstance();
|
||||
pSceneManager->GoBackward(BackwardSceneTransition(SCENE_TRANSITION_ANIMATION_TYPE_RIGHT));
|
||||
}
|
121
tizen/MapsWithMe/src/UserMarkPanel.cpp
Normal file
121
tizen/MapsWithMe/src/UserMarkPanel.cpp
Normal file
|
@ -0,0 +1,121 @@
|
|||
#include "UserMarkPanel.hpp"
|
||||
#include "SceneRegister.hpp"
|
||||
#include "MapsWithMeForm.hpp"
|
||||
#include "AppResourceId.h"
|
||||
#include "Constants.hpp"
|
||||
#include "BookMarkUtils.hpp"
|
||||
#include "Utils.hpp"
|
||||
|
||||
#include "../../../map/framework.hpp"
|
||||
#include "../../../platform/settings.hpp"
|
||||
#include "../../../platform/tizen_utils.hpp"
|
||||
#include "../../../base/logging.hpp"
|
||||
|
||||
using namespace Tizen::Base;
|
||||
using namespace Tizen::Ui::Controls;
|
||||
using namespace Tizen::Ui::Scenes;
|
||||
using namespace Tizen::Graphics;
|
||||
using namespace consts;
|
||||
using namespace bookmark;
|
||||
|
||||
UserMarkPanel::UserMarkPanel()
|
||||
:m_pMainForm(0)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
UserMarkPanel::~UserMarkPanel(void)
|
||||
{
|
||||
}
|
||||
|
||||
bool UserMarkPanel::Construct(const Tizen::Graphics::FloatRectangle& rect)
|
||||
{
|
||||
Panel::Construct(rect);
|
||||
SetBackgroundColor(green);
|
||||
m_pButton = new Button;
|
||||
m_pButton->Construct(FloatRectangle(rect.width - btnSz - btwWdth, btwWdth, btnSz, btnSz));
|
||||
|
||||
m_pButton->SetActionId(ID_STAR);
|
||||
m_pButton->AddActionEventListener(*this);
|
||||
AddControl(m_pButton);
|
||||
|
||||
m_pLabel = new Label();
|
||||
m_pLabel->Construct(Rectangle(btwWdth, btwWdth, rect.width - 2 * btnSz - btwWdth, markPanelHeight - 2 * btwWdth), "");
|
||||
m_pLabel->SetTextColor(white);
|
||||
m_pLabel->AddTouchEventListener(*this);
|
||||
m_pLabel->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
|
||||
m_pLabel->SetTextVerticalAlignment(ALIGNMENT_TOP);
|
||||
AddControl(m_pLabel);
|
||||
|
||||
UpdateState();
|
||||
return true;
|
||||
}
|
||||
|
||||
void UserMarkPanel::SetMainForm(MapsWithMeForm * pMainForm)
|
||||
{
|
||||
m_pMainForm = pMainForm;
|
||||
}
|
||||
|
||||
void UserMarkPanel::OnTouchPressed (Tizen::Ui::Control const & source,
|
||||
Tizen::Graphics::Point const & currentPosition,
|
||||
Tizen::Ui::TouchEventInfo const & touchInfo)
|
||||
{
|
||||
if (m_pMainForm)
|
||||
m_pMainForm->ShowBookMarkSplitPanel();
|
||||
}
|
||||
|
||||
void UserMarkPanel::Enable()
|
||||
{
|
||||
String res = GetMarkName(GetCurMark());
|
||||
res.Append("\n");
|
||||
res.Append(GetMarkType(GetCurMark()));
|
||||
m_pLabel->SetText(res);
|
||||
SetShowState(true);
|
||||
UpdateState();
|
||||
Invalidate(true);
|
||||
}
|
||||
|
||||
void UserMarkPanel::Disable()
|
||||
{
|
||||
SetShowState(false);
|
||||
}
|
||||
|
||||
void UserMarkPanel::OnActionPerformed(Tizen::Ui::Control const & source, int actionId)
|
||||
{
|
||||
switch(actionId)
|
||||
{
|
||||
case ID_STAR:
|
||||
{
|
||||
if (IsBookMark(GetCurMark()))
|
||||
{
|
||||
BookMarkManager::GetInstance().RemoveCurBookMark();
|
||||
}
|
||||
else
|
||||
{
|
||||
BookMarkManager::GetInstance().AddCurMarkToBookMarks();
|
||||
}
|
||||
UpdateState();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
UserMark const * UserMarkPanel::GetCurMark()
|
||||
{
|
||||
return BookMarkManager::GetInstance().GetCurMark();
|
||||
}
|
||||
|
||||
void UserMarkPanel::UpdateState()
|
||||
{
|
||||
if (IsBookMark(GetCurMark()))
|
||||
{
|
||||
m_pButton->SetNormalBackgroundBitmap(*GetBitmap(IDB_PLACE_PAGE_BUTTON_SELECTED));
|
||||
m_pButton->SetPressedBackgroundBitmap(*GetBitmap(IDB_PLACE_PAGE_BUTTON_SELECTED));
|
||||
}
|
||||
else
|
||||
{
|
||||
m_pButton->SetNormalBackgroundBitmap(*GetBitmap(IDB_PLACE_PAGE_BUTTON));
|
||||
m_pButton->SetPressedBackgroundBitmap(*GetBitmap(IDB_PLACE_PAGE_BUTTON));
|
||||
}
|
||||
Invalidate(true);
|
||||
}
|
Loading…
Add table
Reference in a new issue