Tizen 2.1 base
[framework/osp/uifw.git] / src / ui / inc / FUiCtrl_ButtonPresenter.h
1 //
2 // Open Service Platform
3 // Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
4 //
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
8 //
9 //     http://floralicense.org/license/
10 //
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.
16 //
17 /**
18  * @file                FUiCtrl_ButtonPresenter.h
19  * @brief               This is the header file for the _ButtonPresenter class.
20  *
21  * This header file contains the declarations of the %_ButtonPresenter class.
22  */
23 #ifndef _FUI_CTRL_INTERNAL_BUTTON_PRESENTER_H_
24 #define _FUI_CTRL_INTERNAL_BUTTON_PRESENTER_H_
25
26 #include <FBaseObject.h>
27 #include <FGrp_TextTextObject.h>
28 #include "FUi_Control.h"
29
30 namespace Tizen { namespace Ui { namespace Animations
31 {
32 class _VisualElement;
33 }}} // Tizen::Ui::Animations
34
35 namespace Tizen { namespace Ui { namespace Controls
36 {
37 class _Button;
38 class _ButtonModel;
39
40 /**
41  * @class _ButtonPresenter
42  * @brief
43  * @since       1.0
44  *
45  *
46  *
47  *
48  */
49 class _ButtonPresenter
50         : public Tizen::Base::Object
51 {
52 public:
53         _ButtonPresenter(void);
54         virtual ~_ButtonPresenter(void);
55
56 public:
57         virtual result Construct(const _Button& button);
58         virtual result Install(void);
59
60         virtual bool OnTouchPressed(const _Control& source, const _TouchInfo& touchinfo);
61         virtual bool OnTouchReleased(const _Control& source, const _TouchInfo& touchinfo);
62         virtual bool OnTouchMoved(const _Control& source, const _TouchInfo& touchinfo);
63         virtual bool OnTouchCanceled(const _Control& source, const _TouchInfo& touchinfo);
64         virtual void OnTouchMoveHandled(const _Control& control);
65
66         void Draw(void);
67
68         void OnFontChanged(Tizen::Graphics::Font* pFont);
69         void OnFontInfoRequested(unsigned long& style, int& size);
70         void SetTextSize(int size, unsigned long fontStyle = Tizen::Graphics::FONT_STYLE_PLAIN);
71         void SetFontInfo(unsigned long style, int size);
72
73         Tizen::Graphics::_Text::TextObject* GetTextObject(void) const;
74         result InitTextObject(void);
75
76 protected:
77         result SetModel(const _ButtonModel& buttonModel);
78
79 private:
80         _ButtonPresenter(const _ButtonPresenter& rhs);
81         _ButtonPresenter& operator =(const _ButtonPresenter& rhs);
82
83         void DrawBackground(void);
84         void DrawToolbarItemBackground(void);
85         void DrawBitmap(void);
86         void DrawText(void);
87         void DrawToolbarSelectedBitmap(void);
88
89         bool IsEnabledStateChanged(void);
90
91 private:
92         _Button* __pButton;
93         _ButtonModel* __pButtonModel;
94         bool __needDraw;
95         bool __previousEnabledState;
96         bool __touchMoveHandled;
97
98         Tizen::Graphics::Font* __pFont;
99         Tizen::Graphics::_Text::TextObject* __pTextObject;
100
101         Tizen::Ui::Animations::_VisualElement* __pBase;
102         unsigned long __fontStyle;
103         int __fontSize;
104 }; // _ButtonPresenter
105
106 }}} // Tizen::Ui::Controls
107
108 #endif  // _FUI_CTRL_INTERNAL_BUTTON_PRESENTER_H_