Merge "Enter key shouldn't enable cursor when token is focused" into tizen_2.2
[platform/framework/native/uifw.git] / src / ui / controls / FUiCtrl_SearchBarImpl.cpp
1 //
2 // Open Service Platform
3 // Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
4 //
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
8 //
9 //     http://www.apache.org/licenses/LICENSE-2.0/
10 //
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.
16 //
17
18 /**
19  * @file        FUiCtrl_SearchBarImpl.cpp
20  * @brief       This is the implementation file for _SearchBarImpl class.
21  */
22
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"
38
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;
45
46 namespace Tizen { namespace Ui { namespace Controls
47 {
48
49 _SearchBarImpl::_SearchBarImpl(SearchBar* pPublic, _SearchBar* pCore)
50         : _ControlImpl(pPublic, pCore)
51         , __pSearchBar(pCore)
52         , __pEditField(null)
53         , __pButton(null)
54         , __pContentControl(null)
55         , __pPublicActionEvent(null)
56         , __pPublicKeypadEvent(null)
57         , __pPublicTextBlockEvent(null)
58         , __pPublicTextEvent(null)
59         , __pPublicSearchBarEvent(null)
60         , __pPublicLanguageEvent(null)
61         , __pPublicFocusEventListeners(null)
62 {
63         ClearLastResult();
64 }
65
66 _SearchBarImpl::~_SearchBarImpl(void)
67 {
68         if (__pSearchBar)
69         {
70                 SetContent(null);
71         }
72
73         if (__pPublicActionEvent)
74         {
75                 delete __pPublicActionEvent;
76                 __pPublicActionEvent = null;
77         }
78
79         if (__pPublicKeypadEvent)
80         {
81                 delete __pPublicKeypadEvent;
82                 __pPublicKeypadEvent = null;
83         }
84
85         if (__pPublicTextBlockEvent)
86         {
87                 delete __pPublicTextBlockEvent;
88                 __pPublicTextBlockEvent = null;
89         }
90
91         if (__pPublicTextEvent)
92         {
93                 delete __pPublicTextEvent;
94                 __pPublicTextEvent = null;
95         }
96
97         if (__pPublicSearchBarEvent)
98         {
99                 delete __pPublicSearchBarEvent;
100                 __pPublicSearchBarEvent = null;
101         }
102
103         if (__pSearchBar)
104         {
105                 if (__pSearchBar->GetClippedGroupControl())
106                 {
107                         _Control* pControl = __pSearchBar->GetClippedGroupControl();
108                         pControl->DetachAllChildren();
109                 }
110         }
111
112         if (__pEditField)
113         {
114                 delete __pEditField;
115                 __pEditField = null;
116         }
117
118         if (__pButton)
119         {
120                 delete __pButton;
121                 __pButton = null;
122         }
123
124         if (__pPublicFocusEventListeners)
125         {
126                 delete __pPublicFocusEventListeners;
127                 __pPublicFocusEventListeners = null;
128         }
129 }
130
131 _SearchBarImpl*
132 _SearchBarImpl::CreateSearchBarImplN(SearchBar* pControl, const Rectangle& bounds, bool enableSearchBarButton, KeypadAction keypadAction)
133 {
134         ClearLastResult();
135         result r = E_SUCCESS;
136
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.");
140
141         _SearchBar* pCore = _SearchBar::CreateSearchBarN();
142         r = GetLastResult();
143         SysTryReturn(NID_UI_CTRL, pCore != null, null, r, "[%s] Propagating.", GetErrorMessage(r));
144
145         _SearchBarImpl* pImpl = new (std::nothrow) _SearchBarImpl(pControl, pCore);
146
147         r = CheckConstruction(pCore, pImpl);
148         SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
149
150         r = pImpl->InitializeBoundsProperties(GET_SIZE_INFO(SearchBar), bounds, pCore->GetOrientation());
151         SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
152
153         r = pImpl->Initialize(enableSearchBarButton, keypadAction);
154         SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
155
156         return pImpl;
157 CATCH:
158         delete pImpl;
159         return null;
160 }
161
162 _SearchBarImpl*
163 _SearchBarImpl::CreateSearchBarImplFN(SearchBar* pControl, const FloatRectangle& bounds, bool enableSearchBarButton, KeypadAction keypadAction)
164 {
165         ClearLastResult();
166         result r = E_SUCCESS;
167
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.");
171
172         _SearchBar* pCore = _SearchBar::CreateSearchBarN();
173         r = GetLastResult();
174         SysTryReturn(NID_UI_CTRL, pCore != null, null, r, "[%s] Propagating.", GetErrorMessage(r));
175
176         _SearchBarImpl* pImpl = new (std::nothrow) _SearchBarImpl(pControl, pCore);
177
178         r = CheckConstruction(pCore, pImpl);
179         SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
180
181         r = pImpl->InitializeBoundsPropertiesF(GET_SIZE_INFO(SearchBar), bounds, pCore->GetOrientation());
182         SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
183
184         r = pImpl->Initialize(enableSearchBarButton, keypadAction);
185         SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
186
187         return pImpl;
188 CATCH:
189         delete pImpl;
190         return null;
191 }
192
193 const char*
194 _SearchBarImpl::GetPublicClassName(void) const
195 {
196         return "Tizen::Ui::Controls::SearchBar";
197 }
198
199 const SearchBar&
200 _SearchBarImpl::GetPublic(void) const
201 {
202         return static_cast <const SearchBar&>(_ControlImpl::GetPublic());
203 }
204
205 SearchBar&
206 _SearchBarImpl::GetPublic(void)
207 {
208         return static_cast <SearchBar&>(_ControlImpl::GetPublic());
209 }
210
211 const _SearchBar&
212 _SearchBarImpl::GetCore(void) const
213 {
214         return static_cast <const _SearchBar&>(_ControlImpl::GetCore());
215 }
216
217 _SearchBar&
218 _SearchBarImpl::GetCore(void)
219 {
220         return static_cast <_SearchBar&>(_ControlImpl::GetCore());
221 }
222
223 _SearchBarImpl*
224 _SearchBarImpl::GetInstance(SearchBar& searchBar)
225 {
226         return (static_cast<_SearchBarImpl*>(searchBar._pControlImpl));
227 }
228
229 const _SearchBarImpl*
230 _SearchBarImpl::GetInstance(const SearchBar& searchBar)
231 {
232         return (static_cast<const _SearchBarImpl*>(searchBar._pControlImpl));
233 }
234
235
236 result
237 _SearchBarImpl::Initialize(bool enableSearchBarButton, KeypadAction keypadAction)
238 {
239         ClearLastResult();
240
241         result r = E_SUCCESS;
242
243         CoreKeypadAction coreKeypadAction = CORE_KEYPAD_ACTION_SEARCH;
244         switch (keypadAction)
245         {
246         case KEYPAD_ACTION_ENTER:
247                 coreKeypadAction = CORE_KEYPAD_ACTION_ENTER;
248                 break;
249
250         case KEYPAD_ACTION_GO:
251                 coreKeypadAction = CORE_KEYPAD_ACTION_GO;
252                 break;
253
254         case KEYPAD_ACTION_NEXT:
255                 coreKeypadAction = CORE_KEYPAD_ACTION_NEXT;
256                 break;
257
258         case KEYPAD_ACTION_SEND:
259                 coreKeypadAction = CORE_KEYPAD_ACTION_SEND;
260                 break;
261
262         case KEYPAD_ACTION_SEARCH:
263                 coreKeypadAction = CORE_KEYPAD_ACTION_SEARCH;
264                 break;
265
266         case KEYPAD_ACTION_LOGIN:
267                 coreKeypadAction = CORE_KEYPAD_ACTION_LOGIN;
268                 break;
269
270         case KEYPAD_ACTION_SIGN_IN:
271                 coreKeypadAction = CORE_KEYPAD_ACTION_SIGN_IN;
272                 break;
273
274         case KEYPAD_ACTION_JOIN:
275                 coreKeypadAction = CORE_KEYPAD_ACTION_JOIN;
276                 break;
277
278         case KEYPAD_ACTION_DONE:
279                 coreKeypadAction = CORE_KEYPAD_ACTION_DONE;
280                 break;
281
282         default:
283                 break;
284         }
285
286         __pEditField = new (std::nothrow) EditField();
287         SysTryReturnResult(NID_UI_CTRL, __pEditField, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Failed to allocate memory.");
288
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));
291
292         __pEditField->AddFocusEventListener(*this);
293         SysTryReturnResult(NID_UI_CTRL, GetLastResult() == E_SUCCESS, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
294
295         __pEditField->AddKeyEventListener(*this);
296         SysTryReturnResult(NID_UI_CTRL, GetLastResult() == E_SUCCESS, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
297
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");
301
302         String cancelButtonText;
303         GET_STRING_CONFIG(IDS_TPLATFORM_BUTTON_CANCEL_ABB, cancelButtonText);
304
305         __pButton = new (std::nothrow) Button();
306         SysTryReturnResult(NID_UI_CTRL, __pButton, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Failed to allocate memory.");
307
308         r = __pButton->Construct(GetBoundsF(), cancelButtonText);
309         SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
310
311         __pButton->AddFocusEventListener(*this);
312         SysTryReturnResult(NID_UI_CTRL, GetLastResult() == E_SUCCESS, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
313
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");
317
318         r = __pSearchBar->Initialize(enableSearchBarButton, coreKeypadAction);
319         SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "Propagating.");
320
321         __pPublicActionEvent = _PublicActionEvent::CreateInstanceN(GetPublic());
322         r = GetLastResult();
323         SysTryReturn(NID_UI_CTRL, __pPublicActionEvent, r, r, "[%s] Propagating.", GetErrorMessage(r));
324
325         r = __pSearchBar->AddActionEventListener(*this);
326         SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
327
328         __pPublicKeypadEvent = _PublicKeypadEvent::CreateInstanceN(GetPublic());
329         r = GetLastResult();
330         SysTryReturn(NID_UI_CTRL, __pPublicKeypadEvent, r, r, "[%s] Propagating.", GetErrorMessage(r));
331
332         r = __pSearchBar->AddKeypadEventListener(*this);
333         SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
334
335         __pPublicTextBlockEvent = _PublicTextBlockEvent::CreateInstanceN(GetPublic());
336         r = GetLastResult();
337         SysTryReturn(NID_UI_CTRL, __pPublicTextBlockEvent, r, r, "[%s] Propagating.", GetErrorMessage(r));
338
339         r = __pSearchBar->AddTextBlockEventListener(*this);
340         SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
341
342         __pPublicTextEvent = _PublicTextEvent::CreateInstanceN(GetPublic());
343         r = GetLastResult();
344         SysTryReturn(NID_UI_CTRL, __pPublicTextEvent, r, r, "[%s] Propagating.", GetErrorMessage(r));
345
346         r = __pSearchBar->AddTextEventListener(*this);
347         SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
348
349         __pPublicSearchBarEvent = _PublicSearchBarEvent::CreateInstanceN(GetPublic());
350         r = GetLastResult();
351         SysTryReturn(NID_UI_CTRL, __pPublicSearchBarEvent, r, r, "[%s] Propagating.", GetErrorMessage(r));
352
353         r = __pSearchBar->AddSearchBarEventListener(*this);
354         SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
355
356         __pPublicLanguageEvent = _PublicLanguageEvent::CreateInstanceN(GetPublic());
357         r = GetLastResult();
358         SysTryReturn(NID_UI_CTRL, __pPublicLanguageEvent, r, r, "[%s] Propagating.", GetErrorMessage(r));
359
360         r = __pSearchBar->AddLanguageEventListener(*this);
361         SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
362
363         __pPublicFocusEventListeners = CreatePublicEventListenerListN();
364         r = GetLastResult();
365         SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
366
367         return r;
368 }
369
370 Control*
371 _SearchBarImpl::GetContent(void) const
372 {
373         ClearLastResult();
374
375         return __pContentControl;
376 }
377
378 result
379 _SearchBarImpl::SetContent(const Control* pContent)
380 {
381         ClearLastResult();
382
383         result r = E_SUCCESS;
384         if (pContent != null)
385         {
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.");
390         }
391
392         if (pContent != null && __pContentControl == null)
393         {
394                 __pContentControl = const_cast <Control*>(pContent);
395                 _Control& control = _ControlImpl::GetInstance(*__pContentControl)->GetCore();
396
397                 r = __pSearchBar->SetContent(&control);
398         }
399
400         return r;
401 }
402
403 result
404 _SearchBarImpl::UpdateContentArea(bool invalidate)
405 {
406         ClearLastResult();
407
408         return __pSearchBar->UpdateContentArea(invalidate);
409 }
410
411 result
412 _SearchBarImpl::SetContentAreaVisible(bool visible)
413 {
414         ClearLastResult();
415
416         return __pSearchBar->SetContentAreaVisible(visible, true);
417 }
418
419 bool
420 _SearchBarImpl::IsContentAreaVisible(void) const
421 {
422         ClearLastResult();
423
424         return __pSearchBar->IsContentAreaVisible();
425 }
426
427 result
428 _SearchBarImpl::SetContentAreaSize(const Dimension& size)
429 {
430         ClearLastResult();
431
432         FloatDimension contentSize;
433         contentSize = _CoordinateSystemUtils::ConvertToFloat(size);
434         Variant var(contentSize);
435
436         return __pSearchBar->SetPropertyContentAreaSize(var);
437 }
438
439 result
440 _SearchBarImpl::SetContentAreaSize(const FloatDimension& size)
441 {
442         ClearLastResult();
443
444         Variant var(size);
445         return __pSearchBar->SetPropertyContentAreaSize(var);
446 }
447
448 Dimension
449 _SearchBarImpl::GetContentAreaSize(void) const
450 {
451         ClearLastResult();
452
453         Dimension size;
454         size = _CoordinateSystemUtils::ConvertToInteger(__pSearchBar->GetPropertyContentAreaSize().ToFloatDimension());
455
456         return size;
457 }
458
459 FloatDimension
460 _SearchBarImpl::GetContentAreaSizeF(void) const
461 {
462         ClearLastResult();
463
464         return __pSearchBar->GetPropertyContentAreaSize().ToFloatDimension();
465 }
466
467 SearchBarMode
468 _SearchBarImpl::GetMode(void) const
469 {
470         ClearLastResult();
471
472         return __pSearchBar->GetMode();
473 }
474
475 bool
476 _SearchBarImpl::IsModeLocked(void) const
477 {
478         ClearLastResult();
479
480         return __pSearchBar->IsModeLocked();
481 }
482
483 result
484 _SearchBarImpl::SetMode(SearchBarMode mode)
485 {
486         ClearLastResult();
487
488         return __pSearchBar->SetMode(mode);
489 }
490
491 result
492 _SearchBarImpl::SetModeLocked(bool modeLocked)
493 {
494         ClearLastResult();
495
496         return __pSearchBar->SetModeLocked(modeLocked);
497 }
498
499 int
500 _SearchBarImpl::GetButtonActionId(void) const
501 {
502         ClearLastResult();
503
504         return __pSearchBar->GetPropertyButtonActionId().ToInt();
505 }
506
507 Color
508 _SearchBarImpl::GetButtonColor(SearchBarButtonStatus status) const
509 {
510         ClearLastResult();
511
512         Variant buttonColor;
513
514         switch (status)
515         {
516         case SEARCH_BAR_BUTTON_STATUS_NORMAL:
517                 buttonColor = __pSearchBar->GetPropertyButtonNormalColor();
518                 break;
519         case SEARCH_BAR_BUTTON_STATUS_PRESSED:
520                 buttonColor = __pSearchBar->GetPropertyButtonPressedColor();
521                 break;
522         case SEARCH_BAR_BUTTON_STATUS_HIGHLIGHTED:
523                 buttonColor = __pSearchBar->GetPropertyButtonHighlightedColor();
524                 break;
525         case SEARCH_BAR_BUTTON_STATUS_DISABLED:
526                 buttonColor = __pSearchBar->GetPropertyButtonDisabledColor();
527                 break;
528         default:
529                 break;
530         }
531
532         return buttonColor.ToColor();
533 }
534
535 Color
536 _SearchBarImpl::GetButtonTextColor(SearchBarButtonStatus status) const
537 {
538         ClearLastResult();
539
540         Variant buttonTextColor;
541
542         switch (status)
543         {
544         case SEARCH_BAR_BUTTON_STATUS_NORMAL:
545                 buttonTextColor = __pSearchBar->GetPropertyButtonNormalTextColor();
546                 break;
547         case SEARCH_BAR_BUTTON_STATUS_PRESSED:
548                 buttonTextColor = __pSearchBar->GetPropertyButtonPressedTextColor();
549                 break;
550         case SEARCH_BAR_BUTTON_STATUS_HIGHLIGHTED:
551                 buttonTextColor = __pSearchBar->GetPropertyButtonHighlightedTextColor();
552                 break;
553         case SEARCH_BAR_BUTTON_STATUS_DISABLED:
554                 buttonTextColor = __pSearchBar->GetPropertyButtonDisabledTextColor();
555                 break;
556         default:
557                 break;
558         }
559
560         return buttonTextColor.ToColor();
561 }
562
563 SearchBarButtonStatus
564 _SearchBarImpl::GetButtonStatus(void) const
565 {
566         ClearLastResult();
567
568         return __pSearchBar->GetButtonStatus();
569 }
570
571 result
572 _SearchBarImpl::SetButton(const String& text, int actionId)
573 {
574         ClearLastResult();
575
576         result r = E_SUCCESS;
577         Variant var(actionId);
578
579         r = __pSearchBar->SetButtonText(text);
580         SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
581
582         r = __pSearchBar->SetPropertyButtonActionId(var);
583
584         return r;
585 }
586
587 result
588 _SearchBarImpl::SetButtonEnabled(bool enabled)
589 {
590         ClearLastResult();
591
592         return __pSearchBar->SetButtonEnabled(enabled);
593 }
594
595 result
596 _SearchBarImpl::SetButtonColor(SearchBarButtonStatus status, const Color& color)
597 {
598         ClearLastResult();
599
600         result r = E_SUCCESS;
601         Variant var(color);
602
603         switch (status)
604         {
605         case SEARCH_BAR_BUTTON_STATUS_NORMAL:
606                 r = __pSearchBar->SetPropertyButtonNormalColor(var);
607                 break;
608         case SEARCH_BAR_BUTTON_STATUS_PRESSED:
609                 r = __pSearchBar->SetPropertyButtonPressedColor(var);
610                 break;
611         case SEARCH_BAR_BUTTON_STATUS_HIGHLIGHTED:
612                 r = __pSearchBar->SetPropertyButtonHighlightedColor(var);
613                 break;
614         case SEARCH_BAR_BUTTON_STATUS_DISABLED:
615                 r = __pSearchBar->SetPropertyButtonDisabledColor(var);
616                 break;
617         default:
618                 break;
619         }
620
621         return r;
622 }
623
624 result
625 _SearchBarImpl::SetButtonTextColor(SearchBarButtonStatus status, const Color& color)
626 {
627         ClearLastResult();
628
629         result r = E_SUCCESS;
630         Variant var(color);
631
632         switch (status)
633         {
634         case SEARCH_BAR_BUTTON_STATUS_NORMAL:
635                 r = __pSearchBar->SetPropertyButtonNormalTextColor(var);
636                 break;
637         case SEARCH_BAR_BUTTON_STATUS_PRESSED:
638                 r = __pSearchBar->SetPropertyButtonPressedTextColor(var);
639                 break;
640         case SEARCH_BAR_BUTTON_STATUS_HIGHLIGHTED:
641                 r = __pSearchBar->SetPropertyButtonHighlightedTextColor(var);
642                 break;
643         case SEARCH_BAR_BUTTON_STATUS_DISABLED:
644                 r = __pSearchBar->SetPropertyButtonDisabledTextColor(var);
645                 break;
646         default:
647                 break;
648         }
649
650         return r;
651 }
652
653 result
654 _SearchBarImpl::AppendCharacter(const Character& character)
655 {
656         ClearLastResult();
657
658         return __pSearchBar->AppendCharacter(character);
659 }
660
661 result
662 _SearchBarImpl::AppendText(const String& text)
663 {
664         ClearLastResult();
665
666         return __pSearchBar->AppendText(text);
667 }
668
669 result
670 _SearchBarImpl::SetText(const String& text)
671 {
672         ClearLastResult();
673
674         return __pSearchBar->SetText(text);
675 }
676
677 result
678 _SearchBarImpl::InsertCharacterAt(int index, const Character& character)
679 {
680         ClearLastResult();
681
682         return __pSearchBar->InsertCharacterAt(index, character);
683 }
684
685 result
686 _SearchBarImpl::InsertTextAt(int index, const String& text)
687 {
688         ClearLastResult();
689
690         return __pSearchBar->InsertTextAt(index, text);
691 }
692
693 result
694 _SearchBarImpl::DeleteCharacterAt(int index)
695 {
696         ClearLastResult();
697
698         return __pSearchBar->DeleteCharacterAt(index);
699 }
700
701 result
702 _SearchBarImpl::Clear(void)
703 {
704         ClearLastResult();
705
706         result r = E_SUCCESS;
707         r = __pSearchBar->Clear();
708
709         SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, E_SYSTEM,
710                            "[E_SYSTEM] A system error has occured. Failed to clear the text.");
711         return r;
712 }
713
714 int
715 _SearchBarImpl::GetTextLength(void) const
716 {
717         ClearLastResult();
718
719         return __pSearchBar->GetTextLength();
720 }
721
722 String
723 _SearchBarImpl::GetText(void) const
724 {
725         ClearLastResult();
726
727         return __pSearchBar->GetText();
728 }
729
730 String
731 _SearchBarImpl::GetText(int start, int end) const
732 {
733         ClearLastResult();
734
735         return __pSearchBar->GetText(start, end);
736 }
737
738 int
739 _SearchBarImpl::GetLimitLength(void) const
740 {
741         ClearLastResult();
742
743         return __pSearchBar->GetLimitLength();
744 }
745
746 result
747 _SearchBarImpl::SetLimitLength(int limitLength)
748 {
749         ClearLastResult();
750
751         return __pSearchBar->SetLimitLength(limitLength);
752 }
753
754 result
755 _SearchBarImpl::ShowKeypad(void) const
756 {
757         ClearLastResult();
758
759         return __pSearchBar->ShowKeypad();
760 }
761
762 result
763 _SearchBarImpl::HideKeypad(void) const
764 {
765         ClearLastResult();
766
767         return __pSearchBar->HideKeypad();
768 }
769
770 int
771 _SearchBarImpl::GetSearchFieldTextSize(void) const
772 {
773         ClearLastResult();
774
775         int textSize = _CoordinateSystemUtils::ConvertToInteger(__pSearchBar->GetSearchFieldTextSizeF());
776         return textSize;
777 }
778
779 float
780 _SearchBarImpl::GetSearchFieldTextSizeF(void) const
781 {
782         ClearLastResult();
783
784         return __pSearchBar->GetSearchFieldTextSizeF();
785 }
786
787 result
788 _SearchBarImpl::SetSearchFieldTextSize(int size)
789 {
790         ClearLastResult();
791
792         float textSize = _CoordinateSystemUtils::ConvertToFloat(size);
793         return SetSearchFieldTextSize(textSize);
794 }
795
796 result
797 _SearchBarImpl::SetSearchFieldTextSize(float size)
798 {
799         ClearLastResult();
800
801         return __pSearchBar->SetSearchFieldTextSize(size);
802 }
803
804 result
805 _SearchBarImpl::GetBlockRange(int& start, int& end) const
806 {
807         ClearLastResult();
808
809         return __pSearchBar->GetBlockRange(start, end);
810 }
811
812 result
813 _SearchBarImpl::ReleaseBlock(void)
814 {
815         ClearLastResult();
816
817         return __pSearchBar->ReleaseBlock();
818 }
819
820 result
821 _SearchBarImpl::SetBlockRange(int start, int end)
822 {
823         ClearLastResult();
824
825         return __pSearchBar->SetBlockRange(start, end + 1);
826 }
827
828 result
829 _SearchBarImpl::RemoveTextBlock(void)
830 {
831         ClearLastResult();
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.");
835
836         return r;
837 }
838
839 Color
840 _SearchBarImpl::GetColor(void) const
841 {
842         ClearLastResult();
843
844         return __pSearchBar->GetPropertyColor().ToColor();
845 }
846
847 Color
848 _SearchBarImpl::GetSearchFieldColor(SearchFieldStatus status) const
849 {
850         ClearLastResult();
851
852         Variant searchFieldColor;
853
854         switch (status)
855         {
856         case SEARCH_FIELD_STATUS_NORMAL:
857                 searchFieldColor = __pSearchBar->GetPropertySearchFieldNormalColor();
858                 break;
859         case SEARCH_FIELD_STATUS_HIGHLIGHTED:
860                 searchFieldColor = __pSearchBar->GetPropertySearchFieldHighlightedColor();
861                 break;
862         case SEARCH_FIELD_STATUS_DISABLED:
863                 searchFieldColor = __pSearchBar->GetPropertySearchFieldDisabledColor();
864                 break;
865         default:
866                 break;
867         }
868
869         return searchFieldColor.ToColor();
870 }
871
872 Color
873 _SearchBarImpl::GetSearchFieldTextColor(SearchFieldStatus status) const
874 {
875         ClearLastResult();
876
877         Color color;
878         _Edit* pEdit = __pSearchBar->GetSearchField();
879         if (pEdit)
880         {
881                 switch (status)
882                 {
883                 case SEARCH_FIELD_STATUS_NORMAL:
884                         color = pEdit->GetTextColor(EDIT_TEXT_COLOR_NORMAL);
885                         break;
886                 case SEARCH_FIELD_STATUS_HIGHLIGHTED:
887                         color = pEdit->GetTextColor(EDIT_TEXT_COLOR_HIGHLIGHTED);
888                         break;
889                 case SEARCH_FIELD_STATUS_DISABLED:
890                         color = pEdit->GetTextColor(EDIT_TEXT_COLOR_DISABLED);
891                         break;
892                 default:
893                         break;
894                 }
895         }
896         return color;
897 }
898
899 result
900 _SearchBarImpl::SetBackgroundBitmap(const Bitmap& bitmap)
901 {
902         ClearLastResult();
903
904         return __pSearchBar->SetBackgroundBitmap(bitmap);
905 }
906
907 result
908 _SearchBarImpl::SetColor(const Color& color)
909 {
910         ClearLastResult();
911
912         Variant var(color);
913
914         return __pSearchBar->SetPropertyColor(var);
915 }
916
917 result
918 _SearchBarImpl::SetSearchFieldColor(SearchFieldStatus status, const Color& color)
919 {
920         ClearLastResult();
921
922         result r = E_SUCCESS;
923         Variant var(color);
924
925         switch (status)
926         {
927         case SEARCH_FIELD_STATUS_NORMAL:
928                 r = __pSearchBar->SetPropertySearchFieldNormalColor(var);
929                 break;
930         case SEARCH_FIELD_STATUS_HIGHLIGHTED:
931                 r = __pSearchBar->SetPropertySearchFieldHighlightedColor(var);
932                 break;
933         case SEARCH_FIELD_STATUS_DISABLED:
934                 r = __pSearchBar->SetPropertySearchFieldDisabledColor(var);
935                 break;
936         default:
937                 break;
938         }
939
940         return r;
941 }
942
943 result
944 _SearchBarImpl::SetSearchFieldTextColor(SearchFieldStatus status, const Color& color)
945 {
946         ClearLastResult();
947
948         result r = E_SUCCESS;
949         _Edit* pEdit = __pSearchBar->GetSearchField();
950         if (pEdit)
951         {
952                 switch (status)
953                 {
954                 case SEARCH_FIELD_STATUS_NORMAL:
955                         r = pEdit->SetTextColor(EDIT_TEXT_COLOR_NORMAL, color);
956                         break;
957                 case SEARCH_FIELD_STATUS_HIGHLIGHTED:
958                         r = pEdit->SetTextColor(EDIT_TEXT_COLOR_HIGHLIGHTED, color);
959                         break;
960                 case SEARCH_FIELD_STATUS_DISABLED:
961                         r = pEdit->SetTextColor(EDIT_TEXT_COLOR_DISABLED, color);
962                         break;
963                 default:
964                         break;
965                 }
966         }
967
968         return r;
969 }
970
971 String
972 _SearchBarImpl::GetGuideText(void) const
973 {
974         ClearLastResult();
975
976         return __pSearchBar->GetGuideText();
977 }
978
979 result
980 _SearchBarImpl::SetGuideText(const String& guideText)
981 {
982         ClearLastResult();
983
984         return __pSearchBar->SetGuideText(guideText);
985 }
986
987 Color
988 _SearchBarImpl::GetGuideTextColor(void) const
989 {
990         ClearLastResult();
991
992         return __pSearchBar->GetGuideTextColor();
993 }
994
995 result
996 _SearchBarImpl::SetGuideTextColor(const Color& color)
997 {
998         ClearLastResult();
999
1000         return __pSearchBar->SetGuideTextColor(color);
1001 }
1002
1003 int
1004 _SearchBarImpl::GetCursorPosition(void) const
1005 {
1006         ClearLastResult();
1007
1008         return __pSearchBar->GetCursorPosition();
1009 }
1010
1011 result
1012 _SearchBarImpl::SetCursorPosition(int index)
1013 {
1014         ClearLastResult();
1015
1016         return __pSearchBar->SetCursorPosition(index);
1017 }
1018
1019 bool
1020 _SearchBarImpl::IsLowerCaseModeEnabled(void) const
1021 {
1022         ClearLastResult();
1023
1024         return __pSearchBar->IsLowerCaseModeEnabled();
1025 }
1026
1027 void
1028 _SearchBarImpl::SetLowerCaseModeEnabled(bool enable)
1029 {
1030         ClearLastResult();
1031
1032         return __pSearchBar->SetLowerCaseModeEnabled(enable);
1033 }
1034
1035 EllipsisPosition
1036 _SearchBarImpl::GetEllipsisPosition(void) const
1037 {
1038         ClearLastResult();
1039
1040         return __pSearchBar->GetEllipsisPosition();
1041 }
1042
1043 result
1044 _SearchBarImpl::SetEllipsisPosition(EllipsisPosition position)
1045 {
1046         ClearLastResult();
1047
1048         return __pSearchBar->SetEllipsisPosition(position);
1049 }
1050
1051 KeypadAction
1052 _SearchBarImpl::GetKeypadAction(void) const
1053 {
1054         ClearLastResult();
1055
1056         CoreKeypadAction coreKeypadAction = __pSearchBar->GetKeypadAction();
1057         KeypadAction publicKeypadAction = ConvertKeypadAction(coreKeypadAction);
1058
1059         return publicKeypadAction;
1060 }
1061
1062 bool
1063 _SearchBarImpl::IsTextPredictionEnabled(void) const
1064 {
1065         return __pSearchBar->IsTextPredictionEnabled();
1066 }
1067
1068 result
1069 _SearchBarImpl::SetTextPredictionEnabled(bool enable)
1070 {
1071         return __pSearchBar->SetTextPredictionEnabled(enable);
1072 }
1073
1074 result
1075 _SearchBarImpl::SetCurrentLanguage(LanguageCode languageCode)
1076 {
1077         return __pSearchBar->SetCurrentLanguage(languageCode);
1078 }
1079
1080 result
1081 _SearchBarImpl::GetCurrentLanguage(LanguageCode& language) const
1082 {
1083         return __pSearchBar->GetCurrentLanguage(language);
1084 }
1085
1086 result
1087 _SearchBarImpl::AddActionEventListener(IActionEventListener& listener)
1088 {
1089         ClearLastResult();
1090
1091         SysTryReturn(NID_UI_CTRL, __pPublicActionEvent, E_SYSTEM, E_SYSTEM,
1092                      "[E_SYSTEM] A system error has occurred.");
1093
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.");
1097         return r;
1098 }
1099
1100 result
1101 _SearchBarImpl::RemoveActionEventListener(IActionEventListener& listener)
1102 {
1103         ClearLastResult();
1104
1105         SysTryReturn(NID_UI_CTRL, __pPublicActionEvent, E_SYSTEM, E_SYSTEM,
1106                      "[E_SYSTEM] A system error has occurred.");
1107
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.");
1111         return r;
1112 }
1113
1114 result
1115 _SearchBarImpl::AddKeypadEventListener(IKeypadEventListener& listener)
1116 {
1117         ClearLastResult();
1118
1119         SysTryReturn(NID_UI_CTRL, __pPublicKeypadEvent, E_SYSTEM, E_SYSTEM,
1120                      "[E_SYSTEM] A system error has occurred.");
1121
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.");
1125
1126         return r;
1127 }
1128
1129 result
1130 _SearchBarImpl::RemoveKeypadEventListener(IKeypadEventListener& listener)
1131 {
1132         ClearLastResult();
1133
1134         SysTryReturn(NID_UI_CTRL, __pPublicKeypadEvent, E_SYSTEM, E_SYSTEM,
1135                      "[E_SYSTEM] A system error has occurred.");
1136
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.");
1140
1141         return r;
1142 }
1143
1144 result
1145 _SearchBarImpl::AddTextBlockEventListener(ITextBlockEventListener& listener)
1146 {
1147         ClearLastResult();
1148
1149         SysTryReturn(NID_UI_CTRL, __pPublicTextBlockEvent, E_SYSTEM, E_SYSTEM,
1150                      "[E_SYSTEM] A system error has occurred.");
1151
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.");
1155
1156         return r;
1157 }
1158
1159 result
1160 _SearchBarImpl::RemoveTextBlockEventListener(ITextBlockEventListener& listener)
1161 {
1162         ClearLastResult();
1163
1164         SysTryReturn(NID_UI_CTRL, __pPublicTextBlockEvent, E_SYSTEM, E_SYSTEM,
1165                      "[E_SYSTEM] A system error has occurred.");
1166
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.");
1170
1171         return r;
1172 }
1173
1174
1175 result
1176 _SearchBarImpl::AddTextEventListener(ITextEventListener& listener)
1177 {
1178         ClearLastResult();
1179
1180         SysTryReturn(NID_UI_CTRL, __pPublicTextEvent, E_SYSTEM, E_SYSTEM,
1181                      "[E_SYSTEM] A system error has occurred.");
1182
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.");
1186
1187         return r;
1188 }
1189
1190 result
1191 _SearchBarImpl::RemoveTextEventListener(ITextEventListener& listener)
1192 {
1193         ClearLastResult();
1194
1195         SysTryReturn(NID_UI_CTRL, __pPublicTextEvent, E_SYSTEM, E_SYSTEM,
1196                      "[E_SYSTEM] A system error has occurred.");
1197
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.");
1201
1202         return r;
1203 }
1204
1205 result
1206 _SearchBarImpl::AddSearchBarEventListener(const ISearchBarEventListener& listener)
1207 {
1208         ClearLastResult();
1209
1210         SysTryReturn(NID_UI_CTRL, __pPublicSearchBarEvent, E_SYSTEM, E_SYSTEM,
1211                      "[E_SYSTEM] A system error has occurred.");
1212
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.");
1216
1217         return r;
1218 }
1219
1220 result
1221 _SearchBarImpl::RemoveSearchBarEventListener(const ISearchBarEventListener& listener)
1222 {
1223         ClearLastResult();
1224
1225         SysTryReturn(NID_UI_CTRL, __pPublicSearchBarEvent, E_SYSTEM, E_SYSTEM,
1226                      "[E_SYSTEM] A system error has occurred.");
1227
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.");
1231
1232         return r;
1233 }
1234
1235 result
1236 _SearchBarImpl::AddLanguageEventListener(ILanguageEventListener& listener)
1237 {
1238         ClearLastResult();
1239
1240         SysAssertf(__pPublicLanguageEvent != null, "Not yet constructed. Construct() should be called before use.");
1241
1242         return __pPublicLanguageEvent->AddListener(listener);
1243 }
1244
1245 result
1246 _SearchBarImpl::RemoveLanguageEventListener(ILanguageEventListener& listener)
1247 {
1248         ClearLastResult();
1249
1250         SysAssertf(__pPublicLanguageEvent != null, "Not yet constructed. Construct() should be called before use.");
1251
1252         return __pPublicLanguageEvent->RemoveListener(listener);
1253 }
1254
1255 void
1256 _SearchBarImpl::SetEditTextFilter(IEditTextFilter* pFilter)
1257 {
1258         __pSearchBar->SetEditTextFilter(pFilter);
1259
1260         return;
1261 }
1262
1263 void
1264 _SearchBarImpl::SendOpaqueCommand (const String& command)
1265 {
1266         __pSearchBar->SendOpaqueCommand(command);
1267
1268         return;
1269 }
1270
1271 void
1272 _SearchBarImpl::OnActionPerformed(const _Control& source, int actionId)
1273 {
1274         ClearLastResult();
1275
1276         if (__pPublicActionEvent != null)
1277         {
1278                 IEventArg* pEventArg = _PublicActionEvent::CreateActionEventArgN(actionId);
1279                 result r = GetLastResult();
1280                 SysTryReturnVoidResult(NID_UI_CTRL, pEventArg, r, "[%s] Propagating.", GetErrorMessage(r));
1281
1282                 __pPublicActionEvent->Fire(*pEventArg);
1283         }
1284         return;
1285 }
1286
1287 void
1288 _SearchBarImpl::OnKeypadWillOpen(void)
1289 {
1290         ClearLastResult();
1291
1292         if (__pPublicKeypadEvent != null)
1293         {
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));
1298
1299                 __pPublicKeypadEvent->Fire(*pEventArg);
1300         }
1301         return;
1302 }
1303
1304 void
1305 _SearchBarImpl::OnKeypadOpened(void)
1306 {
1307         ClearLastResult();
1308
1309         if (__pPublicKeypadEvent != null)
1310         {
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));
1315
1316                 __pPublicKeypadEvent->Fire(*pEventArg);
1317         }
1318         return;
1319 }
1320
1321
1322 void
1323 _SearchBarImpl::OnKeypadClosed(void)
1324 {
1325         ClearLastResult();
1326
1327         if (__pPublicKeypadEvent != null)
1328         {
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));
1333
1334                 __pPublicKeypadEvent->Fire(*pEventArg);
1335         }
1336         return;
1337 }
1338
1339 void
1340 _SearchBarImpl::OnKeypadBoundsChanged(void)
1341 {
1342         ClearLastResult();
1343
1344         if (__pPublicKeypadEvent != null)
1345         {
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));
1350
1351                 __pPublicKeypadEvent->Fire(*pEventArg);
1352         }
1353         return;
1354 }
1355
1356 void
1357 _SearchBarImpl::OnKeypadActionPerformed(CoreKeypadAction keypadAction)
1358 {
1359         ClearLastResult();
1360
1361         if (__pPublicKeypadEvent != null)
1362         {
1363                 KeypadAction publicKeypadAction = ConvertKeypadAction(keypadAction);
1364
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));
1369
1370                 __pPublicKeypadEvent->Fire(*pEventArg);
1371         }
1372         return;
1373 }
1374
1375 void
1376 _SearchBarImpl::OnTextBlockSelected(_Control& source, int start, int end)
1377 {
1378         ClearLastResult();
1379
1380         if (__pPublicTextBlockEvent != null)
1381         {
1382                 IEventArg* pEventArg = _PublicTextBlockEvent::CreateTextBlockEventArgN(start, end);
1383                 result r = GetLastResult();
1384                 SysTryReturnVoidResult(NID_UI_CTRL, pEventArg, r, "[%s] Propagating.", GetErrorMessage(r));
1385
1386                 __pPublicTextBlockEvent->Fire(*pEventArg);
1387         }
1388         return;
1389 }
1390
1391 void
1392 _SearchBarImpl::OnTextValueChanged(const _Control& source)
1393 {
1394         ClearLastResult();
1395
1396         if (__pPublicTextEvent != null)
1397         {
1398                 IEventArg* pEventArg = _PublicTextEvent::CreateTextEventArgN(TEXT_EVENT_CHANGED);
1399                 result r = GetLastResult();
1400                 SysTryReturnVoidResult(NID_UI_CTRL, pEventArg, r, "[%s] Propagating.", GetErrorMessage(r));
1401
1402                 __pPublicTextEvent->Fire(*pEventArg);
1403         }
1404         return;
1405 }
1406
1407 void
1408 _SearchBarImpl::OnTextValueChangeCanceled(const _Control& source)
1409 {
1410         ClearLastResult();
1411
1412         if (__pPublicTextEvent != null)
1413         {
1414                 IEventArg* pEventArg = _PublicTextEvent::CreateTextEventArgN(TEXT_EVENT_CANCELED);
1415                 result r = GetLastResult();
1416                 SysTryReturnVoidResult(NID_UI_CTRL, pEventArg, r, "[%s] Propagating.", GetErrorMessage(r));
1417
1418                 __pPublicTextEvent->Fire(*pEventArg);
1419         }
1420         return;
1421 }
1422
1423 void
1424 _SearchBarImpl::OnSearchBarModeChanged(_SearchBar& source, SearchBarMode mode)
1425 {
1426         ClearLastResult();
1427
1428         if ((_AppInfo::GetApiVersion() == _API_VERSION_2_0 && _AppInfo::IsOspCompat()) && __pSearchBar != null)
1429         {
1430                 if (mode == SEARCH_BAR_MODE_NORMAL)
1431                 {
1432                         __pSearchBar->SetHeaderVisibleState(true);
1433                 }
1434                 else
1435                 {
1436                         __pSearchBar->SetHeaderVisibleState(false);
1437                 }
1438                 __pSearchBar->SetContentsArea();
1439         }
1440
1441         if (__pPublicSearchBarEvent != null)
1442         {
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));
1446
1447                 __pPublicSearchBarEvent->Fire(*pEventArg);
1448         }
1449         return;
1450 }
1451
1452 void
1453 _SearchBarImpl::OnLanguageChanged(LanguageCode oldLanguage, LanguageCode newLanguage)
1454 {
1455         if (__pPublicLanguageEvent)
1456         {
1457                 IEventArg* pKLanguageEventArg = _PublicLanguageEvent::CreateLanguageEventArgN(GetPublic(), oldLanguage, newLanguage);
1458                 result r = GetLastResult();
1459                 SysTryReturnVoidResult(NID_UI_CTRL, pKLanguageEventArg, r, "[%s] Propagating.", GetErrorMessage(r));
1460
1461                 __pPublicLanguageEvent->Fire(*pKLanguageEventArg);
1462         }
1463         else
1464         {
1465                 SysLog(NID_UI_CTRL, "Event is not created.");
1466         }
1467         return;
1468 }
1469
1470 void
1471 _SearchBarImpl::OnFocusEventListenerAdded(IFocusEventListener& listener)
1472 {
1473         ClearLastResult();
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.");
1477 }
1478
1479 void
1480 _SearchBarImpl::OnFocusEventListenerRemoved(IFocusEventListener& listener)
1481 {
1482         ClearLastResult();
1483         SysTryReturnVoidResult(NID_UI,
1484                                 __pPublicFocusEventListeners->Remove(&listener) == E_SUCCESS, E_SYSTEM,
1485                                 "[E_SYSTEM] A system error has occured. Failed to remove listener.");
1486 }
1487
1488 void
1489 _SearchBarImpl::OnFocusGained(const Tizen::Ui::Control& source)
1490 {
1491         if (!__pSearchBar->IsFocusCallbackToBeFired())
1492         {
1493                 return;
1494         }
1495
1496         IEnumeratorT<IEventListener*>* pEnumerator = __pPublicFocusEventListeners->GetEnumeratorN();
1497
1498         if (pEnumerator)
1499         {
1500                 while (pEnumerator->MoveNext() == E_SUCCESS)
1501                 {
1502                         IEventListener* pListener = null;
1503                         pEnumerator->GetCurrent(pListener);
1504
1505                         IFocusEventListener* pFocusEventListener = dynamic_cast <IFocusEventListener*>(pListener);
1506
1507                         if (pFocusEventListener != null )
1508                         {
1509                                 pFocusEventListener->OnFocusGained(GetPublic());
1510                         }
1511                 }
1512
1513                 delete pEnumerator;
1514         }
1515
1516         return;
1517 }
1518
1519 void
1520 _SearchBarImpl::OnFocusLost(const Tizen::Ui::Control& source)
1521 {
1522         if (!__pSearchBar->IsFocusCallbackToBeFired())
1523         {
1524                 return;
1525         }
1526
1527         IEnumeratorT<IEventListener*>* pEnumerator = __pPublicFocusEventListeners->GetEnumeratorN();
1528         if (pEnumerator)
1529         {
1530                 while (pEnumerator->MoveNext() == E_SUCCESS)
1531                 {
1532                         IEventListener* pListener = null;
1533                         pEnumerator->GetCurrent(pListener);
1534
1535                         IFocusEventListener* pFocusEventListener = dynamic_cast <IFocusEventListener*>(pListener);
1536
1537                         if (pFocusEventListener != null )
1538                         {
1539                                 pFocusEventListener->OnFocusLost(GetPublic());
1540                         }
1541                 }
1542
1543                 delete pEnumerator;
1544         }
1545
1546         return;
1547 }
1548
1549 void
1550 _SearchBarImpl::OnKeyPressed(const Tizen::Ui::Control& source, Tizen::Ui::KeyCode keyCode)
1551 {
1552         IEnumeratorT<IEventListener*>* pEnumerator = GetKeyEventListener()->GetEnumeratorN();
1553         if (pEnumerator)
1554         {
1555                 while (pEnumerator->MoveNext() == E_SUCCESS)
1556                 {
1557                         IEventListener* pListener = null;
1558                         pEnumerator->GetCurrent(pListener);
1559
1560                         IKeyEventListener* pKeyEventListener = dynamic_cast <IKeyEventListener*>(pListener);
1561
1562                         if (pKeyEventListener != null )
1563                         {
1564                                 pKeyEventListener->OnKeyPressed(GetPublic(), keyCode);
1565                         }
1566                 }
1567
1568                 delete pEnumerator;
1569         }
1570
1571         return;
1572 }
1573
1574 void
1575 _SearchBarImpl::OnKeyReleased(const Tizen::Ui::Control& source, Tizen::Ui::KeyCode keyCode)
1576 {
1577         IEnumeratorT<IEventListener*>* pEnumerator = GetKeyEventListener()->GetEnumeratorN();
1578         if (pEnumerator)
1579         {
1580                 while (pEnumerator->MoveNext() == E_SUCCESS)
1581                 {
1582                         IEventListener* pListener = null;
1583                         pEnumerator->GetCurrent(pListener);
1584
1585                         IKeyEventListener* pKeyEventListener = dynamic_cast <IKeyEventListener*>(pListener);
1586
1587                         if (pKeyEventListener != null )
1588                         {
1589                                 pKeyEventListener->OnKeyReleased(GetPublic(), keyCode);
1590                         }
1591                 }
1592
1593                 delete pEnumerator;
1594         }
1595
1596         return;
1597 }
1598
1599 void
1600 _SearchBarImpl::OnKeyLongPressed(const Tizen::Ui::Control& source, Tizen::Ui::KeyCode keyCode)
1601 {
1602         IEnumeratorT<IEventListener*>* pEnumerator = GetKeyEventListener()->GetEnumeratorN();
1603         if (pEnumerator)
1604         {
1605                 while (pEnumerator->MoveNext() == E_SUCCESS)
1606                 {
1607                         IEventListener* pListener = null;
1608                         pEnumerator->GetCurrent(pListener);
1609
1610                         IKeyEventListener* pKeyEventListener = dynamic_cast <IKeyEventListener*>(pListener);
1611
1612                         if (pKeyEventListener != null )
1613                         {
1614                                 pKeyEventListener->OnKeyLongPressed(GetPublic(), keyCode);
1615                         }
1616                 }
1617
1618                 delete pEnumerator;
1619         }
1620
1621         return;
1622 }
1623
1624 KeypadAction
1625 _SearchBarImpl::ConvertKeypadAction(CoreKeypadAction keypadAction) const
1626 {
1627         KeypadAction publicKeypadAction = KEYPAD_ACTION_SEARCH;
1628         switch (keypadAction)
1629         {
1630         case CORE_KEYPAD_ACTION_ENTER:
1631                 publicKeypadAction = KEYPAD_ACTION_ENTER;
1632                 break;
1633
1634         case CORE_KEYPAD_ACTION_GO:
1635                 publicKeypadAction = KEYPAD_ACTION_GO;
1636                 break;
1637
1638         case CORE_KEYPAD_ACTION_NEXT:
1639                 publicKeypadAction = KEYPAD_ACTION_NEXT;
1640                 break;
1641
1642         case CORE_KEYPAD_ACTION_SEND:
1643                 publicKeypadAction = KEYPAD_ACTION_SEND;
1644                 break;
1645
1646         case CORE_KEYPAD_ACTION_SEARCH:
1647                 publicKeypadAction = KEYPAD_ACTION_SEARCH;
1648                 break;
1649
1650         case CORE_KEYPAD_ACTION_LOGIN:
1651                 publicKeypadAction = KEYPAD_ACTION_LOGIN;
1652                 break;
1653
1654         case CORE_KEYPAD_ACTION_SIGN_IN:
1655                 publicKeypadAction = KEYPAD_ACTION_SIGN_IN;
1656                 break;
1657
1658         case CORE_KEYPAD_ACTION_JOIN:
1659                 publicKeypadAction = KEYPAD_ACTION_JOIN;
1660                 break;
1661
1662         case CORE_KEYPAD_ACTION_DONE:
1663                 publicKeypadAction = KEYPAD_ACTION_DONE;
1664                 break;
1665
1666         default:
1667                 break;
1668         }
1669
1670         return publicKeypadAction;
1671 }
1672
1673 _EditFieldImpl*
1674 _SearchBarImpl::GetEditFieldImpl(void) const
1675 {
1676         return __pEditFieldImpl;
1677 }
1678
1679 _ButtonImpl*
1680 _SearchBarImpl::GetButtonImpl(void) const
1681 {
1682         return __pButtonImpl;
1683 }
1684
1685 class _SearchBarMaker
1686         : public _UiBuilderControlMaker
1687 {
1688 public:
1689         _SearchBarMaker(_UiBuilder* pUibuilder)
1690                 : _UiBuilderControlMaker(pUibuilder){}
1691         virtual ~_SearchBarMaker(void){}
1692         static _UiBuilderControlMaker*
1693         GetInstance(_UiBuilder* pUibuilder)
1694         {
1695                 _SearchBarMaker* pSearchBarMaker = new (std::nothrow) _SearchBarMaker(pUibuilder);
1696                 return pSearchBarMaker;
1697         };
1698
1699 protected:
1700         virtual Control*
1701         Make(_UiBuilderControl* pControl)
1702         {
1703                 result r = E_SUCCESS;
1704
1705                 FloatRectangle rect;
1706                 SearchBar* pSearchBar = null;
1707                 _UiBuilderControlLayout* pControlProperty = null;
1708                 bool showSearchBarButton = true;
1709                 KeypadAction keypadAction = KEYPAD_ACTION_ENTER;
1710                 Color color;
1711                 int opacity = SEARCHBAR_DEFAULT_OPACITY;
1712                 EllipsisPosition ellipsisPosition = ELLIPSIS_POSITION_END;
1713                 String text;
1714                 String guideText;
1715                 int limitLength = SEARCHBAR_TEXT_LENGTH_MAX;
1716                 int buttonActionId = -1;
1717                 String buttonText;
1718                 float searchFieldTextSize = 0.0f;
1719                 bool lowercaseEnable = false;
1720                 String elementString;
1721
1722                 GetProperty(pControl, &pControlProperty);
1723                 if (pControlProperty == null)
1724                 {
1725                         return null;
1726                 }
1727
1728                 pSearchBar = new (std::nothrow) SearchBar;
1729                 if (pSearchBar == null)
1730                 {
1731                         return null;
1732                 }
1733
1734                 rect = pControlProperty->GetRectF();
1735                 if (pControl->GetElement("showSearchBarButton", elementString))
1736                 {
1737                         if (elementString.Equals(L"false", false))
1738                         {
1739                                 showSearchBarButton = false;
1740                         }
1741                 }
1742
1743                 if (pControl->GetElement("keypadAction", elementString))
1744                 {
1745                         if (elementString.Equals(L"KEYPAD_ACTION_ENTER", false))
1746                         {
1747                                 keypadAction = KEYPAD_ACTION_ENTER;
1748                         }
1749                         else if (elementString.Equals(L"KEYPAD_ACTION_GO", false))
1750                         {
1751                                 keypadAction = KEYPAD_ACTION_GO;
1752                         }
1753                         else if (elementString.Equals(L"KEYPAD_ACTION_NEXT", false))
1754                         {
1755                                 keypadAction = KEYPAD_ACTION_NEXT;
1756                         }
1757                         else if (elementString.Equals(L"KEYPAD_ACTION_SEND", false))
1758                         {
1759                                 keypadAction = KEYPAD_ACTION_SEND;
1760                         }
1761                         else if (elementString.Equals(L"KEYPAD_ACTION_SEARCH", false))
1762                         {
1763                                 keypadAction = KEYPAD_ACTION_SEARCH;
1764                         }
1765                         else if (elementString.Equals(L"KEYPAD_ACTION_LOGIN", false))
1766                         {
1767                                 keypadAction = KEYPAD_ACTION_LOGIN;
1768                         }
1769                         else if (elementString.Equals(L"KEYPAD_ACTION_SIGN_IN", false))
1770                         {
1771                                 keypadAction = KEYPAD_ACTION_SIGN_IN;
1772                         }
1773                         else if (elementString.Equals(L"KEYPAD_ACTION_JOIN", false))
1774                         {
1775                                 keypadAction = KEYPAD_ACTION_JOIN;
1776                         }
1777                         else if (elementString.Equals(L"KEYPAD_ACTION_DONE", false))
1778                         {
1779                                 keypadAction = KEYPAD_ACTION_DONE;
1780                         }
1781                 }
1782
1783                 r = pSearchBar->Construct(rect, showSearchBarButton, keypadAction);
1784                 if (r != E_SUCCESS)
1785                 {
1786                         delete pSearchBar;
1787                         return null;
1788                 }
1789
1790                 if (showSearchBarButton)
1791                 {
1792                         if (pControl->GetElement("buttonActionId", elementString))
1793                         {
1794                                 Base::Integer::Parse(elementString, buttonActionId);
1795                         }
1796
1797                         if (pControl->GetElement("buttonText", elementString))
1798                         {
1799                                 r = pSearchBar->SetButton(elementString, buttonActionId);
1800                         }
1801                 }
1802
1803                 if (pControl->GetElement("text", elementString))
1804                 {
1805                         r = pSearchBar->SetText(elementString);
1806                 }
1807
1808                 if (pControl->GetElement("guideText", elementString))
1809                 {
1810                         r = pSearchBar->SetGuideText(elementString);
1811                 }
1812
1813                 if (pControl->GetElement("searchFieldTextSize", elementString))
1814                 {
1815                         searchFieldTextSize = _CoordinateSystemUtils::ConvertToFloat(elementString);
1816                         _ICoordinateSystemTransformer* pTransform = GetTransformer();
1817                         if (pTransform)
1818                         {
1819                                 searchFieldTextSize = pTransform->Transform(searchFieldTextSize);
1820                         }
1821                         r = pSearchBar->SetSearchFieldTextSize(searchFieldTextSize);
1822                 }
1823
1824                 if (pControl->GetElement("limitLength", elementString))
1825                 {
1826                         Base::Integer::Parse(elementString, limitLength);
1827                         r = pSearchBar->SetLimitLength(limitLength);
1828                 }
1829
1830                 if (pControl->GetElement("lowerCaseMode", elementString))
1831                 {
1832                         if (elementString.Equals(L"true", false))
1833                         {
1834                                 lowercaseEnable = true;
1835                         }
1836                         else
1837                         {
1838                                 lowercaseEnable = false;
1839                         }
1840
1841                         pSearchBar->SetLowerCaseModeEnabled(lowercaseEnable);
1842                 }
1843
1844                 if (pControl->GetElement("ellipsisPosition", elementString))
1845                 {
1846                         if (elementString.Equals(L"ELLIPSIS_POSITION_START", false))
1847                         {
1848                                 ellipsisPosition = ELLIPSIS_POSITION_START;
1849                         }
1850                         else if (elementString.Equals(L"ELLIPSIS_POSITION_MIDDLE", false))
1851                         {
1852                                 ellipsisPosition = ELLIPSIS_POSITION_MIDDLE;
1853                         }
1854                         else
1855                         {
1856                                 ellipsisPosition = ELLIPSIS_POSITION_END;
1857                         }
1858
1859                         r = pSearchBar->SetEllipsisPosition(ellipsisPosition);
1860                 }
1861
1862                 if (pControl->GetElement("backgroundBitmapPath", elementString))
1863                 {
1864                         Bitmap* pBackgroundBitmap = null;
1865                         pBackgroundBitmap = LoadBitmapN(elementString);
1866                         if (pBackgroundBitmap != null)
1867                         {
1868                                 pSearchBar->SetBackgroundBitmap(*pBackgroundBitmap);
1869                                 delete pBackgroundBitmap;
1870                         }
1871                 }
1872
1873                 if (pControl->GetElement("colorOpacity", elementString))
1874                 {
1875                         Base::Integer::Parse(elementString, opacity);
1876                 }
1877                 if (pControl->GetElement("color", elementString))
1878                 {
1879                         ConvertStringToColor32(elementString, opacity, color);
1880                         r = pSearchBar->SetColor(color);
1881                 }
1882
1883                 opacity = SEARCHBAR_DEFAULT_OPACITY;
1884                 if (pControl->GetElement("normalButtonColor", elementString))
1885                 {
1886                         ConvertStringToColor32(elementString, opacity, color);
1887                         r = pSearchBar->SetButtonColor(SEARCH_BAR_BUTTON_STATUS_NORMAL, color);
1888                 }
1889
1890                 if (pControl->GetElement("normalButtonTextColor", elementString))
1891                 {
1892                         ConvertStringToColor32(elementString, opacity, color);
1893                         r = pSearchBar->SetButtonTextColor(SEARCH_BAR_BUTTON_STATUS_NORMAL, color);
1894                 }
1895
1896                 if (pControl->GetElement("normalSearchFieldColor", elementString))
1897                 {
1898                         ConvertStringToColor32(elementString, opacity, color);
1899                         r = pSearchBar->SetSearchFieldColor(SEARCH_FIELD_STATUS_NORMAL, color);
1900                 }
1901
1902                 if (pControl->GetElement("normalSearchFieldTextColor", elementString))
1903                 {
1904                         ConvertStringToColor32(elementString, opacity, color);
1905                         r = pSearchBar->SetSearchFieldTextColor(SEARCH_FIELD_STATUS_NORMAL, color);
1906                 }
1907
1908                 if (pControl->GetElement("disabledButtonColor", elementString))
1909                 {
1910                         ConvertStringToColor32(elementString, opacity, color);
1911                         r = pSearchBar->SetButtonColor(SEARCH_BAR_BUTTON_STATUS_DISABLED, color);
1912                 }
1913
1914                 if (pControl->GetElement("disabledButtonTextColor", elementString))
1915                 {
1916                         ConvertStringToColor32(elementString, opacity, color);
1917                         r = pSearchBar->SetButtonTextColor(SEARCH_BAR_BUTTON_STATUS_DISABLED, color);
1918                 }
1919
1920                 if (pControl->GetElement("disabledSearchFieldColor", elementString))
1921                 {
1922                         ConvertStringToColor32(elementString, opacity, color);
1923                         r = pSearchBar->SetSearchFieldColor(SEARCH_FIELD_STATUS_DISABLED, color);
1924                 }
1925
1926                 if (pControl->GetElement("disabledSearchFieldTextColor", elementString))
1927                 {
1928                         ConvertStringToColor32(elementString, opacity, color);
1929                         r = pSearchBar->SetSearchFieldTextColor(SEARCH_FIELD_STATUS_DISABLED, color);
1930                 }
1931
1932                 if (pControl->GetElement("highlightedButtonColor", elementString))
1933                 {
1934                         ConvertStringToColor32(elementString, opacity, color);
1935                         r = pSearchBar->SetButtonColor(SEARCH_BAR_BUTTON_STATUS_HIGHLIGHTED, color);
1936                 }
1937
1938                 if (pControl->GetElement("highlightedButtonTextColor", elementString))
1939                 {
1940                         ConvertStringToColor32(elementString, opacity, color);
1941                         r = pSearchBar->SetButtonTextColor(SEARCH_BAR_BUTTON_STATUS_HIGHLIGHTED, color);
1942                 }
1943
1944                 if (pControl->GetElement("highlightedSearchFieldColor", elementString))
1945                 {
1946                         ConvertStringToColor32(elementString, opacity, color);
1947                         r = pSearchBar->SetSearchFieldColor(SEARCH_FIELD_STATUS_HIGHLIGHTED, color);
1948                 }
1949
1950                 if (pControl->GetElement("highlightedSearchFieldTextColor", elementString))
1951                 {
1952                         ConvertStringToColor32(elementString, opacity, color);
1953                         r = pSearchBar->SetSearchFieldTextColor(SEARCH_FIELD_STATUS_HIGHLIGHTED, color);
1954                 }
1955
1956                 if (pControl->GetElement("pressedButtonColor", elementString))
1957                 {
1958                         ConvertStringToColor32(elementString, opacity, color);
1959                         r = pSearchBar->SetButtonColor(SEARCH_BAR_BUTTON_STATUS_PRESSED, color);
1960                 }
1961
1962                 if (pControl->GetElement("pressedButtonTextColor", elementString))
1963                 {
1964                         ConvertStringToColor32(elementString, opacity, color);
1965                         r = pSearchBar->SetButtonTextColor(SEARCH_BAR_BUTTON_STATUS_PRESSED, color);
1966                 }
1967
1968                 if (pControl->GetElement("guideTextColor", elementString))
1969                 {
1970                         ConvertStringToColor32(elementString, opacity, color);
1971                         r = pSearchBar->SetGuideTextColor(color);
1972                 }
1973
1974                 if (pControl->GetElement(L"accessibilityHint", elementString))
1975                 {
1976                         AccessibilityContainer* pContainer = pSearchBar->GetAccessibilityContainer();
1977                         if (pContainer)
1978                         {
1979                                 AccessibilityElement* pElement = pContainer->GetElement(L"EditText");
1980                                 if (pElement)
1981                                 {
1982                                         pElement->SetHint(elementString);
1983                                 }
1984                         }
1985                 }
1986
1987                 return pSearchBar;
1988         }
1989 };
1990
1991 _SearchBarRegister::_SearchBarRegister(void)
1992 {
1993         _UiBuilderControlTableManager* pUiBuilderControlTableManager = _UiBuilderControlTableManager::GetInstance();
1994         pUiBuilderControlTableManager->RegisterControl(L"SearchBar", _SearchBarMaker::GetInstance);
1995 }
1996
1997 _SearchBarRegister::~_SearchBarRegister(void)
1998 {
1999         _UiBuilderControlTableManager* pUiBuilderControlTableManager = _UiBuilderControlTableManager::GetInstance();
2000         pUiBuilderControlTableManager->UnregisterControl(L"SearchBar");
2001 }
2002 static _SearchBarRegister SearchBarRegisterToUiBuilder;
2003 }}} // Tizen::Ui::Controls