Tizen 2.1 base
[framework/osp/uifw.git] / src / ui / inc / FUiCtrl_TokenEdit.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_TokenEdit.h
19  * @brief               This is the header file for the _TokenEdit class.
20  *
21  * This header file contains the declarations of the %_TokenEdit class.
22  */
23 #ifndef _FUICTRL_INTERNAL_TOKEN_EDIT_H_
24 #define _FUICTRL_INTERNAL_TOKEN_EDIT_H_
25
26 #include <FUiCtrlExpandableEditArea.h>
27 #include "FUiCtrl_Edit.h"
28 #include "FUiCtrl_ITokenFilter.h"
29
30 namespace Tizen { namespace Ui
31 {
32 class _AccessibilityElement;
33 }} // Tizen::Ui
34
35 namespace Tizen { namespace Ui { namespace Controls
36 {
37 class _TokenEditPresenter;
38
39 const int TOKEN_COLOR_MAX = 2;
40
41 class _TokenEdit
42         : virtual public Tizen::Base::Runtime::IEventListener
43         , virtual public Tizen::Ui::_IUiEventListener
44         , virtual public Tizen::Ui::_IUiEventPreviewer
45         , virtual public Tizen::Ui::_ITouchGestureEventListener
46         , public Tizen::Ui::Controls::_Edit
47 {
48
49 public:
50         _TokenEdit(void);
51
52         virtual ~_TokenEdit(void);
53
54         static _TokenEdit* CreateTokenEditN(void);
55
56         DECLARE_CLASS_BEGIN(_TokenEdit, _Edit);
57         DECLARE_PROPERTY("normalTokenColor", GetPropertyNormalTokenColor, SetPropertyNormalTokenColor);
58         DECLARE_PROPERTY("selectedTokenColor", GetPropertySelectedTokenColor, SetPropertySelectedTokenColor);
59         DECLARE_PROPERTY("tokenTextColor", GetPropertyTokenTextColor, SetPropertyTokenTextColor);
60         DECLARE_PROPERTY("selectedTokenTextColor", GetPropertySelectedTokenTextColor, SetPropertySelectedTokenTextColor);
61         DECLARE_PROPERTY("tokenEditModeEnabled", GetPropertyTokenEditModeEnabled, SetPropertyTokenEditModeEnabled);
62         DECLARE_CLASS_END();
63
64 // Properties
65         result SetPropertyNormalTokenColor(const Variant& color);
66         Variant GetPropertyNormalTokenColor(void) const;
67         result SetPropertySelectedTokenColor(const Variant& color);
68         Variant GetPropertySelectedTokenColor(void) const;
69         result SetPropertyTokenTextColor(const Variant& color);
70         Variant GetPropertyTokenTextColor(void) const;
71         result SetPropertySelectedTokenTextColor(const Variant& color);
72         Variant GetPropertySelectedTokenTextColor(void) const;
73         result SetPropertyTokenEditModeEnabled(const Variant& enable);
74         Variant GetPropertyTokenEditModeEnabled(void) const;
75
76         virtual void OnDraw(void);
77         result SetTokenFilter(const _ITokenFilter* pFilter);
78         _ITokenFilter* GetTokenFilter(void) const;
79         result AppendToken(const Tizen::Base::String& token);
80         result InsertTokenAt(int index, const Tizen::Base::String& token);
81         Tizen::Base::String GetTokenAt(int index) const;
82         int GetTokenCount(void) const;
83         int GetSelectedTokenIndex(void) const;
84         bool IsTokenEditModeEnabled(void) const;
85         result RemoveTokenAt(int index);
86         result SetTokenSelected(int index, bool selected);
87         result SetTokenEditModeEnabled(bool enable);
88         Tizen::Graphics::Color GetTokenColor(ExpandableEditAreaTokenStatus status) const;
89         Tizen::Graphics::Color GetTokenTextColor(void) const;
90         result SetTokenColor(ExpandableEditAreaTokenStatus status, const Tizen::Graphics::Color& color);
91         result SetTokenTextColor(const Tizen::Graphics::Color& color);
92         Tizen::Graphics::Color GetSelectedTokenTextColor(void) const;
93         result SetSelectedTokenTextColor(const Tizen::Graphics::Color& color);
94         virtual result SetTitleText(const Tizen::Base::String& title);
95         virtual Tizen::Base::String GetTitleText(void) const;
96         void SetAutoShrinkModeEnabled(bool enable);
97         bool IsAutoShrinkModeEnabled(void) const;
98         result ProcessTokenFiltering(const Tizen::Base::String& inputString, Tizen::Base::String& replaceString, bool& enable);
99
100         // Touch callbacks
101         virtual bool OnTouchPressed(const _Control& source, const _TouchInfo& touchinfo);
102         virtual bool OnTouchReleased(const _Control& source, const _TouchInfo& touchinfo);
103         virtual bool OnTouchMoved(const _Control& source, const _TouchInfo& touchinfo);
104
105         virtual result OnAttachedToMainTree(void);
106
107 private:
108         _TokenEdit(const _TokenEdit& rhs);
109         _TokenEdit& operator =(const _TokenEdit& rhs);
110
111         virtual void OnBoundsChanged(void);
112
113 // Attributes
114 private:
115         _TokenEditPresenter* __pTokenEditPresenter;
116         Tizen::Graphics::Color __tokenColor[TOKEN_COLOR_MAX];
117
118         Tizen::Graphics::Color __tokenTextColor[TOKEN_COLOR_MAX];
119
120         bool __isSelectedTokenTextColorSet;
121
122         _ITokenFilter* __pTokenFilter;
123
124         Tizen::Ui::_AccessibilityElement* __pDescriptionTextAccessibilityElement;
125         Tizen::Ui::_AccessibilityElement* __pHiddenTokenCountAccessibilityElement;
126         Tizen::Ui::_AccessibilityElement* __pExpandableButtonAccessibilityElement;
127 };      // _TokenEdit
128
129 }}} // Tizen::Ui::Controls
130
131 #endif      // _FUICTRL_INTERNAL_TOKEN_EDIT_H_