Merge "Unchecked GetCharacter func when index is over string length" into tizen_2.2
[platform/framework/native/uifw.git] / inc / FUiCtrlSearchBar.h
1 //
2 // Open Service Platform
3 // Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
4 //
5 // Licensed under the Apache License, Version 2.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://www.apache.org/licenses/LICENSE-2.0/
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        FUiCtrlSearchBar.h
20  * @brief       This is the header file for the %SearchBar class.
21  *
22  * This header file contains the declarations of the %SearchBar class.
23  */
24
25 #ifndef _FUI_CTRL_SEARCH_BAR_H_
26 #define _FUI_CTRL_SEARCH_BAR_H_
27
28 #include <FBaseObject.h>
29 #include <FBaseTypes.h>
30 #include <FBaseString.h>
31 #include <FUiControl.h>
32 #include <FUiCtrlEditTypes.h>
33 #include <FUiCtrlIEditTextFilter.h>
34 #include <FUiIActionEventListener.h>
35 #include <FUiIKeypadEventListener.h>
36 #include <FUiILanguageEventListener.h>
37 #include <FUiITextBlockEventListener.h>
38 #include <FUiITextEventListener.h>
39
40 namespace Tizen { namespace Graphics
41 {
42 class Rectangle;
43 }} // Tizen::Graphics
44
45 namespace Tizen { namespace Ui { namespace Controls
46 {
47
48 class ISearchBarEventListener;
49
50 /**
51  * @enum    SearchFieldStatus
52  *
53  * Defines the possible states of the search field of the search bar.
54  *
55  * @since       2.0
56  */
57 enum SearchFieldStatus
58 {
59         SEARCH_FIELD_STATUS_NORMAL,         /**< The normal state */
60         SEARCH_FIELD_STATUS_HIGHLIGHTED,    /**< The focus-highlighted state */
61         SEARCH_FIELD_STATUS_DISABLED        /**< The disabled state */
62 };
63
64 /**
65  * @enum    SearchBarButtonStatus
66  *
67  * Defines the possible states of the search bar button.
68  *
69  * @since       2.0
70  */
71 enum SearchBarButtonStatus
72 {
73         SEARCH_BAR_BUTTON_STATUS_NORMAL = 0,        /**< The normal status */
74         SEARCH_BAR_BUTTON_STATUS_PRESSED,           /**< The selected status */
75         SEARCH_BAR_BUTTON_STATUS_HIGHLIGHTED,       /**< The highlighted status */
76         SEARCH_BAR_BUTTON_STATUS_DISABLED           /**< The disabled status */
77 };
78
79 /**
80  * @enum        SearchBarMode
81  *
82  * Defines the possible modes of the search bar.
83  *
84  * @since       2.0
85  */
86 enum SearchBarMode
87 {
88         SEARCH_BAR_MODE_NORMAL,     /**< The normal mode */
89         SEARCH_BAR_MODE_INPUT       /**< The input mode */
90 };
91
92 /**
93  * @class       SearchBar
94  * @brief       This class is an implementation of a search bar.
95  *
96  * @since       2.0
97  *
98  * The %SearchBar class displays an editable search field for entering keywords and an optional button that is displayed in the
99  * input mode.
100  *
101  * For more information on the class features, see <a href="../org.tizen.native.appprogramming/html/guide/ui/implementing_searchbar.htm">SearchBar</a>.
102  *
103  * The following example demonstrates how to use the %SearchBar class.
104  *
105  * @code
106 // Sample code for SearchBarSample.h
107 #include <FUi.h>
108
109 class SearchBarSample
110         : public Tizen::Ui::Controls::Form
111         , public Tizen::Ui::Controls::ISearchBarEventListener
112         , public Tizen::Ui::Controls::IListViewItemEventListener
113         , public Tizen::Ui::Controls::IListViewItemProvider
114         , public Tizen::Ui::ITextEventListener
115 {
116 public:
117         SearchBarSample(void)
118         : __pSearchBar(null)
119         , __pSearchBarListView(null){}
120
121         bool Initialize(void);
122         virtual result OnInitializing(void);
123
124         // ISearchBarEventListener
125         virtual void OnSearchBarModeChanged(Tizen::Ui::Controls::SearchBar& source, Tizen::Ui::Controls::SearchBarMode mode);
126         virtual void OnSearchBarContentAreaResized(Tizen::Ui::Controls::SearchBar& source, Tizen::Graphics::Dimension& size) {};
127         virtual void OnTextValueChanged(const Tizen::Ui::Control& source);
128         virtual void OnTextValueChangeCanceled(const Tizen::Ui::Control& source){};
129
130         // IListViewItemEventListener
131         virtual void OnListViewContextItemStateChanged(Tizen::Ui::Controls::ListView &listView, int index, int elementId, Tizen::Ui::Controls::ListContextItemStatus state);
132         virtual void OnListViewItemStateChanged(Tizen::Ui::Controls::ListView &listView, int index, int elementId, Tizen::Ui::Controls::ListItemStatus status);
133         virtual void OnListViewItemSwept(Tizen::Ui::Controls::ListView &listView, int index, Tizen::Ui::Controls::SweepDirection direction);
134
135         //IListViewItemProvider
136         virtual Tizen::Ui::Controls::ListItemBase* CreateItem (int index, int itemWidth);
137         virtual bool DeleteItem (int index, Tizen::Ui::Controls::ListItemBase *pItem, int itemWidth);
138         virtual int GetItemCount(void);
139
140 private:
141         static const int ID_FORMAT_STRING = 500;
142
143         Tizen::Ui::Controls::SearchBar* __pSearchBar;
144         Tizen::Ui::Controls::ListView*  __pSearchBarListView;
145 };
146  * @endcode
147  *
148  * @code
149 // Sample code for SearchBarSample.cpp
150 #include <FApp.h>
151 #include <FGraphics.h>
152
153 #include "SearchBarSample.h"
154
155 using namespace Tizen::Base;
156 using namespace Tizen::Base::Collection;
157 using namespace Tizen::Graphics;
158 using namespace Tizen::Ui;
159 using namespace Tizen::Ui::Controls;
160
161 bool
162 SearchBarSample::Initialize(void)
163 {
164         Construct(FORM_STYLE_NORMAL);
165         return true;
166 }
167
168 result
169 SearchBarSample::OnInitializing(void)
170 {
171         result r = E_SUCCESS;
172
173         // Creates an instance of SearchBar
174         __pSearchBar = new SearchBar();
175         __pSearchBar->Construct(Rectangle(0, 0, GetClientAreaBounds().width, 110));
176         __pSearchBar->SetText(L"Click here! ");
177         __pSearchBar->AddSearchBarEventListener(*this);
178         __pSearchBar->AddTextEventListener(*this);
179
180         // Creates an instance of ListView
181         __pSearchBarListView = new ListView();
182         __pSearchBarListView->Construct(Rectangle(0, 110, GetClientAreaBounds().width, GetClientAreaBounds().height - 110), true, false);
183         __pSearchBarListView->SetItemProvider(*this);
184         __pSearchBarListView->AddListViewItemEventListener(*this);
185         __pSearchBarListView->SetTextOfEmptyList(L"No search result");
186         __pSearchBarListView->SetShowState(false);
187         __pSearchBar->SetContent(__pSearchBarListView);
188
189         // Adds controls to the form
190         AddControl(__pSearchBar);
191
192         return r;
193 }
194
195 // ISearchBarEventListener implementation
196 void
197 SearchBarSample::OnSearchBarModeChanged(Tizen::Ui::Controls::SearchBar& source, Tizen::Ui::Controls::SearchBarMode mode)
198 {
199         Rectangle clientRect = GetClientAreaBounds();
200         __pSearchBar->SetText(L"");
201
202         if(mode == SEARCH_BAR_MODE_INPUT)
203         {
204                 SetActionBarsVisible(FORM_ACTION_BAR_FOOTER, false);
205                 __pSearchBar->SetContentAreaSize(Dimension(clientRect.width, clientRect.height));
206                 __pSearchBarListView->SetSize(Dimension(clientRect.width, clientRect.height));
207                 __pSearchBarListView->UpdateList();
208         }
209         else
210         {
211                 SetActionBarsVisible(FORM_ACTION_BAR_FOOTER, true);
212                 __pSearchBarListView->UpdateList();
213                 __pSearchBarListView->SetShowState(false);
214                 __pSearchBar->SetText(L"Click here!");
215         }
216         Invalidate(true);
217 }
218
219 void
220 SearchBarSample::OnTextValueChanged(const Tizen::Ui::Control& source)
221 {
222         if(__pSearchBarListView)
223         {
224                 __pSearchBarListView->UpdateList();
225                 __pSearchBarListView->ScrollToItem(0);
226                 __pSearchBarListView->SetShowState(true);
227         }
228         Invalidate(true);
229 }
230
231 // IListViewItemEventListener implementation
232  void
233  SearchBarSample::OnListViewContextItemStateChanged(Tizen::Ui::Controls::ListView &listView, int index, int elementId, Tizen::Ui::Controls::ListContextItemStatus state)
234  {
235         // ....
236  }
237
238  void
239  SearchBarSample::OnListViewItemStateChanged(Tizen::Ui::Controls::ListView &listView, int index, int elementId, Tizen::Ui::Controls::ListItemStatus status)
240  {
241         // ....
242  }
243
244  void
245  SearchBarSample::OnListViewItemSwept(Tizen::Ui::Controls::ListView &listView, int index, Tizen::Ui::Controls::SweepDirection direction)
246  {
247         // ....
248  }
249
250 //IListViewItemProvider
251 ListItemBase*
252 SearchBarSample::CreateItem (int index, int itemWidth)
253 {
254         // Creates an instance of CustomItem
255         CustomItem* pItem = new CustomItem();
256         ListAnnexStyle style = LIST_ANNEX_STYLE_NORMAL;
257
258         // Gets texts of the search bar
259         String inputText = null;
260         inputText = __pSearchBar->GetText();
261
262         if(inputText.CompareTo(L"a") == 0 || inputText.CompareTo(L"A") == 0 )
263         {
264                 switch (index % 3)
265                 {
266                 case 0:
267                         {
268                                 pItem->Construct(Dimension(itemWidth,100), style);
269                                 pItem->AddElement(Rectangle(80, 25, 200, 50), ID_FORMAT_STRING, L"ajo", true);
270                         }
271                         break;
272                 case 1:
273                         {
274                                 pItem->Construct(Dimension(itemWidth,100), style);
275                                 pItem->AddElement(Rectangle(80, 25, 200, 50), ID_FORMAT_STRING, L"aeun", true);
276                         }
277                         break;
278                 case 2:
279                         {
280                                 pItem->Construct(Dimension(itemWidth,100), style);
281                                 pItem->AddElement(Rectangle(80, 25, 200, 50), ID_FORMAT_STRING, L"abee", true);
282                         }
283                         break;
284                 default:
285                         break;
286                 }
287         }
288         else if (inputText.CompareTo(L"b") == 0 || inputText.CompareTo(L"B") == 0)
289         {
290                 switch (index%3)
291                 {
292                 case 0:
293                         {
294                                 pItem->Construct(Dimension(itemWidth,100), style);
295                                 pItem->AddElement(Rectangle(80, 25, 200, 50), ID_FORMAT_STRING, L"bonge", true);
296                         }
297                         break;
298                 case 1:
299                         {
300                                 pItem->Construct(Dimension(itemWidth,100), style);
301                                 pItem->AddElement(Rectangle(80, 25, 200, 50), ID_FORMAT_STRING, L"bnpyo", true);
302                         }
303                         break;
304                 case 2:
305                         {
306                                 pItem->Construct(Dimension(itemWidth,100), style);
307                                 pItem->AddElement(Rectangle(80, 25, 200, 50), ID_FORMAT_STRING, L"bkueon", true);
308                         }
309                         break;
310                 default:
311                         break;
312                 }
313         }
314         else
315         {
316                 pItem->Construct(Dimension(itemWidth,100), style);
317                 pItem->AddElement(Rectangle(80, 25, 200, 50), ID_FORMAT_STRING, L"default", true);
318         }
319
320         return pItem;
321 }
322
323 bool
324 SearchBarSample::DeleteItem (int index, Tizen::Ui::Controls::ListItemBase *pItem, int itemWidth)
325 {
326         delete pItem;
327         pItem = null;
328         return true;
329 }
330
331 int
332 SearchBarSample::GetItemCount(void)
333 {
334         return 3;
335 }
336  * @endcode
337  *
338  */
339
340 class _OSP_EXPORT_ SearchBar
341         : public Tizen::Ui::Control
342 {
343 public:
344         /**
345          * The object is not fully constructed after this constructor is called.  @n
346          * For full construction, the %Construct() method must be called right after calling this constructor.
347          *
348          * @since       2.0
349          */
350         SearchBar(void);
351
352         /**
353          * This polymorphic destructor should be overridden if required.@n
354          * This way, the destructors of the derived classes are called when the destructor of this interface is called.
355          *
356          * @since       2.0
357          */
358         virtual ~SearchBar(void);
359
360         /**
361          * Initializes this instance of the %SearchBar control with the specified parameters.
362          *
363          * @since               2.0
364          *
365          * @return              An error code
366          * @param[in]   rect                    An instance of the Graphics::Rectangle class @n
367          *                                                              This instance represents the x and y coordinates of the top-left corner of the created window along with
368          *                                                              the width and height of the control. @n
369          *                                                              The optimal size of the control is defined in
370          *                                                              <a href="../org.tizen.native.appprogramming/html/guide/ui/control_optimalsize.htm">Optimal Size of UI Controls</a>.
371          * @param[in]   searchBarButton Set to @c true to display the search bar button, @n
372          *                              else @c false
373          * @param[in]   keypadAction    The keypad action
374          * @exception   E_SUCCESS               The method is successful.
375          * @exception   E_INVALID_ARG   A specified input parameter is invalid, or @n
376          *                                                              the action ID of the specified item must be a positive integer.
377          * @exception   E_SYSTEM                A system error has occurred.
378          * @remarks
379          *                              - It is recommended that %SearchBar should be placed at the top-left corner of Form's client area.
380          *                              - By default, a "Cancel" button is displayed if @c searchBarButton is set to @c true. When the user presses the cancel button,
381          *                              the %SearchBar control returns to ::SEARCH_BAR_MODE_NORMAL automatically.
382          */
383         result Construct(const Tizen::Graphics::Rectangle& rect, bool searchBarButton = true, KeypadAction keypadAction = KEYPAD_ACTION_SEARCH);
384
385         /**
386          * Initializes this instance of the %SearchBar control with the specified parameters.
387          *
388          * @since               2.1
389          *
390          * @return              An error code
391          * @param[in]   rect                    An instance of the Tizen::Graphics::FloatRectangle class @n
392          *                                                              This instance represents the x and y coordinates of the top-left corner of the created window along with
393          *                                                              the width and height of the control. @n
394          *                                                              The optimal size of the control is defined in
395          *                                                              <a href="../org.tizen.native.appprogramming/html/guide/ui/control_optimalsize.htm">Optimal Size of UI Controls</a>.
396          * @param[in]   searchBarButton Set to @c true to display the search bar button, @n
397          *                              else @c false
398          * @param[in]   keypadAction    The keypad action
399          * @exception   E_SUCCESS               The method is successful.
400          * @exception   E_INVALID_ARG   A specified input parameter is invalid, or @n
401          *                                                              the action ID of the specified item must be a positive integer.
402          * @exception   E_SYSTEM                A system error has occurred.
403          * @remarks
404          *                              - It is recommended that %SearchBar should be placed at the top-left corner of Form's client area.
405          *                              - By default, a "Cancel" button is displayed if @c searchBarButton is set to @c true. When the user presses the cancel button,
406          *                              the %SearchBar control returns to ::SEARCH_BAR_MODE_NORMAL automatically.
407          */
408         result Construct(const Tizen::Graphics::FloatRectangle& rect, bool searchBarButton = true, KeypadAction keypadAction = KEYPAD_ACTION_SEARCH);
409
410         /**
411          * Gets the content of Control.
412          *
413          * @since               2.0
414          *
415          * @return              The control that is displayed in the content area of %SearchBar in the ::SEARCH_BAR_MODE_INPUT mode, @n
416          *                              else @c null if an error occurs
417          * @exception   E_SUCCESS                       The method is successful.
418          * @remarks             The specific error code can be accessed using the GetLastResult() method.
419          */
420         Tizen::Ui::Control* GetContent(void) const;
421
422         /**
423          * Sets the content control.
424          *
425          * @if OSPCOMPAT
426          * @brief <i> [Compatibility] </i>
427          * @endif
428          * @since               2.0
429          * @if OSPCOMPAT
430          * @compatibility This method has compatibility issues with OSP compatible applications. @n
431          *                                              For more information, see @ref CompSetContentPage "here"
432          * @endif
433          * @return      An error code
434          * @param[in]   pContent                        The control to display in the content area of the search bar
435          * @exception   E_SUCCESS                       The method is successful.
436          * @exception   E_INVALID_ARG           A specified input parameter is invalid. @n
437          *                                                                      The following controls cannot be set as the content: @n
438          *                                                                      @li All classes derived from the Window class
439          *                                                                      @li All picker classes (For example, DateTimePicker)
440          *                                                                      @li Form
441          *                                                                      @li Keypad
442          *                                                                      @li OverlayPanel
443          * @exception   E_SYSTEM                        A system error has occurred.
444          * @remarks             The specified content control is displayed when the mode of the %SearchBar control is changed to SEARCH_BAR_MODE_INPUT.
445          * @see                 GetContentAreaSize()
446          * @see                 AddSearchBarEventListener()
447          * @see                 ISearchBarEventListener
448          */
449         result SetContent(const Tizen::Ui::Control* pContent);
450         /**
451          * @page               CompSetContentPage        Compatibility for SetContent()
452          * @section            CompSetContentPage IssueSection          Issues
453          * Implementing this method in OSP compatible applications has the following issue: @n
454          * SetContent() method passes the ownership of Content control to SearchBar in OSP,
455          * whereas the Content control ownership remains with the caller in Tizen.
456          *
457          * @section            CompSetContentPage SolutionSection               Resolutions
458          * In Tizen, the caller should delete the previous Content control, if this method is called more than once.
459          */
460
461         /**
462          * Updates the content area of the %SearchBar control.
463          *
464          * @since               2.0
465          *
466          * @return              An error code
467          * @param[in]   invalidate                                      Set to @c true to perform invalidate on the content area, @n
468          *                                                                              else @c false
469          * @exception   E_SUCCESS                               The method is successful.
470          * @exception   E_INVALID_OPERATION             The current state of the instance prohibits the execution of the specified operation. @n
471          *                                                                              The current mode of %SearchBar prohibits the execution of the method.
472          * @exception   E_SYSTEM                                A system error has occurred.
473          * @remarks             The method performs Invalidate() on the content area.
474          */
475         result UpdateContentArea(bool invalidate = true);
476
477         /**
478          * Sets the visibility state of the content area.
479          *
480          * @since               2.0
481          *
482          * @return              An error code
483          * @param[in]   visible                         Set to @c true to make the content area visible, @n
484          *                                                                      else @c false
485          * @exception   E_SUCCESS                       The method is successful.
486          * @exception   E_SYSTEM                        A system error has occurred.
487          * @see                 IsContentAreaVisible()
488          */
489         result SetContentAreaVisible(bool visible);
490
491         /**
492          * Checks whether the content area is visible.
493          *
494          * @since               2.0
495          *
496          * @return              @c true if the content area is visible, @n
497          *                              else @c false
498          * @exception   E_SUCCESS                       The method is successful.
499          * @see                 SetContentAreaVisible()
500          */
501         bool IsContentAreaVisible(void) const;
502
503         /**
504          * Sets the size of the content area of the %SearchBar control.
505          *
506          * @since               2.0
507          *
508          * @return              An error code
509          * @param[in]   size                            The size of the content area
510          * @exception   E_SUCCESS                       The method is successful.
511          * @exception   E_INVALID_ARG           The specified input parameter is invalid. @n
512          *                                  The width and height of @c size must be greater than or equal to @c 0.
513          * @remarks             The content area must be resized when the orientation of the form is changed once the size of the content area is changed.
514          * @see         GetContentAreaSize()
515          */
516         result SetContentAreaSize(const Tizen::Graphics::Dimension& size);
517
518         /**
519          * Sets the size of the content area of the %SearchBar control.
520          *
521          * @since               2.1
522          *
523          * @return              An error code
524          * @param[in]   size                            The size of the content area
525          * @exception   E_SUCCESS                       The method is successful.
526          * @exception   E_INVALID_ARG           The specified input parameter is invalid. @n
527          *                                  The width and height of @c size must be greater than or equal to @c 0.
528          * @remarks             The content area must be resized when the orientation of the form is changed once the size of the content area is changed.
529          * @see         GetContentAreaSizeF()
530          */
531         result SetContentAreaSize(const Tizen::Graphics::FloatDimension& size);
532
533         /**
534          * Gets the size of the content area of the %SearchBar control.
535          *
536          * @since               2.0
537          *
538          * @return              The size of the content area
539          * @remarks             The content area is the area where the 'content' of the %SearchBar control is displayed. The size of the content areas can
540          *              be changed at runtime.
541          * @see         AddSearchBarEventListener()
542          * @see         ISearchBarEventListener
543          */
544         Tizen::Graphics::Dimension GetContentAreaSize(void) const;
545
546         /**
547          * Gets the size of the content area of the %SearchBar control.
548          *
549          * @since               2.1
550          *
551          * @return              The size of the content area
552          * @remarks             The content area is the area where the 'content' of the %SearchBar control is displayed. The size of the content areas can
553          *              be changed at runtime.
554          * @see         AddSearchBarEventListener()
555          * @see         ISearchBarEventListener
556          */
557         Tizen::Graphics::FloatDimension GetContentAreaSizeF(void) const;
558
559 // Modes
560         /**
561          * Gets the search bar mode.
562          *
563          * @since               2.0
564          *
565          * @return      The search bar mode
566          * @exception   E_SUCCESS                       The method is successful.
567          * @exception   E_SYSTEM                        A system error has occurred.
568          * @remarks     The specific error code can be accessed using the GetLastResult() method.
569          * @see         SetMode()
570          */
571         SearchBarMode GetMode(void) const;
572
573         /**
574          * Checks whether the search bar mode is locked.
575          *
576          * @since               2.0
577          *
578          * @return              @c true if the mode is locked, @n
579          *                              else @c false
580          * @exception   E_SUCCESS                       The method is successful.
581          * @exception   E_SYSTEM                        A system error has occurred.
582          * @remarks             The specific error code can be accessed using the GetLastResult() method.
583          * @see                 SetModeLock()
584          */
585         bool IsModeLocked(void) const;
586
587         /**
588          * Sets the search bar mode.
589          *
590          * @since               2.0
591          *
592          * @return              An error code
593          * @param[in]   mode                The search bar mode
594          * @exception   E_SUCCESS                       The method is successful.
595          * @exception   E_INVALID_OPERATION     The current state of the instance prohibits the execution of the specified operation, or @n
596          *                                                                      the mode is locked.
597          * @exception   E_SYSTEM            A system error has occurred.
598          * @see                 GetMode()
599          * @see                 SetModeLock()
600          */
601         result SetMode(SearchBarMode mode);
602
603         /**
604          * Sets the lock status of the search bar mode.
605          *
606          * @since               2.0
607          *
608          * @return      An error code
609          * @param[in]   modeLocked          Set to @c true to lock the search bar mode, @n
610          *                                                                      else @c false
611          * @exception   E_SUCCESS           The method is successful.
612          * @exception   E_SYSTEM            A system error has occurred.
613          * @see         GetMode()
614          */
615         result SetModeLocked(bool modeLocked);
616
617         /**
618          * Gets the action ID of the search bar button.
619          *
620          * @since               2.0
621          *
622          * @return      The action ID, @n
623          *                              else @c -1 if an error occurs
624          * @exception   E_SUCCESS           The method is successful.
625          * @exception   E_SYSTEM            A system error has occurred.
626          * @remarks
627          *                              - The specific error code can be accessed using the GetLastResult() method.
628          *                              - By default, the method returns @c -1 if no user defined search bar button is set.
629          */
630         int GetButtonActionId(void) const;
631
632         /**
633          * Gets the color of the search bar button for the specified state.
634          *
635          * @since               2.0
636          *
637          * @return              The color of the search bar button, @n
638          *                              else RGBA(0,0,0,0) if an error occurs
639          * @param[in]   status                          The status of the search bar button
640          * @exception   E_SUCCESS                       The method is successful.
641          * @exception   E_SYSTEM                        A system error has occurred.
642          * @remarks             The specific error code can be accessed using the GetLastResult() method.
643          * @see                 SetButtonColor()
644          */
645         Tizen::Graphics::Color GetButtonColor(SearchBarButtonStatus status) const;
646
647         /**
648          * Gets the text color of the search bar button for the specified state.
649          *
650          * @since               2.0
651          *
652          * @return              The text color of the search bar button, @n
653          *                              else RGBA(0,0,0,0) if an error occurs
654          * @param[in]   status              The status of the search bar button
655          * @exception   E_SUCCESS           The method is successful.
656          * @exception   E_SYSTEM            A system error has occurred.
657          * @remarks     The specific error code can be accessed using the GetLastResult() method.
658          */
659         Tizen::Graphics::Color GetButtonTextColor(SearchBarButtonStatus status) const;
660
661         /**
662          * Gets the state of the search bar button.
663          *
664          * @since               2.0
665          *
666          * @return              The state of the search bar button
667          * @exception   E_SUCCESS           The method is successful.
668          * @exception   E_SYSTEM            A system error has occurred.
669          * @remarks             The specific error code can be accessed using the GetLastResult() method.
670          */
671         SearchBarButtonStatus GetButtonStatus(void) const;
672
673         /**
674          * Sets the user defined search bar button.
675          *
676          * @since               2.0
677          *
678          * @return      An error code
679          * @param[in]   text                    The button text
680          * @param[in]   actionId                The button action ID
681          * @exception   E_SUCCESS               The method is successful.
682          * @exception   E_INVALID_ARG   A specified input parameter is invalid, or @n
683          *                                                              the specified @c actionId must be greater than or equal to @c 0.
684          * @exception   E_SYSTEM                A system error has occurred.
685          */
686         result SetButton(const Tizen::Base::String& text, int actionId);
687
688         /**
689          * Sets the enabled status of the search bar button.
690          *
691          * @since               2.0
692          *
693          * @return              An error code
694          * @param[in]   enabled                 Set to @c true to enable the search bar button, @n
695          *                                                              else @c false
696          * @exception   E_SUCCESS               The method is successful.
697          * @exception   E_SYSTEM                A system error has occurred.
698          */
699         result SetButtonEnabled(bool enabled);
700
701         /**
702          * Sets the color of the search bar button for the specified state.
703          *
704          * @since               2.0
705          *
706          * @return              An error code
707          * @param[in]   status          The button status
708          * @param[in]   color           The button color to set
709          * @exception   E_SUCCESS               The method is successful.
710          * @exception   E_SYSTEM                A system error has occurred.
711          * @see                 GetButtonColor()
712          */
713         result SetButtonColor(SearchBarButtonStatus status, const Tizen::Graphics::Color& color);
714
715         /**
716          * Sets the text color of the button of the %SearchBar control for the specified state.
717          *
718          * @since               2.0
719          *
720          * @return              An error code
721          * @param[in]   status                  The button status
722          * @param[in]   color                   The button text color to set
723          * @exception   E_SUCCESS               The method is successful.
724          * @exception   E_SYSTEM                A system error has occurred.
725          */
726         result SetButtonTextColor(SearchBarButtonStatus status, const Tizen::Graphics::Color& color);
727
728         /**
729          * Appends the specified character at the end of the text.
730          *
731          * @since               2.0
732          *
733          * @return              An error code
734          * @param[in]   character               The character to add
735          * @exception   E_SUCCESS               The method is successful.
736          * @exception   E_SYSTEM                A system error has occurred.
737          * @remarks
738          *                              - The method modifies the text buffer that is managed by the %SearchBar control.
739          *                              - To display the changes, the control must be drawn again.
740          */
741         result AppendCharacter(const Tizen::Base::Character& character);
742
743         /**
744          * Appends the specified text at the end of the existing text.
745          *
746          * @since               2.0
747          *
748          * @return              An error code
749          * @param[in]   text            The text to append
750          * @exception   E_SUCCESS       The method is successful.
751          * @exception   E_SYSTEM    A system error has occurred.
752          * @remarks
753          *                              - To denote the end of a line use '\\n'.
754          *                              - The method modifies the text buffer that is managed by the %SearchBar control.
755          *                              - To display the changes, the control must be drawn again.
756          */
757         result AppendText(const Tizen::Base::String& text);
758
759
760         /**
761          * Sets the text to be displayed.
762          *
763          * @since               2.0
764          *
765          * @return              An error code
766          * @param[in]   text                    The text to display
767          * @exception   E_SUCCESS       The method is successful.
768          * @exception   E_SYSTEM        A system error has occurred.
769          * @remarks
770          *                              - To denote the end of a line use '\\n'.
771          *                              - The method modifies the text buffer that is managed by the %SearchBar control.
772          *                              - To display the changes, the control must be drawn again.
773          */
774         result SetText(const Tizen::Base::String& text);
775
776         /**
777          * Inserts the character at the specified index.
778          *
779          * @since               2.0
780          *
781          * @return              An error code
782          * @param[in]   index                   The position to insert the character
783          * @param[in]   character               The character to insert
784          * @exception   E_SUCCESS               The method is successful.
785          * @exception   E_OUT_OF_RANGE  The specified @c index is outside the bounds of the data structure. @n
786          *                              The specified @c index is greater than the number of elements or less than @c 0.
787          * @exception   E_MAX_EXCEEDED  The length of the specified @c text exceeds the system limitation.
788          * @exception   E_SYSTEM                A system error has occurred.
789          * @remarks
790          *                              - The method modifies the text buffer that is managed by the %SearchBar control.
791          *                              - To display the changes, the control must be drawn again.
792          */
793         result InsertCharacterAt(int index, const Tizen::Base::Character& character);
794
795         /**
796          * Inserts the specified text at the specified index.
797          *
798          * @since               2.0
799          *
800          * @return              An error code
801          * @param[in]   index                   The position at which to insert
802          * @param[in]   text                    The text to insert
803          * @exception   E_SUCCESS               The method is successful.
804          * @exception   E_OUT_OF_RANGE  The specified @c index is outside the bounds of the data structure. @n
805          *                                                              The specified @c index is greater than the number of elements or less than @c 0.
806          * @exception   E_MAX_EXCEEDED  The length of the specified @c text exceeds the system limitation.
807          * @exception   E_SYSTEM            A system error has occurred.
808          * @remarks
809          *                              - The method modifies the text buffer that is managed by the %SearchBar control.
810          *                              - To display the changes, the control must be drawn again.
811          */
812         result InsertTextAt(int index, const Tizen::Base::String& text);
813
814         /**
815          * Deletes the character at the specified position.
816          *
817          * @since               2.0
818          *
819          * @return              An error code
820          * @param[in]   index                   The index
821          * @exception   E_SUCCESS               The method is successful.
822          * @exception   E_INVALID_ARG   The specified @c index is negative.
823          * @exception   E_OUT_OF_RANGE  The specified @c index is outside the bounds of the data structure. @n
824          *                              The specified @c index is greater than the number of elements or less than @c 0.
825          * @exception   E_SYSTEM                A system error has occurred.
826          * @remarks
827          *                              - The method modifies the text buffer that is managed by the %SearchBar control.
828          *                              - To display the changes, the control must be drawn again.
829          */
830         result DeleteCharacterAt(int index);
831
832         /**
833          * Clears the text that is displayed by the %SearchBar control.
834          *
835          * @since               2.0
836          *
837          * @return              An error code
838          * @exception   E_SUCCESS               The method is successful.
839          * @exception   E_SYSTEM                A system error has occurred.
840          * @remarks
841          *                              - The method modifies the text buffer that is managed by the %SearchBar control.
842          *                              - To display the changes, the control must be drawn again.
843          */
844         result Clear(void);
845
846         /**
847          * Gets the length of the text that is displayed by the %SearchBar control.
848          *
849          * @since               2.0
850          *
851          * @return              The length of the text, @n
852          *                              else @c -1 if an error occurs
853          * @exception   E_SUCCESS               The method is successful.
854          * @exception   E_SYSTEM                A system error has occurred.
855          * @remarks             The specific error code can be accessed using the GetLastResult() method.
856          */
857         int GetTextLength(void) const;
858
859         /**
860          * Gets the text that is displayed by the %SearchBar control.
861          *
862          * @since               2.0
863          *
864          * @return              The text displayed by the %SearchBar control, @n
865          *                              else an empty string if an error occurs
866          * @exception   E_SUCCESS                       The method is successful.
867          * @exception   E_SYSTEM                        A system error has occurred.
868          * @remarks             The specific error code can be accessed using the GetLastResult() method.
869          * @see                 SetText()
870          */
871         Tizen::Base::String GetText(void) const;
872
873         /**
874          * Gets a portion of text that is displayed by the %SearchBar control.
875          *
876          * @since               2.0
877          *
878          * @return              The specified portion of the text, @n
879          *                              else an empty string if an error occurs
880          * @param[in]   start           The starting index of range
881          * @param[in]   end                 The last index of range
882          * @exception   E_SUCCESS       The method is successful.
883          * @exception   E_OUT_OF_RANGE  The specified index is outside the bounds of the data structure, or @n
884          *                                                              either the @c start or @c end parameter is greater than the number of elements or less than @c 0.
885          * @exception   E_SYSTEM                A system error has occurred.
886          * @remarks             The specific error code can be accessed using the GetLastResult() method.
887          * @see                 SetText()
888          */
889         Tizen::Base::String GetText(int start, int end) const;
890
891         /**
892          * Gets the limit of the length of the text.
893          *
894          * @since               2.0
895          *
896          * @return              The limit of the text length, @n
897          *                              else @c -1 if an error occurs
898          * @exception   E_SUCCESS               The method is successful.
899          * @exception   E_SYSTEM                A system error has occurred.
900          * @remarks
901          *                              - The specific error code can be accessed using the GetLastResult() method.
902          *                              - The default limit length is @c 500.
903          * @see         SetLimitLength()
904          */
905         int GetLimitLength(void) const;
906
907         /**
908          * Sets the limit of the length of the text.
909          *
910          * @since               2.0
911          *
912          * @return              An error code
913          * @param[in]   limitLength             The limit text length to set
914          * @exception   E_SUCCESS               The method is successful.
915          * @exception   E_INVALID_ARG   The specified input parameter is invalid, or @n
916          *                                                              the specified limit length cannot be @c 0 or negative.
917          * @exception   E_SYSTEM                A system error has occurred.
918          * @see                 GetLimitLength()
919          */
920         result SetLimitLength(int limitLength);
921
922         /**
923          * Shows the keypad associated with the %SearchBar control.
924          *
925          * @since               2.0
926          *
927          * @return              An error code
928          * @exception   E_SUCCESS               The method is successful.
929          * @exception   E_INVALID_STATE This instance is in an invalid state.
930          * @exception   E_SYSTEM                A system error has occurred.
931          * @see                 HideKeypad()
932          */
933         result ShowKeypad(void) const;
934
935         /**
936          * Hides the keypad associated with the %SearchBar control.
937          *
938          * @since               2.0
939          *
940          * @return              An error code
941          * @exception   E_SUCCESS               The method is successful.
942          * @exception   E_SYSTEM                A system error has occurred.
943          * @see                 ShowKeypad()
944          */
945         result HideKeypad(void) const;
946
947         /**
948          * Gets the text size of the search field.
949          *
950          * @since               2.0
951          *
952          * @return      The size of the text, @n
953          *              else @c -1 if an error occurs
954          * @exception   E_SUCCESS               The method is successful.
955          * @exception   E_SYSTEM                A system error has occurred.
956          * @remarks     The specific error code can be accessed using the GetLastResult() method.
957          * @see         SetSearchFieldTextSize()
958          */
959         int GetSearchFieldTextSize(void) const;
960
961         /**
962          * Gets the text size of the search field.
963          *
964          * @since               2.1
965          *
966          * @return      The size of the text, @n
967          *              else @c -1 if an error occurs
968          * @exception   E_SUCCESS               The method is successful.
969          * @exception   E_SYSTEM                A system error has occurred.
970          * @remarks     The specific error code can be accessed using the GetLastResult() method.
971          * @see         SetSearchFieldTextSize()
972          */
973         float GetSearchFieldTextSizeF(void) const;
974
975         /**
976          * Sets the text size of the text field of the %SearchBar control.
977          *
978          * @since               2.0
979          *
980          * @return              An error code
981          * @param[in]   size                    The text size
982          * @exception   E_SUCCESS               The method is successful.
983          * @exception   E_INVALID_ARG   The specified input parameter is invalid, or @n
984          *                                                              the specified @c size cannot be a negative value.
985          * @exception   E_SYSTEM                A system error has occurred.
986          * @see                 GetSearchFieldTextSize()
987          */
988         result SetSearchFieldTextSize(int size);
989
990         /**
991          * Sets the text size of the text field of the %SearchBar control.
992          *
993          * @since               2.1
994          *
995          * @return              An error code
996          * @param[in]   size                    The text size
997          * @exception   E_SUCCESS               The method is successful.
998          * @exception   E_INVALID_ARG   The specified input parameter is invalid, or @n
999          *                                                              the specified @c size cannot be a negative value.
1000          * @exception   E_SYSTEM                A system error has occurred.
1001          * @see                 GetSearchFieldTextSizeF()
1002          */
1003         result SetSearchFieldTextSize(float size);
1004
1005         /**
1006          * Gets the start and the end index of the currently selected text block.
1007          *
1008          * @since               2.0
1009          *
1010          * @return              An error code
1011          * @param[out]  start                   The start index of the text block
1012          * @param[out]  end                             The end index of the text block
1013          * @exception   E_SUCCESS               The method is successful.
1014          * @exception   E_SYSTEM                A system error has occurred.
1015          * @remarks             The method returns @c start = 0 and @c end = 0 if no text block is selected.
1016          * @see                 ReleaseBlock()
1017          * @see                 SetBlockRange()
1018          */
1019         result GetBlockRange(int& start, int& end) const;
1020
1021         /**
1022          * Releases the selection of the current text block.
1023          *
1024          * @since               2.0
1025          *
1026          * @return              An error code
1027          * @exception   E_SUCCESS                       The method is successful.
1028          * @exception   E_SYSTEM                        A system error has occurred.
1029          * @see                 GetBlockRange()
1030          * @see                 SetBlockRange()
1031          */
1032         result ReleaseBlock(void);
1033
1034         /**
1035          * Sets the block range for the text.
1036          *
1037          * @since               2.0
1038          *
1039          * @return              An error code
1040          * @param[in]   start           The start index of the text block
1041          * @param[in]   end             The end index of the text block
1042          * @exception   E_SUCCESS       The method is successful.
1043          * @exception   E_OUT_OF_RANGE  The specified index is outside the bounds of the data structure, or @n
1044          *                                                              either the @c start or @c end parameter is greater than the number of elements or less than @c 0.
1045          * @exception   E_SYSTEM                A system error has occurred.
1046          * @see                 ReleaseBlock()
1047          * @see                 GetBlockRange()
1048          */
1049         result SetBlockRange(int start, int end);
1050
1051         /**
1052          * Removes the text of the selected text block.
1053          *
1054          * @since               2.0
1055          *
1056          * @return              An error code
1057          * @exception   E_SUCCESS                       The method is successful.
1058          * @exception   E_SYSTEM                        A system error has occurred.
1059          */
1060         result RemoveTextBlock(void);
1061
1062         /**
1063          * Gets the color of the %SearchBar control for the specified status.
1064          *
1065          * @since               2.0
1066          *
1067          * @return              The color of the %SearchBar control, @n
1068          *                              else RGBA(0,0,0,0) if an error occurs
1069          * @exception   E_SUCCESS               The method is successful.
1070          * @exception   E_SYSTEM                A system error has occurred.
1071          * @remarks             The specific error code can be accessed using the GetLastResult() method.
1072          * @see                 SetColor()
1073          */
1074         Tizen::Graphics::Color GetColor(void) const;
1075
1076         /**
1077          * Gets the color of the search field for the specified status.
1078          *
1079          * @since               2.0
1080          *
1081          * @return              The color, @n
1082          *                              else RGBA(0,0,0,0) if an error occurs
1083          * @param[in]   status                  The search field status
1084          * @exception   E_SUCCESS               The method is successful.
1085          * @exception   E_SYSTEM                A system error has occurred.
1086          * @remarks             The specific error code can be accessed using the GetLastResult() method.
1087          * @see                 SetSearchFieldColor()
1088          */
1089         Tizen::Graphics::Color GetSearchFieldColor(SearchFieldStatus status) const;
1090
1091         /**
1092          * Gets the text color of the search field for the specified status.
1093          *
1094          * @since               2.0
1095          *
1096          * @return              The text color, @n
1097          *                              else RGBA(0,0,0,0) if an error occurs
1098          * @param[in]   status                  The search field status
1099          * @exception   E_SUCCESS               The method is successful.
1100          * @exception   E_SYSTEM                A system error has occurred.
1101          * @remarks             The specific error code can be accessed using the GetLastResult() method.
1102          * @see                 SetSearchFieldTextColor()
1103          */
1104         Tizen::Graphics::Color GetSearchFieldTextColor(SearchFieldStatus status) const;
1105
1106         /**
1107          * Sets the background bitmap of the %SearchBar control.
1108          *
1109          * @since               2.0
1110          *
1111          * @return              An error code
1112          * @param[in]   bitmap                  The background bitmap
1113          * @exception   E_SUCCESS               The method is successful.
1114          * @exception   E_SYSTEM                A system error has occurred.
1115          */
1116         result SetBackgroundBitmap(const Tizen::Graphics::Bitmap& bitmap);
1117
1118         /**
1119          * Sets the color of the search bar.
1120          *
1121          * @since               2.0
1122          *
1123          * @return              An error code
1124          * @param[in]   color                   The color
1125          * @exception   E_SUCCESS               The method is successful.
1126          * @exception   E_SYSTEM                A system error has occurred.
1127          * @see                 GetColor()
1128          */
1129         result SetColor(const Tizen::Graphics::Color& color);
1130
1131         /**
1132          * Sets the color of the search field for the specified status.
1133          *
1134          * @since               2.0
1135          *
1136          * @return              An error code
1137          * @param[in]   status                          The state of the search field
1138          * @param[in]   color                           The text color
1139          * @exception   E_SUCCESS                       The method is successful.
1140          * @exception   E_SYSTEM                        A system error has occurred.
1141          * @see                 GetSearchFieldColor()
1142          */
1143         result SetSearchFieldColor(SearchFieldStatus status, const Tizen::Graphics::Color& color);
1144
1145         /**
1146          * Sets the text color of the search field for the specified status.
1147          *
1148          * @since               2.0
1149          *
1150          * @return              An error code
1151          * @param[in]   status                  The state of the search field
1152          * @param[in]   color                   The text color
1153          * @exception   E_SUCCESS               The method is successful.
1154          * @exception   E_SYSTEM                A system error has occurred.
1155          * @see                 GetSearchFieldTextColor()
1156          */
1157         result SetSearchFieldTextColor(SearchFieldStatus status, const Tizen::Graphics::Color& color);
1158
1159         /**
1160          * Gets the guide text.
1161          *
1162          * @since               2.0
1163          *
1164          * @return              The guide text, @n
1165          *                              else an empty string if an error occurs
1166          * @exception   E_SUCCESS        The method is successful.
1167          * @exception   E_SYSTEM         A system error has occurred.
1168          * @remarks             The specific error code can be accessed using the GetLastResult() method.
1169          * @see                 GetGuideText()
1170          */
1171         Tizen::Base::String GetGuideText(void) const;
1172
1173         /**
1174          * Sets the guide text. @n
1175          * This text is displayed when there is no text in the %SearchBar control.
1176          *
1177          * @since               2.0
1178          *
1179          * @return              An error code
1180          * @param[in]   guideText                       The guide text
1181          * @exception   E_SUCCESS                       The method is successful.
1182          * @exception   E_SYSTEM                        A system error has occurred.
1183          * @see                 GetGuideText()
1184          */
1185         result SetGuideText(const Tizen::Base::String& guideText);
1186
1187         /**
1188          * Gets the text color of the guide text.
1189          *
1190          * @since               2.0
1191          *
1192          * @return              The text color of the guide text, @n
1193          *                              else RGBA(0,0,0,0) if an error occurs
1194          * @exception   E_SUCCESS                       The method is successful.
1195          * @exception   E_SYSTEM                        A system error has occurred.
1196          * @remarks             The specific error code can be accessed using the GetLastResult() method.
1197          * @see                 SetGuideTextColor()
1198          */
1199         Tizen::Graphics::Color GetGuideTextColor(void) const;
1200
1201         /**
1202          * Sets the text color of the guide text.
1203          *
1204          * @since               2.0
1205          *
1206          * @return              An error code
1207          * @param[in]   color                           The guide text color
1208          * @exception   E_SUCCESS                       The method is successful.
1209          * @exception   E_SYSTEM                        A system error has occurred.
1210          * @see                 GetGuideTextColor()
1211          */
1212         result SetGuideTextColor(const Tizen::Graphics::Color& color);
1213
1214 // Cursor
1215         /**
1216          * Gets the current cursor position index.
1217          *
1218          * @since               2.0
1219          *
1220          * @return              The cursor position, @n
1221          *                              else @c -1 if an error occurs
1222          * @exception   E_SUCCESS                       The method is successful.
1223          * @exception   E_SYSTEM                        A system error has occurred.
1224          * @remarks             The specific error code can be accessed using the GetLastResult() method.
1225          * @see                 SetCursorPosition()
1226          */
1227         int GetCursorPosition(void) const;
1228
1229         /**
1230          * Sets the cursor at the specified index.
1231          *
1232          * @since               2.0
1233          *
1234          * @return              An error code
1235          * @param[in]   index                   The cursor index
1236          * @exception   E_SUCCESS               The method is successful.
1237          * @exception   E_OUT_OF_RANGE  The specified @c index is outside the bounds of the data structure. @n
1238          *                                                              The specified @c index is greater than the number of elements or less than @c 0.
1239          * @exception   E_SYSTEM            A system error has occurred.
1240          * @see                 GetCursorPosition()
1241          */
1242         result SetCursorPosition(int index);
1243
1244         /**
1245          * Checks whether the lowercase mode is enabled.
1246          *
1247          * @since               2.0
1248          *
1249          * @return              @c true if the lowercase mode is enabled, @n
1250          *                              else @c false
1251          * @exception   E_SUCCESS               The method is successful.
1252          * @exception   E_SYSTEM                A system error has occurred.
1253          * @remarks             The specific error code can be accessed using the GetLastResult() method.
1254          * @see                 SetLowerCaseModeEnabled()
1255          */
1256         bool IsLowerCaseModeEnabled(void) const;
1257
1258         /**
1259          * Enables or disables the lowercase mode.
1260          *
1261          * @since               2.0
1262          *
1263          * @param[in]   enable                  Set to @c true to enable the lowercase mode, @n
1264          *                                                              else @c false
1265          * @exception   E_SUCCESS               The method is successful.
1266          * @exception   E_SYSTEM                A system error has occurred.
1267          * @see                 IsLowerCaseModeEnabled()
1268          */
1269         void SetLowerCaseModeEnabled(bool enable);
1270
1271 // Ellipsis
1272         /**
1273          * Gets the ellipsis position.
1274          *
1275          * @since               2.0
1276          *
1277          * @return              The ellipsis position
1278          * @exception   E_SUCCESS                       The method is successful.
1279          * @exception   E_SYSTEM                        A system error has occurred.
1280          * @remarks             The specific error code can be accessed using the GetLastResult() method.
1281          * @see                 SetEllipsisPosition()
1282          */
1283         EllipsisPosition GetEllipsisPosition(void) const;
1284
1285         /**
1286          * Sets the ellipsis position.
1287          *
1288          * @since               2.0
1289          *
1290          * @return              An error code
1291          * @param[in]   position                        The ellipsis position
1292          * @exception   E_SUCCESS                       The method is successful.
1293          * @exception   E_SYSTEM                        A system error has occurred.
1294          * @see                 GetEllipsisPosition()
1295          */
1296         result SetEllipsisPosition(EllipsisPosition position);
1297
1298         /**
1299         * Sets the input language.
1300         *
1301         * @since 2.0
1302         *
1303         * @brief <i> [Deprecated]  </i>
1304         * @deprecated We no longer provide a method to set the language of the current keypad. @n
1305         *                                        This method is provided only for backward compatibility and will be deleted in the near future.
1306         * @return     An error code
1307         * @param[in]  languageCode               The language to set
1308         * @exception  E_SUCCESS              The method is successful.
1309         * @exception  E_OUT_OF_MEMORY                   The memory is insufficient.
1310         * @remarks
1311         *                               - The application can set the language of the current keypad that is associated with the current %SearchBar.
1312         *                               - This method only works if the language to set is supported by the current preloaded keypad.
1313         */
1314
1315         result SetCurrentLanguage(Tizen::Locales::LanguageCode languageCode);
1316
1317         /**
1318         * Gets the current input language.
1319         *
1320         * @since 2.0
1321         *
1322         * @return     An error code
1323         * @param[out] language               The current input language
1324         * @exception     E_SUCCESS                             The method is successful.
1325         * @remarks   The application can get the current language of the keypad that is associated with the current %SearchBar.
1326         */
1327
1328         result GetCurrentLanguage(Tizen::Locales::LanguageCode& language) const;
1329
1330         /**
1331          * Gets the keypad action type.
1332          *
1333          * @since               2.0
1334          *
1335          * @return              The keypad action
1336          * @exception   E_SUCCESS                       The method is successful.
1337          * @exception   E_SYSTEM                        A system error has occurred.
1338          * @remarks             The specific error code can be accessed using the GetLastResult() method.
1339          */
1340         KeypadAction GetKeypadAction(void) const;
1341
1342         /**
1343         * Checks whether the text prediction is enabled.
1344         *
1345         * @since 2.0
1346         * @return                @c true if the text prediction is enabled, @n
1347         *                                 else @c false
1348         * @exception          E_SUCCESS                The method is successful.
1349         * @see                      SetTextPredictionEnabled()
1350         */
1351         bool IsTextPredictionEnabled(void) const;
1352
1353         /**
1354         * Enables or disables the text prediction.
1355         *
1356         * @since 2.0
1357         * @param[in]           enable                       Set to @c true to enable the text prediction, @n
1358         *                                                                    else @c false
1359         * @return                An error code
1360         * @exception           E_SUCCESS                The method is successful.
1361         * @exception            E_UNSUPPORTED_OPERATION     This operation is not supported.
1362         * @see                      IsTextPredictionEnabled()
1363         */
1364         result SetTextPredictionEnabled(bool enable);
1365
1366         /**
1367          * Adds the specified action event listener. @n
1368          * The added listener is notified when the user clicks the search bar button.
1369          *
1370          * @since               2.0
1371          *
1372          * @param[in]   listener        The event listener to add
1373          * @see                 RemoveActionEventListener()
1374          */
1375         void AddActionEventListener(Tizen::Ui::IActionEventListener& listener);
1376
1377         /**
1378          * Removes the specified action event listener. @n
1379          * The removed listener cannot listen to events when they are fired.
1380          *
1381          * @since               2.0
1382          *
1383          * @param[in]   listener        The event listener to remove
1384          * @see                 AddActionEventListener()
1385          */
1386         void RemoveActionEventListener(Tizen::Ui::IActionEventListener& listener);
1387
1388         /**
1389          * Adds the specified text event listener. @n
1390          * The added listener can listen to events on the context of the specified event dispatcher when they are fired.
1391          *
1392          * @since               2.0
1393          *
1394          * @param[in]   listener                The event listener to add
1395          * @remarks             The added listener is notified when: @n
1396          *              @li The user presses a key on the software keypad.
1397          *              @li The user selects a word in the candidate list.
1398          *              @li The user pastes a text.
1399          * @see                 RemoveTextEventListener()
1400          */
1401         void AddTextEventListener(Tizen::Ui::ITextEventListener& listener);
1402
1403         /**
1404          * Removes the specified text event listener. @n
1405          * The removed listener cannot listen to events when they are fired.
1406          *
1407          * @since               2.0
1408          *
1409          * @param[in]   listener        The event listener to remove
1410          * @see                 AddTextEventListener()
1411          */
1412         void RemoveTextEventListener(Tizen::Ui::ITextEventListener& listener);
1413
1414         /**
1415          * Adds the specified search bar event listener. @n
1416          * The added listener can listen to events on the context of the specified event dispatcher when they are fired.
1417          *
1418          * @since               2.0
1419          *
1420          * @param[in]   listener        The event listener to add
1421          * @remarks             The added listener is notified when: @n
1422          *              @li The user presses a key on the software keypad.
1423          *              @li The user selects a word in the candidate list.
1424          *              @li The user pastes a text.
1425          * @see                 AddSearchBarEventListener()
1426          */
1427         void AddSearchBarEventListener(ISearchBarEventListener& listener);
1428
1429         /**
1430          * Removes the specified search bar event listener. @n
1431          * The removed listener cannot listen to events when they are fired.
1432          *
1433          * @since               2.0
1434          *
1435          * @param[in]   listener        The event listener to remove
1436          * @see         RemoveTextEventListener()
1437          */
1438         void RemoveSearchBarEventListener(ISearchBarEventListener& listener);
1439
1440         /**
1441          * Adds the specified text block event listener.
1442          *
1443          * @since               2.0
1444          *
1445          * @param[in]   listener        The event listener to add
1446          * @remarks             Programmatically, modification of the text selection does not cause the text block selection event to fire.
1447          * @see                 RemoveTextBlockEventListener()
1448          */
1449         void AddTextBlockEventListener(Tizen::Ui::ITextBlockEventListener& listener);
1450
1451         /**
1452          * Removes the specified text block event listener. @n
1453          * The removed listener cannot listen to events when they are fired.
1454          *
1455          * @since               2.0
1456          *
1457          * @param[in]   listener        The event listener to remove
1458          * @see                 AddTextBlockEventListener()
1459          */
1460         void RemoveTextBlockEventListener(Tizen::Ui::ITextBlockEventListener& listener);
1461
1462         /**
1463          * Adds the specified keypad event listener. @n
1464          * The added listener is notified when the keypad associated with this text editor is opened or closed.
1465          *
1466          * @since               2.0
1467          *
1468          * @param[in]   listener        The event listener to add
1469          * @see         RemoveKeypadEventListener()
1470          */
1471         void AddKeypadEventListener(Tizen::Ui::IKeypadEventListener& listener);
1472
1473         /**
1474          * Removes the specified keypad event listener. @n
1475          * The removed listener cannot listen to events when they are fired.
1476          *
1477          * @since               2.0
1478          *
1479          * @param[in]   listener        The event listener to remove
1480          * @see                 AddKeypadEventListener()
1481          */
1482         void RemoveKeypadEventListener(Tizen::Ui::IKeypadEventListener& listener);
1483
1484         /**
1485         * Adds a listener instance for language events. @n
1486         * The added listener is notified when the input language is changed.
1487         *
1488         * @since 2.0
1489         *
1490         * @param[in]  listener               The listener to add
1491         * @remarks    The application can recognize when the language is changed from the keypad by adding Tizen::Ui::ILanguageEventListener.
1492         * @see            RemoveLanguageEventListener()
1493         */
1494
1495         void AddLanguageEventListener(Tizen::Ui::ILanguageEventListener& listener);
1496
1497         /**
1498         * Removes the specified listener instance. @n
1499         * The removed listener cannot listen to events when they are fired.
1500         *
1501         * @since 2.0
1502         *
1503         * @param[in]  listener               The listener to remove
1504         * @see             AddLanguageEventListener()
1505         */
1506
1507         void RemoveLanguageEventListener(Tizen::Ui::ILanguageEventListener& listener);
1508
1509         /**
1510          * Sets the text filter.
1511          *
1512          * @since               2.1
1513          *
1514          * @param[in]           pFilter The filter
1515          * @remarks     The %SearchBar control checks with the registered filter to decide whether the user-entered text should be replaced.
1516          */
1517         void  SetEditTextFilter(IEditTextFilter* pFilter);
1518
1519         /**
1520         * Sends opaque command to the input method.
1521         *
1522         * @since     2.1
1523         *
1524         * @param[in] command            The opaque command
1525         * @remarks
1526         *                               - This method can be used to provide domain-specific features that are only known between certain input methods and their clients.
1527         *                               - This method may not work, depending on the active Input Method.
1528         */
1529         void SendOpaqueCommand (const Tizen::Base::String& command);
1530
1531 protected:
1532         friend class _SearchBarImpl;
1533
1534 private:
1535         //
1536         // The implementation of this copy constructor is intentionally blank and declared as private to prohibit copying of objects.
1537         //
1538         SearchBar(const SearchBar& rhs);
1539
1540         //
1541         // The implementation of this copy assignment operator is intentionally blank and declared as private to prohibit copying of objects.
1542         //
1543         SearchBar& operator =(const SearchBar& rhs);
1544
1545 }; // SearchBar
1546
1547 }}} // Tizen::Ui::Controls
1548
1549 #endif // _FUI_CTRL_SEARCH_BAR_H_