Change keypad UI logic for Tizen2.1 concept
[platform/framework/native/uifw.git] / src / ui / inc / FUiCtrl_Keypad.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_Keypad.h
20 * @brief                This is the header file for the _Keypad class.
21 *
22 * This header file contains the declarations of the _Keypad class.
23 */
24 #ifndef _FUI_CTRL_INTERNAL_KEYPAD_H_
25 #define _FUI_CTRL_INTERNAL_KEYPAD_H_
26
27 #include <FUiCtrlEditTypes.h>
28 #include "FUi_Window.h"
29 #include "FUiCtrl_Button.h"
30 #include "FUiCtrl_Edit.h"
31 #include "FUiCtrl_IActionEventListener.h"
32 #include "FUiCtrl_IKeypadEventListener.h"
33 #include "FUiCtrl_ITextEventListener.h"
34 #include "FUiCtrl_TextEvent.h"
35
36 namespace Tizen { namespace Ui { namespace Controls
37 {
38
39 struct _KeypadStyleInfo
40 {
41         KeypadStyle keypadStyle;
42         bool textPredictionEnabled;
43         bool isNormalNumberStyle;
44         bool enterActionEnabled;
45         bool isLowerCaseModeEnabled;
46 };
47
48 class _OSP_EXPORT_ _Keypad
49         : virtual public Tizen::Base::Runtime::IEventListener
50         , virtual public Tizen::Ui::_IUiEventListener
51         , virtual public Tizen::Ui::_IUiEventPreviewer
52         , public Tizen::Ui::_Window
53         , public _IActionEventListener
54         , public _IKeypadEventListener
55 {
56         DECLARE_CLASS_BEGIN(_Keypad, _Control);
57         DECLARE_PROPERTY("singleLineEnabled", GetPropertySingleLineEnabled, SetPropertySingleLineEnabled);
58         DECLARE_PROPERTY("text", GetPropertyText, SetPropertyText);
59         DECLARE_CLASS_END();
60
61         result SetPropertySingleLineEnabled(const Tizen::Ui::Variant& enabled);
62         Tizen::Ui::Variant GetPropertySingleLineEnabled(void) const;
63
64         result SetPropertyText(const Tizen::Ui::Variant& text);
65         Tizen::Ui::Variant GetPropertyText(void) const;
66
67 public:
68         static _Keypad* CreateKeypadN(void);
69         virtual ~_Keypad(void);
70
71         result Initialize(int editStyle, _KeypadStyleInfo styleInfo, int limitLength, _Edit* pCallerEdit = null);
72         virtual void OnDraw(void);
73
74         result SetSingleLineEnabled(bool enabled);
75         bool IsSingleLineEnabled(void) const;
76
77         Tizen::Base::String GetText(void) const;
78         void SetText(const Tizen::Base::String& text);
79         void SetEditTextFilter(IEditTextFilter* pFilter);
80         void SendOpaqueCommand (const Tizen::Base::String& command);
81
82         result AddTextEventListener(const _ITextEventListener& listener);
83         result RemoveTextEventListener(const _ITextEventListener& listener);
84
85         virtual result OnAttachedToMainTree(void);
86         virtual void OnActionPerformed(const Tizen::Ui::_Control& source, int actionId);
87         virtual void OnKeypadWillOpen(void);
88         virtual void OnKeypadOpened(void);
89         virtual void OnKeypadClosed(void);
90         virtual void OnKeypadBoundsChanged(void);
91         virtual void OnKeypadActionPerformed(CoreKeypadAction keypadAction);
92         virtual void OnChangeLayout(_ControlOrientation orientation);
93         virtual void OnNativeWindowActivated(void);
94
95 private:
96         _Keypad(void);
97         _Keypad(const _Keypad&);
98         _Keypad& operator =(const _Keypad&);
99
100         result Dispose(void);
101         result ChangeLayoutInternal(void);
102         Tizen::Graphics::FloatRectangle GetIndicatorBounds(void) const;
103         _Button* CreateButtonItemN(int actionId, const Tizen::Base::String& text);
104         _Button* CreateFooterBackButton(_Toolbar* pFooter);
105         _Toolbar* CreateFooter(void);
106
107 private:
108         bool __isInitialized;
109         bool __isSingleLineEnabled;
110         _Control* __pOwner;
111         _Edit* __pCallerEdit;
112         _Edit* __pChildEdit;
113         _Toolbar* __pFooter;
114         Tizen::Base::String __text;
115         _TextEvent* __pTextEvent;
116         bool __isCommandButtonPressed;
117         bool __isPredictionWindowOpendInUSBMode;
118 }; // _Keypad
119
120 } } } // Tizen::Ui::Controls
121 #endif // _FUI_CTRL_INTERNAL_KEYPAD_H_