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_TabBarPresenter.h
19 * @brief This is the header file for the _TabBarPresenter class.
21 * This header file contains the declarations of the %_TabBarPresenter class.
23 #ifndef _FUI_CTRL_INTERNAL_TABBAR_PRESENTER_H_
24 #define _FUI_CTRL_INTERNAL_TABBAR_PRESENTER_H_
27 #include <FBaseObject.h>
28 #include <FGrp_TextTextObject.h>
29 #include "FUi_Control.h"
30 #include "FUiCtrl_TabBar.h"
31 #include "FUiCtrl_TabBarItem.h"
32 #include "FUiCtrl_TabBarModel.h"
35 namespace Tizen { namespace Ui { namespace Controls
40 * @class _TabBarPresenter
48 class _TabBarPresenter
49 : public Tizen::Base::Object
53 _TabBarPresenter(_TabBar& pTabBar);
54 virtual ~_TabBarPresenter(void);
58 result Construct(void);
59 result InitializeFont(void);
61 result AddItem(const Tizen::Base::String& text, int actionId);
62 result InsertItemAt(int index, const Tizen::Base::String& text, int actionId);
63 result SetItemAt(int index, const Tizen::Base::String& text, int actionId);
64 _TabBarItem* GetItemAt(int index) const;
65 result RemoveItemAt(int index);
66 result RemoveAllItems(void);
68 result SetItemSelected(int index);
69 int GetSelectedItemIndex(void) const;
71 int GetItemCount(void) const;
72 int GetItemIndexFromPosition(const Tizen::Graphics::Point& point) const;
73 _TabBarItem* GetItemFromPosition(const Tizen::Graphics::Point& position) const;
74 result SetTopDrawnItemIndex(int index);
76 result SetReplacementColor(const Tizen::Graphics::Color& color);
77 result SetItemReplacementColor(_TabBarItemStatus itemStatus, const Tizen::Graphics::Color& color);
80 void InitItemPositionX(void);
82 virtual void OnFontChanged(Tizen::Graphics::Font* pFont);
83 virtual void OnFontInfoRequested(unsigned long& style, int& size);
85 bool OnTouchPressed(const _Control& source, const _TouchInfo& touchinfo);
86 bool OnTouchReleased(const _Control& source, const _TouchInfo& touchinfo);
87 bool OnTouchMoved(const _Control& source, const _TouchInfo& touchinfo);
88 void OnBoundsChanged(void);
90 void SetAllAccessibilityElement(void);
93 result LoadBitmap(void);
94 result AdjustItemPositionX(int distance);
95 _TabBarItemStatus GetItemStatus(int index) const;
96 result SetItemStatus(int index, _TabBarItemStatus status);
97 void DrawBackground(Tizen::Graphics::Canvas* pCanvas);
98 void DrawItem(Tizen::Graphics::Canvas* pCanvas);
99 void DrawArrow(Tizen::Graphics::Canvas* pCanvas);
100 result DrawBitmap(Tizen::Graphics::Canvas& canvas, const Tizen::Graphics::Rectangle& bounds, const Tizen::Graphics::Bitmap& bitmap);
103 _TabBarPresenter(const _TabBarPresenter& rhs);
104 _TabBarPresenter& operator =(const _TabBarPresenter& rhs);
108 _TabBarModel* __pTabBarModel;
110 Tizen::Graphics::Font* __pFont;
111 Tizen::Graphics::_Text::TextObject* __pTextObject;
112 Tizen::Graphics::Point __startPosition;
113 int __highlightedItemIndex;
115 bool __touchBubblingBlocked;
116 Tizen::Graphics::Bitmap* __pBgBitmapCached;
118 Tizen::Graphics::Bitmap* __pItemBgBitmapCached[ITEM_STATUS_MAX];
120 Tizen::Graphics::Bitmap* __pLeftArrowBgBitmapCached;
121 Tizen::Graphics::Bitmap* __pRightArrowBgBitmapCached;
122 Tizen::Graphics::Bitmap* __pLeftArrowBitmapCached;
123 Tizen::Graphics::Bitmap* __pRightArrowBitmapCached;
124 }; // _TabBarPresenter
126 }}} // Tizen::Ui::Controls
128 #endif // _FUI_CTRL_INTERNAL_TABBAR_PRESENTER_H_