Changed indicator bg color.
[platform/framework/native/uifw.git] / src / ui / controls / FUiCtrl_TabBar.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_TabBar.cpp
19  * @brief               This is the implementation file for the _TabBar class.
20  */
21
22
23 #include <FBaseErrorDefine.h>
24 #include <FBaseSysLog.h>
25 #include "FUi_AccessibilityContainer.h"
26 #include "FUi_AccessibilityElement.h"
27 #include "FUi_CoordinateSystemUtils.h"
28 #include "FUi_ResourceManager.h"
29 #include "FUi_UiTouchEvent.h"
30
31 #include "FUiCtrl_TabBar.h"
32
33 using namespace Tizen::Base;
34 using namespace Tizen::Graphics;
35 using namespace Tizen::Base::Runtime;
36
37 namespace Tizen { namespace Ui { namespace Controls
38 {
39
40 IMPLEMENT_PROPERTY(_TabBar);
41
42 _TabBar::_TabBar()
43         : __pTabBarPresenter(null)
44         , __pActionEvent(null)
45 {
46         GET_COLOR_CONFIG(TABBAR::BG_NORMAL, __color);
47
48         GET_COLOR_CONFIG(TABBAR::ITEM_BG_NORMAL, __itemColor[ITEM_STATUS_NORMAL]);
49         GET_COLOR_CONFIG(TABBAR::ITEM_BG_SELECTED, __itemColor[ITEM_STATUS_SELECTED]);
50         GET_COLOR_CONFIG(TABBAR::ITEM_BG_PRESSED, __itemColor[ITEM_STATUS_PRESSED]);
51         GET_COLOR_CONFIG(TABBAR::ITEM_BG_DISABLED, __itemColor[ITEM_STATUS_DISABLED]);
52
53         GET_COLOR_CONFIG(TABBAR::ITEM_TEXT_NORMAL, __itemTextColor[ITEM_STATUS_NORMAL]);
54         GET_COLOR_CONFIG(TABBAR::ITEM_TEXT_SELECTED, __itemTextColor[ITEM_STATUS_SELECTED]);
55         GET_COLOR_CONFIG(TABBAR::ITEM_TEXT_PRESSED, __itemTextColor[ITEM_STATUS_PRESSED]);
56         GET_COLOR_CONFIG(TABBAR::ITEM_TEXT_DISABLED, __itemTextColor[ITEM_STATUS_DISABLED]);
57 }
58
59 _TabBar::~_TabBar(void)
60 {
61         delete __pTabBarPresenter;
62         __pTabBarPresenter = null;
63
64         if (__pActionEvent)
65         {
66                 delete __pActionEvent;
67                 __pActionEvent = null;
68         }
69
70         RemoveAllAccessibilityElement();
71 }
72
73 _TabBar*
74 _TabBar::CreateTabBarN(void)
75 {
76         _TabBar* pTabBar = new (std::nothrow) _TabBar();
77         SysTryReturn(NID_UI_CTRL, pTabBar != null, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
78
79         result r = pTabBar->Initialize();
80         SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Failed to Initialize.", GetErrorMessage(r));
81
82         pTabBar->AcquireHandle();
83         pTabBar->SetTouchPressThreshold(0.08f);
84
85         if (pTabBar->GetAccessibilityContainer() != null)
86         {
87                 pTabBar->GetAccessibilityContainer()->Activate(true);
88                 pTabBar->GetAccessibilityContainer()->AddListener(*pTabBar);
89         }
90
91         return pTabBar;
92
93 CATCH:
94         delete pTabBar;
95
96         return null;
97 }
98
99 result
100 _TabBar::Initialize(void)
101 {
102         _TabBarPresenter* pTabBarPresenter = new (std::nothrow) _TabBarPresenter(*this);
103         SysTryReturn(NID_UI_CTRL, pTabBarPresenter != null, E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
104
105         result r = pTabBarPresenter->Construct();
106         SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
107
108         r = SetPresenter(*pTabBarPresenter);
109         SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
110
111         r = pTabBarPresenter->InitializeFont();
112         SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
113
114         return r;
115
116 CATCH:
117         __pTabBarPresenter = null;
118
119         delete pTabBarPresenter;
120
121         return r;
122 }
123
124 result
125 _TabBar::SetPresenter(const _TabBarPresenter& tabBarPresenter)
126 {
127         __pTabBarPresenter = const_cast<_TabBarPresenter*>(&tabBarPresenter);
128
129         return E_SUCCESS;
130 }
131
132 result
133 _TabBar::AddItem(const Tizen::Base::String& text, int actionId)
134 {
135         return __pTabBarPresenter->AddItem(text, actionId);
136 }
137
138 result
139 _TabBar::InsertItemAt(int index, const Tizen::Base::String& text, int actionId)
140 {
141         return __pTabBarPresenter->InsertItemAt(index, text, actionId);
142 }
143
144 result
145 _TabBar::SetItemAt(int index, const Tizen::Base::String& text, int actionId)
146 {
147         return __pTabBarPresenter->SetItemAt(index, text, actionId);
148 }
149
150 result
151 _TabBar::RemoveItemAt(int index)
152 {
153         return __pTabBarPresenter->RemoveItemAt(index);
154 }
155
156 result
157 _TabBar::RemoveAllItems(void)
158 {
159         return __pTabBarPresenter->RemoveAllItems();
160 }
161
162 result
163 _TabBar::SetPropertyColor(const Variant& color)
164 {
165         result r = E_SUCCESS;
166
167         r = __pTabBarPresenter->SetReplacementColor(color.ToColor());
168
169         if (r == E_SUCCESS)
170         {
171                 __color = color.ToColor();
172         }
173
174         return r;
175 }
176
177 Variant
178 _TabBar::GetPropertyColor(void) const
179 {
180         return Tizen::Ui::Variant(__color);
181 }
182
183 result
184 _TabBar::SetColor(Tizen::Graphics::Color color)
185 {
186         return SetProperty("color", Variant(color));
187 }
188
189 Tizen::Graphics::Color
190 _TabBar::GetColor(void) const
191 {
192         Variant color = GetProperty("color");
193
194         return color.ToColor();
195 }
196
197 result
198 _TabBar::SetPropertyNormalItemColor(const Variant& color)
199 {
200         result r = E_SUCCESS;
201
202         r = __pTabBarPresenter->SetItemReplacementColor(ITEM_STATUS_NORMAL, color.ToColor());
203         if (r == E_SUCCESS)
204         {
205                 __itemColor[ITEM_STATUS_NORMAL] = color.ToColor();
206         }
207
208         return r;
209 }
210
211 Variant
212 _TabBar::GetPropertyNormalItemColor(void) const
213 {
214         return Tizen::Ui::Variant(__itemColor[ITEM_STATUS_NORMAL]);
215 }
216
217 result
218 _TabBar::SetPropertySelectedItemColor(const Variant& color)
219 {
220         result r = E_SUCCESS;
221
222         r = __pTabBarPresenter->SetItemReplacementColor(ITEM_STATUS_SELECTED, color.ToColor());
223         if (r == E_SUCCESS)
224         {
225                 __itemColor[ITEM_STATUS_SELECTED] = color.ToColor();
226         }
227
228         return r;
229 }
230
231 Variant
232 _TabBar::GetPropertySelectedItemColor(void) const
233 {
234         return Tizen::Ui::Variant(__itemColor[ITEM_STATUS_SELECTED]);
235 }
236
237 result
238 _TabBar::SetPropertyPressedItemColor(const Variant& color)
239 {
240         result r = E_SUCCESS;
241
242         r = __pTabBarPresenter->SetItemReplacementColor(ITEM_STATUS_PRESSED, color.ToColor());
243         if (r == E_SUCCESS)
244         {
245                 __itemColor[ITEM_STATUS_PRESSED] = color.ToColor();
246         }
247
248         return r;
249 }
250
251 Variant
252 _TabBar::GetPropertyPressedItemColor(void) const
253 {
254         return Tizen::Ui::Variant(__itemColor[ITEM_STATUS_PRESSED]);
255 }
256
257 result
258 _TabBar::SetPropertyDisabledItemColor(const Variant& color)
259 {
260         result r = E_SUCCESS;
261
262         r = __pTabBarPresenter->SetItemReplacementColor(ITEM_STATUS_DISABLED, color.ToColor());
263         if (r == E_SUCCESS)
264         {
265                 __itemColor[ITEM_STATUS_DISABLED] = color.ToColor();
266         }
267
268         return r;
269 }
270
271 Variant
272 _TabBar::GetPropertyDisabledItemColor(void) const
273 {
274         return Tizen::Ui::Variant(__itemColor[ITEM_STATUS_DISABLED]);
275 }
276
277 result
278 _TabBar::SetItemColor(_TabBarItemStatus itemStatus, Tizen::Graphics::Color color)
279 {
280         result r = E_SUCCESS;
281
282         if (itemStatus == ITEM_STATUS_NORMAL)
283         {
284                 r = SetProperty("normalItemColor", Variant(color));
285         }
286         else if (itemStatus == ITEM_STATUS_SELECTED)
287         {
288                 r = SetProperty("selectedItemColor", Variant(color));
289         }
290         else if (itemStatus == ITEM_STATUS_PRESSED)
291         {
292                 r = SetProperty("pressedItemColor", Variant(color));
293         }
294         else
295         {
296                 r = SetProperty("disabledItemColor", Variant(color));
297         }
298
299         return r;
300 }
301
302 Tizen::Graphics::Color
303 _TabBar::GetItemColor(_TabBarItemStatus itemStatus) const
304 {
305         Color itemColor;
306
307         if (itemStatus == ITEM_STATUS_NORMAL)
308         {
309                 Variant color = GetProperty("normalItemColor");
310                 itemColor = color.ToColor();
311         }
312         else if (itemStatus == ITEM_STATUS_SELECTED)
313         {
314                 Variant color = GetProperty("selectedItemColor");
315                 itemColor = color.ToColor();
316         }
317         else if (itemStatus == ITEM_STATUS_PRESSED)
318         {
319                 Variant color = GetProperty("pressedItemColor");
320                 itemColor = color.ToColor();
321         }
322         else
323         {
324                 Variant color = GetProperty("disabledItemColor");
325                 itemColor = color.ToColor();
326         }
327
328         return itemColor;
329 }
330
331 result
332 _TabBar::SetPropertyNormalItemTextColor(const Variant & color)
333 {
334         __itemTextColor[ITEM_STATUS_NORMAL] = color.ToColor();
335
336         return E_SUCCESS;
337 }
338
339 Variant
340 _TabBar::GetPropertyNormalItemTextColor(void) const
341 {
342         return Tizen::Ui::Variant(__itemTextColor[ITEM_STATUS_NORMAL]);
343 }
344
345 result
346 _TabBar::SetPropertySelectedItemTextColor(const Variant & color)
347 {
348         __itemTextColor[ITEM_STATUS_SELECTED] = color.ToColor();
349
350         return E_SUCCESS;
351 }
352
353 Variant
354 _TabBar::GetPropertySelectedItemTextColor(void) const
355 {
356         return Tizen::Ui::Variant(__itemTextColor[ITEM_STATUS_SELECTED]);
357 }
358
359 result
360 _TabBar::SetPropertyPressedItemTextColor(const Variant & color)
361 {
362         __itemTextColor[ITEM_STATUS_PRESSED] = color.ToColor();
363
364         return E_SUCCESS;
365 }
366
367 Variant
368 _TabBar::GetPropertyPressedItemTextColor(void) const
369 {
370         return Tizen::Ui::Variant(__itemTextColor[ITEM_STATUS_PRESSED]);
371 }
372
373 result
374 _TabBar::SetPropertyDisabledItemTextColor(const Variant & color)
375 {
376         __itemTextColor[ITEM_STATUS_DISABLED] = color.ToColor();
377
378         return E_SUCCESS;
379 }
380
381 Variant
382 _TabBar::GetPropertyDisabledItemTextColor(void) const
383 {
384         return Tizen::Ui::Variant(__itemTextColor[ITEM_STATUS_DISABLED]);
385 }
386
387 void
388 _TabBar::SetItemTextColor(_TabBarItemStatus status, Tizen::Graphics::Color color)
389 {
390         Color itemTextColor;
391         result r = E_SUCCESS;
392
393         if (status == ITEM_STATUS_NORMAL)
394         {
395                 r = SetProperty("normalItemTextColor", Variant(color));
396         }
397         else if (status == ITEM_STATUS_SELECTED)
398         {
399                 r = SetProperty("selectedItemTextColor", Variant(color));
400         }
401         else
402         {
403                 r = SetProperty("pressedItemTextColor", Variant(color));
404         }
405
406         if (r != E_SUCCESS)
407         {
408                 SysLogException(NID_UI_CTRL, E_INVALID_STATE, "Color is invalid.");
409         }
410
411 }
412
413 Tizen::Graphics::Color
414 _TabBar::GetItemTextColor(_TabBarItemStatus status) const
415 {
416         Color itemTextColor;
417
418         if (status == ITEM_STATUS_NORMAL)
419         {
420                 Variant color = GetProperty("normalItemTextColor");
421                 itemTextColor = color.ToColor();
422         }
423         else if (status == ITEM_STATUS_SELECTED)
424         {
425                 Variant color = GetProperty("selectedItemTextColor");
426                 itemTextColor = color.ToColor();
427         }
428         else if (status == ITEM_STATUS_PRESSED)
429         {
430                 Variant color = GetProperty("pressedItemTextColor");
431                 itemTextColor = color.ToColor();
432         }
433         else
434         {
435                 Variant color = GetProperty("disabledItemTextColor");
436                 itemTextColor = color.ToColor();
437         }
438
439         return itemTextColor;
440 }
441
442 result
443 _TabBar::SetItemSelected(int index)
444 {
445         return __pTabBarPresenter->SetItemSelected(index);
446 }
447
448 int
449 _TabBar::GetSelectedItemIndex(void) const
450 {
451         return __pTabBarPresenter->GetSelectedItemIndex();
452 }
453
454 int
455 _TabBar::GetItemCount(void) const
456 {
457         return __pTabBarPresenter->GetItemCount();
458 }
459
460 _TabBarItem*
461 _TabBar::GetItemFromPosition(const Tizen::Graphics::FloatPoint& position) const
462 {
463         return __pTabBarPresenter->GetItemFromPosition(position);
464 }
465
466 result
467 _TabBar::SetTopDrawnItemIndex(int index)
468 {
469         return __pTabBarPresenter->SetTopDrawnItemIndex(index);
470 }
471
472 result
473 _TabBar::SetWidth(float width)
474 {
475         float height = 0.0f;
476         GET_SHAPE_CONFIG(TABBAR::HEIGHT, _CONTROL_ORIENTATION_PORTRAIT, height);
477
478         result r = SetSize(FloatDimension(width, height));
479         SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
480         __pTabBarPresenter->ResetItemPositionX();
481
482         return r;
483 }
484
485 void
486 _TabBar::AddActionEventListener(const Tizen::Ui::Controls::_IActionEventListener& listener)
487 {
488         ClearLastResult();
489
490         if (__pActionEvent == null)
491         {
492                 __pActionEvent = _ActionEvent::CreateInstanceN(*this);
493
494                 if (__pActionEvent == null || IsFailed(GetLastResult()))
495                 {
496                         SysLog(NID_UI_CTRL, "[E_INVALID_STATE] System error occured.");
497                         SetLastResult(E_INVALID_STATE);
498                         delete __pActionEvent;
499                         return;
500                 }
501         }
502
503         SetLastResult(E_SUCCESS);
504         __pActionEvent->AddListener(listener);
505 }
506
507 void
508 _TabBar::RemoveActionEventListener(const Tizen::Ui::Controls::_IActionEventListener& listener)
509 {
510         SysTryReturnVoidResult(NID_UI_CTRL, __pActionEvent != null, E_INVALID_STATE, "[E_INVALID_STATE] This instance isn't constructed.")
511         // Todo : check fail case of RemoveListener
512         __pActionEvent->RemoveListener(listener);
513 }
514
515 bool
516 _TabBar::OnTouchPressed(const _Control& source, const _TouchInfo& touchinfo)
517 {
518         return __pTabBarPresenter->OnTouchPressed(source, touchinfo);
519 }
520
521 bool
522 _TabBar::OnTouchReleased(const _Control& source, const _TouchInfo& touchinfo)
523 {
524         bool eventFire = __pTabBarPresenter->OnTouchReleased(source, touchinfo);
525         FloatPoint touchPosition = touchinfo.GetCurrentPosition();
526
527         if (eventFire == true)
528         {
529                 int index = __pTabBarPresenter->GetItemIndexFromPosition(touchPosition);
530                 _TabBarItem* pItem = __pTabBarPresenter->GetItemAt(index);
531                 if (pItem != null)
532                 {
533                         if (__pActionEvent)
534                         {
535                                 IEventArg* pEventArg = _ActionEvent::CreateActionEventArgN(pItem->GetActionId());
536                                 SysTryReturn(NID_UI_CTRL, pEventArg != null, E_INVALID_STATE, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
537
538                                 PLAY_FEEDBACK(_RESOURCE_FEEDBACK_PATTERN_TAP, this);
539                                 __pActionEvent->Fire(*pEventArg);
540                         }
541                 }
542         }
543
544         return true;
545 }
546
547 bool
548 _TabBar::OnTouchCanceled(const _Control& source, const _TouchInfo& touchinfo)
549 {
550         return __pTabBarPresenter->OnTouchCanceled(source, touchinfo);
551 }
552
553 bool
554 _TabBar::OnTouchMoved(const _Control& source, const _TouchInfo& touchinfo)
555 {
556         return __pTabBarPresenter->OnTouchMoved(source, touchinfo);
557 }
558
559 void
560 _TabBar::OnFontChanged(Font * pFont)
561 {
562         __pTabBarPresenter->OnFontChanged(pFont);
563 }
564
565 void
566 _TabBar::OnFontInfoRequested(unsigned long& style, float& size)
567 {
568         __pTabBarPresenter->OnFontInfoRequested(style, size);
569 }
570
571 void
572 _TabBar::OnDraw(void)
573 {
574         __pTabBarPresenter->Draw();
575         SetAllAccessibilityElement();
576 }
577
578 void
579 _TabBar::OnBoundsChanged(void)
580 {
581         __pTabBarPresenter->OnBoundsChanged();
582 }
583
584 bool
585 _TabBar::OnKeyPressed(const _Control& source, const _KeyInfo& keyInfo)
586 {
587         if (this != &source)
588         {
589                 return false;
590         }
591         _KeyCode keyCode = keyInfo.GetKeyCode();
592         int itemCount = __pTabBarPresenter->GetItemCount();
593         if (itemCount == 0 || __isInFocusMode == false)
594         {
595                 return false;
596         }
597
598         if (keyCode == _KEY_RIGHT)
599         {
600                 if (__currentPressedItemIndex < (itemCount - 1))
601                 {
602                         if (__pTabBarPresenter->GetItemStatus(__currentPressedItemIndex) != ITEM_STATUS_SELECTED)
603                         {
604                                 __pTabBarPresenter->SetItemStatus(__currentPressedItemIndex, ITEM_STATUS_NORMAL);
605                         }
606
607                         __currentPressedItemIndex++;
608
609                         if (__pTabBarPresenter->GetItemStatus(__currentPressedItemIndex) != ITEM_STATUS_SELECTED)
610                         {
611                                 __pTabBarPresenter->SetItemStatus(__currentPressedItemIndex, ITEM_STATUS_PRESSED);
612                         }
613                         __pTabBarPresenter->ShiftToFocusedItem(__currentPressedItemIndex, _FOCUS_DIRECTION_MOVE_RIGHT);
614                 }
615                 return true;
616         }
617         else if (keyCode == _KEY_LEFT)
618         {
619                 if (__currentPressedItemIndex >= -1)
620                 {
621                         if (__pTabBarPresenter->GetItemStatus(__currentPressedItemIndex) != ITEM_STATUS_SELECTED)
622                         {
623                                 __pTabBarPresenter->SetItemStatus(__currentPressedItemIndex, ITEM_STATUS_NORMAL);
624                         }
625                         if (__currentPressedItemIndex == -1)
626                         {
627                                 __currentPressedItemIndex = 0;
628                         }
629                         if (__currentPressedItemIndex > 0)
630                         {
631                                 __currentPressedItemIndex--;
632                         }
633                         if (__pTabBarPresenter->GetItemStatus(__currentPressedItemIndex) != ITEM_STATUS_SELECTED)
634                         {
635                                 __pTabBarPresenter->SetItemStatus(__currentPressedItemIndex, ITEM_STATUS_PRESSED);
636                         }
637                         __pTabBarPresenter->ShiftToFocusedItem(__currentPressedItemIndex, _FOCUS_DIRECTION_MOVE_LEFT);
638                 }
639                 return true;
640         }
641         else if (keyCode == _KEY_ENTER && __currentPressedItemIndex != -1)
642         {
643                 __pTabBarPresenter->SetItemStatus(__currentPressedItemIndex, ITEM_STATUS_SELECTED);
644                 __pTabBarPresenter->SetItemSelected(__currentPressedItemIndex);
645
646                 _TabBarItem* pItem = __pTabBarPresenter->GetItemAt(__currentPressedItemIndex);
647                 if (pItem != null)
648                 {
649                         if (__pActionEvent)
650                         {
651                                 IEventArg* pEventArg = _ActionEvent::CreateActionEventArgN(pItem->GetActionId());
652                                 SysTryReturn(NID_UI_CTRL, pEventArg != null, E_INVALID_STATE, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
653
654                                 PLAY_FEEDBACK(_RESOURCE_FEEDBACK_PATTERN_TAP, this);
655                                 __pActionEvent->Fire(*pEventArg);
656                         }
657                 }
658
659                 Invalidate();
660                 return true;
661         }
662         else if (keyCode == _KEY_DOWN || keyCode == _KEY_UP || keyCode == _KEY_TAB)
663         {
664                 if (__pTabBarPresenter->GetItemStatus(__currentPressedItemIndex) == ITEM_STATUS_PRESSED)
665                 {
666                         __pTabBarPresenter->SetItemStatus(__currentPressedItemIndex, ITEM_STATUS_NORMAL);
667                 }
668                 Invalidate();
669         }
670
671         return false;
672 }
673
674 bool
675 _TabBar::OnKeyReleased(const _Control& source, const _KeyInfo& keyInfo)
676 {
677         return false;
678 }
679
680 void
681 _TabBar::OnDrawFocus(void)
682 {
683         if (__pTabBarPresenter->GetItemCount() > 0)
684         {
685                 __currentPressedItemIndex = 0;
686         }
687         else
688         {
689                 __currentPressedItemIndex = -1;
690         }
691
692         if (__pTabBarPresenter->GetItemStatus(__currentPressedItemIndex) != ITEM_STATUS_SELECTED)
693         {
694                 __pTabBarPresenter->SetItemStatus(__currentPressedItemIndex, ITEM_STATUS_PRESSED);
695         }
696
697         __pTabBarPresenter->ShiftToFocusedItem(__currentPressedItemIndex, _FOCUS_DIRECTION_MOVE_LEFT);
698         __isInFocusMode = true;
699
700         return;
701 }
702
703 void
704 _TabBar::OnFocusModeStateChanged(void)
705 {
706         if (__pTabBarPresenter->GetItemStatus(__currentPressedItemIndex) == ITEM_STATUS_PRESSED)
707         {
708                 __pTabBarPresenter->SetItemStatus(__currentPressedItemIndex, ITEM_STATUS_NORMAL);
709         }
710
711         __currentPressedItemIndex = -1;
712         __isInFocusMode = false;
713
714         Invalidate();
715 }
716
717 _AccessibilityElement*
718 _TabBar::GetAccessibilityElement(const int mainIndex) const
719 {
720         _AccessibilityElement* pElement = null;
721         result r = __accessibilityElements.GetAt(mainIndex, pElement);
722         SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Failed at AccessibiltyElement.", GetErrorMessage(r));
723
724         return pElement;
725
726 CATCH:
727         delete pElement;
728
729         return null;
730 }
731
732 void
733 _TabBar::AddAccessibilityElement(const _AccessibilityElement& element)
734 {
735         __accessibilityElements.Add(const_cast<_AccessibilityElement*>(&element));
736 }
737
738 void
739 _TabBar::SetAllAccessibilityElement(void)
740 {
741         __pTabBarPresenter->SetAllAccessibilityElement();
742 }
743
744 void
745 _TabBar::RemoveAllAccessibilityElement(void)
746 {
747         while (__accessibilityElements.GetCount() > 0)
748         {
749                 _AccessibilityElement* pElement = null;
750                 if (__accessibilityElements.GetAt(0, pElement) == E_SUCCESS)
751                 {
752                         pElement->GetParent()->RemoveElement(*pElement);
753                         __accessibilityElements.RemoveAt(0);
754                 }
755         }
756 }
757
758 bool
759 _TabBar::OnAccessibilityFocusMovedNext(const _AccessibilityContainer& control, const _AccessibilityElement& element)
760 {
761         return __pTabBarPresenter->OnAccessibilityFocusMovedNext(control, element);
762 }
763
764 bool
765 _TabBar::OnAccessibilityFocusMovedPrevious(const _AccessibilityContainer& control, const _AccessibilityElement& element)
766 {
767         return __pTabBarPresenter->OnAccessibilityFocusMovedPrevious(control, element);
768 }
769
770 bool
771 _TabBar::OnAccessibilityReadElement(const _AccessibilityContainer& control, const _AccessibilityElement& element)
772 {
773         return __pTabBarPresenter->OnAccessibilityReadElement(control, element);
774 }
775
776 bool
777 _TabBar::OnAccessibilityReadingElement(const _AccessibilityContainer& control, const _AccessibilityElement& element)
778 {
779         return __pTabBarPresenter->OnAccessibilityReadingElement(control, element);
780 }
781
782 bool
783 _TabBar::OnAccessibilityFocusIn(const _AccessibilityContainer& control, const _AccessibilityElement& element)
784 {
785         return __pTabBarPresenter->OnAccessibilityFocusIn(control, element);
786 }
787
788 bool
789 _TabBar::OnAccessibilityFocusOut(const _AccessibilityContainer& control, const _AccessibilityElement& element)
790 {
791         return __pTabBarPresenter->OnAccessibilityFocusOut(control, element);
792 }
793
794 bool
795 _TabBar::OnAccessibilityActionPerformed(const _AccessibilityContainer& control, const _AccessibilityElement& element)
796 {
797         return __pTabBarPresenter->OnAccessibilityActionPerformed(control, element);
798 }
799
800 bool
801 _TabBar::OnAccessibilityValueIncreased(const _AccessibilityContainer& control, const _AccessibilityElement& element)
802 {
803         return __pTabBarPresenter->OnAccessibilityValueIncreased(control, element);
804 }
805
806 bool
807 _TabBar::OnAccessibilityValueDecreased(const _AccessibilityContainer& control, const _AccessibilityElement& element)
808 {
809         return __pTabBarPresenter->OnAccessibilityValueDecreased(control, element);
810 }
811
812 bool
813 _TabBar::OnAccessibilityItemRefreshed(const _AccessibilityContainer& control, const _AccessibilityElement& element, _AccessibilityFocusDirection direction)
814 {
815         return __pTabBarPresenter->OnAccessibilityItemRefreshed(control, element, direction);
816 }
817
818 }}} // Tizen::Ui::Controls