Tizen 2.1 base
[framework/osp/uifw.git] / src / ui / inc / FUiCtrl_InputPadPresenter.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 /**
19  * @file                FUiCtrl_InputPadPresenter.h
20  * @brief               This is the header file for the _InputPadPresenter class.
21  *
22  * This header file contains the declarations of the %_InputPadPresenter class.
23  */
24
25 #ifndef _FUI_CTRL_INTERNAL_INPUTPAD_PRESENTER_H_
26 #define _FUI_CTRL_INTERNAL_INPUTPAD_PRESENTER_H_
27
28 #include <FGrp_TextTextObject.h>
29
30 #include "FUi_Control.h"
31 #include "FUiCtrl_IInputPadEventListener.h"
32 #include "FUiCtrl_DateTimeDefine.h"
33
34 namespace Tizen { namespace Graphics {
35 class Font;
36 }} // Tizen::Graphics
37
38 namespace Tizen { namespace Ui { namespace Controls
39 {
40
41 class _InputPad;
42
43 class _InputPadPresenter
44         : public Tizen::Base::Object
45 {
46 public:
47         _InputPadPresenter(_InputPad* pInputPad);
48         virtual ~_InputPadPresenter(void);
49
50         result Construct(const Tizen::Graphics::Rectangle& bounds);
51
52         result LoadProperties(Tizen::Ui::_ControlOrientation orientation);
53         result LoadResource(void);
54         result InitializeTextObjects(void);
55
56         void SetInputPadEventListener(const _IInputPadEventListener& listener);
57         result SetInputPadStyle(const _InputPadStyle style);
58
59         _InputPadStyle GetInputPadStyle(void) const;
60         Tizen::Graphics::Rectangle GetButtonBounds(int index) const;
61         int GetReturnValue(int index) const;
62
63         result Draw(void);
64
65         void EnableLayoutChangedFlag(void);
66
67         void SetFont(Tizen::Graphics::Font* pFont);
68
69         virtual bool OnTouchPressed(const Tizen::Ui::_Control& source, const Tizen::Ui::_TouchInfo& touchinfo);
70         virtual bool OnTouchReleased(const Tizen::Ui::_Control& source, const Tizen::Ui::_TouchInfo& touchinfo);
71         virtual bool OnTouchCanceled(const Tizen::Ui::_Control& source, const Tizen::Ui::_TouchInfo& touchinfo);
72
73 private:
74         result DrawAllButtons(Tizen::Graphics::Canvas& canvas);
75         result DrawButton(Tizen::Graphics::Canvas& canvas, int index);
76         result RefreshButton(int index);
77         int GetIndexFromTouchedPosition(const Tizen::Graphics::Point& point) const;
78
79         _InputPadPresenter(const _InputPadPresenter&);
80         _InputPadPresenter& operator =(const _InputPadPresenter&);
81
82 private:
83         _InputPad* __pInputPad;
84         _IInputPadEventListener* __pInputPadEventListener;
85
86         Tizen::Graphics::Font* __pFont;
87
88         Tizen::Graphics::Bitmap* __pKeypadBackgroundBitmap;
89
90         Tizen::Graphics::Bitmap* __pKeypadButtonNormalPlainBitmap;
91         Tizen::Graphics::Bitmap* __pKeypadButtonPressedPlainBitmap;
92
93         Tizen::Graphics::Bitmap* __pKeypadButtonNormalEffectBitmap;
94         Tizen::Graphics::Bitmap* __pKeypadButtonPressedEffectBitmap;
95
96         Tizen::Graphics::_Text::TextObject __textObject;
97         Tizen::Graphics::_Text::TextObject __guideTextObject;
98
99         _InputPadStyle __inputPadStyle;
100
101         int __buttonWidth;
102         int __buttonHeight;
103         int __startX;
104         int __startY;
105         int __marginX;
106         int __marginY;
107         int __pressedIndex;
108
109         bool __isLayoutChanged;
110
111         static const int INPUTPAD_BUTTON_MAX = 12;
112         static const int INPUTPAD_BUTTON_COLUMN_MAX = 3;
113         static const int INPUTPAD_BUTTON_ROW_MAX = 4;
114
115         static const int INPUTPAD_NUMBER_1 = 0;
116         static const int INPUTPAD_NUMBER_9 = 8;
117         static const int INPUTPAD_NUMBER_0 = 10;
118 }; // _InputPadPresenter
119
120 }}} // Tizen::Ui::Controls
121
122 #endif  // _FUI_CTRL_INTERNAL_INPUTPAD_PRESENTER_H_