Tizen 2.1 base
[framework/osp/uifw.git] / src / ui / controls / FUiCtrlSearchBar.cpp
1 //
2 // Open Service Platform
3 // Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
4 //
5 // Licensed under the Flora License, Version 1.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://floralicense.org/license/
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         FUiCtrlSearchBar.cpp
20 * @brief        This is the implementation file for SearchBar class.
21 */
22
23 #include <FBaseSysLog.h>
24 #include <FLclLocale.h>
25 #include <FUiCtrlSearchBar.h>
26 #include "FUiCtrl_SearchBarImpl.h"
27
28 using namespace Tizen::Base;
29 using namespace Tizen::Graphics;
30 using namespace Tizen::Locales;
31 using namespace Tizen::Ui;
32
33 namespace Tizen { namespace Ui { namespace Controls {
34
35 SearchBar::SearchBar(void)
36 {
37 }
38
39 SearchBar::~SearchBar(void)
40 {
41 }
42
43 result
44 SearchBar::Construct(const Rectangle& rect, bool searchBarButton, KeypadAction keypadAction)
45 {
46         result r = E_SUCCESS;
47
48         _SearchBarImpl* pSearchBarImpl = _SearchBarImpl::GetInstance(*this);
49         SysAssertf(pSearchBarImpl == null, "Already constructed. Calling Construct() twice or more on a same instance is not allowed for this class.");
50
51         pSearchBarImpl = _SearchBarImpl::CreateSearchBarImplN(this, rect, searchBarButton, keypadAction);
52         r = GetLastResult();
53         SysTryReturn(NID_UI_CTRL, pSearchBarImpl != null, r, r, "[%s] Propagating.", GetErrorMessage(r));
54
55         _pControlImpl = pSearchBarImpl;
56
57         return r;
58 }
59
60 Control*
61 SearchBar::GetContent(void) const
62 {
63         const _SearchBarImpl* pSearchBarImpl = _SearchBarImpl::GetInstance(*this);
64         SysAssertf(pSearchBarImpl, "Not yet constructed. Construct() should be called before use.");
65
66         return pSearchBarImpl->GetContent();
67 }
68
69 result
70 SearchBar::SetContent(const Control* pContent)
71 {
72         _SearchBarImpl* pSearchBarImpl = _SearchBarImpl::GetInstance(*this);
73         SysAssertf(pSearchBarImpl, "Not yet constructed. Construct() should be called before use.");
74
75         return pSearchBarImpl->SetContent(pContent);
76 }
77
78 result
79 SearchBar::UpdateContentArea(bool invalidate)
80 {
81         _SearchBarImpl* pSearchBarImpl = _SearchBarImpl::GetInstance(*this);
82         SysAssertf(pSearchBarImpl, "Not yet constructed. Construct() should be called before use.");
83
84         return pSearchBarImpl->UpdateContentArea(invalidate);
85 }
86
87 result
88 SearchBar::SetContentAreaVisible(bool visible)
89 {
90         _SearchBarImpl* pSearchBarImpl = _SearchBarImpl::GetInstance(*this);
91         SysAssertf(pSearchBarImpl, "Not yet constructed. Construct() should be called before use.");
92
93         return pSearchBarImpl->SetContentAreaVisible(visible);
94 }
95
96 bool
97 SearchBar::IsContentAreaVisible(void) const
98 {
99         const _SearchBarImpl* pSearchBarImpl = _SearchBarImpl::GetInstance(*this);
100         SysAssertf(pSearchBarImpl, "Not yet constructed. Construct() should be called before use.");
101
102         return pSearchBarImpl->IsContentAreaVisible();
103 }
104
105 result
106 SearchBar::SetContentAreaSize(const Dimension& size)
107 {
108         _SearchBarImpl* pSearchBarImpl = _SearchBarImpl::GetInstance(*this);
109         SysAssertf(pSearchBarImpl, "Not yet constructed. Construct() should be called before use.");
110
111         return pSearchBarImpl->SetContentAreaSize(size);
112 }
113
114 Dimension
115 SearchBar::GetContentAreaSize(void) const
116 {
117         const _SearchBarImpl* pSearchBarImpl = _SearchBarImpl::GetInstance(*this);
118         SysAssertf(pSearchBarImpl, "Not yet constructed. Construct() should be called before use.");
119
120         return pSearchBarImpl->GetContentAreaSize();
121 }
122
123 SearchBarMode
124 SearchBar::GetMode(void) const
125 {
126         const _SearchBarImpl* pSearchBarImpl = _SearchBarImpl::GetInstance(*this);
127         SysAssertf(pSearchBarImpl, "Not yet constructed. Construct() should be called before use.");
128
129         return pSearchBarImpl->GetMode();
130 }
131
132 bool
133 SearchBar::IsModeLocked(void) const
134 {
135         const _SearchBarImpl* pSearchBarImpl = _SearchBarImpl::GetInstance(*this);
136         SysAssertf(pSearchBarImpl, "Not yet constructed. Construct() should be called before use.");
137
138         return pSearchBarImpl->IsModeLocked();
139 }
140
141 result
142 SearchBar::SetMode(SearchBarMode mode)
143 {
144         _SearchBarImpl* pSearchBarImpl = _SearchBarImpl::GetInstance(*this);
145         SysAssertf(pSearchBarImpl, "Not yet constructed. Construct() should be called before use.");
146
147         return pSearchBarImpl->SetMode(mode);
148 }
149
150 result
151 SearchBar::SetModeLocked(bool modeLocked)
152 {
153         _SearchBarImpl* pSearchBarImpl = _SearchBarImpl::GetInstance(*this);
154         SysAssertf(pSearchBarImpl, "Not yet constructed. Construct() should be called before use.");
155
156         return pSearchBarImpl->SetModeLocked(modeLocked);
157 }
158
159 int
160 SearchBar::GetButtonActionId(void) const
161 {
162         const _SearchBarImpl* pSearchBarImpl = _SearchBarImpl::GetInstance(*this);
163         SysAssertf(pSearchBarImpl, "Not yet constructed. Construct() should be called before use.");
164
165         return pSearchBarImpl->GetButtonActionId();
166 }
167
168 Color
169 SearchBar::GetButtonColor(SearchBarButtonStatus status) const
170 {
171         const _SearchBarImpl* pSearchBarImpl = _SearchBarImpl::GetInstance(*this);
172         SysAssertf(pSearchBarImpl, "Not yet constructed. Construct() should be called before use.");
173
174         return pSearchBarImpl->GetButtonColor(status);
175 }
176
177 Color
178 SearchBar::GetButtonTextColor(SearchBarButtonStatus status) const
179 {
180         const _SearchBarImpl* pSearchBarImpl = _SearchBarImpl::GetInstance(*this);
181         SysAssertf(pSearchBarImpl, "Not yet constructed. Construct() should be called before use.");
182
183         return pSearchBarImpl->GetButtonTextColor(status);
184 }
185
186 SearchBarButtonStatus
187 SearchBar::GetButtonStatus(void) const
188 {
189         const _SearchBarImpl* pSearchBarImpl = _SearchBarImpl::GetInstance(*this);
190         SysAssertf(pSearchBarImpl, "Not yet constructed. Construct() should be called before use.");
191
192         return pSearchBarImpl->GetButtonStatus();
193 }
194
195 result
196 SearchBar::SetButton(const String& text, int actionId)
197 {
198         _SearchBarImpl* pSearchBarImpl = _SearchBarImpl::GetInstance(*this);
199         SysAssertf(pSearchBarImpl, "Not yet constructed. Construct() should be called before use.");
200
201         return pSearchBarImpl->SetButton(text, actionId);
202 }
203
204 result
205 SearchBar::SetButtonEnabled(bool enabled)
206 {
207         _SearchBarImpl* pSearchBarImpl = _SearchBarImpl::GetInstance(*this);
208         SysAssertf(pSearchBarImpl, "Not yet constructed. Construct() should be called before use.");
209
210         return pSearchBarImpl->SetButtonEnabled(enabled);
211 }
212
213 result
214 SearchBar::SetButtonColor(SearchBarButtonStatus status, const Color& color)
215 {
216         _SearchBarImpl* pSearchBarImpl = _SearchBarImpl::GetInstance(*this);
217         SysAssertf(pSearchBarImpl, "Not yet constructed. Construct() should be called before use.");
218
219         return pSearchBarImpl->SetButtonColor(status, color);
220 }
221
222 result
223 SearchBar::SetButtonTextColor(SearchBarButtonStatus status, const Color& color)
224 {
225         _SearchBarImpl* pSearchBarImpl = _SearchBarImpl::GetInstance(*this);
226         SysAssertf(pSearchBarImpl, "Not yet constructed. Construct() should be called before use.");
227
228         return pSearchBarImpl->SetButtonTextColor(status, color);
229 }
230
231 result
232 SearchBar::AppendCharacter(const Character& character)
233 {
234         _SearchBarImpl* pSearchBarImpl = _SearchBarImpl::GetInstance(*this);
235         SysAssertf(pSearchBarImpl, "Not yet constructed. Construct() should be called before use.");
236
237         return pSearchBarImpl->AppendCharacter(character);
238 }
239
240 result
241 SearchBar::AppendText(const String& text)
242 {
243         _SearchBarImpl* pSearchBarImpl = _SearchBarImpl::GetInstance(*this);
244         SysAssertf(pSearchBarImpl, "Not yet constructed. Construct() should be called before use.");
245
246         return pSearchBarImpl->AppendText(text);
247 }
248
249 result
250 SearchBar::SetText(const String& text)
251 {
252         _SearchBarImpl* pSearchBarImpl = _SearchBarImpl::GetInstance(*this);
253         SysAssertf(pSearchBarImpl, "Not yet constructed. Construct() should be called before use.");
254
255         return pSearchBarImpl->SetText(text);
256 }
257
258 result
259 SearchBar::InsertCharacterAt(int index, const Character& character)
260 {
261         _SearchBarImpl* pSearchBarImpl = _SearchBarImpl::GetInstance(*this);
262         SysAssertf(pSearchBarImpl, "Not yet constructed. Construct() should be called before use.");
263
264         return pSearchBarImpl->InsertCharacterAt(index, character);
265 }
266
267 result
268 SearchBar::InsertTextAt(int index, const String& text)
269 {
270         _SearchBarImpl* pSearchBarImpl = _SearchBarImpl::GetInstance(*this);
271         SysAssertf(pSearchBarImpl, "Not yet constructed. Construct() should be called before use.");
272
273         return pSearchBarImpl->InsertTextAt(index, text);
274 }
275
276 result
277 SearchBar::DeleteCharacterAt(int index)
278 {
279         _SearchBarImpl* pSearchBarImpl = _SearchBarImpl::GetInstance(*this);
280         SysAssertf(pSearchBarImpl, "Not yet constructed. Construct() should be called before use.");
281
282         return pSearchBarImpl->DeleteCharacterAt(index);
283 }
284
285 result
286 SearchBar::Clear(void)
287 {
288         _SearchBarImpl* pSearchBarImpl = _SearchBarImpl::GetInstance(*this);
289         SysAssertf(pSearchBarImpl, "Not yet constructed. Construct() should be called before use.");
290
291         return pSearchBarImpl->Clear();
292 }
293
294 int
295 SearchBar::GetTextLength(void) const
296 {
297         const _SearchBarImpl* pSearchBarImpl = _SearchBarImpl::GetInstance(*this);
298         SysAssertf(pSearchBarImpl, "Not yet constructed. Construct() should be called before use.");
299
300         return pSearchBarImpl->GetTextLength();
301 }
302
303 String
304 SearchBar::GetText(void) const
305 {
306         const _SearchBarImpl* pSearchBarImpl = _SearchBarImpl::GetInstance(*this);
307         SysAssertf(pSearchBarImpl, "Not yet constructed. Construct() should be called before use.");
308
309         return pSearchBarImpl->GetText();
310 }
311
312 String
313 SearchBar::GetText(int start, int end) const
314 {
315         const _SearchBarImpl* pSearchBarImpl = _SearchBarImpl::GetInstance(*this);
316         SysAssertf(pSearchBarImpl, "Not yet constructed. Construct() should be called before use.");
317
318         return pSearchBarImpl->GetText(start, end);
319 }
320
321 int
322 SearchBar::GetLimitLength(void) const
323 {
324         const _SearchBarImpl* pSearchBarImpl = _SearchBarImpl::GetInstance(*this);
325         SysAssertf(pSearchBarImpl, "Not yet constructed. Construct() should be called before use.");
326
327         return pSearchBarImpl->GetLimitLength();
328 }
329
330 result
331 SearchBar::SetLimitLength(int limitLength)
332 {
333         _SearchBarImpl* pSearchBarImpl = _SearchBarImpl::GetInstance(*this);
334         SysAssertf(pSearchBarImpl, "Not yet constructed. Construct() should be called before use.");
335
336         return pSearchBarImpl->SetLimitLength(limitLength);
337 }
338
339 result
340 SearchBar::ShowKeypad(void) const
341 {
342         const _SearchBarImpl* pSearchBarImpl = _SearchBarImpl::GetInstance(*this);
343         SysAssertf(pSearchBarImpl, "Not yet constructed. Construct() should be called before use.");
344
345         return pSearchBarImpl->ShowKeypad();
346 }
347
348 result
349 SearchBar::HideKeypad(void) const
350 {
351         const _SearchBarImpl* pSearchBarImpl = _SearchBarImpl::GetInstance(*this);
352         SysAssertf(pSearchBarImpl, "Not yet constructed. Construct() should be called before use.");
353
354         return pSearchBarImpl->HideKeypad();
355 }
356
357 int
358 SearchBar::GetSearchFieldTextSize(void) const
359 {
360         const _SearchBarImpl* pSearchBarImpl = _SearchBarImpl::GetInstance(*this);
361         SysAssertf(pSearchBarImpl, "Not yet constructed. Construct() should be called before use.");
362
363         return pSearchBarImpl->GetSearchFieldTextSize();
364 }
365
366 result
367 SearchBar::SetSearchFieldTextSize(int size)
368 {
369         _SearchBarImpl* pSearchBarImpl = _SearchBarImpl::GetInstance(*this);
370         SysAssertf(pSearchBarImpl, "Not yet constructed. Construct() should be called before use.");
371
372         return pSearchBarImpl->SetSearchFieldTextSize(size);
373 }
374
375 result
376 SearchBar::GetBlockRange(int& start, int& end) const
377 {
378         const _SearchBarImpl* pSearchBarImpl = _SearchBarImpl::GetInstance(*this);
379         SysAssertf(pSearchBarImpl, "Not yet constructed. Construct() should be called before use.");
380
381         return pSearchBarImpl->GetBlockRange(start, end);
382 }
383
384 result
385 SearchBar::ReleaseBlock(void)
386 {
387         _SearchBarImpl* pSearchBarImpl = _SearchBarImpl::GetInstance(*this);
388         SysAssertf(pSearchBarImpl, "Not yet constructed. Construct() should be called before use.");
389
390         return pSearchBarImpl->ReleaseBlock();
391 }
392
393 result
394 SearchBar::SetBlockRange(int start, int end)
395 {
396         _SearchBarImpl* pSearchBarImpl = _SearchBarImpl::GetInstance(*this);
397         SysAssertf(pSearchBarImpl, "Not yet constructed. Construct() should be called before use.");
398
399         return pSearchBarImpl->SetBlockRange(start, end);
400 }
401
402 result
403 SearchBar::RemoveTextBlock(void)
404 {
405         _SearchBarImpl* pSearchBarImpl = _SearchBarImpl::GetInstance(*this);
406         SysAssertf(pSearchBarImpl, "Not yet constructed. Construct() should be called before use.");
407
408         return pSearchBarImpl->RemoveTextBlock();
409 }
410
411 Color
412 SearchBar::GetColor(void) const
413 {
414         const _SearchBarImpl* pSearchBarImpl = _SearchBarImpl::GetInstance(*this);
415         SysAssertf(pSearchBarImpl, "Not yet constructed. Construct() should be called before use.");
416
417         return pSearchBarImpl->GetColor();
418 }
419
420 Color
421 SearchBar::GetSearchFieldColor(SearchFieldStatus status) const
422 {
423         const _SearchBarImpl* pSearchBarImpl = _SearchBarImpl::GetInstance(*this);
424         SysAssertf(pSearchBarImpl, "Not yet constructed. Construct() should be called before use.");
425
426         return pSearchBarImpl->GetSearchFieldColor(status);
427 }
428
429 Color
430 SearchBar::GetSearchFieldTextColor(SearchFieldStatus status) const
431 {
432         const _SearchBarImpl* pSearchBarImpl = _SearchBarImpl::GetInstance(*this);
433         SysAssertf(pSearchBarImpl, "Not yet constructed. Construct() should be called before use.");
434
435         return pSearchBarImpl->GetSearchFieldTextColor(status);
436 }
437
438 result
439 SearchBar::SetBackgroundBitmap(const Bitmap& bitmap)
440 {
441         _SearchBarImpl* pSearchBarImpl = _SearchBarImpl::GetInstance(*this);
442         SysAssertf(pSearchBarImpl, "Not yet constructed. Construct() should be called before use.");
443
444         return pSearchBarImpl->SetBackgroundBitmap(bitmap);
445 }
446
447 result
448 SearchBar::SetColor(const Color& color)
449 {
450         _SearchBarImpl* pSearchBarImpl = _SearchBarImpl::GetInstance(*this);
451         SysAssertf(pSearchBarImpl, "Not yet constructed. Construct() should be called before use.");
452
453         return pSearchBarImpl->SetColor(color);
454 }
455
456 result
457 SearchBar::SetSearchFieldColor(SearchFieldStatus status, const Color& color)
458 {
459         _SearchBarImpl* pSearchBarImpl = _SearchBarImpl::GetInstance(*this);
460         SysAssertf(pSearchBarImpl, "Not yet constructed. Construct() should be called before use.");
461
462         return pSearchBarImpl->SetSearchFieldColor(status, color);
463 }
464
465 result
466 SearchBar::SetSearchFieldTextColor(SearchFieldStatus status, const Color& color)
467 {
468         _SearchBarImpl* pSearchBarImpl = _SearchBarImpl::GetInstance(*this);
469         SysAssertf(pSearchBarImpl, "Not yet constructed. Construct() should be called before use.");
470
471         return pSearchBarImpl->SetSearchFieldTextColor(status, color);
472 }
473
474 String
475 SearchBar::GetGuideText(void) const
476 {
477         const _SearchBarImpl* pSearchBarImpl = _SearchBarImpl::GetInstance(*this);
478         SysAssertf(pSearchBarImpl, "Not yet constructed. Construct() should be called before use.");
479
480         return pSearchBarImpl->GetGuideText();
481 }
482
483 result
484 SearchBar::SetGuideText(const String& guideText)
485 {
486         _SearchBarImpl* pSearchBarImpl = _SearchBarImpl::GetInstance(*this);
487         SysAssertf(pSearchBarImpl, "Not yet constructed. Construct() should be called before use.");
488
489         return pSearchBarImpl->SetGuideText(guideText);
490 }
491
492 Color
493 SearchBar::GetGuideTextColor(void) const
494 {
495         const _SearchBarImpl* pSearchBarImpl = _SearchBarImpl::GetInstance(*this);
496         SysAssertf(pSearchBarImpl, "Not yet constructed. Construct() should be called before use.");
497
498         return pSearchBarImpl->GetGuideTextColor();
499 }
500
501 result
502 SearchBar::SetGuideTextColor(const Color& color)
503 {
504         _SearchBarImpl* pSearchBarImpl = _SearchBarImpl::GetInstance(*this);
505         SysAssertf(pSearchBarImpl, "Not yet constructed. Construct() should be called before use.");
506
507         return pSearchBarImpl->SetGuideTextColor(color);
508 }
509
510 int
511 SearchBar::GetCursorPosition(void) const
512 {
513         const _SearchBarImpl* pSearchBarImpl = _SearchBarImpl::GetInstance(*this);
514         SysAssertf(pSearchBarImpl, "Not yet constructed. Construct() should be called before use.");
515
516         return pSearchBarImpl->GetCursorPosition();
517 }
518
519 result
520 SearchBar::SetCursorPosition(int index)
521 {
522         _SearchBarImpl* pSearchBarImpl = _SearchBarImpl::GetInstance(*this);
523         SysAssertf(pSearchBarImpl, "Not yet constructed. Construct() should be called before use.");
524
525         return pSearchBarImpl->SetCursorPosition(index);
526 }
527
528 bool
529 SearchBar::IsLowerCaseModeEnabled(void) const
530 {
531         const _SearchBarImpl* pSearchBarImpl = _SearchBarImpl::GetInstance(*this);
532         SysAssertf(pSearchBarImpl, "Not yet constructed. Construct() should be called before use.");
533
534         return pSearchBarImpl->IsLowerCaseModeEnabled();
535 }
536
537 void
538 SearchBar::SetLowerCaseModeEnabled(bool enable)
539 {
540         _SearchBarImpl* pSearchBarImpl = _SearchBarImpl::GetInstance(*this);
541         SysAssertf(pSearchBarImpl, "Not yet constructed. Construct() should be called before use.");
542
543         pSearchBarImpl->SetLowerCaseModeEnabled(enable);
544
545         return;
546 }
547
548 EllipsisPosition
549 SearchBar::GetEllipsisPosition(void) const
550 {
551         const _SearchBarImpl* pSearchBarImpl = _SearchBarImpl::GetInstance(*this);
552         SysAssertf(pSearchBarImpl, "Not yet constructed. Construct() should be called before use.");
553
554         return pSearchBarImpl->GetEllipsisPosition();
555 }
556
557 result
558 SearchBar::SetEllipsisPosition(EllipsisPosition position)
559 {
560         _SearchBarImpl* pSearchBarImpl = _SearchBarImpl::GetInstance(*this);
561         SysAssertf(pSearchBarImpl, "Not yet constructed. Construct() should be called before use.");
562
563         return pSearchBarImpl->SetEllipsisPosition(position);
564 }
565
566 KeypadAction
567 SearchBar::GetKeypadAction(void) const
568 {
569         const _SearchBarImpl* pSearchBarImpl = _SearchBarImpl::GetInstance(*this);
570         SysAssertf(pSearchBarImpl, "Not yet constructed. Construct() should be called before use.");
571
572         return pSearchBarImpl->GetKeypadAction();
573 }
574
575 bool
576 SearchBar::IsTextPredictionEnabled(void) const
577 {
578         const _SearchBarImpl* pSearchBarImpl = _SearchBarImpl::GetInstance(*this);
579         SysAssertf(pSearchBarImpl, "Not yet constructed. Construct() should be called before use.");
580
581         return pSearchBarImpl->IsTextPredictionEnabled();
582 }
583
584 result
585 SearchBar::SetTextPredictionEnabled(bool enable)
586 {
587         _SearchBarImpl* pSearchBarImpl = _SearchBarImpl::GetInstance(*this);
588         SysAssertf(pSearchBarImpl, "Not yet constructed. Construct() should be called before use.");
589
590         return pSearchBarImpl->SetTextPredictionEnabled(enable);
591 }
592
593 result
594 SearchBar::SetCurrentLanguage(LanguageCode languageCode)
595 {
596         _SearchBarImpl* pSearchBarImpl = _SearchBarImpl::GetInstance(*this);
597         SysAssertf(pSearchBarImpl != null, "Not yet constructed. Construct() should be called before use.");
598
599         return pSearchBarImpl->SetCurrentLanguage(languageCode);
600 }
601
602 result
603 SearchBar::GetCurrentLanguage(LanguageCode& language) const
604 {
605         const _SearchBarImpl* pSearchBarImpl = _SearchBarImpl::GetInstance(*this);
606         SysAssertf(pSearchBarImpl != null, "Not yet constructed. Construct() should be called before use.");
607
608         return pSearchBarImpl->GetCurrentLanguage(language);
609 }
610
611 void
612 SearchBar::AddActionEventListener(IActionEventListener& listener)
613 {
614         _SearchBarImpl* pSearchBarImpl = _SearchBarImpl::GetInstance(*this);
615         SysAssertf(pSearchBarImpl, "Not yet constructed. Construct() should be called before use.");
616
617         result r = pSearchBarImpl->AddActionEventListener(listener);
618         SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
619
620         return;
621 }
622
623 void
624 SearchBar::RemoveActionEventListener(IActionEventListener& listener)
625 {
626         _SearchBarImpl* pSearchBarImpl = _SearchBarImpl::GetInstance(*this);
627         SysAssertf(pSearchBarImpl, "Not yet constructed. Construct() should be called before use.");
628
629         result r = pSearchBarImpl->RemoveActionEventListener(listener);
630         SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
631
632         return;
633 }
634
635 void
636 SearchBar::AddTextEventListener(ITextEventListener& listener)
637 {
638         _SearchBarImpl* pSearchBarImpl = _SearchBarImpl::GetInstance(*this);
639         SysAssertf(pSearchBarImpl, "Not yet constructed. Construct() should be called before use.");
640
641         result r = pSearchBarImpl->AddTextEventListener(listener);
642         SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
643
644         return;
645 }
646
647 void
648 SearchBar::RemoveTextEventListener(ITextEventListener& listener)
649 {
650         _SearchBarImpl* pSearchBarImpl = _SearchBarImpl::GetInstance(*this);
651         SysAssertf(pSearchBarImpl, "Not yet constructed. Construct() should be called before use.");
652
653         result r = pSearchBarImpl->RemoveTextEventListener(listener);
654         SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
655
656         return;
657 }
658
659 void
660 SearchBar::AddSearchBarEventListener(ISearchBarEventListener& listener)
661 {
662         _SearchBarImpl* pSearchBarImpl = _SearchBarImpl::GetInstance(*this);
663         SysAssertf(pSearchBarImpl, "Not yet constructed. Construct() should be called before use.");
664
665         result r = pSearchBarImpl->AddSearchBarEventListener(listener);
666         SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
667
668         return;
669 }
670
671 void
672 SearchBar::RemoveSearchBarEventListener(ISearchBarEventListener& listener)
673 {
674         _SearchBarImpl* pSearchBarImpl = _SearchBarImpl::GetInstance(*this);
675         SysAssertf(pSearchBarImpl, "Not yet constructed. Construct() should be called before use.");
676
677         result r = pSearchBarImpl->RemoveSearchBarEventListener(listener);
678         SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
679
680         return;
681 }
682
683 void
684 SearchBar::AddTextBlockEventListener(ITextBlockEventListener& listener)
685 {
686         _SearchBarImpl* pSearchBarImpl = _SearchBarImpl::GetInstance(*this);
687         SysAssertf(pSearchBarImpl, "Not yet constructed. Construct() should be called before use.");
688
689         result r = pSearchBarImpl->AddTextBlockEventListener(listener);
690         SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
691
692         return;
693 }
694
695 void
696 SearchBar::RemoveTextBlockEventListener(ITextBlockEventListener& listener)
697 {
698         _SearchBarImpl* pSearchBarImpl = _SearchBarImpl::GetInstance(*this);
699         SysAssertf(pSearchBarImpl, "Not yet constructed. Construct() should be called before use.");
700
701         result r = pSearchBarImpl->RemoveTextBlockEventListener(listener);
702         SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
703
704         return;
705 }
706
707 void
708 SearchBar::AddKeypadEventListener(IKeypadEventListener& listener)
709 {
710         _SearchBarImpl* pSearchBarImpl = _SearchBarImpl::GetInstance(*this);
711         SysAssertf(pSearchBarImpl, "Not yet constructed. Construct() should be called before use.");
712
713         result r = pSearchBarImpl->AddKeypadEventListener(listener);
714         SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
715
716         return;
717 }
718
719 void
720 SearchBar::RemoveKeypadEventListener(IKeypadEventListener& listener)
721 {
722         _SearchBarImpl* pSearchBarImpl = _SearchBarImpl::GetInstance(*this);
723         SysAssertf(pSearchBarImpl, "Not yet constructed. Construct() should be called before use.");
724
725         result r = pSearchBarImpl->RemoveKeypadEventListener(listener);
726         SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
727
728         return;
729 }
730
731 void
732 SearchBar::AddLanguageEventListener(ILanguageEventListener& listener)
733 {
734         _SearchBarImpl* pSearchBarImpl = _SearchBarImpl::GetInstance(*this);
735         SysAssertf(pSearchBarImpl != null, "Not yet constructed. Construct() should be called before use.");
736
737         result r = pSearchBarImpl->AddLanguageEventListener(listener);
738         SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
739
740         return;
741 }
742
743 void
744 SearchBar::RemoveLanguageEventListener(ILanguageEventListener& listener)
745 {
746         _SearchBarImpl* pSearchBarImpl = _SearchBarImpl::GetInstance(*this);
747         SysAssertf(pSearchBarImpl != null, "Not yet constructed. Construct() should be called before use.");
748
749         result r = pSearchBarImpl->RemoveLanguageEventListener(listener);
750         SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
751
752         return;
753 }
754
755 }}} // Tizen::Ui::Controls