Tizen 2.1 base
[framework/osp/uifw.git] / src / ui / inc / FUiCtrl_SearchBarPresenter.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_SearchBarPresenter.h
20  * @brief       This is the header file for the _SearchBarPresenter class.
21  *
22  * This header file contains the declarations of the %_SearchBarPresenter class.
23  */
24
25 #ifndef _FUI_CTRL_INTERNAL_SEARCH_BAR_PRESENTER_H_
26 #define _FUI_CTRL_INTERNAL_SEARCH_BAR_PRESENTER_H_
27
28 #include <FBaseObject.h>
29 #include "FUiCtrl_SearchBar.h"
30
31 namespace Tizen { namespace Ui { namespace Animations
32 {
33 class _VisualElement;
34 }}} // Tizen::Ui::Animations
35
36 namespace Tizen { namespace Ui { namespace Controls
37 {
38
39 class _SearchBar;
40 class _SearchBarModel;
41
42 /**
43  * @class _SearchBarPresenter
44  * @brief
45  * @since 2.0
46  */
47 class _SearchBarPresenter
48         : public Tizen::Base::Object
49 {
50 public:
51         /**
52          * This is default constructor for this class.
53          *
54          * @since       2.0
55          */
56         _SearchBarPresenter(void);
57
58         /**
59          * This is the destructor for this class.
60          *
61          * @since       2.0
62          */
63         virtual ~_SearchBarPresenter(void);
64
65 // Operations
66         result Construct(const _SearchBar& searchBar);
67         result Install(void);
68
69         /**
70          * Updates the content area of the SearchBar control.
71          *
72          * @since  2.0
73          * @return      An error code
74          * @param[in]   show        A Boolean flag indicating whether to perform show on the content area.
75          * @exception   E_SUCCESS              The method was successful.
76          * @exception   E_INVALID_OPERATION    The current state of the instance prohibits the execution of the specified operation @n
77          *                                     -- the current mode of SearchBar prohibits the execution of the method. @n
78          * @exception   E_SYSTEM               A system error occurred.
79          * @remarks     The method performs Invalidate() on the content area.
80          */
81         result UpdateContentArea(bool invalidate = true);
82
83         /**
84          * Sets the visibility state of the content area.
85          *
86          * @since       2.0
87          * @return      An error code
88          * @param[in]   visible            The visibility state of the content area.
89          * @exception   E_SUCCESS          The method was successful.
90          * @exception   E_SYSTEM           A system error occurred.
91          * @see         IsContentAreaVisible()
92          */
93         result SetContentAreaVisible(bool visible);
94
95         /**
96          * Checks whether the content area is visible.
97          *
98          * @since       2.0
99          * @return      The visibility state of the content area.
100          * @exception   E_SUCCESS           The method was successful.
101          * @see         SetContentAreaVisible()
102          */
103         bool IsContentAreaVisible(void) const;
104
105         /**
106          * Gets the search bar mode.
107          *
108          * @since               2.0
109          * @return      The search bar mode
110          * @exception   E_SUCCESS           The method was successful.
111          * @exception   E_SYSTEM            A system error occurred.
112          * @remarks     The specific error code can be accessed using the GetLastResult() method.
113          * @see         SetMode()
114          */
115         SearchBarMode GetMode(void) const;
116
117         /**
118          * Determines whether the search bar mode is locked.
119          *
120          * @since               2.0
121          * @return      @c true if the mode is locked, @n
122          *                              else @c false
123          * @exception   E_SUCCESS           The method was successful.
124          * @exception   E_SYSTEM            A system error occurred.
125          * @remarks     The specific error code can be accessed using the GetLastResult() method.
126          * @see         SetModeLock()
127          */
128         bool IsModeLocked(void) const;
129
130         /**
131          * Sets the search bar mode.
132          *
133          * @since               2.0
134          * @return      An error code
135          * @exception   E_SUCCESS           The method was successful.
136          * @exception   E_INVALID_OPERATION     The current state of the instance prohibits the execution of the specified operation, or the mode is locked.
137          * @exception   E_SYSTEM            A system error occurred.
138          * @see         GetMode()
139          * @see         SetModeLock()
140          */
141         result SetMode(SearchBarMode mode);
142
143         /**
144          * Locks or unlocks the search bar mode.
145          *
146          * @since               2.0
147          * @return      An error code
148          * @param[in]   modeLocked      The mode lock
149          * @exception   E_SUCCESS       The method was successful.
150          * @exception   E_SYSTEM        A system error occurred.
151          * @see         GetMode()
152          */
153         result SetModeLocked(bool modeLocked);
154
155         /**
156          * Sets the visibility state of the header.
157          *
158          * @since       2.0
159          * @param[in]   visible            The visibility state of the the header.
160          */
161         void SetHeaderVisibleState(bool visible);
162
163         result Draw(void);
164
165         // callback
166         void OnBoundsChanged(void);
167
168 private:
169         _SearchBarPresenter(const _SearchBarPresenter&);
170
171         _SearchBarPresenter& operator =(const _SearchBarPresenter&);
172
173         void SetCancelButtonVisible(bool visible);
174         void SetContainerVisible(bool visible);
175         result DrawIcon(void);
176
177         result ChangeMode(SearchBarMode mode);
178         void InitializeInputModeLayout(void);
179         void InitializeViewModeLayout(void);
180         result LoadSearchFieldIcon(void);
181
182         _SearchBar* __pSearchBar;
183         _SearchBarModel* __pSearchBarModel;
184
185         _Button* __pCancelButton;
186         _Edit* __pEdit;
187         _Control* __pContainer;
188
189         Tizen::Graphics::Rectangle __searchFieldBounds;
190
191         Tizen::Ui::Animations::_VisualElement* __pIconElement;
192
193         Tizen::Graphics::Bitmap* __pReplacedSearchFieldNormalBitmap;
194         Tizen::Graphics::Bitmap* __pReplacedSearchFieldDisabledBitmap;
195         Tizen::Graphics::Bitmap* __pSearchFieldEffectBitmap;
196
197
198 }; // _SearchBarPresenter
199
200 }}} // Tizen::Ui::Controls
201
202 #endif  // _FUI_CTRL_INTERNAL_SEARCH_BAR_PRESENTER_H_