Fix a log error
[platform/framework/native/uifw.git] / src / ui / controls / FUiCtrl_SearchBar.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_SearchBar.cpp
20  * @brief               This is the implementation file for the _SearchBar class.
21  */
22
23 #include <FBaseErrorDefine.h>
24 #include <FBaseSysLog.h>
25 #include <FGrp_BitmapImpl.h>
26 #include <FSys_SettingInfoImpl.h>
27 #include "FUi_ResourceManager.h"
28 #include "FUi_FocusManagerImpl.h"
29 #include "FUi_AccessibilityContainer.h"
30 #include "FUi_AccessibilityElement.h"
31 #include "FUi_AccessibilityManager.h"
32 #include "FUi_CoordinateSystemUtils.h"
33 #include "FUiAnim_VisualElement.h"
34 #include "FUiCtrl_SearchBar.h"
35 #include "FUiCtrl_SearchBarPresenter.h"
36 #include "FUiCtrl_Form.h"
37 #include "FUiCtrl_Edit.h"
38 #include "FUiCtrl_Panel.h"
39 #include "FUiCtrl_OverlayPanel.h"
40 #include "FUiCtrl_Keypad.h"
41 #include "FUiCtrl_ColorPicker.h"
42 #include "FUiCtrl_ActionEvent.h"
43 #include "FUiCtrl_TextBlockEvent.h"
44 #include "FUiCtrl_TextEvent.h"
45 #include "FUiCtrl_SearchBarImpl.h"
46 #include "FUiCtrl_EditFieldImpl.h"
47 #include "FUiCtrl_ButtonImpl.h"
48
49
50 using namespace Tizen::Graphics;
51 using namespace Tizen::Ui;
52 using namespace Tizen::Ui::Animations;
53 using namespace Tizen::Base;
54 using namespace Tizen::Base::Runtime;
55 using namespace Tizen::Locales;
56 using namespace Tizen::System;
57
58 namespace Tizen { namespace Ui { namespace Controls
59 {
60
61 IMPLEMENT_PROPERTY(_SearchBar);
62
63 _SearchBar::_SearchBar(void)
64         : __pSearchBarPresenter(null)
65         , __pClippedGroupControl(null)
66         , __pEdit(null)
67         , __pCancelButton(null)
68         , __pContainer(null)
69         , __pContentControl(null)
70         , __actionId(0)
71         , __searchBarStyle(0)
72         , __isButtonEnabled(true)
73         , __isUsableCancelButton(false)
74         , __isUserContainerBounds(false)
75         , __isCancelActionInProgress(false)
76         , __isUserGuideTextColor(false)
77         , __isKeypadOpening(false)
78         , __isupdateContentBounds(false)
79         , __isFocusCallbackToBeFired(true)
80         , __isButtonTextChangedByApp(false)
81         , __contentVisibilitySetByApp(true)
82         , __isFocusUiInitialized(false)
83         , __isTouchMoved(false)
84         , __keypadAction(CORE_KEYPAD_ACTION_SEARCH)
85         , __pBackgroundBitmap(null)
86         , __backgroundColor(Color())
87         , __contentColor(Color())
88         , __pActionEvent(null)
89         , __pKeypadEvent(null)
90         , __pTextBlockEvent(null)
91         , __pTextEvent(null)
92         , __pSearchBarEvent(null)
93         , __pLanguageEvent(null)
94         , __pAccessibilitySearchBarElement(null)
95 {
96         for (int i = 0; i < SEARCHBAR_BUTTON_COLOR_MAX; i++)
97         {
98                 __buttonColor[i] = Color(0);
99                 __buttonTextColor[i] = Color(0);
100         }
101
102         for (int i = 0; i < SEARCHBAR_COLOR_MAX; i++)
103         {
104                 __color[i] = Color(0);
105                 __textColor[i] = Color(0);
106                 __guideTextColor[i] = Color(0);
107         }
108
109         _AccessibilityContainer* pContainer = GetAccessibilityContainer();
110         if (pContainer != null)
111         {
112                 pContainer->Activate(true);
113         }
114 }
115
116 _SearchBar::~_SearchBar(void)
117 {
118         SettingInfo::RemoveSettingEventListener(*this);
119
120         delete __pSearchBarPresenter;
121         __pSearchBarPresenter = null;
122
123         if (__pClippedGroupControl != null)
124         {
125                 DetachChild(*__pClippedGroupControl);
126
127                 delete __pClippedGroupControl;
128                 __pClippedGroupControl = null;
129         }
130
131         if (__pContainer != null)
132         {
133                 DetachChild(*__pContainer);
134
135                 delete __pContainer;
136                 __pContainer = null;
137         }
138
139         delete __pActionEvent;
140         __pActionEvent = null;
141
142         delete __pKeypadEvent;
143         __pKeypadEvent = null;
144
145         delete __pTextBlockEvent;
146         __pTextBlockEvent = null;
147
148         delete __pTextEvent;
149         __pTextEvent = null;
150
151         delete __pSearchBarEvent;
152         __pSearchBarEvent = null;
153
154         delete __pLanguageEvent;
155         __pLanguageEvent = null;
156
157         if (__pAccessibilitySearchBarElement != null)
158         {
159                 __pAccessibilitySearchBarElement->Activate(false);
160                 __pAccessibilitySearchBarElement = null;
161         }
162
163         delete __pBackgroundBitmap;
164         __pBackgroundBitmap = null;
165 }
166
167 _SearchBar*
168 _SearchBar::CreateSearchBarN(void)
169 {
170         _SearchBar* pSearchBar = new (std::nothrow) _SearchBar();
171         SysTryReturn(NID_UI_CTRL, pSearchBar != null, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
172         if (GetLastResult() != E_SUCCESS)
173         {
174                 delete pSearchBar;
175                 return null;
176         }
177
178         pSearchBar->AcquireHandle();
179         pSearchBar->SetTouchPressThreshold(_TOUCH_PRESS_THRESHOLD_INSENSITIVE);
180
181         return pSearchBar;
182 }
183
184 result
185 _SearchBar::Initialize(bool enableSearchBarButton, CoreKeypadAction keypadAction)
186 {
187         result r = E_SUCCESS;
188
189         // Setting Button color
190         GET_COLOR_CONFIG(SEARCHBAR::BUTTON_BG_NORMAL, __buttonColor[SEARCH_BAR_BUTTON_STATUS_NORMAL]);
191         GET_COLOR_CONFIG(SEARCHBAR::BUTTON_BG_PRESSED, __buttonColor[SEARCH_BAR_BUTTON_STATUS_PRESSED]);
192         GET_COLOR_CONFIG(SEARCHBAR::BUTTON_BG_HIGHLIGHTED, __buttonColor[SEARCH_BAR_BUTTON_STATUS_HIGHLIGHTED]);
193         GET_COLOR_CONFIG(SEARCHBAR::BUTTON_BG_DISABLED, __buttonColor[SEARCH_BAR_BUTTON_STATUS_DISABLED]);
194
195         GET_COLOR_CONFIG(SEARCHBAR::BUTTON_TEXT_NORMAL, __buttonTextColor[SEARCH_BAR_BUTTON_STATUS_NORMAL]);
196         GET_COLOR_CONFIG(SEARCHBAR::BUTTON_TEXT_PRESSED, __buttonTextColor[SEARCH_BAR_BUTTON_STATUS_PRESSED]);
197         GET_COLOR_CONFIG(SEARCHBAR::BUTTON_TEXT_HIGHLIGHTED, __buttonTextColor[SEARCH_BAR_BUTTON_STATUS_HIGHLIGHTED]);
198         GET_COLOR_CONFIG(SEARCHBAR::BUTTON_TEXT_DISABLED, __buttonTextColor[SEARCH_BAR_BUTTON_STATUS_DISABLED]);
199
200         GET_COLOR_CONFIG(SEARCHBAR::CONTENT_AREA_BG_NORMAL, __contentColor);
201
202         for (int i = 0; i < SEARCHBAR_COLOR_MAX; i++)
203         {
204                 switch (i)
205                 {
206                 case SEARCH_FIELD_STATUS_DISABLED:
207                         GET_COLOR_CONFIG(SEARCHBAR::EDIT_BG_DISABLED, __color[i]);
208                         GET_COLOR_CONFIG(SEARCHBAR::EDIT_TEXT_DISABLED, __textColor[i]);
209                         GET_COLOR_CONFIG(SEARCHBAR::GUIDE_TEXT_DISABLED, __guideTextColor[i]);
210                         break;
211
212                 case SEARCH_FIELD_STATUS_HIGHLIGHTED:
213                         GET_COLOR_CONFIG(SEARCHBAR::EDIT_BG_NORMAL, __color[i]);
214                         GET_COLOR_CONFIG(SEARCHBAR::EDIT_TEXT_HIGHLIGHTED, __textColor[i]);
215                         GET_COLOR_CONFIG(SEARCHBAR::GUIDE_TEXT_NORMAL, __guideTextColor[i]);
216                         break;
217                 default:
218                         GET_COLOR_CONFIG(SEARCHBAR::EDIT_BG_NORMAL, __color[i]);
219                         GET_COLOR_CONFIG(SEARCHBAR::EDIT_TEXT_NORMAL, __textColor[i]);
220                         GET_COLOR_CONFIG(SEARCHBAR::GUIDE_TEXT_NORMAL, __guideTextColor[i]);
221                         break;
222                 }
223         }
224
225         GET_COLOR_CONFIG(SEARCHBAR::BG_NORMAL, __backgroundColor);
226
227         __isUsableCancelButton = enableSearchBarButton;
228         __keypadAction = keypadAction;
229
230         GetVisualElement()->SetClipChildrenEnabled(false);
231
232         r = CreateClippedGroupControl();
233         SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, E_SYSTEM, E_SYSTEM,
234                          "[%s] A system error has occurred. The construction of parent control for clipped group control failed.", GetErrorMessage(E_SYSTEM));
235
236         r = CreateSearchField();
237         SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, E_SYSTEM, E_SYSTEM,
238                          "[%s] A system error has occurred. The edit construction failed.", GetErrorMessage(E_SYSTEM));
239         r = CreateCancelButton();
240         SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, E_SYSTEM, E_SYSTEM,
241                          "[%s] A system error has occurred. The cancel button construction failed.", GetErrorMessage(E_SYSTEM));
242
243         SetContentsArea();
244         r = CreateContentsArea();
245         SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, E_SYSTEM, E_SYSTEM,
246                          "[%s] A system error has occurred. The construction of parent for content failed.", GetErrorMessage(E_SYSTEM));
247
248         _SearchBarPresenter* pPresenter = new (std::nothrow) _SearchBarPresenter();
249         SysTryReturn(NID_UI_CTRL, pPresenter != null, E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
250
251         r = pPresenter->Construct(*this);
252         SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
253
254         r = pPresenter->Install();
255         SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
256
257         __pSearchBarPresenter = pPresenter;
258
259         InitializeAccessibility();
260
261         r = _SettingInfoImpl::AddSettingEventListener(*this);
262         SysTryCatch(NID_UI, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
263
264         return r;
265
266 CATCH:
267         delete pPresenter;
268         pPresenter = null;
269
270         return r;
271 }
272
273 result
274 _SearchBar::CreateSearchField(void)
275 {
276         result r = E_SUCCESS;
277
278         FloatRectangle editBounds;
279         float horizontalMargin = 0.0f;
280         float verticalMargin = 0.0f;
281         float iconHorizontalMargin = 0.0f;
282         float textHorizontalMargin = 0.0f;
283         float iconWidth = 0.0f;
284         float textSize = 0.0f;
285         float searchBarMinHeight = 0.0f;
286         float searchBarMinWidthModeNormal = 0.0f;
287
288         FloatRectangle searchBarBounds = GetBoundsF();
289         _ControlOrientation orientation = _ControlManager::GetInstance()->GetOrientation();
290
291         GET_SHAPE_CONFIG(SEARCHBAR::HORIZONTAL_MARGIN, orientation, horizontalMargin);
292         GET_SHAPE_CONFIG(SEARCHBAR::VERTICAL_MARGIN, orientation, verticalMargin);
293         GET_SHAPE_CONFIG(SEARCHBAR::ICON_HORIZONTAL_MARGIN, orientation, iconHorizontalMargin);
294         GET_SHAPE_CONFIG(SEARCHBAR::ICON_WIDTH, orientation, iconWidth);
295         GET_SHAPE_CONFIG(SEARCHBAR::TEXT_HORIZONTAL_MARGIN, orientation, textHorizontalMargin);
296         GET_SHAPE_CONFIG(SEARCHBAR::SEARCH_FIELD_MIN_WIDTH_NORMAL_MODE, orientation, searchBarMinWidthModeNormal);
297         GET_SHAPE_CONFIG(SEARCHBAR::MIN_HEIGHT, orientation, searchBarMinHeight);
298
299         float searchFieldMinHeight = searchBarMinHeight - (verticalMargin * 2.0f);
300
301         editBounds.x = horizontalMargin;
302
303         if (searchBarBounds.height < searchBarMinHeight)
304         {
305                 verticalMargin = (searchBarBounds.height - searchFieldMinHeight)/2.0f;
306                 if (verticalMargin < 0.0f)
307                 {
308                         verticalMargin = 0.0f;
309                 }
310         }
311
312         editBounds.y = verticalMargin;
313
314         editBounds.width = searchBarBounds.width - (editBounds.x * 2.0f);
315         editBounds.height = searchBarBounds.height - (editBounds.y * 2.0f);
316
317         editBounds.width = (editBounds.width > searchBarMinWidthModeNormal) ? editBounds.width : searchBarMinWidthModeNormal;
318         editBounds.height = (editBounds.height > searchFieldMinHeight) ? editBounds.height : searchFieldMinHeight;
319
320         _SearchBarImpl* pSearchBarImpl = static_cast<_SearchBarImpl*>(GetUserData());
321         SysTryReturnResult(NID_UI_CTRL, pSearchBarImpl != null, E_SYSTEM,
322                            "A system error has occurred. Failed to get _SearchBarImpl instance.");
323
324         __pEdit = &(pSearchBarImpl->GetEditFieldImpl()->GetCore());
325         SysTryReturnResult(NID_UI_CTRL, __pEdit != null, E_SYSTEM,
326                            "A system error has occurred. Failed to get _Edit instance.");
327
328         __pEdit->SetKeypadCommandButtonVisible(false);
329         __pEdit->SetBounds(editBounds);
330         __pEdit->AddKeypadEventListener(*this);
331         __pEdit->AddTextBlockEventListener(*this);
332         __pEdit->AddTextEventListener(*this);
333
334         GET_SHAPE_CONFIG(SEARCHBAR::EDIT_TEXT_SIZE, orientation, textSize);
335         __pEdit->SetTextSize(textSize);
336
337         __pEdit->SetHorizontalMargin(iconHorizontalMargin + iconWidth + textHorizontalMargin, EDIT_TEXT_LEFT_MARGIN);
338         __pEdit->SetHorizontalMargin(textHorizontalMargin, EDIT_TEXT_RIGHT_MARGIN);
339         __pEdit->SetLimitLength(SEARCHBAR_TEXT_LENGTH_MAX);
340
341         for (int status = 0; status < SEARCHBAR_COLOR_MAX; status++)
342         {
343                 EditStatus editStatus = ConvertSearchBarStatus((SearchFieldStatus) status);
344                 __pEdit->SetColor(editStatus, __color[status]);
345         }
346
347         __pEdit->SetTextColor(EDIT_TEXT_COLOR_NORMAL, __textColor[SEARCH_FIELD_STATUS_NORMAL]);
348         __pEdit->SetTextColor(EDIT_TEXT_COLOR_DISABLED, __textColor[SEARCH_FIELD_STATUS_DISABLED]);
349         __pEdit->SetTextColor(EDIT_TEXT_COLOR_HIGHLIGHTED, __textColor[SEARCH_FIELD_STATUS_HIGHLIGHTED]);
350
351         __pEdit->ReplaceDefaultBackgroundBitmapForSearchBar();
352
353         __pEdit->SetKeypadAction(__keypadAction);
354
355         r = __pClippedGroupControl->AttachChild(*__pEdit);
356         SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , E_SYSTEM,
357                         "[%s] A system error has occurred. Failed to attach edit as child.", GetErrorMessage(E_SYSTEM));
358
359         return E_SUCCESS;
360
361 CATCH:
362         delete __pEdit;
363         __pEdit = null;
364
365         return r;
366 }
367
368 result
369 _SearchBar::CreateCancelButton(void)
370 {
371         result r = E_SUCCESS;
372
373         float textSize = 0.0f;
374         String cancelButtonText;
375
376         _ControlOrientation orientation = _ControlManager::GetInstance()->GetOrientation();
377
378         _SearchBarImpl* pSearchBarImpl = static_cast<_SearchBarImpl*>(GetUserData());
379         SysTryReturnResult(NID_UI_CTRL, pSearchBarImpl != null, E_SYSTEM,
380                            "A system error has occurred. Failed to get _SearchBarImpl instance.");
381
382         __pCancelButton = &(pSearchBarImpl->GetButtonImpl()->GetCore());
383         SysTryReturnResult(NID_UI_CTRL, __pCancelButton != null, E_SYSTEM,
384                            "A system error has occurred. Failed to get _Button instance.");
385
386         r = GetLastResult();
387         SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "Propagating.");
388
389         r = ResizeCancelButton();
390         SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
391
392         GET_STRING_CONFIG(IDS_TPLATFORM_BUTTON_CANCEL_ABB, cancelButtonText);
393         r = __pCancelButton->SetText(cancelButtonText);
394         SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
395
396         GET_SHAPE_CONFIG(SEARCHBAR::BUTTON_TEXT_SIZE, orientation, textSize);
397         r = __pCancelButton->SetTextSize(textSize);
398         SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
399
400         __pCancelButton->SetTextHorizontalAlignment(ALIGNMENT_CENTER);
401         __pCancelButton->SetTextVerticalAlignment(ALIGNMENT_MIDDLE);
402
403         r = __pCancelButton->SetActionId(__actionId);
404         SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
405
406         r = __pCancelButton->AddActionEventListener(*this);
407         SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
408
409         __pCancelButton->SetVisibleState(false);
410
411         for (int status = 0; status < SEARCHBAR_BUTTON_COLOR_MAX; status++)
412         {
413                 _ButtonStatus buttonStatus = ConvertSearchBarButtonStatus((SearchBarButtonStatus) status);
414
415                 r = __pCancelButton->SetColor(buttonStatus, __buttonColor[status]);
416                 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
417
418                 r = __pCancelButton->SetTextColor(buttonStatus, __buttonTextColor[status]);
419                 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
420         }
421
422         r = __pClippedGroupControl->AttachChild(*__pCancelButton);
423         SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , E_SYSTEM,
424                         "[%s] A system error has occurred. Failed to attach button as child.", GetErrorMessage(E_SYSTEM));
425
426         return E_SUCCESS;
427
428 CATCH:
429         delete __pCancelButton;
430         __pCancelButton = null;
431
432         return r;
433 }
434
435 result
436 _SearchBar::CreateContentsArea(void)
437 {
438         result r = E_SUCCESS;
439
440         __pContainer = _Control::CreateControlN();
441
442         r = GetLastResult();
443         SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "Propagating.");
444
445         __pContainer->SetVisibleState(false);
446
447         r = AttachChild(*__pContainer);
448         SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , E_SYSTEM,
449                         "[%s] A system error has occurred. Failed to attach the parent of content.", GetErrorMessage(E_SYSTEM));
450
451         return E_SUCCESS;
452
453 CATCH:
454         delete __pContainer;
455         __pContainer = null;
456
457         return r;
458 }
459
460 void
461 _SearchBar::SetContentsArea(void)
462 {
463         if (__isUserContainerBounds)
464         {
465                 return;
466         }
467
468         FloatDimension screenSize = _ControlManager::GetInstance()->GetScreenSizeF();
469         float width = screenSize.width;
470         float height = screenSize.height;
471
472         _Control* pParent = GetParentForm();
473         if (pParent != null)
474         {
475                 width = pParent->GetClientBoundsF().width;
476                 height = pParent->GetClientBoundsF().height;
477         }
478
479         FloatRectangle controlBounds = GetBoundsF();
480         controlBounds = CoordinateSystem::AlignToDevice(FloatRectangle(controlBounds));
481
482         __contentAreaBounds.x = 0.0f;
483         __contentAreaBounds.y = controlBounds.height;
484         __contentAreaBounds.width = width - controlBounds.x;
485         __contentAreaBounds.height = height - (controlBounds.y + controlBounds.height);
486
487         if (__pContainer != null)
488         {
489                 result r = E_SUCCESS;
490                 r = __pContainer->SetBounds(__contentAreaBounds);
491                 SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
492         }
493         return;
494 }
495
496 _Control*
497 _SearchBar::GetContent(void) const
498 {
499         return __pContentControl;
500 }
501
502 result
503 _SearchBar::SetContent(const _Control* pContent)
504 {
505         __pContentControl = const_cast <_Control*>(pContent);
506         result r = E_SUCCESS;
507
508         if (__pContainer != null)
509         {
510                 r = __pContainer->AttachChild(*__pContentControl);
511                 SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "Propagating");
512         }
513
514         return r;
515 }
516
517 result
518 _SearchBar::UpdateContentArea(bool invalidate)
519 {
520         return __pSearchBarPresenter->UpdateContentArea(invalidate);
521 }
522
523 result
524 _SearchBar::SetContentAreaVisible(bool visible, bool isCalledByApp)
525 {
526         SysTryReturn(NID_UI_CTRL, __pContainer != null, E_SYSTEM, E_SYSTEM,
527                          "[%s] A system error has occurred. The instance of parent to content is null.", GetErrorMessage(E_SYSTEM));
528
529         SearchBarMode searchBarMode = GetMode();
530         if (searchBarMode == SEARCH_BAR_MODE_INPUT)
531         {
532                 __pContainer->SetVisibleState(visible);
533         }
534
535         if (isCalledByApp)
536         {
537                 __contentVisibilitySetByApp = visible;
538         }
539
540         return __pSearchBarPresenter->SetContentAreaVisible(visible);
541 }
542
543 bool
544 _SearchBar::IsContentAreaVisible(void) const
545 {
546         return __pSearchBarPresenter->IsContentAreaVisible();
547 }
548
549 result
550 _SearchBar::SetContentAreaSize(const Dimension& size)
551 {
552         return SetProperty("contentAreaSize", Variant(size));
553 }
554
555 Dimension
556 _SearchBar::GetContentAreaSize(void) const
557 {
558         Variant size = GetProperty("contentAreaSize");
559
560         return size.ToDimension();
561 }
562
563 SearchBarMode
564 _SearchBar::GetMode(void) const
565 {
566         return __pSearchBarPresenter->GetMode();
567 }
568
569 bool
570 _SearchBar::IsModeLocked(void) const
571 {
572         return __pSearchBarPresenter->IsModeLocked();
573 }
574
575 result
576 _SearchBar::SetMode(SearchBarMode mode, bool isCalledByApp)
577 {
578         _AccessibilityElement* pEditElement = __pEdit->GetTextAccessibilityElement();
579 //      if (mode == SEARCH_BAR_MODE_NORMAL)
580 //      {
581 //              pEditElement->SetHint("Double Tap To Type Search Text");
582 //      }
583 //      else
584 //      {
585 //              pEditElement->SetHint("Enter Search Text");
586 //      }
587
588 //      pEditElement->SetTrait("SearchBar");
589         pEditElement->SetName("SearchField");
590
591         return __pSearchBarPresenter->SetMode(mode, isCalledByApp);
592 }
593
594 result
595 _SearchBar::SetModeLocked(bool modeLocked)
596 {
597         if (modeLocked && GetMode() == SEARCH_BAR_MODE_NORMAL)
598         {
599                 __pEdit->SetViewModeEnabled(true);
600         }
601
602         if (!modeLocked && __pEdit->IsViewModeEnabled())
603         {
604                 __pEdit->SetViewModeEnabled(false);
605         }
606
607         return __pSearchBarPresenter->SetModeLocked(modeLocked);
608 }
609
610 int
611 _SearchBar::GetButtonActionId(void) const
612 {
613         Variant actionId = GetProperty("buttonActionId");
614
615         return actionId.ToInt();
616 }
617
618 Color
619 _SearchBar::GetButtonColor(SearchBarButtonStatus status) const
620 {
621         Variant buttonColor;
622
623         switch (status)
624         {
625         case SEARCH_BAR_BUTTON_STATUS_NORMAL:
626                 buttonColor = GetProperty("buttonNormalColor");
627                 break;
628         case SEARCH_BAR_BUTTON_STATUS_PRESSED:
629                 buttonColor = GetProperty("buttonPressedColor");
630                 break;
631         case SEARCH_BAR_BUTTON_STATUS_HIGHLIGHTED:
632                 buttonColor = GetProperty("buttonHighlightedColor");
633                 break;
634         case SEARCH_BAR_BUTTON_STATUS_DISABLED:
635                 buttonColor = GetProperty("buttonDisabledColor");
636                 break;
637         default:
638                 break;
639         }
640
641         return buttonColor.ToColor();
642 }
643
644 Color
645 _SearchBar::GetButtonTextColor(SearchBarButtonStatus status) const
646 {
647         Variant buttonTextColor;
648
649         switch (status)
650         {
651         case SEARCH_BAR_BUTTON_STATUS_NORMAL:
652                 buttonTextColor = GetProperty("buttonNormalTextColor");
653                 break;
654         case SEARCH_BAR_BUTTON_STATUS_PRESSED:
655                 buttonTextColor = GetProperty("buttonPressedTextColor");
656                 break;
657         case SEARCH_BAR_BUTTON_STATUS_HIGHLIGHTED:
658                 buttonTextColor = GetProperty("buttonHighlightedTextColor");
659                 break;
660         case SEARCH_BAR_BUTTON_STATUS_DISABLED:
661                 buttonTextColor = GetProperty("buttonDisabledTextColor");
662                 break;
663         default:
664                 break;
665         }
666
667         return buttonTextColor.ToColor();
668 }
669
670 SearchBarButtonStatus
671 _SearchBar::GetButtonStatus(void) const
672 {
673         SysTryReturn(NID_UI_CTRL, __pCancelButton != null, SEARCH_BAR_BUTTON_STATUS_NORMAL, E_SYSTEM,
674                          "[%s] A system error has occurred. The _Button instance is null.", GetErrorMessage(E_SYSTEM));
675
676         SearchBarButtonStatus buttonStatus = SEARCH_BAR_BUTTON_STATUS_NORMAL;
677
678         if (!__isButtonEnabled)
679         {
680                 buttonStatus = SEARCH_BAR_BUTTON_STATUS_DISABLED;
681         }
682
683         return buttonStatus;
684 }
685
686 result
687 _SearchBar::SetButtonText(const String& text)
688 {
689         SysTryReturn(NID_UI_CTRL, __pCancelButton != null, E_SYSTEM, E_SYSTEM,
690                          "[%s] A system error has occurred. The _Button instance is null.", GetErrorMessage(E_SYSTEM));
691
692         result r = E_SUCCESS;
693
694         r = __pCancelButton->SetText(text);
695         SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, E_SYSTEM, E_SYSTEM,
696                          "[%s] A system error has occurred. Failed to set text.", GetErrorMessage(E_SYSTEM));
697
698         __isButtonTextChangedByApp = true;
699
700         return r;
701 }
702
703 result
704 _SearchBar::SetButtonActionId(int actionId)
705 {
706         return SetProperty("buttonActionId", Variant(actionId));
707 }
708
709 result
710 _SearchBar::SetButtonEnabled(bool enabled)
711 {
712         SysTryReturn(NID_UI_CTRL, __pCancelButton != null, E_SYSTEM, E_SYSTEM,
713                          "[%s] A system error has occurred. The _Button instance is null.", GetErrorMessage(E_SYSTEM));
714
715         __pCancelButton->SetEnableState(enabled);
716
717         __isButtonEnabled = enabled;
718
719         return E_SUCCESS;
720 }
721
722 result
723 _SearchBar::SetButtonColor(SearchBarButtonStatus status, const Color& color)
724 {
725         result r = E_SUCCESS;
726
727         switch (status)
728         {
729         case SEARCH_BAR_BUTTON_STATUS_NORMAL:
730                 r = SetProperty("buttonNormalColor", Variant(color));
731                 break;
732         case SEARCH_BAR_BUTTON_STATUS_PRESSED:
733                 r = SetProperty("buttonPressedColor", Variant(color));
734                 break;
735         case SEARCH_BAR_BUTTON_STATUS_HIGHLIGHTED:
736                 r = SetProperty("buttonHighlightedColor", Variant(color));
737                 break;
738         case SEARCH_BAR_BUTTON_STATUS_DISABLED:
739                 r = SetProperty("buttonDisabledColor", Variant(color));
740                 break;
741         default:
742                 break;
743         }
744
745         return r;
746 }
747
748 result
749 _SearchBar::SetButtonTextColor(SearchBarButtonStatus status, const Color& color)
750 {
751         result r = E_SUCCESS;
752
753         switch (status)
754         {
755         case SEARCH_BAR_BUTTON_STATUS_NORMAL:
756                 r = SetProperty("buttonNormalTextColor", Variant(color));
757                 break;
758         case SEARCH_BAR_BUTTON_STATUS_PRESSED:
759                 r = SetProperty("buttonPressedTextColor", Variant(color));
760                 break;
761         case SEARCH_BAR_BUTTON_STATUS_HIGHLIGHTED:
762                 r = SetProperty("buttonHighlightedTextColor", Variant(color));
763                 break;
764         case SEARCH_BAR_BUTTON_STATUS_DISABLED:
765                 r = SetProperty("buttonDisabledTextColor", Variant(color));
766                 break;
767         default:
768                 break;
769         }
770
771         return r;
772 }
773
774 result
775 _SearchBar::AppendCharacter(const Character& character)
776 {
777         SysTryReturn(NID_UI_CTRL, __pEdit != null, E_SYSTEM, E_SYSTEM,
778                          "[%s] A system error has occurred. The _Edit instance is null.", GetErrorMessage(E_SYSTEM));
779         SysTryReturn(NID_UI_CTRL, character.CompareTo(null), E_SYSTEM, E_SYSTEM,
780                          "[%s] A system error has occurred. The character is null.", GetErrorMessage(E_SYSTEM));
781
782         result r = E_SUCCESS;
783
784         r = __pEdit->AppendCharacter(character);
785         SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, E_SYSTEM, E_SYSTEM,
786                          "[%s] A system error has occurred. Failed to set character.", GetErrorMessage(E_SYSTEM));
787
788         return r;
789 }
790
791 result
792 _SearchBar::AppendText(const String& text)
793 {
794         SysTryReturn(NID_UI_CTRL, __pEdit != null, E_SYSTEM, E_SYSTEM,
795                          "[%s] A system error has occurred. The _Edit instance is null.", GetErrorMessage(E_SYSTEM));
796         SysTryReturn(NID_UI_CTRL, text.IsEmpty() == false, E_SYSTEM, E_SYSTEM,
797                          "[%s] A system error has occurred. The text is empty.", GetErrorMessage(E_SYSTEM));
798
799         result r = E_SUCCESS;
800
801         r = __pEdit->AppendText(text);
802         SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, E_SYSTEM, E_SYSTEM,
803                          "[%s] A system error has occurred. Failed to set text.", GetErrorMessage(E_SYSTEM));
804
805         return r;
806 }
807
808 result
809 _SearchBar::SetText(const String& text)
810 {
811         SysTryReturn(NID_UI_CTRL, __pEdit != null, E_SYSTEM, E_SYSTEM,
812                          "[%s] A system error has occurred. The _Edit instance is null.", GetErrorMessage(E_SYSTEM));
813
814         result r = E_SUCCESS;
815
816         int limitLength = __pEdit->GetTextLimitLength();
817         int textLength = text.GetLength();
818         SysTryReturn(NID_UI_CTRL, limitLength >= textLength, E_SYSTEM, E_SYSTEM,
819                          "[%s] A system error has occurred. textLength exceeds the limitLength", GetErrorMessage(E_SYSTEM));
820
821         r = __pEdit->SetText(text);
822         SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, E_SYSTEM, E_SYSTEM,
823                          "[%s] A system error has occurred. Failed to set text.", GetErrorMessage(E_SYSTEM));
824
825         return r;
826 }
827
828 result
829 _SearchBar::InsertCharacterAt(int index, const Character& character)
830 {
831         SysTryReturn(NID_UI_CTRL, __pEdit != null, E_SYSTEM, E_SYSTEM,
832                          "[%s] A system error has occurred. The _Edit instance is null.", GetErrorMessage(E_SYSTEM));
833         SysTryReturn(NID_UI_CTRL, index > -1, E_OUT_OF_RANGE, E_OUT_OF_RANGE,
834                          "[%s] index(%d) is out of range.", GetErrorMessage(E_OUT_OF_RANGE), index);
835         SysTryReturn(NID_UI_CTRL, character.CompareTo(null), E_SYSTEM, E_SYSTEM,
836                          "[%s] A system error has occurred. The character is null.", GetErrorMessage(E_SYSTEM));
837
838         result r = E_SUCCESS;
839
840         int textLength = 0;
841         int limitLength = 0;
842         limitLength = __pEdit->GetTextLimitLength();
843         textLength = __pEdit->GetTextLength() + 1;
844
845         SysTryReturn(NID_UI_CTRL, limitLength >= textLength, E_MAX_EXCEEDED, E_MAX_EXCEEDED,
846                          "[%s] limitLength(%d) exceeds the maximum limit textLength(%d).", GetErrorMessage(E_MAX_EXCEEDED), limitLength, textLength);
847
848         SysTryReturn(NID_UI_CTRL, index <= __pEdit->GetTextLength(), E_OUT_OF_RANGE, E_OUT_OF_RANGE,
849                          "[%s] index(%d) is out of range of current textLength(%d).", GetErrorMessage(E_OUT_OF_RANGE), index, __pEdit->GetTextLength());
850
851         r = __pEdit->InsertCharacterAt(index, character);
852         SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, E_SYSTEM, E_SYSTEM,
853                          "[%s] A system error has occurred. Failed to set text.", GetErrorMessage(E_SYSTEM));
854
855         return r;
856 }
857
858 result
859 _SearchBar::InsertTextAt(int index, const String& text)
860 {
861         SysTryReturn(NID_UI_CTRL, __pEdit != null, E_SYSTEM, E_SYSTEM,
862                          "[%s] A system error has occurred. The _Edit instance is null.", GetErrorMessage(E_SYSTEM));
863         SysTryReturn(NID_UI_CTRL, index > -1, E_OUT_OF_RANGE, E_OUT_OF_RANGE,
864                          "[%s] index(%d) is out of range.", GetErrorMessage(E_OUT_OF_RANGE), index);
865
866         result r = E_SUCCESS;
867
868         int textLength = 0;
869         int limitLength = 0;
870         limitLength = __pEdit->GetTextLimitLength();
871         textLength = __pEdit->GetTextLength() + text.GetLength();
872
873         SysTryReturn(NID_UI_CTRL, limitLength >= textLength, E_MAX_EXCEEDED, E_MAX_EXCEEDED,
874                          "[%s] limitLength(%d) exceeds the maximum limit textLength(%d).", GetErrorMessage(E_MAX_EXCEEDED), limitLength, textLength);
875         SysTryReturn(NID_UI_CTRL, index <= __pEdit->GetTextLength(), E_OUT_OF_RANGE, E_OUT_OF_RANGE,
876                          "[%s] index(%d) is out of range of current textLength(%d).", GetErrorMessage(E_OUT_OF_RANGE), index, __pEdit->GetTextLength());
877
878         r = __pEdit->InsertTextAt(index, text);
879         SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, E_SYSTEM, E_SYSTEM,
880                          "[%s] A system error has occurred. Failed to insert text.", GetErrorMessage(E_SYSTEM));
881
882         return r;
883 }
884
885 result
886 _SearchBar::DeleteCharacterAt(int index)
887 {
888         SysTryReturn(NID_UI_CTRL, __pEdit != null, E_SYSTEM, E_SYSTEM,
889                          "[%s] A system error has occurred. The _Edit instance is null.", GetErrorMessage(E_SYSTEM));
890         SysTryReturn(NID_UI_CTRL, index > -1, E_INVALID_ARG, E_INVALID_ARG,
891                          "[%s] Invalid argument(s) is used. index = %d", GetErrorMessage(E_INVALID_ARG), index);
892
893         result r = E_SUCCESS;
894         int textLength = 0;
895         textLength = __pEdit->GetTextLength();
896
897         SysTryReturn(NID_UI_CTRL, textLength > index, E_OUT_OF_RANGE, E_OUT_OF_RANGE,
898                          "[%s] index(%d) is out of range. textLength(%d)", GetErrorMessage(E_OUT_OF_RANGE), index, textLength);
899
900         r = __pEdit->DeleteCharacterAt(index);
901         SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, E_SYSTEM,
902                            "A system error has occurred. Failed to delete character.");
903
904         return r;
905 }
906
907 result
908 _SearchBar::Clear(void)
909 {
910         SysTryReturn(NID_UI_CTRL, __pEdit != null, E_SYSTEM, E_SYSTEM,
911                          "[%s] A system error has occurred. The _Edit instance is null.", GetErrorMessage(E_SYSTEM));
912
913         return __pEdit->ClearText();
914 }
915
916 int
917 _SearchBar::GetTextLength(void) const
918 {
919         SysTryReturn(NID_UI_CTRL, __pEdit != null, -1, E_SYSTEM,
920                          "[%s] A system error has occurred. The _Edit instance is null.", GetErrorMessage(E_SYSTEM));
921
922         return __pEdit->GetTextLength();
923 }
924
925 String
926 _SearchBar::GetText(void) const
927 {
928         SysTryReturn(NID_UI_CTRL, __pEdit != null, String(), E_SYSTEM,
929                          "[%s] A system error has occurred. The _Edit instance is null.", GetErrorMessage(E_SYSTEM));
930
931         return __pEdit->GetText();
932 }
933
934 String
935 _SearchBar::GetText(int start, int end) const
936 {
937         SysTryReturn(NID_UI_CTRL, __pEdit != null, String(), E_SYSTEM,
938                          "[%s] A system error has occurred. The _Edit instance is null.", GetErrorMessage(E_SYSTEM));
939
940         return __pEdit->GetText(start, end);
941 }
942
943 int
944 _SearchBar::GetLimitLength(void) const
945 {
946         SysTryReturn(NID_UI_CTRL, __pEdit != null, -1, E_SYSTEM,
947                          "[%s] A system error has occurred. The _Edit instance is null.", GetErrorMessage(E_SYSTEM));
948
949         return __pEdit->GetTextLimitLength();
950 }
951
952 result
953 _SearchBar::SetLimitLength(int limitLength)
954 {
955         SysTryReturn(NID_UI_CTRL, __pEdit != null, E_SYSTEM, E_SYSTEM,
956                          "[%s] A system error has occurred. The _Edit instance is null.", GetErrorMessage(E_SYSTEM));
957         SysTryReturn(NID_UI_CTRL, limitLength > 0, E_INVALID_ARG, E_INVALID_ARG,
958                          "[%s] Invalid argument(s) is used.limitLength = %d", GetErrorMessage(E_INVALID_ARG), limitLength);
959
960         String tempString = GetText();
961
962         int textLength = tempString.GetLength();
963         SysTryReturn(NID_UI_CTRL, limitLength >= textLength, E_INVALID_ARG, E_INVALID_ARG,
964                          "[%s] Invalid argument(s) is used. limitLength = %d, textLength = %d", GetErrorMessage(E_INVALID_ARG), limitLength, textLength);
965
966         result r = __pEdit->SetLimitLength(limitLength);
967         SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
968
969         r = SetText(tempString);
970         SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, E_SYSTEM, r, "[%s] Propagating.", GetErrorMessage(r));
971
972         return E_SUCCESS;
973 }
974
975 result
976 _SearchBar::ShowKeypad(void) const
977 {
978         SysTryReturn(NID_UI_CTRL, __pEdit != null, E_SYSTEM, E_SYSTEM,
979                          "[%s] A system error has occurred. The _Edit instance is null.", GetErrorMessage(E_SYSTEM));
980
981         SearchBarMode mode = __pSearchBarPresenter->GetMode();
982         SysTryReturn(NID_UI_CTRL, mode == SEARCH_BAR_MODE_INPUT, E_INVALID_STATE, E_INVALID_STATE,
983                          "[%s] The SearchBar is currently in Normal mode.", GetErrorMessage(E_INVALID_STATE));
984         return __pEdit->ShowKeypad();
985 }
986
987 result
988 _SearchBar::HideKeypad(void)
989 {
990         SysTryReturn(NID_UI_CTRL, __pEdit != null, E_SYSTEM, E_SYSTEM,
991                          "[%s] A system error has occurred. The _Edit instance is null.", GetErrorMessage(E_SYSTEM));
992
993         SearchBarMode mode = __pSearchBarPresenter->GetMode();
994         SysTryReturn(NID_UI_CTRL, mode == SEARCH_BAR_MODE_INPUT, E_SYSTEM, E_SYSTEM,
995                          "[%s] A system error has occurred. The SearchBar is currently in Normal mode.", GetErrorMessage(E_SYSTEM));
996
997         result r = __pEdit->HideKeypad();
998
999         SetContentsArea();
1000
1001         return r;
1002 }
1003
1004 float
1005 _SearchBar::GetSearchFieldTextSizeF(void) const
1006 {
1007         SysTryReturn(NID_UI_CTRL, __pEdit != null, -1, E_SYSTEM,
1008                          "[%s] A system error has occurred. The _Edit instance is null.", GetErrorMessage(E_SYSTEM));
1009
1010         return __pEdit->GetTextSizeF();
1011 }
1012
1013 result
1014 _SearchBar::SetSearchFieldTextSize(float size)
1015 {
1016         SysTryReturn(NID_UI_CTRL, __pEdit != null, E_SYSTEM, E_SYSTEM,
1017                          "[%s] A system error has occurred. The _Edit instance is null.", GetErrorMessage(E_SYSTEM));
1018
1019         return __pEdit->SetTextSize(size);
1020 }
1021
1022 result
1023 _SearchBar::GetBlockRange(int& start, int& end) const
1024 {
1025         SysTryReturn(NID_UI_CTRL, __pEdit != null, E_SYSTEM, E_SYSTEM,
1026                          "[%s] A system error has occurred. The _Edit instance is null.", GetErrorMessage(E_SYSTEM));
1027
1028         int startIndex = -1;
1029         int endIndex = -1;
1030
1031         __pEdit->GetBlockRange(startIndex, endIndex);
1032         SysTryReturn(NID_UI_CTRL, (startIndex > -1 && endIndex > 0), E_SYSTEM, E_SYSTEM,
1033                          "[%s] A system error has occurred. Failed to get text block range.", GetErrorMessage(E_SYSTEM));
1034
1035         start = startIndex;
1036         end = endIndex - 1;
1037
1038         return E_SUCCESS;
1039 }
1040
1041 result
1042 _SearchBar::ReleaseBlock(void)
1043 {
1044         SysTryReturn(NID_UI_CTRL, __pEdit != null, E_SYSTEM, E_SYSTEM,
1045                          "[%s] A system error has occurred. The _Edit instance is null.", GetErrorMessage(E_SYSTEM));
1046
1047         result r = E_SUCCESS;
1048
1049         int start = 0;
1050         int end = 0;
1051
1052         r = GetBlockRange(start, end);
1053         SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
1054
1055         return __pEdit->ReleaseTextBlock();
1056 }
1057
1058 result
1059 _SearchBar::SetBlockRange(int start, int end)
1060 {
1061         SysTryReturn(NID_UI_CTRL, __pEdit != null, E_SYSTEM, E_SYSTEM,
1062                          "[%s] A system error has occurred. The _Edit instance is null.", GetErrorMessage(E_SYSTEM));
1063
1064         result r = E_SUCCESS;
1065
1066         int textLength = 0;
1067         textLength = __pEdit->GetTextLength();
1068
1069         SysTryReturn(NID_UI_CTRL, (start < end && start >= 0 && textLength >= end), E_OUT_OF_RANGE, E_OUT_OF_RANGE,
1070                          "[%s] start (%d) and end (%d) is out of range.", GetErrorMessage(E_OUT_OF_RANGE), start, end - 1);
1071
1072         r = SetCursorPosition(start);
1073         SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "Propagating.");
1074
1075         r = __pEdit->BeginTextBlock();
1076         SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, E_SYSTEM, E_SYSTEM,
1077                          "[%s] A system error has occurred. Failed to set text block range.", GetErrorMessage(E_SYSTEM));
1078
1079         r = SetCursorPosition(end);
1080         SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, E_SYSTEM, E_SYSTEM,
1081                          "[%s] A system error has occurred. Failed to set cursor position.", GetErrorMessage(E_SYSTEM));
1082
1083         return E_SUCCESS;
1084 }
1085
1086 result
1087 _SearchBar::RemoveTextBlock(void)
1088 {
1089         SysTryReturn(NID_UI_CTRL, __pEdit != null, E_SYSTEM, E_SYSTEM,
1090                          "[%s] A system error has occurred. The _Edit instance is null.", GetErrorMessage(E_SYSTEM));
1091
1092         result r = E_SUCCESS;
1093
1094         r = __pEdit->RemoveTextBlock();
1095         SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
1096
1097         return r;
1098 }
1099
1100 Color
1101 _SearchBar::GetColor(void) const
1102 {
1103         Variant backgroundColor = GetProperty("color");
1104
1105         return backgroundColor.ToColor();
1106 }
1107
1108 Color
1109 _SearchBar::GetSearchFieldColor(SearchFieldStatus status) const
1110 {
1111         Variant searchFieldColor;
1112
1113         switch (status)
1114         {
1115         case SEARCH_FIELD_STATUS_NORMAL:
1116                 searchFieldColor = GetProperty("searchFieldNormalColor");
1117                 break;
1118         case SEARCH_FIELD_STATUS_HIGHLIGHTED:
1119                 searchFieldColor = GetProperty("searchFieldHighlightedColor");
1120                 break;
1121         case SEARCH_FIELD_STATUS_DISABLED:
1122                 searchFieldColor = GetProperty("searchFieldDisabledColor");
1123                 break;
1124         default:
1125                 break;
1126         }
1127
1128         return searchFieldColor.ToColor();
1129 }
1130
1131
1132 Color
1133 _SearchBar::GetSearchFieldTextColor(SearchFieldStatus status) const
1134 {
1135         Variant searchFieldTextColor;
1136
1137         switch (status)
1138         {
1139         case SEARCH_FIELD_STATUS_NORMAL:
1140                 searchFieldTextColor = GetProperty("searchFieldNormalTextColor");
1141                 break;
1142         case SEARCH_FIELD_STATUS_HIGHLIGHTED:
1143                 searchFieldTextColor = GetProperty("searchFieldHighlightedTextColor");
1144                 break;
1145         case SEARCH_FIELD_STATUS_DISABLED:
1146                 searchFieldTextColor = GetProperty("searchFieldDisabledTextColor");
1147                 break;
1148         default:
1149                 break;
1150         }
1151
1152         return searchFieldTextColor.ToColor();
1153 }
1154
1155
1156 result
1157 _SearchBar::SetBackgroundBitmap(const Bitmap& bitmap)
1158 {
1159         Bitmap* pNewBitmap = _BitmapImpl::CloneN(bitmap);
1160         SysTryReturn(NID_UI_CTRL, pNewBitmap != null, E_SYSTEM, E_SYSTEM,
1161                          "[%s] A system error has occurred. The creation of bitmap failed.", GetErrorMessage(E_SYSTEM));
1162
1163         delete __pBackgroundBitmap;
1164         __pBackgroundBitmap = null;
1165
1166         __pBackgroundBitmap = pNewBitmap;
1167
1168         return E_SUCCESS;
1169 }
1170
1171 Bitmap*
1172 _SearchBar::GetBackgroundBitmap(void) const
1173 {
1174         return __pBackgroundBitmap;
1175 }
1176
1177 result
1178 _SearchBar::SetColor(const Color& color)
1179 {
1180         return SetProperty("color", Variant(color));
1181 }
1182
1183 result
1184 _SearchBar::SetSearchFieldColor(SearchFieldStatus status, const Color& color)
1185 {
1186         result r = E_SUCCESS;
1187
1188         switch (status)
1189         {
1190         case SEARCH_FIELD_STATUS_NORMAL:
1191                 r = SetProperty("searchFieldNormalColor", Variant(color));
1192                 break;
1193         case SEARCH_FIELD_STATUS_HIGHLIGHTED:
1194                 r = SetProperty("searchFieldHighlightedColor", Variant(color));
1195                 break;
1196         case SEARCH_FIELD_STATUS_DISABLED:
1197                 r = SetProperty("searchFieldDisabledColor", Variant(color));
1198                 break;
1199         default:
1200                 break;
1201         }
1202
1203         return r;
1204 }
1205
1206
1207 result
1208 _SearchBar::SetSearchFieldTextColor(SearchFieldStatus status, const Color& color)
1209 {
1210         result r = E_SUCCESS;
1211
1212         switch (status)
1213         {
1214         case SEARCH_FIELD_STATUS_NORMAL:
1215                 r = SetProperty("searchFieldNormalTextColor", Variant(color));
1216                 break;
1217         case SEARCH_FIELD_STATUS_HIGHLIGHTED:
1218                 r = SetProperty("searchFieldHighlightedTextColor", Variant(color));
1219                 break;
1220         case SEARCH_FIELD_STATUS_DISABLED:
1221                 r = SetProperty("searchFieldDisabledTextColor", Variant(color));
1222                 break;
1223         default:
1224                 break;
1225         }
1226
1227         return r;
1228 }
1229
1230
1231 String
1232 _SearchBar::GetGuideText(void) const
1233 {
1234         SysTryReturn(NID_UI_CTRL, __pEdit != null, String(), E_SYSTEM,
1235                          "[%s] A system error has occurred. The _Edit instance is null.", GetErrorMessage(E_SYSTEM));
1236
1237         return __pEdit->GetGuideText();
1238 }
1239
1240 result
1241 _SearchBar::SetGuideText(const String& guideText)
1242 {
1243         SysTryReturn(NID_UI_CTRL, __pEdit != null, E_SYSTEM, E_SYSTEM,
1244                          "[%s] A system error has occurred. The _Edit instance is null.", GetErrorMessage(E_SYSTEM));
1245
1246         __pEdit->SetGuideText(guideText);
1247
1248         return E_SUCCESS;
1249 }
1250
1251 Color
1252 _SearchBar::GetGuideTextColor(void) const
1253 {
1254         SysTryReturn(NID_UI_CTRL, __pEdit != null, E_SYSTEM, E_SYSTEM,
1255                          "[%s] A system error has occurred. The _Edit instance is null.", GetErrorMessage(E_SYSTEM));
1256
1257         return __pEdit->GetGuideTextColor();
1258 }
1259
1260 result
1261 _SearchBar::SetGuideTextColor(const Color& color)
1262 {
1263         SysTryReturn(NID_UI_CTRL, __pEdit != null, E_SYSTEM, E_SYSTEM,
1264                          "[%s] A system error has occurred. The _Edit instance is null.", GetErrorMessage(E_SYSTEM));
1265
1266         __isUserGuideTextColor = true;
1267         return __pEdit->SetGuideTextColor(color);
1268 }
1269
1270 int
1271 _SearchBar::GetCursorPosition(void) const
1272 {
1273         SysTryReturn(NID_UI_CTRL, __pEdit != null, -1, E_SYSTEM,
1274                          "[%s] A system error has occurred. The _Edit instance is null.", GetErrorMessage(E_SYSTEM));
1275
1276         return __pEdit->GetCursorPosition();
1277 }
1278
1279 result
1280 _SearchBar::SetCursorPosition(int index)
1281 {
1282         SysTryReturn(NID_UI_CTRL, __pEdit != null, E_SYSTEM, E_SYSTEM,
1283                          "[%s] A system error has occurred. The _Edit instance is null.", GetErrorMessage(E_SYSTEM));
1284         SysTryReturn(NID_UI_CTRL, index > -1, E_OUT_OF_RANGE, E_OUT_OF_RANGE,
1285                          "[%s] index(%d) is out of range.", GetErrorMessage(E_OUT_OF_RANGE), index);
1286
1287         int textLength = -1;
1288         textLength = __pEdit->GetTextLength();
1289
1290         SysTryReturn(NID_UI_CTRL, (index > -1 && index <= textLength), E_OUT_OF_RANGE, E_OUT_OF_RANGE,
1291                          "[%s] index(%d) is out of range.", GetErrorMessage(E_OUT_OF_RANGE), index);
1292
1293         return __pEdit->SetCursorPosition(index);
1294 }
1295
1296 bool
1297 _SearchBar::IsLowerCaseModeEnabled(void) const
1298 {
1299         SysTryReturn(NID_UI_CTRL, __pEdit != null, E_SYSTEM, E_SYSTEM,
1300                          "[%s] A system error has occurred. The _Edit instance is null.", GetErrorMessage(E_SYSTEM));
1301
1302         return __pEdit->IsLowerCaseModeEnabled();
1303 }
1304
1305 void
1306 _SearchBar::SetLowerCaseModeEnabled(bool enable)
1307 {
1308         SysTryReturnVoidResult(NID_UI_CTRL, __pEdit != null, E_SYSTEM,
1309                                    "[%s] A system error has occurred. The _Edit instance is null.", GetErrorMessage(E_SYSTEM));
1310
1311         __pEdit->SetLowerCaseModeEnabled(enable);
1312 }
1313
1314 EllipsisPosition
1315 _SearchBar::GetEllipsisPosition(void) const
1316 {
1317         SysTryReturn(NID_UI_CTRL, __pEdit != null, ELLIPSIS_POSITION_START, E_SYSTEM,
1318                          "[%s] A system error has occurred. The _Edit instance is null.", GetErrorMessage(E_SYSTEM));
1319
1320         return __pEdit->GetEllipsisPosition();
1321 }
1322
1323 result
1324 _SearchBar::SetEllipsisPosition(EllipsisPosition position)
1325 {
1326         SysTryReturn(NID_UI_CTRL, __pEdit != null, E_SYSTEM, E_SYSTEM,
1327                          "[%s] A system error has occurred. The _Edit instance is null.", GetErrorMessage(E_SYSTEM));
1328         __pEdit->SetEllipsisPosition(position);
1329
1330         return E_SUCCESS;
1331 }
1332
1333 CoreKeypadAction
1334 _SearchBar::GetKeypadAction(void) const
1335 {
1336         return __keypadAction;
1337 }
1338
1339 bool
1340 _SearchBar::IsTextPredictionEnabled(void) const
1341 {
1342         SysTryReturn(NID_UI_CTRL, __pEdit != null, false, E_SYSTEM,
1343                          "[%s] A system error has occurred. The _Edit instance is null.", GetErrorMessage(E_SYSTEM));
1344         return __pEdit->IsTextPredictionEnabled();
1345 }
1346
1347 result
1348 _SearchBar::SetTextPredictionEnabled(bool enable)
1349 {
1350         SysTryReturn(NID_UI_CTRL, __pEdit != null, E_SYSTEM, E_SYSTEM,
1351                          "[%s] A system error has occurred. The _Edit instance is null.", GetErrorMessage(E_SYSTEM));
1352         return __pEdit->SetTextPredictionEnabled(enable);
1353 }
1354
1355 result
1356 _SearchBar::SetCurrentLanguage(LanguageCode languageCode)
1357 {
1358         return __pEdit->SetCurrentLanguage(languageCode);
1359 }
1360
1361 result
1362 _SearchBar::GetCurrentLanguage(LanguageCode& language) const
1363 {
1364         return __pEdit->GetCurrentLanguage(language);
1365 }
1366
1367 result
1368 _SearchBar::AddActionEventListener(const _IActionEventListener& listener)
1369 {
1370         result r = E_SUCCESS;
1371
1372         if (__pActionEvent == null)
1373         {
1374                 __pActionEvent = _ActionEvent::CreateInstanceN(*this);
1375                 r = GetLastResult();
1376                 SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "Propagating.");
1377
1378                 __pActionEvent->AddListener(listener);
1379         }
1380
1381         return r;
1382 }
1383
1384 result
1385 _SearchBar::RemoveActionEventListener(const _IActionEventListener& listener)
1386 {
1387         SysTryReturn(NID_UI_CTRL, __pActionEvent != null, E_SYSTEM, E_SYSTEM,
1388                          "[%s] A system error has occurred. The action event instance is null.", GetErrorMessage(E_SYSTEM));
1389         result r = E_SUCCESS;
1390
1391         r = __pActionEvent->RemoveListener(listener);
1392         SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "Propagating.");
1393
1394         return r;
1395 }
1396
1397 result
1398 _SearchBar::AddKeypadEventListener(const _IKeypadEventListener& listener)
1399 {
1400         result r = E_SUCCESS;
1401
1402         if (__pKeypadEvent == null)
1403         {
1404                 __pKeypadEvent = _KeypadEvent::CreateInstanceN(*this);
1405                 r = GetLastResult();
1406                 SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "Propagating.");
1407
1408                 r = __pKeypadEvent->AddListener(listener);
1409                 SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "Propagating.");
1410         }
1411
1412         return r;
1413 }
1414
1415 result
1416 _SearchBar::RemoveKeypadEventListener(const _IKeypadEventListener& listener)
1417 {
1418         SysTryReturn(NID_UI_CTRL, __pKeypadEvent != null, E_SYSTEM, E_SYSTEM,
1419                          "[%s] A system error has occurred. The keypad event instance is null.", GetErrorMessage(E_SYSTEM));
1420         result r = E_SUCCESS;
1421
1422         r = __pKeypadEvent->RemoveListener(listener);
1423         SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "Propagating.");
1424
1425         return r;
1426 }
1427
1428 result
1429 _SearchBar::AddTextBlockEventListener(const _ITextBlockEventListener& listener)
1430 {
1431         result r = E_SUCCESS;
1432
1433         if (__pTextBlockEvent == null)
1434         {
1435                 __pTextBlockEvent = _TextBlockEvent::CreateInstanceN(*this);
1436                 r = GetLastResult();
1437                 SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "Propagating.");
1438
1439                 r = __pTextBlockEvent->AddListener(listener);
1440                 SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "Propagating.");
1441
1442         }
1443
1444         return r;
1445 }
1446
1447 result
1448 _SearchBar::RemoveTextBlockEventListener(const _ITextBlockEventListener& listener)
1449 {
1450         SysTryReturn(NID_UI_CTRL, __pTextBlockEvent != null, E_SYSTEM, E_SYSTEM,
1451                          "[%s] A system error has occurred. The text block event instance is null.", GetErrorMessage(E_SYSTEM));
1452         result r = E_SUCCESS;
1453
1454         r = __pTextBlockEvent->RemoveListener(listener);
1455         SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "Propagating.");
1456
1457         return r;
1458 }
1459
1460
1461 result
1462 _SearchBar::AddTextEventListener(const _ITextEventListener& listener)
1463 {
1464         result r = E_SUCCESS;
1465
1466         if (__pTextEvent == null)
1467         {
1468                 __pTextEvent = _TextEvent::CreateInstanceN(*this);
1469                 r = GetLastResult();
1470                 SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "Propagating.");
1471
1472                 r = __pTextEvent->AddListener(listener);
1473                 SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "Propagating.");
1474         }
1475
1476         return r;
1477 }
1478
1479 result
1480 _SearchBar::RemoveTextEventListener(const _ITextEventListener& listener)
1481 {
1482         SysTryReturn(NID_UI_CTRL, __pTextEvent != null, E_SYSTEM, E_SYSTEM,
1483                          "[%s] A system error has occurred. The text event instance is null.", GetErrorMessage(E_SYSTEM));
1484         result r = E_SUCCESS;
1485
1486         r = __pTextEvent->RemoveListener(listener);
1487         SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "Propagating.");
1488
1489         return r;
1490 }
1491
1492 result
1493 _SearchBar::AddSearchBarEventListener(const _ISearchBarEventListener& listener)
1494 {
1495         result r = E_SUCCESS;
1496
1497         if (__pSearchBarEvent == null)
1498         {
1499                 __pSearchBarEvent = _SearchBarEvent::CreateInstanceN(*this);
1500                 r = GetLastResult();
1501                 SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "Propagating.");
1502
1503                 r = __pSearchBarEvent->AddListener(listener);
1504                 SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "Propagating.");
1505         }
1506
1507         return r;
1508 }
1509
1510 result
1511 _SearchBar::RemoveSearchBarEventListener(const _ISearchBarEventListener& listener)
1512 {
1513         SysTryReturn(NID_UI_CTRL, __pSearchBarEvent != null, E_SYSTEM, E_SYSTEM,
1514                          "[%s] A system error has occurred. The searchbar event instance is null.", GetErrorMessage(E_SYSTEM));
1515         result r = E_SUCCESS;
1516
1517         r = __pSearchBarEvent->RemoveListener(listener);
1518         SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "Propagating.");
1519
1520         return r;
1521 }
1522
1523 result
1524 _SearchBar::AddLanguageEventListener(const _ILanguageEventListener& listener)
1525 {
1526         result r = E_SUCCESS;
1527
1528         if (__pLanguageEvent == null)
1529         {
1530                 __pLanguageEvent = _LanguageEvent::CreateInstanceN(*this);
1531                 r = GetLastResult();
1532                 SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "Propagating.");
1533
1534                 r = __pLanguageEvent->AddListener(listener);
1535                 SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "Propagating.");
1536         }
1537
1538         return r;
1539 }
1540
1541 result
1542 _SearchBar::RemoveLanguageEventListener(const _ILanguageEventListener& listener)
1543 {
1544         SysTryReturn(NID_UI_CTRL, __pLanguageEvent != null, E_SYSTEM, E_SYSTEM, "[%s] This instance isn't constructed.", GetErrorMessage(E_SYSTEM));
1545         result r = E_SUCCESS;
1546
1547         __pLanguageEvent->RemoveListener(listener);
1548         SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "Propagating.");
1549
1550         return r;
1551 }
1552
1553 void
1554 _SearchBar::OnBoundsChanged(void)
1555 {
1556         if (__pSearchBarPresenter != null)
1557         {
1558                 __isupdateContentBounds = true;
1559                 __pSearchBarPresenter->OnBoundsChanged();
1560         }
1561
1562         if (__pAccessibilitySearchBarElement != null)
1563         {
1564                 __pAccessibilitySearchBarElement->SetBounds(FloatRectangle(0.0f, 0.0f, GetBoundsF().width, GetBoundsF().height));
1565         }
1566
1567         if (IsFocused())
1568         {
1569                 RemoveFocusRing(true);
1570                 if (IsFocusModeStateEnabled())
1571                 {
1572                         DrawFocus();
1573                 }
1574         }
1575
1576         return;
1577 }
1578
1579 void
1580 _SearchBar::OnChangeLayout(_ControlOrientation orientation)
1581 {
1582         __isupdateContentBounds = true;
1583         return;
1584 }
1585
1586 void
1587 _SearchBar::OnDraw(void)
1588 {
1589         if (!__isUserGuideTextColor)
1590         {
1591                 SearchFieldStatus status = GetCurrentStatus();
1592                 __pEdit->SetGuideTextColor(__guideTextColor[status]);
1593         }
1594
1595         if (__isupdateContentBounds)
1596         {
1597                 SetContentsArea();
1598                 __isupdateContentBounds = false;
1599         }
1600         __pSearchBarPresenter->Draw();
1601         return;
1602 }
1603
1604 _UiTouchEventDelivery
1605 _SearchBar::OnPreviewTouchMoved(const _Control& source, const _TouchInfo& touchinfo)
1606 {
1607         if (&source == __pEdit)
1608         {
1609                 __isTouchMoved = true;
1610         }
1611
1612         return _UI_TOUCH_EVENT_DELIVERY_YES;
1613 }
1614
1615 _UiTouchEventDelivery
1616 _SearchBar::OnPreviewTouchReleased(const _Control& source, const _TouchInfo& touchinfo)
1617 {
1618         _Edit* pEdit = dynamic_cast <_Edit*>(const_cast <_Control*>(&source));
1619         if (pEdit == null)
1620         {
1621                 return _UI_TOUCH_EVENT_DELIVERY_YES;
1622         }
1623
1624         if (pEdit->IsClearIconPressed())
1625         {
1626                 __isTouchMoved = false;
1627                 return _UI_TOUCH_EVENT_DELIVERY_YES;
1628         }
1629
1630         SetContentAreaVisible(__contentVisibilitySetByApp);     //When a touch happens on SearchField
1631         SetFocusCallbackParameter(true);
1632
1633         if (!__isTouchMoved)
1634         {
1635                 SetMode(SEARCH_BAR_MODE_INPUT);
1636         }
1637
1638         __isTouchMoved = false;
1639         return _UI_TOUCH_EVENT_DELIVERY_YES;
1640 }
1641
1642 _UiTouchEventDelivery
1643 _SearchBar::OnPreviewTouchCanceled(const _Control& source, const _TouchInfo& touchinfo)
1644 {
1645         __isTouchMoved = false;
1646         return _UI_TOUCH_EVENT_DELIVERY_YES;
1647 }
1648
1649 bool
1650 _SearchBar::OnTouchReleased(const _Control& source, const _TouchInfo& touchinfo)
1651 {
1652         __pSearchBarPresenter->OnTouchReleased(source);
1653         return true;
1654 }
1655
1656 void
1657 _SearchBar::FireButtonActionEvent(const _Control &source, int actionId)
1658 {
1659         if (__actionId == actionId)
1660         {
1661                 __isCancelActionInProgress = true;
1662                 SetFocusCallbackParameter(true);
1663                 SetMode(SEARCH_BAR_MODE_NORMAL);
1664
1665                 SetFocused();
1666
1667                 if (__pActionEvent != null)
1668                 {
1669                         IEventArg* pEventArg = _ActionEvent::CreateActionEventArgN(__actionId);
1670                         result r = GetLastResult();
1671                         SysTryReturnVoidResult(NID_UI_CTRL, pEventArg != null, r, "[%s] Propagating.", GetErrorMessage(r));
1672
1673                         __pActionEvent->Fire(*pEventArg);
1674                 }
1675                 __isCancelActionInProgress = false;
1676         }
1677 }
1678
1679 void
1680 _SearchBar::OnActionPerformed(const _Control& source, int actionId)
1681 {
1682         FireButtonActionEvent(source, actionId);
1683         return;
1684 }
1685
1686 // Keypad callbacks
1687 void
1688 _SearchBar::OnKeypadWillOpen(void)
1689 {
1690         if (!__isKeypadOpening)
1691         {
1692                 if (__pKeypadEvent != null)
1693                 {
1694                         IEventArg* pEventArg = _KeypadEvent::CreateKeypadEventArgN(CORE_KEYPAD_ACTION_SEARCH, CORE_KEYPAD_EVENT_STATUS_CREATED);
1695                         result r = GetLastResult();
1696                         SysTryReturnVoidResult(NID_UI_CTRL, pEventArg != null, r, "[%s] Propagating.", GetErrorMessage(r));
1697
1698                         __pKeypadEvent->Fire(*pEventArg);
1699                 }
1700         }
1701
1702         __isKeypadOpening = true;
1703         return;
1704 }
1705
1706 void
1707 _SearchBar::OnKeypadOpened(void)
1708 {
1709         if (__pKeypadEvent != null)
1710         {
1711                 IEventArg* pEventArg = _KeypadEvent::CreateKeypadEventArgN(CORE_KEYPAD_ACTION_SEARCH, CORE_KEYPAD_EVENT_STATUS_OPEN);
1712                 result r = GetLastResult();
1713                 SysTryReturnVoidResult(NID_UI_CTRL, pEventArg != null, r, "[%s] Propagating.", GetErrorMessage(r));
1714
1715                 __pKeypadEvent->Fire(*pEventArg);
1716         }
1717
1718         __isKeypadOpening = false;
1719         SetContentsArea();
1720         return;
1721 }
1722
1723 void
1724 _SearchBar::OnKeypadClosed(void)
1725 {
1726         if (__pKeypadEvent != null)
1727         {
1728                 IEventArg* pEventArg = _KeypadEvent::CreateKeypadEventArgN(CORE_KEYPAD_ACTION_SEARCH, CORE_KEYPAD_EVENT_STATUS_CLOSE);
1729                 result r = GetLastResult();
1730                 SysTryReturnVoidResult(NID_UI_CTRL, pEventArg != null, r, "[%s] Propagating.", GetErrorMessage(r));
1731
1732                 __pKeypadEvent->Fire(*pEventArg);
1733         }
1734
1735         __isKeypadOpening = false;
1736
1737         SetContentsArea();
1738         return;
1739 }
1740
1741 void
1742 _SearchBar::OnKeypadBoundsChanged(void)
1743 {
1744         if (__pKeypadEvent != null)
1745         {
1746                 IEventArg* pEventArg = _KeypadEvent::CreateKeypadEventArgN(CORE_KEYPAD_ACTION_SEARCH, CORE_KEYPAD_EVENT_STATUS_BOUNDS_CHANGED);
1747                 result r = GetLastResult();
1748                 SysTryReturnVoidResult(NID_UI_CTRL, pEventArg != null, r, "[%s] Propagating.", GetErrorMessage(r));
1749
1750                 __pKeypadEvent->Fire(*pEventArg);
1751         }
1752
1753         SetContentsArea();
1754         return;
1755 }
1756
1757 void
1758 _SearchBar::OnKeypadActionPerformed(CoreKeypadAction keypadAction)
1759 {
1760         if (__pKeypadEvent != null)
1761         {
1762                 IEventArg* pEventArg = _KeypadEvent::CreateKeypadEventArgN(keypadAction, CORE_KEYPAD_EVENT_STATUS_ENTERACTION);
1763                 result r = GetLastResult();
1764                 SysTryReturnVoidResult(NID_UI_CTRL, pEventArg != null, r, "[%s] Propagating.", GetErrorMessage(r));
1765
1766                 __pKeypadEvent->Fire(*pEventArg);
1767         }
1768         return;
1769 }
1770
1771 // TextBlock callbacks
1772 void
1773 _SearchBar::OnTextBlockSelected(_Control& source, int start, int end)
1774 {
1775         if (__pTextBlockEvent != null)
1776         {
1777                 IEventArg* pEventArg = _TextBlockEvent::CreateTextBlockEventArgN(start, end);
1778                 result r = GetLastResult();
1779                 SysTryReturnVoidResult(NID_UI_CTRL, pEventArg != null, r, "[%s] Propagating.", GetErrorMessage(r));
1780
1781                 __pTextBlockEvent->Fire(*pEventArg);
1782         }
1783         return;
1784 }
1785
1786 // Text callbacks
1787 void
1788 _SearchBar::OnTextValueChanged(const _Control& source)
1789 {
1790         if (GetTextLength())
1791         {
1792                 SetContentAreaVisible(__contentVisibilitySetByApp);
1793         }
1794
1795         if (!__isCancelActionInProgress)
1796         {
1797                 SetContentDimming();
1798                 if (__pTextEvent != null)
1799                 {
1800                         IEventArg* pEventArg = _TextEvent::CreateTextEventArgN(CORE_TEXT_EVENT_CHANGED);
1801                         result r = GetLastResult();
1802                         SysTryReturnVoidResult(NID_UI_CTRL, pEventArg != null, r, "[%s] Propagating.", GetErrorMessage(r));
1803
1804                         __pTextEvent->Fire(*pEventArg);
1805                 }
1806         }
1807         return;
1808 }
1809
1810 void
1811 _SearchBar::OnTextValueChangeCanceled(const _Control& source)
1812 {
1813         if (__pTextEvent != null)
1814         {
1815                 IEventArg* pEventArg = _TextEvent::CreateTextEventArgN(CORE_TEXT_EVENT_CANCELED);
1816                 result r = GetLastResult();
1817                 SysTryReturnVoidResult(NID_UI_CTRL, pEventArg != null, r, "[%s] Propagating.", GetErrorMessage(r));
1818
1819                 __pTextEvent->Fire(*pEventArg);
1820         }
1821         return;
1822 }
1823
1824 result
1825 _SearchBar::OnAttachedToMainTree(void)
1826 {
1827         SetContentsArea();
1828         return E_SUCCESS;
1829 }
1830
1831 void
1832 _SearchBar::OnFontChanged(Font* pFont)
1833 {
1834         __pCancelButton->SetFont(pFont->GetFaceName());
1835         __pEdit->SetFont(*pFont);
1836         return;
1837 }
1838
1839 void
1840 _SearchBar::OnFontInfoRequested(unsigned long& style, int& size)
1841 {
1842         style = FONT_STYLE_PLAIN;
1843         size = __pCancelButton->GetTextSize();
1844
1845         return;
1846 }
1847
1848 bool
1849 _SearchBar::OnFocusGained(const _Control& source)
1850 {
1851         return _Control::OnFocusGained(source);
1852 }
1853
1854 bool
1855 _SearchBar::OnFocusLost(const _Control &source)
1856 {
1857         return _Control::OnFocusLost(source);
1858 }
1859
1860 void
1861 _SearchBar::OnDrawFocus(void)
1862 {
1863         __isFocusUiInitialized = true;
1864         _Control::OnDrawFocus();
1865
1866         return;
1867 }
1868
1869 bool
1870 _SearchBar::IsChildControlFocusManage(void) const
1871 {
1872         return true;
1873 }
1874
1875 bool
1876 _SearchBar::OnPreviewKeyPressed(const _Control &source, const _KeyInfo &keyInfo)
1877 {
1878         if (!__pEdit->IsUsbKeyboardConnected())
1879         {
1880                         return false;
1881         }
1882
1883         _KeyCode keyCode = keyInfo.GetKeyCode();
1884
1885         if (keyCode == _KEY_TAB && GetMode() == SEARCH_BAR_MODE_INPUT && __isFocusUiInitialized == false)
1886         {
1887                 __isFocusUiInitialized = true;
1888                 return false;
1889         }
1890
1891         switch (keyCode)
1892         {
1893                 case _KEY_UP:
1894                 case _KEY_DOWN:
1895                 case _KEY_TAB:
1896                         SetFocusCallbackParameter(true);
1897                         if ((__pContentControl && __pContentControl->IsVisible() == false) || !__pContentControl)
1898                         {
1899                                 SetContentAreaVisible(false);
1900                         }
1901
1902                         break;
1903                 default:
1904                         break;
1905         }
1906         return false;
1907 }
1908
1909 bool
1910 _SearchBar::OnKeyPressed(const _Control& source, const _KeyInfo& keyInfo)
1911 {
1912         if (!__pEdit->IsUsbKeyboardConnected())
1913         {
1914                 return false;
1915         }
1916
1917         if (!IsVisible())
1918         {
1919                 return false;
1920         }
1921
1922         _FocusManagerImpl* pFocusMgrImpl = _FocusManagerImpl::GetInstance();
1923         if (!pFocusMgrImpl->IsFocusModeStateEnabled())
1924         {
1925                 return false;
1926         }
1927
1928         _KeyCode keyCode = keyInfo.GetKeyCode();
1929
1930         switch (keyCode)
1931         {
1932                 case _KEY_RIGHT:
1933                         if (&source == this)
1934                         {
1935                                 SetContentAreaVisible(__contentVisibilitySetByApp);
1936                                 SetFocusCallbackParameter(true);
1937                                 SetMode(SEARCH_BAR_MODE_INPUT);
1938                                 __pEdit->SetFocused();
1939                         }
1940
1941                         SetFocusCallbackParameter(false);
1942
1943                         if (&source == __pEdit)
1944                         {
1945                                 if ((!__isButtonEnabled || !__isUsableCancelButton) && __pContentControl && __pContentControl->IsVisible() && __pContentControl->GetEnableState())
1946                                 {
1947                                         __pContentControl->SetFocused();
1948                                         __pContentControl->OnDrawFocus();
1949
1950                                         return true;
1951                                 }
1952                                 else if (__isButtonEnabled && __isUsableCancelButton)
1953                                 {
1954                                         __pCancelButton->SetFocused();
1955                                 }
1956
1957                                 return true;
1958                         }
1959
1960                         if (&source == __pCancelButton && __pContentControl && __pContentControl->IsVisible() && __pContentControl->GetEnableState())
1961                         {
1962                                 __pContentControl->SetFocused();
1963                                 __pContentControl->OnDrawFocus();
1964
1965                                 return true;
1966                         }
1967
1968                         break;
1969
1970                 case _KEY_LEFT:
1971                         if (&source == __pCancelButton)
1972                         {
1973                                 __pEdit->SetFocused();
1974                                 return true;
1975                         }
1976
1977                         if (&source == __pContentControl)
1978                         {
1979                                 if ((__isButtonEnabled && __isUsableCancelButton))
1980                                 {
1981                                         __pCancelButton->SetFocused();
1982                                 }
1983                                 else
1984                                 {
1985                                         __pEdit->SetFocused();
1986                                 }
1987                                 return true;
1988                         }
1989
1990                         break;
1991
1992                 case _KEY_ENTER:
1993                         if (&source == __pCancelButton)
1994                         {
1995                                 FireButtonActionEvent(source, __actionId);
1996                                 _Control::OnDrawFocus();
1997
1998                                 return true;
1999                         }
2000
2001                         break;
2002
2003                 default:
2004                         return false;
2005         }
2006
2007         return false;
2008 }
2009
2010 void
2011 _SearchBar::OnSettingChanged(Tizen::Base::String& key)
2012 {
2013         if (__isButtonTextChangedByApp || !__isUsableCancelButton)
2014         {
2015                 return;
2016         }
2017
2018         if (key.Equals(L"http://tizen.org/setting/locale.language", false))
2019         {
2020                 String cancelText;
2021                 GET_STRING_CONFIG(IDS_TPLATFORM_BUTTON_CANCEL_ABB, cancelText);
2022                 __pCancelButton->SetText(cancelText);
2023                 __pCancelButton->Invalidate();
2024         }
2025
2026         return;
2027 }
2028
2029 Canvas*
2030 _SearchBar::OnCanvasRequestedN(const FloatRectangle& bounds)
2031 {
2032         return __pSearchBarPresenter->OnCanvasRequestedN(bounds);
2033 }
2034
2035 _Control*
2036 _SearchBar::GetParentForm(void) const
2037 {
2038         _Form* pForm = null;
2039         _Control* pControlCore = GetParent();
2040
2041         while (true)
2042         {
2043                 if (pControlCore == null)
2044                 {
2045                         SysLog(NID_UI_CTRL,"[E_SYSTEM] The parent form is null.");
2046
2047                         return null;
2048                 }
2049
2050                 pForm = dynamic_cast <_Form*>(pControlCore);
2051
2052                 if (pForm != null)
2053                 {
2054                         break;
2055                 }
2056
2057                 pControlCore = pControlCore->GetParent();
2058         }
2059
2060         return pControlCore;
2061 }
2062
2063 _Button*
2064 _SearchBar::GetSearchBarButton(void) const
2065 {
2066         return __pCancelButton;
2067 }
2068
2069 _Edit*
2070 _SearchBar::GetSearchField(void)
2071 {
2072         return __pEdit;
2073 }
2074
2075 _Control*
2076 _SearchBar::GetSearchBarContainer(void) const
2077 {
2078         return __pContainer;
2079 }
2080
2081 _Control*
2082 _SearchBar::GetClippedGroupControl(void) const
2083 {
2084         return __pClippedGroupControl;
2085 }
2086
2087 bool
2088 _SearchBar::IsUsableCancelButton(void) const
2089 {
2090         return __isUsableCancelButton;
2091 }
2092
2093 EditStatus
2094 _SearchBar::ConvertSearchBarStatus(SearchFieldStatus status)
2095 {
2096         EditStatus editStatus = EDIT_STATUS_NORMAL;
2097         switch (status)
2098         {
2099         case SEARCH_FIELD_STATUS_NORMAL:
2100                 editStatus = EDIT_STATUS_NORMAL;
2101                 break;
2102
2103         case SEARCH_FIELD_STATUS_DISABLED:
2104                 editStatus = EDIT_STATUS_DISABLED;
2105                 break;
2106
2107         case SEARCH_FIELD_STATUS_HIGHLIGHTED:
2108                 editStatus = EDIT_STATUS_HIGHLIGHTED;
2109                 break;
2110         default:
2111                 break;
2112         }
2113
2114         return editStatus;
2115 }
2116
2117 _ButtonStatus
2118 _SearchBar::ConvertSearchBarButtonStatus(SearchBarButtonStatus status)
2119 {
2120         _ButtonStatus buttonStatus = _BUTTON_STATUS_NORMAL;
2121
2122         switch (status)
2123         {
2124         case SEARCH_BAR_BUTTON_STATUS_NORMAL:
2125                 buttonStatus = _BUTTON_STATUS_NORMAL;
2126                 break;
2127
2128         case SEARCH_BAR_BUTTON_STATUS_PRESSED:
2129                 buttonStatus = _BUTTON_STATUS_PRESSED;
2130                 break;
2131
2132         case SEARCH_BAR_BUTTON_STATUS_HIGHLIGHTED:
2133                 buttonStatus = _BUTTON_STATUS_HIGHLIGHTED;
2134                 break;
2135
2136         case SEARCH_BAR_BUTTON_STATUS_DISABLED:
2137                 buttonStatus = _BUTTON_STATUS_DISABLED;
2138                 break;
2139         default:
2140                 break;
2141         }
2142
2143         return buttonStatus;
2144 }
2145
2146 result
2147 _SearchBar::SendSearchBarEvent(_SearchBarEventStatus status)
2148 {
2149         result r = E_SUCCESS;
2150         if (__pSearchBarEvent != null)
2151         {
2152                 IEventArg* pEventArg = _SearchBarEvent::CreateSearchBarEventArgN(status);
2153                 r = GetLastResult();
2154                 SysTryReturn(NID_UI_CTRL, pEventArg != null, r, r, "[%s] Propagating.", GetErrorMessage(r));
2155
2156                 if (!IsContentAreaVisible())
2157                 {
2158                         SetContentAreaVisible(false);
2159                 }
2160
2161                 __pSearchBarEvent->Fire(*pEventArg);
2162         }
2163
2164         return E_SUCCESS;
2165 }
2166
2167 void
2168 _SearchBar::SetHeaderVisibleState(bool visible)
2169 {
2170         if (__pSearchBarPresenter != null)
2171         {
2172                 __pSearchBarPresenter->SetHeaderVisibleState(visible);
2173         }
2174         return;
2175 }
2176
2177 result
2178 _SearchBar::SetPropertyButtonActionId(const Variant& actionId)
2179 {
2180         SysTryReturn(NID_UI_CTRL, __pCancelButton != null, E_SYSTEM, E_SYSTEM,
2181                          "[%s] A system error has occurred. The _Button instance is null.", GetErrorMessage(E_SYSTEM));
2182         SysTryReturn(NID_UI_CTRL, actionId.ToInt() > -1, E_INVALID_ARG, E_INVALID_ARG,
2183                          "[%s] Invalid argument(s) is used. actionId.ToInt() = %d", GetErrorMessage(E_INVALID_ARG), actionId.ToInt());
2184
2185         result r = E_SUCCESS;
2186
2187         r = __pCancelButton->SetPropertyActionId(actionId);
2188         SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, E_SYSTEM, E_SYSTEM,
2189                      "[%s] A system error has occurred. Failed to set actionId.", GetErrorMessage(E_SYSTEM));
2190
2191         __actionId = actionId.ToInt();
2192
2193         return r;
2194 }
2195
2196 Variant
2197 _SearchBar::GetPropertyButtonActionId(void) const
2198 {
2199         SysTryReturn(NID_UI_CTRL, __pCancelButton != null, Variant(-1), E_SYSTEM,
2200                          "[%s] A system error has occurred. The _Button instance is null.", GetErrorMessage(E_SYSTEM));
2201
2202         return Variant(__actionId);
2203 }
2204
2205 result
2206 _SearchBar::SetPropertyButtonDisabledColor(const Variant& color)
2207 {
2208         SysTryReturn(NID_UI_CTRL, __pCancelButton != null, E_SYSTEM, E_SYSTEM,
2209                          "[%s] A system error has occurred. The _Button instance is null.", GetErrorMessage(E_SYSTEM));
2210
2211         result r = E_SUCCESS;
2212
2213         r = __pCancelButton->SetPropertyDisabledColor(color);
2214         SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, E_SYSTEM, E_SYSTEM,
2215                          "[%s] A system error has occurred. Failed to set button color.", GetErrorMessage(E_SYSTEM));
2216
2217         __buttonColor[SEARCH_BAR_BUTTON_STATUS_DISABLED] = color.ToColor();
2218
2219         return r;
2220 }
2221
2222 Variant
2223 _SearchBar::GetPropertyButtonDisabledColor(void) const
2224 {
2225         SysTryReturn(NID_UI_CTRL, __pCancelButton != null, Variant(Color()), E_SYSTEM,
2226                          "[%s] A system error has occurred. The _Button instance is null.", GetErrorMessage(E_SYSTEM));
2227
2228         return Variant(__buttonColor[SEARCH_BAR_BUTTON_STATUS_DISABLED]);
2229 }
2230
2231 result
2232 _SearchBar::SetPropertyButtonHighlightedColor(const Variant& color)
2233 {
2234         SysTryReturn(NID_UI_CTRL, __pCancelButton != null, E_SYSTEM, E_SYSTEM,
2235                          "[%s] A system error has occurred. The _Button instance is null.", GetErrorMessage(E_SYSTEM));
2236
2237         result r = E_SUCCESS;
2238
2239         r = __pCancelButton->SetPropertyHighlightedColor(color);
2240         SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, E_SYSTEM, E_SYSTEM,
2241                          "[%s] A system error has occurred. Failed to set button color.", GetErrorMessage(E_SYSTEM));
2242
2243         __buttonColor[SEARCH_BAR_BUTTON_STATUS_HIGHLIGHTED] = color.ToColor();
2244
2245         return r;
2246 }
2247
2248 Variant
2249 _SearchBar::GetPropertyButtonHighlightedColor(void) const
2250 {
2251         SysTryReturn(NID_UI_CTRL, __pCancelButton != null, Variant(Color()), E_SYSTEM,
2252                          "[%s] A system error has occurred. The _Button instance is null.", GetErrorMessage(E_SYSTEM));
2253
2254         return Variant(__buttonColor[SEARCH_BAR_BUTTON_STATUS_HIGHLIGHTED]);
2255 }
2256
2257 result
2258 _SearchBar::SetPropertyButtonNormalColor(const Variant& color)
2259 {
2260         SysTryReturn(NID_UI_CTRL, __pCancelButton != null, E_SYSTEM, E_SYSTEM,
2261                          "[%s] A system error has occurred. The _Button instance is null.", GetErrorMessage(E_SYSTEM));
2262
2263         result r = E_SUCCESS;
2264
2265         r = __pCancelButton->SetPropertyNormalColor(color);
2266         SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, E_SYSTEM, E_SYSTEM,
2267                          "[%s] A system error has occurred. Failed to set button color.", GetErrorMessage(E_SYSTEM));
2268
2269         __buttonColor[SEARCH_BAR_BUTTON_STATUS_NORMAL] = color.ToColor();
2270
2271         return r;
2272 }
2273
2274 Variant
2275 _SearchBar::GetPropertyButtonNormalColor(void) const
2276 {
2277         SysTryReturn(NID_UI_CTRL, __pCancelButton != null, Variant(Color()), E_SYSTEM,
2278                          "[%s] A system error has occurred. The _Button instance is null.", GetErrorMessage(E_SYSTEM));
2279
2280         return Variant(__buttonColor[SEARCH_BAR_BUTTON_STATUS_NORMAL]);
2281 }
2282
2283 result
2284 _SearchBar::SetPropertyButtonPressedColor(const Variant& color)
2285 {
2286         SysTryReturn(NID_UI_CTRL, __pCancelButton != null, E_SYSTEM, E_SYSTEM,
2287                          "[%s] A system error has occurred. The _Button instance is null.", GetErrorMessage(E_SYSTEM));
2288
2289         result r = E_SUCCESS;
2290
2291         r = __pCancelButton->SetPropertyPressedColor(color);
2292         SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, E_SYSTEM, E_SYSTEM,
2293                          "[%s] A system error has occurred. Failed to set button color.", GetErrorMessage(E_SYSTEM));
2294
2295         __buttonColor[SEARCH_BAR_BUTTON_STATUS_PRESSED] = color.ToColor();
2296
2297         return r;
2298 }
2299
2300 Variant
2301 _SearchBar::GetPropertyButtonPressedColor(void) const
2302 {
2303         SysTryReturn(NID_UI_CTRL, __pCancelButton != null, Variant(Color()), E_SYSTEM,
2304                          "[%s] A system error has occurred. The _Button instance is null.", GetErrorMessage(E_SYSTEM));
2305
2306         return Variant(__buttonColor[SEARCH_BAR_BUTTON_STATUS_PRESSED]);
2307 }
2308
2309 result
2310 _SearchBar::SetPropertyButtonDisabledTextColor(const Variant& textColor)
2311 {
2312         SysTryReturn(NID_UI_CTRL, __pCancelButton != null, E_SYSTEM, E_SYSTEM,
2313                          "[%s] A system error has occurred. The _Button instance is null.", GetErrorMessage(E_SYSTEM));
2314
2315         result r = E_SUCCESS;
2316
2317         r = __pCancelButton->SetPropertyDisabledTextColor(textColor);
2318         SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, E_SYSTEM, E_SYSTEM,
2319                          "[%s] A system error has occurred. Failed to set button text color.", GetErrorMessage(E_SYSTEM));
2320
2321         __buttonTextColor[SEARCH_BAR_BUTTON_STATUS_DISABLED] = textColor.ToColor();
2322
2323         return r;
2324 }
2325
2326 Variant
2327 _SearchBar::GetPropertyButtonDisabledTextColor(void) const
2328 {
2329         SysTryReturn(NID_UI_CTRL, __pCancelButton != null, Variant(Color()), E_SYSTEM,
2330                          "[%s] A system error has occurred. The _Button instance is null.", GetErrorMessage(E_SYSTEM));
2331
2332         return Variant(__buttonTextColor[SEARCH_BAR_BUTTON_STATUS_DISABLED]);
2333 }
2334
2335 result
2336 _SearchBar::SetPropertyButtonHighlightedTextColor(const Variant& textColor)
2337 {
2338         SysTryReturn(NID_UI_CTRL, __pCancelButton != null, E_SYSTEM, E_SYSTEM,
2339                          "[%s] A system error has occurred. The _Button instance is null.", GetErrorMessage(E_SYSTEM));
2340
2341         result r = E_SUCCESS;
2342
2343         r = __pCancelButton->SetPropertyHighlightedTextColor(textColor);
2344         SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, E_SYSTEM, E_SYSTEM,
2345                          "[%s] A system error has occurred. Failed to set button text color.", GetErrorMessage(E_SYSTEM));
2346
2347         __buttonTextColor[SEARCH_BAR_BUTTON_STATUS_HIGHLIGHTED] = textColor.ToColor();
2348
2349         return r;
2350 }
2351
2352 Variant
2353 _SearchBar::GetPropertyButtonHighlightedTextColor(void) const
2354 {
2355         SysTryReturn(NID_UI_CTRL, __pCancelButton != null, Variant(Color()), E_SYSTEM,
2356                          "[%s] A system error has occurred. The _Button instance is null.", GetErrorMessage(E_SYSTEM));
2357
2358         return Variant(__buttonTextColor[SEARCH_BAR_BUTTON_STATUS_HIGHLIGHTED]);
2359 }
2360
2361 result
2362 _SearchBar::SetPropertyButtonNormalTextColor(const Variant& textColor)
2363 {
2364         SysTryReturn(NID_UI_CTRL, __pCancelButton != null, E_SYSTEM, E_SYSTEM,
2365                          "[%s] A system error has occurred. The _Button instance is null.", GetErrorMessage(E_SYSTEM));
2366
2367         result r = E_SUCCESS;
2368
2369         r = __pCancelButton->SetPropertyNormalTextColor(textColor);
2370         SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, E_SYSTEM, E_SYSTEM,
2371                          "[%s] A system error has occurred. Failed to set button text color.", GetErrorMessage(E_SYSTEM));
2372
2373         __buttonTextColor[SEARCH_BAR_BUTTON_STATUS_NORMAL] = textColor.ToColor();
2374
2375         return r;
2376 }
2377
2378 Variant
2379 _SearchBar::GetPropertyButtonNormalTextColor(void) const
2380 {
2381         SysTryReturn(NID_UI_CTRL, __pCancelButton != null, Variant(Color()), E_SYSTEM,
2382                          "[%s] A system error has occurred. The _Button instance is null.", GetErrorMessage(E_SYSTEM));
2383
2384         return Variant(__buttonTextColor[SEARCH_BAR_BUTTON_STATUS_NORMAL]);
2385 }
2386
2387 result
2388 _SearchBar::SetPropertyButtonPressedTextColor(const Variant& textColor)
2389 {
2390         SysTryReturn(NID_UI_CTRL, __pCancelButton != null, E_SYSTEM, E_SYSTEM,
2391                          "[%s] A system error has occurred. The _Button instance is null.", GetErrorMessage(E_SYSTEM));
2392
2393         result r = E_SUCCESS;
2394
2395         r = __pCancelButton->SetPropertyPressedTextColor(textColor);
2396         SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, E_SYSTEM, E_SYSTEM,
2397                          "[%s] A system error has occurred. Failed to set button text color.", GetErrorMessage(E_SYSTEM));
2398
2399         __buttonTextColor[SEARCH_BAR_BUTTON_STATUS_PRESSED] = textColor.ToColor();
2400
2401         return r;
2402 }
2403
2404 Variant
2405 _SearchBar::GetPropertyButtonPressedTextColor(void) const
2406 {
2407         SysTryReturn(NID_UI_CTRL, __pCancelButton != null, Variant(Color()), E_SYSTEM,
2408                          "[%s] A system error has occurred. The _Button instance is null.", GetErrorMessage(E_SYSTEM));
2409
2410         return Variant(__buttonTextColor[SEARCH_BAR_BUTTON_STATUS_PRESSED]);
2411 }
2412
2413 result
2414 _SearchBar::SetPropertySearchFieldDisabledColor(const Variant& color)
2415 {
2416         SysTryReturn(NID_UI_CTRL, __pEdit != null, E_SYSTEM, E_SYSTEM,
2417                          "[%s] A system error has occurred. The _Edit instance is null.", GetErrorMessage(E_SYSTEM));
2418
2419         result r = E_SUCCESS;
2420
2421         r = __pEdit->SetPropertyDisabledColor(color);
2422         SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, E_SYSTEM, E_SYSTEM,
2423                          "[%s] A system error has occurred. Failed to set the edit disabled color.", GetErrorMessage(E_SYSTEM));
2424
2425         __color[SEARCH_FIELD_STATUS_DISABLED] = color.ToColor();
2426
2427         return r;
2428 }
2429
2430 Variant
2431 _SearchBar::GetPropertySearchFieldDisabledColor(void) const
2432 {
2433         SysTryReturn(NID_UI_CTRL, __pEdit != null, Variant(Color()), E_SYSTEM,
2434                          "[%s] A system error has occurred. The _Edit instance is null.", GetErrorMessage(E_SYSTEM));
2435
2436         return Variant(__color[SEARCH_FIELD_STATUS_DISABLED]);
2437 }
2438
2439 result
2440 _SearchBar::SetPropertySearchFieldHighlightedColor(const Variant& color)
2441 {
2442         SysTryReturn(NID_UI_CTRL, __pEdit != null, E_SYSTEM, E_SYSTEM,
2443                          "[%s] A system error has occurred. The _Edit instance is null.", GetErrorMessage(E_SYSTEM));
2444
2445         result r = E_SUCCESS;
2446
2447         r = __pEdit->SetPropertyHighlightedColor(color);
2448         SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, E_SYSTEM, E_SYSTEM,
2449                          "[%s] A system error has occurred. Failed to set the edit highlighted color.", GetErrorMessage(E_SYSTEM));
2450
2451         __color[SEARCH_FIELD_STATUS_HIGHLIGHTED] = color.ToColor();
2452
2453         return r;
2454 }
2455
2456 Variant
2457 _SearchBar::GetPropertySearchFieldHighlightedColor(void) const
2458 {
2459         SysTryReturn(NID_UI_CTRL, __pEdit != null, Variant(Color()), E_SYSTEM,
2460                          "[%s] A system error has occurred. The _Edit instance is null.", GetErrorMessage(E_SYSTEM));
2461
2462         return Variant(__color[SEARCH_FIELD_STATUS_HIGHLIGHTED]);
2463 }
2464
2465 result
2466 _SearchBar::SetPropertySearchFieldNormalColor(const Variant& color)
2467 {
2468         SysTryReturn(NID_UI_CTRL, __pEdit != null, E_SYSTEM, E_SYSTEM,
2469                          "[%s] A system error has occurred. The _Edit instance is null.", GetErrorMessage(E_SYSTEM));
2470
2471         result r = E_SUCCESS;
2472
2473         r = __pEdit->SetPropertyNormalColor(color);
2474         SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, E_SYSTEM, E_SYSTEM,
2475                          "[%s] A system error has occurred. Failed to set edit normal color.", GetErrorMessage(E_SYSTEM));
2476
2477         __color[SEARCH_FIELD_STATUS_NORMAL] = color.ToColor();
2478
2479         return r;
2480 }
2481
2482 Variant
2483 _SearchBar::GetPropertySearchFieldNormalColor(void) const
2484 {
2485         SysTryReturn(NID_UI_CTRL, __pEdit != null, Variant(Color()), E_SYSTEM,
2486                          "[%s] A system error has occurred. The _Edit instance is null.", GetErrorMessage(E_SYSTEM));
2487
2488         return Variant(__color[SEARCH_FIELD_STATUS_NORMAL]);
2489 }
2490
2491 result
2492 _SearchBar::SetPropertySearchFieldDisabledTextColor(const Variant& textColor)
2493 {
2494         SysTryReturn(NID_UI_CTRL, __pEdit != null, E_SYSTEM, E_SYSTEM,
2495                          "[%s] A system error has occurred. The _Edit instance is null.", GetErrorMessage(E_SYSTEM));
2496
2497         result r = E_SUCCESS;
2498
2499         r = __pEdit->SetPropertyDisabledTextColor(textColor);
2500         SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, E_SYSTEM, E_SYSTEM,
2501                          "[%s] A system error has occurred. Failed to set edit disabled text color.", GetErrorMessage(E_SYSTEM));
2502
2503         __textColor[SEARCH_FIELD_STATUS_DISABLED] = textColor.ToColor();
2504
2505         return r;
2506 }
2507
2508 Variant
2509 _SearchBar::GetPropertySearchFieldDisabledTextColor(void) const
2510 {
2511         SysTryReturn(NID_UI_CTRL, __pEdit != null, Variant(Color()), E_SYSTEM,
2512                          "[%s] A system error has occurred. The _Edit instance is null.", GetErrorMessage(E_SYSTEM));
2513
2514         return Variant(__textColor[SEARCH_FIELD_STATUS_DISABLED]);
2515 }
2516
2517 result
2518 _SearchBar::SetPropertySearchFieldHighlightedTextColor(const Variant& textColor)
2519 {
2520         SysTryReturn(NID_UI_CTRL, __pEdit != null, E_SYSTEM, E_SYSTEM,
2521                          "[%s] A system error has occurred. The _Edit instance is null.", GetErrorMessage(E_SYSTEM));
2522
2523         result r = E_SUCCESS;
2524
2525         r = __pEdit->SetPropertyHighlightedTextColor(textColor);
2526         SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, E_SYSTEM, E_SYSTEM,
2527                          "[%s] A system error has occurred. Failed to set edit highlighted text color.", GetErrorMessage(E_SYSTEM));
2528
2529         __textColor[SEARCH_FIELD_STATUS_HIGHLIGHTED] = textColor.ToColor();
2530
2531         return r;
2532 }
2533
2534 Variant
2535 _SearchBar::GetPropertySearchFieldHighlightedTextColor(void) const
2536 {
2537         SysTryReturn(NID_UI_CTRL, __pEdit != null, Variant(Color()), E_SYSTEM,
2538                          "[%s] A system error has occurred. The _Edit instance is null.", GetErrorMessage(E_SYSTEM));
2539
2540         return Variant(__textColor[SEARCH_FIELD_STATUS_HIGHLIGHTED]);
2541 }
2542
2543 result
2544 _SearchBar::SetPropertySearchFieldNormalTextColor(const Variant& textColor)
2545 {
2546         SysTryReturn(NID_UI_CTRL, __pEdit != null, E_SYSTEM, E_SYSTEM,
2547                          "[%s] A system error has occurred. The _Edit instance is null.", GetErrorMessage(E_SYSTEM));
2548
2549         result r = E_SUCCESS;
2550
2551         r = __pEdit->SetPropertyNormalTextColor(textColor);
2552         SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, E_SYSTEM, E_SYSTEM,
2553                          "[%s] A system error has occurred. Failed to set edit normal text color.", GetErrorMessage(E_SYSTEM));
2554
2555         __textColor[SEARCH_FIELD_STATUS_NORMAL] = textColor.ToColor();
2556
2557         return r;
2558 }
2559
2560 Variant
2561 _SearchBar::GetPropertySearchFieldNormalTextColor(void) const
2562 {
2563         SysTryReturn(NID_UI_CTRL, __pEdit != null, Variant(Color()), E_SYSTEM,
2564                          "[%s] A system error has occurred. The _Edit instance is null.", GetErrorMessage(E_SYSTEM));
2565
2566         return Variant(__textColor[SEARCH_FIELD_STATUS_NORMAL]);
2567 }
2568
2569 result
2570 _SearchBar::SetPropertyColor(const Variant& color)
2571 {
2572         __backgroundColor = color.ToColor();
2573
2574         return E_SUCCESS;
2575 }
2576
2577 Variant
2578 _SearchBar::GetPropertyColor(void) const
2579 {
2580         return Variant(__backgroundColor);
2581 }
2582
2583 result
2584 _SearchBar::SetPropertyContentAreaSize(const Variant& size)
2585 {
2586         FloatDimension contentAreaSize = size.ToFloatDimension();
2587         SysTryReturn(NID_UI_CTRL, contentAreaSize.width >= 0 && contentAreaSize.height >= 0, E_INVALID_ARG, E_INVALID_ARG,
2588                          "[%s] Invalid argument(s) is used. contentAreaSize.width = %f, contenAreaSize.height = %f",
2589                          GetErrorMessage(E_INVALID_ARG), contentAreaSize.width, contentAreaSize.height);
2590
2591         result r = E_SUCCESS;
2592
2593         // Todo
2594         FloatRectangle bounds = GetBoundsF();
2595         FloatRectangle contentAreaBounds(0.0f, 0.0f, 0.0f, 0.0f);
2596
2597         contentAreaBounds.x = 0.0f;
2598         contentAreaBounds.y = bounds.height;
2599         contentAreaBounds.width = contentAreaSize.width;
2600         contentAreaBounds.height = contentAreaSize.height;
2601
2602         __contentAreaBounds = contentAreaBounds;
2603         __isUserContainerBounds = true;
2604
2605         // set bounds
2606         if (__pContainer != null)
2607         {
2608                 r = __pContainer->SetBounds(__contentAreaBounds);
2609                 SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "Propagating.");
2610         }
2611
2612         return r;
2613 }
2614
2615 Variant
2616 _SearchBar::GetPropertyContentAreaSize(void) const
2617 {
2618         FloatDimension contentAreaSize(__contentAreaBounds.width, __contentAreaBounds.height);
2619
2620         return Variant(contentAreaSize);
2621 }
2622
2623 result
2624 _SearchBar::CreateClippedGroupControl(void)
2625 {
2626         result r = E_SUCCESS;
2627         FloatRectangle clippedGroupControlBounds(FloatPoint(0.0f, 0.0f), GetSizeF());
2628         __pClippedGroupControl = _Control::CreateControlN();
2629         r = GetLastResult();
2630         SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "Propagating.");
2631
2632         r = AttachChild(*__pClippedGroupControl);
2633         SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , E_SYSTEM,
2634                     "[E_SYSTEM] A system error has occurred. Failed to attach the parent of clipped control.");
2635
2636         r = __pClippedGroupControl->SetBounds(clippedGroupControlBounds);
2637         SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
2638
2639         __pClippedGroupControl->SetBackgroundColor(Color(0));
2640
2641         __pClippedGroupControl->SetClipChildrenEnabled(true);
2642
2643         return r;
2644
2645 CATCH:
2646         delete __pClippedGroupControl;
2647         __pClippedGroupControl = null;
2648
2649         return r;
2650 }
2651
2652 void
2653 _SearchBar::InitializeAccessibility(void)
2654 {
2655         _AccessibilityContainer* pSBContainer = null;
2656         pSBContainer = GetAccessibilityContainer();
2657
2658         _AccessibilityContainer* pEditContainer = null;
2659         pEditContainer = __pEdit->GetAccessibilityContainer();
2660         pSBContainer->AddChildContainer(*pEditContainer);
2661
2662         _AccessibilityContainer* pButtonContainer = null;
2663         pButtonContainer = __pCancelButton->GetAccessibilityContainer();
2664
2665         if (__isUsableCancelButton)
2666         {
2667                 pSBContainer->AddChildContainer(*pButtonContainer);
2668         }
2669
2670         _AccessibilityElement* pEditElement = __pEdit->GetTextAccessibilityElement();
2671
2672 //      pEditElement->SetHintWithStringId("Double Tap To Type Search Text");
2673 //      pEditElement->SetTrait("SearchBar");
2674         pEditElement->SetName("SearchField");
2675
2676         pSBContainer->Activate(false);
2677
2678         return;
2679 }
2680
2681 void
2682 _SearchBar::SetContentDimming(void)
2683 {
2684         if (__pContainer != null)
2685         {
2686                 if (!GetTextLength())
2687                 {
2688                         __contentColor.SetAlpha(_SEARCH_CONTENT_DIM_OPACITY);
2689                 }
2690                 else
2691                 {
2692                         __contentColor.SetAlpha(0);
2693                 }
2694                 __pContainer->SetBackgroundColor(__contentColor);
2695         }
2696         return;
2697 }
2698
2699 bool
2700 _SearchBar::IsContentAttachable(const _Control* pContent)
2701 {
2702         const _Window* pWindow = dynamic_cast <const _Window*>(pContent);
2703         const _ColorPicker* pColorPicker = dynamic_cast <const _ColorPicker*>(pContent);
2704         const _Form* pForm = dynamic_cast <const _Form*>(pContent);
2705         const _Keypad* pKeypad = dynamic_cast <const _Keypad*>(pContent);
2706         const _OverlayPanel* pOverlayPanel = dynamic_cast <const _OverlayPanel*>(pContent);
2707
2708         bool isContentAttachable = true;
2709
2710         isContentAttachable = ((pWindow == null) && (pColorPicker == null) &&
2711                                (pForm == null) && (pKeypad == null) && (pOverlayPanel == null));
2712         return isContentAttachable;
2713 }
2714
2715 result
2716 _SearchBar::ResizeCancelButton(void)
2717 {
2718         result r = E_SUCCESS;
2719
2720         float horizontalMargin = 0.0f;
2721         float buttonLeftMargin = 0.0f;
2722         float buttonRightMargin = 0.0f;
2723         float buttonMinWidth = 0.0f;
2724         float searchFieldMinWidth = 0.0f;
2725         float buttonVerticalMargin = 0.0f;
2726         float searchBarMinHeight = 0.0f;
2727         float buttonWidth = 0.0f;
2728         float buttonHeight = 0.0f;
2729
2730         FloatRectangle cancelButtonBounds;
2731         FloatRectangle searchBarBounds = GetBoundsF();
2732
2733         _ControlOrientation orientation = _ControlManager::GetInstance()->GetOrientation();
2734
2735         GET_SHAPE_CONFIG(SEARCHBAR::HORIZONTAL_MARGIN, orientation, horizontalMargin);
2736         GET_SHAPE_CONFIG(SEARCHBAR::BUTTON_LEFT_MARGIN, orientation, buttonLeftMargin);
2737         GET_SHAPE_CONFIG(SEARCHBAR::BUTTON_RIGHT_MARGIN, orientation, buttonRightMargin);
2738         GET_SHAPE_CONFIG(SEARCHBAR::BUTTON_WIDTH, orientation, buttonWidth);
2739         GET_SHAPE_CONFIG(SEARCHBAR::BUTTON_HEIGHT, orientation, buttonHeight);
2740         GET_SHAPE_CONFIG(SEARCHBAR::BUTTON_MIN_WIDTH, orientation, buttonMinWidth);
2741         GET_SHAPE_CONFIG(SEARCHBAR::SEARCH_FIELD_MIN_WIDTH, orientation, searchFieldMinWidth);
2742         GET_SHAPE_CONFIG(SEARCHBAR::VERTICAL_MARGIN, orientation, buttonVerticalMargin);
2743         GET_SHAPE_CONFIG(SEARCHBAR::MIN_HEIGHT, orientation, searchBarMinHeight);
2744
2745         cancelButtonBounds.width = buttonWidth;
2746         cancelButtonBounds.height = buttonHeight;
2747
2748         float buttonResizableSearchBarWidth = (horizontalMargin + searchFieldMinWidth +
2749                                              cancelButtonBounds.width + buttonLeftMargin + buttonRightMargin);
2750
2751         if (searchBarBounds.width < buttonResizableSearchBarWidth)
2752         {
2753                 cancelButtonBounds.width = searchBarBounds.width -(searchFieldMinWidth + buttonLeftMargin
2754                                                                    + buttonRightMargin + horizontalMargin);
2755         }
2756
2757         cancelButtonBounds.x = searchBarBounds.width - cancelButtonBounds.width - buttonRightMargin;
2758         cancelButtonBounds.y = (searchBarBounds.height - cancelButtonBounds.height)/2.0f;
2759
2760         cancelButtonBounds.y = cancelButtonBounds.y < 0.0f ? 0.0f:cancelButtonBounds.y;
2761
2762         if (cancelButtonBounds.width < buttonMinWidth)
2763         {
2764                 cancelButtonBounds.width = buttonMinWidth;
2765         }
2766
2767         cancelButtonBounds.width = (cancelButtonBounds.width > 0.0f) ? cancelButtonBounds.width : 0.0f;
2768         cancelButtonBounds.height = (cancelButtonBounds.height > 0.0f) ? cancelButtonBounds.height : 0.0f;
2769         r = __pCancelButton->SetBounds(cancelButtonBounds);
2770
2771         return r;
2772 }
2773
2774 void
2775 _SearchBar::RecalculateButtonBounds(void)
2776 {
2777         result r = E_SUCCESS;
2778
2779         float horizontalMargin = 0.0f;
2780         float verticalMargin = 0.0f;
2781         float buttonLeftMargin = 0.0f;
2782         float buttonRightMargin = 0.0f;
2783         float buttonMinWidth = 0.0f;
2784         float searchFieldMinWidth = 0.0f;
2785         float buttonVerticalMargin = 0.0f;
2786         float searchBarMinHeight = 0.0f;
2787         float buttonWidth = 0.0f;
2788         float buttonHeight = 0.0f;
2789         float cancelButtonWidth = 0.0f;
2790
2791         FloatRectangle cancelButtonBounds;
2792         FloatRectangle editBounds;
2793         FloatRectangle searchBarBounds = GetBoundsF();
2794
2795         _ControlOrientation orientation = _ControlManager::GetInstance()->GetOrientation();
2796
2797         GET_SHAPE_CONFIG(SEARCHBAR::HORIZONTAL_MARGIN, orientation, horizontalMargin);
2798         GET_SHAPE_CONFIG(SEARCHBAR::VERTICAL_MARGIN, orientation, verticalMargin);
2799         GET_SHAPE_CONFIG(SEARCHBAR::BUTTON_LEFT_MARGIN, orientation, buttonLeftMargin);
2800         GET_SHAPE_CONFIG(SEARCHBAR::BUTTON_RIGHT_MARGIN, orientation, buttonRightMargin);
2801         GET_SHAPE_CONFIG(SEARCHBAR::BUTTON_WIDTH, orientation, buttonWidth);
2802         GET_SHAPE_CONFIG(SEARCHBAR::BUTTON_HEIGHT, orientation, buttonHeight);
2803         GET_SHAPE_CONFIG(SEARCHBAR::BUTTON_MIN_WIDTH, orientation, buttonMinWidth);
2804         GET_SHAPE_CONFIG(SEARCHBAR::SEARCH_FIELD_MIN_WIDTH, orientation, searchFieldMinWidth);
2805         GET_SHAPE_CONFIG(SEARCHBAR::VERTICAL_MARGIN, orientation, buttonVerticalMargin);
2806         GET_SHAPE_CONFIG(SEARCHBAR::MIN_HEIGHT, orientation, searchBarMinHeight);
2807
2808         cancelButtonBounds.height = buttonHeight;
2809
2810         float searchFieldMinHeight = searchBarMinHeight - (verticalMargin * 2.0f);
2811         cancelButtonWidth = __pCancelButton->GetTextExtentSizeF() + __pCancelButton->GetRightMarginF() + __pCancelButton->GetLeftMarginF();
2812         editBounds.x = horizontalMargin;
2813
2814         if (searchBarBounds.height < searchBarMinHeight)
2815         {
2816                 verticalMargin = (searchBarBounds.height - searchFieldMinHeight)/2.0f;
2817                 if (verticalMargin < 0.0f)
2818                 {
2819                         verticalMargin = 0.0f;
2820                 }
2821         }
2822
2823         editBounds.y = verticalMargin;
2824         editBounds.height = searchBarBounds.height - (editBounds.y * 2.0f);
2825
2826         editBounds.height = (editBounds.height > searchFieldMinHeight) ? editBounds.height : searchFieldMinHeight;
2827
2828         editBounds.width = searchBarBounds.width - cancelButtonWidth - horizontalMargin - buttonLeftMargin - buttonRightMargin;
2829
2830         if (editBounds.width < searchFieldMinWidth)
2831         {
2832                 editBounds.width = searchFieldMinWidth;
2833         }
2834
2835         cancelButtonBounds.x = editBounds.width + horizontalMargin + buttonLeftMargin;
2836         cancelButtonBounds.y = (searchBarBounds.height - cancelButtonBounds.height)/2.0f;
2837
2838         cancelButtonBounds.y = cancelButtonBounds.y < 0.0f ? 0.0f:cancelButtonBounds.y;
2839
2840         float remainingWidth = searchBarBounds.width - editBounds.width - horizontalMargin - buttonLeftMargin - buttonRightMargin;
2841
2842         if (remainingWidth < buttonMinWidth)
2843         {
2844                 cancelButtonBounds.width = buttonMinWidth;
2845         }
2846         else
2847         {
2848                 cancelButtonBounds.width = searchBarBounds.width - cancelButtonBounds.x - buttonRightMargin;
2849         }
2850
2851         cancelButtonBounds.width = (cancelButtonBounds.width > 0.0f) ? cancelButtonBounds.width : 0.0f;
2852         cancelButtonBounds.height = (cancelButtonBounds.height > 0.0f) ? cancelButtonBounds.height : 0.0f;
2853
2854         r = __pCancelButton->SetBounds(cancelButtonBounds);
2855         SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
2856         r = __pEdit->SetBounds(editBounds);
2857         SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
2858
2859         return;
2860 }
2861
2862 SearchFieldStatus
2863 _SearchBar::GetCurrentStatus(void)
2864 {
2865         SearchFieldStatus searchFieldStatus = SEARCH_FIELD_STATUS_NORMAL;
2866
2867         if (IsEnabled())
2868         {
2869                 if (__pEdit->IsFocused())
2870                 {
2871                         searchFieldStatus = SEARCH_FIELD_STATUS_HIGHLIGHTED;
2872                 }
2873         }
2874         else
2875         {
2876                 searchFieldStatus = SEARCH_FIELD_STATUS_DISABLED;
2877         }
2878
2879         return searchFieldStatus;
2880 }
2881
2882 void
2883 _SearchBar::SetEditTextFilter(IEditTextFilter* pFilter)
2884 {
2885         SysTryReturnVoidResult(NID_UI_CTRL, __pEdit != null, E_SYSTEM,
2886                                    "[%s] A system error has occurred. The _Edit instance is null.", GetErrorMessage(E_SYSTEM));
2887
2888         __pEdit->SetEditTextFilter(pFilter);
2889
2890         return;
2891 }
2892
2893 void
2894 _SearchBar::SendOpaqueCommand(const String& command)
2895 {
2896         SysTryReturnVoidResult(NID_UI_CTRL, __pEdit != null, E_SYSTEM,
2897                                    "[E_SYSTEM] A system error has occurred. The _Edit instance is null.");
2898
2899         __pEdit->SendOpaqueCommand(command);
2900
2901         return;
2902 }
2903
2904 void
2905 _SearchBar::SetFocusCallbackParameter(bool state)
2906 {
2907         __isFocusCallbackToBeFired = state;
2908         return;
2909 }
2910
2911 bool
2912 _SearchBar::IsFocusCallbackToBeFired(void) const
2913 {
2914         return __isFocusCallbackToBeFired;
2915 }
2916 }}} // Tizen::Ui::Controls