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)
69 if (__pSearchBar != null)
72 if (__pSearchBar->GetClippedGroupControl())
74 _Control* pControl = __pSearchBar->GetClippedGroupControl();
75 pControl->DetachAllChildren();
85 delete __pPublicActionEvent;
86 __pPublicActionEvent = null;
88 delete __pPublicKeypadEvent;
89 __pPublicKeypadEvent = null;
91 delete __pPublicTextBlockEvent;
92 __pPublicTextBlockEvent = null;
94 delete __pPublicTextEvent;
95 __pPublicTextEvent = null;
97 delete __pPublicSearchBarEvent;
98 __pPublicSearchBarEvent = null;
100 delete __pPublicLanguageEvent;
101 __pPublicLanguageEvent = null;
103 delete __pPublicFocusEventListeners;
104 __pPublicFocusEventListeners = null;
108 _SearchBarImpl::CreateSearchBarImplN(SearchBar* pControl, const Rectangle& bounds, bool enableSearchBarButton, KeypadAction keypadAction)
111 result r = E_SUCCESS;
113 r = GET_SIZE_INFO(SearchBar).CheckInitialSizeValid(Dimension(bounds.width, bounds.height), _CONTROL_ORIENTATION_PORTRAIT);
114 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, null, E_INVALID_ARG,
115 "[E_INVALID_ARG] Invalid argument(s) is used. The given size is not valid.");
117 _SearchBar* pCore = _SearchBar::CreateSearchBarN();
119 SysTryReturn(NID_UI_CTRL, pCore != null, null, r, "[%s] Propagating.", GetErrorMessage(r));
121 _SearchBarImpl* pImpl = new (std::nothrow) _SearchBarImpl(pControl, pCore);
123 r = CheckConstruction(pCore, pImpl);
124 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
126 r = pImpl->InitializeBoundsProperties(GET_SIZE_INFO(SearchBar), bounds, pCore->GetOrientation());
127 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
129 r = pImpl->Initialize(enableSearchBarButton, keypadAction);
130 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
139 _SearchBarImpl::CreateSearchBarImplFN(SearchBar* pControl, const FloatRectangle& bounds, bool enableSearchBarButton, KeypadAction keypadAction)
142 result r = E_SUCCESS;
144 r = GET_SIZE_INFO(SearchBar).CheckInitialSizeValidF(FloatDimension(bounds.width, bounds.height), _CONTROL_ORIENTATION_PORTRAIT);
145 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, null, E_INVALID_ARG,
146 "[E_INVALID_ARG] Invalid argument(s) is used. The given size is not valid.");
148 _SearchBar* pCore = _SearchBar::CreateSearchBarN();
150 SysTryReturn(NID_UI_CTRL, pCore != null, null, r, "[%s] Propagating.", GetErrorMessage(r));
152 _SearchBarImpl* pImpl = new (std::nothrow) _SearchBarImpl(pControl, pCore);
154 r = CheckConstruction(pCore, pImpl);
155 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
157 r = pImpl->InitializeBoundsPropertiesF(GET_SIZE_INFO(SearchBar), bounds, pCore->GetOrientation());
158 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
160 r = pImpl->Initialize(enableSearchBarButton, keypadAction);
161 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
170 _SearchBarImpl::GetPublicClassName(void) const
172 return "Tizen::Ui::Controls::SearchBar";
176 _SearchBarImpl::GetPublic(void) const
178 return static_cast <const SearchBar&>(_ControlImpl::GetPublic());
182 _SearchBarImpl::GetPublic(void)
184 return static_cast <SearchBar&>(_ControlImpl::GetPublic());
188 _SearchBarImpl::GetCore(void) const
190 return static_cast <const _SearchBar&>(_ControlImpl::GetCore());
194 _SearchBarImpl::GetCore(void)
196 return static_cast <_SearchBar&>(_ControlImpl::GetCore());
200 _SearchBarImpl::GetInstance(SearchBar& searchBar)
202 return (static_cast<_SearchBarImpl*>(searchBar._pControlImpl));
205 const _SearchBarImpl*
206 _SearchBarImpl::GetInstance(const SearchBar& searchBar)
208 return (static_cast<const _SearchBarImpl*>(searchBar._pControlImpl));
213 _SearchBarImpl::Initialize(bool enableSearchBarButton, KeypadAction keypadAction)
217 result r = E_SUCCESS;
219 CoreKeypadAction coreKeypadAction = CORE_KEYPAD_ACTION_SEARCH;
220 switch (keypadAction)
222 case KEYPAD_ACTION_ENTER:
223 coreKeypadAction = CORE_KEYPAD_ACTION_ENTER;
226 case KEYPAD_ACTION_GO:
227 coreKeypadAction = CORE_KEYPAD_ACTION_GO;
230 case KEYPAD_ACTION_NEXT:
231 coreKeypadAction = CORE_KEYPAD_ACTION_NEXT;
234 case KEYPAD_ACTION_SEND:
235 coreKeypadAction = CORE_KEYPAD_ACTION_SEND;
238 case KEYPAD_ACTION_SEARCH:
239 coreKeypadAction = CORE_KEYPAD_ACTION_SEARCH;
242 case KEYPAD_ACTION_LOGIN:
243 coreKeypadAction = CORE_KEYPAD_ACTION_LOGIN;
246 case KEYPAD_ACTION_SIGN_IN:
247 coreKeypadAction = CORE_KEYPAD_ACTION_SIGN_IN;
250 case KEYPAD_ACTION_JOIN:
251 coreKeypadAction = CORE_KEYPAD_ACTION_JOIN;
254 case KEYPAD_ACTION_DONE:
255 coreKeypadAction = CORE_KEYPAD_ACTION_DONE;
262 __pEditField = new (std::nothrow) EditField();
263 SysTryReturnResult(NID_UI_CTRL, __pEditField, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Failed to allocate memory.");
265 r = __pEditField->Construct(GetBoundsF(), EDIT_FIELD_STYLE_NORMAL, INPUT_STYLE_OVERLAY, EDIT_FIELD_TITLE_STYLE_NONE, true);
266 SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
268 __pEditField->AddFocusEventListener(*this);
269 SysTryReturnResult(NID_UI_CTRL, GetLastResult() == E_SUCCESS, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
271 __pEditField->AddKeyEventListener(*this);
272 SysTryReturnResult(NID_UI_CTRL, GetLastResult() == E_SUCCESS, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
274 __pEditFieldImpl = _EditFieldImpl::GetInstance(*__pEditField);
275 SysTryReturnResult(NID_UI_CTRL, __pEditFieldImpl != null, E_SYSTEM,
276 "[E_SYSTEM] A system error has occured. Failed to EditFieldImpl instance");
278 String cancelButtonText;
279 GET_STRING_CONFIG(IDS_TPLATFORM_BUTTON_CANCEL_ABB, cancelButtonText);
281 __pButton = new (std::nothrow) Button();
282 SysTryReturnResult(NID_UI_CTRL, __pButton, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Failed to allocate memory.");
284 r = __pButton->Construct(GetBoundsF(), cancelButtonText);
285 SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
287 __pButton->AddFocusEventListener(*this);
288 SysTryReturnResult(NID_UI_CTRL, GetLastResult() == E_SUCCESS, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
290 __pButtonImpl = _ButtonImpl::GetInstance(*__pButton);
291 SysTryReturnResult(NID_UI_CTRL, __pButtonImpl != null, E_SYSTEM,
292 "[E_SYSTEM] A system error has occured. Failed to ButtonImpl instance");
294 r = __pSearchBar->Initialize(enableSearchBarButton, coreKeypadAction);
295 SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "Propagating.");
297 __pPublicActionEvent = _PublicActionEvent::CreateInstanceN(GetPublic());
299 SysTryReturn(NID_UI_CTRL, __pPublicActionEvent, r, r, "[%s] Propagating.", GetErrorMessage(r));
301 r = __pSearchBar->AddActionEventListener(*this);
302 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
304 __pPublicKeypadEvent = _PublicKeypadEvent::CreateInstanceN(GetPublic());
306 SysTryReturn(NID_UI_CTRL, __pPublicKeypadEvent, r, r, "[%s] Propagating.", GetErrorMessage(r));
308 r = __pSearchBar->AddKeypadEventListener(*this);
309 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
311 __pPublicTextBlockEvent = _PublicTextBlockEvent::CreateInstanceN(GetPublic());
313 SysTryReturn(NID_UI_CTRL, __pPublicTextBlockEvent, r, r, "[%s] Propagating.", GetErrorMessage(r));
315 r = __pSearchBar->AddTextBlockEventListener(*this);
316 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
318 __pPublicTextEvent = _PublicTextEvent::CreateInstanceN(GetPublic());
320 SysTryReturn(NID_UI_CTRL, __pPublicTextEvent, r, r, "[%s] Propagating.", GetErrorMessage(r));
322 r = __pSearchBar->AddTextEventListener(*this);
323 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
325 __pPublicSearchBarEvent = _PublicSearchBarEvent::CreateInstanceN(GetPublic());
327 SysTryReturn(NID_UI_CTRL, __pPublicSearchBarEvent, r, r, "[%s] Propagating.", GetErrorMessage(r));
329 r = __pSearchBar->AddSearchBarEventListener(*this);
330 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
332 __pPublicLanguageEvent = _PublicLanguageEvent::CreateInstanceN(GetPublic());
334 SysTryReturn(NID_UI_CTRL, __pPublicLanguageEvent, r, r, "[%s] Propagating.", GetErrorMessage(r));
336 r = __pSearchBar->AddLanguageEventListener(*this);
337 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
339 __pPublicFocusEventListeners = CreatePublicEventListenerListN();
341 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
347 _SearchBarImpl::GetContent(void) const
351 return __pContentControl;
355 _SearchBarImpl::SetContent(const Control* pContent)
359 result r = E_SUCCESS;
360 if (pContent != null)
362 const _Control& content = _ControlImpl::GetInstance(*pContent)->GetCore();
363 bool isContentAttachable = __pSearchBar->IsContentAttachable(&content);
364 SysTryReturn(NID_UI_CTRL, isContentAttachable, E_INVALID_ARG, E_INVALID_ARG,
365 "[E_INVALID_ARG] Invalid argument(s) is used. The content cannot be set.");
368 if (pContent != null && __pContentControl == null)
370 __pContentControl = const_cast <Control*>(pContent);
371 _Control& control = _ControlImpl::GetInstance(*__pContentControl)->GetCore();
373 r = __pSearchBar->SetContent(&control);
380 _SearchBarImpl::UpdateContentArea(bool invalidate)
384 return __pSearchBar->UpdateContentArea(invalidate);
388 _SearchBarImpl::SetContentAreaVisible(bool visible)
392 return __pSearchBar->SetContentAreaVisible(visible, true);
396 _SearchBarImpl::IsContentAreaVisible(void) const
400 return __pSearchBar->IsContentAreaVisible();
404 _SearchBarImpl::SetContentAreaSize(const Dimension& size)
408 FloatDimension contentSize;
409 contentSize = _CoordinateSystemUtils::ConvertToFloat(size);
410 Variant var(contentSize);
412 return __pSearchBar->SetPropertyContentAreaSize(var);
416 _SearchBarImpl::SetContentAreaSize(const FloatDimension& size)
421 return __pSearchBar->SetPropertyContentAreaSize(var);
425 _SearchBarImpl::GetContentAreaSize(void) const
430 size = _CoordinateSystemUtils::ConvertToInteger(__pSearchBar->GetPropertyContentAreaSize().ToFloatDimension());
436 _SearchBarImpl::GetContentAreaSizeF(void) const
440 return __pSearchBar->GetPropertyContentAreaSize().ToFloatDimension();
444 _SearchBarImpl::GetMode(void) const
448 return __pSearchBar->GetMode();
452 _SearchBarImpl::IsModeLocked(void) const
456 return __pSearchBar->IsModeLocked();
460 _SearchBarImpl::SetMode(SearchBarMode mode)
464 return __pSearchBar->SetMode(mode, true);
468 _SearchBarImpl::SetModeLocked(bool modeLocked)
472 return __pSearchBar->SetModeLocked(modeLocked);
476 _SearchBarImpl::GetButtonActionId(void) const
480 return __pSearchBar->GetPropertyButtonActionId().ToInt();
484 _SearchBarImpl::GetButtonColor(SearchBarButtonStatus status) const
492 case SEARCH_BAR_BUTTON_STATUS_NORMAL:
493 buttonColor = __pSearchBar->GetPropertyButtonNormalColor();
495 case SEARCH_BAR_BUTTON_STATUS_PRESSED:
496 buttonColor = __pSearchBar->GetPropertyButtonPressedColor();
498 case SEARCH_BAR_BUTTON_STATUS_HIGHLIGHTED:
499 buttonColor = __pSearchBar->GetPropertyButtonHighlightedColor();
501 case SEARCH_BAR_BUTTON_STATUS_DISABLED:
502 buttonColor = __pSearchBar->GetPropertyButtonDisabledColor();
508 return buttonColor.ToColor();
512 _SearchBarImpl::GetButtonTextColor(SearchBarButtonStatus status) const
516 Variant buttonTextColor;
520 case SEARCH_BAR_BUTTON_STATUS_NORMAL:
521 buttonTextColor = __pSearchBar->GetPropertyButtonNormalTextColor();
523 case SEARCH_BAR_BUTTON_STATUS_PRESSED:
524 buttonTextColor = __pSearchBar->GetPropertyButtonPressedTextColor();
526 case SEARCH_BAR_BUTTON_STATUS_HIGHLIGHTED:
527 buttonTextColor = __pSearchBar->GetPropertyButtonHighlightedTextColor();
529 case SEARCH_BAR_BUTTON_STATUS_DISABLED:
530 buttonTextColor = __pSearchBar->GetPropertyButtonDisabledTextColor();
536 return buttonTextColor.ToColor();
539 SearchBarButtonStatus
540 _SearchBarImpl::GetButtonStatus(void) const
544 return __pSearchBar->GetButtonStatus();
548 _SearchBarImpl::SetButton(const String& text, int actionId)
552 result r = E_SUCCESS;
553 Variant var(actionId);
555 r = __pSearchBar->SetButtonText(text);
556 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
558 r = __pSearchBar->SetPropertyButtonActionId(var);
564 _SearchBarImpl::SetButtonEnabled(bool enabled)
568 return __pSearchBar->SetButtonEnabled(enabled);
572 _SearchBarImpl::SetButtonColor(SearchBarButtonStatus status, const Color& color)
576 result r = E_SUCCESS;
581 case SEARCH_BAR_BUTTON_STATUS_NORMAL:
582 r = __pSearchBar->SetPropertyButtonNormalColor(var);
584 case SEARCH_BAR_BUTTON_STATUS_PRESSED:
585 r = __pSearchBar->SetPropertyButtonPressedColor(var);
587 case SEARCH_BAR_BUTTON_STATUS_HIGHLIGHTED:
588 r = __pSearchBar->SetPropertyButtonHighlightedColor(var);
590 case SEARCH_BAR_BUTTON_STATUS_DISABLED:
591 r = __pSearchBar->SetPropertyButtonDisabledColor(var);
601 _SearchBarImpl::SetButtonTextColor(SearchBarButtonStatus status, const Color& color)
605 result r = E_SUCCESS;
610 case SEARCH_BAR_BUTTON_STATUS_NORMAL:
611 r = __pSearchBar->SetPropertyButtonNormalTextColor(var);
613 case SEARCH_BAR_BUTTON_STATUS_PRESSED:
614 r = __pSearchBar->SetPropertyButtonPressedTextColor(var);
616 case SEARCH_BAR_BUTTON_STATUS_HIGHLIGHTED:
617 r = __pSearchBar->SetPropertyButtonHighlightedTextColor(var);
619 case SEARCH_BAR_BUTTON_STATUS_DISABLED:
620 r = __pSearchBar->SetPropertyButtonDisabledTextColor(var);
630 _SearchBarImpl::AppendCharacter(const Character& character)
634 return __pSearchBar->AppendCharacter(character);
638 _SearchBarImpl::AppendText(const String& text)
642 return __pSearchBar->AppendText(text);
646 _SearchBarImpl::SetText(const String& text)
650 return __pSearchBar->SetText(text);
654 _SearchBarImpl::InsertCharacterAt(int index, const Character& character)
658 return __pSearchBar->InsertCharacterAt(index, character);
662 _SearchBarImpl::InsertTextAt(int index, const String& text)
666 return __pSearchBar->InsertTextAt(index, text);
670 _SearchBarImpl::DeleteCharacterAt(int index)
674 return __pSearchBar->DeleteCharacterAt(index);
678 _SearchBarImpl::Clear(void)
682 result r = E_SUCCESS;
683 r = __pSearchBar->Clear();
685 SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, E_SYSTEM,
686 "[E_SYSTEM] A system error has occured. Failed to clear the text.");
691 _SearchBarImpl::GetTextLength(void) const
695 return __pSearchBar->GetTextLength();
699 _SearchBarImpl::GetText(void) const
703 return __pSearchBar->GetText();
707 _SearchBarImpl::GetText(int start, int end) const
711 return __pSearchBar->GetText(start, end);
715 _SearchBarImpl::GetLimitLength(void) const
719 return __pSearchBar->GetLimitLength();
723 _SearchBarImpl::SetLimitLength(int limitLength)
727 return __pSearchBar->SetLimitLength(limitLength);
731 _SearchBarImpl::ShowKeypad(void) const
735 return __pSearchBar->ShowKeypad();
739 _SearchBarImpl::HideKeypad(void) const
743 return __pSearchBar->HideKeypad();
747 _SearchBarImpl::GetSearchFieldTextSize(void) const
751 int textSize = _CoordinateSystemUtils::ConvertToInteger(__pSearchBar->GetSearchFieldTextSizeF());
756 _SearchBarImpl::GetSearchFieldTextSizeF(void) const
760 return __pSearchBar->GetSearchFieldTextSizeF();
764 _SearchBarImpl::SetSearchFieldTextSize(int size)
768 float textSize = _CoordinateSystemUtils::ConvertToFloat(size);
769 return SetSearchFieldTextSize(textSize);
773 _SearchBarImpl::SetSearchFieldTextSize(float size)
777 return __pSearchBar->SetSearchFieldTextSize(size);
781 _SearchBarImpl::GetBlockRange(int& start, int& end) const
785 return __pSearchBar->GetBlockRange(start, end);
789 _SearchBarImpl::ReleaseBlock(void)
793 return __pSearchBar->ReleaseBlock();
797 _SearchBarImpl::SetBlockRange(int start, int end)
801 return __pSearchBar->SetBlockRange(start, end + 1);
805 _SearchBarImpl::RemoveTextBlock(void)
808 result r = __pSearchBar->RemoveTextBlock();
809 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, E_SYSTEM, E_SYSTEM,
810 "[E_SYSTEM] A system error has occured. Unable to remove the text block.");
816 _SearchBarImpl::GetColor(void) const
820 return __pSearchBar->GetPropertyColor().ToColor();
824 _SearchBarImpl::GetSearchFieldColor(SearchFieldStatus status) const
828 Variant searchFieldColor;
832 case SEARCH_FIELD_STATUS_NORMAL:
833 searchFieldColor = __pSearchBar->GetPropertySearchFieldNormalColor();
835 case SEARCH_FIELD_STATUS_HIGHLIGHTED:
836 searchFieldColor = __pSearchBar->GetPropertySearchFieldHighlightedColor();
838 case SEARCH_FIELD_STATUS_DISABLED:
839 searchFieldColor = __pSearchBar->GetPropertySearchFieldDisabledColor();
845 return searchFieldColor.ToColor();
849 _SearchBarImpl::GetSearchFieldTextColor(SearchFieldStatus status) const
854 _Edit* pEdit = __pSearchBar->GetSearchField();
859 case SEARCH_FIELD_STATUS_NORMAL:
860 color = pEdit->GetTextColor(EDIT_TEXT_COLOR_NORMAL);
862 case SEARCH_FIELD_STATUS_HIGHLIGHTED:
863 color = pEdit->GetTextColor(EDIT_TEXT_COLOR_HIGHLIGHTED);
865 case SEARCH_FIELD_STATUS_DISABLED:
866 color = pEdit->GetTextColor(EDIT_TEXT_COLOR_DISABLED);
876 _SearchBarImpl::SetBackgroundBitmap(const Bitmap& bitmap)
880 return __pSearchBar->SetBackgroundBitmap(bitmap);
884 _SearchBarImpl::SetColor(const Color& color)
890 return __pSearchBar->SetPropertyColor(var);
894 _SearchBarImpl::SetSearchFieldColor(SearchFieldStatus status, const Color& color)
898 result r = E_SUCCESS;
903 case SEARCH_FIELD_STATUS_NORMAL:
904 r = __pSearchBar->SetPropertySearchFieldNormalColor(var);
906 case SEARCH_FIELD_STATUS_HIGHLIGHTED:
907 r = __pSearchBar->SetPropertySearchFieldHighlightedColor(var);
909 case SEARCH_FIELD_STATUS_DISABLED:
910 r = __pSearchBar->SetPropertySearchFieldDisabledColor(var);
920 _SearchBarImpl::SetSearchFieldTextColor(SearchFieldStatus status, const Color& color)
924 result r = E_SUCCESS;
925 _Edit* pEdit = __pSearchBar->GetSearchField();
930 case SEARCH_FIELD_STATUS_NORMAL:
931 r = pEdit->SetTextColor(EDIT_TEXT_COLOR_NORMAL, color);
933 case SEARCH_FIELD_STATUS_HIGHLIGHTED:
934 r = pEdit->SetTextColor(EDIT_TEXT_COLOR_HIGHLIGHTED, color);
936 case SEARCH_FIELD_STATUS_DISABLED:
937 r = pEdit->SetTextColor(EDIT_TEXT_COLOR_DISABLED, color);
948 _SearchBarImpl::GetGuideText(void) const
952 return __pSearchBar->GetGuideText();
956 _SearchBarImpl::SetGuideText(const String& guideText)
960 return __pSearchBar->SetGuideText(guideText);
964 _SearchBarImpl::GetGuideTextColor(void) const
968 return __pSearchBar->GetGuideTextColor();
972 _SearchBarImpl::SetGuideTextColor(const Color& color)
976 return __pSearchBar->SetGuideTextColor(color);
980 _SearchBarImpl::GetCursorPosition(void) const
984 return __pSearchBar->GetCursorPosition();
988 _SearchBarImpl::SetCursorPosition(int index)
992 return __pSearchBar->SetCursorPosition(index);
996 _SearchBarImpl::IsLowerCaseModeEnabled(void) const
1000 return __pSearchBar->IsLowerCaseModeEnabled();
1004 _SearchBarImpl::SetLowerCaseModeEnabled(bool enable)
1008 return __pSearchBar->SetLowerCaseModeEnabled(enable);
1012 _SearchBarImpl::GetEllipsisPosition(void) const
1016 return __pSearchBar->GetEllipsisPosition();
1020 _SearchBarImpl::SetEllipsisPosition(EllipsisPosition position)
1024 return __pSearchBar->SetEllipsisPosition(position);
1028 _SearchBarImpl::GetKeypadAction(void) const
1032 CoreKeypadAction coreKeypadAction = __pSearchBar->GetKeypadAction();
1033 KeypadAction publicKeypadAction = ConvertKeypadAction(coreKeypadAction);
1035 return publicKeypadAction;
1039 _SearchBarImpl::IsTextPredictionEnabled(void) const
1041 return __pSearchBar->IsTextPredictionEnabled();
1045 _SearchBarImpl::SetTextPredictionEnabled(bool enable)
1047 return __pSearchBar->SetTextPredictionEnabled(enable);
1051 _SearchBarImpl::SetCurrentLanguage(LanguageCode languageCode)
1053 return __pSearchBar->SetCurrentLanguage(languageCode);
1057 _SearchBarImpl::GetCurrentLanguage(LanguageCode& language) const
1059 return __pSearchBar->GetCurrentLanguage(language);
1063 _SearchBarImpl::AddActionEventListener(IActionEventListener& listener)
1067 SysTryReturn(NID_UI_CTRL, __pPublicActionEvent, E_SYSTEM, E_SYSTEM,
1068 "[E_SYSTEM] A system error has occurred.");
1070 result r = __pPublicActionEvent->AddListener(listener);
1071 SysTryReturnResult(NID_UI_CTRL, r != E_OBJ_ALREADY_EXIST, E_SYSTEM,
1072 "A system error has occurred. The same listener instance already exists in the event listener list.");
1077 _SearchBarImpl::RemoveActionEventListener(IActionEventListener& listener)
1081 SysTryReturn(NID_UI_CTRL, __pPublicActionEvent, E_SYSTEM, E_SYSTEM,
1082 "[E_SYSTEM] A system error has occurred.");
1084 result r = __pPublicActionEvent->RemoveListener(listener);
1085 SysTryReturnResult(NID_UI_CTRL, r != E_OBJ_NOT_FOUND, E_SYSTEM,
1086 "A system error has occurred. The specified listener does not exist in the event listener list.");
1091 _SearchBarImpl::AddKeypadEventListener(IKeypadEventListener& listener)
1095 SysTryReturn(NID_UI_CTRL, __pPublicKeypadEvent, E_SYSTEM, E_SYSTEM,
1096 "[E_SYSTEM] A system error has occurred.");
1098 result r = __pPublicKeypadEvent->AddListener(listener);
1099 SysTryReturnResult(NID_UI_CTRL, r != E_OBJ_ALREADY_EXIST, E_SYSTEM,
1100 "A system error has occurred. The same listener instance already exists in the event listener list.");
1106 _SearchBarImpl::RemoveKeypadEventListener(IKeypadEventListener& listener)
1110 SysTryReturn(NID_UI_CTRL, __pPublicKeypadEvent, E_SYSTEM, E_SYSTEM,
1111 "[E_SYSTEM] A system error has occurred.");
1113 result r = __pPublicKeypadEvent->RemoveListener(listener);
1114 SysTryReturnResult(NID_UI_CTRL, r != E_OBJ_NOT_FOUND, E_SYSTEM,
1115 "A system error has occurred. The specified listener does not exist in the event listener list.");
1121 _SearchBarImpl::AddTextBlockEventListener(ITextBlockEventListener& listener)
1125 SysTryReturn(NID_UI_CTRL, __pPublicTextBlockEvent, E_SYSTEM, E_SYSTEM,
1126 "[E_SYSTEM] A system error has occurred.");
1128 result r = __pPublicTextBlockEvent->AddListener(listener);
1129 SysTryReturnResult(NID_UI_CTRL, r != E_OBJ_ALREADY_EXIST, E_SYSTEM,
1130 "A system error has occurred. The same listener instance already exists in the event listener list.");
1136 _SearchBarImpl::RemoveTextBlockEventListener(ITextBlockEventListener& listener)
1140 SysTryReturn(NID_UI_CTRL, __pPublicTextBlockEvent, E_SYSTEM, E_SYSTEM,
1141 "[E_SYSTEM] A system error has occurred.");
1143 result r = __pPublicTextBlockEvent->RemoveListener(listener);
1144 SysTryReturnResult(NID_UI_CTRL, r != E_OBJ_NOT_FOUND, E_SYSTEM,
1145 "A system error has occurred. The specified listener does not exist in the event listener list.");
1152 _SearchBarImpl::AddTextEventListener(ITextEventListener& listener)
1156 SysTryReturn(NID_UI_CTRL, __pPublicTextEvent, E_SYSTEM, E_SYSTEM,
1157 "[E_SYSTEM] A system error has occurred.");
1159 result r = __pPublicTextEvent->AddListener(listener);
1160 SysTryReturnResult(NID_UI_CTRL, r != E_OBJ_ALREADY_EXIST, E_SYSTEM,
1161 "A system error has occurred. The same listener instance already exists in the event listener list.");
1167 _SearchBarImpl::RemoveTextEventListener(ITextEventListener& listener)
1171 SysTryReturn(NID_UI_CTRL, __pPublicTextEvent, E_SYSTEM, E_SYSTEM,
1172 "[E_SYSTEM] A system error has occurred.");
1174 result r = __pPublicTextEvent->RemoveListener(listener);
1175 SysTryReturnResult(NID_UI_CTRL, r != E_OBJ_NOT_FOUND, E_SYSTEM,
1176 "A system error has occurred. The specified listener does not exist in the event listener list.");
1182 _SearchBarImpl::AddSearchBarEventListener(const ISearchBarEventListener& listener)
1186 SysTryReturn(NID_UI_CTRL, __pPublicSearchBarEvent, E_SYSTEM, E_SYSTEM,
1187 "[E_SYSTEM] A system error has occurred.");
1189 result r = __pPublicSearchBarEvent->AddListener(listener);
1190 SysTryReturnResult(NID_UI_CTRL, r != E_OBJ_ALREADY_EXIST, E_SYSTEM,
1191 "A system error has occurred. The same listener instance already exists in the event listener list.");
1197 _SearchBarImpl::RemoveSearchBarEventListener(const ISearchBarEventListener& listener)
1201 SysTryReturn(NID_UI_CTRL, __pPublicSearchBarEvent, E_SYSTEM, E_SYSTEM,
1202 "[E_SYSTEM] A system error has occurred.");
1204 result r = __pPublicSearchBarEvent->RemoveListener(listener);
1205 SysTryReturnResult(NID_UI_CTRL, r != E_OBJ_NOT_FOUND, E_SYSTEM,
1206 "A system error has occurred. The specified listener does not exist in the event listener list.");
1212 _SearchBarImpl::AddLanguageEventListener(ILanguageEventListener& listener)
1216 SysAssertf(__pPublicLanguageEvent != null, "Not yet constructed. Construct() should be called before use.");
1218 return __pPublicLanguageEvent->AddListener(listener);
1222 _SearchBarImpl::RemoveLanguageEventListener(ILanguageEventListener& listener)
1226 SysAssertf(__pPublicLanguageEvent != null, "Not yet constructed. Construct() should be called before use.");
1228 return __pPublicLanguageEvent->RemoveListener(listener);
1232 _SearchBarImpl::SetEditTextFilter(IEditTextFilter* pFilter)
1234 __pSearchBar->SetEditTextFilter(pFilter);
1240 _SearchBarImpl::SendOpaqueCommand (const String& command)
1242 __pSearchBar->SendOpaqueCommand(command);
1248 _SearchBarImpl::OnActionPerformed(const _Control& source, int actionId)
1252 if (__pPublicActionEvent != null)
1254 IEventArg* pEventArg = _PublicActionEvent::CreateActionEventArgN(actionId);
1255 result r = GetLastResult();
1256 SysTryReturnVoidResult(NID_UI_CTRL, pEventArg, r, "[%s] Propagating.", GetErrorMessage(r));
1258 __pPublicActionEvent->Fire(*pEventArg);
1264 _SearchBarImpl::OnKeypadWillOpen(void)
1268 if (__pPublicKeypadEvent != null)
1270 IEventArg* pEventArg = _PublicKeypadEvent::CreateKeypadEventArgN(
1271 GetPublic(), KEYPAD_ACTION_SEARCH, KEYPAD_EVENT_STATUS_CREATED);
1272 result r = GetLastResult();
1273 SysTryReturnVoidResult(NID_UI_CTRL, pEventArg, r, "[%s] Propagating.", GetErrorMessage(r));
1275 __pPublicKeypadEvent->Fire(*pEventArg);
1281 _SearchBarImpl::OnKeypadOpened(void)
1285 if (__pPublicKeypadEvent != null)
1287 IEventArg* pEventArg = _PublicKeypadEvent::CreateKeypadEventArgN(
1288 GetPublic(), KEYPAD_ACTION_SEARCH, KEYPAD_EVENT_STATUS_OPEN);
1289 result r = GetLastResult();
1290 SysTryReturnVoidResult(NID_UI_CTRL, pEventArg, r, "[%s] Propagating.", GetErrorMessage(r));
1292 __pPublicKeypadEvent->Fire(*pEventArg);
1299 _SearchBarImpl::OnKeypadClosed(void)
1303 if (__pPublicKeypadEvent != null)
1305 IEventArg* pEventArg = _PublicKeypadEvent::CreateKeypadEventArgN(
1306 GetPublic(), KEYPAD_ACTION_SEARCH, KEYPAD_EVENT_STATUS_CLOSE);
1307 result r = GetLastResult();
1308 SysTryReturnVoidResult(NID_UI_CTRL, pEventArg, r, "[%s] Propagating.", GetErrorMessage(r));
1310 __pPublicKeypadEvent->Fire(*pEventArg);
1316 _SearchBarImpl::OnKeypadBoundsChanged(void)
1320 if (__pPublicKeypadEvent != null)
1322 IEventArg* pEventArg = _PublicKeypadEvent::CreateKeypadEventArgN(
1323 GetPublic(), KEYPAD_ACTION_SEARCH, KEYPAD_EVENT_STATUS_BOUNDS_CHANGED);
1324 result r = GetLastResult();
1325 SysTryReturnVoidResult(NID_UI_CTRL, pEventArg, r, "[%s] Propagating.", GetErrorMessage(r));
1327 __pPublicKeypadEvent->Fire(*pEventArg);
1333 _SearchBarImpl::OnKeypadActionPerformed(CoreKeypadAction keypadAction)
1337 if (__pPublicKeypadEvent != null)
1339 KeypadAction publicKeypadAction = ConvertKeypadAction(keypadAction);
1341 IEventArg* pEventArg = _PublicKeypadEvent::CreateKeypadEventArgN(
1342 GetPublic(), publicKeypadAction, KEYPAD_EVENT_STATUS_ENTERACTION);
1343 result r = GetLastResult();
1344 SysTryReturnVoidResult(NID_UI_CTRL, pEventArg, r, "[%s] Propagating.", GetErrorMessage(r));
1346 __pPublicKeypadEvent->Fire(*pEventArg);
1352 _SearchBarImpl::OnTextBlockSelected(_Control& source, int start, int end)
1356 if (__pPublicTextBlockEvent != null)
1358 IEventArg* pEventArg = _PublicTextBlockEvent::CreateTextBlockEventArgN(start, end);
1359 result r = GetLastResult();
1360 SysTryReturnVoidResult(NID_UI_CTRL, pEventArg, r, "[%s] Propagating.", GetErrorMessage(r));
1362 __pPublicTextBlockEvent->Fire(*pEventArg);
1368 _SearchBarImpl::OnTextValueChanged(const _Control& source)
1372 if (__pPublicTextEvent != null)
1374 IEventArg* pEventArg = _PublicTextEvent::CreateTextEventArgN(TEXT_EVENT_CHANGED);
1375 result r = GetLastResult();
1376 SysTryReturnVoidResult(NID_UI_CTRL, pEventArg, r, "[%s] Propagating.", GetErrorMessage(r));
1378 __pPublicTextEvent->Fire(*pEventArg);
1384 _SearchBarImpl::OnTextValueChangeCanceled(const _Control& source)
1388 if (__pPublicTextEvent != null)
1390 IEventArg* pEventArg = _PublicTextEvent::CreateTextEventArgN(TEXT_EVENT_CANCELED);
1391 result r = GetLastResult();
1392 SysTryReturnVoidResult(NID_UI_CTRL, pEventArg, r, "[%s] Propagating.", GetErrorMessage(r));
1394 __pPublicTextEvent->Fire(*pEventArg);
1400 _SearchBarImpl::OnSearchBarModeChanged(_SearchBar& source, SearchBarMode mode)
1404 if ((_AppInfo::GetApiVersion() == _API_VERSION_2_0 && _AppInfo::IsOspCompat()) && __pSearchBar != null)
1406 if (mode == SEARCH_BAR_MODE_NORMAL)
1408 __pSearchBar->SetHeaderVisibleState(true);
1412 __pSearchBar->SetHeaderVisibleState(false);
1414 __pSearchBar->SetContentsArea();
1417 if (__pPublicSearchBarEvent != null)
1419 IEventArg* pEventArg = _PublicSearchBarEvent::CreateSearchBarEventArgN(SEARCH_BAR_EVENT_MODE_CHANGE);
1420 result r = GetLastResult();
1421 SysTryReturnVoidResult(NID_UI_CTRL, pEventArg, r, "[%s] Propagating.", GetErrorMessage(r));
1423 __pPublicSearchBarEvent->Fire(*pEventArg);
1429 _SearchBarImpl::OnLanguageChanged(LanguageCode oldLanguage, LanguageCode newLanguage)
1431 if (__pPublicLanguageEvent != null)
1433 IEventArg* pKLanguageEventArg = _PublicLanguageEvent::CreateLanguageEventArgN(GetPublic(), oldLanguage, newLanguage);
1434 result r = GetLastResult();
1435 SysTryReturnVoidResult(NID_UI_CTRL, pKLanguageEventArg, r, "[%s] Propagating.", GetErrorMessage(r));
1437 __pPublicLanguageEvent->Fire(*pKLanguageEventArg);
1441 SysLog(NID_UI_CTRL, "Event is not created.");
1447 _SearchBarImpl::OnFocusEventListenerAdded(IFocusEventListener& listener)
1450 SysTryReturnVoidResult(NID_UI,
1451 __pPublicFocusEventListeners->Add(const_cast <IFocusEventListener*>(&listener)) == E_SUCCESS, E_SYSTEM,
1452 "[E_SYSTEM] A system error has occured. Failed to add listener.");
1456 _SearchBarImpl::OnFocusEventListenerRemoved(IFocusEventListener& listener)
1459 SysTryReturnVoidResult(NID_UI,
1460 __pPublicFocusEventListeners->Remove(&listener) == E_SUCCESS, E_SYSTEM,
1461 "[E_SYSTEM] A system error has occured. Failed to remove listener.");
1465 _SearchBarImpl::OnFocusGained(const Tizen::Ui::Control& source)
1467 if (!__pSearchBar->IsFocusCallbackToBeFired())
1472 IEnumeratorT<IEventListener*>* pEnumerator = __pPublicFocusEventListeners->GetEnumeratorN();
1474 if (pEnumerator != null)
1476 while (pEnumerator->MoveNext() == E_SUCCESS)
1478 IEventListener* pListener = null;
1479 pEnumerator->GetCurrent(pListener);
1481 IFocusEventListener* pFocusEventListener = dynamic_cast <IFocusEventListener*>(pListener);
1483 if (pFocusEventListener != null )
1485 pFocusEventListener->OnFocusGained(GetPublic());
1496 _SearchBarImpl::OnFocusLost(const Tizen::Ui::Control& source)
1498 if (!__pSearchBar->IsFocusCallbackToBeFired())
1503 IEnumeratorT<IEventListener*>* pEnumerator = __pPublicFocusEventListeners->GetEnumeratorN();
1504 if (pEnumerator != null)
1506 while (pEnumerator->MoveNext() == E_SUCCESS)
1508 IEventListener* pListener = null;
1509 pEnumerator->GetCurrent(pListener);
1511 IFocusEventListener* pFocusEventListener = dynamic_cast <IFocusEventListener*>(pListener);
1513 if (pFocusEventListener != null )
1515 pFocusEventListener->OnFocusLost(GetPublic());
1526 _SearchBarImpl::OnKeyPressed(const Tizen::Ui::Control& source, Tizen::Ui::KeyCode keyCode)
1528 IEnumeratorT<IEventListener*>* pEnumerator = GetKeyEventListener()->GetEnumeratorN();
1529 if (pEnumerator != null)
1531 while (pEnumerator->MoveNext() == E_SUCCESS)
1533 IEventListener* pListener = null;
1534 pEnumerator->GetCurrent(pListener);
1536 IKeyEventListener* pKeyEventListener = dynamic_cast <IKeyEventListener*>(pListener);
1538 if (pKeyEventListener != null )
1540 pKeyEventListener->OnKeyPressed(GetPublic(), keyCode);
1551 _SearchBarImpl::OnKeyReleased(const Tizen::Ui::Control& source, Tizen::Ui::KeyCode keyCode)
1553 IEnumeratorT<IEventListener*>* pEnumerator = GetKeyEventListener()->GetEnumeratorN();
1554 if (pEnumerator != null)
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->OnKeyReleased(GetPublic(), keyCode);
1576 _SearchBarImpl::OnKeyLongPressed(const Tizen::Ui::Control& source, Tizen::Ui::KeyCode keyCode)
1578 IEnumeratorT<IEventListener*>* pEnumerator = GetKeyEventListener()->GetEnumeratorN();
1579 if (pEnumerator != null)
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->OnKeyLongPressed(GetPublic(), keyCode);
1601 _SearchBarImpl::ConvertKeypadAction(CoreKeypadAction keypadAction) const
1603 KeypadAction publicKeypadAction = KEYPAD_ACTION_SEARCH;
1604 switch (keypadAction)
1606 case CORE_KEYPAD_ACTION_ENTER:
1607 publicKeypadAction = KEYPAD_ACTION_ENTER;
1610 case CORE_KEYPAD_ACTION_GO:
1611 publicKeypadAction = KEYPAD_ACTION_GO;
1614 case CORE_KEYPAD_ACTION_NEXT:
1615 publicKeypadAction = KEYPAD_ACTION_NEXT;
1618 case CORE_KEYPAD_ACTION_SEND:
1619 publicKeypadAction = KEYPAD_ACTION_SEND;
1622 case CORE_KEYPAD_ACTION_SEARCH:
1623 publicKeypadAction = KEYPAD_ACTION_SEARCH;
1626 case CORE_KEYPAD_ACTION_LOGIN:
1627 publicKeypadAction = KEYPAD_ACTION_LOGIN;
1630 case CORE_KEYPAD_ACTION_SIGN_IN:
1631 publicKeypadAction = KEYPAD_ACTION_SIGN_IN;
1634 case CORE_KEYPAD_ACTION_JOIN:
1635 publicKeypadAction = KEYPAD_ACTION_JOIN;
1638 case CORE_KEYPAD_ACTION_DONE:
1639 publicKeypadAction = KEYPAD_ACTION_DONE;
1646 return publicKeypadAction;
1650 _SearchBarImpl::GetEditFieldImpl(void) const
1652 return __pEditFieldImpl;
1656 _SearchBarImpl::GetButtonImpl(void) const
1658 return __pButtonImpl;
1661 class _SearchBarMaker
1662 : public _UiBuilderControlMaker
1665 _SearchBarMaker(_UiBuilder* pUibuilder)
1666 : _UiBuilderControlMaker(pUibuilder){}
1667 virtual ~_SearchBarMaker(void){}
1668 static _UiBuilderControlMaker*
1669 GetInstance(_UiBuilder* pUibuilder)
1671 _SearchBarMaker* pSearchBarMaker = new (std::nothrow) _SearchBarMaker(pUibuilder);
1672 return pSearchBarMaker;
1677 Make(_UiBuilderControl* pControl)
1679 result r = E_SUCCESS;
1681 FloatRectangle rect;
1682 SearchBar* pSearchBar = null;
1683 _UiBuilderControlLayout* pControlProperty = null;
1684 bool showSearchBarButton = true;
1685 KeypadAction keypadAction = KEYPAD_ACTION_ENTER;
1687 int opacity = SEARCHBAR_DEFAULT_OPACITY;
1688 EllipsisPosition ellipsisPosition = ELLIPSIS_POSITION_END;
1691 int limitLength = SEARCHBAR_TEXT_LENGTH_MAX;
1692 int buttonActionId = -1;
1694 float searchFieldTextSize = 0.0f;
1695 bool lowercaseEnable = false;
1696 String elementString;
1698 GetProperty(pControl, &pControlProperty);
1699 if (pControlProperty == null)
1704 pSearchBar = new (std::nothrow) SearchBar;
1705 if (pSearchBar == null)
1710 rect = pControlProperty->GetRectF();
1711 if (pControl->GetElement("showSearchBarButton", elementString))
1713 if (elementString.Equals(L"false", false))
1715 showSearchBarButton = false;
1719 if (pControl->GetElement("keypadAction", elementString))
1721 if (elementString.Equals(L"KEYPAD_ACTION_ENTER", false))
1723 keypadAction = KEYPAD_ACTION_ENTER;
1725 else if (elementString.Equals(L"KEYPAD_ACTION_GO", false))
1727 keypadAction = KEYPAD_ACTION_GO;
1729 else if (elementString.Equals(L"KEYPAD_ACTION_NEXT", false))
1731 keypadAction = KEYPAD_ACTION_NEXT;
1733 else if (elementString.Equals(L"KEYPAD_ACTION_SEND", false))
1735 keypadAction = KEYPAD_ACTION_SEND;
1737 else if (elementString.Equals(L"KEYPAD_ACTION_SEARCH", false))
1739 keypadAction = KEYPAD_ACTION_SEARCH;
1741 else if (elementString.Equals(L"KEYPAD_ACTION_LOGIN", false))
1743 keypadAction = KEYPAD_ACTION_LOGIN;
1745 else if (elementString.Equals(L"KEYPAD_ACTION_SIGN_IN", false))
1747 keypadAction = KEYPAD_ACTION_SIGN_IN;
1749 else if (elementString.Equals(L"KEYPAD_ACTION_JOIN", false))
1751 keypadAction = KEYPAD_ACTION_JOIN;
1753 else if (elementString.Equals(L"KEYPAD_ACTION_DONE", false))
1755 keypadAction = KEYPAD_ACTION_DONE;
1759 r = pSearchBar->Construct(rect, showSearchBarButton, keypadAction);
1766 if (showSearchBarButton)
1768 if (pControl->GetElement("buttonActionId", elementString))
1770 Base::Integer::Parse(elementString, buttonActionId);
1773 if (pControl->GetElement("buttonText", elementString))
1775 r = pSearchBar->SetButton(elementString, buttonActionId);
1779 if (pControl->GetElement("text", elementString))
1781 r = pSearchBar->SetText(elementString);
1784 if (pControl->GetElement("guideText", elementString))
1786 r = pSearchBar->SetGuideText(elementString);
1789 if (pControl->GetElement("searchFieldTextSize", elementString))
1791 searchFieldTextSize = _LocalizedNumParser::ToDouble(elementString, "C");
1792 _ICoordinateSystemTransformer* pTransform = GetTransformer();
1793 if (pTransform != null)
1795 searchFieldTextSize = pTransform->Transform(searchFieldTextSize);
1797 r = pSearchBar->SetSearchFieldTextSize(searchFieldTextSize);
1800 if (pControl->GetElement("limitLength", elementString))
1802 Base::Integer::Parse(elementString, limitLength);
1803 r = pSearchBar->SetLimitLength(limitLength);
1806 if (pControl->GetElement("lowerCaseMode", elementString))
1808 if (elementString.Equals(L"true", false))
1810 lowercaseEnable = true;
1814 lowercaseEnable = false;
1817 pSearchBar->SetLowerCaseModeEnabled(lowercaseEnable);
1820 if (pControl->GetElement("ellipsisPosition", elementString))
1822 if (elementString.Equals(L"ELLIPSIS_POSITION_START", false))
1824 ellipsisPosition = ELLIPSIS_POSITION_START;
1826 else if (elementString.Equals(L"ELLIPSIS_POSITION_MIDDLE", false))
1828 ellipsisPosition = ELLIPSIS_POSITION_MIDDLE;
1832 ellipsisPosition = ELLIPSIS_POSITION_END;
1835 r = pSearchBar->SetEllipsisPosition(ellipsisPosition);
1838 if (pControl->GetElement("backgroundBitmapPath", elementString))
1840 Bitmap* pBackgroundBitmap = null;
1841 pBackgroundBitmap = LoadBitmapN(elementString);
1842 if (pBackgroundBitmap != null)
1844 pSearchBar->SetBackgroundBitmap(*pBackgroundBitmap);
1845 delete pBackgroundBitmap;
1849 if (pControl->GetElement("colorOpacity", elementString))
1851 Base::Integer::Parse(elementString, opacity);
1853 if (pControl->GetElement("color", elementString))
1855 ConvertStringToColor32(elementString, opacity, color);
1856 r = pSearchBar->SetColor(color);
1859 opacity = SEARCHBAR_DEFAULT_OPACITY;
1860 if (pControl->GetElement("normalButtonColor", elementString))
1862 ConvertStringToColor32(elementString, opacity, color);
1863 r = pSearchBar->SetButtonColor(SEARCH_BAR_BUTTON_STATUS_NORMAL, color);
1866 if (pControl->GetElement("normalButtonTextColor", elementString))
1868 ConvertStringToColor32(elementString, opacity, color);
1869 r = pSearchBar->SetButtonTextColor(SEARCH_BAR_BUTTON_STATUS_NORMAL, color);
1872 if (pControl->GetElement("normalSearchFieldColor", elementString))
1874 ConvertStringToColor32(elementString, opacity, color);
1875 r = pSearchBar->SetSearchFieldColor(SEARCH_FIELD_STATUS_NORMAL, color);
1878 if (pControl->GetElement("normalSearchFieldTextColor", elementString))
1880 ConvertStringToColor32(elementString, opacity, color);
1881 r = pSearchBar->SetSearchFieldTextColor(SEARCH_FIELD_STATUS_NORMAL, color);
1884 if (pControl->GetElement("disabledButtonColor", elementString))
1886 ConvertStringToColor32(elementString, opacity, color);
1887 r = pSearchBar->SetButtonColor(SEARCH_BAR_BUTTON_STATUS_DISABLED, color);
1890 if (pControl->GetElement("disabledButtonTextColor", elementString))
1892 ConvertStringToColor32(elementString, opacity, color);
1893 r = pSearchBar->SetButtonTextColor(SEARCH_BAR_BUTTON_STATUS_DISABLED, color);
1896 if (pControl->GetElement("disabledSearchFieldColor", elementString))
1898 ConvertStringToColor32(elementString, opacity, color);
1899 r = pSearchBar->SetSearchFieldColor(SEARCH_FIELD_STATUS_DISABLED, color);
1902 if (pControl->GetElement("disabledSearchFieldTextColor", elementString))
1904 ConvertStringToColor32(elementString, opacity, color);
1905 r = pSearchBar->SetSearchFieldTextColor(SEARCH_FIELD_STATUS_DISABLED, color);
1908 if (pControl->GetElement("highlightedButtonColor", elementString))
1910 ConvertStringToColor32(elementString, opacity, color);
1911 r = pSearchBar->SetButtonColor(SEARCH_BAR_BUTTON_STATUS_HIGHLIGHTED, color);
1914 if (pControl->GetElement("highlightedButtonTextColor", elementString))
1916 ConvertStringToColor32(elementString, opacity, color);
1917 r = pSearchBar->SetButtonTextColor(SEARCH_BAR_BUTTON_STATUS_HIGHLIGHTED, color);
1920 if (pControl->GetElement("highlightedSearchFieldColor", elementString))
1922 ConvertStringToColor32(elementString, opacity, color);
1923 r = pSearchBar->SetSearchFieldColor(SEARCH_FIELD_STATUS_HIGHLIGHTED, color);
1926 if (pControl->GetElement("highlightedSearchFieldTextColor", elementString))
1928 ConvertStringToColor32(elementString, opacity, color);
1929 r = pSearchBar->SetSearchFieldTextColor(SEARCH_FIELD_STATUS_HIGHLIGHTED, color);
1932 if (pControl->GetElement("pressedButtonColor", elementString))
1934 ConvertStringToColor32(elementString, opacity, color);
1935 r = pSearchBar->SetButtonColor(SEARCH_BAR_BUTTON_STATUS_PRESSED, color);
1938 if (pControl->GetElement("pressedButtonTextColor", elementString))
1940 ConvertStringToColor32(elementString, opacity, color);
1941 r = pSearchBar->SetButtonTextColor(SEARCH_BAR_BUTTON_STATUS_PRESSED, color);
1944 if (pControl->GetElement("guideTextColor", elementString))
1946 ConvertStringToColor32(elementString, opacity, color);
1947 r = pSearchBar->SetGuideTextColor(color);
1950 if (pControl->GetElement(L"accessibilityHint", elementString))
1952 AccessibilityContainer* pContainer = pSearchBar->GetAccessibilityContainer();
1953 if (pContainer != null)
1955 AccessibilityElement* pElement = pContainer->GetElement(L"EditText");
1956 if (pElement != null)
1958 pElement->SetHint(elementString);
1967 _SearchBarRegister::_SearchBarRegister(void)
1969 _UiBuilderControlTableManager* pUiBuilderControlTableManager = _UiBuilderControlTableManager::GetInstance();
1970 pUiBuilderControlTableManager->RegisterControl(L"SearchBar", _SearchBarMaker::GetInstance);
1973 _SearchBarRegister::~_SearchBarRegister(void)
1975 _UiBuilderControlTableManager* pUiBuilderControlTableManager = _UiBuilderControlTableManager::GetInstance();
1976 pUiBuilderControlTableManager->UnregisterControl(L"SearchBar");
1978 static _SearchBarRegister SearchBarRegisterToUiBuilder;
1979 }}} // Tizen::Ui::Controls