Tizen 2.1 base
[framework/osp/uifw.git] / src / ui / inc / FUiCtrl_SearchBarImpl.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_SearchBarImpl.h
20  * @brief               This is the header file for the _SearchBarImpl class.
21  *
22  * This header file contains the declarations of the %_SearchBarImpl class.
23  */
24
25 #ifndef _FUI_CTRL_INTERNAL_SEARCH_BAR_IMPL_H_
26 #define _FUI_CTRL_INTERNAL_SEARCH_BAR_IMPL_H_
27
28 #include <FUiCtrlSearchBar.h>
29 #include "FUi_ControlImpl.h"
30 #include "FUiCtrl_IActionEventListener.h"
31 #include "FUiCtrl_IKeypadEventListener.h"
32 #include "FUiCtrl_ILanguageEventListener.h"
33 #include "FUiCtrl_ITextBlockEventListener.h"
34 #include "FUiCtrl_ITextEventListener.h"
35 #include "FUiCtrl_ISearchBarEventListener.h"
36 #include "FUiCtrl_PublicKeypadEvent.h"
37 #include "FUiCtrl_PublicLanguageEvent.h"
38 #include "FUiCtrl_PublicSearchBarEvent.h"
39 #include "FUiCtrl_SearchBar.h"
40
41
42 namespace Tizen { namespace Ui { namespace Controls
43 {
44 class _PublicActionEvent;
45 class _PublicTextEvent;
46 class _PublicTextBlockEvent;
47
48 class _SearchBarImpl
49         : public _ControlImpl
50         , public _IActionEventListener
51         , public _IKeypadEventListener
52         , public _ILanguageEventListener
53         , public _ITextBlockEventListener
54         , public _ITextEventListener
55         , public _ISearchBarEventListener
56         , virtual public Tizen::Base::Runtime::IEventListener
57 {
58 public:
59         static _SearchBarImpl* CreateSearchBarImplN(SearchBar* pCore, const Tizen::Graphics::Rectangle& bounds, bool enableSearchBarButton = true, KeypadAction keypadAction = KEYPAD_ACTION_SEARCH);
60
61         /**
62          * This is default constructor for this class.
63          *
64          * @since       2.0
65          */
66         _SearchBarImpl(SearchBar* pPublic, _SearchBar* pCore);
67
68         /**
69          * This is the destructor for this class.
70          *
71          * @since       2.0
72          */
73         virtual ~_SearchBarImpl(void);
74
75         virtual const char* GetPublicClassName(void) const;
76         virtual const SearchBar& GetPublic(void) const;
77         virtual SearchBar& GetPublic(void);
78         virtual const _SearchBar& GetCore(void) const;
79         virtual _SearchBar& GetCore(void);
80
81         /**
82          * Gets the content of %Control.
83          *
84          * @since                2.0
85          * @return       The control that is displayed in the SearchBar's content area in SEARCH_BAR_MODE_INPUT mode, @n
86          *                               else @c null if an error occurs
87          * @exception    E_SUCCESS                      The method was successful.
88          * @remarks      The specific error code can be accessed using the GetLastResult() method.
89          */
90         Tizen::Ui::Control* GetContent(void) const;
91
92         /**
93          * Sets the content control.
94          *
95          * @since               2.0
96          * @return      An error code
97          * @param[in]   pContent           The control that is to be displayed in the
98          *                                 SearchBar's content area.
99          * @exception   E_SUCCESS          The method was successful.
100          * @exception   E_INVALID_ARG      A specified input parameter is invalid. @n
101          *                                 The following controls cannot be set as the
102          *                                 content: @n
103          *                                 @li All classes derived from Window class
104          *                                 @li All picker classes (ex: DateTimePicker)
105          *                                 @li Form
106          *                                 @li Keypad
107          *                                 @li OverlayPanel
108          * @exception   E_SYSTEM           A system error occurred.
109          * @remarks     The specified content control is displayed when the SearchBar controls mode is changed to SEARCH_BAR_MODE_INPUT.
110          * @see         GetContentAreaSize()
111          * @see         AddSearchBarEventListener()
112          * @see         ISearchBarEventListener
113          */
114         result SetContent(const Tizen::Ui::Control* pContent);
115
116         /**
117          * Updates the content area of the SearchBar control.
118          *
119          * @since  2.0
120          * @return      An error code
121          * @param[in]   show        A Boolean flag indicating whether to perform show on the content area.
122          * @exception   E_SUCCESS              The method was successful.
123          * @exception   E_INVALID_OPERATION    The current state of the instance prohibits the execution of the specified operation @n
124          *                                     -- the current mode of SearchBar prohibits the execution of the method. @n
125          * @exception   E_SYSTEM               A system error occurred.
126          * @remarks     The method performs Invalidate() on the content area.
127          */
128         result UpdateContentArea(bool invalidate = true);
129
130         /**
131          * Sets the visibility state of the content area.
132          *
133          * @since       2.0
134          * @return      An error code
135          * @param[in]   visible            The visibility state of the content area.
136          * @exception   E_SUCCESS          The method was successful.
137          * @exception   E_SYSTEM           A system error occurred.
138          * @see         IsContentAreaVisible()
139          */
140         result SetContentAreaVisible(bool visible);
141
142         /**
143          * Checks whether the content area is visible.
144          *
145          * @since       2.0
146          * @return      The visibility state of the content area.
147          * @exception   E_SUCCESS           The method was successful.
148          * @see         SetContentAreaVisible()
149          */
150         bool IsContentAreaVisible(void) const;
151
152         /**
153          * Sets the size of the content area of the SearchBar control.
154          *
155          * @since       2.0
156          * @return      An error code
157          * @param[in]   size               The content area size.
158          * @exception   E_SUCCESS          The method was successful.
159          * @exception   E_INVALID_ARG      A specified input parameter is invalid. @n
160          *                                 -- width and height of @c size must be greater than or equal to @c 0.
161          * @remarks     You must resize the content area when the Form's orientation is changed once you change the
162
163          *              the size of the content area.
164
165          * @see         GetContentAreaSize()
166          */
167         result SetContentAreaSize(const Tizen::Graphics::Dimension& size);
168
169         /**
170          * Gets the size of the content area of the SearchBar control.
171          *
172          * @since               2.0
173          * @return      The size of the content area
174          * @remarks     The content area is the area where the 'content' of the SearchBar control is displayed. The size of the content areas can
175          *              be changed at runtime.
176          * @see         AddSearchBarEventListener()
177          * @see         ISearchBarEventListener
178          */
179         Tizen::Graphics::Dimension GetContentAreaSize(void) const;
180
181         /**
182          * Gets the search bar mode.
183          *
184          * @since               2.0
185          * @return      The search bar mode
186          * @exception   E_SUCCESS           The method was successful.
187          * @exception   E_SYSTEM            A system error occurred.
188          * @remarks     The specific error code can be accessed using the GetLastResult() method.
189          * @see         SetMode()
190          */
191         SearchBarMode GetMode(void) const;
192
193         /**
194          * Determines whether the search bar mode is locked.
195          *
196          * @since               2.0
197          * @return      @c true if the mode is locked, @n
198          *                              else @c false
199          * @exception   E_SUCCESS           The method was successful.
200          * @exception   E_SYSTEM            A system error occurred.
201          * @remarks     The specific error code can be accessed using the GetLastResult() method.
202          * @see         SetModeLock()
203          */
204         bool IsModeLocked(void) const;
205
206         /**
207          * Sets the search bar mode.
208          *
209          * @since               2.0
210          * @return      An error code
211          * @exception   E_SUCCESS           The method was successful.
212          * @exception   E_INVALID_OPERATION     The current state of the instance prohibits the execution of the specified operation, or the mode is locked.
213          * @exception   E_SYSTEM            A system error occurred.
214          * @see         GetMode()
215          * @see         SetModeLock()
216          */
217         result SetMode(SearchBarMode mode);
218
219         /**
220          * Locks or unlocks the search bar mode.
221          *
222          * @since               2.0
223          * @return      An error code
224          * @param[in]   modeLocked      The mode lock
225          * @exception   E_SUCCESS       The method was successful.
226          * @exception   E_SYSTEM        A system error occurred.
227          * @see         GetMode()
228          */
229         result SetModeLocked(bool modeLocked);
230
231         /**
232          * Gets the search bar button's action Id
233          *
234          * @since               2.0
235          * @return      The action ID, @n
236          *                              else @c -1 if an error occurs
237          * @exception   E_SUCCESS           The method was successful.
238          * @exception   E_SYSTEM            A system error occurred.
239          * @remarks     The specific error code can be accessed using the GetLastResult() method. @n
240          *                              By default, the method returns @c -1 if no user defined search bar button is set.
241          */
242         int GetButtonActionId(void) const;
243
244         /**
245          * Gets the color of the search bar button for the specified state.
246          *
247          * @since               2.0
248          * @return      The color of the search bar button, @n
249          *                              else RGBA(0,0,0,0) if an error occurs
250          * @param[in]   status              The search bar button's status
251          * @exception   E_SUCCESS           The method was successful.
252          * @exception   E_SYSTEM            A system error occurred.
253          * @remarks     The specific error code can be accessed using the GetLastResult() method.
254          * @see         SetButtonColor()
255          */
256         Tizen::Graphics::Color GetButtonColor(SearchBarButtonStatus status) const;
257
258         /**
259          * Gets the text color of the search bar button for the specified state.
260          *
261          * @since               2.0
262          * @return      The text color of the search bar button, @n
263          *                              else RGBA(0,0,0,0) if an error occurs
264          * @param[in]   status              The search bar button's status
265          * @exception   E_SUCCESS           The method was successful.
266          * @exception   E_SYSTEM            A system error occurred.
267          * @remarks     The specific error code can be accessed using the GetLastResult() method.
268          */
269         Tizen::Graphics::Color GetButtonTextColor(SearchBarButtonStatus status) const;
270
271         /**
272          * Gets the state of the search bar button.
273          *
274          * @since               2.0
275          * @return      The state of the search bar button
276          * @exception   E_SUCCESS           The method was successful.
277          * @exception   E_SYSTEM            A system error occurred.
278          * @remarks     The specific error code can be accessed using the GetLastResult() method.
279          */
280         SearchBarButtonStatus GetButtonStatus(void) const;
281
282         /**
283          * Sets the user defined search bar button.
284          *
285          * @since               2.0
286          * @return      An error code
287          * @param[in]   text            The button text
288          * @param[in]   actionId        The button action ID
289          * @exception   E_SUCCESS       The method was successful.
290          * @exception   E_INVALID_ARG   A specified input parameter is invalid, or the action ID of the specified item must greater than or equal to zero.
291          * @exception   E_SYSTEM        A system error occurred.
292          */
293         result SetButton(const Tizen::Base::String& text, int actionId);
294
295         /**
296          * Enables or disables the search bar button.
297          *
298          * @since               2.0
299          * @return      An error code
300          * @param[in]   enabled         Set to @c true to enable the search bar button, @n
301          *                              else @c false
302          * @exception   E_SUCCESS       The method was successful.
303          * @exception   E_SYSTEM        A system error occurred.
304          */
305         result SetButtonEnabled(bool enabled);
306
307         /**
308          * Sets the search bar button's color for the specified state.
309          *
310          * @since               2.0
311          * @return              An error code
312          * @param[in]   status          The button status
313          * @param[in]   color           The button color to set
314          * @exception   E_SUCCESS       The method was successful.
315          * @exception   E_SYSTEM            A system error occurred.
316          * @see         GetButtonColor()
317          */
318         result SetButtonColor(SearchBarButtonStatus status, const Tizen::Graphics::Color& color);
319
320         /**
321          * Sets the text color of the SearchBar control's button for the specified state.
322          *
323          * @since               2.0
324          * @return      An error code
325          * @param[in]   status          The button status
326          * @param[in]   color           The button text color to set
327          * @exception   E_SUCCESS       The method was successful.
328          * @exception   E_SYSTEM        A system error occurred.
329          */
330         result SetButtonTextColor(SearchBarButtonStatus status, const Tizen::Graphics::Color& color);
331
332         /**
333          * Appends the specified character at the end of the text.
334          *
335          * @since               2.0
336          * @return              An error code
337          * @param[in]   character           The character to add
338          * @exception   E_SUCCESS       The method was successful.
339          * @exception   E_SYSTEM            A system error occurred.
340          * @remarks             The method modifies the text buffer that is managed by the SearchBar control. @n
341          *              To display the changes, the control must be drawn again.
342          */
343         result AppendCharacter(const Tizen::Base::Character& character);
344
345         /**
346          * Appends the specified text at the end of the existing text.
347          *
348          * @since               1.0
349          * @return              An error code
350          * @param[in]   text        The text to append
351          * @exception   E_SUCCESS   The method was successful.
352          * @exception   E_SYSTEM    A system error occurred.
353          * @remarks     To denote the end of a line use '\\n'. @n
354          *              The method modifies the text buffer that is managed by the SearchBar control. @n
355          *              To display the changes, the control must be drawn again.
356          */
357         result AppendText(const Tizen::Base::String& text);
358
359         /**
360          * Sets the text to display.
361          *
362          * @since               2.0
363          * @return              An error code
364          * @param[in]   text            The text to display
365          * @exception   E_SUCCESS       The method was successful.
366          * @exception   E_SYSTEM        A system error occurred.
367          * @remarks     To denote the end of a line use '\\n'. @n
368          *              The method modifies the text buffer that is managed by the SearchBar control. @n
369          *              To display the changes, the control must be drawn again.
370          */
371         result SetText(const Tizen::Base::String& text);
372
373         /**
374          * Inserts the character at the specified index.
375          *
376          * @since               2.0
377          * @return              An error code
378          * @param[in]   index               The position to insert the character
379          * @param[in]   character           The character to insert
380          * @exception   E_SUCCESS       The method was successful.
381          * @exception   E_OUT_OF_RANGE  The specified @c index is outside the bounds of the data structure. @n
382          *                              -- @c index is greater than the number of elements or less than zero.
383          * @exception   E_MAX_EXCEEDED  The length of the specified @c text exceeds the system limitation.
384          * @exception   E_SYSTEM        A system error occurred.
385          * @remarks     The method modifies the text buffer that is managed by the SearchBar control.
386          *              To display the changes, the control must be drawn again.
387          */
388         result InsertCharacterAt(int index, const Tizen::Base::Character& character);
389
390         /**
391          * Inserts the specified text at the specified index.
392          *
393          * @since               2.0
394          * @return              An error code
395          * @param[in]   index               The position at which to insert.
396          * @param[in]   text                The text to be inserted
397          * @exception   E_SUCCESS       The method was successful.
398          * @exception   E_OUT_OF_RANGE  The specified @c index is outside the bounds
399          *                              of the data structure. @n
400          *                              -- @c index is greater than the number of elements or less than zero.
401          * @exception   E_MAX_EXCEEDED  The length of the specified @c text
402          *                              exceeds the system limitation.
403          * @exception   E_SYSTEM            A system error occurred.
404          * @remarks     The method modifies the text buffer that is managed by the SearchBar control.
405          *              To display the changes, the control must be drawn again.
406          */
407         result InsertTextAt(int index, const Tizen::Base::String& text);
408
409         /**
410          * Deletes the character at the specified position.
411          *
412          * @since       2.0
413          * @return      An error code
414          * @param[in]   index                   The index
415          * @exception   E_SUCCESS               The method was successful.
416          * @exception   E_INVALID_ARG   The specified @c index is negative.
417          * @exception   E_OUT_OF_RANGE  The specified @c index is outside the bounds
418          *                              of the data structure. @n
419          *                              -- @c index is greater than the number of elements or less than zero.
420          * @exception   E_SYSTEM                A system error occurred.
421          * @remarks     The method modifies the text buffer that is managed by the SearchBar control.
422          *              To display the changes, the control must be drawn again.
423          */
424         result DeleteCharacterAt(int index);
425
426         /**
427          * Clears text that is displayed by the SearchBar control.
428          *
429          * @since               2.0
430          * @return              An error code
431          * @exception   E_SUCCESS       The method was successful.
432          * @exception   E_SYSTEM            A system error occurred.
433          * @remarks     The method modifies the text buffer that is managed by the SearchBar control.
434          *              To display the changes, the control must be drawn again.
435          */
436         result Clear(void);
437
438         /**
439          * Gets the length of the text that is displayed by the SearchBar control.
440          *
441          * @since               2.0
442          * @return              The length of the text, @n
443          *              else @c -1 if an error occurs
444          * @exception   E_SUCCESS               The method was successful.
445          * @exception   E_SYSTEM                A system error occurred.
446          * @remarks             The specific error code can be accessed using the GetLastResult() method.
447          */
448         int GetTextLength(void) const;
449
450         /**
451          * Gets the text that is displayed by the SearchBar control.
452          *
453          * @since               2.0
454          * @return              The text of the SearchBar control, @n
455          *                          else an empty string if an error occurs
456          * @exception   E_SUCCESS           The method was successful.
457          * @exception   E_SYSTEM            A system error occurred.
458          * @remarks     The specific error code can be accessed using the GetLastResult() method.
459          * @see                 SetText()
460          */
461         Tizen::Base::String GetText(void) const;
462
463         /**
464          * Gets a portion of text that is displayed by the SearchBar control.
465          *
466          * @since               2.0
467          * @return              The specified portion of the text, @n
468          *                              else an empty string if an error occurs
469          * @param[in]   start           The starting index of range
470          * @param[in]   end                 The last index of range
471          * @exception   E_SUCCESS       The method was successful.
472          * @exception   E_OUT_OF_RANGE  The specified index is outside the bounds of the data structure, or either the @c start or @c end parameter is greater than the number of elements or less than zero.
473          * @exception   E_SYSTEM            A system error occurred.
474          * @remarks             The specific error code can be accessed using the GetLastResult() method.
475          * @see                 SetText()
476          */
477         Tizen::Base::String GetText(int start, int end) const;
478
479         /**
480          * Gets the limit of the length of the text.
481          *
482          * @since               2.0
483          * @return      The limit length, @n
484          *              else @c -1 if an error occurs
485          * @exception   E_SUCCESS               The method was successful.
486          * @exception   E_SYSTEM                A system error occurred.
487          * @remarks     The specific error code can be accessed using the GetLastResult() method. @n
488          *                              The default limit length is @c 500.
489          * @see         SetLimitLength()
490          */
491         int GetLimitLength(void) const;
492
493         /**
494          * Sets the limit of the length of the text.
495          *
496          * @since               2.0
497          * @return      An error code
498          * @param[in]   limitLength              The limit text length to set
499          * @exception   E_SUCCESS        The method was successful.
500          * @exception   E_INVALID_ARG    A specified input parameter is invalid, or the specified limit length cannot be negative value or zero.
501          * @exception   E_SYSTEM         A system error occurred.
502          * @see         GetLimitLength()
503          */
504         result SetLimitLength(int limitLength);
505
506         /**
507          * Opens the keypad associated with the SearchBar control.
508          *
509          * @since               2.0
510          * @return      An error code
511          * @exception   E_SUCCESS               The method was successful.
512          * @exception   E_SYSTEM                A system error occurred.
513          * @see         HideKeypad()
514          */
515         result ShowKeypad(void) const;
516
517         /**
518          * Closes the keypad associated with the SearchBar control.
519          *
520          * @since               2.0
521          * @return      An error code
522          * @exception   E_SUCCESS               The method was successful.
523          * @exception   E_SYSTEM                A system error occurred.
524          * @see         ShowKeypad()
525          */
526         result HideKeypad(void) const;
527
528         /**
529          * Gets the text size of the search field.
530          *
531          * @since               2.0
532          * @return      The size of the text, @n
533          *              else @c -1 if an error occurs
534          * @exception   E_SUCCESS               The method was successful.
535          * @exception   E_SYSTEM                A system error occurred.
536          * @remarks     The specific error code can be accessed using the GetLastResult() method.
537          * @see         SetSearchFieldTextSize()
538          */
539         int GetSearchFieldTextSize(void) const;
540
541         /**
542          * Sets the text size of the SearchBar control's text field.
543          *
544          * @since               2.0
545          * @return      An error code
546          * @param[in]   size                    The text size
547          * @exception   E_SUCCESS               The method was successful.
548          * @exception   E_INVALID_ARG   A specified input parameter is invalid, or the specified @c size cannot be negative value.
549          * @exception   E_SYSTEM                A system error occurred.
550          * @see         GetSearchFieldTextSize()
551          */
552         result SetSearchFieldTextSize(int size);
553
554         /**
555          * Gets the start and the end index of the currently selected text block.
556          *
557          * @since               2.0
558          * @return              An error code
559          * @param[out]  start                   The start index of the text block
560          * @param[out]  end                             The end index of the text block
561          * @exception   E_SUCCESS               The method was successful.
562          * @exception   E_SYSTEM                A system error occurred.
563          * @remarks             The method returns @c start = 0 and @c end = 0 if no text block is selected.
564          * @see                 ReleaseBlock()
565          * @see                 SetBlockRange()
566          */
567         result GetBlockRange(int& start, int& end) const;
568
569         /**
570          * Releases the selection of the current text block.
571          *
572          * @since               2.0
573          * @return              An error code
574          * @exception   E_SUCCESS          The method was successful.
575          * @exception   E_SYSTEM           A system error occurred.
576          * @see                 GetBlockRange()
577          * @see                 SetBlockRange()
578          */
579         result ReleaseBlock(void);
580
581         /**
582          * Selects the specified block of the text.
583          *
584          * @since               2.0
585          * @return              An error code
586          * @param[in]   start           The start index of the text block
587          * @param[in]   end             The end index of the text block
588          * @exception   E_SUCCESS       The method was successful.
589          * @exception   E_OUT_OF_RANGE  The specified index is outside the bounds of the data structure, or either the @c start or @c end parameter is greater than the number of elements or less than zero.
590          * @exception   E_SYSTEM        A system error occurred.
591          * @see                 ReleaseBlock()
592          * @see                 GetBlockRange()
593          */
594         result SetBlockRange(int start, int end);
595
596         /**
597          * Removes the text of the selected text block.
598          *
599          * @since               2.0
600          * @return              An error code
601          * @exception   E_SUCCESS           The method was successful.
602          * @exception   E_SYSTEM                A system error occurred.
603          */
604         result RemoveTextBlock(void);
605
606         /**
607          * Gets the color of the SearchBar control for the specified status.
608          *
609          * @since               2.0
610          * @return              The color of the SearchBar control, @n
611          *                              else RGBA(0,0,0,0) if an error occurs
612          * @exception   E_SUCCESS               The method was successful.
613          * @exception   E_SYSTEM                A system error occurred.
614          * @remarks             The specific error code can be accessed using the GetLastResult() method.
615          * @see                 SetColor()
616          */
617         Tizen::Graphics::Color GetColor(void) const;
618
619         /**
620          * Gets the color of the search field for the specified status.
621          *
622          * @since               2.0
623          * @return              The color, @n
624          *                              else RGBA(0,0,0,0) if an error occurs
625          * @param[in]   status                  The search field status
626          * @exception   E_SUCCESS               The method was successful.
627          * @exception   E_SYSTEM                A system error occurred.
628          * @remarks             The specific error code can be accessed using the GetLastResult() method.
629          * @see                 SetSearchFieldColor()
630          */
631         Tizen::Graphics::Color GetSearchFieldColor(SearchFieldStatus status) const;
632
633         /**
634          * Gets the text color of the search field for the specified status.
635          *
636          * @since               2.0
637          * @return              The text color, @n
638          *                              else RGBA(0,0,0,0) if an error occurs
639          * @param[in]   status                  The search field status
640          * @exception   E_SUCCESS               The method was successful.
641          * @exception   E_SYSTEM                A system error occurred.
642          * @remarks             The specific error code can be accessed using the GetLastResult() method.
643          * @see                 SetSearchFieldTextColor()
644          */
645         Tizen::Graphics::Color GetSearchFieldTextColor(SearchFieldStatus status) const;
646
647         /**
648          * Sets the background bitmap of the SearchBar control.
649          *
650          * @since               2.0
651          * @return              An error code
652          * @param[in]   bitmap              The background bitmap
653          * @exception   E_SUCCESS       The method was successful.
654          * @exception   E_SYSTEM        A system error occurred.
655          */
656         result SetBackgroundBitmap(const Tizen::Graphics::Bitmap& bitmap);
657
658         /**
659          * Sets the color of the search bar.
660          *
661          * @since               2.0
662          * @return              An error code
663          * @param[in]   status              The state of SearchBar
664          * @param[in]   color               The color
665          * @exception   E_SUCCESS       The method was successful.
666          * @exception   E_SYSTEM        A system error occurred.
667          * @see                 GetColor()
668          */
669         result SetColor(const Tizen::Graphics::Color& color);
670
671         /**
672          * Sets the color of the search field for the specified status.
673          *
674          * @since               2.0
675          * @return          An error code
676          * @param[in]   status               The state of search field
677          * @param[in]   color                The text color
678          * @exception   E_SUCCESS        The method was successful.
679          * @exception   E_SYSTEM         A system error occurred.
680          * @see         GetSearchFieldColor()
681          */
682         result SetSearchFieldColor(SearchFieldStatus status, const Tizen::Graphics::Color& color);
683
684         /**
685          * Sets the text color of the search field for the specified status.
686          *
687          * @since               2.0
688          * @return          An error code
689          * @param[in]   status               The state of search field
690          * @param[in]   color                The text color
691          * @exception   E_SUCCESS        The method was successful.
692          * @exception   E_SYSTEM         A system error occurred.
693          * @see         GetSearchFieldTextColor()
694          */
695         result SetSearchFieldTextColor(SearchFieldStatus status, const Tizen::Graphics::Color& color);
696
697         /**
698          * Gets the guide text.
699          *
700          * @since               2.0
701          * @return          The guide text, @n
702          *                              else an empty string if an error occurs
703          * @param[in]   guideText
704          * @exception   E_SUCCESS        The method was successful.
705          * @exception   E_SYSTEM         A system error occurred.
706          * @remarks     The specific error code can be accessed using the GetLastResult() method.
707          * @see         GetGuideText()
708          */
709         Tizen::Base::String GetGuideText(void) const;
710
711         /**
712          * Displays the specified text when there is no text in the SearchBar control.
713          *
714          * @since               2.0
715          * @return          An error code
716          * @param[in]   guideText                The guide text
717          * @exception   E_SUCCESS        The method was successful.
718          * @exception   E_SYSTEM         A system error occurred.
719          * @see         GetGuideText()
720          */
721         result SetGuideText(const Tizen::Base::String& guideText);
722
723         /**
724          * Gets the text color of the guide text.
725          *
726          * @since               2.0
727          * @return          The text color of the guide text, @n
728          *                              else RGBA(0,0,0,0) if an error occurs
729          * @exception   E_SUCCESS        The method was successful.
730          * @exception   E_SYSTEM         A system error occurred.
731          * @remarks     The specific error code can be accessed using the GetLastResult() method.
732          * @see         SetGuideTextColor()
733          */
734         Tizen::Graphics::Color GetGuideTextColor(void) const;
735
736         /**
737          * Sets the text color of the guide text.
738          *
739          * @since               2.0
740          * @return          An error code
741          * @param[in]   color                The guide text color
742          * @exception   E_SUCCESS        The method was successful.
743          * @exception   E_SYSTEM         A system error occurred.
744          * @see         GetGuideTextColor()
745          */
746         result SetGuideTextColor(const Tizen::Graphics::Color& color);
747
748         /**
749          * Gets the current cursor position index.
750          *
751          * @since               2.0
752          * @return              The cursor position, @n
753          *                              else @c -1 if an error occurs
754          * @exception   E_SUCCESS           The method was successful.
755          * @exception   E_SYSTEM            A system error occurred.
756          * @remarks             The specific error code can be accessed using the GetLastResult() method.
757          * @see                 SetCursorPosition()
758          */
759         int GetCursorPosition(void) const;
760
761         /**
762          * Sets the cursor at the specified index.
763          *
764          * @since               2.0
765          * @return      An error code
766          * @param[in]   index               The cursor index
767          * @exception   E_SUCCESS       The method was successful.
768          * @exception   E_OUT_OF_RANGE  The specified @c index is outside the bounds of the data structure, or @c index is greater than the number of elements or less than zero.
769          * @exception   E_SYSTEM            A system error occurred.
770          * @see         GetCursorPosition()
771          */
772         result SetCursorPosition(int index);
773
774         /**
775          * Checks whether the lowercase mode is enabled.
776          *
777          * @since               2.0
778          * @return              @c true if the lowercase mode is enabled, @n
779          *                              else @c false
780          * @exception   E_SUCCESS               The method was successful.
781          * @exception   E_SYSTEM                A system error occurred.
782          * @remarks             The specific error code can be accessed using the GetLastResult() method.
783          * @see         SetLowerCaseModeEnabled()
784          */
785         bool IsLowerCaseModeEnabled(void) const;
786
787         /**
788          * Enables or disables the lowercase mode.
789          *
790          * @since               2.0
791          * @param[in]   enable  Set to @c true to enable lowercase mode, @n
792          *                                              else @c false
793          * @exception   E_SUCCESS               The method was successful.
794          * @exception   E_SYSTEM                A system error occurred.
795          * @see         IsLowerCaseModeEnabled()
796          */
797         void SetLowerCaseModeEnabled(bool enable);
798
799         /**
800          * Gets the ellipsis position.
801          *
802          * @since               2.0
803          * @return      The ellipsis position
804          * @exception   E_SUCCESS           The method was successful.
805          * @exception   E_SYSTEM            A system error occurred.
806          * @remarks     The specific error code can be accessed using the GetLastResult() method.
807          * @see         SetEllipsisPosition()
808          */
809         EllipsisPosition GetEllipsisPosition(void) const;
810
811         /**
812          * Sets the ellipsis position.
813          *
814          * @since               2.0
815          * @return      An error code
816          * @param[in]   position                The ellipsis position
817          * @exception   E_SUCCESS           The method was successful.
818          * @exception   E_SYSTEM            A system error occurred.
819          * @see         GetEllipsisPosition()
820          */
821         result SetEllipsisPosition(EllipsisPosition position);
822
823         /**
824          * Gets the keypad action type.
825          *
826          * @since               2.0
827          * @return      The keypad action
828          * @exception   E_SUCCESS           The method was successful.
829          * @exception   E_SYSTEM            A system error occurred.
830          * @remarks     The specific error code can be accessed using the GetLastResult() method.
831          */
832         KeypadAction GetKeypadAction(void) const;
833
834         /**
835         * Checks whether the text prediction is enabled.
836         *
837         * @since 2.0
838         * @return               @c true if the text prediction is enabled, @n
839         *                                       else @c false
840         * @exception            E_SUCCESS                       The method is successful.
841         * @exception            E_SYSTEM                        A system error has occurred.
842         * @remarks                      The specific error code can be accessed using the GetLastResult() method.
843         * @see                          SetTextPredictionEnabled()
844         */
845         bool IsTextPredictionEnabled(void) const;
846
847         /**
848         * Enables or disables the text prediction.
849         *
850         * @since 2.0
851         * @param[in]            enable                          Set to @c true to enable the text prediction, @n
852         *                                                                               else @c false
853         * @return                       An error code
854         * @exception            E_SUCCESS                       The method is successful.
855         * @exception            E_SYSTEM                        A system error has occurred.
856         * @see                          IsTextPredictionEnabled()
857          */
858         result SetTextPredictionEnabled(bool enable);
859
860         result GetCurrentLanguage(Tizen::Locales::LanguageCode& language) const;
861         result SetCurrentLanguage(Tizen::Locales::LanguageCode languageCode);
862
863         /**
864          * Adds an action event listener. @n
865          * The added listener is notified when the user clicks the search bar button.
866          *
867          * @since               2.0
868          * @param[in]   listener                The event listener to add
869          * @see         RemoveActionEventListener()
870          */
871         result AddActionEventListener(Tizen::Ui::IActionEventListener& listener);
872
873         /**
874          * Removes the specified action event listener. @n
875          * The removed listener cannot listen to events when they are fired.
876          *
877          * @since               2.0
878          * @param[in]   listener                The event listener to remove
879          * @see         AddActionEventListener()
880          */
881         result RemoveActionEventListener(Tizen::Ui::IActionEventListener& listener);
882
883         /**
884          * Adds a text event listener. @n
885          * The added listener can listen to events on the specified event dispatcher's context when they are fired.
886          *
887          * @since               2.0
888          * @param[in]   listener            The event listener to add
889          * @remarks     The added listener is notified when: @n
890          *              @li the user presses a key on the software keypad.
891          *              @li the user selects a word in the candidate list.
892          *              @li the user pastes a text.
893          * @see         RemoveTextEventListener()
894          */
895         result AddTextEventListener(Tizen::Ui::ITextEventListener& listener);
896
897         /**
898          * Removes the specified text event listener. @n
899          * The removed listener cannot listen to events when they are fired.
900          *
901          * @since               2.0
902          * @param[in]   listener                The event listener to remove
903          * @see         AddTextEventListener()
904          */
905         result RemoveTextEventListener(Tizen::Ui::ITextEventListener& listener);
906
907         /**
908          * Adds a search bar event listener. @n
909          * The added listener can listen to events on the specified event dispatcher's context when they are fired.
910          *
911          * @since               2.0
912          * @param[in]   listener            The event listener to add
913          * @remarks     The added listener is notified when: @n
914          *              @li the user presses a key on the software keypad.
915          *              @li the user selects a word in the candidate list.
916          *              @li the user pastes a text.
917          * @see         AddSearchBarEventListener()
918          */
919         result AddSearchBarEventListener(const ISearchBarEventListener& listener);
920
921         /**
922          * Removes the specified search bar event listener. @n
923          * The removed listener cannot listen to events when they are fired.
924          *
925          * @since               2.0
926          * @param[in]   listener                The event listener to remove
927          * @see         RemoveTextEventListener()
928          */
929         result RemoveSearchBarEventListener(const ISearchBarEventListener& listener);
930
931         /**
932          * Adds a text block event listener.
933          *
934          * @since               2.0
935          * @param[in]   listener               The event listener to add
936          * @remarks             Programmatically, modification of the text selection does not cause
937          *              the text block selection event to fire.
938          * @see                 RemoveTextBlockEventListener()
939          */
940         result AddTextBlockEventListener(Tizen::Ui::ITextBlockEventListener& listener);
941
942         /**
943          * Removes the specified text block event listener. @n
944          * The removed listener cannot listen to events when they are fired.
945          *
946          * @since               2.0
947          * @param[in]   listener               The event listener to remove
948          * @see                 AddTextBlockEventListener()
949          */
950         result RemoveTextBlockEventListener(Tizen::Ui::ITextBlockEventListener& listener);
951
952         /**
953          * Adds a keypad event listener. @n
954          * The added listener is notified when the keypad associated with this text
955          * editor is opened or closed.
956          *
957          * @since               2.0
958          * @param[in]   listener                The event listener to add
959          * @see         RemoveKeypadEventListener()
960          */
961         result AddKeypadEventListener(Tizen::Ui::IKeypadEventListener& listener);
962
963         /**
964          * Removes the specified keypad event listener. @n
965          * The removed listener cannot listen to events when they are fired.
966          *
967          * @since               2.0
968          * @param[in]   listener                The event listener to remove
969          * @see         AddKeypadEventListener()
970          */
971         result RemoveKeypadEventListener(Tizen::Ui::IKeypadEventListener& listener);
972
973         result AddLanguageEventListener(Tizen::Ui::ILanguageEventListener& listener);
974         result RemoveLanguageEventListener(Tizen::Ui::ILanguageEventListener& listener);
975
976         virtual void OnActionPerformed(const Tizen::Ui::_Control& source, int actionId);
977
978         virtual void OnKeypadWillOpen(void);
979         virtual void OnKeypadOpened(void);
980         virtual void OnKeypadClosed(void);
981         virtual void OnKeypadBoundsChanged(void);
982         virtual void OnKeypadActionPerformed(CoreKeypadAction keypadAction);
983
984         virtual void OnTextBlockSelected(Tizen::Ui::_Control& source, int start, int end);
985
986         virtual void OnTextValueChanged(const Tizen::Ui::_Control& source);
987         virtual void OnTextValueChangeCanceled(const Tizen::Ui::_Control& source);
988
989         virtual void OnSearchBarModeChanged(_SearchBar& source, SearchBarMode mode);
990
991         virtual void OnLanguageChanged(Tizen::Locales::LanguageCode oldLanguage, Tizen::Locales::LanguageCode newLanguage);
992
993         static _SearchBarImpl* GetInstance(SearchBar& searchBar);
994         static const _SearchBarImpl* GetInstance(const SearchBar& searchBar);
995
996 private:
997         _SearchBarImpl(const _SearchBarImpl&);
998         _SearchBarImpl& operator =(const _SearchBarImpl&);
999
1000         result Initialize(bool enableSearchBarButton, KeypadAction keypadAction);
1001         KeypadAction ConvertKeypadAction(CoreKeypadAction keypadAction) const;
1002         CoreKeypadAction ConvertKeypadAction(KeypadAction keypadAction) const;
1003
1004         _SearchBar* __pSearchBar;
1005
1006         Control* __pContentControl;
1007
1008         _PublicActionEvent* __pPublicActionEvent;
1009         _PublicKeypadEvent* __pPublicKeypadEvent;
1010         _PublicTextBlockEvent* __pPublicTextBlockEvent;
1011         _PublicTextEvent* __pPublicTextEvent;
1012         _PublicSearchBarEvent* __pPublicSearchBarEvent;
1013         _PublicLanguageEvent* __pPublicLanguageEvent;
1014
1015 }; // _SearchBarImpl
1016
1017 }}} // Tizen::Ui::Controls
1018
1019 #endif  // _FUI_CTRL_INTERNAL_SEARCH_BAR_IMPL_H_