Changed indicator bg color.
[platform/framework/native/uifw.git] / src / ui / controls / FUiCtrl_TokenEdit.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  * @file                FUiCtrl_TokenEdit.cpp
19  * @brief               This is the implementation file for the _TokenEdit class.
20  */
21
22 #include <FBaseSysLog.h>
23 #include "FUiCtrl_TokenEdit.h"
24 #include "FUiCtrl_TokenEditPresenter.h"
25
26 #include "FUi_AccessibilityContainer.h"
27 #include "FUi_AccessibilityElement.h"
28
29 using namespace Tizen::Base;
30 using namespace Tizen::Graphics;
31 using namespace Tizen::Ui;
32
33 namespace Tizen { namespace Ui { namespace Controls
34 {
35
36 IMPLEMENT_PROPERTY(_TokenEdit);
37
38 _TokenEdit::_TokenEdit(void)
39         : _Edit()
40         , __pTokenEditPresenter(null)
41         , __isSelectedTokenTextColorSet(false)
42         , __pTokenFilter(null)
43         , __pTitleTextAccessibilityElement(null)
44         , __pCursorAccessibilityElement(null)
45 {
46         GET_COLOR_CONFIG(TOKENEDIT::BG_NORMAL, __tokenColor[TOKEN_EDIT_STATUS_NORMAL]);
47         GET_COLOR_CONFIG(TOKENEDIT::BG_SELECTED, __tokenColor[TOKEN_EDIT_STATUS_SELECTED]);
48         GET_COLOR_CONFIG(TOKENEDIT::BG_HIGHLIGHTED, __tokenColor[TOKEN_EDIT_STATUS_HIGHLIGHTED]);
49         GET_COLOR_CONFIG(TOKENEDIT::BG_DISABLED, __tokenColor[TOKEN_EDIT_STATUS_DISABLED]);
50         __tokenColor[TOKEN_EDIT_STATUS_DISABLED].SetAlpha(TOKEN_EDIT_BG_DISABLED_OPACITY); //apply dimming
51         GET_COLOR_CONFIG(TOKENEDIT::TEXT_NORMAL, __tokenTextColor[EXPANDABLE_EDIT_AREA_TOKEN_STATUS_NORMAL]);
52         GET_COLOR_CONFIG(TOKENEDIT::TEXT_SELECTED, __tokenTextColor[EXPANDABLE_EDIT_AREA_TOKEN_STATUS_SELECTED]);
53
54         _AccessibilityContainer* pContainer = null;
55         pContainer = GetAccessibilityContainer();
56         if (pContainer)
57         {
58                 pContainer->Activate(true);
59         }
60 }
61
62 _TokenEdit::~_TokenEdit(void)
63 {
64
65 }
66
67 _TokenEdit*
68 _TokenEdit::CreateTokenEditN(void)
69 {
70         _TokenEditPresenter* pPresenter = _TokenEditPresenter::CreateTokenEditPresenterN();
71         result r = GetLastResult();
72         SysTryReturn(NID_UI_CTRL, pPresenter != null, null, r, "[%s] Propagating.", GetErrorMessage(r));
73
74         _TokenEdit* pTokenEdit = new (std::nothrow) _TokenEdit();
75         SysTryCatch(NID_UI_CTRL, pTokenEdit != null, , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
76         SysTryCatch(NID_UI_CTRL, GetLastResult() == E_SUCCESS, , GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
77
78         pTokenEdit->AcquireHandle();
79
80         pTokenEdit->SetPresenter(*pPresenter);
81         pTokenEdit->__pTokenEditPresenter = pPresenter;
82
83         return pTokenEdit;
84
85 CATCH:
86         delete pPresenter;
87         delete pTokenEdit;
88         return null;
89 }
90
91 void
92 _TokenEdit::OnDraw(void)
93 {
94         result r = E_SUCCESS;
95
96         if (__pTokenEditPresenter == null)
97         {
98                 return;
99         }
100
101         Canvas* pCanvas = GetCanvasN();
102         SysTryReturnVoidResult(NID_UI_CTRL, pCanvas, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
103
104         r = __pTokenEditPresenter->Draw(*pCanvas);
105         SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
106
107         delete pCanvas;
108 }
109
110 result
111 _TokenEdit::SetTokenFilter(const _ITokenFilter* pFilter)
112 {
113         result r = E_SUCCESS;
114
115         __pTokenFilter = const_cast< _ITokenFilter* >(pFilter);
116
117         return r;
118 }
119
120 _ITokenFilter*
121 _TokenEdit::GetTokenFilter(void) const
122 {
123         return __pTokenFilter;
124 }
125
126 result
127 _TokenEdit::AppendToken(const String& token)
128 {
129         result r = E_SUCCESS;
130
131         SysAssertf(__pTokenEditPresenter != null, "_TokenEditPresenter instance is null");
132
133         r = __pTokenEditPresenter->AppendToken(token);
134         SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "Propagating.");
135
136         return r;
137 }
138
139 result
140 _TokenEdit::InsertTokenAt(int index, const String& token)
141 {
142         result r = E_SUCCESS;
143
144         SysAssertf(__pTokenEditPresenter != null, "_TokenEditPresenter instance is null");
145
146         r = __pTokenEditPresenter->InsertTokenAt(index, token, true);
147         SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "Propagating.");
148
149         return r;
150 }
151
152 String
153 _TokenEdit::GetTokenAt(int index) const
154 {
155         SysAssertf(__pTokenEditPresenter != null, "_TokenEditPresenter instance is null");
156
157         return __pTokenEditPresenter->GetTokenAt(index);
158 }
159
160 int
161 _TokenEdit::GetTokenCount(void) const
162 {
163         SysAssertf(__pTokenEditPresenter != null, "_TokenEditPresenter instance is null");
164
165         return __pTokenEditPresenter->GetTokenCount(true);
166 }
167
168 int
169 _TokenEdit::GetSelectedTokenIndex(void) const
170 {
171         SysAssertf(__pTokenEditPresenter != null, "_TokenEditPresenter instance is null");
172
173         return __pTokenEditPresenter->GetSelectedTokenIndex();
174 }
175
176 bool
177 _TokenEdit::IsTokenEditModeEnabled(void) const
178 {
179         SysAssertf(__pTokenEditPresenter != null, "_TokenEditPresenter instance is null");
180
181         Variant var = GetProperty("tokenEditModeEnabled");
182
183         return var.ToBool();
184 }
185
186 result
187 _TokenEdit::RemoveTokenAt(int index)
188 {
189         SysAssertf(__pTokenEditPresenter != null, "_TokenEditPresenter instance is null");
190
191         return __pTokenEditPresenter->RemoveTokenAt(index, true);
192 }
193
194 result
195 _TokenEdit::SetTokenSelected(int index, bool selected)
196 {
197         SysAssertf(__pTokenEditPresenter != null, "_TokenEditPresenter instance is null");
198
199         return __pTokenEditPresenter->SetTokenSelected(index, selected);
200 }
201
202 result
203 _TokenEdit::SetTokenEditModeEnabled(bool enable)
204 {
205         SysAssertf(__pTokenEditPresenter != null, "_TokenEditPresenter instance is null");
206
207         Variant var(enable);
208
209         return SetProperty("tokenEditModeEnabled", var);
210 }
211
212 Color
213 _TokenEdit::GetTokenColor(TokenEditStatus status) const
214 {
215         Variant var;
216
217         switch (status)
218         {
219         case TOKEN_EDIT_STATUS_NORMAL:
220                 var = GetProperty("normalTokenColor");
221                 break;
222
223         case TOKEN_EDIT_STATUS_SELECTED:
224                 var = GetProperty("selectedTokenColor");
225                 break;
226
227         case TOKEN_EDIT_STATUS_HIGHLIGHTED:
228                 var = GetProperty("highlightedTokenColor");
229                 break;
230
231         case TOKEN_EDIT_STATUS_DISABLED:
232                 var = GetProperty("disabledTokenColor");
233                 break;
234
235         default:
236                 break;
237         }
238
239         return var.ToColor();
240 }
241
242 Color
243 _TokenEdit::GetTokenTextColor(void) const
244 {
245         Variant var = GetProperty("tokenTextColor");
246
247         return var.ToColor();
248 }
249
250 result
251 _TokenEdit::SetTokenColor(TokenEditStatus status, const Color& color)
252 {
253         result r = E_SUCCESS;
254         Variant var(color);
255
256         switch (status)
257         {
258         case TOKEN_EDIT_STATUS_NORMAL:
259                 r = SetProperty("normalTokenColor", var);
260                 break;
261
262         case TOKEN_EDIT_STATUS_SELECTED:
263                 r = SetProperty("selectedTokenColor", var);
264                 break;
265
266         case TOKEN_EDIT_STATUS_HIGHLIGHTED:
267                 r = SetProperty("highlightedTokenColor", var);
268                 break;
269
270         case TOKEN_EDIT_STATUS_DISABLED:
271                 r = SetProperty("disabledTokenColor", var);
272                 break;
273         default:
274                 break;
275         }
276
277         return r;
278 }
279
280 result
281 _TokenEdit::SetTokenTextColor(const Color& color)
282 {
283         Variant var(color);
284         return SetProperty("tokenTextColor", var);
285 }
286
287 Color
288 _TokenEdit::GetSelectedTokenTextColor(void) const
289 {
290         Variant var = GetProperty("selectedTokenTextColor");
291
292         return var.ToColor();
293 }
294
295 result
296 _TokenEdit::SetSelectedTokenTextColor(const Color& color)
297 {
298         Variant var(color);
299
300         return SetProperty("selectedTokenTextColor", var);
301 }
302
303 result
304 _TokenEdit::SetTitleText(const String& title)
305 {
306         result r = E_SUCCESS;
307
308         SysAssertf(__pTokenEditPresenter != null, "_TokenEditPresenter instance is null");
309
310         __pTokenEditPresenter->SetDescriptionText(title);
311
312         r = __pTokenEditPresenter->CalculateDescriptionTextRect(title);
313         SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "Propagating.");
314
315         r = __pTokenEditPresenter->CalculateTokenPositionFromIndex(0);
316         SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "Propagating.");
317
318         r = __pTokenEditPresenter->SetInitialBounds();
319         SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "Propagating.");
320
321         Invalidate(true);
322         return r;
323 }
324
325 String
326 _TokenEdit::GetTitleText(void) const
327 {
328         SysAssertf(__pTokenEditPresenter != null, "_TokenEditPresenter instance is null");
329
330         return __pTokenEditPresenter->GetDescriptionText();
331 }
332
333 void
334 _TokenEdit::SetAutoShrinkModeEnabled(bool enable)
335 {
336         SysAssertf(__pTokenEditPresenter != null, "_TokenEditPresenter instance is null");
337
338         __pTokenEditPresenter->SetAutoShrinkModeEnabled(enable);
339 }
340
341 bool
342 _TokenEdit::IsAutoShrinkModeEnabled(void) const
343 {
344         SysAssertf(__pTokenEditPresenter != null, "_TokenEditPresenter instance is null");
345
346         return __pTokenEditPresenter->IsAutoShrinkModeEnabled();
347 }
348
349 result
350 _TokenEdit::ProcessTokenFiltering(const String& inputString, String& replaceString, bool& enable)
351 {
352         if (__pTokenFilter)
353         {
354                 enable = __pTokenFilter->ReplaceToken(inputString, replaceString);
355         }
356
357         return E_SUCCESS;
358 }
359
360 bool
361 _TokenEdit::OnTouchPressed(const _Control& source, const _TouchInfo& touchinfo)
362 {
363         if (&source != this)
364         {
365                 return false;
366         }
367
368         if (__pTokenEditPresenter == null)
369         {
370                 return false;
371         }
372         return __pTokenEditPresenter->OnTouchPressed(source, touchinfo);
373 }
374
375 bool
376 _TokenEdit::OnTouchReleased(const _Control& source, const _TouchInfo& touchinfo)
377 {
378         if (&source != this)
379         {
380                 return false;
381         }
382         if (__pTokenEditPresenter == null)
383         {
384                 return false;
385         }
386         return __pTokenEditPresenter->OnTouchReleased(source, touchinfo);
387 }
388
389 bool
390 _TokenEdit::OnTouchMoved(const _Control& source, const _TouchInfo& touchinfo)
391 {
392         if (&source != this)
393         {
394                 return false;
395         }
396         if (__pTokenEditPresenter == null)
397         {
398                 return false;
399         }
400         return __pTokenEditPresenter->OnTouchMoved(source, touchinfo);
401 }
402
403 result
404 _TokenEdit::SetPropertyNormalTokenColor(const Variant& color)
405 {
406         ClearLastResult();
407
408         __tokenColor[TOKEN_EDIT_STATUS_NORMAL] = color.ToColor();
409
410         return E_SUCCESS;
411 }
412
413 Variant
414 _TokenEdit::GetPropertyNormalTokenColor(void) const
415 {
416         ClearLastResult();
417
418         return Variant(__tokenColor[TOKEN_EDIT_STATUS_NORMAL]);
419 }
420
421 result
422 _TokenEdit::SetPropertySelectedTokenColor(const Variant& color)
423 {
424         ClearLastResult();
425
426         __tokenColor[TOKEN_EDIT_STATUS_SELECTED] = color.ToColor();
427
428         return E_SUCCESS;
429 }
430
431 Variant
432 _TokenEdit::GetPropertySelectedTokenColor(void) const
433 {
434         ClearLastResult();
435
436         return Variant(__tokenColor[TOKEN_EDIT_STATUS_SELECTED]);
437 }
438
439 result
440 _TokenEdit::SetPropertyHighlightedTokenColor(const Variant& color)
441 {
442         ClearLastResult();
443
444         __tokenColor[TOKEN_EDIT_STATUS_HIGHLIGHTED] = color.ToColor();
445
446         return E_SUCCESS;
447 }
448
449 Variant
450 _TokenEdit::GetPropertyHighlightedTokenColor(void) const
451 {
452         ClearLastResult();
453
454         return Variant(__tokenColor[TOKEN_EDIT_STATUS_HIGHLIGHTED]);
455 }
456
457 result
458 _TokenEdit::SetPropertyDisabledTokenColor(const Variant& color)
459 {
460         ClearLastResult();
461
462         __tokenColor[TOKEN_EDIT_STATUS_DISABLED] = color.ToColor();
463
464         return E_SUCCESS;
465 }
466
467 Variant
468 _TokenEdit::GetPropertyDisabledTokenColor(void) const
469 {
470         ClearLastResult();
471
472         return Variant(__tokenColor[TOKEN_EDIT_STATUS_DISABLED]);
473 }
474
475 result
476 _TokenEdit::SetPropertyTokenTextColor(const Variant& color)
477 {
478         ClearLastResult();
479
480         __tokenTextColor[EXPANDABLE_EDIT_AREA_TOKEN_STATUS_NORMAL] = color.ToColor();
481         if (!__isSelectedTokenTextColorSet)
482         {
483                 __tokenTextColor[EXPANDABLE_EDIT_AREA_TOKEN_STATUS_SELECTED] = color.ToColor();
484         }
485
486         return E_SUCCESS;
487 }
488
489 Variant
490 _TokenEdit::GetPropertyTokenTextColor(void) const
491 {
492         ClearLastResult();
493
494         return Variant(__tokenTextColor[EXPANDABLE_EDIT_AREA_TOKEN_STATUS_NORMAL]);
495 }
496
497 result
498 _TokenEdit::SetPropertySelectedTokenTextColor(const Variant& color)
499 {
500         ClearLastResult();
501
502         __isSelectedTokenTextColorSet = true;
503
504         __tokenTextColor[EXPANDABLE_EDIT_AREA_TOKEN_STATUS_SELECTED] = color.ToColor();
505
506         return E_SUCCESS;
507 }
508
509 Variant
510 _TokenEdit::GetPropertySelectedTokenTextColor(void) const
511 {
512         ClearLastResult();
513
514         return Variant(__tokenTextColor[EXPANDABLE_EDIT_AREA_TOKEN_STATUS_SELECTED]);
515 }
516
517 result
518 _TokenEdit::SetPropertyTokenEditModeEnabled(const Variant& enable)
519 {
520         SysAssertf(__pTokenEditPresenter != null, "_TokenEditPresenter instance is null");
521
522         ClearLastResult();
523
524         return __pTokenEditPresenter->SetTokenEditModeEnabled(enable.ToBool());
525 }
526
527 Variant
528 _TokenEdit::GetPropertyTokenEditModeEnabled(void) const
529 {
530         SysAssertf(__pTokenEditPresenter != null, "_TokenEditPresenter instance is null");
531
532         ClearLastResult();
533
534         bool enabled = __pTokenEditPresenter->IsTokenEditModeEnabled();
535
536         return Variant(enabled);
537 }
538
539 result
540 _TokenEdit::OnAttachedToMainTree(void)
541 {
542         _AccessibilityContainer* pContainer = null;
543         pContainer = GetAccessibilityContainer();
544         if (pContainer)
545         {
546                 if (__pTitleTextAccessibilityElement)
547                 {
548                         return E_SUCCESS;
549                 }
550                 pContainer->AddListener(*this);
551                 UpdateAccessibilityElement(EDIT_ACCESSIBILITY_ELEMENT_TYPE_TEXT);
552         }
553
554         return E_SUCCESS;
555 }
556
557 void
558 _TokenEdit::OnBoundsChanged(void)
559 {
560         SysAssertf(__pTokenEditPresenter != null, "_TokenEditPresenter instance is null");
561
562         __pTokenEditPresenter->OnBoundsChanged();
563
564         return;
565 }
566
567 bool
568 _TokenEdit::OnAccessibilityFocusIn(const _AccessibilityContainer& control, const _AccessibilityElement& element)
569 {
570         return __pTokenEditPresenter->OnAccessibilityFocusIn(control, element);
571 }
572
573 bool
574 _TokenEdit::OnAccessibilityFocusOut(const _AccessibilityContainer& control, const _AccessibilityElement& element)
575 {
576         return __pTokenEditPresenter->OnAccessibilityFocusOut(control, element);
577 }
578
579 bool
580 _TokenEdit::OnAccessibilityActionPerformed(const _AccessibilityContainer& control, const _AccessibilityElement& element)
581 {
582         return __pTokenEditPresenter->OnAccessibilityActionPerformed(control, element);
583 }
584
585 void
586 _TokenEdit::UpdateAccessibilityElement(EditAccessibilityElementType type)
587 {
588         _AccessibilityElement* pTextAccessibilityElement = _Edit::GetTextAccessibilityElement();
589         String spaceString(L" ");
590         switch (type)
591         {
592         case EDIT_ACCESSIBILITY_ELEMENT_TYPE_TEXT:
593                 if (pTextAccessibilityElement)
594                 {
595                         pTextAccessibilityElement->SetBounds(FloatRectangle(0.0f, 0.0f, GetBoundsF().width, GetBoundsF().height));
596                         if (GetTokenCount())
597                         {
598                                 pTextAccessibilityElement->SetLabel(GetTitleText() + spaceString + __pTokenEditPresenter->GetTextAccessibilityElementText());
599                         }
600                         else
601                         {
602                                 pTextAccessibilityElement->SetLabel(GetTitleText() + spaceString + GetGuideText() + GetText());
603                         }
604                         pTextAccessibilityElement->SetHint(L"double tap to edit");
605                 }
606                 break;
607
608         default:
609                 break;
610         }
611
612         return;
613 }
614
615 _AccessibilityElement*
616 _TokenEdit::GetTitleTextAccessibilityElement(void) const
617 {
618         return __pTitleTextAccessibilityElement;
619 }
620
621 _AccessibilityElement*
622 _TokenEdit::GetCursorAccessibilityElement(void) const
623 {
624         return __pCursorAccessibilityElement;
625 }
626
627 result
628 _TokenEdit::AddTitleAccessibilityElement(void)
629 {
630         result r = E_SUCCESS;
631
632         if (!(GetEditStyle() & EDIT_STYLE_TITLE_LEFT))
633         {
634                 return r;
635         }
636
637         if (__pTitleTextAccessibilityElement)
638         {
639                 return r;
640         }
641
642         _AccessibilityContainer* pContainer = GetAccessibilityContainer();
643
644         if (pContainer)
645         {
646                 _AccessibilityElement* pAccessibilityElement = new (std::nothrow) _AccessibilityElement(true);
647                 SysTryReturnResult(NID_UI_CTRL, pAccessibilityElement != null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
648
649                 String labelText = GetTitleText();
650                 pAccessibilityElement->SetBounds(__pTokenEditPresenter->GetDescriptionTextRect());
651                 pAccessibilityElement->SetLabel(labelText);
652                 pContainer->AddElement(*pAccessibilityElement);
653                 __pTitleTextAccessibilityElement = pAccessibilityElement;
654         }
655
656         return r;
657 }
658
659 result
660 _TokenEdit::AddCursorAccessibilityElement(void)
661 {
662         result r = E_SUCCESS;
663
664         if (__pCursorAccessibilityElement)
665         {
666                 return r;
667         }
668
669         _AccessibilityContainer* pContainer = GetAccessibilityContainer();
670
671         if (pContainer)
672         {
673                 _AccessibilityElement* pAccessibilityElement = new (std::nothrow) _AccessibilityElement(true);
674                 SysTryReturnResult(NID_UI_CTRL, pAccessibilityElement != null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
675
676                 if (GetTextLength())
677                 {
678                         pAccessibilityElement->SetLabel(GetText());
679                 }
680                 else
681                 {
682                         pAccessibilityElement->SetTrait(L"Edit field");
683                 }
684
685                 pContainer->AddElement(*pAccessibilityElement);
686
687                 __pCursorAccessibilityElement = pAccessibilityElement;
688
689                 SetCursorAccessibilityBounds(__pTokenEditPresenter->GetTextBoundsF());
690         }
691
692         return r;
693 }
694
695 result
696 _TokenEdit::SetCursorAccessibilityBounds(const FloatRectangle& cursorBounds)
697 {
698         if (!__pCursorAccessibilityElement)
699         {
700                 return E_SUCCESS;
701         }
702         __pCursorAccessibilityElement->SetBounds(cursorBounds);
703
704         return E_SUCCESS;
705 }
706
707 void
708 _TokenEdit::RemoveTitleAccessibilityElement(void)
709 {
710         _AccessibilityContainer* pContainer = GetAccessibilityContainer();
711         if (pContainer)
712         {
713                 if (__pTitleTextAccessibilityElement)
714                 {
715                         pContainer->RemoveElement(*__pTitleTextAccessibilityElement);
716                         __pTitleTextAccessibilityElement = null;
717                 }
718         }
719 }
720
721 void
722 _TokenEdit::RemoveCursorAccessibilityElement(void)
723 {
724         _AccessibilityContainer* pContainer = GetAccessibilityContainer();
725         if (pContainer)
726         {
727                 if (__pCursorAccessibilityElement)
728                 {
729                         pContainer->RemoveElement(*__pCursorAccessibilityElement);
730                         __pCursorAccessibilityElement = null;
731                 }
732         }
733 }
734
735 void
736 _TokenEdit::OnDrawFocus(void)
737 {
738         //Exit Token editing/pressed mode
739         __pTokenEditPresenter->PrepareFocusUiMode();
740
741         __pTokenEditPresenter->SetDrawFocusState(true);
742
743         RefreshFocusUi();
744
745         return;
746 }
747
748 void
749 _TokenEdit::OnFocusModeStateChanged(void)
750 {
751         //Reset focus index here
752         __pTokenEditPresenter->SetDrawFocusState(false);
753
754         return;
755 }
756
757 void
758 _TokenEdit::RefreshFocusUi(void)
759 {
760         int focusedTokenIndex = __pTokenEditPresenter->GetFocusedTokenIndex();
761
762         if (focusedTokenIndex == -1)
763         {
764                 _Control::OnDrawFocus();
765         }
766         else
767         {
768                 _Control::OnFocusLost(*this);
769         }
770
771         return;
772 }
773 }}} //Tizen::Ui::Controls