2 // Open Service Platform
3 // Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
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
9 // http://www.apache.org/licenses/LICENSE-2.0/
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_SearchBarImpl.cpp
20 * @brief This is the implementation file for _SearchBarImpl class.
23 #include <FApp_AppInfo.h>
24 #include <FBaseSysLog.h>
25 #include <FBase_LocalizedNumParser.h>
26 #include <FLclLocale.h>
27 #include <FUiAccessibilityContainer.h>
28 #include <FUiAccessibilityElement.h>
29 #include "FUi_ResourceSizeInfo.h"
30 #include "FUi_ResourceManager.h"
31 #include "FUi_UiBuilder.h"
32 #include "FUiCtrl_PublicActionEvent.h"
33 #include "FUiCtrl_PublicTextBlockEvent.h"
34 #include "FUiCtrl_PublicTextEvent.h"
35 #include "FUiCtrl_SearchBarImpl.h"
36 #include "FUi_CoordinateSystemUtils.h"
37 #include "FUiCtrl_EditFieldImpl.h"
38 #include "FUiCtrl_ButtonImpl.h"
40 using namespace Tizen::App;
41 using namespace Tizen::Base;
42 using namespace Tizen::Base::Runtime;
43 using namespace Tizen::Locales;
44 using namespace Tizen::Graphics;
45 using namespace Tizen::Ui;
47 namespace Tizen { namespace Ui { namespace Controls
50 _SearchBarImpl::_SearchBarImpl(SearchBar* pPublic, _SearchBar* pCore)
51 : _ControlImpl(pPublic, pCore)
55 , __pContentControl(null)
56 , __pPublicActionEvent(null)
57 , __pPublicKeypadEvent(null)
58 , __pPublicTextBlockEvent(null)
59 , __pPublicTextEvent(null)
60 , __pPublicSearchBarEvent(null)
61 , __pPublicLanguageEvent(null)
62 , __pPublicFocusEventListeners(null)
67 _SearchBarImpl::~_SearchBarImpl(void)
74 if (__pPublicActionEvent)
76 delete __pPublicActionEvent;
77 __pPublicActionEvent = null;
80 if (__pPublicKeypadEvent)
82 delete __pPublicKeypadEvent;
83 __pPublicKeypadEvent = null;
86 if (__pPublicTextBlockEvent)
88 delete __pPublicTextBlockEvent;
89 __pPublicTextBlockEvent = null;
92 if (__pPublicTextEvent)
94 delete __pPublicTextEvent;
95 __pPublicTextEvent = null;
98 if (__pPublicSearchBarEvent)
100 delete __pPublicSearchBarEvent;
101 __pPublicSearchBarEvent = null;
106 if (__pSearchBar->GetClippedGroupControl())
108 _Control* pControl = __pSearchBar->GetClippedGroupControl();
109 pControl->DetachAllChildren();
125 if (__pPublicFocusEventListeners)
127 delete __pPublicFocusEventListeners;
128 __pPublicFocusEventListeners = null;
133 _SearchBarImpl::CreateSearchBarImplN(SearchBar* pControl, const Rectangle& bounds, bool enableSearchBarButton, KeypadAction keypadAction)
136 result r = E_SUCCESS;
138 r = GET_SIZE_INFO(SearchBar).CheckInitialSizeValid(Dimension(bounds.width, bounds.height), _CONTROL_ORIENTATION_PORTRAIT);
139 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, null, E_INVALID_ARG,
140 "[E_INVALID_ARG] Invalid argument(s) is used. The given size is not valid.");
142 _SearchBar* pCore = _SearchBar::CreateSearchBarN();
144 SysTryReturn(NID_UI_CTRL, pCore != null, null, r, "[%s] Propagating.", GetErrorMessage(r));
146 _SearchBarImpl* pImpl = new (std::nothrow) _SearchBarImpl(pControl, pCore);
148 r = CheckConstruction(pCore, pImpl);
149 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
151 r = pImpl->InitializeBoundsProperties(GET_SIZE_INFO(SearchBar), bounds, pCore->GetOrientation());
152 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
154 r = pImpl->Initialize(enableSearchBarButton, keypadAction);
155 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
164 _SearchBarImpl::CreateSearchBarImplFN(SearchBar* pControl, const FloatRectangle& bounds, bool enableSearchBarButton, KeypadAction keypadAction)
167 result r = E_SUCCESS;
169 r = GET_SIZE_INFO(SearchBar).CheckInitialSizeValidF(FloatDimension(bounds.width, bounds.height), _CONTROL_ORIENTATION_PORTRAIT);
170 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, null, E_INVALID_ARG,
171 "[E_INVALID_ARG] Invalid argument(s) is used. The given size is not valid.");
173 _SearchBar* pCore = _SearchBar::CreateSearchBarN();
175 SysTryReturn(NID_UI_CTRL, pCore != null, null, r, "[%s] Propagating.", GetErrorMessage(r));
177 _SearchBarImpl* pImpl = new (std::nothrow) _SearchBarImpl(pControl, pCore);
179 r = CheckConstruction(pCore, pImpl);
180 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
182 r = pImpl->InitializeBoundsPropertiesF(GET_SIZE_INFO(SearchBar), bounds, pCore->GetOrientation());
183 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
185 r = pImpl->Initialize(enableSearchBarButton, keypadAction);
186 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
195 _SearchBarImpl::GetPublicClassName(void) const
197 return "Tizen::Ui::Controls::SearchBar";
201 _SearchBarImpl::GetPublic(void) const
203 return static_cast <const SearchBar&>(_ControlImpl::GetPublic());
207 _SearchBarImpl::GetPublic(void)
209 return static_cast <SearchBar&>(_ControlImpl::GetPublic());
213 _SearchBarImpl::GetCore(void) const
215 return static_cast <const _SearchBar&>(_ControlImpl::GetCore());
219 _SearchBarImpl::GetCore(void)
221 return static_cast <_SearchBar&>(_ControlImpl::GetCore());
225 _SearchBarImpl::GetInstance(SearchBar& searchBar)
227 return (static_cast<_SearchBarImpl*>(searchBar._pControlImpl));
230 const _SearchBarImpl*
231 _SearchBarImpl::GetInstance(const SearchBar& searchBar)
233 return (static_cast<const _SearchBarImpl*>(searchBar._pControlImpl));
238 _SearchBarImpl::Initialize(bool enableSearchBarButton, KeypadAction keypadAction)
242 result r = E_SUCCESS;
244 CoreKeypadAction coreKeypadAction = CORE_KEYPAD_ACTION_SEARCH;
245 switch (keypadAction)
247 case KEYPAD_ACTION_ENTER:
248 coreKeypadAction = CORE_KEYPAD_ACTION_ENTER;
251 case KEYPAD_ACTION_GO:
252 coreKeypadAction = CORE_KEYPAD_ACTION_GO;
255 case KEYPAD_ACTION_NEXT:
256 coreKeypadAction = CORE_KEYPAD_ACTION_NEXT;
259 case KEYPAD_ACTION_SEND:
260 coreKeypadAction = CORE_KEYPAD_ACTION_SEND;
263 case KEYPAD_ACTION_SEARCH:
264 coreKeypadAction = CORE_KEYPAD_ACTION_SEARCH;
267 case KEYPAD_ACTION_LOGIN:
268 coreKeypadAction = CORE_KEYPAD_ACTION_LOGIN;
271 case KEYPAD_ACTION_SIGN_IN:
272 coreKeypadAction = CORE_KEYPAD_ACTION_SIGN_IN;
275 case KEYPAD_ACTION_JOIN:
276 coreKeypadAction = CORE_KEYPAD_ACTION_JOIN;
279 case KEYPAD_ACTION_DONE:
280 coreKeypadAction = CORE_KEYPAD_ACTION_DONE;
287 __pEditField = new (std::nothrow) EditField();
288 SysTryReturnResult(NID_UI_CTRL, __pEditField, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Failed to allocate memory.");
290 r = __pEditField->Construct(GetBoundsF(), EDIT_FIELD_STYLE_NORMAL, INPUT_STYLE_OVERLAY, EDIT_FIELD_TITLE_STYLE_NONE, true);
291 SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
293 __pEditField->AddFocusEventListener(*this);
294 SysTryReturnResult(NID_UI_CTRL, GetLastResult() == E_SUCCESS, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
296 __pEditField->AddKeyEventListener(*this);
297 SysTryReturnResult(NID_UI_CTRL, GetLastResult() == E_SUCCESS, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
299 __pEditFieldImpl = _EditFieldImpl::GetInstance(*__pEditField);
300 SysTryReturnResult(NID_UI_CTRL, __pEditFieldImpl != null, E_SYSTEM,
301 "[E_SYSTEM] A system error has occured. Failed to EditFieldImpl instance");
303 String cancelButtonText;
304 GET_STRING_CONFIG(IDS_TPLATFORM_BUTTON_CANCEL_ABB, cancelButtonText);
306 __pButton = new (std::nothrow) Button();
307 SysTryReturnResult(NID_UI_CTRL, __pButton, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Failed to allocate memory.");
309 r = __pButton->Construct(GetBoundsF(), cancelButtonText);
310 SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
312 __pButton->AddFocusEventListener(*this);
313 SysTryReturnResult(NID_UI_CTRL, GetLastResult() == E_SUCCESS, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
315 __pButtonImpl = _ButtonImpl::GetInstance(*__pButton);
316 SysTryReturnResult(NID_UI_CTRL, __pButtonImpl != null, E_SYSTEM,
317 "[E_SYSTEM] A system error has occured. Failed to ButtonImpl instance");
319 r = __pSearchBar->Initialize(enableSearchBarButton, coreKeypadAction);
320 SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "Propagating.");
322 __pPublicActionEvent = _PublicActionEvent::CreateInstanceN(GetPublic());
324 SysTryReturn(NID_UI_CTRL, __pPublicActionEvent, r, r, "[%s] Propagating.", GetErrorMessage(r));
326 r = __pSearchBar->AddActionEventListener(*this);
327 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
329 __pPublicKeypadEvent = _PublicKeypadEvent::CreateInstanceN(GetPublic());
331 SysTryReturn(NID_UI_CTRL, __pPublicKeypadEvent, r, r, "[%s] Propagating.", GetErrorMessage(r));
333 r = __pSearchBar->AddKeypadEventListener(*this);
334 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
336 __pPublicTextBlockEvent = _PublicTextBlockEvent::CreateInstanceN(GetPublic());
338 SysTryReturn(NID_UI_CTRL, __pPublicTextBlockEvent, r, r, "[%s] Propagating.", GetErrorMessage(r));
340 r = __pSearchBar->AddTextBlockEventListener(*this);
341 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
343 __pPublicTextEvent = _PublicTextEvent::CreateInstanceN(GetPublic());
345 SysTryReturn(NID_UI_CTRL, __pPublicTextEvent, r, r, "[%s] Propagating.", GetErrorMessage(r));
347 r = __pSearchBar->AddTextEventListener(*this);
348 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
350 __pPublicSearchBarEvent = _PublicSearchBarEvent::CreateInstanceN(GetPublic());
352 SysTryReturn(NID_UI_CTRL, __pPublicSearchBarEvent, r, r, "[%s] Propagating.", GetErrorMessage(r));
354 r = __pSearchBar->AddSearchBarEventListener(*this);
355 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
357 __pPublicLanguageEvent = _PublicLanguageEvent::CreateInstanceN(GetPublic());
359 SysTryReturn(NID_UI_CTRL, __pPublicLanguageEvent, r, r, "[%s] Propagating.", GetErrorMessage(r));
361 r = __pSearchBar->AddLanguageEventListener(*this);
362 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
364 __pPublicFocusEventListeners = CreatePublicEventListenerListN();
366 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
372 _SearchBarImpl::GetContent(void) const
376 return __pContentControl;
380 _SearchBarImpl::SetContent(const Control* pContent)
384 result r = E_SUCCESS;
385 if (pContent != null)
387 const _Control& content = _ControlImpl::GetInstance(*pContent)->GetCore();
388 bool isContentAttachable = __pSearchBar->IsContentAttachable(&content);
389 SysTryReturn(NID_UI_CTRL, isContentAttachable, E_INVALID_ARG, E_INVALID_ARG,
390 "[E_INVALID_ARG] Invalid argument(s) is used. The content cannot be set.");
393 if (pContent != null && __pContentControl == null)
395 __pContentControl = const_cast <Control*>(pContent);
396 _Control& control = _ControlImpl::GetInstance(*__pContentControl)->GetCore();
398 r = __pSearchBar->SetContent(&control);
405 _SearchBarImpl::UpdateContentArea(bool invalidate)
409 return __pSearchBar->UpdateContentArea(invalidate);
413 _SearchBarImpl::SetContentAreaVisible(bool visible)
417 return __pSearchBar->SetContentAreaVisible(visible, true);
421 _SearchBarImpl::IsContentAreaVisible(void) const
425 return __pSearchBar->IsContentAreaVisible();
429 _SearchBarImpl::SetContentAreaSize(const Dimension& size)
433 FloatDimension contentSize;
434 contentSize = _CoordinateSystemUtils::ConvertToFloat(size);
435 Variant var(contentSize);
437 return __pSearchBar->SetPropertyContentAreaSize(var);
441 _SearchBarImpl::SetContentAreaSize(const FloatDimension& size)
446 return __pSearchBar->SetPropertyContentAreaSize(var);
450 _SearchBarImpl::GetContentAreaSize(void) const
455 size = _CoordinateSystemUtils::ConvertToInteger(__pSearchBar->GetPropertyContentAreaSize().ToFloatDimension());
461 _SearchBarImpl::GetContentAreaSizeF(void) const
465 return __pSearchBar->GetPropertyContentAreaSize().ToFloatDimension();
469 _SearchBarImpl::GetMode(void) const
473 return __pSearchBar->GetMode();
477 _SearchBarImpl::IsModeLocked(void) const
481 return __pSearchBar->IsModeLocked();
485 _SearchBarImpl::SetMode(SearchBarMode mode)
489 return __pSearchBar->SetMode(mode);
493 _SearchBarImpl::SetModeLocked(bool modeLocked)
497 return __pSearchBar->SetModeLocked(modeLocked);
501 _SearchBarImpl::GetButtonActionId(void) const
505 return __pSearchBar->GetPropertyButtonActionId().ToInt();
509 _SearchBarImpl::GetButtonColor(SearchBarButtonStatus status) const
517 case SEARCH_BAR_BUTTON_STATUS_NORMAL:
518 buttonColor = __pSearchBar->GetPropertyButtonNormalColor();
520 case SEARCH_BAR_BUTTON_STATUS_PRESSED:
521 buttonColor = __pSearchBar->GetPropertyButtonPressedColor();
523 case SEARCH_BAR_BUTTON_STATUS_HIGHLIGHTED:
524 buttonColor = __pSearchBar->GetPropertyButtonHighlightedColor();
526 case SEARCH_BAR_BUTTON_STATUS_DISABLED:
527 buttonColor = __pSearchBar->GetPropertyButtonDisabledColor();
533 return buttonColor.ToColor();
537 _SearchBarImpl::GetButtonTextColor(SearchBarButtonStatus status) const
541 Variant buttonTextColor;
545 case SEARCH_BAR_BUTTON_STATUS_NORMAL:
546 buttonTextColor = __pSearchBar->GetPropertyButtonNormalTextColor();
548 case SEARCH_BAR_BUTTON_STATUS_PRESSED:
549 buttonTextColor = __pSearchBar->GetPropertyButtonPressedTextColor();
551 case SEARCH_BAR_BUTTON_STATUS_HIGHLIGHTED:
552 buttonTextColor = __pSearchBar->GetPropertyButtonHighlightedTextColor();
554 case SEARCH_BAR_BUTTON_STATUS_DISABLED:
555 buttonTextColor = __pSearchBar->GetPropertyButtonDisabledTextColor();
561 return buttonTextColor.ToColor();
564 SearchBarButtonStatus
565 _SearchBarImpl::GetButtonStatus(void) const
569 return __pSearchBar->GetButtonStatus();
573 _SearchBarImpl::SetButton(const String& text, int actionId)
577 result r = E_SUCCESS;
578 Variant var(actionId);
580 r = __pSearchBar->SetButtonText(text);
581 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
583 r = __pSearchBar->SetPropertyButtonActionId(var);
589 _SearchBarImpl::SetButtonEnabled(bool enabled)
593 return __pSearchBar->SetButtonEnabled(enabled);
597 _SearchBarImpl::SetButtonColor(SearchBarButtonStatus status, const Color& color)
601 result r = E_SUCCESS;
606 case SEARCH_BAR_BUTTON_STATUS_NORMAL:
607 r = __pSearchBar->SetPropertyButtonNormalColor(var);
609 case SEARCH_BAR_BUTTON_STATUS_PRESSED:
610 r = __pSearchBar->SetPropertyButtonPressedColor(var);
612 case SEARCH_BAR_BUTTON_STATUS_HIGHLIGHTED:
613 r = __pSearchBar->SetPropertyButtonHighlightedColor(var);
615 case SEARCH_BAR_BUTTON_STATUS_DISABLED:
616 r = __pSearchBar->SetPropertyButtonDisabledColor(var);
626 _SearchBarImpl::SetButtonTextColor(SearchBarButtonStatus status, const Color& color)
630 result r = E_SUCCESS;
635 case SEARCH_BAR_BUTTON_STATUS_NORMAL:
636 r = __pSearchBar->SetPropertyButtonNormalTextColor(var);
638 case SEARCH_BAR_BUTTON_STATUS_PRESSED:
639 r = __pSearchBar->SetPropertyButtonPressedTextColor(var);
641 case SEARCH_BAR_BUTTON_STATUS_HIGHLIGHTED:
642 r = __pSearchBar->SetPropertyButtonHighlightedTextColor(var);
644 case SEARCH_BAR_BUTTON_STATUS_DISABLED:
645 r = __pSearchBar->SetPropertyButtonDisabledTextColor(var);
655 _SearchBarImpl::AppendCharacter(const Character& character)
659 return __pSearchBar->AppendCharacter(character);
663 _SearchBarImpl::AppendText(const String& text)
667 return __pSearchBar->AppendText(text);
671 _SearchBarImpl::SetText(const String& text)
675 return __pSearchBar->SetText(text);
679 _SearchBarImpl::InsertCharacterAt(int index, const Character& character)
683 return __pSearchBar->InsertCharacterAt(index, character);
687 _SearchBarImpl::InsertTextAt(int index, const String& text)
691 return __pSearchBar->InsertTextAt(index, text);
695 _SearchBarImpl::DeleteCharacterAt(int index)
699 return __pSearchBar->DeleteCharacterAt(index);
703 _SearchBarImpl::Clear(void)
707 result r = E_SUCCESS;
708 r = __pSearchBar->Clear();
710 SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, E_SYSTEM,
711 "[E_SYSTEM] A system error has occured. Failed to clear the text.");
716 _SearchBarImpl::GetTextLength(void) const
720 return __pSearchBar->GetTextLength();
724 _SearchBarImpl::GetText(void) const
728 return __pSearchBar->GetText();
732 _SearchBarImpl::GetText(int start, int end) const
736 return __pSearchBar->GetText(start, end);
740 _SearchBarImpl::GetLimitLength(void) const
744 return __pSearchBar->GetLimitLength();
748 _SearchBarImpl::SetLimitLength(int limitLength)
752 return __pSearchBar->SetLimitLength(limitLength);
756 _SearchBarImpl::ShowKeypad(void) const
760 return __pSearchBar->ShowKeypad();
764 _SearchBarImpl::HideKeypad(void) const
768 return __pSearchBar->HideKeypad();
772 _SearchBarImpl::GetSearchFieldTextSize(void) const
776 int textSize = _CoordinateSystemUtils::ConvertToInteger(__pSearchBar->GetSearchFieldTextSizeF());
781 _SearchBarImpl::GetSearchFieldTextSizeF(void) const
785 return __pSearchBar->GetSearchFieldTextSizeF();
789 _SearchBarImpl::SetSearchFieldTextSize(int size)
793 float textSize = _CoordinateSystemUtils::ConvertToFloat(size);
794 return SetSearchFieldTextSize(textSize);
798 _SearchBarImpl::SetSearchFieldTextSize(float size)
802 return __pSearchBar->SetSearchFieldTextSize(size);
806 _SearchBarImpl::GetBlockRange(int& start, int& end) const
810 return __pSearchBar->GetBlockRange(start, end);
814 _SearchBarImpl::ReleaseBlock(void)
818 return __pSearchBar->ReleaseBlock();
822 _SearchBarImpl::SetBlockRange(int start, int end)
826 return __pSearchBar->SetBlockRange(start, end + 1);
830 _SearchBarImpl::RemoveTextBlock(void)
833 result r = __pSearchBar->RemoveTextBlock();
834 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, E_SYSTEM, E_SYSTEM,
835 "[E_SYSTEM] A system error has occured. Unable to remove the text block.");
841 _SearchBarImpl::GetColor(void) const
845 return __pSearchBar->GetPropertyColor().ToColor();
849 _SearchBarImpl::GetSearchFieldColor(SearchFieldStatus status) const
853 Variant searchFieldColor;
857 case SEARCH_FIELD_STATUS_NORMAL:
858 searchFieldColor = __pSearchBar->GetPropertySearchFieldNormalColor();
860 case SEARCH_FIELD_STATUS_HIGHLIGHTED:
861 searchFieldColor = __pSearchBar->GetPropertySearchFieldHighlightedColor();
863 case SEARCH_FIELD_STATUS_DISABLED:
864 searchFieldColor = __pSearchBar->GetPropertySearchFieldDisabledColor();
870 return searchFieldColor.ToColor();
874 _SearchBarImpl::GetSearchFieldTextColor(SearchFieldStatus status) const
879 _Edit* pEdit = __pSearchBar->GetSearchField();
884 case SEARCH_FIELD_STATUS_NORMAL:
885 color = pEdit->GetTextColor(EDIT_TEXT_COLOR_NORMAL);
887 case SEARCH_FIELD_STATUS_HIGHLIGHTED:
888 color = pEdit->GetTextColor(EDIT_TEXT_COLOR_HIGHLIGHTED);
890 case SEARCH_FIELD_STATUS_DISABLED:
891 color = pEdit->GetTextColor(EDIT_TEXT_COLOR_DISABLED);
901 _SearchBarImpl::SetBackgroundBitmap(const Bitmap& bitmap)
905 return __pSearchBar->SetBackgroundBitmap(bitmap);
909 _SearchBarImpl::SetColor(const Color& color)
915 return __pSearchBar->SetPropertyColor(var);
919 _SearchBarImpl::SetSearchFieldColor(SearchFieldStatus status, const Color& color)
923 result r = E_SUCCESS;
928 case SEARCH_FIELD_STATUS_NORMAL:
929 r = __pSearchBar->SetPropertySearchFieldNormalColor(var);
931 case SEARCH_FIELD_STATUS_HIGHLIGHTED:
932 r = __pSearchBar->SetPropertySearchFieldHighlightedColor(var);
934 case SEARCH_FIELD_STATUS_DISABLED:
935 r = __pSearchBar->SetPropertySearchFieldDisabledColor(var);
945 _SearchBarImpl::SetSearchFieldTextColor(SearchFieldStatus status, const Color& color)
949 result r = E_SUCCESS;
950 _Edit* pEdit = __pSearchBar->GetSearchField();
955 case SEARCH_FIELD_STATUS_NORMAL:
956 r = pEdit->SetTextColor(EDIT_TEXT_COLOR_NORMAL, color);
958 case SEARCH_FIELD_STATUS_HIGHLIGHTED:
959 r = pEdit->SetTextColor(EDIT_TEXT_COLOR_HIGHLIGHTED, color);
961 case SEARCH_FIELD_STATUS_DISABLED:
962 r = pEdit->SetTextColor(EDIT_TEXT_COLOR_DISABLED, color);
973 _SearchBarImpl::GetGuideText(void) const
977 return __pSearchBar->GetGuideText();
981 _SearchBarImpl::SetGuideText(const String& guideText)
985 return __pSearchBar->SetGuideText(guideText);
989 _SearchBarImpl::GetGuideTextColor(void) const
993 return __pSearchBar->GetGuideTextColor();
997 _SearchBarImpl::SetGuideTextColor(const Color& color)
1001 return __pSearchBar->SetGuideTextColor(color);
1005 _SearchBarImpl::GetCursorPosition(void) const
1009 return __pSearchBar->GetCursorPosition();
1013 _SearchBarImpl::SetCursorPosition(int index)
1017 return __pSearchBar->SetCursorPosition(index);
1021 _SearchBarImpl::IsLowerCaseModeEnabled(void) const
1025 return __pSearchBar->IsLowerCaseModeEnabled();
1029 _SearchBarImpl::SetLowerCaseModeEnabled(bool enable)
1033 return __pSearchBar->SetLowerCaseModeEnabled(enable);
1037 _SearchBarImpl::GetEllipsisPosition(void) const
1041 return __pSearchBar->GetEllipsisPosition();
1045 _SearchBarImpl::SetEllipsisPosition(EllipsisPosition position)
1049 return __pSearchBar->SetEllipsisPosition(position);
1053 _SearchBarImpl::GetKeypadAction(void) const
1057 CoreKeypadAction coreKeypadAction = __pSearchBar->GetKeypadAction();
1058 KeypadAction publicKeypadAction = ConvertKeypadAction(coreKeypadAction);
1060 return publicKeypadAction;
1064 _SearchBarImpl::IsTextPredictionEnabled(void) const
1066 return __pSearchBar->IsTextPredictionEnabled();
1070 _SearchBarImpl::SetTextPredictionEnabled(bool enable)
1072 return __pSearchBar->SetTextPredictionEnabled(enable);
1076 _SearchBarImpl::SetCurrentLanguage(LanguageCode languageCode)
1078 return __pSearchBar->SetCurrentLanguage(languageCode);
1082 _SearchBarImpl::GetCurrentLanguage(LanguageCode& language) const
1084 return __pSearchBar->GetCurrentLanguage(language);
1088 _SearchBarImpl::AddActionEventListener(IActionEventListener& listener)
1092 SysTryReturn(NID_UI_CTRL, __pPublicActionEvent, E_SYSTEM, E_SYSTEM,
1093 "[E_SYSTEM] A system error has occurred.");
1095 result r = __pPublicActionEvent->AddListener(listener);
1096 SysTryReturnResult(NID_UI_CTRL, r != E_OBJ_ALREADY_EXIST, E_SYSTEM,
1097 "A system error has occurred. The same listener instance already exists in the event listener list.");
1102 _SearchBarImpl::RemoveActionEventListener(IActionEventListener& listener)
1106 SysTryReturn(NID_UI_CTRL, __pPublicActionEvent, E_SYSTEM, E_SYSTEM,
1107 "[E_SYSTEM] A system error has occurred.");
1109 result r = __pPublicActionEvent->RemoveListener(listener);
1110 SysTryReturnResult(NID_UI_CTRL, r != E_OBJ_NOT_FOUND, E_SYSTEM,
1111 "A system error has occurred. The specified listener does not exist in the event listener list.");
1116 _SearchBarImpl::AddKeypadEventListener(IKeypadEventListener& listener)
1120 SysTryReturn(NID_UI_CTRL, __pPublicKeypadEvent, E_SYSTEM, E_SYSTEM,
1121 "[E_SYSTEM] A system error has occurred.");
1123 result r = __pPublicKeypadEvent->AddListener(listener);
1124 SysTryReturnResult(NID_UI_CTRL, r != E_OBJ_ALREADY_EXIST, E_SYSTEM,
1125 "A system error has occurred. The same listener instance already exists in the event listener list.");
1131 _SearchBarImpl::RemoveKeypadEventListener(IKeypadEventListener& listener)
1135 SysTryReturn(NID_UI_CTRL, __pPublicKeypadEvent, E_SYSTEM, E_SYSTEM,
1136 "[E_SYSTEM] A system error has occurred.");
1138 result r = __pPublicKeypadEvent->RemoveListener(listener);
1139 SysTryReturnResult(NID_UI_CTRL, r != E_OBJ_NOT_FOUND, E_SYSTEM,
1140 "A system error has occurred. The specified listener does not exist in the event listener list.");
1146 _SearchBarImpl::AddTextBlockEventListener(ITextBlockEventListener& listener)
1150 SysTryReturn(NID_UI_CTRL, __pPublicTextBlockEvent, E_SYSTEM, E_SYSTEM,
1151 "[E_SYSTEM] A system error has occurred.");
1153 result r = __pPublicTextBlockEvent->AddListener(listener);
1154 SysTryReturnResult(NID_UI_CTRL, r != E_OBJ_ALREADY_EXIST, E_SYSTEM,
1155 "A system error has occurred. The same listener instance already exists in the event listener list.");
1161 _SearchBarImpl::RemoveTextBlockEventListener(ITextBlockEventListener& listener)
1165 SysTryReturn(NID_UI_CTRL, __pPublicTextBlockEvent, E_SYSTEM, E_SYSTEM,
1166 "[E_SYSTEM] A system error has occurred.");
1168 result r = __pPublicTextBlockEvent->RemoveListener(listener);
1169 SysTryReturnResult(NID_UI_CTRL, r != E_OBJ_NOT_FOUND, E_SYSTEM,
1170 "A system error has occurred. The specified listener does not exist in the event listener list.");
1177 _SearchBarImpl::AddTextEventListener(ITextEventListener& listener)
1181 SysTryReturn(NID_UI_CTRL, __pPublicTextEvent, E_SYSTEM, E_SYSTEM,
1182 "[E_SYSTEM] A system error has occurred.");
1184 result r = __pPublicTextEvent->AddListener(listener);
1185 SysTryReturnResult(NID_UI_CTRL, r != E_OBJ_ALREADY_EXIST, E_SYSTEM,
1186 "A system error has occurred. The same listener instance already exists in the event listener list.");
1192 _SearchBarImpl::RemoveTextEventListener(ITextEventListener& listener)
1196 SysTryReturn(NID_UI_CTRL, __pPublicTextEvent, E_SYSTEM, E_SYSTEM,
1197 "[E_SYSTEM] A system error has occurred.");
1199 result r = __pPublicTextEvent->RemoveListener(listener);
1200 SysTryReturnResult(NID_UI_CTRL, r != E_OBJ_NOT_FOUND, E_SYSTEM,
1201 "A system error has occurred. The specified listener does not exist in the event listener list.");
1207 _SearchBarImpl::AddSearchBarEventListener(const ISearchBarEventListener& listener)
1211 SysTryReturn(NID_UI_CTRL, __pPublicSearchBarEvent, E_SYSTEM, E_SYSTEM,
1212 "[E_SYSTEM] A system error has occurred.");
1214 result r = __pPublicSearchBarEvent->AddListener(listener);
1215 SysTryReturnResult(NID_UI_CTRL, r != E_OBJ_ALREADY_EXIST, E_SYSTEM,
1216 "A system error has occurred. The same listener instance already exists in the event listener list.");
1222 _SearchBarImpl::RemoveSearchBarEventListener(const ISearchBarEventListener& listener)
1226 SysTryReturn(NID_UI_CTRL, __pPublicSearchBarEvent, E_SYSTEM, E_SYSTEM,
1227 "[E_SYSTEM] A system error has occurred.");
1229 result r = __pPublicSearchBarEvent->RemoveListener(listener);
1230 SysTryReturnResult(NID_UI_CTRL, r != E_OBJ_NOT_FOUND, E_SYSTEM,
1231 "A system error has occurred. The specified listener does not exist in the event listener list.");
1237 _SearchBarImpl::AddLanguageEventListener(ILanguageEventListener& listener)
1241 SysAssertf(__pPublicLanguageEvent != null, "Not yet constructed. Construct() should be called before use.");
1243 return __pPublicLanguageEvent->AddListener(listener);
1247 _SearchBarImpl::RemoveLanguageEventListener(ILanguageEventListener& listener)
1251 SysAssertf(__pPublicLanguageEvent != null, "Not yet constructed. Construct() should be called before use.");
1253 return __pPublicLanguageEvent->RemoveListener(listener);
1257 _SearchBarImpl::SetEditTextFilter(IEditTextFilter* pFilter)
1259 __pSearchBar->SetEditTextFilter(pFilter);
1265 _SearchBarImpl::SendOpaqueCommand (const String& command)
1267 __pSearchBar->SendOpaqueCommand(command);
1273 _SearchBarImpl::OnActionPerformed(const _Control& source, int actionId)
1277 if (__pPublicActionEvent != null)
1279 IEventArg* pEventArg = _PublicActionEvent::CreateActionEventArgN(actionId);
1280 result r = GetLastResult();
1281 SysTryReturnVoidResult(NID_UI_CTRL, pEventArg, r, "[%s] Propagating.", GetErrorMessage(r));
1283 __pPublicActionEvent->Fire(*pEventArg);
1289 _SearchBarImpl::OnKeypadWillOpen(void)
1293 if (__pPublicKeypadEvent != null)
1295 IEventArg* pEventArg = _PublicKeypadEvent::CreateKeypadEventArgN(
1296 GetPublic(), KEYPAD_ACTION_SEARCH, KEYPAD_EVENT_STATUS_CREATED);
1297 result r = GetLastResult();
1298 SysTryReturnVoidResult(NID_UI_CTRL, pEventArg, r, "[%s] Propagating.", GetErrorMessage(r));
1300 __pPublicKeypadEvent->Fire(*pEventArg);
1306 _SearchBarImpl::OnKeypadOpened(void)
1310 if (__pPublicKeypadEvent != null)
1312 IEventArg* pEventArg = _PublicKeypadEvent::CreateKeypadEventArgN(
1313 GetPublic(), KEYPAD_ACTION_SEARCH, KEYPAD_EVENT_STATUS_OPEN);
1314 result r = GetLastResult();
1315 SysTryReturnVoidResult(NID_UI_CTRL, pEventArg, r, "[%s] Propagating.", GetErrorMessage(r));
1317 __pPublicKeypadEvent->Fire(*pEventArg);
1324 _SearchBarImpl::OnKeypadClosed(void)
1328 if (__pPublicKeypadEvent != null)
1330 IEventArg* pEventArg = _PublicKeypadEvent::CreateKeypadEventArgN(
1331 GetPublic(), KEYPAD_ACTION_SEARCH, KEYPAD_EVENT_STATUS_CLOSE);
1332 result r = GetLastResult();
1333 SysTryReturnVoidResult(NID_UI_CTRL, pEventArg, r, "[%s] Propagating.", GetErrorMessage(r));
1335 __pPublicKeypadEvent->Fire(*pEventArg);
1341 _SearchBarImpl::OnKeypadBoundsChanged(void)
1345 if (__pPublicKeypadEvent != null)
1347 IEventArg* pEventArg = _PublicKeypadEvent::CreateKeypadEventArgN(
1348 GetPublic(), KEYPAD_ACTION_SEARCH, KEYPAD_EVENT_STATUS_BOUNDS_CHANGED);
1349 result r = GetLastResult();
1350 SysTryReturnVoidResult(NID_UI_CTRL, pEventArg, r, "[%s] Propagating.", GetErrorMessage(r));
1352 __pPublicKeypadEvent->Fire(*pEventArg);
1358 _SearchBarImpl::OnKeypadActionPerformed(CoreKeypadAction keypadAction)
1362 if (__pPublicKeypadEvent != null)
1364 KeypadAction publicKeypadAction = ConvertKeypadAction(keypadAction);
1366 IEventArg* pEventArg = _PublicKeypadEvent::CreateKeypadEventArgN(
1367 GetPublic(), publicKeypadAction, KEYPAD_EVENT_STATUS_ENTERACTION);
1368 result r = GetLastResult();
1369 SysTryReturnVoidResult(NID_UI_CTRL, pEventArg, r, "[%s] Propagating.", GetErrorMessage(r));
1371 __pPublicKeypadEvent->Fire(*pEventArg);
1377 _SearchBarImpl::OnTextBlockSelected(_Control& source, int start, int end)
1381 if (__pPublicTextBlockEvent != null)
1383 IEventArg* pEventArg = _PublicTextBlockEvent::CreateTextBlockEventArgN(start, end);
1384 result r = GetLastResult();
1385 SysTryReturnVoidResult(NID_UI_CTRL, pEventArg, r, "[%s] Propagating.", GetErrorMessage(r));
1387 __pPublicTextBlockEvent->Fire(*pEventArg);
1393 _SearchBarImpl::OnTextValueChanged(const _Control& source)
1397 if (__pPublicTextEvent != null)
1399 IEventArg* pEventArg = _PublicTextEvent::CreateTextEventArgN(TEXT_EVENT_CHANGED);
1400 result r = GetLastResult();
1401 SysTryReturnVoidResult(NID_UI_CTRL, pEventArg, r, "[%s] Propagating.", GetErrorMessage(r));
1403 __pPublicTextEvent->Fire(*pEventArg);
1409 _SearchBarImpl::OnTextValueChangeCanceled(const _Control& source)
1413 if (__pPublicTextEvent != null)
1415 IEventArg* pEventArg = _PublicTextEvent::CreateTextEventArgN(TEXT_EVENT_CANCELED);
1416 result r = GetLastResult();
1417 SysTryReturnVoidResult(NID_UI_CTRL, pEventArg, r, "[%s] Propagating.", GetErrorMessage(r));
1419 __pPublicTextEvent->Fire(*pEventArg);
1425 _SearchBarImpl::OnSearchBarModeChanged(_SearchBar& source, SearchBarMode mode)
1429 if ((_AppInfo::GetApiVersion() == _API_VERSION_2_0 && _AppInfo::IsOspCompat()) && __pSearchBar != null)
1431 if (mode == SEARCH_BAR_MODE_NORMAL)
1433 __pSearchBar->SetHeaderVisibleState(true);
1437 __pSearchBar->SetHeaderVisibleState(false);
1439 __pSearchBar->SetContentsArea();
1442 if (__pPublicSearchBarEvent != null)
1444 IEventArg* pEventArg = _PublicSearchBarEvent::CreateSearchBarEventArgN(SEARCH_BAR_EVENT_MODE_CHANGE);
1445 result r = GetLastResult();
1446 SysTryReturnVoidResult(NID_UI_CTRL, pEventArg, r, "[%s] Propagating.", GetErrorMessage(r));
1448 __pPublicSearchBarEvent->Fire(*pEventArg);
1454 _SearchBarImpl::OnLanguageChanged(LanguageCode oldLanguage, LanguageCode newLanguage)
1456 if (__pPublicLanguageEvent)
1458 IEventArg* pKLanguageEventArg = _PublicLanguageEvent::CreateLanguageEventArgN(GetPublic(), oldLanguage, newLanguage);
1459 result r = GetLastResult();
1460 SysTryReturnVoidResult(NID_UI_CTRL, pKLanguageEventArg, r, "[%s] Propagating.", GetErrorMessage(r));
1462 __pPublicLanguageEvent->Fire(*pKLanguageEventArg);
1466 SysLog(NID_UI_CTRL, "Event is not created.");
1472 _SearchBarImpl::OnFocusEventListenerAdded(IFocusEventListener& listener)
1475 SysTryReturnVoidResult(NID_UI,
1476 __pPublicFocusEventListeners->Add(const_cast <IFocusEventListener*>(&listener)) == E_SUCCESS, E_SYSTEM,
1477 "[E_SYSTEM] A system error has occured. Failed to add listener.");
1481 _SearchBarImpl::OnFocusEventListenerRemoved(IFocusEventListener& listener)
1484 SysTryReturnVoidResult(NID_UI,
1485 __pPublicFocusEventListeners->Remove(&listener) == E_SUCCESS, E_SYSTEM,
1486 "[E_SYSTEM] A system error has occured. Failed to remove listener.");
1490 _SearchBarImpl::OnFocusGained(const Tizen::Ui::Control& source)
1492 if (!__pSearchBar->IsFocusCallbackToBeFired())
1497 IEnumeratorT<IEventListener*>* pEnumerator = __pPublicFocusEventListeners->GetEnumeratorN();
1501 while (pEnumerator->MoveNext() == E_SUCCESS)
1503 IEventListener* pListener = null;
1504 pEnumerator->GetCurrent(pListener);
1506 IFocusEventListener* pFocusEventListener = dynamic_cast <IFocusEventListener*>(pListener);
1508 if (pFocusEventListener != null )
1510 pFocusEventListener->OnFocusGained(GetPublic());
1521 _SearchBarImpl::OnFocusLost(const Tizen::Ui::Control& source)
1523 if (!__pSearchBar->IsFocusCallbackToBeFired())
1528 IEnumeratorT<IEventListener*>* pEnumerator = __pPublicFocusEventListeners->GetEnumeratorN();
1531 while (pEnumerator->MoveNext() == E_SUCCESS)
1533 IEventListener* pListener = null;
1534 pEnumerator->GetCurrent(pListener);
1536 IFocusEventListener* pFocusEventListener = dynamic_cast <IFocusEventListener*>(pListener);
1538 if (pFocusEventListener != null )
1540 pFocusEventListener->OnFocusLost(GetPublic());
1551 _SearchBarImpl::OnKeyPressed(const Tizen::Ui::Control& source, Tizen::Ui::KeyCode keyCode)
1553 IEnumeratorT<IEventListener*>* pEnumerator = GetKeyEventListener()->GetEnumeratorN();
1556 while (pEnumerator->MoveNext() == E_SUCCESS)
1558 IEventListener* pListener = null;
1559 pEnumerator->GetCurrent(pListener);
1561 IKeyEventListener* pKeyEventListener = dynamic_cast <IKeyEventListener*>(pListener);
1563 if (pKeyEventListener != null )
1565 pKeyEventListener->OnKeyPressed(GetPublic(), keyCode);
1576 _SearchBarImpl::OnKeyReleased(const Tizen::Ui::Control& source, Tizen::Ui::KeyCode keyCode)
1578 IEnumeratorT<IEventListener*>* pEnumerator = GetKeyEventListener()->GetEnumeratorN();
1581 while (pEnumerator->MoveNext() == E_SUCCESS)
1583 IEventListener* pListener = null;
1584 pEnumerator->GetCurrent(pListener);
1586 IKeyEventListener* pKeyEventListener = dynamic_cast <IKeyEventListener*>(pListener);
1588 if (pKeyEventListener != null )
1590 pKeyEventListener->OnKeyReleased(GetPublic(), keyCode);
1601 _SearchBarImpl::OnKeyLongPressed(const Tizen::Ui::Control& source, Tizen::Ui::KeyCode keyCode)
1603 IEnumeratorT<IEventListener*>* pEnumerator = GetKeyEventListener()->GetEnumeratorN();
1606 while (pEnumerator->MoveNext() == E_SUCCESS)
1608 IEventListener* pListener = null;
1609 pEnumerator->GetCurrent(pListener);
1611 IKeyEventListener* pKeyEventListener = dynamic_cast <IKeyEventListener*>(pListener);
1613 if (pKeyEventListener != null )
1615 pKeyEventListener->OnKeyLongPressed(GetPublic(), keyCode);
1626 _SearchBarImpl::ConvertKeypadAction(CoreKeypadAction keypadAction) const
1628 KeypadAction publicKeypadAction = KEYPAD_ACTION_SEARCH;
1629 switch (keypadAction)
1631 case CORE_KEYPAD_ACTION_ENTER:
1632 publicKeypadAction = KEYPAD_ACTION_ENTER;
1635 case CORE_KEYPAD_ACTION_GO:
1636 publicKeypadAction = KEYPAD_ACTION_GO;
1639 case CORE_KEYPAD_ACTION_NEXT:
1640 publicKeypadAction = KEYPAD_ACTION_NEXT;
1643 case CORE_KEYPAD_ACTION_SEND:
1644 publicKeypadAction = KEYPAD_ACTION_SEND;
1647 case CORE_KEYPAD_ACTION_SEARCH:
1648 publicKeypadAction = KEYPAD_ACTION_SEARCH;
1651 case CORE_KEYPAD_ACTION_LOGIN:
1652 publicKeypadAction = KEYPAD_ACTION_LOGIN;
1655 case CORE_KEYPAD_ACTION_SIGN_IN:
1656 publicKeypadAction = KEYPAD_ACTION_SIGN_IN;
1659 case CORE_KEYPAD_ACTION_JOIN:
1660 publicKeypadAction = KEYPAD_ACTION_JOIN;
1663 case CORE_KEYPAD_ACTION_DONE:
1664 publicKeypadAction = KEYPAD_ACTION_DONE;
1671 return publicKeypadAction;
1675 _SearchBarImpl::GetEditFieldImpl(void) const
1677 return __pEditFieldImpl;
1681 _SearchBarImpl::GetButtonImpl(void) const
1683 return __pButtonImpl;
1686 class _SearchBarMaker
1687 : public _UiBuilderControlMaker
1690 _SearchBarMaker(_UiBuilder* pUibuilder)
1691 : _UiBuilderControlMaker(pUibuilder){}
1692 virtual ~_SearchBarMaker(void){}
1693 static _UiBuilderControlMaker*
1694 GetInstance(_UiBuilder* pUibuilder)
1696 _SearchBarMaker* pSearchBarMaker = new (std::nothrow) _SearchBarMaker(pUibuilder);
1697 return pSearchBarMaker;
1702 Make(_UiBuilderControl* pControl)
1704 result r = E_SUCCESS;
1706 FloatRectangle rect;
1707 SearchBar* pSearchBar = null;
1708 _UiBuilderControlLayout* pControlProperty = null;
1709 bool showSearchBarButton = true;
1710 KeypadAction keypadAction = KEYPAD_ACTION_ENTER;
1712 int opacity = SEARCHBAR_DEFAULT_OPACITY;
1713 EllipsisPosition ellipsisPosition = ELLIPSIS_POSITION_END;
1716 int limitLength = SEARCHBAR_TEXT_LENGTH_MAX;
1717 int buttonActionId = -1;
1719 float searchFieldTextSize = 0.0f;
1720 bool lowercaseEnable = false;
1721 String elementString;
1723 GetProperty(pControl, &pControlProperty);
1724 if (pControlProperty == null)
1729 pSearchBar = new (std::nothrow) SearchBar;
1730 if (pSearchBar == null)
1735 rect = pControlProperty->GetRectF();
1736 if (pControl->GetElement("showSearchBarButton", elementString))
1738 if (elementString.Equals(L"false", false))
1740 showSearchBarButton = false;
1744 if (pControl->GetElement("keypadAction", elementString))
1746 if (elementString.Equals(L"KEYPAD_ACTION_ENTER", false))
1748 keypadAction = KEYPAD_ACTION_ENTER;
1750 else if (elementString.Equals(L"KEYPAD_ACTION_GO", false))
1752 keypadAction = KEYPAD_ACTION_GO;
1754 else if (elementString.Equals(L"KEYPAD_ACTION_NEXT", false))
1756 keypadAction = KEYPAD_ACTION_NEXT;
1758 else if (elementString.Equals(L"KEYPAD_ACTION_SEND", false))
1760 keypadAction = KEYPAD_ACTION_SEND;
1762 else if (elementString.Equals(L"KEYPAD_ACTION_SEARCH", false))
1764 keypadAction = KEYPAD_ACTION_SEARCH;
1766 else if (elementString.Equals(L"KEYPAD_ACTION_LOGIN", false))
1768 keypadAction = KEYPAD_ACTION_LOGIN;
1770 else if (elementString.Equals(L"KEYPAD_ACTION_SIGN_IN", false))
1772 keypadAction = KEYPAD_ACTION_SIGN_IN;
1774 else if (elementString.Equals(L"KEYPAD_ACTION_JOIN", false))
1776 keypadAction = KEYPAD_ACTION_JOIN;
1778 else if (elementString.Equals(L"KEYPAD_ACTION_DONE", false))
1780 keypadAction = KEYPAD_ACTION_DONE;
1784 r = pSearchBar->Construct(rect, showSearchBarButton, keypadAction);
1791 if (showSearchBarButton)
1793 if (pControl->GetElement("buttonActionId", elementString))
1795 Base::Integer::Parse(elementString, buttonActionId);
1798 if (pControl->GetElement("buttonText", elementString))
1800 r = pSearchBar->SetButton(elementString, buttonActionId);
1804 if (pControl->GetElement("text", elementString))
1806 r = pSearchBar->SetText(elementString);
1809 if (pControl->GetElement("guideText", elementString))
1811 r = pSearchBar->SetGuideText(elementString);
1814 if (pControl->GetElement("searchFieldTextSize", elementString))
1816 searchFieldTextSize = _LocalizedNumParser::ToDouble(elementString, "C");
1817 _ICoordinateSystemTransformer* pTransform = GetTransformer();
1820 searchFieldTextSize = pTransform->Transform(searchFieldTextSize);
1822 r = pSearchBar->SetSearchFieldTextSize(searchFieldTextSize);
1825 if (pControl->GetElement("limitLength", elementString))
1827 Base::Integer::Parse(elementString, limitLength);
1828 r = pSearchBar->SetLimitLength(limitLength);
1831 if (pControl->GetElement("lowerCaseMode", elementString))
1833 if (elementString.Equals(L"true", false))
1835 lowercaseEnable = true;
1839 lowercaseEnable = false;
1842 pSearchBar->SetLowerCaseModeEnabled(lowercaseEnable);
1845 if (pControl->GetElement("ellipsisPosition", elementString))
1847 if (elementString.Equals(L"ELLIPSIS_POSITION_START", false))
1849 ellipsisPosition = ELLIPSIS_POSITION_START;
1851 else if (elementString.Equals(L"ELLIPSIS_POSITION_MIDDLE", false))
1853 ellipsisPosition = ELLIPSIS_POSITION_MIDDLE;
1857 ellipsisPosition = ELLIPSIS_POSITION_END;
1860 r = pSearchBar->SetEllipsisPosition(ellipsisPosition);
1863 if (pControl->GetElement("backgroundBitmapPath", elementString))
1865 Bitmap* pBackgroundBitmap = null;
1866 pBackgroundBitmap = LoadBitmapN(elementString);
1867 if (pBackgroundBitmap != null)
1869 pSearchBar->SetBackgroundBitmap(*pBackgroundBitmap);
1870 delete pBackgroundBitmap;
1874 if (pControl->GetElement("colorOpacity", elementString))
1876 Base::Integer::Parse(elementString, opacity);
1878 if (pControl->GetElement("color", elementString))
1880 ConvertStringToColor32(elementString, opacity, color);
1881 r = pSearchBar->SetColor(color);
1884 opacity = SEARCHBAR_DEFAULT_OPACITY;
1885 if (pControl->GetElement("normalButtonColor", elementString))
1887 ConvertStringToColor32(elementString, opacity, color);
1888 r = pSearchBar->SetButtonColor(SEARCH_BAR_BUTTON_STATUS_NORMAL, color);
1891 if (pControl->GetElement("normalButtonTextColor", elementString))
1893 ConvertStringToColor32(elementString, opacity, color);
1894 r = pSearchBar->SetButtonTextColor(SEARCH_BAR_BUTTON_STATUS_NORMAL, color);
1897 if (pControl->GetElement("normalSearchFieldColor", elementString))
1899 ConvertStringToColor32(elementString, opacity, color);
1900 r = pSearchBar->SetSearchFieldColor(SEARCH_FIELD_STATUS_NORMAL, color);
1903 if (pControl->GetElement("normalSearchFieldTextColor", elementString))
1905 ConvertStringToColor32(elementString, opacity, color);
1906 r = pSearchBar->SetSearchFieldTextColor(SEARCH_FIELD_STATUS_NORMAL, color);
1909 if (pControl->GetElement("disabledButtonColor", elementString))
1911 ConvertStringToColor32(elementString, opacity, color);
1912 r = pSearchBar->SetButtonColor(SEARCH_BAR_BUTTON_STATUS_DISABLED, color);
1915 if (pControl->GetElement("disabledButtonTextColor", elementString))
1917 ConvertStringToColor32(elementString, opacity, color);
1918 r = pSearchBar->SetButtonTextColor(SEARCH_BAR_BUTTON_STATUS_DISABLED, color);
1921 if (pControl->GetElement("disabledSearchFieldColor", elementString))
1923 ConvertStringToColor32(elementString, opacity, color);
1924 r = pSearchBar->SetSearchFieldColor(SEARCH_FIELD_STATUS_DISABLED, color);
1927 if (pControl->GetElement("disabledSearchFieldTextColor", elementString))
1929 ConvertStringToColor32(elementString, opacity, color);
1930 r = pSearchBar->SetSearchFieldTextColor(SEARCH_FIELD_STATUS_DISABLED, color);
1933 if (pControl->GetElement("highlightedButtonColor", elementString))
1935 ConvertStringToColor32(elementString, opacity, color);
1936 r = pSearchBar->SetButtonColor(SEARCH_BAR_BUTTON_STATUS_HIGHLIGHTED, color);
1939 if (pControl->GetElement("highlightedButtonTextColor", elementString))
1941 ConvertStringToColor32(elementString, opacity, color);
1942 r = pSearchBar->SetButtonTextColor(SEARCH_BAR_BUTTON_STATUS_HIGHLIGHTED, color);
1945 if (pControl->GetElement("highlightedSearchFieldColor", elementString))
1947 ConvertStringToColor32(elementString, opacity, color);
1948 r = pSearchBar->SetSearchFieldColor(SEARCH_FIELD_STATUS_HIGHLIGHTED, color);
1951 if (pControl->GetElement("highlightedSearchFieldTextColor", elementString))
1953 ConvertStringToColor32(elementString, opacity, color);
1954 r = pSearchBar->SetSearchFieldTextColor(SEARCH_FIELD_STATUS_HIGHLIGHTED, color);
1957 if (pControl->GetElement("pressedButtonColor", elementString))
1959 ConvertStringToColor32(elementString, opacity, color);
1960 r = pSearchBar->SetButtonColor(SEARCH_BAR_BUTTON_STATUS_PRESSED, color);
1963 if (pControl->GetElement("pressedButtonTextColor", elementString))
1965 ConvertStringToColor32(elementString, opacity, color);
1966 r = pSearchBar->SetButtonTextColor(SEARCH_BAR_BUTTON_STATUS_PRESSED, color);
1969 if (pControl->GetElement("guideTextColor", elementString))
1971 ConvertStringToColor32(elementString, opacity, color);
1972 r = pSearchBar->SetGuideTextColor(color);
1975 if (pControl->GetElement(L"accessibilityHint", elementString))
1977 AccessibilityContainer* pContainer = pSearchBar->GetAccessibilityContainer();
1980 AccessibilityElement* pElement = pContainer->GetElement(L"EditText");
1983 pElement->SetHint(elementString);
1992 _SearchBarRegister::_SearchBarRegister(void)
1994 _UiBuilderControlTableManager* pUiBuilderControlTableManager = _UiBuilderControlTableManager::GetInstance();
1995 pUiBuilderControlTableManager->RegisterControl(L"SearchBar", _SearchBarMaker::GetInstance);
1998 _SearchBarRegister::~_SearchBarRegister(void)
2000 _UiBuilderControlTableManager* pUiBuilderControlTableManager = _UiBuilderControlTableManager::GetInstance();
2001 pUiBuilderControlTableManager->UnregisterControl(L"SearchBar");
2003 static _SearchBarRegister SearchBarRegisterToUiBuilder;
2004 }}} // Tizen::Ui::Controls