2 // Open Service Platform
3 // Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
5 // Licensed under the Flora License, Version 1.0 (the License);
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
9 // http://floralicense.org/license/
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an AS IS BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
18 * @file FUiCtrl_ToolbarPresenter.h
19 * @brief This is the header file for the _ToolbarPresenter class.
21 * This header file contains the declarations of the %_ToolbarPresenter class.
24 #ifndef _FUI_CTRL_INTERNAL_TOOLBAR_PRESENTER_H_
25 #define _FUI_CTRL_INTERNAL_TOOLBAR_PRESENTER_H_
27 #include <FBaseObject.h>
28 #include <FGrp_TextTextObject.h>
29 #include "FUiCtrl_Toolbar.h"
31 namespace Tizen { namespace Ui { namespace Controls
38 enum ToolbarSeparatorType
40 TOOLBAR_SEPARATOR_HEADER_BUTTON = 0,
41 TOOLBAR_SEPARATOR_HEADER_SEGMENT,
42 TOOLBAR_SEPARATOR_HEADER_SEGMENT_TITLE,
43 TOOLBAR_SEPARATOR_FOOTER_BUTTON,
44 TOOLBAR_SEPARATOR_FOOTER_SEGMENT,
45 TOOLBAR_SEPARATOR_FOOTER_TOOLBAR,
46 TOOLBAR_SEPARATOR_FOOTER_TAB
50 * @class _ToolbarPresenter
51 * @brief The presenter class of _Toolbar class
54 class _ToolbarPresenter
55 : public Tizen::Base::Object
56 , public Tizen::Base::Runtime::ITimerEventListener
57 , virtual public Tizen::Base::Runtime::IEventListener
60 _ToolbarPresenter(void);
62 virtual ~_ToolbarPresenter(void);
64 result Construct(const _Toolbar& toolbar);
70 void DrawBackground(void);
72 void DrawDescriptionText(void);
74 void DrawEditItem(const Tizen::Graphics::Point& point);
76 void DrawSeparator(ToolbarSeparatorType type, const Tizen::Graphics::Point& point, Tizen::Graphics::Canvas* pCanvas);
80 result DrawTitleText(Tizen::Graphics::Canvas* pCanvas);
82 int GetSelectedItemIndex(void) const;
84 bool IsInitialDraw(void) const;
86 bool IsTabEditModeEnabled(void) const;
88 result SetDescriptionText(const Tizen::Base::String& description);
90 result SetItemSelected(int itemIndex);
92 result SetInitialDrawState(bool state);
94 result SetTabEditModeEnabled(bool enable);
96 result SetTitleText(const Tizen::Base::String& title, HorizontalAlignment alignment);
98 result SetUsableAreaBounds(const Tizen::Graphics::Rectangle& rect);
100 bool OnTouchPressed(const _Control& source, const _TouchInfo& touchinfo);
102 bool OnTouchReleased(const _Control& source, const _TouchInfo& touchinfo);
104 bool OnTouchMoved(const _Control& source, const _TouchInfo& touchinfo);
106 bool OnTouchCanceled(const _Control& source, const _TouchInfo& touchinfo);
108 bool OnLongPressGestureDetected(void);
110 virtual void OnTimerExpired(Tizen::Base::Runtime::Timer& timer);
112 result TimerForTitleSlideInit(void);
114 result TimerForTitleSlideStart(void);
116 result TimerForTitleSlideTimeout(void);
118 Tizen::Graphics::Rectangle GetTitleTextBounds(void) const;
120 Tizen::Graphics::Rectangle GetDescriptionBounds(void) const;
122 void OnFontChanged(Tizen::Graphics::Font* pFont);
123 void OnFontInfoRequested(unsigned long& style, int& size);
124 void SetFontInfo(unsigned long style, int size);
127 result _SetModel(const _ToolbarModel& toolbarModel);
130 result AdjustItemPositionX(int distance);
133 _Toolbar* __pToolbar;
135 _ToolbarModel* __pToolbarModel;
139 bool __tabEditEnabled;
143 bool __touchInitiatedInToolbar;
147 int __initialPressedItemIndex;
149 _ButtonStatus __initialPressesItemStatus;
153 Tizen::Graphics::Bitmap* __pTitleBackgroundBitmap;
155 Tizen::Base::Runtime::Timer* __pTitleSlideTimer;
157 Tizen::Graphics::Rectangle __titleRect;
159 Tizen::Graphics::Rectangle __descriptionRect;
161 Tizen::Graphics::Rectangle __toolbarUsableArea;
163 Tizen::Graphics::Point __currentTouchPosition;
165 Tizen::Base::String __titleText;
167 Tizen::Graphics::Font* __pTitleTextFont;
169 Tizen::Graphics::Font* __pTextFont;
171 Tizen::Graphics::_Text::TextObject* __pDescriptionTextObject;
173 Tizen::Graphics::_Text::TextObject* __pTitleTextObject;
175 Tizen::Graphics::_Text::TextObjectActionType __titleSlidingAction;
177 unsigned long __fontStyle;
180 bool __touchMoveHandled;
183 _ToolbarPresenter(const _ToolbarPresenter& value);
185 _ToolbarPresenter& operator =(const _ToolbarPresenter& value);
189 }}} // Tizen::Ui::Controls
191 #endif // _FUI_CTRL_INTERNAL_TOOLBAR_PRESENTER_H_