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 <FLclLocale.h>
26 #include <FUiAccessibilityContainer.h>
27 #include <FUiAccessibilityElement.h>
28 #include "FUi_ResourceSizeInfo.h"
29 #include "FUi_ResourceManager.h"
30 #include "FUi_UiBuilder.h"
31 #include "FUiCtrl_PublicActionEvent.h"
32 #include "FUiCtrl_PublicTextBlockEvent.h"
33 #include "FUiCtrl_PublicTextEvent.h"
34 #include "FUiCtrl_SearchBarImpl.h"
35 #include "FUi_CoordinateSystemUtils.h"
36 #include "FUiCtrl_EditFieldImpl.h"
37 #include "FUiCtrl_ButtonImpl.h"
39 using namespace Tizen::App;
40 using namespace Tizen::Base;
41 using namespace Tizen::Base::Runtime;
42 using namespace Tizen::Locales;
43 using namespace Tizen::Graphics;
44 using namespace Tizen::Ui;
46 namespace Tizen { namespace Ui { namespace Controls
49 _SearchBarImpl::_SearchBarImpl(SearchBar* pPublic, _SearchBar* pCore)
50 : _ControlImpl(pPublic, pCore)
54 , __pContentControl(null)
55 , __pPublicActionEvent(null)
56 , __pPublicKeypadEvent(null)
57 , __pPublicTextBlockEvent(null)
58 , __pPublicTextEvent(null)
59 , __pPublicSearchBarEvent(null)
60 , __pPublicLanguageEvent(null)
61 , __pPublicFocusEventListeners(null)
66 _SearchBarImpl::~_SearchBarImpl(void)
73 if (__pPublicActionEvent)
75 delete __pPublicActionEvent;
76 __pPublicActionEvent = null;
79 if (__pPublicKeypadEvent)
81 delete __pPublicKeypadEvent;
82 __pPublicKeypadEvent = null;
85 if (__pPublicTextBlockEvent)
87 delete __pPublicTextBlockEvent;
88 __pPublicTextBlockEvent = null;
91 if (__pPublicTextEvent)
93 delete __pPublicTextEvent;
94 __pPublicTextEvent = null;
97 if (__pPublicSearchBarEvent)
99 delete __pPublicSearchBarEvent;
100 __pPublicSearchBarEvent = null;
105 if (__pSearchBar->GetClippedGroupControl())
107 _Control* pControl = __pSearchBar->GetClippedGroupControl();
108 pControl->DetachAllChildren();
124 if (__pPublicFocusEventListeners)
126 delete __pPublicFocusEventListeners;
127 __pPublicFocusEventListeners = null;
132 _SearchBarImpl::CreateSearchBarImplN(SearchBar* pControl, const Rectangle& bounds, bool enableSearchBarButton, KeypadAction keypadAction)
135 result r = E_SUCCESS;
137 r = GET_SIZE_INFO(SearchBar).CheckInitialSizeValid(Dimension(bounds.width, bounds.height), _CONTROL_ORIENTATION_PORTRAIT);
138 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, null, E_INVALID_ARG,
139 "[E_INVALID_ARG] Invalid argument(s) is used. The given size is not valid.");
141 _SearchBar* pCore = _SearchBar::CreateSearchBarN();
143 SysTryReturn(NID_UI_CTRL, pCore != null, null, r, "[%s] Propagating.", GetErrorMessage(r));
145 _SearchBarImpl* pImpl = new (std::nothrow) _SearchBarImpl(pControl, pCore);
147 r = CheckConstruction(pCore, pImpl);
148 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
150 r = pImpl->InitializeBoundsProperties(GET_SIZE_INFO(SearchBar), bounds, pCore->GetOrientation());
151 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
153 r = pImpl->Initialize(enableSearchBarButton, keypadAction);
154 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
163 _SearchBarImpl::CreateSearchBarImplFN(SearchBar* pControl, const FloatRectangle& bounds, bool enableSearchBarButton, KeypadAction keypadAction)
166 result r = E_SUCCESS;
168 r = GET_SIZE_INFO(SearchBar).CheckInitialSizeValidF(FloatDimension(bounds.width, bounds.height), _CONTROL_ORIENTATION_PORTRAIT);
169 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, null, E_INVALID_ARG,
170 "[E_INVALID_ARG] Invalid argument(s) is used. The given size is not valid.");
172 _SearchBar* pCore = _SearchBar::CreateSearchBarN();
174 SysTryReturn(NID_UI_CTRL, pCore != null, null, r, "[%s] Propagating.", GetErrorMessage(r));
176 _SearchBarImpl* pImpl = new (std::nothrow) _SearchBarImpl(pControl, pCore);
178 r = CheckConstruction(pCore, pImpl);
179 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
181 r = pImpl->InitializeBoundsPropertiesF(GET_SIZE_INFO(SearchBar), bounds, pCore->GetOrientation());
182 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
184 r = pImpl->Initialize(enableSearchBarButton, keypadAction);
185 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
194 _SearchBarImpl::GetPublicClassName(void) const
196 return "Tizen::Ui::Controls::SearchBar";
200 _SearchBarImpl::GetPublic(void) const
202 return static_cast <const SearchBar&>(_ControlImpl::GetPublic());
206 _SearchBarImpl::GetPublic(void)
208 return static_cast <SearchBar&>(_ControlImpl::GetPublic());
212 _SearchBarImpl::GetCore(void) const
214 return static_cast <const _SearchBar&>(_ControlImpl::GetCore());
218 _SearchBarImpl::GetCore(void)
220 return static_cast <_SearchBar&>(_ControlImpl::GetCore());
224 _SearchBarImpl::GetInstance(SearchBar& searchBar)
226 return (static_cast<_SearchBarImpl*>(searchBar._pControlImpl));
229 const _SearchBarImpl*
230 _SearchBarImpl::GetInstance(const SearchBar& searchBar)
232 return (static_cast<const _SearchBarImpl*>(searchBar._pControlImpl));
237 _SearchBarImpl::Initialize(bool enableSearchBarButton, KeypadAction keypadAction)
241 result r = E_SUCCESS;
243 CoreKeypadAction coreKeypadAction = CORE_KEYPAD_ACTION_SEARCH;
244 switch (keypadAction)
246 case KEYPAD_ACTION_ENTER:
247 coreKeypadAction = CORE_KEYPAD_ACTION_ENTER;
250 case KEYPAD_ACTION_GO:
251 coreKeypadAction = CORE_KEYPAD_ACTION_GO;
254 case KEYPAD_ACTION_NEXT:
255 coreKeypadAction = CORE_KEYPAD_ACTION_NEXT;
258 case KEYPAD_ACTION_SEND:
259 coreKeypadAction = CORE_KEYPAD_ACTION_SEND;
262 case KEYPAD_ACTION_SEARCH:
263 coreKeypadAction = CORE_KEYPAD_ACTION_SEARCH;
266 case KEYPAD_ACTION_LOGIN:
267 coreKeypadAction = CORE_KEYPAD_ACTION_LOGIN;
270 case KEYPAD_ACTION_SIGN_IN:
271 coreKeypadAction = CORE_KEYPAD_ACTION_SIGN_IN;
274 case KEYPAD_ACTION_JOIN:
275 coreKeypadAction = CORE_KEYPAD_ACTION_JOIN;
278 case KEYPAD_ACTION_DONE:
279 coreKeypadAction = CORE_KEYPAD_ACTION_DONE;
286 __pEditField = new (std::nothrow) EditField();
287 SysTryReturnResult(NID_UI_CTRL, __pEditField, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Failed to allocate memory.");
289 r = __pEditField->Construct(GetBoundsF(), EDIT_FIELD_STYLE_NORMAL, INPUT_STYLE_OVERLAY, EDIT_FIELD_TITLE_STYLE_NONE, true);
290 SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
292 __pEditField->AddFocusEventListener(*this);
293 SysTryReturnResult(NID_UI_CTRL, GetLastResult() == E_SUCCESS, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
295 __pEditField->AddKeyEventListener(*this);
296 SysTryReturnResult(NID_UI_CTRL, GetLastResult() == E_SUCCESS, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
298 __pEditFieldImpl = _EditFieldImpl::GetInstance(*__pEditField);
299 SysTryReturnResult(NID_UI_CTRL, __pEditFieldImpl != null, E_SYSTEM,
300 "[E_SYSTEM] A system error has occured. Failed to EditFieldImpl instance");
302 String cancelButtonText;
303 GET_STRING_CONFIG(IDS_TPLATFORM_BUTTON_CANCEL_ABB, cancelButtonText);
305 __pButton = new (std::nothrow) Button();
306 SysTryReturnResult(NID_UI_CTRL, __pButton, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Failed to allocate memory.");
308 r = __pButton->Construct(GetBoundsF(), cancelButtonText);
309 SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
311 __pButton->AddFocusEventListener(*this);
312 SysTryReturnResult(NID_UI_CTRL, GetLastResult() == E_SUCCESS, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
314 __pButtonImpl = _ButtonImpl::GetInstance(*__pButton);
315 SysTryReturnResult(NID_UI_CTRL, __pButtonImpl != null, E_SYSTEM,
316 "[E_SYSTEM] A system error has occured. Failed to ButtonImpl instance");
318 r = __pSearchBar->Initialize(enableSearchBarButton, coreKeypadAction);
319 SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "Propagating.");
321 __pPublicActionEvent = _PublicActionEvent::CreateInstanceN(GetPublic());
323 SysTryReturn(NID_UI_CTRL, __pPublicActionEvent, r, r, "[%s] Propagating.", GetErrorMessage(r));
325 r = __pSearchBar->AddActionEventListener(*this);
326 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
328 __pPublicKeypadEvent = _PublicKeypadEvent::CreateInstanceN(GetPublic());
330 SysTryReturn(NID_UI_CTRL, __pPublicKeypadEvent, r, r, "[%s] Propagating.", GetErrorMessage(r));
332 r = __pSearchBar->AddKeypadEventListener(*this);
333 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
335 __pPublicTextBlockEvent = _PublicTextBlockEvent::CreateInstanceN(GetPublic());
337 SysTryReturn(NID_UI_CTRL, __pPublicTextBlockEvent, r, r, "[%s] Propagating.", GetErrorMessage(r));
339 r = __pSearchBar->AddTextBlockEventListener(*this);
340 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
342 __pPublicTextEvent = _PublicTextEvent::CreateInstanceN(GetPublic());
344 SysTryReturn(NID_UI_CTRL, __pPublicTextEvent, r, r, "[%s] Propagating.", GetErrorMessage(r));
346 r = __pSearchBar->AddTextEventListener(*this);
347 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
349 __pPublicSearchBarEvent = _PublicSearchBarEvent::CreateInstanceN(GetPublic());
351 SysTryReturn(NID_UI_CTRL, __pPublicSearchBarEvent, r, r, "[%s] Propagating.", GetErrorMessage(r));
353 r = __pSearchBar->AddSearchBarEventListener(*this);
354 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
356 __pPublicLanguageEvent = _PublicLanguageEvent::CreateInstanceN(GetPublic());
358 SysTryReturn(NID_UI_CTRL, __pPublicLanguageEvent, r, r, "[%s] Propagating.", GetErrorMessage(r));
360 r = __pSearchBar->AddLanguageEventListener(*this);
361 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
363 __pPublicFocusEventListeners = CreatePublicEventListenerListN();
365 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
371 _SearchBarImpl::GetContent(void) const
375 return __pContentControl;
379 _SearchBarImpl::SetContent(const Control* pContent)
383 result r = E_SUCCESS;
384 if (pContent != null)
386 const _Control& content = _ControlImpl::GetInstance(*pContent)->GetCore();
387 bool isContentAttachable = __pSearchBar->IsContentAttachable(&content);
388 SysTryReturn(NID_UI_CTRL, isContentAttachable, E_INVALID_ARG, E_INVALID_ARG,
389 "[E_INVALID_ARG] Invalid argument(s) is used. The content cannot be set.");
392 if (pContent != null && __pContentControl == null)
394 __pContentControl = const_cast <Control*>(pContent);
395 _Control& control = _ControlImpl::GetInstance(*__pContentControl)->GetCore();
397 r = __pSearchBar->SetContent(&control);
404 _SearchBarImpl::UpdateContentArea(bool invalidate)
408 return __pSearchBar->UpdateContentArea(invalidate);
412 _SearchBarImpl::SetContentAreaVisible(bool visible)
416 return __pSearchBar->SetContentAreaVisible(visible, true);
420 _SearchBarImpl::IsContentAreaVisible(void) const
424 return __pSearchBar->IsContentAreaVisible();
428 _SearchBarImpl::SetContentAreaSize(const Dimension& size)
432 FloatDimension contentSize;
433 contentSize = _CoordinateSystemUtils::ConvertToFloat(size);
434 Variant var(contentSize);
436 return __pSearchBar->SetPropertyContentAreaSize(var);
440 _SearchBarImpl::SetContentAreaSize(const FloatDimension& size)
445 return __pSearchBar->SetPropertyContentAreaSize(var);
449 _SearchBarImpl::GetContentAreaSize(void) const
454 size = _CoordinateSystemUtils::ConvertToInteger(__pSearchBar->GetPropertyContentAreaSize().ToFloatDimension());
460 _SearchBarImpl::GetContentAreaSizeF(void) const
464 return __pSearchBar->GetPropertyContentAreaSize().ToFloatDimension();
468 _SearchBarImpl::GetMode(void) const
472 return __pSearchBar->GetMode();
476 _SearchBarImpl::IsModeLocked(void) const
480 return __pSearchBar->IsModeLocked();
484 _SearchBarImpl::SetMode(SearchBarMode mode)
488 return __pSearchBar->SetMode(mode);
492 _SearchBarImpl::SetModeLocked(bool modeLocked)
496 return __pSearchBar->SetModeLocked(modeLocked);
500 _SearchBarImpl::GetButtonActionId(void) const
504 return __pSearchBar->GetPropertyButtonActionId().ToInt();
508 _SearchBarImpl::GetButtonColor(SearchBarButtonStatus status) const
516 case SEARCH_BAR_BUTTON_STATUS_NORMAL:
517 buttonColor = __pSearchBar->GetPropertyButtonNormalColor();
519 case SEARCH_BAR_BUTTON_STATUS_PRESSED:
520 buttonColor = __pSearchBar->GetPropertyButtonPressedColor();
522 case SEARCH_BAR_BUTTON_STATUS_HIGHLIGHTED:
523 buttonColor = __pSearchBar->GetPropertyButtonHighlightedColor();
525 case SEARCH_BAR_BUTTON_STATUS_DISABLED:
526 buttonColor = __pSearchBar->GetPropertyButtonDisabledColor();
532 return buttonColor.ToColor();
536 _SearchBarImpl::GetButtonTextColor(SearchBarButtonStatus status) const
540 Variant buttonTextColor;
544 case SEARCH_BAR_BUTTON_STATUS_NORMAL:
545 buttonTextColor = __pSearchBar->GetPropertyButtonNormalTextColor();
547 case SEARCH_BAR_BUTTON_STATUS_PRESSED:
548 buttonTextColor = __pSearchBar->GetPropertyButtonPressedTextColor();
550 case SEARCH_BAR_BUTTON_STATUS_HIGHLIGHTED:
551 buttonTextColor = __pSearchBar->GetPropertyButtonHighlightedTextColor();
553 case SEARCH_BAR_BUTTON_STATUS_DISABLED:
554 buttonTextColor = __pSearchBar->GetPropertyButtonDisabledTextColor();
560 return buttonTextColor.ToColor();
563 SearchBarButtonStatus
564 _SearchBarImpl::GetButtonStatus(void) const
568 return __pSearchBar->GetButtonStatus();
572 _SearchBarImpl::SetButton(const String& text, int actionId)
576 result r = E_SUCCESS;
577 Variant var(actionId);
579 r = __pSearchBar->SetButtonText(text);
580 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
582 r = __pSearchBar->SetPropertyButtonActionId(var);
588 _SearchBarImpl::SetButtonEnabled(bool enabled)
592 return __pSearchBar->SetButtonEnabled(enabled);
596 _SearchBarImpl::SetButtonColor(SearchBarButtonStatus status, const Color& color)
600 result r = E_SUCCESS;
605 case SEARCH_BAR_BUTTON_STATUS_NORMAL:
606 r = __pSearchBar->SetPropertyButtonNormalColor(var);
608 case SEARCH_BAR_BUTTON_STATUS_PRESSED:
609 r = __pSearchBar->SetPropertyButtonPressedColor(var);
611 case SEARCH_BAR_BUTTON_STATUS_HIGHLIGHTED:
612 r = __pSearchBar->SetPropertyButtonHighlightedColor(var);
614 case SEARCH_BAR_BUTTON_STATUS_DISABLED:
615 r = __pSearchBar->SetPropertyButtonDisabledColor(var);
625 _SearchBarImpl::SetButtonTextColor(SearchBarButtonStatus status, const Color& color)
629 result r = E_SUCCESS;
634 case SEARCH_BAR_BUTTON_STATUS_NORMAL:
635 r = __pSearchBar->SetPropertyButtonNormalTextColor(var);
637 case SEARCH_BAR_BUTTON_STATUS_PRESSED:
638 r = __pSearchBar->SetPropertyButtonPressedTextColor(var);
640 case SEARCH_BAR_BUTTON_STATUS_HIGHLIGHTED:
641 r = __pSearchBar->SetPropertyButtonHighlightedTextColor(var);
643 case SEARCH_BAR_BUTTON_STATUS_DISABLED:
644 r = __pSearchBar->SetPropertyButtonDisabledTextColor(var);
654 _SearchBarImpl::AppendCharacter(const Character& character)
658 return __pSearchBar->AppendCharacter(character);
662 _SearchBarImpl::AppendText(const String& text)
666 return __pSearchBar->AppendText(text);
670 _SearchBarImpl::SetText(const String& text)
674 return __pSearchBar->SetText(text);
678 _SearchBarImpl::InsertCharacterAt(int index, const Character& character)
682 return __pSearchBar->InsertCharacterAt(index, character);
686 _SearchBarImpl::InsertTextAt(int index, const String& text)
690 return __pSearchBar->InsertTextAt(index, text);
694 _SearchBarImpl::DeleteCharacterAt(int index)
698 return __pSearchBar->DeleteCharacterAt(index);
702 _SearchBarImpl::Clear(void)
706 result r = E_SUCCESS;
707 r = __pSearchBar->Clear();
709 SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, E_SYSTEM,
710 "[E_SYSTEM] A system error has occured. Failed to clear the text.");
715 _SearchBarImpl::GetTextLength(void) const
719 return __pSearchBar->GetTextLength();
723 _SearchBarImpl::GetText(void) const
727 return __pSearchBar->GetText();
731 _SearchBarImpl::GetText(int start, int end) const
735 return __pSearchBar->GetText(start, end);
739 _SearchBarImpl::GetLimitLength(void) const
743 return __pSearchBar->GetLimitLength();
747 _SearchBarImpl::SetLimitLength(int limitLength)
751 return __pSearchBar->SetLimitLength(limitLength);
755 _SearchBarImpl::ShowKeypad(void) const
759 return __pSearchBar->ShowKeypad();
763 _SearchBarImpl::HideKeypad(void) const
767 return __pSearchBar->HideKeypad();
771 _SearchBarImpl::GetSearchFieldTextSize(void) const
775 int textSize = _CoordinateSystemUtils::ConvertToInteger(__pSearchBar->GetSearchFieldTextSizeF());
780 _SearchBarImpl::GetSearchFieldTextSizeF(void) const
784 return __pSearchBar->GetSearchFieldTextSizeF();
788 _SearchBarImpl::SetSearchFieldTextSize(int size)
792 float textSize = _CoordinateSystemUtils::ConvertToFloat(size);
793 return SetSearchFieldTextSize(textSize);
797 _SearchBarImpl::SetSearchFieldTextSize(float size)
801 return __pSearchBar->SetSearchFieldTextSize(size);
805 _SearchBarImpl::GetBlockRange(int& start, int& end) const
809 return __pSearchBar->GetBlockRange(start, end);
813 _SearchBarImpl::ReleaseBlock(void)
817 return __pSearchBar->ReleaseBlock();
821 _SearchBarImpl::SetBlockRange(int start, int end)
825 return __pSearchBar->SetBlockRange(start, end + 1);
829 _SearchBarImpl::RemoveTextBlock(void)
832 result r = __pSearchBar->RemoveTextBlock();
833 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, E_SYSTEM, E_SYSTEM,
834 "[E_SYSTEM] A system error has occured. Unable to remove the text block.");
840 _SearchBarImpl::GetColor(void) const
844 return __pSearchBar->GetPropertyColor().ToColor();
848 _SearchBarImpl::GetSearchFieldColor(SearchFieldStatus status) const
852 Variant searchFieldColor;
856 case SEARCH_FIELD_STATUS_NORMAL:
857 searchFieldColor = __pSearchBar->GetPropertySearchFieldNormalColor();
859 case SEARCH_FIELD_STATUS_HIGHLIGHTED:
860 searchFieldColor = __pSearchBar->GetPropertySearchFieldHighlightedColor();
862 case SEARCH_FIELD_STATUS_DISABLED:
863 searchFieldColor = __pSearchBar->GetPropertySearchFieldDisabledColor();
869 return searchFieldColor.ToColor();
873 _SearchBarImpl::GetSearchFieldTextColor(SearchFieldStatus status) const
878 _Edit* pEdit = __pSearchBar->GetSearchField();
883 case SEARCH_FIELD_STATUS_NORMAL:
884 color = pEdit->GetTextColor(EDIT_TEXT_COLOR_NORMAL);
886 case SEARCH_FIELD_STATUS_HIGHLIGHTED:
887 color = pEdit->GetTextColor(EDIT_TEXT_COLOR_HIGHLIGHTED);
889 case SEARCH_FIELD_STATUS_DISABLED:
890 color = pEdit->GetTextColor(EDIT_TEXT_COLOR_DISABLED);
900 _SearchBarImpl::SetBackgroundBitmap(const Bitmap& bitmap)
904 return __pSearchBar->SetBackgroundBitmap(bitmap);
908 _SearchBarImpl::SetColor(const Color& color)
914 return __pSearchBar->SetPropertyColor(var);
918 _SearchBarImpl::SetSearchFieldColor(SearchFieldStatus status, const Color& color)
922 result r = E_SUCCESS;
927 case SEARCH_FIELD_STATUS_NORMAL:
928 r = __pSearchBar->SetPropertySearchFieldNormalColor(var);
930 case SEARCH_FIELD_STATUS_HIGHLIGHTED:
931 r = __pSearchBar->SetPropertySearchFieldHighlightedColor(var);
933 case SEARCH_FIELD_STATUS_DISABLED:
934 r = __pSearchBar->SetPropertySearchFieldDisabledColor(var);
944 _SearchBarImpl::SetSearchFieldTextColor(SearchFieldStatus status, const Color& color)
948 result r = E_SUCCESS;
949 _Edit* pEdit = __pSearchBar->GetSearchField();
954 case SEARCH_FIELD_STATUS_NORMAL:
955 r = pEdit->SetTextColor(EDIT_TEXT_COLOR_NORMAL, color);
957 case SEARCH_FIELD_STATUS_HIGHLIGHTED:
958 r = pEdit->SetTextColor(EDIT_TEXT_COLOR_HIGHLIGHTED, color);
960 case SEARCH_FIELD_STATUS_DISABLED:
961 r = pEdit->SetTextColor(EDIT_TEXT_COLOR_DISABLED, color);
972 _SearchBarImpl::GetGuideText(void) const
976 return __pSearchBar->GetGuideText();
980 _SearchBarImpl::SetGuideText(const String& guideText)
984 return __pSearchBar->SetGuideText(guideText);
988 _SearchBarImpl::GetGuideTextColor(void) const
992 return __pSearchBar->GetGuideTextColor();
996 _SearchBarImpl::SetGuideTextColor(const Color& color)
1000 return __pSearchBar->SetGuideTextColor(color);
1004 _SearchBarImpl::GetCursorPosition(void) const
1008 return __pSearchBar->GetCursorPosition();
1012 _SearchBarImpl::SetCursorPosition(int index)
1016 return __pSearchBar->SetCursorPosition(index);
1020 _SearchBarImpl::IsLowerCaseModeEnabled(void) const
1024 return __pSearchBar->IsLowerCaseModeEnabled();
1028 _SearchBarImpl::SetLowerCaseModeEnabled(bool enable)
1032 return __pSearchBar->SetLowerCaseModeEnabled(enable);
1036 _SearchBarImpl::GetEllipsisPosition(void) const
1040 return __pSearchBar->GetEllipsisPosition();
1044 _SearchBarImpl::SetEllipsisPosition(EllipsisPosition position)
1048 return __pSearchBar->SetEllipsisPosition(position);
1052 _SearchBarImpl::GetKeypadAction(void) const
1056 CoreKeypadAction coreKeypadAction = __pSearchBar->GetKeypadAction();
1057 KeypadAction publicKeypadAction = ConvertKeypadAction(coreKeypadAction);
1059 return publicKeypadAction;
1063 _SearchBarImpl::IsTextPredictionEnabled(void) const
1065 return __pSearchBar->IsTextPredictionEnabled();
1069 _SearchBarImpl::SetTextPredictionEnabled(bool enable)
1071 return __pSearchBar->SetTextPredictionEnabled(enable);
1075 _SearchBarImpl::SetCurrentLanguage(LanguageCode languageCode)
1077 return __pSearchBar->SetCurrentLanguage(languageCode);
1081 _SearchBarImpl::GetCurrentLanguage(LanguageCode& language) const
1083 return __pSearchBar->GetCurrentLanguage(language);
1087 _SearchBarImpl::AddActionEventListener(IActionEventListener& listener)
1091 SysTryReturn(NID_UI_CTRL, __pPublicActionEvent, E_SYSTEM, E_SYSTEM,
1092 "[E_SYSTEM] A system error has occurred.");
1094 result r = __pPublicActionEvent->AddListener(listener);
1095 SysTryReturnResult(NID_UI_CTRL, r != E_OBJ_ALREADY_EXIST, E_SYSTEM,
1096 "A system error has occurred. The same listener instance already exists in the event listener list.");
1101 _SearchBarImpl::RemoveActionEventListener(IActionEventListener& listener)
1105 SysTryReturn(NID_UI_CTRL, __pPublicActionEvent, E_SYSTEM, E_SYSTEM,
1106 "[E_SYSTEM] A system error has occurred.");
1108 result r = __pPublicActionEvent->RemoveListener(listener);
1109 SysTryReturnResult(NID_UI_CTRL, r != E_OBJ_NOT_FOUND, E_SYSTEM,
1110 "A system error has occurred. The specified listener does not exist in the event listener list.");
1115 _SearchBarImpl::AddKeypadEventListener(IKeypadEventListener& listener)
1119 SysTryReturn(NID_UI_CTRL, __pPublicKeypadEvent, E_SYSTEM, E_SYSTEM,
1120 "[E_SYSTEM] A system error has occurred.");
1122 result r = __pPublicKeypadEvent->AddListener(listener);
1123 SysTryReturnResult(NID_UI_CTRL, r != E_OBJ_ALREADY_EXIST, E_SYSTEM,
1124 "A system error has occurred. The same listener instance already exists in the event listener list.");
1130 _SearchBarImpl::RemoveKeypadEventListener(IKeypadEventListener& listener)
1134 SysTryReturn(NID_UI_CTRL, __pPublicKeypadEvent, E_SYSTEM, E_SYSTEM,
1135 "[E_SYSTEM] A system error has occurred.");
1137 result r = __pPublicKeypadEvent->RemoveListener(listener);
1138 SysTryReturnResult(NID_UI_CTRL, r != E_OBJ_NOT_FOUND, E_SYSTEM,
1139 "A system error has occurred. The specified listener does not exist in the event listener list.");
1145 _SearchBarImpl::AddTextBlockEventListener(ITextBlockEventListener& listener)
1149 SysTryReturn(NID_UI_CTRL, __pPublicTextBlockEvent, E_SYSTEM, E_SYSTEM,
1150 "[E_SYSTEM] A system error has occurred.");
1152 result r = __pPublicTextBlockEvent->AddListener(listener);
1153 SysTryReturnResult(NID_UI_CTRL, r != E_OBJ_ALREADY_EXIST, E_SYSTEM,
1154 "A system error has occurred. The same listener instance already exists in the event listener list.");
1160 _SearchBarImpl::RemoveTextBlockEventListener(ITextBlockEventListener& listener)
1164 SysTryReturn(NID_UI_CTRL, __pPublicTextBlockEvent, E_SYSTEM, E_SYSTEM,
1165 "[E_SYSTEM] A system error has occurred.");
1167 result r = __pPublicTextBlockEvent->RemoveListener(listener);
1168 SysTryReturnResult(NID_UI_CTRL, r != E_OBJ_NOT_FOUND, E_SYSTEM,
1169 "A system error has occurred. The specified listener does not exist in the event listener list.");
1176 _SearchBarImpl::AddTextEventListener(ITextEventListener& listener)
1180 SysTryReturn(NID_UI_CTRL, __pPublicTextEvent, E_SYSTEM, E_SYSTEM,
1181 "[E_SYSTEM] A system error has occurred.");
1183 result r = __pPublicTextEvent->AddListener(listener);
1184 SysTryReturnResult(NID_UI_CTRL, r != E_OBJ_ALREADY_EXIST, E_SYSTEM,
1185 "A system error has occurred. The same listener instance already exists in the event listener list.");
1191 _SearchBarImpl::RemoveTextEventListener(ITextEventListener& listener)
1195 SysTryReturn(NID_UI_CTRL, __pPublicTextEvent, E_SYSTEM, E_SYSTEM,
1196 "[E_SYSTEM] A system error has occurred.");
1198 result r = __pPublicTextEvent->RemoveListener(listener);
1199 SysTryReturnResult(NID_UI_CTRL, r != E_OBJ_NOT_FOUND, E_SYSTEM,
1200 "A system error has occurred. The specified listener does not exist in the event listener list.");
1206 _SearchBarImpl::AddSearchBarEventListener(const ISearchBarEventListener& listener)
1210 SysTryReturn(NID_UI_CTRL, __pPublicSearchBarEvent, E_SYSTEM, E_SYSTEM,
1211 "[E_SYSTEM] A system error has occurred.");
1213 result r = __pPublicSearchBarEvent->AddListener(listener);
1214 SysTryReturnResult(NID_UI_CTRL, r != E_OBJ_ALREADY_EXIST, E_SYSTEM,
1215 "A system error has occurred. The same listener instance already exists in the event listener list.");
1221 _SearchBarImpl::RemoveSearchBarEventListener(const ISearchBarEventListener& listener)
1225 SysTryReturn(NID_UI_CTRL, __pPublicSearchBarEvent, E_SYSTEM, E_SYSTEM,
1226 "[E_SYSTEM] A system error has occurred.");
1228 result r = __pPublicSearchBarEvent->RemoveListener(listener);
1229 SysTryReturnResult(NID_UI_CTRL, r != E_OBJ_NOT_FOUND, E_SYSTEM,
1230 "A system error has occurred. The specified listener does not exist in the event listener list.");
1236 _SearchBarImpl::AddLanguageEventListener(ILanguageEventListener& listener)
1240 SysAssertf(__pPublicLanguageEvent != null, "Not yet constructed. Construct() should be called before use.");
1242 return __pPublicLanguageEvent->AddListener(listener);
1246 _SearchBarImpl::RemoveLanguageEventListener(ILanguageEventListener& listener)
1250 SysAssertf(__pPublicLanguageEvent != null, "Not yet constructed. Construct() should be called before use.");
1252 return __pPublicLanguageEvent->RemoveListener(listener);
1256 _SearchBarImpl::SetEditTextFilter(IEditTextFilter* pFilter)
1258 __pSearchBar->SetEditTextFilter(pFilter);
1264 _SearchBarImpl::SendOpaqueCommand (const String& command)
1266 __pSearchBar->SendOpaqueCommand(command);
1272 _SearchBarImpl::OnActionPerformed(const _Control& source, int actionId)
1276 if (__pPublicActionEvent != null)
1278 IEventArg* pEventArg = _PublicActionEvent::CreateActionEventArgN(actionId);
1279 result r = GetLastResult();
1280 SysTryReturnVoidResult(NID_UI_CTRL, pEventArg, r, "[%s] Propagating.", GetErrorMessage(r));
1282 __pPublicActionEvent->Fire(*pEventArg);
1288 _SearchBarImpl::OnKeypadWillOpen(void)
1292 if (__pPublicKeypadEvent != null)
1294 IEventArg* pEventArg = _PublicKeypadEvent::CreateKeypadEventArgN(
1295 GetPublic(), KEYPAD_ACTION_SEARCH, KEYPAD_EVENT_STATUS_CREATED);
1296 result r = GetLastResult();
1297 SysTryReturnVoidResult(NID_UI_CTRL, pEventArg, r, "[%s] Propagating.", GetErrorMessage(r));
1299 __pPublicKeypadEvent->Fire(*pEventArg);
1305 _SearchBarImpl::OnKeypadOpened(void)
1309 if (__pPublicKeypadEvent != null)
1311 IEventArg* pEventArg = _PublicKeypadEvent::CreateKeypadEventArgN(
1312 GetPublic(), KEYPAD_ACTION_SEARCH, KEYPAD_EVENT_STATUS_OPEN);
1313 result r = GetLastResult();
1314 SysTryReturnVoidResult(NID_UI_CTRL, pEventArg, r, "[%s] Propagating.", GetErrorMessage(r));
1316 __pPublicKeypadEvent->Fire(*pEventArg);
1323 _SearchBarImpl::OnKeypadClosed(void)
1327 if (__pPublicKeypadEvent != null)
1329 IEventArg* pEventArg = _PublicKeypadEvent::CreateKeypadEventArgN(
1330 GetPublic(), KEYPAD_ACTION_SEARCH, KEYPAD_EVENT_STATUS_CLOSE);
1331 result r = GetLastResult();
1332 SysTryReturnVoidResult(NID_UI_CTRL, pEventArg, r, "[%s] Propagating.", GetErrorMessage(r));
1334 __pPublicKeypadEvent->Fire(*pEventArg);
1340 _SearchBarImpl::OnKeypadBoundsChanged(void)
1344 if (__pPublicKeypadEvent != null)
1346 IEventArg* pEventArg = _PublicKeypadEvent::CreateKeypadEventArgN(
1347 GetPublic(), KEYPAD_ACTION_SEARCH, KEYPAD_EVENT_STATUS_BOUNDS_CHANGED);
1348 result r = GetLastResult();
1349 SysTryReturnVoidResult(NID_UI_CTRL, pEventArg, r, "[%s] Propagating.", GetErrorMessage(r));
1351 __pPublicKeypadEvent->Fire(*pEventArg);
1357 _SearchBarImpl::OnKeypadActionPerformed(CoreKeypadAction keypadAction)
1361 if (__pPublicKeypadEvent != null)
1363 KeypadAction publicKeypadAction = ConvertKeypadAction(keypadAction);
1365 IEventArg* pEventArg = _PublicKeypadEvent::CreateKeypadEventArgN(
1366 GetPublic(), publicKeypadAction, KEYPAD_EVENT_STATUS_ENTERACTION);
1367 result r = GetLastResult();
1368 SysTryReturnVoidResult(NID_UI_CTRL, pEventArg, r, "[%s] Propagating.", GetErrorMessage(r));
1370 __pPublicKeypadEvent->Fire(*pEventArg);
1376 _SearchBarImpl::OnTextBlockSelected(_Control& source, int start, int end)
1380 if (__pPublicTextBlockEvent != null)
1382 IEventArg* pEventArg = _PublicTextBlockEvent::CreateTextBlockEventArgN(start, end);
1383 result r = GetLastResult();
1384 SysTryReturnVoidResult(NID_UI_CTRL, pEventArg, r, "[%s] Propagating.", GetErrorMessage(r));
1386 __pPublicTextBlockEvent->Fire(*pEventArg);
1392 _SearchBarImpl::OnTextValueChanged(const _Control& source)
1396 if (__pPublicTextEvent != null)
1398 IEventArg* pEventArg = _PublicTextEvent::CreateTextEventArgN(TEXT_EVENT_CHANGED);
1399 result r = GetLastResult();
1400 SysTryReturnVoidResult(NID_UI_CTRL, pEventArg, r, "[%s] Propagating.", GetErrorMessage(r));
1402 __pPublicTextEvent->Fire(*pEventArg);
1408 _SearchBarImpl::OnTextValueChangeCanceled(const _Control& source)
1412 if (__pPublicTextEvent != null)
1414 IEventArg* pEventArg = _PublicTextEvent::CreateTextEventArgN(TEXT_EVENT_CANCELED);
1415 result r = GetLastResult();
1416 SysTryReturnVoidResult(NID_UI_CTRL, pEventArg, r, "[%s] Propagating.", GetErrorMessage(r));
1418 __pPublicTextEvent->Fire(*pEventArg);
1424 _SearchBarImpl::OnSearchBarModeChanged(_SearchBar& source, SearchBarMode mode)
1428 if ((_AppInfo::GetApiVersion() == _API_VERSION_2_0 && _AppInfo::IsOspCompat()) && __pSearchBar != null)
1430 if (mode == SEARCH_BAR_MODE_NORMAL)
1432 __pSearchBar->SetHeaderVisibleState(true);
1436 __pSearchBar->SetHeaderVisibleState(false);
1438 __pSearchBar->SetContentsArea();
1441 if (__pPublicSearchBarEvent != null)
1443 IEventArg* pEventArg = _PublicSearchBarEvent::CreateSearchBarEventArgN(SEARCH_BAR_EVENT_MODE_CHANGE);
1444 result r = GetLastResult();
1445 SysTryReturnVoidResult(NID_UI_CTRL, pEventArg, r, "[%s] Propagating.", GetErrorMessage(r));
1447 __pPublicSearchBarEvent->Fire(*pEventArg);
1453 _SearchBarImpl::OnLanguageChanged(LanguageCode oldLanguage, LanguageCode newLanguage)
1455 if (__pPublicLanguageEvent)
1457 IEventArg* pKLanguageEventArg = _PublicLanguageEvent::CreateLanguageEventArgN(GetPublic(), oldLanguage, newLanguage);
1458 result r = GetLastResult();
1459 SysTryReturnVoidResult(NID_UI_CTRL, pKLanguageEventArg, r, "[%s] Propagating.", GetErrorMessage(r));
1461 __pPublicLanguageEvent->Fire(*pKLanguageEventArg);
1465 SysLog(NID_UI_CTRL, "Event is not created.");
1471 _SearchBarImpl::OnFocusEventListenerAdded(IFocusEventListener& listener)
1474 SysTryReturnVoidResult(NID_UI,
1475 __pPublicFocusEventListeners->Add(const_cast <IFocusEventListener*>(&listener)) == E_SUCCESS, E_SYSTEM,
1476 "[E_SYSTEM] A system error has occured. Failed to add listener.");
1480 _SearchBarImpl::OnFocusEventListenerRemoved(IFocusEventListener& listener)
1483 SysTryReturnVoidResult(NID_UI,
1484 __pPublicFocusEventListeners->Remove(&listener) == E_SUCCESS, E_SYSTEM,
1485 "[E_SYSTEM] A system error has occured. Failed to remove listener.");
1489 _SearchBarImpl::OnFocusGained(const Tizen::Ui::Control& source)
1491 if (!__pSearchBar->IsFocusCallbackToBeFired())
1496 IEnumeratorT<IEventListener*>* pEnumerator = __pPublicFocusEventListeners->GetEnumeratorN();
1500 while (pEnumerator->MoveNext() == E_SUCCESS)
1502 IEventListener* pListener = null;
1503 pEnumerator->GetCurrent(pListener);
1505 IFocusEventListener* pFocusEventListener = dynamic_cast <IFocusEventListener*>(pListener);
1507 if (pFocusEventListener != null )
1509 pFocusEventListener->OnFocusGained(GetPublic());
1520 _SearchBarImpl::OnFocusLost(const Tizen::Ui::Control& source)
1522 if (!__pSearchBar->IsFocusCallbackToBeFired())
1527 IEnumeratorT<IEventListener*>* pEnumerator = __pPublicFocusEventListeners->GetEnumeratorN();
1530 while (pEnumerator->MoveNext() == E_SUCCESS)
1532 IEventListener* pListener = null;
1533 pEnumerator->GetCurrent(pListener);
1535 IFocusEventListener* pFocusEventListener = dynamic_cast <IFocusEventListener*>(pListener);
1537 if (pFocusEventListener != null )
1539 pFocusEventListener->OnFocusLost(GetPublic());
1550 _SearchBarImpl::OnKeyPressed(const Tizen::Ui::Control& source, Tizen::Ui::KeyCode keyCode)
1552 IEnumeratorT<IEventListener*>* pEnumerator = GetKeyEventListener()->GetEnumeratorN();
1555 while (pEnumerator->MoveNext() == E_SUCCESS)
1557 IEventListener* pListener = null;
1558 pEnumerator->GetCurrent(pListener);
1560 IKeyEventListener* pKeyEventListener = dynamic_cast <IKeyEventListener*>(pListener);
1562 if (pKeyEventListener != null )
1564 pKeyEventListener->OnKeyPressed(GetPublic(), keyCode);
1575 _SearchBarImpl::OnKeyReleased(const Tizen::Ui::Control& source, Tizen::Ui::KeyCode keyCode)
1577 IEnumeratorT<IEventListener*>* pEnumerator = GetKeyEventListener()->GetEnumeratorN();
1580 while (pEnumerator->MoveNext() == E_SUCCESS)
1582 IEventListener* pListener = null;
1583 pEnumerator->GetCurrent(pListener);
1585 IKeyEventListener* pKeyEventListener = dynamic_cast <IKeyEventListener*>(pListener);
1587 if (pKeyEventListener != null )
1589 pKeyEventListener->OnKeyReleased(GetPublic(), keyCode);
1600 _SearchBarImpl::OnKeyLongPressed(const Tizen::Ui::Control& source, Tizen::Ui::KeyCode keyCode)
1602 IEnumeratorT<IEventListener*>* pEnumerator = GetKeyEventListener()->GetEnumeratorN();
1605 while (pEnumerator->MoveNext() == E_SUCCESS)
1607 IEventListener* pListener = null;
1608 pEnumerator->GetCurrent(pListener);
1610 IKeyEventListener* pKeyEventListener = dynamic_cast <IKeyEventListener*>(pListener);
1612 if (pKeyEventListener != null )
1614 pKeyEventListener->OnKeyLongPressed(GetPublic(), keyCode);
1625 _SearchBarImpl::ConvertKeypadAction(CoreKeypadAction keypadAction) const
1627 KeypadAction publicKeypadAction = KEYPAD_ACTION_SEARCH;
1628 switch (keypadAction)
1630 case CORE_KEYPAD_ACTION_ENTER:
1631 publicKeypadAction = KEYPAD_ACTION_ENTER;
1634 case CORE_KEYPAD_ACTION_GO:
1635 publicKeypadAction = KEYPAD_ACTION_GO;
1638 case CORE_KEYPAD_ACTION_NEXT:
1639 publicKeypadAction = KEYPAD_ACTION_NEXT;
1642 case CORE_KEYPAD_ACTION_SEND:
1643 publicKeypadAction = KEYPAD_ACTION_SEND;
1646 case CORE_KEYPAD_ACTION_SEARCH:
1647 publicKeypadAction = KEYPAD_ACTION_SEARCH;
1650 case CORE_KEYPAD_ACTION_LOGIN:
1651 publicKeypadAction = KEYPAD_ACTION_LOGIN;
1654 case CORE_KEYPAD_ACTION_SIGN_IN:
1655 publicKeypadAction = KEYPAD_ACTION_SIGN_IN;
1658 case CORE_KEYPAD_ACTION_JOIN:
1659 publicKeypadAction = KEYPAD_ACTION_JOIN;
1662 case CORE_KEYPAD_ACTION_DONE:
1663 publicKeypadAction = KEYPAD_ACTION_DONE;
1670 return publicKeypadAction;
1674 _SearchBarImpl::GetEditFieldImpl(void) const
1676 return __pEditFieldImpl;
1680 _SearchBarImpl::GetButtonImpl(void) const
1682 return __pButtonImpl;
1685 class _SearchBarMaker
1686 : public _UiBuilderControlMaker
1689 _SearchBarMaker(_UiBuilder* pUibuilder)
1690 : _UiBuilderControlMaker(pUibuilder){}
1691 virtual ~_SearchBarMaker(void){}
1692 static _UiBuilderControlMaker*
1693 GetInstance(_UiBuilder* pUibuilder)
1695 _SearchBarMaker* pSearchBarMaker = new (std::nothrow) _SearchBarMaker(pUibuilder);
1696 return pSearchBarMaker;
1701 Make(_UiBuilderControl* pControl)
1703 result r = E_SUCCESS;
1705 FloatRectangle rect;
1706 SearchBar* pSearchBar = null;
1707 _UiBuilderControlLayout* pControlProperty = null;
1708 bool showSearchBarButton = true;
1709 KeypadAction keypadAction = KEYPAD_ACTION_ENTER;
1711 int opacity = SEARCHBAR_DEFAULT_OPACITY;
1712 EllipsisPosition ellipsisPosition = ELLIPSIS_POSITION_END;
1715 int limitLength = SEARCHBAR_TEXT_LENGTH_MAX;
1716 int buttonActionId = -1;
1718 float searchFieldTextSize = 0.0f;
1719 bool lowercaseEnable = false;
1720 String elementString;
1722 GetProperty(pControl, &pControlProperty);
1723 if (pControlProperty == null)
1728 pSearchBar = new (std::nothrow) SearchBar;
1729 if (pSearchBar == null)
1734 rect = pControlProperty->GetRectF();
1735 if (pControl->GetElement("showSearchBarButton", elementString))
1737 if (elementString.Equals(L"false", false))
1739 showSearchBarButton = false;
1743 if (pControl->GetElement("keypadAction", elementString))
1745 if (elementString.Equals(L"KEYPAD_ACTION_ENTER", false))
1747 keypadAction = KEYPAD_ACTION_ENTER;
1749 else if (elementString.Equals(L"KEYPAD_ACTION_GO", false))
1751 keypadAction = KEYPAD_ACTION_GO;
1753 else if (elementString.Equals(L"KEYPAD_ACTION_NEXT", false))
1755 keypadAction = KEYPAD_ACTION_NEXT;
1757 else if (elementString.Equals(L"KEYPAD_ACTION_SEND", false))
1759 keypadAction = KEYPAD_ACTION_SEND;
1761 else if (elementString.Equals(L"KEYPAD_ACTION_SEARCH", false))
1763 keypadAction = KEYPAD_ACTION_SEARCH;
1765 else if (elementString.Equals(L"KEYPAD_ACTION_LOGIN", false))
1767 keypadAction = KEYPAD_ACTION_LOGIN;
1769 else if (elementString.Equals(L"KEYPAD_ACTION_SIGN_IN", false))
1771 keypadAction = KEYPAD_ACTION_SIGN_IN;
1773 else if (elementString.Equals(L"KEYPAD_ACTION_JOIN", false))
1775 keypadAction = KEYPAD_ACTION_JOIN;
1777 else if (elementString.Equals(L"KEYPAD_ACTION_DONE", false))
1779 keypadAction = KEYPAD_ACTION_DONE;
1783 r = pSearchBar->Construct(rect, showSearchBarButton, keypadAction);
1790 if (showSearchBarButton)
1792 if (pControl->GetElement("buttonActionId", elementString))
1794 Base::Integer::Parse(elementString, buttonActionId);
1797 if (pControl->GetElement("buttonText", elementString))
1799 r = pSearchBar->SetButton(elementString, buttonActionId);
1803 if (pControl->GetElement("text", elementString))
1805 r = pSearchBar->SetText(elementString);
1808 if (pControl->GetElement("guideText", elementString))
1810 r = pSearchBar->SetGuideText(elementString);
1813 if (pControl->GetElement("searchFieldTextSize", elementString))
1815 searchFieldTextSize = _CoordinateSystemUtils::ConvertToFloat(elementString);
1816 _ICoordinateSystemTransformer* pTransform = GetTransformer();
1819 searchFieldTextSize = pTransform->Transform(searchFieldTextSize);
1821 r = pSearchBar->SetSearchFieldTextSize(searchFieldTextSize);
1824 if (pControl->GetElement("limitLength", elementString))
1826 Base::Integer::Parse(elementString, limitLength);
1827 r = pSearchBar->SetLimitLength(limitLength);
1830 if (pControl->GetElement("lowerCaseMode", elementString))
1832 if (elementString.Equals(L"true", false))
1834 lowercaseEnable = true;
1838 lowercaseEnable = false;
1841 pSearchBar->SetLowerCaseModeEnabled(lowercaseEnable);
1844 if (pControl->GetElement("ellipsisPosition", elementString))
1846 if (elementString.Equals(L"ELLIPSIS_POSITION_START", false))
1848 ellipsisPosition = ELLIPSIS_POSITION_START;
1850 else if (elementString.Equals(L"ELLIPSIS_POSITION_MIDDLE", false))
1852 ellipsisPosition = ELLIPSIS_POSITION_MIDDLE;
1856 ellipsisPosition = ELLIPSIS_POSITION_END;
1859 r = pSearchBar->SetEllipsisPosition(ellipsisPosition);
1862 if (pControl->GetElement("backgroundBitmapPath", elementString))
1864 Bitmap* pBackgroundBitmap = null;
1865 pBackgroundBitmap = LoadBitmapN(elementString);
1866 if (pBackgroundBitmap != null)
1868 pSearchBar->SetBackgroundBitmap(*pBackgroundBitmap);
1869 delete pBackgroundBitmap;
1873 if (pControl->GetElement("colorOpacity", elementString))
1875 Base::Integer::Parse(elementString, opacity);
1877 if (pControl->GetElement("color", elementString))
1879 ConvertStringToColor32(elementString, opacity, color);
1880 r = pSearchBar->SetColor(color);
1883 opacity = SEARCHBAR_DEFAULT_OPACITY;
1884 if (pControl->GetElement("normalButtonColor", elementString))
1886 ConvertStringToColor32(elementString, opacity, color);
1887 r = pSearchBar->SetButtonColor(SEARCH_BAR_BUTTON_STATUS_NORMAL, color);
1890 if (pControl->GetElement("normalButtonTextColor", elementString))
1892 ConvertStringToColor32(elementString, opacity, color);
1893 r = pSearchBar->SetButtonTextColor(SEARCH_BAR_BUTTON_STATUS_NORMAL, color);
1896 if (pControl->GetElement("normalSearchFieldColor", elementString))
1898 ConvertStringToColor32(elementString, opacity, color);
1899 r = pSearchBar->SetSearchFieldColor(SEARCH_FIELD_STATUS_NORMAL, color);
1902 if (pControl->GetElement("normalSearchFieldTextColor", elementString))
1904 ConvertStringToColor32(elementString, opacity, color);
1905 r = pSearchBar->SetSearchFieldTextColor(SEARCH_FIELD_STATUS_NORMAL, color);
1908 if (pControl->GetElement("disabledButtonColor", elementString))
1910 ConvertStringToColor32(elementString, opacity, color);
1911 r = pSearchBar->SetButtonColor(SEARCH_BAR_BUTTON_STATUS_DISABLED, color);
1914 if (pControl->GetElement("disabledButtonTextColor", elementString))
1916 ConvertStringToColor32(elementString, opacity, color);
1917 r = pSearchBar->SetButtonTextColor(SEARCH_BAR_BUTTON_STATUS_DISABLED, color);
1920 if (pControl->GetElement("disabledSearchFieldColor", elementString))
1922 ConvertStringToColor32(elementString, opacity, color);
1923 r = pSearchBar->SetSearchFieldColor(SEARCH_FIELD_STATUS_DISABLED, color);
1926 if (pControl->GetElement("disabledSearchFieldTextColor", elementString))
1928 ConvertStringToColor32(elementString, opacity, color);
1929 r = pSearchBar->SetSearchFieldTextColor(SEARCH_FIELD_STATUS_DISABLED, color);
1932 if (pControl->GetElement("highlightedButtonColor", elementString))
1934 ConvertStringToColor32(elementString, opacity, color);
1935 r = pSearchBar->SetButtonColor(SEARCH_BAR_BUTTON_STATUS_HIGHLIGHTED, color);
1938 if (pControl->GetElement("highlightedButtonTextColor", elementString))
1940 ConvertStringToColor32(elementString, opacity, color);
1941 r = pSearchBar->SetButtonTextColor(SEARCH_BAR_BUTTON_STATUS_HIGHLIGHTED, color);
1944 if (pControl->GetElement("highlightedSearchFieldColor", elementString))
1946 ConvertStringToColor32(elementString, opacity, color);
1947 r = pSearchBar->SetSearchFieldColor(SEARCH_FIELD_STATUS_HIGHLIGHTED, color);
1950 if (pControl->GetElement("highlightedSearchFieldTextColor", elementString))
1952 ConvertStringToColor32(elementString, opacity, color);
1953 r = pSearchBar->SetSearchFieldTextColor(SEARCH_FIELD_STATUS_HIGHLIGHTED, color);
1956 if (pControl->GetElement("pressedButtonColor", elementString))
1958 ConvertStringToColor32(elementString, opacity, color);
1959 r = pSearchBar->SetButtonColor(SEARCH_BAR_BUTTON_STATUS_PRESSED, color);
1962 if (pControl->GetElement("pressedButtonTextColor", elementString))
1964 ConvertStringToColor32(elementString, opacity, color);
1965 r = pSearchBar->SetButtonTextColor(SEARCH_BAR_BUTTON_STATUS_PRESSED, color);
1968 if (pControl->GetElement("guideTextColor", elementString))
1970 ConvertStringToColor32(elementString, opacity, color);
1971 r = pSearchBar->SetGuideTextColor(color);
1974 if (pControl->GetElement(L"accessibilityHint", elementString))
1976 AccessibilityContainer* pContainer = pSearchBar->GetAccessibilityContainer();
1979 AccessibilityElement* pElement = pContainer->GetElement(L"EditText");
1982 pElement->SetHint(elementString);
1991 _SearchBarRegister::_SearchBarRegister(void)
1993 _UiBuilderControlTableManager* pUiBuilderControlTableManager = _UiBuilderControlTableManager::GetInstance();
1994 pUiBuilderControlTableManager->RegisterControl(L"SearchBar", _SearchBarMaker::GetInstance);
1997 _SearchBarRegister::~_SearchBarRegister(void)
1999 _UiBuilderControlTableManager* pUiBuilderControlTableManager = _UiBuilderControlTableManager::GetInstance();
2000 pUiBuilderControlTableManager->UnregisterControl(L"SearchBar");
2002 static _SearchBarRegister SearchBarRegisterToUiBuilder;
2003 }}} // Tizen::Ui::Controls