Changed indicator bg color.
[platform/framework/native/uifw.git] / src / ui / controls / FUiCtrl_TabBarPresenter.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_TabBarPresenter.cpp
19  * @brief               This is the implementation file for the _TabBarPresenter class.
20  */
21
22
23 #include <FBaseErrorDefine.h>
24 #include <FBaseSysLog.h>
25 #include <FGrp_BitmapImpl.h>
26 #include <FGrp_CanvasImpl.h>
27 #include <FGrp_TextTextSimple.h>
28 #include "FUi_AccessibilityContainer.h"
29 #include "FUi_AccessibilityElement.h"
30 #include "FUi_CoordinateSystemUtils.h"
31 #include "FUi_Math.h"
32 #include "FUi_ResourceManager.h"
33 #include "FUi_UiTouchEvent.h"
34
35 #include "FUiCtrl_TabBarPresenter.h"
36
37
38 using namespace Tizen::Ui;
39 using namespace Tizen::Base;
40 using namespace Tizen::Graphics;
41 using namespace Tizen::Graphics::_Text;
42
43 namespace Tizen { namespace Ui { namespace Controls
44 {
45
46 _TabBarPresenter::_TabBarPresenter(_TabBar& tabBar)
47         : __tabBar(tabBar)
48         , __pTabBarModel(null)
49         , __pFont(null)
50         , __pTextObject(null)
51         , __startPosition(FloatPoint(0.0f, 0.0f))
52         , __pressedItemIndex(-1)
53         , __touchMoved(false)
54         , __touchBubblingBlocked(true)
55         , __topMargin(0.0f)
56         , __sideMargin(0.0f)
57         , __itemMargin(0.0f)
58         , __arrowMargin(0.0f)
59         , __itemMaxWidth(0.0f)
60         , __pBgBitmapCached(null)
61         , __pBgEffectBitmapCached(null)
62         , __pLeftArrowBitmapCached(null)
63         , __pRightArrowBitmapCached(null)
64 {
65         for (int i = 0; i < ITEM_STATUS_MAX; i++)
66         {
67                 __pItemBgBitmapCached[i] = null;
68         }
69
70         GET_SHAPE_CONFIG(TABBAR::TOP_MARGIN,     _CONTROL_ORIENTATION_PORTRAIT, __topMargin);
71         GET_SHAPE_CONFIG(TABBAR::SIDE_MARGIN,    _CONTROL_ORIENTATION_PORTRAIT, __sideMargin);
72         GET_SHAPE_CONFIG(TABBAR::ITEM_MARGIN,    _CONTROL_ORIENTATION_PORTRAIT, __itemMargin);
73         GET_SHAPE_CONFIG(TABBAR::ARROW_MARGIN,   _CONTROL_ORIENTATION_PORTRAIT, __arrowMargin);
74         GET_SHAPE_CONFIG(TABBAR::ITEM_MAX_WIDTH, _CONTROL_ORIENTATION_PORTRAIT, __itemMaxWidth);
75 }
76
77 _TabBarPresenter::~_TabBarPresenter(void)
78 {
79         delete __pTabBarModel;
80         __pTabBarModel = null;
81
82         if (__pTextObject)
83         {
84                 __pTextObject->RemoveAll();
85                 delete __pTextObject;
86                 __pTextObject = null;
87         }
88
89         delete __pBgBitmapCached;
90         __pBgBitmapCached = null;
91
92         delete __pBgEffectBitmapCached;
93         __pBgEffectBitmapCached = null;
94
95         for (int i = 0; i < ITEM_STATUS_MAX; i++)
96         {
97                 delete __pItemBgBitmapCached[i];
98                 __pItemBgBitmapCached[i] = null;
99         }
100
101         delete __pLeftArrowBitmapCached;
102         __pLeftArrowBitmapCached = null;
103
104         delete __pRightArrowBitmapCached;
105         __pRightArrowBitmapCached = null;
106 }
107
108 result
109 _TabBarPresenter::Construct(void)
110 {
111         __pTabBarModel = new (std::nothrow) _TabBarModel;
112         SysTryReturn(NID_UI_CTRL, __pTabBarModel != null, E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
113
114         result r = E_SUCCESS;
115
116         r = LoadBitmap();
117         SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
118
119         return r;
120
121 CATCH:
122         delete __pTabBarModel;
123         __pTabBarModel = null;
124
125         return r;
126 }
127
128 result
129 _TabBarPresenter::InitializeFont(void)
130 {
131         result r = E_SUCCESS;
132         __pFont = __tabBar.GetFallbackFont();
133         SysTryCatch(NID_UI_CTRL, __pFont != null, r = E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
134
135         __pTextObject = new (std::nothrow) TextObject();
136         SysTryCatch(NID_UI_CTRL, __pTextObject != null, r = E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
137
138         __pTextObject->Construct();
139         __pTextObject->SetAlignment(TEXT_OBJECT_ALIGNMENT_CENTER | TEXT_OBJECT_ALIGNMENT_MIDDLE);
140         __pTextObject->SetFont(__pFont, 0, __pTextObject->GetTextLength());
141
142         return E_SUCCESS;
143
144 CATCH:
145         delete __pTextObject;
146         __pTextObject = null;
147
148         return r;
149 }
150
151 void
152 _TabBarPresenter::OnFontChanged(Font* pFont)
153 {
154         __pFont = pFont;
155 }
156
157 void
158 _TabBarPresenter::OnFontInfoRequested(unsigned long& style, float& size)
159 {
160         float fontSize = 0.0f;
161         GET_SHAPE_CONFIG(TABBAR::FONT_SIZE, __tabBar.GetOrientation(), fontSize);
162
163         style = FONT_STYLE_PLAIN;
164         size = fontSize;
165 }
166
167 result
168 _TabBarPresenter::LoadBitmap(void)
169 {
170         Bitmap* pBitmap = null;
171
172         Color arrowColor;
173         GET_COLOR_CONFIG(TABBAR::ARROW_BG_NORMAL, arrowColor);
174
175         if (__pBgBitmapCached != null)
176         {
177                 delete __pBgBitmapCached;
178                 __pBgBitmapCached = null;
179         }
180
181         if (__pBgEffectBitmapCached != null)
182         {
183                 delete __pBgEffectBitmapCached;
184                 __pBgEffectBitmapCached = null;
185         }
186
187         if (__pLeftArrowBitmapCached != null)
188         {
189                 delete __pLeftArrowBitmapCached;
190                 __pLeftArrowBitmapCached = null;
191         }
192
193         if (__pRightArrowBitmapCached == null)
194         {
195                 delete __pRightArrowBitmapCached;
196                 __pRightArrowBitmapCached = null;
197         }
198
199         for (int i = 0; i < ITEM_STATUS_MAX; i++)
200         {
201                 if (__pItemBgBitmapCached[i] != null)
202                 {
203                         delete __pItemBgBitmapCached[i];
204                         __pItemBgBitmapCached[i] = null;
205                 }
206         }
207
208         result r;
209         r = GET_BITMAP_CONFIG_N(TABBAR::BG_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, pBitmap);
210         SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r));
211         __pBgBitmapCached = _BitmapImpl::GetColorReplacedBitmapN(*pBitmap, Color::GetColor(COLOR_ID_MAGENTA), __tabBar.GetColor());
212         delete pBitmap;
213         pBitmap = null;
214
215         r = GET_BITMAP_CONFIG_N(TABBAR::BG_OUTLINE_EFFECT_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, __pBgEffectBitmapCached);
216         SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r));
217
218         r = GET_BITMAP_CONFIG_N(TABBAR::LEFT_ARROW_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, pBitmap);
219         __pLeftArrowBitmapCached = _BitmapImpl::GetColorReplacedBitmapN(*pBitmap, Color::GetColor(COLOR_ID_MAGENTA), arrowColor);
220         SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r));
221         delete pBitmap;
222         pBitmap = null;
223
224         r = GET_BITMAP_CONFIG_N(TABBAR::RIGHT_ARROW_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, pBitmap);
225         __pRightArrowBitmapCached = _BitmapImpl::GetColorReplacedBitmapN(*pBitmap, Color::GetColor(COLOR_ID_MAGENTA), arrowColor);
226         SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r));
227         delete pBitmap;
228         pBitmap = null;
229
230         r = GET_BITMAP_CONFIG_N(TABBAR::ITEM_BG_SELECTED, BITMAP_PIXEL_FORMAT_ARGB8888, pBitmap);
231         __pItemBgBitmapCached[ITEM_STATUS_SELECTED] = _BitmapImpl::GetColorReplacedBitmapN(*pBitmap, Color::GetColor(COLOR_ID_MAGENTA), __tabBar.GetItemColor(ITEM_STATUS_SELECTED));
232         SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r));
233         delete pBitmap;
234         pBitmap = null;
235
236         r = GET_BITMAP_CONFIG_N(TABBAR::ITEM_BG_PRESSED, BITMAP_PIXEL_FORMAT_ARGB8888, pBitmap);
237         __pItemBgBitmapCached[ITEM_STATUS_PRESSED] = _BitmapImpl::GetColorReplacedBitmapN(*pBitmap, Color::GetColor(COLOR_ID_MAGENTA), __tabBar.GetItemColor(ITEM_STATUS_PRESSED));
238         SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r));
239         delete pBitmap;
240         pBitmap = null;
241
242         r = GET_BITMAP_CONFIG_N(TABBAR::ITEM_BG_DISABLED, BITMAP_PIXEL_FORMAT_ARGB8888, pBitmap);
243         __pItemBgBitmapCached[ITEM_STATUS_DISABLED] = _BitmapImpl::GetColorReplacedBitmapN(*pBitmap, Color::GetColor(COLOR_ID_MAGENTA), __tabBar.GetItemColor(ITEM_STATUS_DISABLED));
244         SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r));
245         delete pBitmap;
246         pBitmap = null;
247
248         return E_SUCCESS;
249
250 CATCH:
251         delete pBitmap;
252
253         delete __pBgBitmapCached;
254         __pBgBitmapCached = null;
255
256         delete __pLeftArrowBitmapCached;
257         __pLeftArrowBitmapCached = null;
258
259         delete __pRightArrowBitmapCached;
260         __pRightArrowBitmapCached = null;
261
262         for (int i = 0; i < ITEM_STATUS_MAX; i++)
263         {
264                 delete __pItemBgBitmapCached[i];
265                 __pItemBgBitmapCached[i] = null;
266         }
267
268         return E_OUT_OF_MEMORY;
269 }
270
271 result
272 _TabBarPresenter::AddItem(const Tizen::Base::String& text, int actionId)
273 {
274         return __pTabBarModel->AddItem(text, actionId, _CONTROL_ORIENTATION_PORTRAIT);
275 }
276
277 result
278 _TabBarPresenter::InsertItemAt(int index, const Tizen::Base::String& text, int actionId)
279 {
280         if (index <= __pTabBarModel->GetSelectedItemIndex())
281         {
282                 if (__pTabBarModel->GetItemCount() != 0)
283                 {
284                         __pTabBarModel->SetSelectedItemIndex(GetSelectedItemIndex() + 1);
285                 }
286         }
287
288         result r = __pTabBarModel->InsertItemAt(index, text, actionId, _CONTROL_ORIENTATION_PORTRAIT);
289         SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
290
291         return E_SUCCESS;
292 }
293
294 result
295 _TabBarPresenter::SetItemAt(int index, const Tizen::Base::String& text, int actionId)
296 {
297         return __pTabBarModel->SetItemAt(index, text, actionId, _CONTROL_ORIENTATION_PORTRAIT);
298 }
299
300 _TabBarItem*
301 _TabBarPresenter::GetItemAt(int index) const
302 {
303         _TabBarItem* pItem = __pTabBarModel->GetItemAt(index);
304         return pItem;
305 }
306
307 result
308 _TabBarPresenter::RemoveItemAt(int index)
309 {
310         if (index <= GetSelectedItemIndex())
311         {
312                 if (__pTabBarModel->GetItemCount() != 0 && GetSelectedItemIndex() != 0)
313                 {
314                         __pTabBarModel->SetSelectedItemIndex(GetSelectedItemIndex() - 1);
315                 }
316         }
317
318         result r = __pTabBarModel->RemoveItemAt(index, _CONTROL_ORIENTATION_PORTRAIT);
319         SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
320
321         if (GetItemCount() != 0)
322         {
323                 r = SetItemSelected(0);
324                 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
325         }
326         else
327         {
328                 __pTabBarModel->SetSelectedItemIndex(0);
329         }
330
331         return E_SUCCESS;
332 }
333
334 result
335 _TabBarPresenter::RemoveAllItems(void)
336 {
337         __pTabBarModel->RemoveAllItems();
338         return E_SUCCESS;
339 }
340
341 result
342 _TabBarPresenter::SetItemSelected(int index)
343 {
344
345         SysTryReturn(NID_UI_CTRL, index >= 0 && index < GetItemCount(), E_OUT_OF_RANGE, E_OUT_OF_RANGE, "[E_OUT_OF_RANGE] The argument is out of range.");
346
347         int oldSelectedItemIndex = GetSelectedItemIndex();
348         if (index == oldSelectedItemIndex)
349         {
350                 return E_SUCCESS;
351         }
352         _TabBarItem* pItem = GetItemAt(oldSelectedItemIndex);
353         result r = GetLastResult();
354         SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
355         pItem->SetStatus(ITEM_STATUS_NORMAL);
356         _AccessibilityElement* pElement = pItem->GetAccessibilityElement();
357         if(pElement != null)
358         {
359                 pElement->SetStatus(L"");
360                 pElement->SetHintDisabled(false);
361         }
362
363         pItem = GetItemAt(index);
364         r = GetLastResult();
365         SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
366         pItem->SetStatus(ITEM_STATUS_SELECTED);
367         pElement = pItem->GetAccessibilityElement();
368         if(pElement != null)
369         {
370                 pElement->SetStatusWithStringId("IDS_TPLATFORM_BODY_SELECTED_T_TTS");
371                 pElement->SetHintDisabled(true);
372         }
373
374         __pTabBarModel->SetSelectedItemIndex(index);
375
376         return E_SUCCESS;
377 }
378
379 int
380 _TabBarPresenter::GetSelectedItemIndex(void) const
381 {
382         return __pTabBarModel->GetSelectedItemIndex();
383 }
384
385 int
386 _TabBarPresenter::GetItemCount(void) const
387 {
388         return __pTabBarModel->GetItemCount();
389 }
390
391 int
392 _TabBarPresenter::GetItemIndexFromPosition(const Tizen::Graphics::FloatPoint& point) const
393 {
394         FloatRectangle clientBounds = __tabBar.GetBoundsF();
395
396         if (point.x < __sideMargin
397                 || point.x > clientBounds.width - __sideMargin
398                 || point.y < __topMargin
399                 || point.y > clientBounds.height - __topMargin)
400         {
401                 return -1;
402         }
403
404         int itemIndex = __pTabBarModel->GetFirstDrawnItemIndex();
405         _TabBarItem* pItem = __pTabBarModel->GetItemAt(itemIndex);
406
407         while (pItem != null)
408         {
409                 FloatRectangle itemBounds = pItem->GetBounds();
410
411                 if (point.x - __sideMargin > itemBounds.x
412                         && point.x - __sideMargin < itemBounds.x + itemBounds.width
413                         && point.y - __topMargin > itemBounds.y
414                         && point.y - __topMargin < itemBounds.y + itemBounds.height)
415                 {
416                         return itemIndex;
417                 }
418                 itemIndex++;
419                 pItem = __pTabBarModel->GetItemAt(itemIndex);
420         }
421
422         return -1;
423 }
424
425 int
426 _TabBarPresenter::GetItemIndexFromAbsPosition(const Tizen::Graphics::FloatPoint& point) const
427 {
428         FloatRectangle clientBounds = __tabBar.GetBoundsF();
429
430         int itemIndex = 0;
431         _TabBarItem* pItem = __pTabBarModel->GetItemAt(itemIndex);
432
433         while (pItem != null)
434         {
435                 FloatRectangle itemBounds = pItem->GetBounds();
436
437                 if (point.x - __sideMargin > itemBounds.x
438                         && point.x - __sideMargin < itemBounds.x + itemBounds.width
439                         && point.y - __topMargin > itemBounds.y
440                         && point.y - __topMargin < itemBounds.y + itemBounds.height)
441                 {
442                         return itemIndex;
443                 }
444                 itemIndex++;
445                 pItem = __pTabBarModel->GetItemAt(itemIndex);
446         }
447
448         return -1;
449 }
450
451 _TabBarItem*
452 _TabBarPresenter::GetItemFromPosition(const Tizen::Graphics::FloatPoint& position) const
453 {
454         SetLastResult(E_SUCCESS);
455         int index = GetItemIndexFromPosition(position);
456         SysTryReturn(NID_UI_CTRL, index != -1, null, E_SYSTEM, "[E_SYSTEM] Item not found.");
457
458         return __pTabBarModel->GetItemAt(index);
459 }
460
461 result
462 _TabBarPresenter::SetTopDrawnItemIndex(int index)
463 {
464         SysTryReturn(NID_UI_CTRL, index >= 0 && index < GetItemCount(),
465                         E_OUT_OF_RANGE, E_OUT_OF_RANGE, "[E_OUT_OF_RANGE] The argument(%d) is out of range.", index);
466
467         _TabBarItem* pTopItem = GetItemAt(index);
468         result r = GetLastResult();
469         SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
470
471         float distance = pTopItem->GetBounds().x;
472
473         _TabBarItem* pLastItem = GetItemAt(GetItemCount() - 1);
474         SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
475
476         FloatRectangle clientBounds = __tabBar.GetBoundsF();
477         float movableDistance = (pLastItem->GetBounds().x + pLastItem->GetBounds().width) - (clientBounds.width - __sideMargin * 2.0f - __arrowMargin * 2.0f);
478         if (movableDistance < distance)
479         {
480                 distance = movableDistance;
481         }
482
483         r = AdjustItemPositionX(-distance);
484         SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
485
486         return E_SUCCESS;
487 }
488
489 result
490 _TabBarPresenter::SetItemStatus(int index, _TabBarItemStatus status)
491 {
492         _TabBarItem* pItem = __pTabBarModel->GetItemAt(index);
493         SysTryReturn(NID_UI_CTRL, pItem, E_SYSTEM, E_SYSTEM, "[E_SYSTEM] Item(%d) not exists.", index);
494
495         pItem->SetStatus(status);
496
497         return E_SUCCESS;
498 }
499
500 _TabBarItemStatus
501 _TabBarPresenter::GetItemStatus(int index) const
502 {
503         _TabBarItem* pItem = __pTabBarModel->GetItemAt(index);
504         SysTryReturn(NID_UI_CTRL, pItem, ITEM_STATUS_NORMAL, E_SYSTEM, "[E_SYSTEM] Item(%d) not exists.", index);
505
506         _TabBarItemStatus status = pItem->GetStatus();
507
508         return status;
509 }
510
511 result
512 _TabBarPresenter::AdjustItemPositionX(float distance)
513 {
514         int index = 0;
515
516         while (index < GetItemCount())
517         {
518                 _TabBarItem* pItem = __pTabBarModel->GetItemAt(index);
519                 SysTryReturn(NID_UI_CTRL, pItem, E_INVALID_STATE, E_INVALID_STATE, "[E_INVALID_STATE] Item(%d) not exists.", index);
520                 FloatRectangle bounds = pItem->GetBounds();
521                 bounds.x += distance;
522                 pItem->SetBounds(bounds);
523                 index++;
524         }
525
526         SetAllAccessibilityElement();
527
528         return E_SUCCESS;
529 }
530
531 result
532 _TabBarPresenter::SetReplacementColor(const Tizen::Graphics::Color& color)
533 {
534         Bitmap* pBitmap = null;
535         Bitmap* pColorReplcedBitmap = null;
536
537         result r;
538         r = GET_BITMAP_CONFIG_N(TABBAR::BG_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, pBitmap);
539         SysTryReturn(NID_UI_CTRL, pBitmap != null, E_SYSTEM, E_SYSTEM, "[E_SYSTEM] Image loading fail.");
540
541         pColorReplcedBitmap = _BitmapImpl::GetColorReplacedBitmapN(*pBitmap, Color::GetColor(COLOR_ID_MAGENTA), color);
542         delete pBitmap;
543
544         if (__pBgBitmapCached != null)
545         {
546                 delete __pBgBitmapCached;
547         }
548         __pBgBitmapCached = pColorReplcedBitmap;
549
550         return E_SUCCESS;
551 }
552
553 result
554 _TabBarPresenter::SetItemReplacementColor(_TabBarItemStatus itemStatus, const Tizen::Graphics::Color& color)
555 {
556         Bitmap* pBitmap = null;
557         Bitmap* pColorReplcedBitmap = null;
558
559         result r;
560         if (itemStatus == ITEM_STATUS_SELECTED)
561         {
562                 r = GET_BITMAP_CONFIG_N(TABBAR::ITEM_BG_SELECTED, BITMAP_PIXEL_FORMAT_ARGB8888, pBitmap);
563                 SysTryReturn(NID_UI_CTRL, pBitmap != null, E_SYSTEM, E_SYSTEM, "[E_SYSTEM] Image loading fail.");
564         }
565         else if (itemStatus == ITEM_STATUS_PRESSED)
566         {
567                 r = GET_BITMAP_CONFIG_N(TABBAR::ITEM_BG_PRESSED, BITMAP_PIXEL_FORMAT_ARGB8888, pBitmap);
568                 SysTryReturn(NID_UI_CTRL, pBitmap != null, E_SYSTEM, E_SYSTEM, "[E_SYSTEM] Image loading fail.");
569         }
570         else
571         {
572                 return E_SUCCESS;
573         }
574
575         pColorReplcedBitmap = _BitmapImpl::GetColorReplacedBitmapN(*pBitmap, Color::GetColor(COLOR_ID_MAGENTA), color);
576         delete pBitmap;
577
578         if (__pItemBgBitmapCached[itemStatus] != null)
579         {
580                 delete __pItemBgBitmapCached[itemStatus];
581         }
582         __pItemBgBitmapCached[itemStatus] = pColorReplcedBitmap;
583
584         return E_SUCCESS;
585 }
586
587 void
588 _TabBarPresenter::Draw(void)
589 {
590         Canvas* pCanvas = __tabBar.GetCanvasN();
591         SysTryReturnVoidResult(NID_UI_CTRL, pCanvas != null, E_SYSTEM, "[E_SYSTEM] It can not get canvas.");
592
593         FloatRectangle clientBounds = __tabBar.GetBoundsF();
594
595         pCanvas->Clear();
596         DrawBackground(pCanvas);
597         DrawArrow(pCanvas);
598         delete pCanvas;
599
600         FloatRectangle rect(__sideMargin, 0.0f, clientBounds.width - __sideMargin * 2.0f, clientBounds.height);
601         Canvas* pSubCanvas = __tabBar.GetCanvasN(rect);
602
603         if (pSubCanvas != null)
604         {
605                 DrawItem(pSubCanvas);
606                 delete pSubCanvas;
607         }
608 }
609
610 result
611 _TabBarPresenter::ShiftToFocusedItem(int itemIndex, _FocusDirectionMove direction)
612 {
613         int firstDrawnItemIndex = __pTabBarModel->GetFirstDrawnItemIndex();
614         int lastDrawnItemIndex  = __pTabBarModel->GetLastDrawnItemIndex();
615         int index = 0;
616         result r = E_SUCCESS;
617
618         if (direction == _FOCUS_DIRECTION_MOVE_LEFT)
619         {
620                 index = itemIndex - 1;
621         }
622         else if (direction == _FOCUS_DIRECTION_MOVE_RIGHT)
623         {
624                 index = itemIndex + 1;
625         }
626
627         _TabBarItem* pItem = GetItemAt(itemIndex);
628         SysTryReturn(NID_UI_CTRL, pItem != null, E_SYSTEM, E_SYSTEM, "[E_SYSTEM] Item loading fail.");
629
630         FloatRectangle itemBounds = pItem->GetBounds();
631         FloatRectangle clientBounds = __tabBar.GetBoundsF();
632         if (itemBounds.x < 0.0f || clientBounds.width - __sideMargin * 2.0f < itemBounds.x + (itemBounds.width))
633         {
634                 if(index <= firstDrawnItemIndex)
635                 {
636                         r = SetTopDrawnItemIndex(itemIndex);
637                 }
638                 else
639                 {
640                         r = SetTopDrawnItemIndex(firstDrawnItemIndex + 1);
641
642                         pItem = GetItemAt(itemIndex);
643                         SysTryReturn(NID_UI_CTRL, pItem != null, E_SYSTEM, E_SYSTEM, "[E_SYSTEM] Item loading fail.");
644
645                         itemBounds = pItem->GetBounds();
646                         AdjustItemPositionX((clientBounds.width - (__sideMargin * 2.0f)) - (itemBounds.x + itemBounds.width));
647                 }
648
649                 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
650         }
651
652         if(itemIndex == 0)              //when touchedCOM
653         {
654                 SetItemSelected(0);
655         }
656
657         __tabBar.Invalidate();
658
659         return r;
660 }
661
662 void
663 _TabBarPresenter::ResetItemPositionX(void)
664 {
665         int itemCount = GetItemCount();
666         if (itemCount < 1)
667         {
668                 return;
669         }
670
671         _TabBarItem* pFirstItem = __pTabBarModel->GetItemAt(0);
672         _TabBarItem* pLastItem  = __pTabBarModel->GetItemAt(itemCount - 1);
673         SysTryReturnVoidResult(NID_UI_CTRL, pFirstItem != null && pLastItem != null, E_SYSTEM, "[E_SYSTEM] Item not found.");
674
675         FloatRectangle clientBounds    = __tabBar.GetBoundsF();
676         FloatRectangle firstItemBounds = pFirstItem->GetBounds();
677         FloatRectangle lastItemBounds  = pLastItem->GetBounds();
678
679         if (!_FloatCompare(firstItemBounds.x, 0.0f) && lastItemBounds.x + lastItemBounds.width - firstItemBounds.x < clientBounds.width - __sideMargin * 2.0f)
680         {
681                 AdjustItemPositionX(-firstItemBounds.x);
682         }
683         else if (!_FloatCompare(firstItemBounds.x, 0.0f) && lastItemBounds.x + lastItemBounds.width < clientBounds.width - __sideMargin * 2.0f)
684         {
685                 AdjustItemPositionX(clientBounds.width - (__sideMargin + __arrowMargin) * 2.0f - (lastItemBounds.x + lastItemBounds.width));
686         }
687 }
688
689 void
690 _TabBarPresenter::OnBoundsChanged(void)
691 {
692         return ResetItemPositionX();
693 }
694
695 void
696 _TabBarPresenter::DrawItem(Tizen::Graphics::Canvas* pCanvas)
697 {
698         SysTryReturnVoidResult(NID_UI_CTRL, __pTextObject != null, E_INVALID_STATE, "[E_INVALID_STATE] TextObject is not constructed.");
699
700         FloatRectangle clientBounds = pCanvas->GetBoundsF();
701
702         _TabBarItem* pDrawItem = null;
703         FloatRectangle itemBounds(0.0f, 0.0f, 0.0f, 0.0f);
704
705         String drawText(L"");
706         FloatRectangle textRect(0.0f, 0.0f, 0.0f, 0.0f);
707         TextSimple* pSimpleText = null;
708         Color textColor;
709
710         _TabBarItemStatus itemStatus = ITEM_STATUS_NORMAL;
711
712         __pTabBarModel->SetFirstDrawnItemIndex(-1);
713         __pTabBarModel->SetLastDrawnItemIndex(-1);
714         int itemCount = GetItemCount();
715         for (int i = 0; i < itemCount; i++)
716         {
717                 pDrawItem = __pTabBarModel->GetItemAt(i);
718                 if (pDrawItem == null)
719                 {
720                         break;
721                 }
722
723                 itemBounds = pDrawItem->GetBounds();
724
725                 if (itemBounds.x + itemBounds.width < 0.0f)
726                 {
727                         continue;
728                 }
729
730                 if (itemBounds.x > clientBounds.width)
731                 {
732                         break;
733                 }
734
735                 if (__pTabBarModel->GetFirstDrawnItemIndex() == -1)
736                 {
737                         __pTabBarModel->SetFirstDrawnItemIndex(i);
738                 }
739
740                 __pTabBarModel->SetLastDrawnItemIndex(i);
741
742                 itemStatus = pDrawItem->GetStatus();
743
744                 if (!__tabBar.IsEnabled())
745                 {
746                         textColor = __tabBar.GetItemTextColor(ITEM_STATUS_DISABLED);
747                         if (__pItemBgBitmapCached[ITEM_STATUS_DISABLED] != null)
748                         {
749                                 pCanvas->DrawNinePatchedBitmap(itemBounds, *__pItemBgBitmapCached[ITEM_STATUS_DISABLED]);
750                         }
751                 }
752                 else
753                 {
754                         textColor = __tabBar.GetItemTextColor(itemStatus);
755                         if (__pItemBgBitmapCached[itemStatus] != null)
756                         {
757                                 pCanvas->DrawNinePatchedBitmap(itemBounds, *__pItemBgBitmapCached[itemStatus]);
758                         }
759                 }
760
761                 // draw item text
762                 textRect = FloatRectangle(itemBounds.x, itemBounds.y, itemBounds.width, itemBounds.height);
763                 if (textRect.x < 0.0f)
764                 {
765                         textRect.width += textRect.x;
766                         textRect.x = 0.0f;
767                 }
768
769                 if (textRect.x + textRect.width > clientBounds.width)
770                 {
771                         textRect.width = clientBounds.width - textRect.x;
772                 }
773
774                 drawText = pDrawItem->GetText();
775                 __pTextObject->RemoveAll();
776                 pSimpleText = new (std::nothrow)TextSimple(const_cast <wchar_t*>(drawText.GetPointer()), drawText.GetLength());
777                 SysTryReturnVoidResult(NID_UI_CTRL, pSimpleText != null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] TextSimple is not constructed.");
778
779                 __pFont = __tabBar.GetFallbackFont();
780                 SysTryReturnVoidResult(NID_UI_CTRL, __pFont != null, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
781
782                 __pTextObject->AppendElement(*pSimpleText);
783
784                 __pTextObject->SetForegroundColor(textColor, 0, __pTextObject->GetTextLength());
785                 __pTextObject->SetBounds(textRect);
786                 __pTextObject->SetFont(__pFont, 0, __pTextObject->GetTextLength());
787                 __pTextObject->SetWrap(TEXT_OBJECT_WRAP_TYPE_NONE);
788                 if (itemBounds.width < __itemMaxWidth)
789                 {
790                         __pTextObject->SetAction(TEXT_OBJECT_ACTION_TYPE_NONE);
791                 }
792                 else
793                 {
794                         __pTextObject->SetAction(TEXT_OBJECT_ACTION_TYPE_ABBREV);
795                         __pTextObject->SetTextObjectEllipsisType(TEXT_OBJECT_ELLIPSIS_TYPE_TAIL);
796                 }
797                 __pTextObject->Draw(*_CanvasImpl::GetInstance(*pCanvas));
798         } // end for loop
799 }
800
801 void
802 _TabBarPresenter::DrawBackground(Tizen::Graphics::Canvas* pCanvas)
803 {
804         result r = E_SUCCESS;
805         FloatRectangle clientBounds = __tabBar.GetBoundsF();
806
807         if (__pBgBitmapCached != null)
808         {
809                 r = DrawBitmap(*pCanvas, FloatRectangle(0.0f, 0.0f, clientBounds.width, clientBounds.height), *__pBgBitmapCached);
810                 SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
811         }
812
813         bool isCustomBitmap = IS_CUSTOM_BITMAP(TABBAR::BG_NORMAL);
814         if (__pBgEffectBitmapCached != null && !isCustomBitmap)
815         {
816                 r = DrawBitmap(*pCanvas, FloatRectangle(0.0f, 0.0f, clientBounds.width, clientBounds.height), *__pBgEffectBitmapCached);
817                 SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
818         }
819 }
820
821 void
822 _TabBarPresenter::DrawArrow(Tizen::Graphics::Canvas* pCanvas)
823 {
824         FloatRectangle clientBounds = __tabBar.GetBoundsF();
825
826         _TabBarItem* pFirstItem = __pTabBarModel->GetItemAt(0);
827         if (pFirstItem == null)
828         {
829                 return;
830         }
831
832         FloatRectangle firstItemBounds = pFirstItem->GetBounds();
833         FloatRectangle drawRect(0.0f, 0.0f, 0.0f, 0.0f);
834         drawRect.width = __sideMargin;
835         drawRect.height = clientBounds.height;
836
837         // draw left arrow
838         if (firstItemBounds.x < 0.0f)
839         {
840                 drawRect.width = __pLeftArrowBitmapCached->GetWidth();
841                 drawRect.height = __pLeftArrowBitmapCached->GetHeight();
842                 drawRect.x = (__sideMargin - __pLeftArrowBitmapCached->GetWidth()) / 2.0f;
843                 drawRect.y = (clientBounds.height - __pLeftArrowBitmapCached->GetHeight()) / 2.0f;
844                 DrawBitmap(*pCanvas, drawRect, *__pLeftArrowBitmapCached);
845         }
846
847         int itemCount = __pTabBarModel->GetItemCount();
848         _TabBarItem* pLastItem = __pTabBarModel->GetItemAt(itemCount - 1);
849         if (pLastItem == null)
850         {
851                 return;
852         }
853
854         FloatRectangle lastItemBounds = pLastItem->GetBounds();
855
856         drawRect.SetBounds(0.0f, 0.0f, 0.0f, 0.0f);
857         drawRect.x = clientBounds.width - __sideMargin;
858         drawRect.width = __sideMargin;
859         drawRect.height = clientBounds.height;
860
861         // draw right arrow
862         if (lastItemBounds.x + lastItemBounds.width > clientBounds.width - __sideMargin * 2.0f)
863         {
864                 drawRect.x += (__sideMargin - __pRightArrowBitmapCached->GetWidth()) / 2.0f;
865                 drawRect.y = (clientBounds.height - __pRightArrowBitmapCached->GetHeight()) / 2.0f;
866                 drawRect.width = __pRightArrowBitmapCached->GetWidth();
867                 drawRect.height = __pRightArrowBitmapCached->GetHeight();
868                 DrawBitmap(*pCanvas, drawRect, *__pRightArrowBitmapCached);
869         }
870 }
871
872 bool
873 _TabBarPresenter::OnTouchPressed(const _Control& source, const _TouchInfo& touchinfo)
874 {
875         FloatPoint touchPosition = touchinfo.GetCurrentPosition();
876         __startPosition = touchPosition;
877         __touchBubblingBlocked = true;
878
879         int index = GetItemIndexFromPosition(touchPosition);
880         if (index == -1)
881         {
882                 return true;
883         }
884
885         __pressedItemIndex = index;
886         if (GetItemStatus(index) == ITEM_STATUS_SELECTED)
887         {
888                 return true;
889         }
890
891         result r = SetItemStatus(index, ITEM_STATUS_PRESSED);
892         SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, true, r, "[%s] propagating.", GetErrorMessage(r));
893
894         Draw();
895
896         return true;
897 }
898
899 bool
900 _TabBarPresenter::OnTouchReleased(const _Control& source, const _TouchInfo& touchinfo)
901 {
902         FloatPoint touchPosition = touchinfo.GetCurrentPosition();
903         int index = GetItemIndexFromPosition(touchPosition);
904         int selectedItemIndex = GetSelectedItemIndex();
905         bool eventFire = false;
906         result r = E_SUCCESS;
907
908         if (index != -1 && GetItemStatus(index) != ITEM_STATUS_NORMAL && __touchMoved == false)
909         {
910                 if (GetItemStatus(index) == ITEM_STATUS_PRESSED)
911                 {
912                         r = SetItemStatus(index, ITEM_STATUS_SELECTED);
913                         SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, false, r, "[%s] propagating.", GetErrorMessage(r));
914                         SetItemSelected(index);
915                         SetItemStatus(selectedItemIndex, ITEM_STATUS_NORMAL);
916                         eventFire = true;
917                 }
918         }
919
920         for (int i = 0; i < GetItemCount(); i++)
921         {
922                 if (GetItemStatus(i) == ITEM_STATUS_PRESSED)
923                 {
924                         r = SetItemStatus(i, ITEM_STATUS_NORMAL);
925                         SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, false, r, "[%s] propagating.", GetErrorMessage(r));
926                 }
927         }
928
929         __pressedItemIndex = -1;
930         __touchMoved = false;
931
932         Draw();
933
934         return eventFire;
935 }
936
937 bool
938 _TabBarPresenter::OnTouchCanceled(const _Control& source, const _TouchInfo& touchinfo)
939 {
940         result r = E_SUCCESS;
941
942         for (int i = 0; i < GetItemCount(); i++)
943         {
944                 if (GetItemStatus(i) == ITEM_STATUS_PRESSED)
945                 {
946                         r = SetItemStatus(i, ITEM_STATUS_NORMAL);
947                         SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, false, r, "[%s] propagating.", GetErrorMessage(r));
948                 }
949         }
950
951         __pressedItemIndex = -1;
952
953         Draw();
954
955         return true;
956 }
957
958 bool
959 _TabBarPresenter::OnTouchMoved(const _Control& source, const _TouchInfo& touchinfo)
960 {
961
962         if (&source != &__tabBar)
963         {
964                 return false;
965         }
966
967         FloatRectangle clientBounds = __tabBar.GetBoundsF();
968         if (__pTabBarModel->GetWidthOfAllItems() + (__sideMargin * 2.0f) <= clientBounds.width + __arrowMargin * 2.0f)
969         {
970                 return true;
971         }
972
973         FloatPoint touchPosition = touchinfo.GetCurrentPosition();
974
975         if (__touchMoved == false)
976         {
977                 float distanceX = _Abs((touchPosition).x - __startPosition.x);
978                 float distanceY = _Abs((touchPosition).y - __startPosition.y);
979
980                 if (distanceY > distanceX)
981                 {
982                         __touchBubblingBlocked = false;
983                 }
984         }
985
986         __touchMoved = true;
987
988         float distance = touchPosition.x - __startPosition.x;
989
990         __startPosition = touchPosition;
991         _TabBarItem* pItem = null;
992         FloatRectangle itemBounds;
993         int itemCount = GetItemCount();
994
995         if (distance > 0) // right move
996         {
997                 pItem = __pTabBarModel->GetItemAt(0);
998                 if (pItem == null)
999                 {
1000                         return true;
1001                 }
1002
1003                 itemBounds = pItem->GetBounds();
1004
1005                 if (itemBounds.x == __arrowMargin)
1006                 {
1007                         return true;
1008                 }
1009
1010                 if (itemBounds.x + distance >= __arrowMargin)
1011                 {
1012                         distance = __arrowMargin - itemBounds.x;
1013                 }
1014         }
1015         else // left move
1016         {
1017                 pItem = __pTabBarModel->GetItemAt(itemCount - 1);
1018                 if (pItem == null)
1019                 {
1020                         return true;
1021                 }
1022
1023                 itemBounds = pItem->GetBounds();
1024                 if (_FloatCompare(itemBounds.x + itemBounds.width + (__arrowMargin * 2.0f), clientBounds.width - (__sideMargin * 2.0f)))
1025                 {
1026                         return true;
1027                 }
1028
1029                 if (itemBounds.x + itemBounds.width + distance + (__arrowMargin * 2.0f) <= clientBounds.width - (__sideMargin * 2.0f))
1030                 {
1031                         distance = (clientBounds.width - (__sideMargin * 2.0f)) - (itemBounds.x + itemBounds.width + (__arrowMargin * 2.0f));
1032                 }
1033         }
1034
1035         AdjustItemPositionX(distance);
1036
1037         Draw();
1038
1039         return __touchBubblingBlocked;
1040 }
1041
1042 result
1043 _TabBarPresenter::DrawBitmap(Tizen::Graphics::Canvas& canvas, const Tizen::Graphics::FloatRectangle& bounds, const Tizen::Graphics::Bitmap& bitmap)
1044 {
1045         result r = E_SUCCESS;
1046         if (_BitmapImpl::CheckNinePatchedBitmapStrictly(bitmap))
1047         {
1048                 r = canvas.DrawNinePatchedBitmap(bounds, bitmap);
1049                 SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "Fail to draw ninepatched bitmap.")
1050         }
1051         else
1052         {
1053                 r = canvas.DrawBitmap(bounds, bitmap);
1054                 SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "Fail to draw bitmap.")
1055         }
1056
1057         return r;
1058 }
1059
1060 void
1061 _TabBarPresenter::SetAllAccessibilityElement(void)
1062 {
1063         _AccessibilityContainer* pContainer = __tabBar.GetAccessibilityContainer();
1064         if (pContainer != null)
1065         {
1066                 int itemCount = __pTabBarModel->GetItemCount();
1067                 for (int i = 0; i < itemCount; i++)
1068                 {
1069                         _TabBarItem* pItem = __pTabBarModel->GetItemAt(i);
1070                         if (pItem == null)
1071                         {
1072                                 result r = GetLastResult();
1073                                 SysLogException(NID_UI_CTRL, r, "[%s] The current value of pItem is null", GetErrorMessage(r));
1074
1075                                 continue;
1076                         }
1077
1078                         _AccessibilityElement* pElement = pItem->GetAccessibilityElement();
1079                         if (pElement == null)
1080                         {
1081                                 pElement = new (std::nothrow) _AccessibilityElement(true);
1082                                 pElement->Construct(L"", FloatRectangle(0.0f, 0.0f, 0.0f, 0.0f));
1083                                 pElement->SetName(L"Category" + Integer::ToString(i + 1));
1084                                 pElement->SetLabel(pItem->GetText());
1085                                 pElement->SetTraitWithStringId("IDS_TPLATFORM_BODY_CATEGORY");
1086                                 FloatRectangle itemBounds = pItem->GetBounds();
1087                                 itemBounds.x += __sideMargin;
1088                                 pElement->SetBounds(itemBounds);
1089                                 pItem->SetAccessibilityElement(pElement);
1090                                 pContainer->AddElement(*pElement);
1091                         }
1092                         else
1093                         {
1094                                 pElement->SetName(L"Category" + Integer::ToString(i + 1));
1095                                 pElement->SetLabel(pItem->GetText());
1096                                 pElement->SetTraitWithStringId("IDS_TPLATFORM_BODY_CATEGORY");
1097                                 FloatRectangle itemBounds = pItem->GetBounds();
1098                                 itemBounds.x += __sideMargin;
1099                                 pElement->SetBounds(itemBounds);
1100                         }
1101
1102                         if (pItem->GetStatus() != ITEM_STATUS_SELECTED)
1103                         {
1104                                 pElement->SetHintWithStringId("IDS_TPLATFORM_BODY_DOUBLE_TAP_TO_MOVE_TO_CONTENT_T_TTS");
1105                         }
1106                 }
1107         }
1108 }
1109
1110 bool
1111 _TabBarPresenter::OnAccessibilityFocusMovedNext(const _AccessibilityContainer& control, const _AccessibilityElement& element)
1112 {
1113         return false;
1114 }
1115
1116 bool
1117 _TabBarPresenter::OnAccessibilityFocusMovedPrevious(const _AccessibilityContainer& control, const _AccessibilityElement& element)
1118 {
1119         return false;
1120 }
1121
1122 bool
1123 _TabBarPresenter::OnAccessibilityReadElement(const _AccessibilityContainer& control, const _AccessibilityElement& element)
1124 {
1125         return false;
1126 }
1127
1128 bool
1129 _TabBarPresenter::OnAccessibilityReadingElement(const _AccessibilityContainer& control, const _AccessibilityElement& element)
1130 {
1131
1132         return false;
1133 }
1134
1135 bool
1136 _TabBarPresenter::OnAccessibilityFocusIn(const _AccessibilityContainer& control, const _AccessibilityElement& element)
1137 {
1138         return false;
1139 }
1140
1141 bool
1142 _TabBarPresenter::OnAccessibilityFocusOut(const _AccessibilityContainer& control, const _AccessibilityElement& element)
1143 {
1144         return false;
1145 }
1146
1147 bool
1148 _TabBarPresenter::OnAccessibilityActionPerformed(const _AccessibilityContainer& control, const _AccessibilityElement& element)
1149 {
1150         return false;
1151 }
1152
1153 bool
1154 _TabBarPresenter::OnAccessibilityValueIncreased(const _AccessibilityContainer& control, const _AccessibilityElement& element)
1155 {
1156         return false;
1157 }
1158
1159 bool
1160 _TabBarPresenter::OnAccessibilityValueDecreased(const _AccessibilityContainer& control, const _AccessibilityElement& element)
1161 {
1162         return false;
1163 }
1164
1165 bool
1166 _TabBarPresenter::OnAccessibilityItemRefreshed(const _AccessibilityContainer& control, const _AccessibilityElement& element, _AccessibilityFocusDirection direction)
1167 {
1168         FloatRectangle r = element.GetBounds();
1169         int itemIndex = GetItemIndexFromAbsPosition(FloatPoint(r.x + r.width / 2.0f, r.y + r.height / 2.0f));
1170
1171         if (itemIndex < __pTabBarModel->GetFirstDrawnItemIndex() || __pTabBarModel->GetLastDrawnItemIndex() < itemIndex)
1172         {
1173                 SetTopDrawnItemIndex(itemIndex);
1174                 __tabBar.Draw();
1175         }
1176
1177         return false;
1178 }
1179
1180 }}} // Tizen::Ui::Controls