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)
72 if (__pSearchBar->GetClippedGroupControl())
74 _Control* pControl = __pSearchBar->GetClippedGroupControl();
75 pControl->DetachAllChildren();
91 if (__pPublicActionEvent)
93 delete __pPublicActionEvent;
94 __pPublicActionEvent = null;
97 if (__pPublicKeypadEvent)
99 delete __pPublicKeypadEvent;
100 __pPublicKeypadEvent = null;
103 if (__pPublicTextBlockEvent)
105 delete __pPublicTextBlockEvent;
106 __pPublicTextBlockEvent = null;
109 if (__pPublicTextEvent)
111 delete __pPublicTextEvent;
112 __pPublicTextEvent = null;
115 if (__pPublicSearchBarEvent)
117 delete __pPublicSearchBarEvent;
118 __pPublicSearchBarEvent = null;
121 if (__pPublicLanguageEvent)
123 delete __pPublicLanguageEvent;
124 __pPublicLanguageEvent = null;
127 if (__pPublicFocusEventListeners)
129 delete __pPublicFocusEventListeners;
130 __pPublicFocusEventListeners = null;
135 _SearchBarImpl::CreateSearchBarImplN(SearchBar* pControl, const Rectangle& bounds, bool enableSearchBarButton, KeypadAction keypadAction)
138 result r = E_SUCCESS;
140 r = GET_SIZE_INFO(SearchBar).CheckInitialSizeValid(Dimension(bounds.width, bounds.height), _CONTROL_ORIENTATION_PORTRAIT);
141 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, null, E_INVALID_ARG,
142 "[E_INVALID_ARG] Invalid argument(s) is used. The given size is not valid.");
144 _SearchBar* pCore = _SearchBar::CreateSearchBarN();
146 SysTryReturn(NID_UI_CTRL, pCore != null, null, r, "[%s] Propagating.", GetErrorMessage(r));
148 _SearchBarImpl* pImpl = new (std::nothrow) _SearchBarImpl(pControl, pCore);
150 r = CheckConstruction(pCore, pImpl);
151 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
153 r = pImpl->InitializeBoundsProperties(GET_SIZE_INFO(SearchBar), bounds, pCore->GetOrientation());
154 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
156 r = pImpl->Initialize(enableSearchBarButton, keypadAction);
157 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
166 _SearchBarImpl::CreateSearchBarImplFN(SearchBar* pControl, const FloatRectangle& bounds, bool enableSearchBarButton, KeypadAction keypadAction)
169 result r = E_SUCCESS;
171 r = GET_SIZE_INFO(SearchBar).CheckInitialSizeValidF(FloatDimension(bounds.width, bounds.height), _CONTROL_ORIENTATION_PORTRAIT);
172 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, null, E_INVALID_ARG,
173 "[E_INVALID_ARG] Invalid argument(s) is used. The given size is not valid.");
175 _SearchBar* pCore = _SearchBar::CreateSearchBarN();
177 SysTryReturn(NID_UI_CTRL, pCore != null, null, r, "[%s] Propagating.", GetErrorMessage(r));
179 _SearchBarImpl* pImpl = new (std::nothrow) _SearchBarImpl(pControl, pCore);
181 r = CheckConstruction(pCore, pImpl);
182 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
184 r = pImpl->InitializeBoundsPropertiesF(GET_SIZE_INFO(SearchBar), bounds, pCore->GetOrientation());
185 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
187 r = pImpl->Initialize(enableSearchBarButton, keypadAction);
188 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
197 _SearchBarImpl::GetPublicClassName(void) const
199 return "Tizen::Ui::Controls::SearchBar";
203 _SearchBarImpl::GetPublic(void) const
205 return static_cast <const SearchBar&>(_ControlImpl::GetPublic());
209 _SearchBarImpl::GetPublic(void)
211 return static_cast <SearchBar&>(_ControlImpl::GetPublic());
215 _SearchBarImpl::GetCore(void) const
217 return static_cast <const _SearchBar&>(_ControlImpl::GetCore());
221 _SearchBarImpl::GetCore(void)
223 return static_cast <_SearchBar&>(_ControlImpl::GetCore());
227 _SearchBarImpl::GetInstance(SearchBar& searchBar)
229 return (static_cast<_SearchBarImpl*>(searchBar._pControlImpl));
232 const _SearchBarImpl*
233 _SearchBarImpl::GetInstance(const SearchBar& searchBar)
235 return (static_cast<const _SearchBarImpl*>(searchBar._pControlImpl));
240 _SearchBarImpl::Initialize(bool enableSearchBarButton, KeypadAction keypadAction)
244 result r = E_SUCCESS;
246 CoreKeypadAction coreKeypadAction = CORE_KEYPAD_ACTION_SEARCH;
247 switch (keypadAction)
249 case KEYPAD_ACTION_ENTER:
250 coreKeypadAction = CORE_KEYPAD_ACTION_ENTER;
253 case KEYPAD_ACTION_GO:
254 coreKeypadAction = CORE_KEYPAD_ACTION_GO;
257 case KEYPAD_ACTION_NEXT:
258 coreKeypadAction = CORE_KEYPAD_ACTION_NEXT;
261 case KEYPAD_ACTION_SEND:
262 coreKeypadAction = CORE_KEYPAD_ACTION_SEND;
265 case KEYPAD_ACTION_SEARCH:
266 coreKeypadAction = CORE_KEYPAD_ACTION_SEARCH;
269 case KEYPAD_ACTION_LOGIN:
270 coreKeypadAction = CORE_KEYPAD_ACTION_LOGIN;
273 case KEYPAD_ACTION_SIGN_IN:
274 coreKeypadAction = CORE_KEYPAD_ACTION_SIGN_IN;
277 case KEYPAD_ACTION_JOIN:
278 coreKeypadAction = CORE_KEYPAD_ACTION_JOIN;
281 case KEYPAD_ACTION_DONE:
282 coreKeypadAction = CORE_KEYPAD_ACTION_DONE;
289 __pEditField = new (std::nothrow) EditField();
290 SysTryReturnResult(NID_UI_CTRL, __pEditField, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Failed to allocate memory.");
292 r = __pEditField->Construct(GetBoundsF(), EDIT_FIELD_STYLE_NORMAL, INPUT_STYLE_OVERLAY, EDIT_FIELD_TITLE_STYLE_NONE, true);
293 SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
295 __pEditField->AddFocusEventListener(*this);
296 SysTryReturnResult(NID_UI_CTRL, GetLastResult() == E_SUCCESS, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
298 __pEditField->AddKeyEventListener(*this);
299 SysTryReturnResult(NID_UI_CTRL, GetLastResult() == E_SUCCESS, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
301 __pEditFieldImpl = _EditFieldImpl::GetInstance(*__pEditField);
302 SysTryReturnResult(NID_UI_CTRL, __pEditFieldImpl != null, E_SYSTEM,
303 "[E_SYSTEM] A system error has occured. Failed to EditFieldImpl instance");
305 String cancelButtonText;
306 GET_STRING_CONFIG(IDS_TPLATFORM_BUTTON_CANCEL_ABB, cancelButtonText);
308 __pButton = new (std::nothrow) Button();
309 SysTryReturnResult(NID_UI_CTRL, __pButton, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Failed to allocate memory.");
311 r = __pButton->Construct(GetBoundsF(), cancelButtonText);
312 SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
314 __pButton->AddFocusEventListener(*this);
315 SysTryReturnResult(NID_UI_CTRL, GetLastResult() == E_SUCCESS, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
317 __pButtonImpl = _ButtonImpl::GetInstance(*__pButton);
318 SysTryReturnResult(NID_UI_CTRL, __pButtonImpl != null, E_SYSTEM,
319 "[E_SYSTEM] A system error has occured. Failed to ButtonImpl instance");
321 r = __pSearchBar->Initialize(enableSearchBarButton, coreKeypadAction);
322 SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "Propagating.");
324 __pPublicActionEvent = _PublicActionEvent::CreateInstanceN(GetPublic());
326 SysTryReturn(NID_UI_CTRL, __pPublicActionEvent, r, r, "[%s] Propagating.", GetErrorMessage(r));
328 r = __pSearchBar->AddActionEventListener(*this);
329 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
331 __pPublicKeypadEvent = _PublicKeypadEvent::CreateInstanceN(GetPublic());
333 SysTryReturn(NID_UI_CTRL, __pPublicKeypadEvent, r, r, "[%s] Propagating.", GetErrorMessage(r));
335 r = __pSearchBar->AddKeypadEventListener(*this);
336 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
338 __pPublicTextBlockEvent = _PublicTextBlockEvent::CreateInstanceN(GetPublic());
340 SysTryReturn(NID_UI_CTRL, __pPublicTextBlockEvent, r, r, "[%s] Propagating.", GetErrorMessage(r));
342 r = __pSearchBar->AddTextBlockEventListener(*this);
343 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
345 __pPublicTextEvent = _PublicTextEvent::CreateInstanceN(GetPublic());
347 SysTryReturn(NID_UI_CTRL, __pPublicTextEvent, r, r, "[%s] Propagating.", GetErrorMessage(r));
349 r = __pSearchBar->AddTextEventListener(*this);
350 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
352 __pPublicSearchBarEvent = _PublicSearchBarEvent::CreateInstanceN(GetPublic());
354 SysTryReturn(NID_UI_CTRL, __pPublicSearchBarEvent, r, r, "[%s] Propagating.", GetErrorMessage(r));
356 r = __pSearchBar->AddSearchBarEventListener(*this);
357 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
359 __pPublicLanguageEvent = _PublicLanguageEvent::CreateInstanceN(GetPublic());
361 SysTryReturn(NID_UI_CTRL, __pPublicLanguageEvent, r, r, "[%s] Propagating.", GetErrorMessage(r));
363 r = __pSearchBar->AddLanguageEventListener(*this);
364 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
366 __pPublicFocusEventListeners = CreatePublicEventListenerListN();
368 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
374 _SearchBarImpl::GetContent(void) const
378 return __pContentControl;
382 _SearchBarImpl::SetContent(const Control* pContent)
386 result r = E_SUCCESS;
387 if (pContent != null)
389 const _Control& content = _ControlImpl::GetInstance(*pContent)->GetCore();
390 bool isContentAttachable = __pSearchBar->IsContentAttachable(&content);
391 SysTryReturn(NID_UI_CTRL, isContentAttachable, E_INVALID_ARG, E_INVALID_ARG,
392 "[E_INVALID_ARG] Invalid argument(s) is used. The content cannot be set.");
395 if (pContent != null && __pContentControl == null)
397 __pContentControl = const_cast <Control*>(pContent);
398 _Control& control = _ControlImpl::GetInstance(*__pContentControl)->GetCore();
400 r = __pSearchBar->SetContent(&control);
407 _SearchBarImpl::UpdateContentArea(bool invalidate)
411 return __pSearchBar->UpdateContentArea(invalidate);
415 _SearchBarImpl::SetContentAreaVisible(bool visible)
419 return __pSearchBar->SetContentAreaVisible(visible, true);
423 _SearchBarImpl::IsContentAreaVisible(void) const
427 return __pSearchBar->IsContentAreaVisible();
431 _SearchBarImpl::SetContentAreaSize(const Dimension& size)
435 FloatDimension contentSize;
436 contentSize = _CoordinateSystemUtils::ConvertToFloat(size);
437 Variant var(contentSize);
439 return __pSearchBar->SetPropertyContentAreaSize(var);
443 _SearchBarImpl::SetContentAreaSize(const FloatDimension& size)
448 return __pSearchBar->SetPropertyContentAreaSize(var);
452 _SearchBarImpl::GetContentAreaSize(void) const
457 size = _CoordinateSystemUtils::ConvertToInteger(__pSearchBar->GetPropertyContentAreaSize().ToFloatDimension());
463 _SearchBarImpl::GetContentAreaSizeF(void) const
467 return __pSearchBar->GetPropertyContentAreaSize().ToFloatDimension();
471 _SearchBarImpl::GetMode(void) const
475 return __pSearchBar->GetMode();
479 _SearchBarImpl::IsModeLocked(void) const
483 return __pSearchBar->IsModeLocked();
487 _SearchBarImpl::SetMode(SearchBarMode mode)
491 return __pSearchBar->SetMode(mode);
495 _SearchBarImpl::SetModeLocked(bool modeLocked)
499 return __pSearchBar->SetModeLocked(modeLocked);
503 _SearchBarImpl::GetButtonActionId(void) const
507 return __pSearchBar->GetPropertyButtonActionId().ToInt();
511 _SearchBarImpl::GetButtonColor(SearchBarButtonStatus status) const
519 case SEARCH_BAR_BUTTON_STATUS_NORMAL:
520 buttonColor = __pSearchBar->GetPropertyButtonNormalColor();
522 case SEARCH_BAR_BUTTON_STATUS_PRESSED:
523 buttonColor = __pSearchBar->GetPropertyButtonPressedColor();
525 case SEARCH_BAR_BUTTON_STATUS_HIGHLIGHTED:
526 buttonColor = __pSearchBar->GetPropertyButtonHighlightedColor();
528 case SEARCH_BAR_BUTTON_STATUS_DISABLED:
529 buttonColor = __pSearchBar->GetPropertyButtonDisabledColor();
535 return buttonColor.ToColor();
539 _SearchBarImpl::GetButtonTextColor(SearchBarButtonStatus status) const
543 Variant buttonTextColor;
547 case SEARCH_BAR_BUTTON_STATUS_NORMAL:
548 buttonTextColor = __pSearchBar->GetPropertyButtonNormalTextColor();
550 case SEARCH_BAR_BUTTON_STATUS_PRESSED:
551 buttonTextColor = __pSearchBar->GetPropertyButtonPressedTextColor();
553 case SEARCH_BAR_BUTTON_STATUS_HIGHLIGHTED:
554 buttonTextColor = __pSearchBar->GetPropertyButtonHighlightedTextColor();
556 case SEARCH_BAR_BUTTON_STATUS_DISABLED:
557 buttonTextColor = __pSearchBar->GetPropertyButtonDisabledTextColor();
563 return buttonTextColor.ToColor();
566 SearchBarButtonStatus
567 _SearchBarImpl::GetButtonStatus(void) const
571 return __pSearchBar->GetButtonStatus();
575 _SearchBarImpl::SetButton(const String& text, int actionId)
579 result r = E_SUCCESS;
580 Variant var(actionId);
582 r = __pSearchBar->SetButtonText(text);
583 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
585 r = __pSearchBar->SetPropertyButtonActionId(var);
591 _SearchBarImpl::SetButtonEnabled(bool enabled)
595 return __pSearchBar->SetButtonEnabled(enabled);
599 _SearchBarImpl::SetButtonColor(SearchBarButtonStatus status, const Color& color)
603 result r = E_SUCCESS;
608 case SEARCH_BAR_BUTTON_STATUS_NORMAL:
609 r = __pSearchBar->SetPropertyButtonNormalColor(var);
611 case SEARCH_BAR_BUTTON_STATUS_PRESSED:
612 r = __pSearchBar->SetPropertyButtonPressedColor(var);
614 case SEARCH_BAR_BUTTON_STATUS_HIGHLIGHTED:
615 r = __pSearchBar->SetPropertyButtonHighlightedColor(var);
617 case SEARCH_BAR_BUTTON_STATUS_DISABLED:
618 r = __pSearchBar->SetPropertyButtonDisabledColor(var);
628 _SearchBarImpl::SetButtonTextColor(SearchBarButtonStatus status, const Color& color)
632 result r = E_SUCCESS;
637 case SEARCH_BAR_BUTTON_STATUS_NORMAL:
638 r = __pSearchBar->SetPropertyButtonNormalTextColor(var);
640 case SEARCH_BAR_BUTTON_STATUS_PRESSED:
641 r = __pSearchBar->SetPropertyButtonPressedTextColor(var);
643 case SEARCH_BAR_BUTTON_STATUS_HIGHLIGHTED:
644 r = __pSearchBar->SetPropertyButtonHighlightedTextColor(var);
646 case SEARCH_BAR_BUTTON_STATUS_DISABLED:
647 r = __pSearchBar->SetPropertyButtonDisabledTextColor(var);
657 _SearchBarImpl::AppendCharacter(const Character& character)
661 return __pSearchBar->AppendCharacter(character);
665 _SearchBarImpl::AppendText(const String& text)
669 return __pSearchBar->AppendText(text);
673 _SearchBarImpl::SetText(const String& text)
677 return __pSearchBar->SetText(text);
681 _SearchBarImpl::InsertCharacterAt(int index, const Character& character)
685 return __pSearchBar->InsertCharacterAt(index, character);
689 _SearchBarImpl::InsertTextAt(int index, const String& text)
693 return __pSearchBar->InsertTextAt(index, text);
697 _SearchBarImpl::DeleteCharacterAt(int index)
701 return __pSearchBar->DeleteCharacterAt(index);
705 _SearchBarImpl::Clear(void)
709 result r = E_SUCCESS;
710 r = __pSearchBar->Clear();
712 SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, E_SYSTEM,
713 "[E_SYSTEM] A system error has occured. Failed to clear the text.");
718 _SearchBarImpl::GetTextLength(void) const
722 return __pSearchBar->GetTextLength();
726 _SearchBarImpl::GetText(void) const
730 return __pSearchBar->GetText();
734 _SearchBarImpl::GetText(int start, int end) const
738 return __pSearchBar->GetText(start, end);
742 _SearchBarImpl::GetLimitLength(void) const
746 return __pSearchBar->GetLimitLength();
750 _SearchBarImpl::SetLimitLength(int limitLength)
754 return __pSearchBar->SetLimitLength(limitLength);
758 _SearchBarImpl::ShowKeypad(void) const
762 return __pSearchBar->ShowKeypad();
766 _SearchBarImpl::HideKeypad(void) const
770 return __pSearchBar->HideKeypad();
774 _SearchBarImpl::GetSearchFieldTextSize(void) const
778 int textSize = _CoordinateSystemUtils::ConvertToInteger(__pSearchBar->GetSearchFieldTextSizeF());
783 _SearchBarImpl::GetSearchFieldTextSizeF(void) const
787 return __pSearchBar->GetSearchFieldTextSizeF();
791 _SearchBarImpl::SetSearchFieldTextSize(int size)
795 float textSize = _CoordinateSystemUtils::ConvertToFloat(size);
796 return SetSearchFieldTextSize(textSize);
800 _SearchBarImpl::SetSearchFieldTextSize(float size)
804 return __pSearchBar->SetSearchFieldTextSize(size);
808 _SearchBarImpl::GetBlockRange(int& start, int& end) const
812 return __pSearchBar->GetBlockRange(start, end);
816 _SearchBarImpl::ReleaseBlock(void)
820 return __pSearchBar->ReleaseBlock();
824 _SearchBarImpl::SetBlockRange(int start, int end)
828 return __pSearchBar->SetBlockRange(start, end + 1);
832 _SearchBarImpl::RemoveTextBlock(void)
835 result r = __pSearchBar->RemoveTextBlock();
836 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, E_SYSTEM, E_SYSTEM,
837 "[E_SYSTEM] A system error has occured. Unable to remove the text block.");
843 _SearchBarImpl::GetColor(void) const
847 return __pSearchBar->GetPropertyColor().ToColor();
851 _SearchBarImpl::GetSearchFieldColor(SearchFieldStatus status) const
855 Variant searchFieldColor;
859 case SEARCH_FIELD_STATUS_NORMAL:
860 searchFieldColor = __pSearchBar->GetPropertySearchFieldNormalColor();
862 case SEARCH_FIELD_STATUS_HIGHLIGHTED:
863 searchFieldColor = __pSearchBar->GetPropertySearchFieldHighlightedColor();
865 case SEARCH_FIELD_STATUS_DISABLED:
866 searchFieldColor = __pSearchBar->GetPropertySearchFieldDisabledColor();
872 return searchFieldColor.ToColor();
876 _SearchBarImpl::GetSearchFieldTextColor(SearchFieldStatus status) const
881 _Edit* pEdit = __pSearchBar->GetSearchField();
886 case SEARCH_FIELD_STATUS_NORMAL:
887 color = pEdit->GetTextColor(EDIT_TEXT_COLOR_NORMAL);
889 case SEARCH_FIELD_STATUS_HIGHLIGHTED:
890 color = pEdit->GetTextColor(EDIT_TEXT_COLOR_HIGHLIGHTED);
892 case SEARCH_FIELD_STATUS_DISABLED:
893 color = pEdit->GetTextColor(EDIT_TEXT_COLOR_DISABLED);
903 _SearchBarImpl::SetBackgroundBitmap(const Bitmap& bitmap)
907 return __pSearchBar->SetBackgroundBitmap(bitmap);
911 _SearchBarImpl::SetColor(const Color& color)
917 return __pSearchBar->SetPropertyColor(var);
921 _SearchBarImpl::SetSearchFieldColor(SearchFieldStatus status, const Color& color)
925 result r = E_SUCCESS;
930 case SEARCH_FIELD_STATUS_NORMAL:
931 r = __pSearchBar->SetPropertySearchFieldNormalColor(var);
933 case SEARCH_FIELD_STATUS_HIGHLIGHTED:
934 r = __pSearchBar->SetPropertySearchFieldHighlightedColor(var);
936 case SEARCH_FIELD_STATUS_DISABLED:
937 r = __pSearchBar->SetPropertySearchFieldDisabledColor(var);
947 _SearchBarImpl::SetSearchFieldTextColor(SearchFieldStatus status, const Color& color)
951 result r = E_SUCCESS;
952 _Edit* pEdit = __pSearchBar->GetSearchField();
957 case SEARCH_FIELD_STATUS_NORMAL:
958 r = pEdit->SetTextColor(EDIT_TEXT_COLOR_NORMAL, color);
960 case SEARCH_FIELD_STATUS_HIGHLIGHTED:
961 r = pEdit->SetTextColor(EDIT_TEXT_COLOR_HIGHLIGHTED, color);
963 case SEARCH_FIELD_STATUS_DISABLED:
964 r = pEdit->SetTextColor(EDIT_TEXT_COLOR_DISABLED, color);
975 _SearchBarImpl::GetGuideText(void) const
979 return __pSearchBar->GetGuideText();
983 _SearchBarImpl::SetGuideText(const String& guideText)
987 return __pSearchBar->SetGuideText(guideText);
991 _SearchBarImpl::GetGuideTextColor(void) const
995 return __pSearchBar->GetGuideTextColor();
999 _SearchBarImpl::SetGuideTextColor(const Color& color)
1003 return __pSearchBar->SetGuideTextColor(color);
1007 _SearchBarImpl::GetCursorPosition(void) const
1011 return __pSearchBar->GetCursorPosition();
1015 _SearchBarImpl::SetCursorPosition(int index)
1019 return __pSearchBar->SetCursorPosition(index);
1023 _SearchBarImpl::IsLowerCaseModeEnabled(void) const
1027 return __pSearchBar->IsLowerCaseModeEnabled();
1031 _SearchBarImpl::SetLowerCaseModeEnabled(bool enable)
1035 return __pSearchBar->SetLowerCaseModeEnabled(enable);
1039 _SearchBarImpl::GetEllipsisPosition(void) const
1043 return __pSearchBar->GetEllipsisPosition();
1047 _SearchBarImpl::SetEllipsisPosition(EllipsisPosition position)
1051 return __pSearchBar->SetEllipsisPosition(position);
1055 _SearchBarImpl::GetKeypadAction(void) const
1059 CoreKeypadAction coreKeypadAction = __pSearchBar->GetKeypadAction();
1060 KeypadAction publicKeypadAction = ConvertKeypadAction(coreKeypadAction);
1062 return publicKeypadAction;
1066 _SearchBarImpl::IsTextPredictionEnabled(void) const
1068 return __pSearchBar->IsTextPredictionEnabled();
1072 _SearchBarImpl::SetTextPredictionEnabled(bool enable)
1074 return __pSearchBar->SetTextPredictionEnabled(enable);
1078 _SearchBarImpl::SetCurrentLanguage(LanguageCode languageCode)
1080 return __pSearchBar->SetCurrentLanguage(languageCode);
1084 _SearchBarImpl::GetCurrentLanguage(LanguageCode& language) const
1086 return __pSearchBar->GetCurrentLanguage(language);
1090 _SearchBarImpl::AddActionEventListener(IActionEventListener& listener)
1094 SysTryReturn(NID_UI_CTRL, __pPublicActionEvent, E_SYSTEM, E_SYSTEM,
1095 "[E_SYSTEM] A system error has occurred.");
1097 result r = __pPublicActionEvent->AddListener(listener);
1098 SysTryReturnResult(NID_UI_CTRL, r != E_OBJ_ALREADY_EXIST, E_SYSTEM,
1099 "A system error has occurred. The same listener instance already exists in the event listener list.");
1104 _SearchBarImpl::RemoveActionEventListener(IActionEventListener& listener)
1108 SysTryReturn(NID_UI_CTRL, __pPublicActionEvent, E_SYSTEM, E_SYSTEM,
1109 "[E_SYSTEM] A system error has occurred.");
1111 result r = __pPublicActionEvent->RemoveListener(listener);
1112 SysTryReturnResult(NID_UI_CTRL, r != E_OBJ_NOT_FOUND, E_SYSTEM,
1113 "A system error has occurred. The specified listener does not exist in the event listener list.");
1118 _SearchBarImpl::AddKeypadEventListener(IKeypadEventListener& listener)
1122 SysTryReturn(NID_UI_CTRL, __pPublicKeypadEvent, E_SYSTEM, E_SYSTEM,
1123 "[E_SYSTEM] A system error has occurred.");
1125 result r = __pPublicKeypadEvent->AddListener(listener);
1126 SysTryReturnResult(NID_UI_CTRL, r != E_OBJ_ALREADY_EXIST, E_SYSTEM,
1127 "A system error has occurred. The same listener instance already exists in the event listener list.");
1133 _SearchBarImpl::RemoveKeypadEventListener(IKeypadEventListener& listener)
1137 SysTryReturn(NID_UI_CTRL, __pPublicKeypadEvent, E_SYSTEM, E_SYSTEM,
1138 "[E_SYSTEM] A system error has occurred.");
1140 result r = __pPublicKeypadEvent->RemoveListener(listener);
1141 SysTryReturnResult(NID_UI_CTRL, r != E_OBJ_NOT_FOUND, E_SYSTEM,
1142 "A system error has occurred. The specified listener does not exist in the event listener list.");
1148 _SearchBarImpl::AddTextBlockEventListener(ITextBlockEventListener& listener)
1152 SysTryReturn(NID_UI_CTRL, __pPublicTextBlockEvent, E_SYSTEM, E_SYSTEM,
1153 "[E_SYSTEM] A system error has occurred.");
1155 result r = __pPublicTextBlockEvent->AddListener(listener);
1156 SysTryReturnResult(NID_UI_CTRL, r != E_OBJ_ALREADY_EXIST, E_SYSTEM,
1157 "A system error has occurred. The same listener instance already exists in the event listener list.");
1163 _SearchBarImpl::RemoveTextBlockEventListener(ITextBlockEventListener& listener)
1167 SysTryReturn(NID_UI_CTRL, __pPublicTextBlockEvent, E_SYSTEM, E_SYSTEM,
1168 "[E_SYSTEM] A system error has occurred.");
1170 result r = __pPublicTextBlockEvent->RemoveListener(listener);
1171 SysTryReturnResult(NID_UI_CTRL, r != E_OBJ_NOT_FOUND, E_SYSTEM,
1172 "A system error has occurred. The specified listener does not exist in the event listener list.");
1179 _SearchBarImpl::AddTextEventListener(ITextEventListener& listener)
1183 SysTryReturn(NID_UI_CTRL, __pPublicTextEvent, E_SYSTEM, E_SYSTEM,
1184 "[E_SYSTEM] A system error has occurred.");
1186 result r = __pPublicTextEvent->AddListener(listener);
1187 SysTryReturnResult(NID_UI_CTRL, r != E_OBJ_ALREADY_EXIST, E_SYSTEM,
1188 "A system error has occurred. The same listener instance already exists in the event listener list.");
1194 _SearchBarImpl::RemoveTextEventListener(ITextEventListener& listener)
1198 SysTryReturn(NID_UI_CTRL, __pPublicTextEvent, E_SYSTEM, E_SYSTEM,
1199 "[E_SYSTEM] A system error has occurred.");
1201 result r = __pPublicTextEvent->RemoveListener(listener);
1202 SysTryReturnResult(NID_UI_CTRL, r != E_OBJ_NOT_FOUND, E_SYSTEM,
1203 "A system error has occurred. The specified listener does not exist in the event listener list.");
1209 _SearchBarImpl::AddSearchBarEventListener(const ISearchBarEventListener& listener)
1213 SysTryReturn(NID_UI_CTRL, __pPublicSearchBarEvent, E_SYSTEM, E_SYSTEM,
1214 "[E_SYSTEM] A system error has occurred.");
1216 result r = __pPublicSearchBarEvent->AddListener(listener);
1217 SysTryReturnResult(NID_UI_CTRL, r != E_OBJ_ALREADY_EXIST, E_SYSTEM,
1218 "A system error has occurred. The same listener instance already exists in the event listener list.");
1224 _SearchBarImpl::RemoveSearchBarEventListener(const ISearchBarEventListener& listener)
1228 SysTryReturn(NID_UI_CTRL, __pPublicSearchBarEvent, E_SYSTEM, E_SYSTEM,
1229 "[E_SYSTEM] A system error has occurred.");
1231 result r = __pPublicSearchBarEvent->RemoveListener(listener);
1232 SysTryReturnResult(NID_UI_CTRL, r != E_OBJ_NOT_FOUND, E_SYSTEM,
1233 "A system error has occurred. The specified listener does not exist in the event listener list.");
1239 _SearchBarImpl::AddLanguageEventListener(ILanguageEventListener& listener)
1243 SysAssertf(__pPublicLanguageEvent != null, "Not yet constructed. Construct() should be called before use.");
1245 return __pPublicLanguageEvent->AddListener(listener);
1249 _SearchBarImpl::RemoveLanguageEventListener(ILanguageEventListener& listener)
1253 SysAssertf(__pPublicLanguageEvent != null, "Not yet constructed. Construct() should be called before use.");
1255 return __pPublicLanguageEvent->RemoveListener(listener);
1259 _SearchBarImpl::SetEditTextFilter(IEditTextFilter* pFilter)
1261 __pSearchBar->SetEditTextFilter(pFilter);
1267 _SearchBarImpl::SendOpaqueCommand (const String& command)
1269 __pSearchBar->SendOpaqueCommand(command);
1275 _SearchBarImpl::OnActionPerformed(const _Control& source, int actionId)
1279 if (__pPublicActionEvent != null)
1281 IEventArg* pEventArg = _PublicActionEvent::CreateActionEventArgN(actionId);
1282 result r = GetLastResult();
1283 SysTryReturnVoidResult(NID_UI_CTRL, pEventArg, r, "[%s] Propagating.", GetErrorMessage(r));
1285 __pPublicActionEvent->Fire(*pEventArg);
1291 _SearchBarImpl::OnKeypadWillOpen(void)
1295 if (__pPublicKeypadEvent != null)
1297 IEventArg* pEventArg = _PublicKeypadEvent::CreateKeypadEventArgN(
1298 GetPublic(), KEYPAD_ACTION_SEARCH, KEYPAD_EVENT_STATUS_CREATED);
1299 result r = GetLastResult();
1300 SysTryReturnVoidResult(NID_UI_CTRL, pEventArg, r, "[%s] Propagating.", GetErrorMessage(r));
1302 __pPublicKeypadEvent->Fire(*pEventArg);
1308 _SearchBarImpl::OnKeypadOpened(void)
1312 if (__pPublicKeypadEvent != null)
1314 IEventArg* pEventArg = _PublicKeypadEvent::CreateKeypadEventArgN(
1315 GetPublic(), KEYPAD_ACTION_SEARCH, KEYPAD_EVENT_STATUS_OPEN);
1316 result r = GetLastResult();
1317 SysTryReturnVoidResult(NID_UI_CTRL, pEventArg, r, "[%s] Propagating.", GetErrorMessage(r));
1319 __pPublicKeypadEvent->Fire(*pEventArg);
1326 _SearchBarImpl::OnKeypadClosed(void)
1330 if (__pPublicKeypadEvent != null)
1332 IEventArg* pEventArg = _PublicKeypadEvent::CreateKeypadEventArgN(
1333 GetPublic(), KEYPAD_ACTION_SEARCH, KEYPAD_EVENT_STATUS_CLOSE);
1334 result r = GetLastResult();
1335 SysTryReturnVoidResult(NID_UI_CTRL, pEventArg, r, "[%s] Propagating.", GetErrorMessage(r));
1337 __pPublicKeypadEvent->Fire(*pEventArg);
1343 _SearchBarImpl::OnKeypadBoundsChanged(void)
1347 if (__pPublicKeypadEvent != null)
1349 IEventArg* pEventArg = _PublicKeypadEvent::CreateKeypadEventArgN(
1350 GetPublic(), KEYPAD_ACTION_SEARCH, KEYPAD_EVENT_STATUS_BOUNDS_CHANGED);
1351 result r = GetLastResult();
1352 SysTryReturnVoidResult(NID_UI_CTRL, pEventArg, r, "[%s] Propagating.", GetErrorMessage(r));
1354 __pPublicKeypadEvent->Fire(*pEventArg);
1360 _SearchBarImpl::OnKeypadActionPerformed(CoreKeypadAction keypadAction)
1364 if (__pPublicKeypadEvent != null)
1366 KeypadAction publicKeypadAction = ConvertKeypadAction(keypadAction);
1368 IEventArg* pEventArg = _PublicKeypadEvent::CreateKeypadEventArgN(
1369 GetPublic(), publicKeypadAction, KEYPAD_EVENT_STATUS_ENTERACTION);
1370 result r = GetLastResult();
1371 SysTryReturnVoidResult(NID_UI_CTRL, pEventArg, r, "[%s] Propagating.", GetErrorMessage(r));
1373 __pPublicKeypadEvent->Fire(*pEventArg);
1379 _SearchBarImpl::OnTextBlockSelected(_Control& source, int start, int end)
1383 if (__pPublicTextBlockEvent != null)
1385 IEventArg* pEventArg = _PublicTextBlockEvent::CreateTextBlockEventArgN(start, end);
1386 result r = GetLastResult();
1387 SysTryReturnVoidResult(NID_UI_CTRL, pEventArg, r, "[%s] Propagating.", GetErrorMessage(r));
1389 __pPublicTextBlockEvent->Fire(*pEventArg);
1395 _SearchBarImpl::OnTextValueChanged(const _Control& source)
1399 if (__pPublicTextEvent != null)
1401 IEventArg* pEventArg = _PublicTextEvent::CreateTextEventArgN(TEXT_EVENT_CHANGED);
1402 result r = GetLastResult();
1403 SysTryReturnVoidResult(NID_UI_CTRL, pEventArg, r, "[%s] Propagating.", GetErrorMessage(r));
1405 __pPublicTextEvent->Fire(*pEventArg);
1411 _SearchBarImpl::OnTextValueChangeCanceled(const _Control& source)
1415 if (__pPublicTextEvent != null)
1417 IEventArg* pEventArg = _PublicTextEvent::CreateTextEventArgN(TEXT_EVENT_CANCELED);
1418 result r = GetLastResult();
1419 SysTryReturnVoidResult(NID_UI_CTRL, pEventArg, r, "[%s] Propagating.", GetErrorMessage(r));
1421 __pPublicTextEvent->Fire(*pEventArg);
1427 _SearchBarImpl::OnSearchBarModeChanged(_SearchBar& source, SearchBarMode mode)
1431 if ((_AppInfo::GetApiVersion() == _API_VERSION_2_0 && _AppInfo::IsOspCompat()) && __pSearchBar != null)
1433 if (mode == SEARCH_BAR_MODE_NORMAL)
1435 __pSearchBar->SetHeaderVisibleState(true);
1439 __pSearchBar->SetHeaderVisibleState(false);
1441 __pSearchBar->SetContentsArea();
1444 if (__pPublicSearchBarEvent != null)
1446 IEventArg* pEventArg = _PublicSearchBarEvent::CreateSearchBarEventArgN(SEARCH_BAR_EVENT_MODE_CHANGE);
1447 result r = GetLastResult();
1448 SysTryReturnVoidResult(NID_UI_CTRL, pEventArg, r, "[%s] Propagating.", GetErrorMessage(r));
1450 __pPublicSearchBarEvent->Fire(*pEventArg);
1456 _SearchBarImpl::OnLanguageChanged(LanguageCode oldLanguage, LanguageCode newLanguage)
1458 if (__pPublicLanguageEvent)
1460 IEventArg* pKLanguageEventArg = _PublicLanguageEvent::CreateLanguageEventArgN(GetPublic(), oldLanguage, newLanguage);
1461 result r = GetLastResult();
1462 SysTryReturnVoidResult(NID_UI_CTRL, pKLanguageEventArg, r, "[%s] Propagating.", GetErrorMessage(r));
1464 __pPublicLanguageEvent->Fire(*pKLanguageEventArg);
1468 SysLog(NID_UI_CTRL, "Event is not created.");
1474 _SearchBarImpl::OnFocusEventListenerAdded(IFocusEventListener& listener)
1477 SysTryReturnVoidResult(NID_UI,
1478 __pPublicFocusEventListeners->Add(const_cast <IFocusEventListener*>(&listener)) == E_SUCCESS, E_SYSTEM,
1479 "[E_SYSTEM] A system error has occured. Failed to add listener.");
1483 _SearchBarImpl::OnFocusEventListenerRemoved(IFocusEventListener& listener)
1486 SysTryReturnVoidResult(NID_UI,
1487 __pPublicFocusEventListeners->Remove(&listener) == E_SUCCESS, E_SYSTEM,
1488 "[E_SYSTEM] A system error has occured. Failed to remove listener.");
1492 _SearchBarImpl::OnFocusGained(const Tizen::Ui::Control& source)
1494 if (!__pSearchBar->IsFocusCallbackToBeFired())
1499 IEnumeratorT<IEventListener*>* pEnumerator = __pPublicFocusEventListeners->GetEnumeratorN();
1503 while (pEnumerator->MoveNext() == E_SUCCESS)
1505 IEventListener* pListener = null;
1506 pEnumerator->GetCurrent(pListener);
1508 IFocusEventListener* pFocusEventListener = dynamic_cast <IFocusEventListener*>(pListener);
1510 if (pFocusEventListener != null )
1512 pFocusEventListener->OnFocusGained(GetPublic());
1523 _SearchBarImpl::OnFocusLost(const Tizen::Ui::Control& source)
1525 if (!__pSearchBar->IsFocusCallbackToBeFired())
1530 IEnumeratorT<IEventListener*>* pEnumerator = __pPublicFocusEventListeners->GetEnumeratorN();
1533 while (pEnumerator->MoveNext() == E_SUCCESS)
1535 IEventListener* pListener = null;
1536 pEnumerator->GetCurrent(pListener);
1538 IFocusEventListener* pFocusEventListener = dynamic_cast <IFocusEventListener*>(pListener);
1540 if (pFocusEventListener != null )
1542 pFocusEventListener->OnFocusLost(GetPublic());
1553 _SearchBarImpl::OnKeyPressed(const Tizen::Ui::Control& source, Tizen::Ui::KeyCode keyCode)
1555 IEnumeratorT<IEventListener*>* pEnumerator = GetKeyEventListener()->GetEnumeratorN();
1558 while (pEnumerator->MoveNext() == E_SUCCESS)
1560 IEventListener* pListener = null;
1561 pEnumerator->GetCurrent(pListener);
1563 IKeyEventListener* pKeyEventListener = dynamic_cast <IKeyEventListener*>(pListener);
1565 if (pKeyEventListener != null )
1567 pKeyEventListener->OnKeyPressed(GetPublic(), keyCode);
1578 _SearchBarImpl::OnKeyReleased(const Tizen::Ui::Control& source, Tizen::Ui::KeyCode keyCode)
1580 IEnumeratorT<IEventListener*>* pEnumerator = GetKeyEventListener()->GetEnumeratorN();
1583 while (pEnumerator->MoveNext() == E_SUCCESS)
1585 IEventListener* pListener = null;
1586 pEnumerator->GetCurrent(pListener);
1588 IKeyEventListener* pKeyEventListener = dynamic_cast <IKeyEventListener*>(pListener);
1590 if (pKeyEventListener != null )
1592 pKeyEventListener->OnKeyReleased(GetPublic(), keyCode);
1603 _SearchBarImpl::OnKeyLongPressed(const Tizen::Ui::Control& source, Tizen::Ui::KeyCode keyCode)
1605 IEnumeratorT<IEventListener*>* pEnumerator = GetKeyEventListener()->GetEnumeratorN();
1608 while (pEnumerator->MoveNext() == E_SUCCESS)
1610 IEventListener* pListener = null;
1611 pEnumerator->GetCurrent(pListener);
1613 IKeyEventListener* pKeyEventListener = dynamic_cast <IKeyEventListener*>(pListener);
1615 if (pKeyEventListener != null )
1617 pKeyEventListener->OnKeyLongPressed(GetPublic(), keyCode);
1628 _SearchBarImpl::ConvertKeypadAction(CoreKeypadAction keypadAction) const
1630 KeypadAction publicKeypadAction = KEYPAD_ACTION_SEARCH;
1631 switch (keypadAction)
1633 case CORE_KEYPAD_ACTION_ENTER:
1634 publicKeypadAction = KEYPAD_ACTION_ENTER;
1637 case CORE_KEYPAD_ACTION_GO:
1638 publicKeypadAction = KEYPAD_ACTION_GO;
1641 case CORE_KEYPAD_ACTION_NEXT:
1642 publicKeypadAction = KEYPAD_ACTION_NEXT;
1645 case CORE_KEYPAD_ACTION_SEND:
1646 publicKeypadAction = KEYPAD_ACTION_SEND;
1649 case CORE_KEYPAD_ACTION_SEARCH:
1650 publicKeypadAction = KEYPAD_ACTION_SEARCH;
1653 case CORE_KEYPAD_ACTION_LOGIN:
1654 publicKeypadAction = KEYPAD_ACTION_LOGIN;
1657 case CORE_KEYPAD_ACTION_SIGN_IN:
1658 publicKeypadAction = KEYPAD_ACTION_SIGN_IN;
1661 case CORE_KEYPAD_ACTION_JOIN:
1662 publicKeypadAction = KEYPAD_ACTION_JOIN;
1665 case CORE_KEYPAD_ACTION_DONE:
1666 publicKeypadAction = KEYPAD_ACTION_DONE;
1673 return publicKeypadAction;
1677 _SearchBarImpl::GetEditFieldImpl(void) const
1679 return __pEditFieldImpl;
1683 _SearchBarImpl::GetButtonImpl(void) const
1685 return __pButtonImpl;
1688 class _SearchBarMaker
1689 : public _UiBuilderControlMaker
1692 _SearchBarMaker(_UiBuilder* pUibuilder)
1693 : _UiBuilderControlMaker(pUibuilder){}
1694 virtual ~_SearchBarMaker(void){}
1695 static _UiBuilderControlMaker*
1696 GetInstance(_UiBuilder* pUibuilder)
1698 _SearchBarMaker* pSearchBarMaker = new (std::nothrow) _SearchBarMaker(pUibuilder);
1699 return pSearchBarMaker;
1704 Make(_UiBuilderControl* pControl)
1706 result r = E_SUCCESS;
1708 FloatRectangle rect;
1709 SearchBar* pSearchBar = null;
1710 _UiBuilderControlLayout* pControlProperty = null;
1711 bool showSearchBarButton = true;
1712 KeypadAction keypadAction = KEYPAD_ACTION_ENTER;
1714 int opacity = SEARCHBAR_DEFAULT_OPACITY;
1715 EllipsisPosition ellipsisPosition = ELLIPSIS_POSITION_END;
1718 int limitLength = SEARCHBAR_TEXT_LENGTH_MAX;
1719 int buttonActionId = -1;
1721 float searchFieldTextSize = 0.0f;
1722 bool lowercaseEnable = false;
1723 String elementString;
1725 GetProperty(pControl, &pControlProperty);
1726 if (pControlProperty == null)
1731 pSearchBar = new (std::nothrow) SearchBar;
1732 if (pSearchBar == null)
1737 rect = pControlProperty->GetRectF();
1738 if (pControl->GetElement("showSearchBarButton", elementString))
1740 if (elementString.Equals(L"false", false))
1742 showSearchBarButton = false;
1746 if (pControl->GetElement("keypadAction", elementString))
1748 if (elementString.Equals(L"KEYPAD_ACTION_ENTER", false))
1750 keypadAction = KEYPAD_ACTION_ENTER;
1752 else if (elementString.Equals(L"KEYPAD_ACTION_GO", false))
1754 keypadAction = KEYPAD_ACTION_GO;
1756 else if (elementString.Equals(L"KEYPAD_ACTION_NEXT", false))
1758 keypadAction = KEYPAD_ACTION_NEXT;
1760 else if (elementString.Equals(L"KEYPAD_ACTION_SEND", false))
1762 keypadAction = KEYPAD_ACTION_SEND;
1764 else if (elementString.Equals(L"KEYPAD_ACTION_SEARCH", false))
1766 keypadAction = KEYPAD_ACTION_SEARCH;
1768 else if (elementString.Equals(L"KEYPAD_ACTION_LOGIN", false))
1770 keypadAction = KEYPAD_ACTION_LOGIN;
1772 else if (elementString.Equals(L"KEYPAD_ACTION_SIGN_IN", false))
1774 keypadAction = KEYPAD_ACTION_SIGN_IN;
1776 else if (elementString.Equals(L"KEYPAD_ACTION_JOIN", false))
1778 keypadAction = KEYPAD_ACTION_JOIN;
1780 else if (elementString.Equals(L"KEYPAD_ACTION_DONE", false))
1782 keypadAction = KEYPAD_ACTION_DONE;
1786 r = pSearchBar->Construct(rect, showSearchBarButton, keypadAction);
1793 if (showSearchBarButton)
1795 if (pControl->GetElement("buttonActionId", elementString))
1797 Base::Integer::Parse(elementString, buttonActionId);
1800 if (pControl->GetElement("buttonText", elementString))
1802 r = pSearchBar->SetButton(elementString, buttonActionId);
1806 if (pControl->GetElement("text", elementString))
1808 r = pSearchBar->SetText(elementString);
1811 if (pControl->GetElement("guideText", elementString))
1813 r = pSearchBar->SetGuideText(elementString);
1816 if (pControl->GetElement("searchFieldTextSize", elementString))
1818 searchFieldTextSize = _LocalizedNumParser::ToDouble(elementString, "C");
1819 _ICoordinateSystemTransformer* pTransform = GetTransformer();
1822 searchFieldTextSize = pTransform->Transform(searchFieldTextSize);
1824 r = pSearchBar->SetSearchFieldTextSize(searchFieldTextSize);
1827 if (pControl->GetElement("limitLength", elementString))
1829 Base::Integer::Parse(elementString, limitLength);
1830 r = pSearchBar->SetLimitLength(limitLength);
1833 if (pControl->GetElement("lowerCaseMode", elementString))
1835 if (elementString.Equals(L"true", false))
1837 lowercaseEnable = true;
1841 lowercaseEnable = false;
1844 pSearchBar->SetLowerCaseModeEnabled(lowercaseEnable);
1847 if (pControl->GetElement("ellipsisPosition", elementString))
1849 if (elementString.Equals(L"ELLIPSIS_POSITION_START", false))
1851 ellipsisPosition = ELLIPSIS_POSITION_START;
1853 else if (elementString.Equals(L"ELLIPSIS_POSITION_MIDDLE", false))
1855 ellipsisPosition = ELLIPSIS_POSITION_MIDDLE;
1859 ellipsisPosition = ELLIPSIS_POSITION_END;
1862 r = pSearchBar->SetEllipsisPosition(ellipsisPosition);
1865 if (pControl->GetElement("backgroundBitmapPath", elementString))
1867 Bitmap* pBackgroundBitmap = null;
1868 pBackgroundBitmap = LoadBitmapN(elementString);
1869 if (pBackgroundBitmap != null)
1871 pSearchBar->SetBackgroundBitmap(*pBackgroundBitmap);
1872 delete pBackgroundBitmap;
1876 if (pControl->GetElement("colorOpacity", elementString))
1878 Base::Integer::Parse(elementString, opacity);
1880 if (pControl->GetElement("color", elementString))
1882 ConvertStringToColor32(elementString, opacity, color);
1883 r = pSearchBar->SetColor(color);
1886 opacity = SEARCHBAR_DEFAULT_OPACITY;
1887 if (pControl->GetElement("normalButtonColor", elementString))
1889 ConvertStringToColor32(elementString, opacity, color);
1890 r = pSearchBar->SetButtonColor(SEARCH_BAR_BUTTON_STATUS_NORMAL, color);
1893 if (pControl->GetElement("normalButtonTextColor", elementString))
1895 ConvertStringToColor32(elementString, opacity, color);
1896 r = pSearchBar->SetButtonTextColor(SEARCH_BAR_BUTTON_STATUS_NORMAL, color);
1899 if (pControl->GetElement("normalSearchFieldColor", elementString))
1901 ConvertStringToColor32(elementString, opacity, color);
1902 r = pSearchBar->SetSearchFieldColor(SEARCH_FIELD_STATUS_NORMAL, color);
1905 if (pControl->GetElement("normalSearchFieldTextColor", elementString))
1907 ConvertStringToColor32(elementString, opacity, color);
1908 r = pSearchBar->SetSearchFieldTextColor(SEARCH_FIELD_STATUS_NORMAL, color);
1911 if (pControl->GetElement("disabledButtonColor", elementString))
1913 ConvertStringToColor32(elementString, opacity, color);
1914 r = pSearchBar->SetButtonColor(SEARCH_BAR_BUTTON_STATUS_DISABLED, color);
1917 if (pControl->GetElement("disabledButtonTextColor", elementString))
1919 ConvertStringToColor32(elementString, opacity, color);
1920 r = pSearchBar->SetButtonTextColor(SEARCH_BAR_BUTTON_STATUS_DISABLED, color);
1923 if (pControl->GetElement("disabledSearchFieldColor", elementString))
1925 ConvertStringToColor32(elementString, opacity, color);
1926 r = pSearchBar->SetSearchFieldColor(SEARCH_FIELD_STATUS_DISABLED, color);
1929 if (pControl->GetElement("disabledSearchFieldTextColor", elementString))
1931 ConvertStringToColor32(elementString, opacity, color);
1932 r = pSearchBar->SetSearchFieldTextColor(SEARCH_FIELD_STATUS_DISABLED, color);
1935 if (pControl->GetElement("highlightedButtonColor", elementString))
1937 ConvertStringToColor32(elementString, opacity, color);
1938 r = pSearchBar->SetButtonColor(SEARCH_BAR_BUTTON_STATUS_HIGHLIGHTED, color);
1941 if (pControl->GetElement("highlightedButtonTextColor", elementString))
1943 ConvertStringToColor32(elementString, opacity, color);
1944 r = pSearchBar->SetButtonTextColor(SEARCH_BAR_BUTTON_STATUS_HIGHLIGHTED, color);
1947 if (pControl->GetElement("highlightedSearchFieldColor", elementString))
1949 ConvertStringToColor32(elementString, opacity, color);
1950 r = pSearchBar->SetSearchFieldColor(SEARCH_FIELD_STATUS_HIGHLIGHTED, color);
1953 if (pControl->GetElement("highlightedSearchFieldTextColor", elementString))
1955 ConvertStringToColor32(elementString, opacity, color);
1956 r = pSearchBar->SetSearchFieldTextColor(SEARCH_FIELD_STATUS_HIGHLIGHTED, color);
1959 if (pControl->GetElement("pressedButtonColor", elementString))
1961 ConvertStringToColor32(elementString, opacity, color);
1962 r = pSearchBar->SetButtonColor(SEARCH_BAR_BUTTON_STATUS_PRESSED, color);
1965 if (pControl->GetElement("pressedButtonTextColor", elementString))
1967 ConvertStringToColor32(elementString, opacity, color);
1968 r = pSearchBar->SetButtonTextColor(SEARCH_BAR_BUTTON_STATUS_PRESSED, color);
1971 if (pControl->GetElement("guideTextColor", elementString))
1973 ConvertStringToColor32(elementString, opacity, color);
1974 r = pSearchBar->SetGuideTextColor(color);
1977 if (pControl->GetElement(L"accessibilityHint", elementString))
1979 AccessibilityContainer* pContainer = pSearchBar->GetAccessibilityContainer();
1982 AccessibilityElement* pElement = pContainer->GetElement(L"EditText");
1985 pElement->SetHint(elementString);
1994 _SearchBarRegister::_SearchBarRegister(void)
1996 _UiBuilderControlTableManager* pUiBuilderControlTableManager = _UiBuilderControlTableManager::GetInstance();
1997 pUiBuilderControlTableManager->RegisterControl(L"SearchBar", _SearchBarMaker::GetInstance);
2000 _SearchBarRegister::~_SearchBarRegister(void)
2002 _UiBuilderControlTableManager* pUiBuilderControlTableManager = _UiBuilderControlTableManager::GetInstance();
2003 pUiBuilderControlTableManager->UnregisterControl(L"SearchBar");
2005 static _SearchBarRegister SearchBarRegisterToUiBuilder;
2006 }}} // Tizen::Ui::Controls