2 // Open Service Platform
3 // Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
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
9 // http://floralicense.org/license/
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.
19 * @file FUiCtrl_SearchBar.h
20 * @brief This is the header file for the _SearchBar class.
22 * This header file contains the declarations of the %_SearchBar class.
25 #ifndef _FUI_CTRL_INTERNAL_SEARCH_BAR_H_
26 #define _FUI_CTRL_INTERNAL_SEARCH_BAR_H_
28 #include <FUiCtrlSearchBar.h>
29 #include "FUi_Control.h"
30 #include "FUiCtrl_Button.h"
31 #include "FUiCtrl_Edit.h"
32 #include "FUiCtrl_IActionEventListener.h"
33 #include "FUiCtrl_IKeypadEventListener.h"
34 #include "FUiCtrl_ILanguageEventListener.h"
35 #include "FUiCtrl_ITextBlockEventListener.h"
36 #include "FUiCtrl_ITextEventListener.h"
37 #include "FUiCtrl_ISearchBarEventListener.h"
38 #include "FUiCtrl_KeypadEvent.h"
39 #include "FUiCtrl_LanguageEvent.h"
40 #include "FUiCtrl_SearchBarEvent.h"
42 const int SEARCHBAR_COLOR_MAX = 3;
43 const int SEARCHBAR_BUTTON_COLOR_MAX = 4;
44 const int SEARCHBAR_TEXT_LENGTH_MAX = 500;
45 const int SEARCHBAR_DEFAULT_OPACITY = 100;
47 namespace Tizen { namespace Ui { namespace Animations
50 }}} // Tizen::Ui::Animations
52 namespace Tizen { namespace Ui { namespace Controls
56 class _SearchBarPresenter;
58 class _TextBlockEvent;
68 , public _IActionEventListener
69 , public _IKeypadEventListener
70 , public _ITextBlockEventListener
71 , public _ITextEventListener
72 , virtual public Tizen::Base::Runtime::IEventListener
73 , virtual public Tizen::Ui::_IUiEventListener
74 , virtual public Tizen::Ui::_IUiEventPreviewer
76 DECLARE_CLASS_BEGIN(_SearchBar, _Control);
77 DECLARE_PROPERTY("buttonActionId", GetPropertyButtonActionId, SetPropertyButtonActionId);
78 DECLARE_PROPERTY("buttonDisabledColor", GetPropertyButtonDisabledColor, SetPropertyButtonDisabledColor);
79 DECLARE_PROPERTY("buttonHighlightedColor", GetPropertyButtonHighlightedColor, SetPropertyButtonHighlightedColor);
80 DECLARE_PROPERTY("buttonNormalColor", GetPropertyButtonNormalColor, SetPropertyButtonNormalColor);
81 DECLARE_PROPERTY("buttonPressedColor", GetPropertyButtonPressedColor, SetPropertyButtonPressedColor);
82 DECLARE_PROPERTY("buttonDisabledTextColor", GetPropertyButtonDisabledTextColor, SetPropertyButtonDisabledTextColor);
83 DECLARE_PROPERTY("buttonHighlightedTextColor", GetPropertyButtonHighlightedTextColor, SetPropertyButtonHighlightedTextColor);
84 DECLARE_PROPERTY("buttonNormalTextColor", GetPropertyButtonNormalTextColor, SetPropertyButtonNormalTextColor);
85 DECLARE_PROPERTY("buttonPressedTextColor", GetPropertyButtonPressedTextColor, SetPropertyButtonPressedTextColor);
86 DECLARE_PROPERTY("searchFieldDisabledColor", GetPropertySearchFieldDisabledColor, SetPropertySearchFieldDisabledColor);
87 DECLARE_PROPERTY("searchFieldHighlightedColor", GetPropertySearchFieldHighlightedColor, SetPropertySearchFieldHighlightedColor);
88 DECLARE_PROPERTY("searchFieldNormalColor", GetPropertySearchFieldNormalColor, SetPropertySearchFieldNormalColor);
89 DECLARE_PROPERTY("searchFieldDisabledTextColor", GetPropertySearchFieldDisabledTextColor, SetPropertySearchFieldDisabledTextColor);
90 DECLARE_PROPERTY("searchFieldHighlightedTextColor", GetPropertySearchFieldHighlightedTextColor, SetPropertySearchFieldHighlightedTextColor);
91 DECLARE_PROPERTY("searchFieldNormalTextColor", GetPropertySearchFieldNormalTextColor, SetPropertySearchFieldNormalTextColor);
92 DECLARE_PROPERTY("color", GetPropertyColor, SetPropertyColor);
93 DECLARE_PROPERTY("contentAreaSize", GetPropertyContentAreaSize, SetPropertyContentAreaSize);
96 result SetPropertyButtonActionId(const Tizen::Ui::Variant& actionId);
97 Tizen::Ui::Variant GetPropertyButtonActionId(void) const;
98 result SetPropertyButtonDisabledColor(const Tizen::Ui::Variant& color);
99 Tizen::Ui::Variant GetPropertyButtonDisabledColor(void) const;
100 result SetPropertyButtonHighlightedColor(const Tizen::Ui::Variant& color);
101 Tizen::Ui::Variant GetPropertyButtonHighlightedColor(void) const;
102 result SetPropertyButtonNormalColor(const Tizen::Ui::Variant& color);
103 Tizen::Ui::Variant GetPropertyButtonNormalColor(void) const;
104 result SetPropertyButtonPressedColor(const Tizen::Ui::Variant& color);
105 Tizen::Ui::Variant GetPropertyButtonPressedColor(void) const;
106 result SetPropertyButtonDisabledTextColor(const Tizen::Ui::Variant& textColor);
107 Tizen::Ui::Variant GetPropertyButtonDisabledTextColor(void) const;
108 result SetPropertyButtonHighlightedTextColor(const Tizen::Ui::Variant& textColor);
109 Tizen::Ui::Variant GetPropertyButtonHighlightedTextColor(void) const;
110 result SetPropertyButtonNormalTextColor(const Tizen::Ui::Variant& textColor);
111 Tizen::Ui::Variant GetPropertyButtonNormalTextColor(void) const;
112 result SetPropertyButtonPressedTextColor(const Tizen::Ui::Variant& textColor);
113 Tizen::Ui::Variant GetPropertyButtonPressedTextColor(void) const;
114 result SetPropertySearchFieldDisabledColor(const Tizen::Ui::Variant& color);
115 Tizen::Ui::Variant GetPropertySearchFieldDisabledColor(void) const;
116 result SetPropertySearchFieldHighlightedColor(const Tizen::Ui::Variant& color);
117 Tizen::Ui::Variant GetPropertySearchFieldHighlightedColor(void) const;
118 result SetPropertySearchFieldNormalColor(const Tizen::Ui::Variant& color);
119 Tizen::Ui::Variant GetPropertySearchFieldNormalColor(void) const;
120 result SetPropertySearchFieldDisabledTextColor(const Tizen::Ui::Variant& textColor);
121 Tizen::Ui::Variant GetPropertySearchFieldDisabledTextColor(void) const;
122 result SetPropertySearchFieldHighlightedTextColor(const Tizen::Ui::Variant& textColor);
123 Tizen::Ui::Variant GetPropertySearchFieldHighlightedTextColor(void) const;
124 result SetPropertySearchFieldNormalTextColor(const Tizen::Ui::Variant& textColor);
125 Tizen::Ui::Variant GetPropertySearchFieldNormalTextColor(void) const;
126 result SetPropertyColor(const Tizen::Ui::Variant& color);
127 Tizen::Ui::Variant GetPropertyColor(void) const;
128 result SetPropertyContentAreaSize(const Tizen::Ui::Variant& size);
129 Tizen::Ui::Variant GetPropertyContentAreaSize(void) const;
133 * This is default constructor for this class.
140 * This is the destructor for this class.
144 virtual ~_SearchBar(void);
146 static _SearchBar* CreateSearchBarN(void);
149 * Initializes this instance of the SearchBar control with the specified parameters.
152 * @return An error code
153 * @param[in] enableSearchBarButton Set to @c true to display the search bar button, @n
155 * @param[in] keypadAction The keypad action
156 * @exception E_SUCCESS The method was successful.
157 * @exception E_INVALID_ARG A specified input parameter is invalid, or the action ID of the specified item must be a positive integer.
158 * @exception E_SYSTEM A system error occurred.
159 * @remarks By default, a "Cancel" button is displayed if @c enableSearchBarButton is set to @c true. When the user presses the cancel button,
160 * the SearchBar control returns to SEARCH_BAR_MODE_NORMAL automatically.
162 result Initialize(bool enableSearchBarButton = true, CoreKeypadAction keypadAction = CORE_KEYPAD_ACTION_SEARCH);
165 * Gets the content of %Control.
168 * @return The control that is displayed in the SearchBar's content area in SEARCH_BAR_MODE_INPUT mode, @n
169 * else @c null if an error occurs
170 * @exception E_SUCCESS The method was successful.
171 * @remarks The specific error code can be accessed using the GetLastResult() method.
173 Tizen::Ui::_Control* GetContent(void) const;
176 * Sets the content control.
179 * @return An error code
180 * @param[in] pContent The control that is to be displayed in the
181 * SearchBar's content area.
182 * @exception E_SUCCESS The method was successful.
183 * @exception E_INVALID_ARG A specified input parameter is invalid. @n
184 * The following controls cannot be set as the
186 * @li All classes derived from Window class
187 * @li All picker classes (ex: DateTimePicker)
191 * @exception E_SYSTEM A system error occurred.
192 * @remarks The specified content control is displayed when the SearchBar controls mode is changed to SEARCH_BAR_MODE_INPUT.
193 * @see GetContentAreaSize()
194 * @see AddSearchBarEventListener()
195 * @see ISearchBarEventListener
197 result SetContent(const Tizen::Ui::_Control* pContent);
200 * Updates the content area of the SearchBar control.
203 * @return An error code
204 * @param[in] show A Boolean flag indicating whether to perform show on the content area.
205 * @exception E_SUCCESS The method was successful.
206 * @exception E_INVALID_OPERATION The current state of the instance prohibits the execution of the specified operation @n
207 * -- the current mode of SearchBar prohibits the execution of the method. @n
208 * @exception E_SYSTEM A system error occurred.
209 * @remarks The method performs Invalidate() on the content area.
211 result UpdateContentArea(bool invalidate = true);
214 * Sets the visibility state of the content area.
217 * @return An error code
218 * @param[in] visible The visibility state of the content area.
219 * @exception E_SUCCESS The method was successful.
220 * @exception E_SYSTEM A system error occurred.
221 * @see IsContentAreaVisible()
223 result SetContentAreaVisible(bool visible);
226 * Checks whether the content area is visible.
229 * @return The visibility state of the content area.
230 * @exception E_SUCCESS The method was successful.
231 * @see SetContentAreaVisible()
233 bool IsContentAreaVisible(void) const;
236 * Sets the size of the content area of the SearchBar control.
239 * @return An error code
240 * @param[in] size The content area size.
241 * @exception E_SUCCESS The method was successful.
242 * @exception E_INVALID_ARG A specified input parameter is invalid. @n
243 * -- width and height of @c size must be greater than or equal to @c 0.
244 * @remarks You must resize the content area when the Form's orientation is changed once you change the
246 * the size of the content area.
248 * @see GetContentAreaSize()
250 result SetContentAreaSize(const Tizen::Graphics::Dimension& size);
253 * Gets the size of the content area of the SearchBar control.
256 * @return The size of the content area
257 * @remarks The content area is the area where the 'content' of the SearchBar control is displayed. The size of the content areas can
258 * be changed at runtime.
259 * @see AddSearchBarEventListener()
260 * @see ISearchBarEventListener
262 Tizen::Graphics::Dimension GetContentAreaSize(void) const;
265 * Gets the search bar mode.
268 * @return The search bar mode
269 * @exception E_SUCCESS The method was successful.
270 * @exception E_SYSTEM A system error occurred.
271 * @remarks The specific error code can be accessed using the GetLastResult() method.
274 SearchBarMode GetMode(void) const;
277 * Determines whether the search bar mode is locked.
280 * @return @c true if the mode is locked, @n
282 * @exception E_SUCCESS The method was successful.
283 * @exception E_SYSTEM A system error occurred.
284 * @remarks The specific error code can be accessed using the GetLastResult() method.
287 bool IsModeLocked(void) const;
290 * Sets the search bar mode.
293 * @return An error code
294 * @exception E_SUCCESS The method was successful.
295 * @exception E_INVALID_OPERATION The current state of the instance prohibits the execution of the specified operation, or the mode is locked.
296 * @exception E_SYSTEM A system error occurred.
300 result SetMode(SearchBarMode mode);
303 * Locks or unlocks the search bar mode.
306 * @return An error code
307 * @param[in] modeLocked The mode lock
308 * @exception E_SUCCESS The method was successful.
309 * @exception E_SYSTEM A system error occurred.
312 result SetModeLocked(bool modeLocked);
315 * Gets the search bar button's action Id
318 * @return The action ID, @n
319 * else @c -1 if an error occurs
320 * @exception E_SUCCESS The method was successful.
321 * @exception E_SYSTEM A system error occurred.
322 * @remarks The specific error code can be accessed using the GetLastResult() method. @n
323 * By default, the method returns @c -1 if no user defined search bar button is set.
325 int GetButtonActionId(void) const;
328 * Gets the color of the search bar button for the specified state.
331 * @return The color of the search bar button, @n
332 * else RGBA(0,0,0,0) if an error occurs
333 * @param[in] status The search bar button's status
334 * @exception E_SUCCESS The method was successful.
335 * @exception E_SYSTEM A system error occurred.
336 * @remarks The specific error code can be accessed using the GetLastResult() method.
337 * @see SetButtonColor()
339 Tizen::Graphics::Color GetButtonColor(SearchBarButtonStatus status) const;
342 * Gets the text color of the search bar button for the specified state.
345 * @return The text color of the search bar button, @n
346 * else RGBA(0,0,0,0) if an error occurs
347 * @param[in] status The search bar button's status
348 * @exception E_SUCCESS The method was successful.
349 * @exception E_SYSTEM A system error occurred.
350 * @remarks The specific error code can be accessed using the GetLastResult() method.
352 Tizen::Graphics::Color GetButtonTextColor(SearchBarButtonStatus status) const;
355 * Gets the state of the search bar button.
358 * @return The state of the search bar button
359 * @exception E_SUCCESS The method was successful.
360 * @exception E_SYSTEM A system error occurred.
361 * @remarks The specific error code can be accessed using the GetLastResult() method.
363 SearchBarButtonStatus GetButtonStatus(void) const;
366 * Sets the user defined search bar button text.
369 * @return An error code
370 * @param[in] actionId The button action ID
371 * @exception E_SUCCESS The method was successful.
372 * @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.
373 * @exception E_SYSTEM A system error occurred.
375 result SetButtonText(const Tizen::Base::String& text);
378 * Sets the user defined search bar button action ID.
381 * @return An error code
382 * @param[in] actionId The button action ID
383 * @exception E_SUCCESS The method was successful.
384 * @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.
385 * @exception E_SYSTEM A system error occurred.
387 result SetButtonActionId(int actionId);
390 * Enables or disables the search bar button.
393 * @return An error code
394 * @param[in] enabled Set to @c true to enable the search bar button, @n
396 * @exception E_SUCCESS The method was successful.
397 * @exception E_SYSTEM A system error occurred.
399 result SetButtonEnabled(bool enabled);
402 * Sets the search bar button's color for the specified state.
405 * @return An error code
406 * @param[in] status The button status
407 * @param[in] color The button color to set
408 * @exception E_SUCCESS The method was successful.
409 * @exception E_SYSTEM A system error occurred.
410 * @see GetButtonColor()
412 result SetButtonColor(SearchBarButtonStatus status, const Tizen::Graphics::Color& color);
415 * Sets the text color of the SearchBar control's button for the specified state.
418 * @return An error code
419 * @param[in] status The button status
420 * @param[in] color The button text color to set
421 * @exception E_SUCCESS The method was successful.
422 * @exception E_SYSTEM A system error occurred.
424 result SetButtonTextColor(SearchBarButtonStatus status, const Tizen::Graphics::Color& color);
427 * Appends the specified character at the end of the text.
430 * @return An error code
431 * @param[in] character The character to add
432 * @exception E_SUCCESS The method was successful.
433 * @exception E_SYSTEM A system error occurred.
434 * @remarks The method modifies the text buffer that is managed by the SearchBar control. @n
435 * To display the changes, the control must be drawn again.
437 result AppendCharacter(const Tizen::Base::Character& character);
440 * Appends the specified text at the end of the existing text.
443 * @return An error code
444 * @param[in] text The text to append
445 * @exception E_SUCCESS The method was successful.
446 * @exception E_SYSTEM A system error occurred.
447 * @remarks To denote the end of a line use '\\n'. @n
448 * The method modifies the text buffer that is managed by the SearchBar control. @n
449 * To display the changes, the control must be drawn again.
451 result AppendText(const Tizen::Base::String& text);
454 * Sets the text to display.
457 * @return An error code
458 * @param[in] text The text to display
459 * @exception E_SUCCESS The method was successful.
460 * @exception E_SYSTEM A system error occurred.
461 * @remarks To denote the end of a line use '\\n'. @n
462 * The method modifies the text buffer that is managed by the SearchBar control. @n
463 * To display the changes, the control must be drawn again.
465 result SetText(const Tizen::Base::String& text);
468 * Inserts the character at the specified index.
471 * @return An error code
472 * @param[in] index The position to insert the character
473 * @param[in] character The character to insert
474 * @exception E_SUCCESS The method was successful.
475 * @exception E_OUT_OF_RANGE The specified @c index is outside the bounds of the data structure. @n
476 * -- @c index is greater than the number of elements or less than zero.
477 * @exception E_MAX_EXCEEDED The length of the specified @c text exceeds the system limitation.
478 * @exception E_SYSTEM A system error occurred.
479 * @remarks The method modifies the text buffer that is managed by the SearchBar control.
480 * To display the changes, the control must be drawn again.
482 result InsertCharacterAt(int index, const Tizen::Base::Character& character);
485 * Inserts the specified text at the specified index.
488 * @return An error code
489 * @param[in] index The position at which to insert.
490 * @param[in] text The text to be inserted
491 * @exception E_SUCCESS The method was successful.
492 * @exception E_OUT_OF_RANGE The specified @c index is outside the bounds
493 * of the data structure. @n
494 * -- @c index is greater than the number of elements or less than zero.
495 * @exception E_MAX_EXCEEDED The length of the specified @c text
496 * exceeds the system limitation.
497 * @exception E_SYSTEM A system error occurred.
498 * @remarks The method modifies the text buffer that is managed by the SearchBar control.
499 * To display the changes, the control must be drawn again.
501 result InsertTextAt(int index, const Tizen::Base::String& text);
504 * Deletes the character at the specified position.
507 * @return An error code
508 * @param[in] index The index
509 * @exception E_SUCCESS The method was successful.
510 * @exception E_INVALID_ARG The specified @c index is negative.
511 * @exception E_OUT_OF_RANGE The specified @c index is outside the bounds
512 * of the data structure. @n
513 * -- @c index is greater than the number of elements or less than zero.
514 * @exception E_SYSTEM A system error occurred.
515 * @remarks The method modifies the text buffer that is managed by the SearchBar control.
516 * To display the changes, the control must be drawn again.
518 result DeleteCharacterAt(int index);
521 * Clears text that is displayed by the SearchBar control.
524 * @return An error code
525 * @exception E_SUCCESS The method was successful.
526 * @exception E_SYSTEM A system error occurred.
527 * @remarks The method modifies the text buffer that is managed by the SearchBar control.
528 * To display the changes, the control must be drawn again.
533 * Gets the length of the text that is displayed by the SearchBar control.
536 * @return The length of the text, @n
537 * else @c -1 if an error occurs
538 * @exception E_SUCCESS The method was successful.
539 * @exception E_SYSTEM A system error occurred.
540 * @remarks The specific error code can be accessed using the GetLastResult() method.
542 int GetTextLength(void) const;
545 * Gets the text that is displayed by the SearchBar control.
548 * @return The text of the SearchBar control, @n
549 * else an empty string if an error occurs
550 * @exception E_SUCCESS The method was successful.
551 * @exception E_SYSTEM A system error occurred.
552 * @remarks The specific error code can be accessed using the GetLastResult() method.
555 Tizen::Base::String GetText(void) const;
558 * Gets a portion of text that is displayed by the SearchBar control.
561 * @return The specified portion of the text, @n
562 * else an empty string if an error occurs
563 * @param[in] start The starting index of range
564 * @param[in] end The last index of range
565 * @exception E_SUCCESS The method was successful.
566 * @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.
567 * @exception E_SYSTEM A system error occurred.
568 * @remarks The specific error code can be accessed using the GetLastResult() method.
571 Tizen::Base::String GetText(int start, int end) const;
574 * Gets the limit of the length of the text.
577 * @return The limit length, @n
578 * else @c -1 if an error occurs
579 * @exception E_SUCCESS The method was successful.
580 * @exception E_SYSTEM A system error occurred.
581 * @remarks The specific error code can be accessed using the GetLastResult() method. @n
582 * The default limit length is @c 500.
583 * @see SetLimitLength()
585 int GetLimitLength(void) const;
588 * Sets the limit of the length of the text.
591 * @return An error code
592 * @param[in] limitLength The limit text length to set
593 * @exception E_SUCCESS The method was successful.
594 * @exception E_INVALID_ARG A specified input parameter is invalid, or the specified limit length cannot be negative value or zero.
595 * @exception E_SYSTEM A system error occurred.
596 * @see GetLimitLength()
598 result SetLimitLength(int limitLength);
601 * Opens the keypad associated with the SearchBar control.
604 * @return An error code
605 * @exception E_SUCCESS The method was successful.
606 * @exception E_SYSTEM A system error occurred.
609 result ShowKeypad(void) const;
612 * Closes the keypad associated with the SearchBar control.
615 * @return An error code
616 * @exception E_SUCCESS The method was successful.
617 * @exception E_SYSTEM A system error occurred.
620 result HideKeypad(void);
623 * Gets the text size of the search field.
626 * @return The size of the text, @n
627 * else @c -1 if an error occurs
628 * @exception E_SUCCESS The method was successful.
629 * @exception E_SYSTEM A system error occurred.
630 * @remarks The specific error code can be accessed using the GetLastResult() method.
631 * @see SetSearchFieldTextSize()
633 int GetSearchFieldTextSize(void) const;
636 * Sets the text size of the SearchBar control's text field.
639 * @return An error code
640 * @param[in] size The text size
641 * @exception E_SUCCESS The method was successful.
642 * @exception E_INVALID_ARG A specified input parameter is invalid, or the specified @c size cannot be negative value.
643 * @exception E_SYSTEM A system error occurred.
644 * @see GetSearchFieldTextSize()
646 result SetSearchFieldTextSize(int size);
649 * Gets the start and the end index of the currently selected text block.
652 * @return An error code
653 * @param[out] start The start index of the text block
654 * @param[out] end The end index of the text block
655 * @exception E_SUCCESS The method was successful.
656 * @exception E_SYSTEM A system error occurred.
657 * @remarks The method returns @c start = 0 and @c end = 0 if no text block is selected.
658 * @see ReleaseBlock()
659 * @see SetBlockRange()
661 result GetBlockRange(int& start, int& end) const;
664 * Releases the selection of the current text block.
667 * @return An error code
668 * @exception E_SUCCESS The method was successful.
669 * @exception E_SYSTEM A system error occurred.
670 * @see GetBlockRange()
671 * @see SetBlockRange()
673 result ReleaseBlock(void);
676 * Selects the specified block of the text.
679 * @return An error code
680 * @param[in] start The start index of the text block
681 * @param[in] end The end index of the text block
682 * @exception E_SUCCESS The method was successful.
683 * @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.
684 * @exception E_SYSTEM A system error occurred.
685 * @see ReleaseBlock()
686 * @see GetBlockRange()
688 result SetBlockRange(int start, int end);
691 * Removes the text of the selected text block.
694 * @return An error code
695 * @exception E_SUCCESS The method was successful.
696 * @exception E_SYSTEM A system error occurred.
698 result RemoveTextBlock(void);
701 * Gets the color of the SearchBar control for the specified status.
704 * @return The color of the SearchBar control, @n
705 * else RGBA(0,0,0,0) if an error occurs
706 * @exception E_SUCCESS The method was successful.
707 * @exception E_SYSTEM A system error occurred.
708 * @remarks The specific error code can be accessed using the GetLastResult() method.
711 Tizen::Graphics::Color GetColor(void) const;
714 * Gets the color of the search field for the specified status.
717 * @return The color, @n
718 * else RGBA(0,0,0,0) if an error occurs
719 * @param[in] status The search field status
720 * @exception E_SUCCESS The method was successful.
721 * @exception E_SYSTEM A system error occurred.
722 * @remarks The specific error code can be accessed using the GetLastResult() method.
723 * @see SetSearchFieldColor()
725 Tizen::Graphics::Color GetSearchFieldColor(SearchFieldStatus status) const;
728 * Gets the text color of the search field for the specified status.
731 * @return The text color, @n
732 * else RGBA(0,0,0,0) if an error occurs
733 * @param[in] status The search field status
734 * @exception E_SUCCESS The method was successful.
735 * @exception E_SYSTEM A system error occurred.
736 * @remarks The specific error code can be accessed using the GetLastResult() method.
737 * @see SetSearchFieldTextColor()
739 Tizen::Graphics::Color GetSearchFieldTextColor(SearchFieldStatus status) const;
742 * Sets the background bitmap of the SearchBar control.
745 * @return An error code
746 * @param[in] bitmap The background bitmap
747 * @exception E_SUCCESS The method was successful.
748 * @exception E_SYSTEM A system error occurred.
750 result SetBackgroundBitmap(const Tizen::Graphics::Bitmap& bitmap);
753 * Sets the color of the search bar.
756 * @return An error code
757 * @param[in] status The state of SearchBar
758 * @param[in] color The color
759 * @exception E_SUCCESS The method was successful.
760 * @exception E_SYSTEM A system error occurred.
763 result SetColor(const Tizen::Graphics::Color& color);
766 * Sets the color of the search field for the specified status.
769 * @return An error code
770 * @param[in] status The state of search field
771 * @param[in] color The text color
772 * @exception E_SUCCESS The method was successful.
773 * @exception E_SYSTEM A system error occurred.
774 * @see GetSearchFieldColor()
776 result SetSearchFieldColor(SearchFieldStatus status, const Tizen::Graphics::Color& color);
779 * Sets the text color of the search field for the specified status.
782 * @return An error code
783 * @param[in] status The state of search field
784 * @param[in] color The text color
785 * @exception E_SUCCESS The method was successful.
786 * @exception E_SYSTEM A system error occurred.
787 * @see GetSearchFieldTextColor()
789 result SetSearchFieldTextColor(SearchFieldStatus status, const Tizen::Graphics::Color& color);
792 * Gets the guide text.
795 * @return The guide text, @n
796 * else an empty string if an error occurs
797 * @param[in] guideText
798 * @exception E_SUCCESS The method was successful.
799 * @exception E_SYSTEM A system error occurred.
800 * @remarks The specific error code can be accessed using the GetLastResult() method.
801 * @see GetGuideText()
803 Tizen::Base::String GetGuideText(void) const;
806 * Displays the specified text when there is no text in the SearchBar control.
809 * @return An error code
810 * @param[in] guideText The guide text
811 * @exception E_SUCCESS The method was successful.
812 * @exception E_SYSTEM A system error occurred.
813 * @see GetGuideText()
815 result SetGuideText(const Tizen::Base::String& guideText);
818 * Gets the text color of the guide text.
821 * @return The text color of the guide text, @n
822 * else RGBA(0,0,0,0) if an error occurs
823 * @exception E_SUCCESS The method was successful.
824 * @exception E_SYSTEM A system error occurred.
825 * @remarks The specific error code can be accessed using the GetLastResult() method.
826 * @see SetGuideTextColor()
828 Tizen::Graphics::Color GetGuideTextColor(void) const;
831 * Sets the text color of the guide text.
834 * @return An error code
835 * @param[in] color The guide text color
836 * @exception E_SUCCESS The method was successful.
837 * @exception E_SYSTEM A system error occurred.
838 * @see GetGuideTextColor()
840 result SetGuideTextColor(const Tizen::Graphics::Color& color);
843 * Gets the current cursor position index.
846 * @return The cursor position, @n
847 * else @c -1 if an error occurs
848 * @exception E_SUCCESS The method was successful.
849 * @exception E_SYSTEM A system error occurred.
850 * @remarks The specific error code can be accessed using the GetLastResult() method.
851 * @see SetCursorPosition()
853 int GetCursorPosition(void) const;
856 * Sets the cursor at the specified index.
859 * @return An error code
860 * @param[in] index The cursor index
861 * @exception E_SUCCESS The method was successful.
862 * @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.
863 * @exception E_SYSTEM A system error occurred.
864 * @see GetCursorPosition()
866 result SetCursorPosition(int index);
869 * Checks whether the lowercase mode is enabled.
872 * @return @c true if the lowercase mode is enabled, @n
874 * @exception E_SUCCESS The method was successful.
875 * @exception E_SYSTEM A system error occurred.
876 * @remarks The specific error code can be accessed using the GetLastResult() method.
877 * @see SetLowerCaseModeEnabled()
879 bool IsLowerCaseModeEnabled(void) const;
882 * Enables or disables the lowercase mode.
885 * @param[in] enable Set to @c true to enable lowercase mode, @n
887 * @exception E_SUCCESS The method was successful.
888 * @exception E_SYSTEM A system error occurred.
889 * @see IsLowerCaseModeEnabled()
891 void SetLowerCaseModeEnabled(bool enable);
894 * Gets the ellipsis position.
897 * @return The ellipsis position
898 * @exception E_SUCCESS The method was successful.
899 * @exception E_SYSTEM A system error occurred.
900 * @remarks The specific error code can be accessed using the GetLastResult() method.
901 * @see SetEllipsisPosition()
903 EllipsisPosition GetEllipsisPosition(void) const;
906 * Sets the ellipsis position.
909 * @return An error code
910 * @param[in] position The ellipsis position
911 * @exception E_SUCCESS The method was successful.
912 * @exception E_SYSTEM A system error occurred.
913 * @see GetEllipsisPosition()
915 result SetEllipsisPosition(EllipsisPosition position);
918 * Gets the keypad action type.
921 * @return The keypad action
922 * @exception E_SUCCESS The method was successful.
923 * @exception E_SYSTEM A system error occurred.
924 * @remarks The specific error code can be accessed using the GetLastResult() method.
926 CoreKeypadAction GetKeypadAction(void) const;
929 * Checks whether the text prediction is enabled.
932 * @return @c true if the text prediction is enabled, @n
934 * @exception E_SUCCESS The method is successful.
935 * @exception E_SYSTEM A system error has occurred.
936 * @remarks The specific error code can be accessed using the GetLastResult() method.
937 * @see SetTextPredictionEnabled()
939 bool IsTextPredictionEnabled(void) const;
942 * Enables or disables the text prediction.
945 * @param[in] enable Set to @c true to enable the text prediction, @n
947 * @return An error code
948 * @exception E_SUCCESS The method is successful.
949 * @exception E_SYSTEM A system error has occurred.
950 * @see IsTextPredictionEnabled()
952 result SetTextPredictionEnabled(bool enable);
954 result GetCurrentLanguage(Tizen::Locales::LanguageCode& language) const;
955 result SetCurrentLanguage(Tizen::Locales::LanguageCode languageCode);
957 result AddActionEventListener(const _IActionEventListener& listener);
958 result RemoveActionEventListener(const _IActionEventListener& listener);
959 result AddKeypadEventListener(const _IKeypadEventListener& listener);
960 result RemoveKeypadEventListener(const _IKeypadEventListener& listener);
961 result AddTextBlockEventListener(const _ITextBlockEventListener& listener);
962 result RemoveTextBlockEventListener(const _ITextBlockEventListener& listener);
963 result AddTextEventListener(const _ITextEventListener& listener);
964 result RemoveTextEventListener(const _ITextEventListener& listener);
965 result AddSearchBarEventListener(const _ISearchBarEventListener& listener);
966 result RemoveSearchBarEventListener(const _ISearchBarEventListener& listener);
967 result AddLanguageEventListener(const _ILanguageEventListener& listener);
968 result RemoveLanguageEventListener(const _ILanguageEventListener& listener);
970 void SetContentsArea(void);
972 Tizen::Graphics::Bitmap* GetBackgroundBitmap(void) const;
973 bool IsUsableCancelButton(void) const;
975 _Button* GetSearchBarButton(void) const;
976 _Edit* GetSearchField(void);
977 _Control* GetSearchBarContainer(void) const;
978 _Control* GetClippedGroupControl(void) const;
980 result SendSearchBarEvent(_SearchBarEventStatus status);
981 void SetHeaderVisibleState(bool visible);
982 void SetContentDimming(void);
983 bool IsContentAttachable(const _Control* pContent);
984 result ResizeCancelButton(void);
986 virtual _UiTouchEventDelivery OnPreviewTouchReleased(const _Control& source, const _TouchInfo& touchinfo);
988 virtual void OnActionPerformed(const Tizen::Ui::_Control& source, int actionId);
990 virtual void OnKeypadWillOpen(void);
991 virtual void OnKeypadOpened(void);
992 virtual void OnKeypadClosed(void);
993 virtual void OnKeypadBoundsChanged(void);
994 virtual void OnKeypadActionPerformed(CoreKeypadAction keypadAction);
996 virtual void OnTextBlockSelected(Tizen::Ui::_Control& source, int start, int end);
998 virtual void OnTextValueChanged(const Tizen::Ui::_Control& source);
999 virtual void OnTextValueChangeCanceled(const Tizen::Ui::_Control& source);
1001 virtual void OnBoundsChanged(void);
1002 virtual result OnAttachedToMainTree(void);
1003 virtual void OnFontChanged(Tizen::Graphics::Font* pFont);
1004 virtual void OnFontInfoRequested(unsigned long& style, int& size);
1005 virtual bool OnFocusGained(const _Control& source);
1006 virtual bool OnFocusLost(const _Control& source);
1009 virtual void OnDraw(void);
1012 _SearchBar(const _SearchBar&);
1013 _SearchBar& operator =(const _SearchBar&);
1015 _ButtonStatus ConvertSearchBarButtonStatus(SearchBarButtonStatus status);
1016 EditStatus ConvertSearchBarStatus(SearchFieldStatus status);
1018 result CreateSearchField(void);
1019 result CreateCancelButton(void);
1020 result CreateFrontButton(void);
1021 result CreateContentsArea(void);
1022 result CreateClippedGroupControl(void);
1023 //Tizen::Graphics::Font* CreateEditFontN(const Tizen::Graphics::Font* pFont);
1025 Tizen::Ui::_Control* GetParentForm(void) const;
1027 _SearchBarPresenter* __pSearchBarPresenter;
1029 _Control* __pClippedGroupControl;
1031 _Button* __pCancelButton;
1032 _Control* __pContainer;
1033 _Control* __pContentControl;
1036 int __searchBarStyle;
1038 bool __isButtonEnabled;
1039 bool __isUsableCancelButton;
1040 bool __isUserContainerBounds;
1041 bool __isCancelActionInProgress;
1043 CoreKeypadAction __keypadAction;
1045 Tizen::Graphics::Bitmap* __pBackgroundBitmap;
1046 Tizen::Graphics::Color __backgroundColor;
1047 Tizen::Graphics::Color __contentColor;
1049 Tizen::Graphics::Color __color[SEARCHBAR_COLOR_MAX];
1050 Tizen::Graphics::Color __textColor[SEARCHBAR_COLOR_MAX];
1051 Tizen::Graphics::Color __buttonColor[SEARCHBAR_BUTTON_COLOR_MAX];
1052 Tizen::Graphics::Color __buttonTextColor[SEARCHBAR_BUTTON_COLOR_MAX];
1054 Tizen::Graphics::Rectangle __contentAreaBounds;
1056 _ActionEvent* __pActionEvent;
1057 _KeypadEvent* __pKeypadEvent;
1058 _TextBlockEvent* __pTextBlockEvent;
1059 _TextEvent* __pTextEvent;
1060 _SearchBarEvent* __pSearchBarEvent;
1061 _LanguageEvent* __pLanguageEvent;
1062 static const byte _SEARCH_CONTENT_DIM_OPACITY = 128; //50% opacity
1066 }}} // Tizen::Ui::Controls
1068 #endif // _FUI_CTRL_INTERNAL_SEARCH_BAR_H_