Change initializing time for SetAccessibilityElement.
[framework/osp/uifw.git] / src / ui / controls / FUiCtrl_TableViewItem.cpp
1 //
2 // Open Service Platform
3 // Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
4 //
5 // Licensed under the Apache License, Version 2.0 (the License);
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
8 //
9 //     http://www.apache.org/licenses/LICENSE-2.0/
10 //
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an "AS IS" BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
16 //
17
18 /**
19  * @file        FUiCtrl_TableViewItem.cpp
20  * @brief       This is the implementation file for _TableViewItem class.
21  *
22  * This file contains the implementation of _TableViewItem class.
23  */
24
25 #include <FBaseUtilMath.h>
26 #include <FGrp_BitmapImpl.h>
27 #include "FUi_ResourceManager.h"
28 #include "FUi_UiTouchEvent.h"
29 #include "FUiAnim_VisualElement.h"
30 #include "FUiAnim_ControlVisualElement.h"
31 #include "FUiCtrl_TableViewItem.h"
32 #include "FUiCtrl_TableView.h"
33 #include "FUi_CoordinateSystemUtils.h"
34 #include "FUi_Math.h"
35 #include "FUiCtrl_LabelImpl.h"
36
37 using namespace Tizen::Base;
38 using namespace Tizen::Base::Runtime;
39 using namespace Tizen::Base::Collection;
40 using namespace Tizen::Ui::Animations;
41 using namespace Tizen::Graphics;
42
43 namespace Tizen { namespace Ui { namespace Controls
44 {
45
46 _TableViewItemControl::_TableViewItemControl(void)
47         :__pBackgroundBitmap(null)
48 {
49 }
50
51 _TableViewItemControl::~_TableViewItemControl(void)
52 {
53         if(__pBackgroundBitmap)
54         {
55                 delete __pBackgroundBitmap;
56                 __pBackgroundBitmap = null;
57         }
58         ClearLastResult();
59 }
60
61 void
62 _TableViewItemControl::OnDraw(void)
63 {
64         Bitmap* pBitmap = GetBackgroundBitmap();
65
66         FloatRectangle bounds(0.0f, 0.0f, GetBoundsF().width, GetBoundsF().height); // +++ check floating
67
68         Color bgColor = GetBackgroundColor();
69
70         Canvas* pCanvas = null;
71
72         if (pBitmap != null)
73         {
74                 pCanvas = GetCanvasN();
75                 if (pCanvas == null)
76                 {
77                         SysLog(NID_UI_CTRL, "Cannot get a canvas.");
78
79                         return;
80                 }
81
82                 pCanvas->SetBackgroundColor(Color(0, 0, 0, 0));
83                 pCanvas->Clear();
84
85                 if (_BitmapImpl::CheckNinePatchedBitmapStrictly(*pBitmap))
86                 {
87                         pCanvas->DrawNinePatchedBitmap(bounds, *pBitmap);
88                 }
89                 else
90                 {
91                         FloatRectangle drawingRect(0.0f, 0.0f, bounds.width, bounds.height);
92                         pCanvas->DrawBitmap(drawingRect, *pBitmap);
93                 }
94
95         }
96         else
97         {
98                 if (IsCalledGetCanvasN() == false)
99                 {
100                         GetVisualElement()->SetBackgroundColor(_Colorf((float)bgColor.GetRed() / 255, (float)bgColor.GetGreen() / 255, (float)bgColor.GetBlue() / 255, (float)bgColor.GetAlpha() / 255));
101                 }
102                 else
103                 {
104                         pCanvas = GetCanvasN();
105                         if (pCanvas == null)
106                         {
107                                 SysLog(NID_UI_CTRL, "Cannot get a canvas.");
108
109                                 return;
110                         }
111
112                         pCanvas->SetBackgroundColor(Color(0, 0, 0, 0));
113                         pCanvas->Clear();
114                         pCanvas->FillRectangle(GetBackgroundColor(), bounds); // +++ check floating
115                 }
116         }
117
118         if (pCanvas)
119         {
120                 delete pCanvas;
121         }
122
123         return;
124 }
125
126 HitTestResult
127 _TableViewItemControl::HitTest(const  Graphics :: FloatPoint & point)
128 {
129         return HIT_TEST_NOWHERE;
130 }
131
132 _TableViewItemControl*
133 _TableViewItemControl::CreateTableViewItemControlN(void)
134 {
135         _TableViewItemControl* pItemControl = new (std::nothrow) _TableViewItemControl();
136         SysTryReturn(NID_UI_CTRL, pItemControl, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory is insufficient.");
137         SysTryCatch(NID_UI_CTRL, GetLastResult() == E_SUCCESS, , E_SYSTEM, "[E_SYSTEM] A system error occurred.");
138
139         pItemControl->AcquireHandle();
140
141         return pItemControl;
142
143 CATCH:
144         delete pItemControl;
145         return null;
146 }
147
148 result
149 _TableViewItemControl::SetBackgroundBitmap(const Bitmap& bitmap)
150 {
151         result r = E_SYSTEM;
152
153         Bitmap* pClonedBitmap = _BitmapImpl::CloneN(bitmap);
154
155         if (pClonedBitmap)
156         {
157                 if (__pBackgroundBitmap != null)
158                 {
159                         delete __pBackgroundBitmap;
160                 }
161
162                 __pBackgroundBitmap = pClonedBitmap;
163
164                 r = E_SUCCESS;
165         }
166
167         return r;
168 }
169
170 Bitmap*
171 _TableViewItemControl::GetBackgroundBitmap(void) const
172 {
173         return __pBackgroundBitmap;
174 }
175
176 _TableViewItem::_TableViewItem(float itemHeight)
177         : _Control()
178         , __pAppInfo(null)
179         , __refCount(1)
180         , __itemHeight(itemHeight)
181         , __itemGroupIndex(-1)
182         , __itemIndex(-1)
183         , __checkedState(false)
184         , __enabledState(true)
185         , __itemChanged(true)
186         , __reorderMode(false)
187         , __itemSelected(false)
188         , __itemTouchMoved(false)
189         , __childMarginState(false)
190         , __annexStyle(TABLE_VIEW_ANNEX_STYLE_NORMAL)
191         , __drawingStatus(TABLE_VIEW_ITEM_DRAWING_STATUS_NORMAL)
192         , __selectionStyle(TABLE_VIEW_ITEM_SELECTION_STYLE_WHOLE)
193         , __itemType(TABLE_VIEW_ITEM_TYPE_NONE)
194         , __pContextItem(null)
195         , __isContextItem(false)
196         , __isContextItemActivated(false)
197         , __checkItemHeightNeeded(false)
198         , __pItemDivider(null)
199         , __pItemTopDivider(null)
200         , __pItemAnnex(null)
201         , __pItemCover(null)
202         , __pItemAnnexLeftDivider(null)
203         , __pItemAnnexRightDivider(null)
204         , __itemWidth(0.0f)
205         , __pDrawingProperty(null)
206         , __itemDividerEnabled(true)
207         , __pSimpleItemText(null)
208         , __pSimpleItemBitmap(null)
209         , __simpleItemTextSize(0)
210         , __pHeaderFooterItemText(null)
211         , __pDimLayer(null)
212         , __touchStartPosition(0.0f, 0.0f)
213         , __annexOnOffTouchPosition(0)
214         , __annexOnOffHandlerMoved(false)
215         , __annexOnOffHandlerLastPosition(0.0f)
216         , __childControlCenterAlign(false)
217         , __customHeight(0.0f)
218         , __animationCount(0)
219         , __pAccessibilityElement(null)
220         , __pPressedTimer(null)
221         , __pReleasedTimer(null)
222         , __isPressedTimerEnabled(false)
223         , __isReleasedTimerEnabled(false)
224         , __pressedControl(TABLE_VIEW_ITEM_PRESSED_NONE)
225         , __releasedControl(TABLE_VIEW_ITEM_PRESSED_NONE)
226         , __pCheckedTimer(null)
227         , __isCheckedTimerEnabled(false)
228         , __isCheckedAnimationEnabled(false)
229         , __checkedCount(0)
230         , __checkedBounds(FloatRectangle(0.0f, 0.0f, 0.0f, 0.0f))
231         , __isItemLayoutEnabled(false)
232         , __isMoveItemAnimationEnabled(false)
233         , __isZoomInOutItemAnimationEnabled(false)
234         , __isFadeInOutItemAnimationEnabled(false)
235         , __isAnimationCallbackBlocked(false)
236         , __isItemTapSoundEnabled(true)
237         , __isTabSoundPlayed(false)
238         , __isSelectedDetailButton(false)
239         , __pHighlightVisualElement(null)
240         , __pBitmapVisualElement(null)
241         , __pMoveItemAnimation(null)
242         , __pZoomInOutItemAnimation(null)
243         , __pFadeInOutItemtAnimation(null)
244 {
245         for (int i = 0; i < 3; i++)
246         {
247                 __pItemBgBitmap[i] = null;
248         }
249
250         GET_COLOR_CONFIG(TABLEVIEW::ITEM_BG_NORMAL, __colorItemBg[TABLE_VIEW_ITEM_DRAWING_STATUS_NORMAL]); // for support opacity 0x00
251         GET_COLOR_CONFIG(TABLEVIEW::ITEM_BG_PRESSED, __colorItemBg[TABLE_VIEW_ITEM_DRAWING_STATUS_PRESSED]);
252         GET_COLOR_CONFIG(TABLEVIEW::ITEM_BG_HIGHLIGHTED, __colorItemBg[TABLE_VIEW_ITEM_DRAWING_STATUS_HIGHLIGHTED]);
253
254         GET_COLOR_CONFIG(TABLEVIEW::ITEM_TEXT_NORMAL, __simpleItemTextColor[TABLE_VIEW_ITEM_DRAWING_STATUS_NORMAL]);
255         GET_COLOR_CONFIG(TABLEVIEW::ITEM_TEXT_PRESSED, __simpleItemTextColor[TABLE_VIEW_ITEM_DRAWING_STATUS_PRESSED]);
256         GET_COLOR_CONFIG(TABLEVIEW::ITEM_TEXT_HIGHLIGHTED, __simpleItemTextColor[TABLE_VIEW_ITEM_DRAWING_STATUS_HIGHLIGHTED]);
257         GET_COLOR_CONFIG(TABLEVIEW::GROUPITEM_TEXT_NORMAL, __simpleItemTextColor[TABLE_VIEW_GROUPITEM_DRAWING_STATUS_NORMAL]);
258         GET_COLOR_CONFIG(TABLEVIEW::GROUPITEM_TEXT_PRESSED, __simpleItemTextColor[TABLE_VIEW_GROUPITEM_DRAWING_STATUS_PRESSED]);
259         GET_COLOR_CONFIG(TABLEVIEW::ITEM_TEXT_DISABLED, __simpleItemTextColor[TABLE_VIEW_SIMPLEITEM_DRAWING_STATUS_DISABLED]);
260
261
262         _AccessibilityContainer* pContainer = GetAccessibilityContainer();
263         if (pContainer)
264         {
265                 pContainer->Activate(true);
266                 pContainer->AddListener(*this);
267         }
268 }
269
270 _TableViewItem::~_TableViewItem()
271 {
272         __isAnimationCallbackBlocked = true;
273
274         StopTouchPressedTimer();
275         delete __pPressedTimer;
276         __pPressedTimer = null;
277
278         StopTouchReleasedTimer();
279         delete __pReleasedTimer;
280         __pReleasedTimer = null;
281
282         _VisualElement* pVisualElement = GetVisualElement();
283         if (pVisualElement != null)
284         {
285                 if(__pMoveItemAnimation != null)
286                 {
287                         __pMoveItemAnimation->SetVisualElementAnimationTickEventListener(null);
288                         __pMoveItemAnimation->SetVisualElementAnimationStatusEventListener(null);
289                 }
290
291                 if(__pZoomInOutItemAnimation != null)
292                 {
293                         __pZoomInOutItemAnimation->SetVisualElementAnimationTickEventListener(null);
294                         __pZoomInOutItemAnimation->SetVisualElementAnimationStatusEventListener(null);
295                 }
296
297                 if(__pFadeInOutItemtAnimation != null)
298                 {
299                         __pFadeInOutItemtAnimation->SetVisualElementAnimationTickEventListener(null);
300                         __pFadeInOutItemtAnimation->SetVisualElementAnimationStatusEventListener(null);
301                 }
302                 pVisualElement->RemoveAllAnimations();
303         }
304
305         for (int j = 0; j < 3; j++)
306         {
307                 delete __pItemBgBitmap[j];
308                 __pItemBgBitmap[j] = null;
309         }
310
311         if (__pHighlightVisualElement != null)
312         {
313                 __pHighlightVisualElement->RemoveAllAnimations();
314                 __pHighlightVisualElement->SetAnimationProvider(null);
315                 __pHighlightVisualElement->Destroy();
316                 __pHighlightVisualElement = null;
317         }
318
319         if (__pBitmapVisualElement != null)
320         {
321                 __pBitmapVisualElement->RemoveAllAnimations();
322                 __pBitmapVisualElement->SetAnimationProvider(null);
323                 __pBitmapVisualElement->Destroy();
324                 __pBitmapVisualElement = null;
325         }
326
327         DetachAllChildren();
328
329         if (GetParent() != null && __isContextItem == true)
330         {
331                 GetParent()->DetachChild(*this);
332         }
333
334         delete __pItemDivider;
335         __pItemDivider = null;
336
337         delete __pItemTopDivider;
338         __pItemTopDivider = null;
339
340         delete __pItemAnnexLeftDivider;
341         __pItemAnnexLeftDivider = null;
342
343         delete __pItemAnnexRightDivider;
344         __pItemAnnexRightDivider = null;
345
346         delete __pItemAnnex;
347         __pItemAnnex = null;
348
349         delete __pDimLayer;
350         __pDimLayer = null;
351
352         delete __pItemCover;
353         __pItemCover = null;
354
355         delete __pHeaderFooterItemText;
356         __pHeaderFooterItemText = null;
357
358         delete __pMoveItemAnimation;
359         __pMoveItemAnimation = null;
360
361         delete __pZoomInOutItemAnimation;
362         __pZoomInOutItemAnimation = null;
363
364         delete __pFadeInOutItemtAnimation;
365         __pFadeInOutItemtAnimation = null;
366
367         if (__isCheckedTimerEnabled)
368         {
369                 __pCheckedTimer->Cancel();
370         }
371
372         delete __pCheckedTimer;
373         __pCheckedTimer = null;
374
375         if (__pAccessibilityElement)
376         {
377                 _AccessibilityContainer* pContainer = GetAccessibilityContainer();
378                 if(pContainer)
379                 {
380                         pContainer->RemoveAllElement();
381                 }
382                 __pAccessibilityElement = null;
383         }
384 }
385
386 _TableViewItem*
387 _TableViewItem::CreateTableViewItemN(float itemHeight)
388 {
389         result r = E_SUCCESS;
390
391         _TableViewItem* pItem = null;
392         pItem = new (std::nothrow) _TableViewItem(itemHeight);
393         SysTryReturn(NID_UI_CTRL, pItem, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient.");
394
395         pItem->AcquireHandle();
396
397         r = pItem->Initialize();
398         SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r = E_SYSTEM, "[E_SYSTEM] Unable to create TableView Item");
399
400         return pItem;
401
402 CATCH:
403         delete pItem;
404
405         return null;
406 }
407
408 result
409 _TableViewItem::Initialize(void)
410 {
411         GetVisualElement()->SetSurfaceOpaque(false);
412
413         result r = E_SUCCESS;
414
415         __pHighlightVisualElement = new (std::nothrow) _VisualElement();
416         SysTryCatch(NID_UI_CTRL, __pHighlightVisualElement != null, r = E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
417
418         r = __pHighlightVisualElement->Construct();
419         SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Failed to construct Visual Element.", GetErrorMessage(r));
420
421         r = __pHighlightVisualElement->SetSurfaceOpaque(false);
422         SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Failed to set surface opaque.", GetErrorMessage(r));
423
424         __pHighlightVisualElement->SetImplicitAnimationEnabled(false);
425
426         r = GetVisualElement()->AttachChild(*__pHighlightVisualElement);
427         SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Failed to attach child to the control VisualElement.", GetErrorMessage(r));
428
429         r = SetItemHighlightBounds(*__pHighlightVisualElement, CalculateItemHighlightBounds());
430         SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Failed to set bounds.", GetErrorMessage(r));
431
432         __pHighlightVisualElement->SetBackgroundColor(_Colorf(0.0f, 0.0f, 0.0f, 0.0f));
433         __pHighlightVisualElement->SetShowState(true);
434
435         r = __individualSelectionControls.Construct(DEFAULT_CAPTURED_CONTROL_COUNT);
436         SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Failed to construct ArrayList", GetErrorMessage(r));
437
438         SetTouchPressThreshold(SENSITIVE);
439
440         if (!_FloatCompare(__itemHeight, 0.0f))
441         {
442                 SetAccessibilityElement();
443         }
444
445         return r;
446
447 CATCH:
448         if (__pHighlightVisualElement != null)
449         {
450                 __pHighlightVisualElement->RemoveAllAnimations();
451                 __pHighlightVisualElement->SetAnimationProvider(null);
452                 __pHighlightVisualElement->Destroy();
453                 __pHighlightVisualElement = null;
454         }
455
456         return r;
457 }
458
459 _TableViewItem*
460 _TableViewItem::GetContextItem(void) const
461 {
462         return __pContextItem;
463 }
464
465 void
466 _TableViewItem::SetContextItem(_TableViewItem* pContextItem)
467 {
468         if (pContextItem != null)
469         {
470                 pContextItem->__isContextItem = true;
471         }
472
473         __pContextItem = pContextItem;
474 }
475
476 bool
477 _TableViewItem::IsContextItem(void) const
478 {
479         return __isContextItem;
480 }
481
482 void
483 _TableViewItem::SetContextItemActivation(bool activated)
484 {
485         __isContextItemActivated = activated;
486 }
487
488 bool
489 _TableViewItem::IsContextItemActivated(void) const
490 {
491         return __isContextItemActivated;
492 }
493
494 result
495 _TableViewItem::CreateItemDimLayer(void)
496 {
497         result r = E_SUCCESS;
498
499         if (__pDimLayer == null)
500         {
501                 __pDimLayer = _Label::CreateLabelN();
502
503                 r = GetLastResult();
504                 SysTryReturn(NID_UI_CTRL, __pDimLayer != null, r, r, "[%s] Propagating.", GetErrorMessage(r));
505
506                 __pDimLayer->SetBackgroundColor(Color(0, 0, 0, BACKGROUND_DIMMED_OPACITY * 0xff));
507                 __pDimLayer->SetVisibleState(false);
508
509                 AttachSystemChild(*__pDimLayer);
510         }
511
512         return r;
513 }
514
515 result
516 _TableViewItem::CreateItemDivider(void)
517 {
518         result r = E_SUCCESS;
519
520         if (__pItemDivider == null)
521         {
522                 __pItemDivider = _TableViewItemControl::CreateTableViewItemControlN();
523                 r = GetLastResult();
524                 SysTryReturn(NID_UI_CTRL, __pItemDivider != null, r, r, "[%s] Propagating.", GetErrorMessage(r));
525
526                 AttachSystemChild(*__pItemDivider);
527
528                 _AccessibilityContainer* pContainer = __pItemDivider->GetAccessibilityContainer();
529                 pContainer->Activate(false);
530         }
531
532         if (__pItemTopDivider == null)
533         {
534                 __pItemTopDivider = _TableViewItemControl::CreateTableViewItemControlN();
535                 SysTryReturn(NID_UI_CTRL, __pItemTopDivider != null, r, r, "[%s] Propagating.", GetErrorMessage(r));
536
537                 AttachSystemChild(*__pItemTopDivider);
538
539                 _AccessibilityContainer* pContainer = __pItemTopDivider->GetAccessibilityContainer();
540                 pContainer->Activate(false);
541         }
542
543         return r;
544 }
545
546 result
547 _TableViewItem::CreateItemAnnexDivider(void)
548 {
549         result r = E_SUCCESS;
550
551         if (__pItemAnnexLeftDivider == null)
552         {
553                 __pItemAnnexLeftDivider = _TableViewItemControl::CreateTableViewItemControlN();
554                 r = GetLastResult();
555                 SysTryReturn(NID_UI_CTRL, __pItemAnnexLeftDivider != null, r, r, "[%s] Propagating.", GetErrorMessage(r));
556
557                 AttachSystemChild(*__pItemAnnexLeftDivider);
558         }
559
560         if (__pItemAnnexRightDivider == null)
561         {
562                 __pItemAnnexRightDivider = _TableViewItemControl::CreateTableViewItemControlN();
563                 SysTryReturn(NID_UI_CTRL, __pItemAnnexRightDivider != null, r, r, "[%s] Propagating.", GetErrorMessage(r));
564
565                 AttachSystemChild(*__pItemAnnexRightDivider);
566         }
567
568         return r;
569 }
570
571 result
572 _TableViewItem::CreateItemCover(void)
573 {
574         result r = E_SUCCESS;
575
576         if (__pItemCover == null)
577         {
578                 __pItemCover = _TableViewItemControl::CreateTableViewItemControlN();
579                 r = GetLastResult();
580                 SysTryReturn(NID_UI_CTRL, __pItemCover != null, r, r, "[%s] Propagating.", GetErrorMessage(r));
581
582                 AttachSystemChild(*__pItemCover);
583         }
584
585         return r;
586 }
587
588 result
589 _TableViewItem::CreateCheckBox(void)
590 {
591         result r = E_SUCCESS;
592
593         if (__pItemAnnex == null)
594         {
595                 float annexWidth = 0.0f;
596                 float annexHeight = 0.0f;
597                 GET_SHAPE_CONFIG(TABLEVIEW::ITEM_ANNEX_WIDTH, _CONTROL_ORIENTATION_PORTRAIT, annexWidth);
598                 GET_SHAPE_CONFIG(TABLEVIEW::ITEM_ANNEX_HEIGHT, _CONTROL_ORIENTATION_PORTRAIT, annexHeight);
599
600                 __pItemAnnex = new (std::nothrow) Label();
601                 r = GetLastResult();
602                 SysTryReturn(NID_UI_CTRL, __pItemAnnex != null, r, r, "[%s] Propagating.", GetErrorMessage(r));
603
604                 float leftMargin = 0.0f;
605                 GET_SHAPE_CONFIG(TABLEVIEW::ITEM_LEFT_MARGIN, _CONTROL_ORIENTATION_PORTRAIT, leftMargin);
606
607                 float itemHeight = ((__customHeight > 0) ? __customHeight : GetBoundsF().height);
608                 __pItemAnnex->Construct(FloatRectangle(leftMargin, ((itemHeight - annexHeight) / 2), annexWidth, annexHeight), L"");
609                 __pItemAnnex->SetBackgroundColor(Color(0, 0, 0, 0));
610
611                 AttachSystemChild(*GetLabelCore(__pItemAnnex));
612         }
613
614         return r;
615 }
616
617
618 result
619 _TableViewItem::CreateRadioBox(void)
620 {
621         result r = E_SUCCESS;
622
623         if (__pItemAnnex == null)
624         {
625                 float annexWidth = 0.0f;
626                 float annexHeight = 0.0f;
627                 GET_SHAPE_CONFIG(TABLEVIEW::ITEM_ANNEX_WIDTH, _CONTROL_ORIENTATION_PORTRAIT, annexWidth);
628                 GET_SHAPE_CONFIG(TABLEVIEW::ITEM_ANNEX_HEIGHT, _CONTROL_ORIENTATION_PORTRAIT, annexHeight);
629
630                 __pItemAnnex = new (std::nothrow) Label();
631                 r = GetLastResult();
632                 SysTryReturn(NID_UI_CTRL, __pItemAnnex != null, r, r, "[%s] Propagating.", GetErrorMessage(r));
633
634                 float leftMargin = 0.0f;
635                 GET_SHAPE_CONFIG(TABLEVIEW::ITEM_LEFT_MARGIN, _CONTROL_ORIENTATION_PORTRAIT, leftMargin);
636
637                 float itemHeight = ((__customHeight > 0) ? __customHeight : GetBoundsF().height);
638                 __pItemAnnex->Construct(FloatRectangle(leftMargin, ((itemHeight - annexHeight) / 2), annexWidth, annexHeight), L"");
639                 __pItemAnnex->SetBackgroundColor(Color(0, 0, 0, 0));
640
641                 AttachSystemChild(*GetLabelCore(__pItemAnnex));
642         }
643
644         return r;
645 }
646
647 result
648 _TableViewItem::CreateOnOffButton(void)
649 {
650         result r = E_SUCCESS;
651
652         if (__pItemAnnex == null)
653         {
654                 float annexWidth = 0.0f;
655                 float annexHeight = 0.0f;
656
657                 GET_SHAPE_CONFIG(TABLEVIEW::ITEM_ANNEX_ONOFF_WIDTH, _CONTROL_ORIENTATION_PORTRAIT, annexWidth);
658                 GET_SHAPE_CONFIG(TABLEVIEW::ITEM_ANNEX_ONOFF_HEIGHT, _CONTROL_ORIENTATION_PORTRAIT, annexHeight);
659
660                 __pItemAnnex = new (std::nothrow) Label();
661                 r = GetLastResult();
662                 SysTryReturn(NID_UI_CTRL, __pItemAnnex != null, r, r, "[%s] Propagating.", GetErrorMessage(r));
663
664                 float leftMargin = 0.0f;
665                 GET_SHAPE_CONFIG(TABLEVIEW::ITEM_LEFT_MARGIN, _CONTROL_ORIENTATION_PORTRAIT, leftMargin);
666
667                 leftMargin += __pDrawingProperty->scrollMargin;
668
669                 float itemHeight = ((__customHeight > 0) ? __customHeight : GetBoundsF().height);
670                 __pItemAnnex->Construct(FloatRectangle((GetBoundsF().width - annexWidth - leftMargin), ((itemHeight - annexHeight) / 2), annexWidth, annexHeight), L"");
671                 __pItemAnnex->SetBackgroundColor(Color(0, 0, 0, 0));
672
673                 AttachSystemChild(*GetLabelCore(__pItemAnnex));
674         }
675
676         return r;
677 }
678
679 result
680 _TableViewItem::CreateDetailButton(void)
681 {
682         result r = E_SUCCESS;
683
684         if (__pItemAnnex == null)
685         {
686                 float annexWidth = 0.0f;
687                 float annexHeight = 0.0f;
688
689                 GET_SHAPE_CONFIG(TABLEVIEW::ITEM_ANNEX_MORE_WIDTH, _CONTROL_ORIENTATION_PORTRAIT, annexWidth);
690                 GET_SHAPE_CONFIG(TABLEVIEW::ITEM_ANNEX_MORE_HEIGHT, _CONTROL_ORIENTATION_PORTRAIT, annexHeight);
691                 __pItemAnnex = new (std::nothrow) Label();
692                 r = GetLastResult();
693                 SysTryReturn(NID_UI_CTRL, __pItemAnnex != null, r, r, "[%s] Propagating.", GetErrorMessage(r));
694
695                 float leftMargin = 0.0f;
696                 GET_SHAPE_CONFIG(TABLEVIEW::ITEM_LEFT_MARGIN, _CONTROL_ORIENTATION_PORTRAIT, leftMargin);
697
698                 leftMargin += __pDrawingProperty->scrollMargin;
699                 float itemHeight = ((__customHeight > 0) ? __customHeight : GetBoundsF().height);
700                 __pItemAnnex->Construct(FloatRectangle((GetBoundsF().width - annexWidth - leftMargin), ((itemHeight - annexHeight) / 2), annexWidth, annexHeight), L"");
701                 __pItemAnnex->SetBackgroundColor(Color(0, 0, 0, 0));
702
703                 AttachSystemChild(*GetLabelCore(__pItemAnnex));
704         }
705
706         return r;
707 }
708
709 _Label*
710 _TableViewItem::GetLabelCore(Label* label)
711 {
712         if(label == null)
713         {
714                 return null;
715         }
716
717         _LabelImpl* pImpl = _LabelImpl::GetInstance(*label);
718         return &pImpl->GetCore();
719 }
720
721 void
722 _TableViewItem::ExposeContextItem(FloatRectangle itemBounds, float targetWidth)
723 {
724         DrawItemDivider();
725         if (__pDimLayer == null)
726         {
727                 if (CreateItemDimLayer() != E_SUCCESS)
728                 {
729                         return;
730                 }
731         }
732
733         SetBounds(itemBounds);
734
735         bool visible = true;
736
737         if ((itemBounds.width <= 0) || (itemBounds.width >= targetWidth)) // +++ check floating
738         {
739                 visible = false;
740         }
741
742         if (visible)
743         {
744                 float rightMargin = 0.0f;
745                 float dimLayerOpacity = 0.0f;
746
747                 GET_SHAPE_CONFIG(TABLEVIEW::CONTEXTITEM_RIGHT_MARGIN, _CONTROL_ORIENTATION_PORTRAIT, rightMargin);
748
749                 dimLayerOpacity = BACKGROUND_DIMMED_OPACITY - ((itemBounds.width * BACKGROUND_DIMMED_OPACITY) / (targetWidth - rightMargin));
750                 dimLayerOpacity = ((dimLayerOpacity < 0) ? 0 :  dimLayerOpacity); // +++ check floating
751
752                 __pDimLayer->SetBounds(FloatRectangle(0.0f, 0.0f, itemBounds.width, itemBounds.height));
753                 __pDimLayer->SetBackgroundColor(Color(0.0f, 0.0f, 0.0f, dimLayerOpacity * 0xff));
754         }
755
756         __pDimLayer->SetVisibleState(visible);
757
758 }
759
760 void
761 _TableViewItem::DrawItemDimLayer(bool visible)
762 {
763         if (__pDimLayer == null)
764         {
765                 if (CreateItemDimLayer() != E_SUCCESS)
766                 {
767                         return;
768                 }
769         }
770
771         if (visible)
772         {
773                 FloatDimension itemSize = GetSizeF();
774                 __pDimLayer->SetBounds(FloatRectangle(0.0f, 0.0f, itemSize.width, itemSize.height));
775                 __pDimLayer->SetBackgroundColor(Color(0, 0, 0, BACKGROUND_DISABLED_OPACITY * 0xff));
776         }
777
778         __pDimLayer->SetVisibleState(visible);
779 }
780
781 void
782 _TableViewItem::SetItemWidth(float width)
783 {
784         __itemWidth = width;
785 }
786
787 bool
788 _TableViewItem::SetItemBackgroundBitmap(ListItemState itemState, const Bitmap* pBitmap)
789 {
790         Bitmap* pCopyBitmap = null;
791
792         pCopyBitmap = _BitmapImpl::CloneN(*pBitmap);
793         SysTryReturn(NID_UI_CTRL, pCopyBitmap != null, false, E_OUT_OF_MEMORY, ("[E_OUT_OF_MEMORY] The memory is insufficient."));
794
795         delete __pItemBgBitmap[itemState];
796         __pItemBgBitmap[itemState] = pCopyBitmap;
797
798
799         if(__pItemBgBitmap[TABLE_VIEW_ITEM_DRAWING_STATUS_NORMAL] == null &&
800                 __pItemBgBitmap[TABLE_VIEW_ITEM_DRAWING_STATUS_PRESSED] == null &&
801                 __pItemBgBitmap[TABLE_VIEW_ITEM_DRAWING_STATUS_HIGHLIGHTED] == null)
802         {
803                 if(__pBitmapVisualElement != null)
804                 {
805                         __pBitmapVisualElement->Destroy();
806                         __pBitmapVisualElement = null;
807                 }
808         }
809         else
810         {
811                 if(__pBitmapVisualElement == null)
812                 {
813                         FloatRectangle bounds = GetBoundsF();
814                         result r = E_SUCCESS;
815
816                         __pBitmapVisualElement = new (std::nothrow) _VisualElement();
817                         SysTryCatch(NID_UI_CTRL, __pBitmapVisualElement != null, , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient.");
818
819                         r = __pBitmapVisualElement->Construct();
820                         SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
821
822                         __pBitmapVisualElement->SetSurfaceOpaque(false);
823                         SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Failed to set surface opaque.", GetErrorMessage(r));
824
825                         __pBitmapVisualElement->SetImplicitAnimationEnabled(false);
826                         __pBitmapVisualElement->SetBounds(FloatRectangle(0.0f, 0.0f, bounds.width, bounds.height));
827                         __pBitmapVisualElement->SetShowState(true);
828
829                         GetVisualElement()->AttachChild(*__pBitmapVisualElement);
830                 }
831         }
832
833         SetItemChanged(true);
834         return true;
835 CATCH:
836         if (__pBitmapVisualElement != null)
837         {
838                 __pBitmapVisualElement->RemoveAllAnimations();
839                 __pBitmapVisualElement->SetAnimationProvider(null);
840                 __pBitmapVisualElement->Destroy();
841                 __pBitmapVisualElement = null;
842         }
843         return false;
844 }
845
846 Tizen::Graphics::Bitmap*
847 _TableViewItem::GetItemBackgroundBitmap(ListItemState itemState) const
848 {
849         return __pItemBgBitmap[itemState];
850 }
851
852 void
853 _TableViewItem::SetItemBackgroundColor(ListItemState itemState, const Color bgColor)
854 {
855         __colorItemBg[itemState] = bgColor;
856
857         SetItemChanged(true);
858 }
859
860 Color
861 _TableViewItem::GetItemBackgroundColor(ListItemState itemState) const
862 {
863         return __colorItemBg[itemState];
864 }
865
866 void
867 _TableViewItem::SetItemStyle(TableViewAnnexStyle style)
868 {
869         if (__annexStyle == style)
870         {
871                 return;
872         }
873
874         __annexStyle = style;
875 }
876
877 result
878 _TableViewItem::SetSelectionStyle(TableViewItemSelectionStyle style)
879 {
880         __selectionStyle = style;
881
882         return E_SUCCESS;
883 }
884
885 TableViewItemSelectionStyle
886 _TableViewItem::GetSelectionStyle(void) const
887 {
888         return __selectionStyle;
889 }
890
891 float
892 _TableViewItem::GetItemHeight(void) const
893 {
894         return GetSizeF().height;
895 }
896
897 void
898 _TableViewItem::SetItemHeight(int itemHeight)
899 {
900         SetItemHeight(_CoordinateSystemUtils::ConvertToFloat(itemHeight));
901 }
902
903 void
904 _TableViewItem::SetItemHeight(float itemHeight)
905 {
906         SetSize(FloatDimension(GetSizeF().width, itemHeight));
907 }
908
909 void
910 _TableViewItem::SetChecked(bool checked)
911 {
912         if (__checkedState == checked)
913         {
914                 return;
915         }
916
917         __checkedState = checked;
918
919         SetItemChanged(true);
920 }
921
922 bool
923 _TableViewItem::IsChecked(void) const
924 {
925         return __checkedState;
926 }
927
928 void
929 _TableViewItem::SetCheckedAnimationEnabled(bool enabled)
930 {
931         __isCheckedAnimationEnabled = enabled;
932
933         if (__isCheckedAnimationEnabled == false)
934         {
935                 StopCheckBoxAnimation();
936         }
937 }
938
939 void
940 _TableViewItem::SetItemEnabled(bool enabled)
941 {
942         if (__enabledState == enabled)
943         {
944                 return;
945         }
946
947         __enabledState = enabled;
948
949         SetEnableState(enabled);
950
951         SetItemChanged(true);
952
953         Invalidate();
954
955         return;
956 }
957
958 bool
959 _TableViewItem::IsItemEnabled(void) const
960 {
961         return __enabledState;
962 }
963
964 void
965 _TableViewItem::SetItemType(const TableViewItemType itemType)
966 {
967         __itemType = itemType;
968
969         if (__pContextItem != null)
970         {
971                 __pContextItem->SetItemType(__itemType);
972         }
973
974         if(itemType == TABLE_VIEW_ITEM_TYPE_TITLE)
975         {
976                 Color titleColor;
977                 GET_COLOR_CONFIG(TABLEVIEW::ITEM_BG_PRESSED, titleColor);
978                 if(titleColor == __colorItemBg[TABLE_VIEW_ITEM_DRAWING_STATUS_PRESSED])
979                 {
980                         GET_COLOR_CONFIG(TABLEVIEW::GROUPITEM_BG_PRESSED, __colorItemBg[TABLE_VIEW_ITEM_DRAWING_STATUS_PRESSED]);
981                 }
982         }
983 }
984
985 void
986 _TableViewItem::SetItemIndex(int groupIndex, int itemIndex)
987 {
988         __itemGroupIndex = groupIndex;
989         __itemIndex = itemIndex;
990 }
991
992 void
993 _TableViewItem::GetItemIndex(int& groupIndex, int& itemIndex) const
994 {
995         groupIndex = __itemGroupIndex;
996         itemIndex = __itemIndex;
997 }
998
999
1000 TableViewItemType
1001 _TableViewItem::GetItemType(void) const
1002 {
1003         return __itemType;
1004 }
1005
1006 bool
1007 _TableViewItem::IsReorderMode(void) const
1008 {
1009         return __reorderMode;
1010 }
1011
1012 void
1013 _TableViewItem::SetReorderMode(bool enabled)
1014 {
1015         __reorderMode = enabled;
1016 }
1017
1018 void
1019 _TableViewItem::SetAppInfo(const void* pAppInfo)
1020 {
1021         __pAppInfo = const_cast<void*>(pAppInfo);
1022 }
1023
1024 void*
1025 _TableViewItem::GetAppInfo(void) const
1026 {
1027         return __pAppInfo;
1028 }
1029
1030 void
1031 _TableViewItem::SetItemChanged(bool changed)
1032 {
1033         __itemChanged = changed;
1034 }
1035
1036 bool
1037 _TableViewItem::IsItemChanged(void) const
1038 {
1039         return __itemChanged;
1040 }
1041
1042 bool
1043 _TableViewItem::IsAnnexOnOffSliding(void)
1044 {
1045         return __annexOnOffHandlerMoved;
1046 }
1047
1048 TableViewAnnexStyle
1049 _TableViewItem::GetItemStyle(void) const
1050 {
1051         return __annexStyle;
1052 }
1053
1054 bool
1055 _TableViewItem::DrawItem(FloatRectangle& rcItem, ListItemState itemState, bool itemDivider)
1056 {
1057         return true;
1058 }
1059
1060 bool
1061 _TableViewItem::SetItemTapSoundEnabled(bool tapSoundEnabled)
1062 {
1063         bool oldValue = __isItemTapSoundEnabled;
1064         __isItemTapSoundEnabled = tapSoundEnabled;
1065         return oldValue;
1066 }
1067
1068 bool
1069 _TableViewItem::GetItemTapSoundEnabled(void)
1070 {
1071         return __isItemTapSoundEnabled;
1072 }
1073
1074 void
1075 _TableViewItem::FireItemEvent(bool selectedItem)
1076 {
1077         if (HasParent() == false)
1078         {
1079                 return;
1080         }
1081
1082         if (IsContextItem())
1083         {
1084                 return;
1085         }
1086
1087         _TableView* pParent = dynamic_cast<_TableView*>(GetParent());
1088         if (pParent == null)
1089         {
1090                 return;
1091         }
1092
1093         TableViewNotifyType eventType = TABLEVIEW_NOTIFY_TYPE_SELECTED_ITEM;
1094
1095         if ((__annexStyle == TABLE_VIEW_ANNEX_STYLE_MARK)
1096                 || (__annexStyle == TABLE_VIEW_ANNEX_STYLE_RADIO)
1097                 || (__annexStyle == TABLE_VIEW_ANNEX_STYLE_ONOFF_SLIDING))
1098         {
1099                 if (IsChecked())
1100                 {
1101                         eventType = TABLEVIEW_NOTIFY_TYPE_ANNEX_CHECK;
1102                 }
1103                 else
1104                 {
1105                         eventType = TABLEVIEW_NOTIFY_TYPE_ANNEX_UNCHECK;
1106                 }
1107         }
1108         else if (__annexStyle == TABLE_VIEW_ANNEX_STYLE_DETAILED)
1109         {
1110                 if (!selectedItem)
1111                 {
1112                         eventType = TABLEVIEW_NOTIFY_TYPE_ANNEX_MORE;
1113                 }
1114         }
1115         else if(__annexStyle == TABLE_VIEW_ANNEX_STYLE_ONOFF_SLIDING_WITH_DIVIDER)
1116         {
1117                 if (selectedItem)
1118                 {
1119                         eventType = TABLEVIEW_NOTIFY_TYPE_SELECTED_ITEM;
1120                 }
1121                 else
1122                 {
1123                         if (IsChecked())
1124                         {
1125                                 eventType = TABLEVIEW_NOTIFY_TYPE_ANNEX_CHECK;
1126                         }
1127                         else
1128                         {
1129                                 eventType = TABLEVIEW_NOTIFY_TYPE_ANNEX_UNCHECK;
1130                         }
1131                 }
1132         }
1133
1134         if (__isItemTapSoundEnabled)
1135         {
1136                 if (!__isTabSoundPlayed)
1137                 {
1138                         PLAY_FEEDBACK(_RESOURCE_FEEDBACK_PATTERN_TAP);
1139                 }
1140         }
1141
1142         __isTabSoundPlayed = false;
1143         __checkItemHeightNeeded = true;
1144
1145         int groupIndex = -1;
1146         int itemIndex = -1;
1147         GetItemIndex(groupIndex, itemIndex);
1148         pParent->FireTableViewItemEvent(groupIndex, itemIndex, eventType, this);
1149 }
1150
1151 void
1152 _TableViewItem::FireItemSweepEvent(TableViewSweepDirection direction)
1153 {
1154         if (HasParent() == false)
1155         {
1156                 return;
1157         }
1158
1159         _TableView* pParent = dynamic_cast<_TableView*>(GetParent());
1160         if (pParent == null)
1161         {
1162                 return;
1163         }
1164
1165         int groupIndex = -1;
1166         int itemIndex = -1;
1167         GetItemIndex(groupIndex, itemIndex);
1168
1169         pParent->FireTableViewItemSweepEvent(groupIndex, itemIndex, direction);
1170 }
1171
1172 bool
1173 _TableViewItem::OnTouchPressed(const _Control& source, const _TouchInfo& touchinfo)
1174 {
1175         if (IsContextItem() ||
1176                 __isContextItemActivated ||
1177                 IsAnimationPlaying() ||
1178                 IsReorderMode())
1179         {
1180                 return true;
1181         }
1182
1183         __annexOnOffHandlerMoved = false;
1184         __touchStartPosition = touchinfo.GetCurrentPosition(); // +++ check floating
1185
1186         if (&source == this)
1187         {
1188                 __pressedControl = TABLE_VIEW_ITEM_PRESSED_ITEM;
1189         }
1190         else if (&source == GetLabelCore(__pItemAnnex))
1191         {
1192                 __pressedControl = TABLE_VIEW_ITEM_PRESSED_ANNEX;
1193
1194                 if (__annexStyle == TABLE_VIEW_ANNEX_STYLE_ONOFF_SLIDING ||
1195                         __annexStyle == TABLE_VIEW_ANNEX_STYLE_ONOFF_SLIDING_WITH_DIVIDER)
1196                 {
1197                         __annexOnOffTouchPosition = touchinfo.GetCurrentPosition().x; // +++ check floating
1198                 }
1199         }
1200         else if (IsIndividualSelectionEnabled(source))
1201         {
1202                 __pressedControl = TABLE_VIEW_ITEM_PRESSED_INDIVIDUAL;
1203         }
1204         else
1205         {
1206                 __pressedControl = TABLE_VIEW_ITEM_PRESSED_NONE;
1207         }
1208
1209         if(__isReleasedTimerEnabled)
1210         {
1211                 StopTouchReleasedTimer();
1212
1213                 _TableView* pParent = dynamic_cast<_TableView*>(GetParent());
1214                 if (pParent != null)
1215                 {
1216                         int groupIndex = -1;
1217                         int itemIndex = -1;
1218                         GetItemIndex(groupIndex, itemIndex);
1219                         pParent->FireItemTouchReleasedEventDuringPressing(groupIndex, itemIndex);
1220                 }
1221         }
1222         else
1223         {
1224                 if (!IsIndividualSelectionEnabled(source))
1225                 {
1226                         __itemSelected = true;
1227                         if(unlikely((_AccessibilityManager::IsActivated())))
1228                         {
1229                                 FireItemTouchPressed();
1230                         }
1231                         else
1232                         {
1233                                 StartTouchPressedTimer(source, touchinfo);
1234                         }
1235                 }
1236         }
1237
1238         return true;
1239 }
1240
1241 bool
1242 _TableViewItem::OnTouchReleased(const _Control& source, const _TouchInfo& touchinfo)
1243 {
1244         if(IsReorderMode())
1245         {
1246                 return true;
1247         }
1248
1249         if (&source == this)
1250         {
1251                 __releasedControl = TABLE_VIEW_ITEM_PRESSED_ITEM;
1252         }
1253         else if (&source == GetLabelCore(__pItemAnnex))
1254         {
1255                 __releasedControl = TABLE_VIEW_ITEM_PRESSED_ANNEX;
1256         }
1257         else if (IsIndividualSelectionEnabled(source))
1258         {
1259                 __releasedControl = TABLE_VIEW_ITEM_PRESSED_INDIVIDUAL;
1260         }
1261         else
1262         {
1263                 __releasedControl = TABLE_VIEW_ITEM_PRESSED_NONE;
1264         }
1265
1266         __isTabSoundPlayed = IS_PLAYED_FEEDBACK();
1267
1268         if(!__itemTouchMoved && __isPressedTimerEnabled)
1269         {
1270                 StopTouchPressedTimer();
1271
1272                 if(!IsContextItem())
1273                 {
1274                         FireItemTouchPressed();
1275                 }
1276
1277                 StartTouchReleasedTimer();
1278                 return true;
1279         }
1280
1281         FireItemTouchReleased();
1282         return true;
1283 }
1284
1285 void
1286 _TableViewItem::FireItemTouchPressed()
1287 {
1288         if(__pressedControl == TABLE_VIEW_ITEM_PRESSED_ITEM)
1289         {
1290                 __drawingStatus = TABLE_VIEW_ITEM_DRAWING_STATUS_PRESSED;
1291                 SetItemChanged(true);
1292                 Invalidate();
1293         }
1294         else if(__pressedControl == TABLE_VIEW_ITEM_PRESSED_ANNEX)
1295         {
1296                 if (__annexStyle == TABLE_VIEW_ANNEX_STYLE_DETAILED)
1297                 {
1298                         __drawingStatus = TABLE_VIEW_ITEM_DRAWING_STATUS_NORMAL;
1299                         __isSelectedDetailButton = true;
1300                         DrawAnnexStyle();
1301                 }
1302                 else if (__annexStyle == TABLE_VIEW_ANNEX_STYLE_ONOFF_SLIDING ||
1303                                         __annexStyle == TABLE_VIEW_ANNEX_STYLE_ONOFF_SLIDING_WITH_DIVIDER)
1304                 {
1305                         __drawingStatus = TABLE_VIEW_ITEM_DRAWING_STATUS_NORMAL;
1306                 }
1307                 else
1308                 {
1309                         __drawingStatus = TABLE_VIEW_ITEM_DRAWING_STATUS_PRESSED;
1310                         SetItemChanged(true);
1311                         Invalidate();
1312                 }
1313         }
1314         else
1315         {
1316                 if(__pressedControl != TABLE_VIEW_ITEM_PRESSED_INDIVIDUAL)
1317                 {
1318                         __drawingStatus = TABLE_VIEW_ITEM_DRAWING_STATUS_PRESSED;
1319                         SetItemChanged(true);
1320                         Invalidate();
1321                 }
1322         }
1323 }
1324
1325 void
1326 _TableViewItem::FireItemTouchReleased()
1327 {
1328         bool fireItemEvent = false;
1329         bool selectedItem = true;
1330
1331         __drawingStatus = TABLE_VIEW_ITEM_DRAWING_STATUS_NORMAL;
1332
1333         if (__itemSelected == true)
1334         {
1335                 bool checked = IsChecked();
1336                 fireItemEvent = true;
1337
1338                 if (__releasedControl == TABLE_VIEW_ITEM_PRESSED_ITEM)
1339                 {
1340                         if ((__annexStyle == TABLE_VIEW_ANNEX_STYLE_RADIO)
1341                                 || (__annexStyle == TABLE_VIEW_ANNEX_STYLE_ONOFF_SLIDING))
1342                         {
1343                                 SetChecked(!checked);
1344                         }
1345                         else if(__annexStyle == TABLE_VIEW_ANNEX_STYLE_MARK)
1346                         {
1347                                 SetChecked(!checked);
1348                                 SetCheckedAnimationEnabled(!checked);
1349                         }
1350                 }
1351                 else if(__releasedControl == TABLE_VIEW_ITEM_PRESSED_ANNEX)
1352                 {
1353                         if (__annexStyle == TABLE_VIEW_ANNEX_STYLE_DETAILED)
1354                         {
1355                                 __isSelectedDetailButton = false;
1356                                 DrawAnnexStyle();
1357                                 selectedItem = false;
1358                         }
1359                         else if (__annexStyle == TABLE_VIEW_ANNEX_STYLE_ONOFF_SLIDING ||
1360                                 __annexStyle == TABLE_VIEW_ANNEX_STYLE_ONOFF_SLIDING_WITH_DIVIDER)
1361                         {
1362                                 AdjustAnnexOnOffHandlerPosition();
1363                                 selectedItem = false;
1364                         }
1365                         else
1366                         {
1367                                 SetChecked(!checked);
1368                                 SetCheckedAnimationEnabled(!checked);
1369                         }
1370                 }
1371                 else
1372                 {
1373                         if(__releasedControl != TABLE_VIEW_ITEM_PRESSED_INDIVIDUAL)
1374                         {
1375                                 if ((__annexStyle == TABLE_VIEW_ANNEX_STYLE_MARK)
1376                                         || (__annexStyle == TABLE_VIEW_ANNEX_STYLE_RADIO)
1377                                         || (__annexStyle == TABLE_VIEW_ANNEX_STYLE_ONOFF_SLIDING))
1378                                 {
1379                                         SetChecked(!checked);
1380                                         SetCheckedAnimationEnabled(!checked);
1381                                 }
1382                         }
1383                         else
1384                         {
1385                                 fireItemEvent = false;
1386                         }
1387                 }
1388
1389                 SetItemChanged(true);
1390                 Invalidate();
1391
1392         }
1393         else
1394         {
1395                 if (__releasedControl == TABLE_VIEW_ITEM_PRESSED_ANNEX)
1396                 {
1397                         if (__annexStyle == TABLE_VIEW_ANNEX_STYLE_ONOFF_SLIDING ||
1398                                 __annexStyle == TABLE_VIEW_ANNEX_STYLE_ONOFF_SLIDING_WITH_DIVIDER)
1399                         {
1400                                 AdjustAnnexOnOffHandlerPosition();
1401                                 fireItemEvent = true;
1402                         }
1403                 }
1404         }
1405
1406         __itemSelected = false;
1407         __annexOnOffHandlerMoved = false;
1408         __itemTouchMoved = false;
1409
1410         if (fireItemEvent)
1411         {
1412                 FireItemEvent(selectedItem);
1413         }
1414 }
1415
1416 bool
1417 _TableViewItem::OnTouchMoved(const _Control& source, const _TouchInfo& touchinfo)
1418 {
1419         if(IsReorderMode())
1420         {
1421                 return false;
1422         }
1423
1424         if (__isPressedTimerEnabled)
1425         {
1426                 StopTouchPressedTimer();
1427         }
1428
1429         bool retVal = false;
1430
1431         if (&source == this)
1432         {
1433                 __itemSelected = false;
1434                 __drawingStatus = TABLE_VIEW_ITEM_DRAWING_STATUS_NORMAL;
1435
1436                 SetItemChanged(true);
1437                 Invalidate();
1438         }
1439         else if (&source == GetLabelCore(__pItemAnnex))
1440         {
1441                 if (__annexStyle == TABLE_VIEW_ANNEX_STYLE_DETAILED)
1442                 {
1443                         __isSelectedDetailButton = false;
1444                         DrawAnnexStyle();
1445                 }
1446                 else if(__annexStyle == TABLE_VIEW_ANNEX_STYLE_ONOFF_SLIDING ||
1447                         __annexStyle == TABLE_VIEW_ANNEX_STYLE_ONOFF_SLIDING_WITH_DIVIDER)
1448                 {
1449                         __annexOnOffHandlerMoved = true;
1450                         DrawAnnexOnOffHandler(touchinfo.GetCurrentPosition().x);  // +++ check floating
1451                         retVal = true;
1452                 }
1453                 else
1454                 {
1455                         __itemSelected = false;
1456                         __drawingStatus = TABLE_VIEW_ITEM_DRAWING_STATUS_NORMAL;
1457
1458                         SetItemChanged(true);
1459                         Invalidate();
1460                 }
1461         }
1462         else
1463         {
1464                 if(!IsIndividualSelectionEnabled(source))
1465                 {
1466                         __itemSelected = false;
1467                         __drawingStatus = TABLE_VIEW_ITEM_DRAWING_STATUS_NORMAL;
1468
1469                         SetItemChanged(true);
1470                         Invalidate();
1471                 }
1472         }
1473
1474         __itemTouchMoved = true;
1475
1476         return retVal;
1477 }
1478
1479 bool
1480 _TableViewItem::OnTouchCanceled(const _Control& source, const _TouchInfo& touchinfo)
1481 {
1482         if (__isPressedTimerEnabled)
1483         {
1484                 StopTouchPressedTimer();
1485         }
1486
1487         __annexOnOffHandlerMoved = false;
1488         __itemTouchMoved = false;
1489
1490         __itemSelected = false;
1491         __drawingStatus = TABLE_VIEW_ITEM_DRAWING_STATUS_NORMAL;
1492
1493         if (__annexStyle == TABLE_VIEW_ANNEX_STYLE_DETAILED)
1494         {
1495                 __isSelectedDetailButton = false;
1496         }
1497
1498         SetItemChanged(true);
1499         Invalidate();
1500
1501         if (&source != this)
1502         {
1503                 return false;
1504         }
1505
1506         return true;
1507 }
1508
1509 _UiTouchEventDelivery
1510 _TableViewItem::OnPreviewTouchPressed(const _Control& source, const _TouchInfo& touchinfo)
1511 {
1512
1513         return _UI_TOUCH_EVENT_DELIVERY_FORCED_YES;
1514 }
1515
1516 _UiTouchEventDelivery
1517 _TableViewItem::OnPreviewTouchReleased(const _Control& source, const _TouchInfo& touchinfo)
1518 {
1519         return _UI_TOUCH_EVENT_DELIVERY_FORCED_YES;
1520 }
1521
1522 _UiTouchEventDelivery
1523 _TableViewItem::OnPreviewTouchMoved(const _Control& source, const _TouchInfo& touchinfo)
1524 {
1525         return _UI_TOUCH_EVENT_DELIVERY_YES;
1526 }
1527
1528 _UiTouchEventDelivery
1529 _TableViewItem::OnPreviewTouchCanceled(const _Control& source, const _TouchInfo& touchinfo)
1530 {
1531         return _UI_TOUCH_EVENT_DELIVERY_FORCED_YES;
1532 }
1533
1534 void
1535 _TableViewItem::OnDraw(void)
1536 {
1537         if (IsItemChanged() == true)
1538         {
1539                 DrawItemBackground();
1540                 DrawAnnexStyle();
1541                 DrawItemDivider();
1542                 DrawSimpleItem();
1543                 DrawSectionStyleBackgroundCover();
1544
1545                 SetItemChanged(false);
1546         }
1547 }
1548
1549 void
1550 _TableViewItem::OnChildAttached(const _Control& child)
1551 {
1552         _AccessibilityContainer* pContainer = const_cast<_Control*>(&child)->GetAccessibilityContainer();
1553         pContainer->Activate(false);
1554
1555         _Control* pControl = const_cast<_Control*>(&child);
1556         pControl->SetTouchPressThreshold(SENSITIVE);
1557
1558         if ((__annexStyle == TABLE_VIEW_ANNEX_STYLE_MARK) || (__annexStyle == TABLE_VIEW_ANNEX_STYLE_RADIO))
1559         {
1560                 if (GetLabelCore(__pItemAnnex) == &child)
1561                 {
1562                         return;
1563                 }
1564
1565                 FloatRectangle bounds = child.GetBoundsF();
1566                 float leftMargin = 0.0f;
1567                 float annexWidth = 0.0f;
1568
1569                 GET_SHAPE_CONFIG(TABLEVIEW::ITEM_LEFT_MARGIN, _CONTROL_ORIENTATION_PORTRAIT, leftMargin);
1570                 GET_SHAPE_CONFIG(TABLEVIEW::ITEM_ANNEX_WIDTH, _CONTROL_ORIENTATION_PORTRAIT, annexWidth);
1571
1572                 bounds.x += (leftMargin * 2) + annexWidth;
1573                 pControl->SetBounds(bounds);
1574         }
1575 }
1576
1577 void
1578 _TableViewItem::OnChildDetached(const _Control& child)
1579 {
1580         if (__individualSelectionControls.Contains(child))
1581         {
1582                 __individualSelectionControls.Remove(child, false);
1583         }
1584
1585         _Label* pSimpleItemTextCore = GetLabelCore(__pSimpleItemText);
1586         _Label* pSimpleItemBitmapCore = GetLabelCore(__pSimpleItemBitmap);
1587
1588         if (&child == pSimpleItemTextCore)
1589         {
1590                 __pSimpleItemText = null;
1591         }
1592
1593         if (&child == pSimpleItemBitmapCore)
1594         {
1595                 __pSimpleItemBitmap = null;
1596         }
1597 }
1598
1599 void
1600 _TableViewItem::OnTimerExpired(Tizen::Base::Runtime::Timer& timer)
1601 {
1602         result r = E_SUCCESS;
1603
1604         if (&timer == __pCheckedTimer)
1605         {
1606                 if (__checkedCount < MAX_CHECKED_COUNT)
1607                 {
1608                         r = __pCheckedTimer->Start(CHECKED_ANIMATION_DURATION);
1609                         SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
1610                 }
1611
1612                 r = PlayCheckBoxAnimation();
1613                 SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
1614
1615                 if (__checkedCount < MAX_CHECKED_COUNT)
1616                 {
1617                         __checkedCount++;
1618                 }
1619                 else
1620                 {
1621                         __checkedCount = 0;
1622                         __isCheckedAnimationEnabled = false;
1623                         __isCheckedTimerEnabled = false;
1624                 }
1625         }
1626         else if (&timer == __pPressedTimer)
1627         {
1628                 __isPressedTimerEnabled = false;
1629                 FireItemTouchPressed();
1630         }
1631         else if(&timer == __pReleasedTimer)
1632         {
1633                 __isReleasedTimerEnabled = false;
1634                 FireItemTouchReleased();
1635         }
1636 }
1637
1638 result
1639 _TableViewItem::StartTouchPressedTimer(const _Control& source, const _TouchInfo& touchinfo)
1640 {
1641         result r = E_SUCCESS;
1642
1643         if (__pPressedTimer == null)
1644         {
1645                 __pPressedTimer = new (std::nothrow) Timer();
1646                 SysTryCatch(NID_UI_CTRL, __pPressedTimer != null, r = E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
1647
1648                 r = __pPressedTimer->Construct(*this);
1649                 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage);
1650         }
1651
1652         if (__isPressedTimerEnabled == false)
1653         {
1654                 r = __pPressedTimer->Start(TOUCH_PRESSED_DURATION);
1655                 SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage);
1656
1657                 __isPressedTimerEnabled = true;
1658         }
1659
1660         return r;
1661
1662 CATCH:
1663         if (__isPressedTimerEnabled && __pPressedTimer != null)
1664         {
1665                 __pPressedTimer->Cancel();
1666         }
1667
1668         delete __pPressedTimer;
1669         __pPressedTimer = null;
1670
1671         return r;
1672 }
1673
1674 void
1675 _TableViewItem::StopTouchPressedTimer(void)
1676 {
1677         result r = E_SUCCESS;
1678
1679         SysTryReturnVoidResult(NID_UI_CTRL, __pPressedTimer != null, E_SYSTEM, "[E_SYSTEM] Timer is invalid.");
1680
1681         if (__isPressedTimerEnabled)
1682         {
1683                 r = __pPressedTimer->Cancel();
1684                 SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
1685         }
1686
1687         __isPressedTimerEnabled = false;
1688
1689         return;
1690 }
1691
1692 result
1693 _TableViewItem::StartTouchReleasedTimer()
1694 {
1695         result r = E_SUCCESS;
1696
1697         if(__pReleasedTimer == null)
1698         {
1699                 __pReleasedTimer = new (std::nothrow) Timer();
1700                 SysTryCatch(NID_UI_CTRL, __pReleasedTimer != null, r = E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
1701
1702                 r = __pReleasedTimer->Construct(*this);
1703                 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage);
1704         }
1705
1706         if(!__isReleasedTimerEnabled)
1707         {
1708                 r = __pReleasedTimer->Start(TOUCH_RELEASED_DURATION);
1709                 SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage);
1710         }
1711         __isReleasedTimerEnabled = true;
1712
1713         return r;
1714
1715 CATCH:
1716         if (__isReleasedTimerEnabled && __pReleasedTimer != null)
1717         {
1718                 __pReleasedTimer->Cancel();
1719         }
1720
1721         delete __pReleasedTimer;
1722         __pReleasedTimer = null;
1723
1724         return r;
1725 }
1726
1727 void
1728 _TableViewItem::StopTouchReleasedTimer(void)
1729 {
1730         result r = E_SUCCESS;
1731
1732         SysTryReturnVoidResult(NID_UI_CTRL, __pReleasedTimer != null, E_SYSTEM, "[E_SYSTEM] Timer is invalid.");
1733
1734         if (__isReleasedTimerEnabled)
1735         {
1736                 r = __pReleasedTimer->Cancel();
1737                 SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
1738         }
1739
1740         __isReleasedTimerEnabled = false;
1741
1742         return;
1743 }
1744
1745 void
1746 _TableViewItem::OnAncestorInputEnableStateChanged(const _Control& control)
1747 {
1748         if (__isPressedTimerEnabled)
1749         {
1750                 StopTouchPressedTimer();
1751         }
1752
1753         __annexOnOffHandlerMoved = false;
1754         __itemTouchMoved = false;
1755
1756         __itemSelected = false;
1757         __drawingStatus = TABLE_VIEW_ITEM_DRAWING_STATUS_NORMAL;
1758
1759         if (__annexStyle == TABLE_VIEW_ANNEX_STYLE_DETAILED)
1760         {
1761                 __isSelectedDetailButton = false;
1762         }
1763
1764         SetItemChanged(true);
1765         Invalidate();
1766 }
1767
1768 result
1769 _TableViewItem::StartCheckBoxAnimation(void)
1770 {
1771         result r = E_SUCCESS;
1772
1773         if (__pCheckedTimer == null)
1774         {
1775                 __pCheckedTimer = new (std::nothrow) Timer();
1776                 SysTryCatch(NID_UI_CTRL, __pCheckedTimer != null, r = E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
1777
1778                 r = __pCheckedTimer->Construct(*this);
1779                 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage);
1780         }
1781
1782         if (__isCheckedTimerEnabled == false)
1783         {
1784                 r = __pCheckedTimer->Start(CHECKED_ANIMATION_DURATION);
1785                 SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage);
1786
1787                 __isCheckedTimerEnabled = true;
1788         }
1789
1790         return r;
1791
1792 CATCH:
1793         if (__isCheckedTimerEnabled)
1794         {
1795                 __pCheckedTimer->Cancel();
1796         }
1797
1798         delete __pCheckedTimer;
1799         __pCheckedTimer = null;
1800
1801         return r;
1802 }
1803
1804 void
1805 _TableViewItem::StopCheckBoxAnimation(void)
1806 {
1807         result r = E_SUCCESS;
1808
1809         SysTryReturnVoidResult(NID_UI_CTRL, __pCheckedTimer != null, E_SYSTEM, "[E_SYSTEM] Timer is invalid.");
1810
1811         if (__isCheckedTimerEnabled)
1812         {
1813                 r = __pCheckedTimer->Cancel();
1814                 SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
1815         }
1816
1817         __checkedCount = 0;
1818         __isCheckedAnimationEnabled = false;
1819         __isCheckedTimerEnabled = false;
1820
1821         return;
1822 }
1823
1824 result
1825 _TableViewItem::PlayCheckBoxAnimation(void)
1826 {
1827         Bitmap* pCheckBox = null;
1828         Bitmap* pCheckBoxBg = null;
1829         Bitmap* pMergeBitmap = null;
1830         Canvas* pCanvas = null;
1831         result r = E_SUCCESS;
1832
1833         FloatRectangle bounds;
1834
1835         float annexWidth = 0.0f;
1836         float annexHeight = 0.0f;
1837
1838         if (__drawingStatus == TABLE_VIEW_ITEM_DRAWING_STATUS_NORMAL)
1839         {
1840                 r = GET_BITMAP_CONFIG_N(TABLEVIEW::CHECKBOX_BG_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, pCheckBoxBg);
1841         }
1842         else if ((__drawingStatus == TABLE_VIEW_ITEM_DRAWING_STATUS_PRESSED) || (__drawingStatus == TABLE_VIEW_ITEM_DRAWING_STATUS_HIGHLIGHTED))
1843         {
1844                 r = GET_BITMAP_CONFIG_N(TABLEVIEW::CHECKBOX_BG_PRESSED, BITMAP_PIXEL_FORMAT_ARGB8888, pCheckBoxBg);
1845         }
1846         SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS) && (pCheckBoxBg != null), , E_SYSTEM, "[%s] Propagating.", GetErrorMessage(r));
1847
1848         r = GET_BITMAP_CONFIG_N(TABLEVIEW::CHECKBOX_CHECK_MARK_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, pCheckBox);
1849         SysTryCatch(NID_UI_CTRL,(r == E_SUCCESS) && (pCheckBox != null), , E_SYSTEM, "[%s] Propagating.", GetErrorMessage(r));
1850
1851         GET_SHAPE_CONFIG(TABLEVIEW::ITEM_ANNEX_WIDTH, _CONTROL_ORIENTATION_PORTRAIT, annexWidth);
1852         GET_SHAPE_CONFIG(TABLEVIEW::ITEM_ANNEX_HEIGHT, _CONTROL_ORIENTATION_PORTRAIT, annexHeight);
1853
1854         bounds.SetBounds(0, 0, annexWidth, annexHeight);
1855
1856         pCanvas = new (std::nothrow) Canvas();
1857         SysTryCatch(NID_UI_CTRL, pCanvas != null, , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient.");
1858
1859         r = pCanvas->Construct(bounds);
1860         pCanvas->SetBackgroundColor(Color(0, 0, 0, 0));
1861         pCanvas->Clear();
1862
1863         DrawBitmap(*pCanvas, CalculateAnnexBitmapBounds(annexWidth, annexHeight, *pCheckBoxBg), *pCheckBoxBg);
1864
1865         __checkedBounds = CalculateAnnexBitmapBounds(annexWidth, annexHeight, *pCheckBox);
1866         if (IsChecked() == true)
1867         {
1868                 if (_BitmapImpl::CheckNinePatchedBitmapStrictly(*pCheckBox))
1869                 {
1870                         FloatRectangle drawingRect(__checkedBounds.x, __checkedBounds.y, __checkedBounds.width, __checkedBounds.height);
1871                         r = pCanvas->DrawNinePatchedBitmap(drawingRect, *pCheckBox); // +++ check floating
1872                 }
1873                 else
1874                 {
1875                         FloatRectangle bitmapSourceRect(0.0f, 0.0f, pCheckBox->GetWidthF()*__checkedCount * 0.1, pCheckBox->GetHeightF());
1876                         FloatRectangle drawingRect(__checkedBounds.x, __checkedBounds.y, __checkedBounds.width * __checkedCount * 0.1, __checkedBounds.height);
1877                         r = pCanvas->DrawBitmap(drawingRect, *pCheckBox, bitmapSourceRect); // +++ check floating
1878                 }
1879         }
1880
1881         pMergeBitmap = new (std::nothrow) Bitmap();
1882         SysTryCatch(NID_UI_CTRL, pMergeBitmap != null, , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient.");
1883
1884         pMergeBitmap->Construct(*pCanvas, bounds);
1885         _BitmapImpl::ConvertToNonpremultiplied(*pMergeBitmap, true);
1886
1887         if(__pItemAnnex)
1888         {
1889                 __pItemAnnex->SetBackgroundBitmap(*pMergeBitmap);
1890                 __pItemAnnex->Invalidate(false);
1891         }
1892
1893 CATCH:
1894         delete pCheckBox;
1895         delete pCheckBoxBg;
1896         delete pMergeBitmap;
1897         delete pCanvas;
1898
1899         return r;
1900 }
1901
1902 void
1903 _TableViewItem::SetItemLayoutEnabled(bool enabled)
1904 {
1905         __isItemLayoutEnabled = enabled;
1906 }
1907
1908 bool
1909 _TableViewItem::GetItemLayoutEnabled(void)
1910 {
1911         return __isItemLayoutEnabled;
1912 }
1913
1914 void
1915 _TableViewItem::OnBoundsChanged(void)
1916 {
1917         if (__checkItemHeightNeeded && HasParent())
1918         {
1919                 _TableView* pParent = dynamic_cast<_TableView*>(GetParent());
1920                 if (pParent != null)
1921                 {
1922                         int groupIndex = -1;
1923                         int itemIndex = -1;
1924                         GetItemIndex(groupIndex, itemIndex);
1925
1926                         pParent->CheckItemHeightAndRefreshLayout(groupIndex, itemIndex);
1927                 }
1928
1929                 __checkItemHeightNeeded = false;
1930         }
1931
1932         AdjustAnnexBounds();
1933
1934         SetItemHighlightBounds(*__pHighlightVisualElement, CalculateItemHighlightBounds());
1935
1936         if (__pHeaderFooterItemText != null)
1937         {
1938                 FloatRectangle textBounds = __pHeaderFooterItemText->GetBoundsF();
1939                 textBounds.width = GetBoundsF().width;
1940
1941                 __pHeaderFooterItemText->SetBounds(textBounds);
1942         }
1943
1944         if(__pBitmapVisualElement != null)
1945         {
1946                 FloatRectangle bounds = GetBoundsF();
1947                 __pBitmapVisualElement->SetBounds(FloatRectangle(0.0f, 0.0f, bounds.width, bounds.height));
1948         }
1949
1950         if(__pAccessibilityElement != null)
1951         {
1952                 __pAccessibilityElement->SetBounds(FloatRectangle(0.0f,0.0f, GetBoundsF().width, GetBoundsF().height));
1953         }
1954 }
1955
1956 void
1957 _TableViewItem::SetDrawingProperty(_ItemDrawingProperty* pDrawingProperty)
1958 {
1959
1960         SysTryReturnVoidResult(NID_UI_CTRL, pDrawingProperty != null, E_INVALID_ARG, "[E_INAVLID_ARG] pDrawingProperty is null");
1961
1962         __pDrawingProperty = pDrawingProperty;
1963
1964         if(__pDrawingProperty != null)
1965         {
1966                 if (__pDrawingProperty->sectionStyleEnabled == true &&
1967                         !IsContextItem())
1968                 {
1969                         CreateItemCover();
1970                 }
1971
1972                 if(__pDrawingProperty->itemDividerEnabled)
1973                 {
1974                         CreateItemDivider();
1975                 }
1976         }
1977
1978         CreateAnnexStyle();
1979 }
1980
1981 _ItemDrawingProperty*
1982 _TableViewItem::GetDrawingProperty(void)
1983 {
1984         return __pDrawingProperty;
1985 }
1986
1987 void
1988 _TableViewItem::DrawItemBackground(void)
1989 {
1990         Canvas* pCanvas = null;
1991         Bitmap* pDrawBitmap = __pItemBgBitmap[__drawingStatus];
1992         Color bgColor = __colorItemBg[__drawingStatus];
1993         FloatRectangle bounds = GetBoundsF();
1994
1995         SetItemHighlightBounds(*__pHighlightVisualElement, CalculateItemHighlightBounds());
1996
1997         if(__pBitmapVisualElement != null)
1998         {
1999                 pCanvas = __pBitmapVisualElement->GetCanvasN();
2000                 SysTryCatch(NID_UI_CTRL, pCanvas != null, , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient.");
2001                 pCanvas->SetBackgroundColor(Color(0, 0, 0, 0));
2002                 pCanvas->Clear();
2003         }
2004
2005         if(pDrawBitmap != null && __enabledState)
2006         {
2007                 if(pCanvas != null)
2008                 {
2009                         __pHighlightVisualElement->SetBackgroundColor(_Colorf(0.0f, 0.0f, 0.0f, 0.0f));
2010                         DrawBitmap(*pCanvas, FloatRectangle(0.0f, 0.0f, bounds.width, bounds.height), *pDrawBitmap);
2011                 }
2012         }
2013
2014         if(IsContextItem())
2015         {
2016                 DrawContextItemBackground();
2017         }
2018         else if (__pDrawingProperty->sectionStyleEnabled == true)
2019         {
2020                 DrawSectionStyleBackground();
2021         }
2022         else
2023         {
2024                 if(__enabledState)
2025                 {
2026                         if (__itemType == TABLE_VIEW_ITEM_TYPE_HEADER || __itemType == TABLE_VIEW_ITEM_TYPE_FOOTER)
2027                         {
2028                                 SetBackgroundColor(Color(0, 0, 0, 0));
2029                                 __pHighlightVisualElement->SetBackgroundColor(_Colorf(0.0f, 0.0f, 0.0f, 0.0f));
2030                         }
2031                         else if(__itemType == TABLE_VIEW_ITEM_TYPE_TITLE)
2032                         {
2033                                 __pHighlightVisualElement->SetBackgroundColor(_Colorf((float)bgColor.GetRed() / 255.0f, (float)bgColor.GetGreen() / 255.0f, (float)bgColor.GetBlue() / 255.0f, (float)bgColor.GetAlpha() / 255.0f));
2034                         }
2035                         else
2036                         {
2037                                 SetBackgroundColor(__colorItemBg[TABLE_VIEW_ITEM_DRAWING_STATUS_NORMAL]);
2038
2039                                 __pHighlightVisualElement->SetBackgroundColor(_Colorf((float)bgColor.GetRed() / 255.0f, (float)bgColor.GetGreen() / 255.0f, (float)bgColor.GetBlue() / 255.0f, (float)bgColor.GetAlpha() / 255.0f));
2040
2041                                 if (__pDrawingProperty->groupedLookEnabled == true)
2042                                 {
2043                                         DrawGroupedLook();
2044                                 }
2045                         }
2046                 }
2047                 else
2048                 {
2049                         GET_COLOR_CONFIG(TABLEVIEW::ITEM_BG_DISABLED, bgColor);
2050                         SetBackgroundColor(bgColor);
2051                         __pHighlightVisualElement->SetBackgroundColor(_Colorf((float)bgColor.GetRed() / 255.0f, (float)bgColor.GetGreen() / 255.0f, (float)bgColor.GetBlue() / 255.0f, (float)bgColor.GetAlpha() / 255.0f));
2052
2053                         if (__pDrawingProperty->groupedLookEnabled == true)
2054                         {
2055                                 DrawGroupedLook();
2056                         }
2057                 }
2058         }
2059
2060         delete pCanvas;
2061         return;
2062
2063 CATCH:
2064
2065         if (__pBitmapVisualElement != null)
2066         {
2067                 __pBitmapVisualElement->RemoveAllAnimations();
2068                 __pBitmapVisualElement->SetAnimationProvider(null);
2069                 __pBitmapVisualElement->Destroy();
2070                 __pBitmapVisualElement = null;
2071         }
2072 }
2073
2074 void
2075 _TableViewItem::DrawGroupedLook(void)
2076 {
2077         if (IsTitleStyleItem() || IsContextItem())
2078         {
2079                 return;
2080         }
2081
2082         Color barColor;
2083         Color outlineColor = __pDrawingProperty->dividerColor;
2084
2085         float barWidth = 0.0f;
2086
2087         Canvas* pCanvas = GetVisualElement()->GetCanvasN();
2088         SysTryReturnVoidResult(NID_UI_CTRL, pCanvas != null, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
2089
2090         FloatRectangle bounds = GetBoundsF();
2091         pCanvas->SetBackgroundColor(GetBackgroundColor());
2092         pCanvas->Clear();
2093
2094         GET_COLOR_CONFIG(TABLEVIEW::GROUPITEM_BAR_NORMAL, barColor);
2095         GET_SHAPE_CONFIG(TABLEVIEW::GROUPITEM_BAR_WIDTH, _CONTROL_ORIENTATION_PORTRAIT, barWidth);
2096
2097         pCanvas->FillRectangle(barColor, FloatRectangle(0.0f, 0.0f, barWidth, bounds.height));
2098
2099         if (__pDrawingProperty->sectionStyleEnabled == true)
2100         {
2101                 pCanvas->FillRectangle(outlineColor, FloatRectangle(bounds.width - 1.0f, 0.0f, 1.0f, bounds.height));
2102
2103                 if (__itemType == TABLE_VIEW_ITEM_TYPE_TOP || __itemType == TABLE_VIEW_ITEM_TYPE_ONE)
2104                 {
2105                         pCanvas->FillRectangle(outlineColor, FloatRectangle(0.0f, 0.0f, bounds.width, 1.0f));
2106                 }
2107         }
2108
2109         delete pCanvas;
2110 }
2111
2112 void
2113 _TableViewItem::DrawSectionStyleBackground(void)
2114 {
2115         Canvas* pCanvas = null;
2116         Bitmap* pSectionBg = null;
2117         Bitmap* pSectionPressBg = null;
2118         Bitmap* pSectionDisabledBg = null;
2119         Bitmap* pReplacementSectionPressBg = null;
2120         Bitmap* pReplacementSectionBg = null;
2121         Color bgColor = __colorItemBg[__drawingStatus];
2122         FloatRectangle bounds = GetBoundsF();
2123         float dividerHeight = 0.0f;
2124
2125         result r = E_SUCCESS;
2126
2127         pCanvas = GetVisualElement()->GetCanvasN();
2128         SysTryReturnVoidResult(NID_UI_CTRL, pCanvas != null, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
2129
2130         pCanvas->SetBackgroundColor(Color(0, 0, 0, 0));
2131         pCanvas->Clear();
2132
2133         if (__itemType == TABLE_VIEW_ITEM_TYPE_ONE)
2134         {
2135                 r = GET_BITMAP_CONFIG_N(TABLEVIEW::SECTIONITEM_SINGLE_BG_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, pSectionBg);
2136         }
2137         else if (__itemType == TABLE_VIEW_ITEM_TYPE_TOP)
2138         {
2139                 r = GET_BITMAP_CONFIG_N(TABLEVIEW::SECTIONITEM_TOP_BG_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, pSectionBg);
2140         }
2141         else if (__itemType == TABLE_VIEW_ITEM_TYPE_MIDDLE)
2142         {
2143                 r = GET_BITMAP_CONFIG_N(TABLEVIEW::SECTIONITEM_CENTER_BG_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, pSectionBg);
2144         }
2145         else if (__itemType == TABLE_VIEW_ITEM_TYPE_BOTTOM)
2146         {
2147                 r = GET_BITMAP_CONFIG_N(TABLEVIEW::SECTIONITEM_BOTTOM_BG_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, pSectionBg);
2148         }
2149         else
2150         {
2151                 r = E_SYSTEM;
2152         }
2153         SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , E_SYSTEM, "[E_SYSTEM] SectionStyle image load failed");
2154
2155         if (__enabledState)
2156         {
2157                 if(__drawingStatus == TABLE_VIEW_ITEM_DRAWING_STATUS_PRESSED || __drawingStatus == TABLE_VIEW_ITEM_DRAWING_STATUS_HIGHLIGHTED)
2158                 {
2159                         if (__itemType == TABLE_VIEW_ITEM_TYPE_ONE)
2160                         {
2161                                 if(IS_CUSTOM_BITMAP(TABLEVIEW::SECTIONITEM_SINGLE_BG_PRESSED))
2162                                 {
2163                                         r = GET_BITMAP_CONFIG_N(TABLEVIEW::SECTIONITEM_SINGLE_BG_PRESSED, BITMAP_PIXEL_FORMAT_ARGB8888, pSectionPressBg);
2164                                         SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , E_SYSTEM, "[E_SYSTEM] SectionStyle image load failed");
2165                                 }
2166                         }
2167                         else if (__itemType == TABLE_VIEW_ITEM_TYPE_TOP)
2168                         {
2169                                 if(IS_CUSTOM_BITMAP(TABLEVIEW::SECTIONITEM_TOP_BG_PRESSED))
2170                                 {
2171                                         r = GET_BITMAP_CONFIG_N(TABLEVIEW::SECTIONITEM_TOP_BG_PRESSED, BITMAP_PIXEL_FORMAT_ARGB8888, pSectionPressBg);
2172                                         SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , E_SYSTEM, "[E_SYSTEM] SectionStyle image load failed");
2173                                 }
2174                         }
2175                         else if (__itemType == TABLE_VIEW_ITEM_TYPE_MIDDLE)
2176                         {
2177                                 if(IS_CUSTOM_BITMAP(TABLEVIEW::SECTIONITEM_CENTER_BG_PRESSED))
2178                                 {
2179                                         r = GET_BITMAP_CONFIG_N(TABLEVIEW::SECTIONITEM_CENTER_BG_PRESSED, BITMAP_PIXEL_FORMAT_ARGB8888, pSectionPressBg);
2180                                         SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , E_SYSTEM, "[E_SYSTEM] SectionStyle image load failed");
2181                                 }
2182                         }
2183                         else if (__itemType == TABLE_VIEW_ITEM_TYPE_BOTTOM)
2184                         {
2185                                 if(IS_CUSTOM_BITMAP(TABLEVIEW::SECTIONITEM_BOTTOM_BG_PRESSED))
2186                                 {
2187                                         r = GET_BITMAP_CONFIG_N(TABLEVIEW::SECTIONITEM_BOTTOM_BG_PRESSED, BITMAP_PIXEL_FORMAT_ARGB8888, pSectionPressBg);
2188                                         SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , E_SYSTEM, "[E_SYSTEM] SectionStyle image load failed");
2189                                 }
2190                         }
2191
2192                         GET_FIXED_VALUE_CONFIG(TABLEVIEW::ITEM_DIVIDER_HEIGHT, _CONTROL_ORIENTATION_PORTRAIT, dividerHeight);
2193
2194                         if(pSectionPressBg)
2195                         {
2196                                 pReplacementSectionPressBg = Tizen::Graphics::_BitmapImpl::GetColorReplacedBitmapN(*pSectionPressBg, Color::GetColor(COLOR_ID_MAGENTA), bgColor);
2197                         }
2198                         else
2199                         {
2200                                 pReplacementSectionPressBg = Tizen::Graphics::_BitmapImpl::GetColorReplacedBitmapN(*pSectionBg, Color::GetColor(COLOR_ID_MAGENTA), bgColor);
2201                         }
2202
2203                         DrawBitmap(*pCanvas, FloatRectangle(0.0f, dividerHeight, bounds.width, bounds.height - (dividerHeight * 2)), *pReplacementSectionPressBg);
2204                 }
2205                 else
2206                 {
2207                         if(bgColor != null)
2208                         {
2209                                 pReplacementSectionBg = Tizen::Graphics::_BitmapImpl::GetColorReplacedBitmapN(*pSectionBg, Color::GetColor(COLOR_ID_MAGENTA), bgColor);
2210                         }
2211                         else
2212                         {
2213                                 pReplacementSectionBg = Tizen::Graphics::_BitmapImpl::GetColorReplacedBitmapN(*pSectionBg, Color::GetColor(COLOR_ID_MAGENTA), __pDrawingProperty->sectionStyleBgColor);
2214                         }
2215
2216                         DrawBitmap(*pCanvas, FloatRectangle(0.0f, 0.0f, bounds.width, bounds.height), *pReplacementSectionBg);
2217                 }
2218         }
2219         else
2220         {
2221                 if (__itemType == TABLE_VIEW_ITEM_TYPE_ONE)
2222                 {
2223                         if(IS_CUSTOM_BITMAP(TABLEVIEW::SECTIONITEM_SINGLE_BG_DISABLED))
2224                         {
2225                                 r = GET_BITMAP_CONFIG_N(TABLEVIEW::SECTIONITEM_SINGLE_BG_DISABLED, BITMAP_PIXEL_FORMAT_ARGB8888, pSectionDisabledBg);
2226                                 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , E_SYSTEM, "[E_SYSTEM] SectionStyle image load failed");
2227                         }
2228                 }
2229                 else if (__itemType == TABLE_VIEW_ITEM_TYPE_TOP)
2230                 {
2231                         if(IS_CUSTOM_BITMAP(TABLEVIEW::SECTIONITEM_TOP_BG_DISABLED))
2232                         {
2233                                 r = GET_BITMAP_CONFIG_N(TABLEVIEW::SECTIONITEM_TOP_BG_DISABLED, BITMAP_PIXEL_FORMAT_ARGB8888, pSectionDisabledBg);
2234                                 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , E_SYSTEM, "[E_SYSTEM] SectionStyle image load failed");
2235                         }
2236                 }
2237                 else if (__itemType == TABLE_VIEW_ITEM_TYPE_MIDDLE)
2238                 {
2239                         if(IS_CUSTOM_BITMAP(TABLEVIEW::SECTIONITEM_CENTER_BG_DISABLED))
2240                         {
2241                                 r = GET_BITMAP_CONFIG_N(TABLEVIEW::SECTIONITEM_CENTER_BG_DISABLED, BITMAP_PIXEL_FORMAT_ARGB8888, pSectionDisabledBg);
2242                                 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , E_SYSTEM, "[E_SYSTEM] SectionStyle image load failed");
2243                         }
2244                 }
2245                 else if (__itemType == TABLE_VIEW_ITEM_TYPE_BOTTOM)
2246                 {
2247                         if(IS_CUSTOM_BITMAP(TABLEVIEW::SECTIONITEM_BOTTOM_BG_DISABLED))
2248                         {
2249                                 r = GET_BITMAP_CONFIG_N(TABLEVIEW::SECTIONITEM_BOTTOM_BG_DISABLED, BITMAP_PIXEL_FORMAT_ARGB8888, pSectionDisabledBg);
2250                                 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , E_SYSTEM, "[E_SYSTEM] SectionStyle image load failed");
2251                         }
2252                 }
2253
2254                 GET_COLOR_CONFIG(TABLEVIEW::ITEM_BG_DISABLED, bgColor);
2255                 if(pSectionDisabledBg)
2256                 {
2257                         pReplacementSectionBg = Tizen::Graphics::_BitmapImpl::GetColorReplacedBitmapN(*pSectionDisabledBg, Color::GetColor(COLOR_ID_MAGENTA), bgColor);
2258                 }
2259                 else
2260                 {
2261                         pReplacementSectionBg = Tizen::Graphics::_BitmapImpl::GetColorReplacedBitmapN(*pSectionBg, Color::GetColor(COLOR_ID_MAGENTA), bgColor);
2262                 }
2263                 DrawBitmap(*pCanvas, FloatRectangle(0.0f, 0.0f, bounds.width, bounds.height), *pReplacementSectionBg);
2264         }
2265
2266         if (__pDrawingProperty->groupedLookEnabled == true)
2267         {
2268                 Color barColor;
2269
2270                 float barWidth = 0.0f;
2271                 float barMargin = 0.0f;
2272
2273                 GET_COLOR_CONFIG(TABLEVIEW::GROUPITEM_BAR_NORMAL, barColor);
2274                 GET_SHAPE_CONFIG(TABLEVIEW::GROUPITEM_BAR_WIDTH, _CONTROL_ORIENTATION_PORTRAIT, barWidth);
2275                 GET_SHAPE_CONFIG(TABLEVIEW::GROUPITEM_BAR_TOP_MARGIN, _CONTROL_ORIENTATION_PORTRAIT, barMargin);
2276
2277                 pCanvas->FillRectangle(barColor, FloatRectangle(0.0f, barMargin, barWidth, bounds.height-barMargin));
2278         }
2279
2280 CATCH:
2281         delete pSectionBg;
2282         delete pSectionPressBg;
2283         delete pSectionDisabledBg;
2284         delete pReplacementSectionPressBg;
2285         delete pReplacementSectionBg;
2286         delete pCanvas;
2287 }
2288
2289 void
2290 _TableViewItem::DrawSectionStyleBackgroundCover(void)
2291 {
2292         if (!__pDrawingProperty->sectionStyleEnabled ||
2293                 __pItemCover == null)
2294         {
2295                 return;
2296         }
2297
2298         Bitmap* pSectionBgCoverEf = null;
2299         Bitmap* pReplacementSectionBgEf = null;
2300         Bitmap* pReplacementSectionBg = null;
2301         Bitmap* pSectionBgCoverBg = null;
2302         Bitmap* pMergeBitmap = null;
2303         Canvas* pCanvas = null;
2304         Color bgColor;
2305
2306         result r = E_SUCCESS;
2307         FloatRectangle bounds = GetBoundsF();
2308         if (__itemType == TABLE_VIEW_ITEM_TYPE_ONE)
2309         {
2310                 r = GET_BITMAP_CONFIG_N(TABLEVIEW::SECTIONITEM_SINGLE_COVER_BG_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, pSectionBgCoverEf);
2311         }
2312         else if (__itemType == TABLE_VIEW_ITEM_TYPE_TOP)
2313         {
2314                 r = GET_BITMAP_CONFIG_N(TABLEVIEW::SECTIONITEM_TOP_COVER_BG_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, pSectionBgCoverEf);
2315         }
2316         else if (__itemType == TABLE_VIEW_ITEM_TYPE_MIDDLE)
2317         {
2318                 r = GET_BITMAP_CONFIG_N(TABLEVIEW::SECTIONITEM_CENTER_COVER_BG_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, pSectionBgCoverEf);
2319         }
2320         else if (__itemType == TABLE_VIEW_ITEM_TYPE_BOTTOM)
2321         {
2322                 r = GET_BITMAP_CONFIG_N(TABLEVIEW::SECTIONITEM_BOTTOM_COVER_BG_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, pSectionBgCoverEf);
2323         }
2324         else
2325         {
2326                 r = E_SYSTEM;
2327         }
2328         SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , E_SYSTEM, "[E_SYSTEM] SectionStyle image load failed");
2329
2330         if (__itemType == TABLE_VIEW_ITEM_TYPE_ONE)
2331         {
2332                 r = GET_BITMAP_CONFIG_N(TABLEVIEW::SECTIONITEM_SINGLE_COVER_ROUND_BG_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, pSectionBgCoverBg);
2333         }
2334         else if (__itemType == TABLE_VIEW_ITEM_TYPE_TOP)
2335         {
2336                 r = GET_BITMAP_CONFIG_N(TABLEVIEW::SECTIONITEM_TOP_COVER_ROUND_BG_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, pSectionBgCoverBg);
2337         }
2338         else if (__itemType == TABLE_VIEW_ITEM_TYPE_MIDDLE)
2339         {
2340                 r = GET_BITMAP_CONFIG_N(TABLEVIEW::SECTIONITEM_CENTER_COVER_ROUND_BG_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, pSectionBgCoverBg);
2341         }
2342         else if (__itemType == TABLE_VIEW_ITEM_TYPE_BOTTOM)
2343         {
2344                 r = GET_BITMAP_CONFIG_N(TABLEVIEW::SECTIONITEM_BOTTOM_COVER_ROUND_BG_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, pSectionBgCoverBg);
2345         }
2346         else
2347         {
2348                 r = E_SYSTEM;
2349         }
2350         SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , E_SYSTEM, "[E_SYSTEM] SectionStyle image load failed");
2351
2352         __pItemCover->SetBounds(FloatRectangle(0.0f, 0.0f, bounds.width, bounds.height));
2353
2354         if (__enabledState)
2355         {
2356                 _TableView* pParent = dynamic_cast<_TableView*>(GetParent());
2357                 SysTryCatch(NID_UI_CTRL, pParent != null, , E_SYSTEM, "[E_SYSTEM] SectionTableView load failed");
2358
2359                 bgColor = pParent->GetBackgroundColor();
2360         }
2361         else
2362         {
2363                 GET_COLOR_CONFIG(TABLEVIEW::ITEM_BG_DISABLED, bgColor);
2364         }
2365
2366         pReplacementSectionBg = Tizen::Graphics::_BitmapImpl::GetColorReplacedBitmapN(*pSectionBgCoverBg, Color::GetColor(COLOR_ID_MAGENTA), bgColor);
2367         pReplacementSectionBgEf = Tizen::Graphics::_BitmapImpl::GetColorReplacedBitmapN(*pSectionBgCoverEf, Color::GetColor(COLOR_ID_MAGENTA), bgColor);
2368
2369         pCanvas = new (std::nothrow) Canvas();
2370         SysTryCatch(NID_UI_CTRL, pCanvas != null, , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient.");
2371
2372         pCanvas->Construct(FloatRectangle(0.0f, 0.0f, bounds.width, bounds.height));
2373         pCanvas->SetBackgroundColor(Color(0, 0, 0, 0));
2374         pCanvas->Clear();
2375
2376         DrawBitmap(*pCanvas, FloatRectangle(0.0f, 0.0f, bounds.width, bounds.height), *pReplacementSectionBg);
2377         DrawBitmap(*pCanvas, FloatRectangle(0.0f, 0.0f, bounds.width, bounds.height), *pReplacementSectionBgEf);
2378
2379         pMergeBitmap = new (std::nothrow) Bitmap();
2380         SysTryCatch(NID_UI_CTRL, pMergeBitmap != null, , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient.");
2381
2382         pMergeBitmap->Construct(*pCanvas, FloatRectangle(0.0f, 0.0f, bounds.width, bounds.height));
2383
2384         _BitmapImpl::ConvertToNonpremultiplied(*pMergeBitmap, true);
2385
2386         __pItemCover->SetBackgroundBitmap(*pMergeBitmap);
2387
2388 CATCH:
2389         delete pSectionBgCoverEf;
2390         delete pReplacementSectionBgEf;
2391         delete pReplacementSectionBg;
2392         delete pSectionBgCoverBg;
2393         delete pCanvas;
2394         delete pMergeBitmap;
2395 }
2396
2397 void
2398 _TableViewItem::DrawContextItemBackground(void)
2399 {
2400         Canvas* pCanvas = null;
2401         Bitmap* pContextBg = null;
2402         Bitmap* pContextBgEf = null;
2403         Bitmap* pReplacementContextBg = null;
2404         Color bgColor = __colorItemBg[__drawingStatus];
2405
2406         FloatRectangle bounds = GetBoundsF();
2407         result r = E_SUCCESS;
2408
2409         r = GET_BITMAP_CONFIG_N(TABLEVIEW::QUICK_MENU_BG_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, pContextBg);
2410         SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , E_SYSTEM, "[E_SYSTEM] ContextItem image load failed");
2411
2412         r = GET_BITMAP_CONFIG_N(TABLEVIEW::QUICK_MENU_BG_EFFECT, BITMAP_PIXEL_FORMAT_ARGB8888, pContextBgEf);
2413         SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , E_SYSTEM, "[E_SYSTEM] ContextItem image load failed");
2414
2415         pCanvas = GetVisualElement()->GetCanvasN();
2416         SysTryCatch(NID_UI_CTRL, pCanvas != null, , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient.");
2417
2418         pCanvas->SetBackgroundColor(Color(0, 0, 0, 0));
2419         pCanvas->Clear();
2420
2421         if(__enabledState)
2422         {
2423                 if(bgColor == null)
2424                 {
2425                         GET_COLOR_CONFIG(TABLEVIEW::CONTEXTITEM_BG_NORMAL, bgColor);
2426                 }
2427         }
2428         else
2429         {
2430                 GET_COLOR_CONFIG(TABLEVIEW::ITEM_BG_DISABLED, bgColor);
2431         }
2432         pReplacementContextBg = Tizen::Graphics::_BitmapImpl::GetColorReplacedBitmapN(*pContextBg, Color::GetColor(COLOR_ID_MAGENTA), bgColor);
2433         SysTryCatch(NID_UI_CTRL, pReplacementContextBg != null, , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient.");
2434
2435         DrawBitmap(*pCanvas, FloatRectangle(0.0f, 0.0f, bounds.width, bounds.height), *pReplacementContextBg);
2436         DrawBitmap(*pCanvas, FloatRectangle(0.0f, 0.0f, bounds.width, bounds.height), *pContextBgEf);
2437
2438 CATCH:
2439         delete pCanvas;
2440         delete pContextBg;
2441         delete pContextBgEf;
2442         delete pReplacementContextBg;
2443 }
2444
2445
2446 void
2447 _TableViewItem::CreateAnnexStyle(void)
2448 {
2449         switch (__annexStyle)
2450         {
2451         case TABLE_VIEW_ANNEX_STYLE_MARK:
2452                 CreateCheckBox();
2453                 break;
2454         case TABLE_VIEW_ANNEX_STYLE_RADIO:
2455                 CreateRadioBox();
2456                 break;
2457         case TABLE_VIEW_ANNEX_STYLE_ONOFF_SLIDING:
2458                 CreateOnOffButton();
2459                 break;
2460         case TABLE_VIEW_ANNEX_STYLE_ONOFF_SLIDING_WITH_DIVIDER:
2461                 CreateItemAnnexDivider();
2462                 CreateOnOffButton();
2463                 break;
2464         case TABLE_VIEW_ANNEX_STYLE_DETAILED:
2465                 CreateDetailButton();
2466                 break;
2467         default:
2468                 break;
2469         }
2470 }
2471
2472 void
2473 _TableViewItem::DrawAnnexStyle(void)
2474 {
2475         switch (__annexStyle)
2476         {
2477         case TABLE_VIEW_ANNEX_STYLE_MARK:
2478                 DrawCheckBox();
2479                 break;
2480         case TABLE_VIEW_ANNEX_STYLE_RADIO:
2481                 DrawRadioBox();
2482                 break;
2483         case TABLE_VIEW_ANNEX_STYLE_ONOFF_SLIDING:
2484                 DrawOnOffButton();
2485                 break;
2486         case TABLE_VIEW_ANNEX_STYLE_ONOFF_SLIDING_WITH_DIVIDER:
2487                 DrawItemAnnexDivider();
2488                 DrawOnOffButton();
2489                 break;
2490         case TABLE_VIEW_ANNEX_STYLE_DETAILED:
2491                 DrawDetailButton();
2492                 break;
2493         default:
2494                 break;
2495         }
2496 }
2497
2498 void
2499 _TableViewItem::DrawCheckBox(void)
2500 {
2501         Bitmap* pCheckBox = null;
2502         Bitmap* pCheckBoxBg = null;
2503         Bitmap* pMergeBitmap = null;
2504         Canvas* pCanvas = null;
2505         result r = E_SUCCESS;
2506
2507         FloatRectangle bounds;
2508         float annexWidth = 0.0f;
2509         float annexHeight = 0.0f;
2510
2511         if(__enabledState)
2512         {
2513                 if (__drawingStatus == TABLE_VIEW_ITEM_DRAWING_STATUS_NORMAL)
2514                 {
2515                         r = GET_BITMAP_CONFIG_N(TABLEVIEW::CHECKBOX_BG_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, pCheckBoxBg);
2516                         SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS) && (pCheckBoxBg != null), , E_SYSTEM, "[%s] Propagating.", GetErrorMessage(r));
2517
2518                         r = GET_BITMAP_CONFIG_N(TABLEVIEW::CHECKBOX_CHECK_MARK_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, pCheckBox);
2519                         SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS) && (pCheckBox != null), , E_SYSTEM, "[%s] Propagating.", GetErrorMessage(r));
2520                 }
2521                 else if ((__drawingStatus == TABLE_VIEW_ITEM_DRAWING_STATUS_PRESSED) || (__drawingStatus == TABLE_VIEW_ITEM_DRAWING_STATUS_HIGHLIGHTED))
2522                 {
2523                         r = GET_BITMAP_CONFIG_N(TABLEVIEW::CHECKBOX_BG_PRESSED, BITMAP_PIXEL_FORMAT_ARGB8888, pCheckBoxBg);
2524                         SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS) && (pCheckBoxBg != null), , E_SYSTEM, "[%s] Propagating.", GetErrorMessage(r));
2525
2526                         r = GET_BITMAP_CONFIG_N(TABLEVIEW::CHECKBOX_CHECK_MARK_PRESSED, BITMAP_PIXEL_FORMAT_ARGB8888, pCheckBox);
2527                         SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS) && (pCheckBox != null), , E_SYSTEM, "[%s] Propagating.", GetErrorMessage(r));
2528                 }
2529
2530         }
2531         else
2532         {
2533                 r = GET_BITMAP_CONFIG_N(TABLEVIEW::CHECKBOX_BG_DISABLED, BITMAP_PIXEL_FORMAT_ARGB8888, pCheckBoxBg);
2534                 SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS) && (pCheckBoxBg != null), , E_SYSTEM, "[%s] Propagating.", GetErrorMessage(r));
2535
2536                 r = GET_BITMAP_CONFIG_N(TABLEVIEW::CHECKBOX_CHECK_MARK_DISABLED, BITMAP_PIXEL_FORMAT_ARGB8888, pCheckBox);
2537                 SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS) && (pCheckBox != null), , E_SYSTEM, "[%s] Propagating.", GetErrorMessage(r));
2538         }
2539
2540         GET_SHAPE_CONFIG(TABLEVIEW::ITEM_ANNEX_WIDTH, _CONTROL_ORIENTATION_PORTRAIT, annexWidth);
2541         GET_SHAPE_CONFIG(TABLEVIEW::ITEM_ANNEX_HEIGHT, _CONTROL_ORIENTATION_PORTRAIT, annexHeight);
2542
2543         bounds.SetBounds(0.0f, 0.0f, annexWidth, annexHeight);
2544
2545         pCanvas = new (std::nothrow) Canvas();
2546         SysTryCatch(NID_UI_CTRL, pCanvas != null, , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient.");
2547
2548         pCanvas->Construct(bounds);
2549         pCanvas->SetBackgroundColor(Color(0, 0, 0, 0));
2550         pCanvas->Clear();
2551
2552         DrawBitmap(*pCanvas, CalculateAnnexBitmapBounds(annexWidth, annexHeight, *pCheckBoxBg), *pCheckBoxBg);
2553
2554         if (__isCheckedAnimationEnabled == true)
2555         {
2556                 StartCheckBoxAnimation();
2557         }
2558         else
2559         {
2560                 if (IsChecked() == true && pCheckBox != null)
2561                 {
2562                         DrawBitmap(*pCanvas, CalculateAnnexBitmapBounds(annexWidth, annexHeight, *pCheckBox), *pCheckBox);
2563                 }
2564         }
2565
2566         pMergeBitmap = new (std::nothrow) Bitmap();
2567         SysTryCatch(NID_UI_CTRL, pMergeBitmap != null, , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient.");
2568
2569         pMergeBitmap->Construct(*pCanvas, bounds);
2570         _BitmapImpl::ConvertToNonpremultiplied(*pMergeBitmap, true);
2571
2572         __pItemAnnex->SetBackgroundBitmap(*pMergeBitmap);
2573         __pItemAnnex->Invalidate(false);
2574
2575 CATCH:
2576         delete pCheckBox;
2577         delete pCheckBoxBg;
2578         delete pMergeBitmap;
2579         delete pCanvas;
2580
2581         return;
2582 }
2583
2584 void
2585 _TableViewItem::DrawRadioBox(void)
2586 {
2587         Bitmap* pRadioButton = null;
2588         Bitmap* pRadioButtonBg = null;
2589         Bitmap* pMergeBitmap = null;
2590         Canvas* pCanvas = null;
2591         result r = E_SUCCESS;
2592
2593         FloatRectangle bounds;
2594         float annexWidth = 0.0f;
2595         float annexHeight = 0.0f;
2596
2597         if(__enabledState)
2598         {
2599                 if (__drawingStatus == TABLE_VIEW_ITEM_DRAWING_STATUS_NORMAL)
2600                 {
2601                         r = GET_BITMAP_CONFIG_N(TABLEVIEW::RADIOBUTTON_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, pRadioButtonBg);
2602                         SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS) && (pRadioButtonBg != null), , E_SYSTEM, "[E_SYSTEM] RadioButtonBg image load failed");
2603
2604                         r = GET_BITMAP_CONFIG_N(TABLEVIEW::RADIOBUTTON_BUTTON_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, pRadioButton);
2605                         SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS) && (pRadioButton != null), , E_SYSTEM, "[E_SYSTEM] CheckBox image load failed");
2606                 }
2607                 else if ((__drawingStatus == TABLE_VIEW_ITEM_DRAWING_STATUS_PRESSED) || (__drawingStatus == TABLE_VIEW_ITEM_DRAWING_STATUS_HIGHLIGHTED))
2608                 {
2609                         r = GET_BITMAP_CONFIG_N(TABLEVIEW::RADIOBUTTON_PRESSED, BITMAP_PIXEL_FORMAT_ARGB8888, pRadioButtonBg);
2610                         SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS) && (pRadioButtonBg != null), , E_SYSTEM, "[E_SYSTEM] RadioButtonBg image load failed");
2611
2612                         r = GET_BITMAP_CONFIG_N(TABLEVIEW::RADIOBUTTON_BUTTON_PRESSED, BITMAP_PIXEL_FORMAT_ARGB8888, pRadioButton);
2613                         SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS) && (pRadioButton != null), , E_SYSTEM, "[E_SYSTEM] CheckBox image load failed");
2614                 }
2615         }
2616         else
2617         {
2618                 r = GET_BITMAP_CONFIG_N(TABLEVIEW::RADIOBUTTON_NORMAL_DISABLED, BITMAP_PIXEL_FORMAT_ARGB8888, pRadioButtonBg);
2619                 SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS) && (pRadioButtonBg != null), , E_SYSTEM, "[E_SYSTEM] RadioButtonBg image load failed");
2620
2621                 r = GET_BITMAP_CONFIG_N(TABLEVIEW::RADIOBUTTON_BUTTON_DISABLED, BITMAP_PIXEL_FORMAT_ARGB8888, pRadioButton);
2622                 SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS) && (pRadioButton != null), , E_SYSTEM, "[E_SYSTEM] CheckBox image load failed");
2623         }
2624
2625         GET_SHAPE_CONFIG(TABLEVIEW::ITEM_ANNEX_WIDTH, _CONTROL_ORIENTATION_PORTRAIT, annexWidth);
2626         GET_SHAPE_CONFIG(TABLEVIEW::ITEM_ANNEX_HEIGHT, _CONTROL_ORIENTATION_PORTRAIT, annexHeight);
2627         bounds.SetBounds(0.0f, 0.0f, annexWidth, annexHeight);
2628
2629         pCanvas = new (std::nothrow) Canvas();
2630         SysTryCatch(NID_UI_CTRL, pCanvas != null, , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient.");
2631
2632         pCanvas->Construct(bounds);
2633         pCanvas->SetBackgroundColor(Color(0, 0, 0, 0));
2634         pCanvas->Clear();
2635
2636         DrawBitmap(*pCanvas, CalculateAnnexBitmapBounds(annexWidth, annexHeight, *pRadioButtonBg), *pRadioButtonBg);
2637
2638         if (pRadioButton != null && IsChecked() == true)
2639         {
2640                 DrawBitmap(*pCanvas, CalculateAnnexBitmapBounds(annexWidth, annexHeight, *pRadioButton), *pRadioButton);
2641         }
2642
2643         pMergeBitmap = new (std::nothrow) Bitmap();
2644         SysTryCatch(NID_UI_CTRL, pMergeBitmap != null, , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient.");
2645
2646         pMergeBitmap->Construct(*pCanvas, bounds);
2647         _BitmapImpl::ConvertToNonpremultiplied(*pMergeBitmap, true);
2648
2649         __pItemAnnex->SetBackgroundBitmap(*pMergeBitmap);
2650         __pItemAnnex->Invalidate(false);
2651
2652 CATCH:
2653         delete pRadioButton;
2654         delete pRadioButtonBg;
2655         delete pMergeBitmap;
2656         delete pCanvas;
2657
2658         return;
2659 }
2660
2661 void
2662 _TableViewItem::DrawOnOffButton(void)
2663 {
2664         Bitmap* pOnOffButton = null;
2665         Bitmap* pOnOffButtonHandler = null;
2666         Bitmap* pMergeBitmap = null;
2667         Canvas* pCanvas = null;
2668         result r = E_SUCCESS;
2669
2670         FloatRectangle bounds;
2671         FloatRectangle backgroundBounds;
2672         FloatRectangle handlerBounds;
2673         float annexWidth = 0.0f;
2674         float annexHeight = 0.0f;
2675         float annexMargin = 0.0f;
2676
2677         if (IsChecked() == true)
2678         {
2679                 if(__enabledState)
2680                 {
2681                         r = GET_BITMAP_CONFIG_N(TABLEVIEW::ONOFFBUTTON_ON, BITMAP_PIXEL_FORMAT_ARGB8888, pOnOffButton);
2682                 }
2683                 else
2684                 {
2685                         r = GET_BITMAP_CONFIG_N(TABLEVIEW::ONOFFBUTTON_ON_DISABLED, BITMAP_PIXEL_FORMAT_ARGB8888, pOnOffButton);
2686                 }
2687         }
2688         else
2689         {
2690                 if(__enabledState)
2691                 {
2692                         r = GET_BITMAP_CONFIG_N(TABLEVIEW::ONOFFBUTTON_OFF, BITMAP_PIXEL_FORMAT_ARGB8888, pOnOffButton);
2693                 }
2694                 else
2695                 {
2696                         r = GET_BITMAP_CONFIG_N(TABLEVIEW::ONOFFBUTTON_OFF_DISABLED, BITMAP_PIXEL_FORMAT_ARGB8888, pOnOffButton);
2697                 }
2698         }
2699         SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS) && (pOnOffButton != null), , E_SYSTEM, "[E_SYSTEM] OnOffButton_On image load failed");
2700
2701         if(__enabledState)
2702         {
2703                 r = GET_BITMAP_CONFIG_N(TABLEVIEW::ONOFFBUTTON_HANDLER, BITMAP_PIXEL_FORMAT_ARGB8888, pOnOffButtonHandler);
2704         }
2705         else
2706         {
2707                 r = GET_BITMAP_CONFIG_N(TABLEVIEW::ONOFFBUTTON_HANDLER_DISABLED, BITMAP_PIXEL_FORMAT_ARGB8888, pOnOffButtonHandler);
2708         }
2709         SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS) && (pOnOffButtonHandler != null), , E_SYSTEM, "[E_SYSTEM] OnOffHandlerButton button image load failed");
2710
2711         GET_SHAPE_CONFIG(TABLEVIEW::ITEM_ANNEX_ONOFF_WIDTH, _CONTROL_ORIENTATION_PORTRAIT, annexWidth);
2712         GET_SHAPE_CONFIG(TABLEVIEW::ITEM_ANNEX_ONOFF_HEIGHT, _CONTROL_ORIENTATION_PORTRAIT, annexHeight);
2713         bounds.SetBounds(0, 0, annexWidth, annexHeight);
2714
2715         pCanvas = new (std::nothrow) Canvas();
2716         SysTryCatch(NID_UI_CTRL, pCanvas != null, , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient.");
2717
2718         pCanvas->Construct(bounds);
2719         pCanvas->SetBackgroundColor(Color(0, 0, 0, 0));
2720         pCanvas->Clear();
2721
2722         backgroundBounds = CalculateAnnexBitmapBounds(annexWidth, annexHeight, *pOnOffButton);
2723         DrawBitmap(*pCanvas, backgroundBounds, *pOnOffButton);
2724
2725         handlerBounds = CalculateAnnexBitmapBounds(annexWidth, annexHeight, *pOnOffButtonHandler);
2726         GET_SHAPE_CONFIG(TABLEVIEW::ITEM_ANNEX_ONOFF_MARGIN, _CONTROL_ORIENTATION_PORTRAIT, annexMargin);
2727         if (IsChecked() == true)
2728         {
2729                 handlerBounds.x = backgroundBounds.width - handlerBounds.width - annexMargin;
2730                 handlerBounds.y  = backgroundBounds.y - annexMargin;
2731         }
2732         else
2733         {
2734                 handlerBounds.x = backgroundBounds.x + annexMargin;
2735                 handlerBounds.y  = backgroundBounds.y - annexMargin;
2736         }
2737
2738         DrawBitmap(*pCanvas, handlerBounds, *pOnOffButtonHandler);
2739
2740         pMergeBitmap = new (std::nothrow) Bitmap();
2741         SysTryCatch(NID_UI_CTRL, pMergeBitmap != null, , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient.");
2742
2743         pMergeBitmap->Construct(*pCanvas, bounds);
2744         _BitmapImpl::ConvertToNonpremultiplied(*pMergeBitmap, true);
2745
2746         __pItemAnnex->SetBackgroundBitmap(*pMergeBitmap);
2747         __pItemAnnex->Invalidate(false);
2748
2749 CATCH:
2750         delete pOnOffButton;
2751         delete pOnOffButtonHandler;
2752         delete pMergeBitmap;
2753         delete pCanvas;
2754
2755         return;
2756 }
2757
2758 void
2759 _TableViewItem::AdjustAnnexOnOffHandlerPosition()
2760 {
2761         float annexWidth = 0.0f;
2762         float annexHeight = 0.0f;
2763         float annexMargin = 0.0f;
2764
2765         float annexStartPosition = 0.0f;
2766         float annexEndPosition = 0.0f;
2767         float finalEndPosition = 0.0f;
2768         FloatRectangle handlerBounds;
2769         result r = E_SUCCESS;
2770
2771         GET_SHAPE_CONFIG(TABLEVIEW::ITEM_ANNEX_ONOFF_MARGIN, _CONTROL_ORIENTATION_PORTRAIT, annexMargin);
2772
2773         annexStartPosition = __pItemAnnex->GetBoundsF().x;
2774         annexEndPosition = __pItemAnnex->GetBoundsF().x + __pItemAnnex->GetBoundsF().width + annexMargin;
2775
2776         Bitmap* pOnOffButtonHandler = null;
2777         r = GET_BITMAP_CONFIG_N(TABLEVIEW::ONOFFBUTTON_HANDLER, BITMAP_PIXEL_FORMAT_ARGB8888, pOnOffButtonHandler);
2778         SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS) && (pOnOffButtonHandler != null), , E_SYSTEM, "[E_SYSTEM] OnOffHandlerButton button image load failed");
2779
2780         GET_SHAPE_CONFIG(TABLEVIEW::ITEM_ANNEX_ONOFF_WIDTH, _CONTROL_ORIENTATION_PORTRAIT, annexWidth);
2781         GET_SHAPE_CONFIG(TABLEVIEW::ITEM_ANNEX_ONOFF_HEIGHT, _CONTROL_ORIENTATION_PORTRAIT, annexHeight);
2782
2783         handlerBounds = CalculateAnnexBitmapBounds(annexWidth, annexHeight, *pOnOffButtonHandler);
2784
2785         if(__annexOnOffHandlerMoved)
2786         {
2787                 if(annexStartPosition < __annexOnOffHandlerLastPosition
2788                         && annexEndPosition > __annexOnOffHandlerLastPosition)
2789                 {
2790                         if(((annexEndPosition - annexStartPosition) / 2) < __annexOnOffHandlerLastPosition - annexStartPosition + (handlerBounds.width / 2)) // +++ check floating
2791                         {
2792                                 finalEndPosition = annexEndPosition;
2793                                 SetChecked(true);
2794                         }
2795                         else
2796                         {
2797                                 finalEndPosition = annexStartPosition;
2798                                 SetChecked(false);
2799                         }
2800                 }
2801                 else
2802                 {
2803                         if(annexEndPosition < __annexOnOffHandlerLastPosition)
2804                         {
2805                                 finalEndPosition = annexEndPosition;
2806                                 SetChecked(true);
2807                         }
2808                         else
2809                         {
2810                                 finalEndPosition = annexStartPosition;
2811                                 SetChecked(false);
2812                         }
2813                 }
2814         }
2815         else
2816         {
2817                 SetChecked(!IsChecked());
2818                 if(IsChecked())
2819                 {
2820                         finalEndPosition = annexEndPosition;
2821                 }
2822                 else
2823                 {
2824                         finalEndPosition = annexStartPosition;
2825                 }
2826         }
2827
2828         DrawAnnexOnOffHandler(finalEndPosition);
2829
2830 CATCH:
2831         delete pOnOffButtonHandler;
2832
2833         return;
2834 }
2835
2836 void
2837 _TableViewItem::DrawAnnexOnOffHandler(float position)
2838 {
2839         if (__pItemAnnex == null)
2840         {
2841                 return;
2842         }
2843
2844         Bitmap* pOnOffButton = null;
2845         Bitmap* pOnOffButtonHandler = null;
2846         Bitmap* pMergeBitmap = null;
2847         Canvas* pCanvas = null;
2848         result r = E_SUCCESS;
2849
2850         FloatRectangle bounds;
2851         FloatRectangle backgroundBounds;
2852         FloatRectangle handlerBounds;
2853         float annexWidth = 0.0f;
2854         float annexHeight = 0.0f;
2855         float annexMargin = 0.0f;
2856         float annexAbsoluteBoundsStart = 0.0f;
2857         float annexAbsoluteBoundsEnd = 0.0f;
2858         float nextHandlerBounds = 0;
2859
2860         r = GET_BITMAP_CONFIG_N(TABLEVIEW::ONOFFBUTTON_HANDLER, BITMAP_PIXEL_FORMAT_ARGB8888, pOnOffButtonHandler);
2861         SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS) && (pOnOffButtonHandler != null), , E_SYSTEM, "[E_SYSTEM] OnOffHandlerButton button image load failed");
2862
2863         if (IsChecked() == true)
2864         {
2865                 r = GET_BITMAP_CONFIG_N(TABLEVIEW::ONOFFBUTTON_ON, BITMAP_PIXEL_FORMAT_ARGB8888, pOnOffButton);
2866         }
2867         else
2868         {
2869                 r = GET_BITMAP_CONFIG_N(TABLEVIEW::ONOFFBUTTON_OFF, BITMAP_PIXEL_FORMAT_ARGB8888, pOnOffButton);
2870         }
2871         SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS) && (pOnOffButton != null), , E_SYSTEM, "[E_SYSTEM] OnOffButton_On image load failed");
2872
2873         GET_SHAPE_CONFIG(TABLEVIEW::ITEM_ANNEX_ONOFF_WIDTH, _CONTROL_ORIENTATION_PORTRAIT, annexWidth);
2874         GET_SHAPE_CONFIG(TABLEVIEW::ITEM_ANNEX_ONOFF_HEIGHT, _CONTROL_ORIENTATION_PORTRAIT, annexHeight);
2875         GET_SHAPE_CONFIG(TABLEVIEW::ITEM_ANNEX_ONOFF_MARGIN, _CONTROL_ORIENTATION_PORTRAIT, annexMargin);
2876
2877         bounds.SetBounds(0, 0, annexWidth, annexHeight);
2878
2879         pCanvas = new (std::nothrow) Canvas();
2880         SysTryCatch(NID_UI_CTRL, pCanvas != null, , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient.");
2881
2882         pCanvas->Construct(bounds);
2883         pCanvas->SetBackgroundColor(Color(0, 0, 0, 0));
2884         pCanvas->Clear();
2885
2886         backgroundBounds = CalculateAnnexBitmapBounds(annexWidth, annexHeight, *pOnOffButton);
2887         DrawBitmap(*pCanvas, backgroundBounds, *pOnOffButton);
2888
2889         handlerBounds = CalculateAnnexBitmapBounds(annexWidth, annexHeight, *pOnOffButtonHandler);
2890         handlerBounds.y  = backgroundBounds.y - annexMargin;
2891
2892         if(IsChecked())
2893         {
2894                 handlerBounds.x = backgroundBounds.width - handlerBounds.width - annexMargin;
2895         }
2896         else
2897         {
2898                 handlerBounds.x = backgroundBounds.x + annexMargin;
2899         }
2900
2901         nextHandlerBounds = handlerBounds.x + (position - __annexOnOffTouchPosition);
2902         annexAbsoluteBoundsStart = __pItemAnnex->GetBoundsF().x;
2903         annexAbsoluteBoundsEnd = __pItemAnnex->GetBoundsF().x + __pItemAnnex->GetBoundsF().width + annexMargin;
2904
2905         if((annexAbsoluteBoundsStart + nextHandlerBounds + handlerBounds.width)  < annexAbsoluteBoundsEnd &&
2906                 (annexAbsoluteBoundsStart + nextHandlerBounds) > annexAbsoluteBoundsStart)
2907         {
2908                 handlerBounds.x = nextHandlerBounds;
2909                 __annexOnOffHandlerLastPosition = annexAbsoluteBoundsStart + nextHandlerBounds;
2910         }
2911         else if(_FloatCompareGE((annexAbsoluteBoundsStart + nextHandlerBounds + handlerBounds.width), annexAbsoluteBoundsEnd))
2912         {
2913                 handlerBounds.x = backgroundBounds.width - handlerBounds.width - annexMargin;
2914         }
2915         else if(_FloatCompareLE((annexAbsoluteBoundsStart + nextHandlerBounds), annexAbsoluteBoundsStart))
2916         {
2917                 handlerBounds.x = backgroundBounds.x + annexMargin;
2918         }
2919
2920         DrawBitmap(*pCanvas, handlerBounds, *pOnOffButtonHandler);
2921
2922         pMergeBitmap = new (std::nothrow) Bitmap();
2923         SysTryCatch(NID_UI_CTRL, pMergeBitmap != null, , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient.");
2924
2925         pMergeBitmap->Construct(*pCanvas, bounds);
2926         _BitmapImpl::ConvertToNonpremultiplied(*pMergeBitmap, true);
2927
2928         __pItemAnnex->SetBackgroundBitmap(*pMergeBitmap);
2929         __pItemAnnex->Invalidate(false);
2930
2931 CATCH:
2932         delete pOnOffButton;
2933         delete pOnOffButtonHandler;
2934         delete pMergeBitmap;
2935         delete pCanvas;
2936
2937         return;
2938 }
2939
2940 void
2941 _TableViewItem::DrawDetailButton(void)
2942 {
2943         Bitmap* pDetail = null;
2944         Bitmap* pDetailBg = null;
2945         Bitmap* pDetailBgEffect = null;
2946         Bitmap* pDetailEffect = null;
2947         Bitmap* pReplacementDetail = null;
2948         Bitmap* pReplacementDetailBg = null;
2949         Bitmap* pMergeBitmap = null;
2950         Canvas* pCanvas = null;
2951         Color replacementNewColor;
2952         Color replacementNewBgColor;
2953         result r = E_SUCCESS;
2954
2955         FloatRectangle bounds;
2956         float annexWidth = 0.0f;
2957         float annexHeight = 0.0f;
2958         bool themeBackgroundBitmap = false;
2959
2960         themeBackgroundBitmap = IS_CUSTOM_BITMAP(TABLEVIEW::CIRCLE_BUTTON_BG_NORMAL);
2961
2962         if(__enabledState)
2963         {
2964                 r = GET_BITMAP_CONFIG_N(TABLEVIEW::CIRCLE_BUTTON_BG_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, pDetailBg);
2965                 SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS) && (pDetailBg != null), , E_SYSTEM, "[E_SYSTEM] Detail button image load failed");
2966
2967                 if (__isSelectedDetailButton)
2968                 {
2969                         if (!themeBackgroundBitmap)
2970                         {
2971                                 r = GET_BITMAP_CONFIG_N(TABLEVIEW::CIRCLE_BUTTON_BG_PRESSED, BITMAP_PIXEL_FORMAT_ARGB8888, pDetailBgEffect);
2972                                 SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS) && (pDetailBgEffect != null), , E_SYSTEM, "[E_SYSTEM] Detail button image load failed");
2973
2974                                 r = GET_BITMAP_CONFIG_N(TABLEVIEW::CIRCLE_BUTTON_REVEAL_EFFECT, BITMAP_PIXEL_FORMAT_ARGB8888, pDetailEffect);
2975                                 SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS) && (pDetailEffect != null), , E_SYSTEM, "[E_SYSTEM] Detail button image load failed");
2976                         }
2977
2978                         r = GET_BITMAP_CONFIG_N(TABLEVIEW::CIRCLE_BUTTON_REVEAL_PRESSED, BITMAP_PIXEL_FORMAT_ARGB8888, pDetail);
2979                         SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS) && (pDetail != null), , E_SYSTEM, "[E_SYSTEM] Detail button image load failed");
2980
2981                         GET_COLOR_CONFIG(TABLEVIEW::ITEM_ANNEX_DETAIL_PRESSED, replacementNewColor);
2982                         GET_COLOR_CONFIG(TABLEVIEW::ITEM_ANNEX_DETAIL_BG_PRESSED, replacementNewBgColor);
2983                 }
2984                 else
2985                 {
2986                         if (!themeBackgroundBitmap)
2987                         {
2988                                 r = GET_BITMAP_CONFIG_N(TABLEVIEW::CIRCLE_BUTTON_BG_EFFECT, BITMAP_PIXEL_FORMAT_ARGB8888, pDetailBgEffect);
2989                                 SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS) && (pDetailBgEffect != null), , E_SYSTEM, "[E_SYSTEM] Detail button image load failed");
2990
2991                                 r = GET_BITMAP_CONFIG_N(TABLEVIEW::CIRCLE_BUTTON_REVEAL_EFFECT, BITMAP_PIXEL_FORMAT_ARGB8888, pDetailEffect);
2992                                 SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS) && (pDetailEffect != null), , E_SYSTEM, "[E_SYSTEM] Detail button image load failed");
2993                         }
2994
2995                         r = GET_BITMAP_CONFIG_N(TABLEVIEW::CIRCLE_BUTTON_REVEAL_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, pDetail);
2996                         SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS) && (pDetail != null), , E_SYSTEM, "[E_SYSTEM] Detail button image load failed");
2997
2998                         GET_COLOR_CONFIG(TABLEVIEW::ITEM_ANNEX_DETAIL_NORMAL, replacementNewColor);
2999                         GET_COLOR_CONFIG(TABLEVIEW::ITEM_ANNEX_DETAIL_BG_NORMAL, replacementNewBgColor);
3000                 }
3001         }
3002         else
3003         {
3004
3005                 if (!themeBackgroundBitmap)
3006                 {
3007                         r = GET_BITMAP_CONFIG_N(TABLEVIEW::CIRCLE_BUTTON_BG_EFFECT_DISABLED, BITMAP_PIXEL_FORMAT_ARGB8888, pDetailBgEffect);
3008                         SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS) && (pDetailBgEffect != null), , E_SYSTEM, "[E_SYSTEM] Detail button image load failed");
3009
3010                         r = GET_BITMAP_CONFIG_N(TABLEVIEW::CIRCLE_BUTTON_REVEAL_EFFECT, BITMAP_PIXEL_FORMAT_ARGB8888, pDetailEffect);
3011                         SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS) && (pDetailEffect != null), , E_SYSTEM, "[E_SYSTEM] Detail button image load failed");
3012                 }
3013
3014                 r = GET_BITMAP_CONFIG_N(TABLEVIEW::CIRCLE_BUTTON_REVEAL_DISABLED, BITMAP_PIXEL_FORMAT_ARGB8888, pDetail);
3015                 SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS) && (pDetail != null), , E_SYSTEM, "[E_SYSTEM] Detail button image load failed");
3016
3017                 r = GET_BITMAP_CONFIG_N(TABLEVIEW::CIRCLE_BUTTON_BG_DISABLED, BITMAP_PIXEL_FORMAT_ARGB8888, pDetailBg);
3018                 SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS) && (pDetailBg != null), , E_SYSTEM, "[E_SYSTEM] Detail button image load failed");
3019
3020                 GET_COLOR_CONFIG(TABLEVIEW::ITEM_ANNEX_DETAIL_NORMAL, replacementNewColor);
3021         }
3022         pReplacementDetailBg = Tizen::Graphics::_BitmapImpl::GetColorReplacedBitmapN(*pDetailBg, Color::GetColor(COLOR_ID_MAGENTA), replacementNewBgColor);
3023         SysTryCatch(NID_UI_CTRL, pReplacementDetailBg != null, r = E_SYSTEM, E_SYSTEM, "[E_SYSTEM] Detail button image load failed");
3024
3025         pReplacementDetail = Tizen::Graphics::_BitmapImpl::GetColorReplacedBitmapN(*pDetail, Color::GetColor(COLOR_ID_MAGENTA), replacementNewColor);
3026         SysTryCatch(NID_UI_CTRL, pReplacementDetail != null, r = E_SYSTEM, E_SYSTEM, "[E_SYSTEM] Detail button image load failed");
3027
3028         GET_SHAPE_CONFIG(TABLEVIEW::ITEM_ANNEX_MORE_WIDTH, _CONTROL_ORIENTATION_PORTRAIT, annexWidth);
3029         GET_SHAPE_CONFIG(TABLEVIEW::ITEM_ANNEX_MORE_HEIGHT, _CONTROL_ORIENTATION_PORTRAIT, annexHeight);
3030
3031         bounds.SetBounds(0, 0, annexWidth, annexHeight);
3032
3033         pCanvas = new (std::nothrow) Canvas();
3034         SysTryCatch(NID_UI_CTRL, pCanvas != null, , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient.");
3035
3036         pCanvas->Construct(bounds);
3037         pCanvas->SetBackgroundColor(Color(0, 0, 0, 0));
3038         pCanvas->Clear();
3039
3040         DrawBitmap(*pCanvas, CalculateAnnexBitmapBounds(annexWidth, annexHeight, *pReplacementDetailBg), *pReplacementDetailBg);
3041         if (pDetailBgEffect)
3042         {
3043                 DrawBitmap(*pCanvas, CalculateAnnexBitmapBounds(annexWidth, annexHeight, *pDetailBgEffect), *pDetailBgEffect);
3044         }
3045         DrawBitmap(*pCanvas, CalculateAnnexBitmapBounds(annexWidth, annexHeight, *pReplacementDetail), *pReplacementDetail);
3046         if(pDetailEffect)
3047         {
3048                 DrawBitmap(*pCanvas, CalculateAnnexBitmapBounds(annexWidth, annexHeight, *pDetailEffect), *pDetailEffect);
3049         }
3050
3051         pMergeBitmap = new (std::nothrow) Bitmap();
3052         SysTryCatch(NID_UI_CTRL, pMergeBitmap != null, , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient.");
3053
3054         pMergeBitmap->Construct(*pCanvas, bounds);
3055         _BitmapImpl::ConvertToNonpremultiplied(*pMergeBitmap, true);
3056
3057         __pItemAnnex->SetBackgroundBitmap(*pMergeBitmap);
3058         __pItemAnnex->Invalidate(false);
3059
3060 CATCH:
3061         delete pDetail;
3062         delete pDetailBg;
3063         delete pDetailBgEffect;
3064         delete pDetailEffect;
3065         delete pReplacementDetail;
3066         delete pReplacementDetailBg;
3067         delete pMergeBitmap;
3068         delete pCanvas;
3069
3070         return;
3071 }
3072
3073 void
3074 _TableViewItem::DrawItemDivider(void)
3075 {
3076         if(__pItemDivider == null || __pItemTopDivider == null)
3077         {
3078                 return;
3079         }
3080
3081         if (__pDrawingProperty->itemDividerEnabled == false ||
3082                 __itemType == TABLE_VIEW_ITEM_TYPE_HEADER ||
3083                 __itemType == TABLE_VIEW_ITEM_TYPE_FOOTER ||
3084                 __itemDividerEnabled == false)
3085         {
3086                 __pItemDivider->SetVisibleState(false);
3087                 __pItemTopDivider->SetVisibleState(false);
3088
3089                 return;
3090         }
3091
3092         FloatRectangle dividerBottomBounds;
3093         FloatRectangle dividerTopBounds;
3094         Color topLineColor;
3095         Color bottomLineColor;
3096         Color customDividerColor;
3097         FloatRectangle bounds;
3098         FloatPoint bottomPoint;
3099
3100         __pItemDivider->SetVisibleState(true);
3101         __pItemTopDivider->SetVisibleState(true);
3102
3103         if(     __drawingStatus == TABLE_VIEW_ITEM_DRAWING_STATUS_PRESSED ||
3104                 __drawingStatus == TABLE_VIEW_ITEM_DRAWING_STATUS_HIGHLIGHTED)
3105         {
3106                 if(__itemType != TABLE_VIEW_ITEM_TYPE_TITLE)
3107                 {
3108                         __pItemDivider->SetVisibleState(false);
3109                 }
3110
3111                 __pItemTopDivider->SetVisibleState(false);
3112         }
3113
3114         if (__itemType == TABLE_VIEW_ITEM_TYPE_TITLE)
3115         {
3116                 if(__pItemBgBitmap[__drawingStatus] != null)
3117                 {
3118                         __pItemDivider->SetVisibleState(false);
3119                 }
3120                 else
3121                 {
3122                         float lineHeight = 0.0f;
3123                         float lineLeftMargin = 0.0f;
3124                         float lineBottomMargin = 0.0f;
3125                         bounds = GetBoundsF();
3126
3127                         if (__drawingStatus == TABLE_VIEW_ITEM_DRAWING_STATUS_NORMAL)
3128                         {
3129                                 GET_COLOR_CONFIG(TABLEVIEW::GROUPITEM_INDEX_BAR_NORMAL, bottomLineColor);
3130                         }
3131                         else
3132                         {
3133                                 GET_COLOR_CONFIG(TABLEVIEW::GROUPITEM_INDEX_BAR_PRESSED, bottomLineColor);
3134                         }
3135
3136                         GET_SHAPE_CONFIG(TABLEVIEW::GROUPITEM_INDEX_BAR_HEIGHT, _CONTROL_ORIENTATION_PORTRAIT, lineHeight);
3137                         GET_SHAPE_CONFIG(TABLEVIEW::GROUPITEM_INDEX_BAR_LEFT_MARGIN, _CONTROL_ORIENTATION_PORTRAIT, lineLeftMargin);
3138                         GET_SHAPE_CONFIG(TABLEVIEW::GROUPITEM_INDEX_BAR_BOTTOM_MARGIN, _CONTROL_ORIENTATION_PORTRAIT, lineBottomMargin);
3139
3140                         lineHeight = Tizen::Graphics::CoordinateSystem::ConvertToLogicalY(lineHeight);
3141                         lineBottomMargin = Tizen::Graphics::CoordinateSystem::ConvertToLogicalY(lineBottomMargin);
3142                         bottomPoint = Tizen::Graphics::CoordinateSystem::AlignToDevice(FloatPoint(lineLeftMargin, bounds.height));
3143                         dividerBottomBounds = FloatRectangle(bottomPoint.x, bottomPoint.y - lineBottomMargin, bounds.width - lineLeftMargin * 2, lineHeight);
3144                 }
3145         }
3146         else
3147         {
3148                 float lineLeftMargin = 0.0f;
3149                 float lineHeight = 0.0f;
3150                 bounds = GetBoundsF();
3151                 int groupIndex = -1;
3152                 int itemIndex = -1;
3153
3154                 GetItemIndex(groupIndex, itemIndex);
3155
3156                 if (itemIndex < 1)
3157                 {
3158                         __pItemTopDivider->SetVisibleState(false);
3159                 }
3160
3161                 if(!IsContextItem())
3162                 {
3163                         if(__itemType == TABLE_VIEW_ITEM_TYPE_BOTTOM ||
3164                                 __itemType == TABLE_VIEW_ITEM_TYPE_ONE)
3165                         {
3166                                 __pItemDivider->SetVisibleState(false);
3167                         }
3168                 }
3169
3170                 customDividerColor = __pDrawingProperty->dividerColor;
3171                 GET_COLOR_CONFIG(TABLEVIEW::ITEM_DIVIDER_TOP_BG_NORMAL, topLineColor);
3172                 GET_COLOR_CONFIG(TABLEVIEW::ITEM_DIVIDER_BOTTOM_BG_NORMAL, bottomLineColor);
3173                 GET_SHAPE_CONFIG(TABLEVIEW::GROUPITEM_INDEX_BAR_LEFT_MARGIN, _CONTROL_ORIENTATION_PORTRAIT, lineLeftMargin);
3174                 GET_FIXED_VALUE_CONFIG(TABLEVIEW::ITEM_DIVIDER_HEIGHT, _CONTROL_ORIENTATION_PORTRAIT, lineHeight);
3175
3176                 lineHeight = Tizen::Graphics::CoordinateSystem::ConvertToLogicalY(lineHeight);
3177                 bottomPoint = Tizen::Graphics::CoordinateSystem::AlignToDevice(FloatPoint(lineLeftMargin, (bounds.height)));
3178
3179                 dividerTopBounds.SetBounds(bottomPoint.x, 0.0f, bounds.width - lineLeftMargin * 2, lineHeight);
3180                 dividerBottomBounds.SetBounds(bottomPoint.x, bottomPoint.y - lineHeight, bounds.width - lineLeftMargin * 2, lineHeight);
3181         }
3182
3183         if(__pItemDivider->GetVisibleState())
3184         {
3185                 __pItemDivider->SetBounds(dividerBottomBounds);
3186                 if(customDividerColor == bottomLineColor || __itemType == TABLE_VIEW_ITEM_TYPE_TITLE)
3187                 {
3188                         __pItemDivider->SetBackgroundColor(bottomLineColor);
3189                 }
3190                 else
3191                 {
3192                         __pItemDivider->SetBackgroundColor(customDividerColor);
3193                         __pItemDivider->GetVisualElement()->SetOpacity(ITEM_BOTTOM_DIVIDER_OPACITY);
3194                 }
3195                         __pItemDivider->Invalidate();
3196         }
3197
3198         if(__pItemTopDivider->GetVisibleState())
3199         {
3200                 __pItemTopDivider->SetBounds(dividerTopBounds);
3201                 if(customDividerColor == bottomLineColor)
3202                 {
3203                         __pItemTopDivider->SetBackgroundColor(topLineColor);
3204                 }
3205                 else
3206                 {
3207                         __pItemTopDivider->SetBackgroundColor(customDividerColor);
3208                         __pItemTopDivider->GetVisualElement()->SetOpacity(ITEM_TOP_DIVIDER_OPACITY);
3209                 }
3210                 __pItemTopDivider->Invalidate();
3211         }
3212 }
3213
3214 void
3215 _TableViewItem::DrawItemAnnexDivider(void)
3216 {
3217         if (__itemType == TABLE_VIEW_ITEM_TYPE_HEADER || __itemType == TABLE_VIEW_ITEM_TYPE_FOOTER)
3218         {
3219                 if (__pItemAnnexLeftDivider != null)
3220                 {
3221                         __pItemAnnexLeftDivider->SetVisibleState(false);
3222                 }
3223
3224                 if (__pItemAnnexRightDivider != null)
3225                 {
3226                         __pItemAnnexRightDivider->SetVisibleState(false);
3227                 }
3228         }
3229         else
3230         {
3231                 Color dividerLeftColor;
3232                 Color dividerRightColor;
3233                 FloatRectangle bounds = GetBoundsF();
3234                 float dividerHeight = 0;
3235                 float itemHeight = 0;
3236                 float dividerWidth = 0.0f;
3237                 float dividerTopMargin = 0.0f;
3238                 float annexWidth = 0.0f;
3239                 float annexLeftMargin = 0.0f;
3240                 float itemLeftMargin = 0.0f;
3241
3242                 GET_SHAPE_CONFIG(TABLEVIEW::ITEM_LEFT_MARGIN, _CONTROL_ORIENTATION_PORTRAIT, itemLeftMargin);
3243                 GET_SHAPE_CONFIG(TABLEVIEW::ITEM_ANNEX_MARGIN, _CONTROL_ORIENTATION_PORTRAIT, annexLeftMargin);
3244                 GET_SHAPE_CONFIG(TABLEVIEW::ITEM_ANNEX_ONOFF_WIDTH, _CONTROL_ORIENTATION_PORTRAIT, annexWidth);
3245                 GET_COLOR_CONFIG(TABLEVIEW::ITEM_ANNEX_DIVIDER_LEFT_BG_NORMAL, dividerLeftColor);
3246                 GET_COLOR_CONFIG(TABLEVIEW::ITEM_ANNEX_DIVIDER_RIGHT_BG_NORMAL, dividerRightColor);
3247                 GET_FIXED_VALUE_CONFIG(TABLEVIEW::ITEM_ANNEX_DIVIDER_WIDTH, _CONTROL_ORIENTATION_PORTRAIT, dividerWidth);
3248                 GET_FIXED_VALUE_CONFIG(TABLEVIEW::ITEM_ANNEX_DIVIDER_MARGIN, _CONTROL_ORIENTATION_PORTRAIT, dividerTopMargin);
3249
3250                 itemLeftMargin += __pDrawingProperty->scrollMargin;
3251                 itemHeight = ((__customHeight > 0) ? __customHeight : GetBoundsF().height);
3252                 dividerHeight = itemHeight - (dividerTopMargin*2);
3253                 dividerHeight = (dividerHeight > 0) ? dividerHeight : 0;
3254                 __pItemAnnexLeftDivider->SetBounds(FloatRectangle((GetBoundsF().width - annexWidth - (itemLeftMargin + annexLeftMargin) - (dividerWidth*2)), dividerTopMargin, dividerWidth, dividerHeight));
3255                 __pItemAnnexLeftDivider->SetBackgroundColor(dividerLeftColor);
3256                 __pItemAnnexLeftDivider->Invalidate();
3257
3258                 __pItemAnnexRightDivider->SetBounds(FloatRectangle((GetBoundsF().width - annexWidth - (itemLeftMargin + annexLeftMargin) - dividerWidth), dividerTopMargin, dividerWidth, dividerHeight));
3259                 __pItemAnnexRightDivider->SetBackgroundColor(dividerRightColor);
3260                 __pItemAnnexRightDivider->Invalidate();
3261
3262         }
3263
3264         if (__pItemAnnexLeftDivider != null)
3265         {
3266                 _AccessibilityContainer* pContainer = __pItemAnnexLeftDivider->GetAccessibilityContainer();
3267                 pContainer->Activate(false);
3268         }
3269
3270         if (__pItemAnnexRightDivider != null)
3271         {
3272                 _AccessibilityContainer* pContainer = __pItemAnnexRightDivider->GetAccessibilityContainer();
3273                 pContainer->Activate(false);
3274         }
3275 }
3276
3277
3278 result
3279 _TableViewItem::DrawBitmap(Canvas& canvas, const FloatRectangle& bounds, const Bitmap& bitmap)
3280 {
3281         result r = E_SUCCESS;
3282         if (_BitmapImpl::CheckNinePatchedBitmapStrictly(bitmap))
3283         {
3284                 r = canvas.DrawNinePatchedBitmap(bounds, bitmap);
3285                 SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Fail to draw ninepatched bitmap.", GetErrorMessage(r))
3286         }
3287         else
3288         {
3289                 r = canvas.DrawBitmap(bounds, bitmap);
3290                 SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Fail to draw bitmap.", GetErrorMessage(r))
3291         }
3292
3293         return r;
3294 }
3295
3296 result
3297 _TableViewItem::SetItemHighlightBounds(_VisualElement& highlightVisualElement, const FloatRectangle& bounds)
3298 {
3299         return highlightVisualElement.SetBounds(bounds);
3300 }
3301
3302 FloatRectangle
3303 _TableViewItem::CalculateItemHighlightBounds(void)
3304 {
3305         FloatRectangle itemBounds = GetBoundsF();
3306         return FloatRectangle(0.0f, 0.0f, itemBounds.width, itemBounds.height);
3307 }
3308
3309 FloatRectangle
3310 _TableViewItem::CalculateAnnexBitmapBounds(float annexWidth, float annexHeight, const Bitmap& bitmap)
3311 {
3312         FloatRectangle bounds;
3313         float width = 0;
3314         float height = 0;
3315         float leftMargin = 0;
3316         float topMargin = 0;
3317
3318         if (annexWidth > bitmap.GetWidthF())
3319         {
3320                 leftMargin = (annexWidth - bitmap.GetWidthF()) / 2;
3321                 width = bitmap.GetWidthF();
3322         }
3323         else
3324         {
3325                 width = annexWidth;
3326         }
3327
3328         if(annexHeight > bitmap.GetHeightF())
3329         {
3330                 topMargin = (annexHeight - bitmap.GetHeightF()) / 2;
3331                 height = bitmap.GetHeightF();
3332         }
3333         else
3334         {
3335                 height = annexHeight;
3336         }
3337
3338         bounds.SetBounds(leftMargin, topMargin, width, height);
3339
3340         return bounds;
3341 }
3342
3343 bool
3344 _TableViewItem::IsTitleStyleItem(void) const
3345 {
3346         if (__itemType == TABLE_VIEW_ITEM_TYPE_TITLE || __itemType == TABLE_VIEW_ITEM_TYPE_HEADER || __itemType == TABLE_VIEW_ITEM_TYPE_FOOTER)
3347         {
3348                 return true;
3349         }
3350
3351         return false;
3352 }
3353
3354 bool
3355 _TableViewItem::IsValidSelectionState(void)
3356 {
3357         _TableView* pParent = dynamic_cast<_TableView*>(GetParent());
3358         if (pParent == null)
3359         {
3360                 return true;
3361         }
3362
3363         if (pParent->GetPressedItemCount() > 0)
3364         {
3365                 return false;
3366         }
3367
3368         return true;
3369 }
3370
3371 void
3372 _TableViewItem::DrawSimpleItem(void)
3373 {
3374         if (__pSimpleItemText != null)
3375         {
3376                 Color textColor = __simpleItemTextColor[__drawingStatus];
3377                 if (!IsEnabled())
3378                 {
3379                         textColor = __simpleItemTextColor[TABLE_VIEW_SIMPLEITEM_DRAWING_STATUS_DISABLED];
3380                 }
3381
3382                 if (__itemType == TABLE_VIEW_ITEM_TYPE_TITLE)
3383                 {
3384                         if (__drawingStatus == TABLE_VIEW_ITEM_DRAWING_STATUS_NORMAL)
3385                         {
3386                                 textColor = __simpleItemTextColor[TABLE_VIEW_GROUPITEM_DRAWING_STATUS_NORMAL];
3387                         }
3388                         else
3389                         {
3390                                 textColor = __simpleItemTextColor[TABLE_VIEW_GROUPITEM_DRAWING_STATUS_PRESSED];
3391                         }
3392                 }
3393
3394                 __pSimpleItemText->SetTextColor(textColor);
3395                 __pSimpleItemText->Invalidate(false);
3396         }
3397 }
3398 result
3399 _TableViewItem::SetSimpleItemContents(const Tizen::Base::String& text, const Tizen::Graphics::Bitmap* pBitmap, bool groupType)
3400 {
3401         result r = E_SUCCESS;
3402         bool textOnly = true;
3403
3404         if (pBitmap != null)
3405         {
3406                 textOnly = false;
3407         }
3408
3409         r = CreateSimpleItemContents(textOnly);
3410         SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
3411
3412         FloatRectangle bitmapRect = FloatRectangle(0.0f, 0.0f, 0.0f, 0.0f);
3413         FloatRectangle textRect = FloatRectangle(0.0f, 0.0f, 0.0f, 0.0f);
3414         float leftMargin = 0.0f;
3415         float annexMargin = 0.0f;
3416         float elementWidth = 0;
3417         float elementHeight = 0;
3418         float itemHeight = __itemHeight;
3419         float annexWidth = GetAnnexWidth(__annexStyle);
3420
3421         if (groupType)
3422         {
3423                 if (__simpleItemTextSize == 0)
3424                 {
3425                         GET_SHAPE_CONFIG(TABLEVIEW::GROUPITEM_DEFAULT_FONT_SIZE, _CONTROL_ORIENTATION_PORTRAIT, __simpleItemTextSize);
3426                 }
3427                 GET_SHAPE_CONFIG(TABLEVIEW::GROUPITEM_LEFT_MARGIN, _CONTROL_ORIENTATION_PORTRAIT, leftMargin);
3428         }
3429         else
3430         {
3431                 if (__simpleItemTextSize == 0)
3432                 {
3433                         GET_SHAPE_CONFIG(TABLEVIEW::ITEM_DEFAULT_FONT_SIZE, _CONTROL_ORIENTATION_PORTRAIT, __simpleItemTextSize);
3434                 }
3435                 GET_SHAPE_CONFIG(TABLEVIEW::ITEM_LEFT_MARGIN, _CONTROL_ORIENTATION_PORTRAIT, leftMargin);
3436         }
3437
3438         if (!textOnly)
3439         {
3440                 elementWidth = itemHeight * SIMPLE_ITEM_ELEMENT_BITMAP_SIZE_RATIO;
3441                 elementHeight = elementWidth;
3442
3443                 bitmapRect.x = leftMargin;
3444                 bitmapRect.y = (itemHeight - elementHeight) / 2;
3445                 bitmapRect.width = elementWidth;
3446                 bitmapRect.height = elementHeight;
3447         }
3448
3449         textRect.x = bitmapRect.x + elementWidth + leftMargin;
3450
3451         if (__annexStyle == TABLE_VIEW_ANNEX_STYLE_MARK || __annexStyle == TABLE_VIEW_ANNEX_STYLE_RADIO)
3452         {
3453                 GET_SHAPE_CONFIG(TABLEVIEW::ITEM_ANNEX_MARGIN, _CONTROL_ORIENTATION_PORTRAIT, annexMargin);
3454                 textRect.x = bitmapRect.x + elementWidth + annexMargin;
3455         }
3456
3457         if (annexWidth > 0) // +++ check floating
3458         {
3459                 elementWidth = __itemWidth - textRect.x - annexWidth - leftMargin;
3460         }
3461         else
3462         {
3463                 elementWidth = __itemWidth - textRect.x;
3464         }
3465
3466         textRect.y = 0.0f;
3467         textRect.width = elementWidth;
3468         textRect.height = itemHeight;
3469
3470         if (__pSimpleItemBitmap != null && pBitmap != null)
3471         {
3472                 __pSimpleItemBitmap->SetBackgroundBitmap(*pBitmap);
3473                 __pSimpleItemBitmap->SetBounds(bitmapRect);
3474
3475                 _Label* pSimpleItemBitmapCore = GetLabelCore(__pSimpleItemBitmap);
3476                 if (!pSimpleItemBitmapCore->HasParent())
3477                 {
3478                         r = AttachChild(*pSimpleItemBitmapCore);
3479                         SysTryReturn(NID_UI_CTRL, __pSimpleItemBitmap != null, r, r, "[%s] Propagating.", GetErrorMessage(r));
3480                 }
3481         }
3482
3483         if (__pSimpleItemText != null)
3484         {
3485                 __pSimpleItemText->SetTextConfig(__simpleItemTextSize, LABEL_TEXT_STYLE_NORMAL);
3486                 __pSimpleItemText->SetText(text);
3487                 __pSimpleItemText->SetBounds(textRect);
3488
3489                 _Label* pSimpleItemTextCore = GetLabelCore(__pSimpleItemText);
3490                 if (!pSimpleItemTextCore->HasParent())
3491                 {
3492                         r = AttachChild(*pSimpleItemTextCore);
3493                         SysTryReturn(NID_UI_CTRL, __pSimpleItemText != null, r, r, "[%s] Propagating.", GetErrorMessage(r));
3494                 }
3495         }
3496
3497         return E_SUCCESS;
3498 }
3499
3500 result
3501 _TableViewItem::CreateSimpleItemContents(bool textOnly)
3502 {
3503         result r = E_SUCCESS;
3504
3505         if (__pSimpleItemText == null)
3506         {
3507                 __pSimpleItemText = new (std::nothrow) Label();
3508
3509                 r = GetLastResult();
3510                 SysTryReturn(NID_UI_CTRL, __pSimpleItemText != null, r, r, "[%s] Propagating.", GetErrorMessage(r));
3511
3512                 __pSimpleItemText->Construct(FloatRectangle(0.0f, 0.0f, 0.0f, 0.0f), L"");
3513
3514                 __pSimpleItemText->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
3515                 __pSimpleItemText->SetTextVerticalAlignment(ALIGNMENT_MIDDLE);
3516                 if (__itemType == TABLE_VIEW_ITEM_TYPE_TITLE)
3517                 {
3518                         __pSimpleItemText->SetTextColor(__simpleItemTextColor[TABLE_VIEW_GROUPITEM_DRAWING_STATUS_NORMAL]);
3519                 }
3520                 else
3521                 {
3522                         __pSimpleItemText->SetTextColor(__simpleItemTextColor[TABLE_VIEW_ITEM_DRAWING_STATUS_NORMAL]);
3523                 }
3524                 __pSimpleItemText->SetBackgroundColor(Color(0, 0, 0, 0));
3525
3526         }
3527
3528         if (!textOnly)
3529         {
3530                 if (__pSimpleItemBitmap == null)
3531                 {
3532                         __pSimpleItemBitmap = new (std::nothrow) Label();
3533
3534                         r = GetLastResult();
3535                         SysTryReturn(NID_UI_CTRL, __pSimpleItemBitmap != null, r, r, "[%s] Propagating.", GetErrorMessage(r));
3536
3537                         __pSimpleItemBitmap->Construct(FloatRectangle(0.0f, 0.0f, 0.0f, 0.0f), L"");
3538
3539                         __pSimpleItemBitmap->SetBackgroundColor(Color(0, 0, 0, 0));
3540                 }
3541
3542         }
3543         else
3544         {
3545                 if (__pSimpleItemBitmap != null)
3546                 {
3547                         delete __pSimpleItemBitmap;
3548                         __pSimpleItemBitmap = null;
3549                 }
3550         }
3551
3552         return E_SUCCESS;
3553 }
3554
3555 result
3556 _TableViewItem::SetSimpleTextColor(const Tizen::Graphics::Color& color, TableViewItemDrawingStatus status)
3557 {
3558         __simpleItemTextColor[status] = color;
3559
3560         return E_SUCCESS;
3561 }
3562
3563 Tizen::Graphics::Color
3564 _TableViewItem::GetSimpleItemTextColor(TableViewItemDrawingStatus status) const
3565 {
3566         return __simpleItemTextColor[status];
3567 }
3568
3569 result
3570 _TableViewItem::SetSimpleItemTextSize(int size)
3571 {
3572         __simpleItemTextSize = size;
3573
3574         if (__pSimpleItemText != null)
3575         {
3576                 __pSimpleItemText->SetTextConfig(__simpleItemTextSize, LABEL_TEXT_STYLE_NORMAL);
3577         }
3578         return E_SUCCESS;
3579 }
3580
3581 int
3582 _TableViewItem::GetSimpleItemTextSize(void) const
3583 {
3584         return __simpleItemTextSize;
3585 }
3586
3587 result
3588 _TableViewItem::SetSectionHeaderFooterContents(const Tizen::Base::String& text, HorizontalAlignment alignment, bool isHeader)
3589 {
3590         if (__pHeaderFooterItemText == null)
3591         {
3592                 result r = E_SUCCESS;
3593                 float contentsHeight = 0.0f;
3594                 float positionY = 0.0f;
3595                 Color textColor;
3596
3597                 GET_COLOR_CONFIG(TABLEVIEW::GROUPITEM_TEXT_NORMAL, textColor);
3598                 GET_SHAPE_CONFIG(TABLEVIEW::GROUPITEM_DEFAULT_TEXT_HEIGHT, _CONTROL_ORIENTATION_PORTRAIT, contentsHeight);
3599
3600                 __pHeaderFooterItemText = new (std::nothrow) Label();
3601
3602                 r = GetLastResult();
3603                 SysTryReturn(NID_UI_CTRL, __pHeaderFooterItemText != null, r, r, "[%s] Propagating.", GetErrorMessage(r));
3604
3605                 if (isHeader)
3606                 {
3607                         positionY = GetBoundsF().height - contentsHeight;
3608                 }
3609                 __pHeaderFooterItemText->Construct(FloatRectangle(0.0f, positionY, GetBoundsF().width, contentsHeight), text);
3610
3611                 __pHeaderFooterItemText->SetTextHorizontalAlignment(alignment);
3612                 __pHeaderFooterItemText->SetTextColor(textColor);
3613                 __pHeaderFooterItemText->SetBackgroundColor(Color(0, 0, 0, 0));
3614
3615                 _Label* pHeaderFooterItemTextCore = GetLabelCore(__pHeaderFooterItemText);
3616                 AttachChild(*pHeaderFooterItemTextCore);
3617         }
3618
3619         return E_SUCCESS;
3620 }
3621
3622 result
3623 _TableViewItem::SetSectionHeaderFooterAlignment(HorizontalAlignment alignment)
3624 {
3625         if (__pHeaderFooterItemText != null)
3626         {
3627                 __pHeaderFooterItemText->SetTextHorizontalAlignment(alignment);
3628                 __pHeaderFooterItemText->Invalidate(false);
3629         }
3630
3631         return E_SUCCESS;
3632 }
3633
3634 float
3635 _TableViewItem::GetAnnexWidth(TableViewAnnexStyle style)
3636 {
3637         float annexWidth = 0.0f;
3638         float annexDividerWidth = 0.0f;
3639
3640         switch (style)
3641         {
3642         case TABLE_VIEW_ANNEX_STYLE_NORMAL:
3643                 annexWidth = 0.0f;
3644                 break;
3645
3646         case TABLE_VIEW_ANNEX_STYLE_MARK:
3647                 GET_SHAPE_CONFIG(TABLEVIEW::ITEM_ANNEX_WIDTH, _CONTROL_ORIENTATION_PORTRAIT, annexWidth);
3648                 break;
3649
3650         case TABLE_VIEW_ANNEX_STYLE_ONOFF_SLIDING:
3651                 GET_SHAPE_CONFIG(TABLEVIEW::ITEM_ANNEX_ONOFF_WIDTH, _CONTROL_ORIENTATION_PORTRAIT, annexWidth);
3652                 break;
3653
3654         case TABLE_VIEW_ANNEX_STYLE_ONOFF_SLIDING_WITH_DIVIDER:
3655                 GET_SHAPE_CONFIG(TABLEVIEW::ITEM_ANNEX_MARGIN, _CONTROL_ORIENTATION_PORTRAIT, annexDividerWidth);
3656                 GET_FIXED_VALUE_CONFIG(TABLEVIEW::ITEM_ANNEX_DIVIDER_WIDTH, _CONTROL_ORIENTATION_PORTRAIT, annexDividerWidth);
3657                 GET_SHAPE_CONFIG(TABLEVIEW::ITEM_ANNEX_ONOFF_WIDTH, _CONTROL_ORIENTATION_PORTRAIT, annexWidth);
3658                 annexWidth = annexWidth + (annexDividerWidth*2) + annexDividerWidth;
3659                 break;
3660
3661         case TABLE_VIEW_ANNEX_STYLE_DETAILED:
3662                 GET_SHAPE_CONFIG(TABLEVIEW::ITEM_ANNEX_MORE_WIDTH, _CONTROL_ORIENTATION_PORTRAIT, annexWidth);
3663                 break;
3664
3665         case TABLE_VIEW_ANNEX_STYLE_RADIO:
3666                 GET_SHAPE_CONFIG(TABLEVIEW::ITEM_ANNEX_WIDTH, _CONTROL_ORIENTATION_PORTRAIT, annexWidth);
3667                 break;
3668
3669         default:
3670                 break;
3671         }
3672
3673         return annexWidth;
3674 }
3675
3676 void
3677 _TableViewItem::SetDrawingStatus(TableViewItemDrawingStatus status)
3678 {
3679         __drawingStatus = status;
3680 }
3681
3682 TableViewItemDrawingStatus
3683 _TableViewItem::GetDrawingStatus(void)
3684 {
3685         return __drawingStatus;
3686 }
3687
3688 void
3689 _TableViewItem::SetPressedControl(TableViewItemPressedControl pressedControl)
3690 {
3691         __pressedControl = pressedControl;
3692
3693         if(__pressedControl == TABLE_VIEW_ITEM_PRESSED_ITEM)
3694         {
3695                 __drawingStatus = TABLE_VIEW_ITEM_DRAWING_STATUS_PRESSED;
3696         }
3697         else if(__pressedControl == TABLE_VIEW_ITEM_PRESSED_ANNEX)
3698         {
3699                 if (__annexStyle == TABLE_VIEW_ANNEX_STYLE_DETAILED)
3700                 {
3701                         __isSelectedDetailButton = true;
3702                         __drawingStatus = TABLE_VIEW_ITEM_DRAWING_STATUS_NORMAL;
3703                 }
3704                 else if (__annexStyle == TABLE_VIEW_ANNEX_STYLE_ONOFF_SLIDING ||
3705                         __annexStyle == TABLE_VIEW_ANNEX_STYLE_ONOFF_SLIDING_WITH_DIVIDER)
3706                 {
3707                         __drawingStatus = TABLE_VIEW_ITEM_DRAWING_STATUS_NORMAL;
3708                 }
3709                 else
3710                 {
3711                         __drawingStatus = TABLE_VIEW_ITEM_DRAWING_STATUS_PRESSED;
3712                 }
3713         }
3714         else
3715         {
3716                 if(__pressedControl != TABLE_VIEW_ITEM_PRESSED_INDIVIDUAL)
3717                 {
3718                         __drawingStatus = TABLE_VIEW_ITEM_DRAWING_STATUS_PRESSED;
3719                 }
3720         }
3721 }
3722
3723 TableViewItemPressedControl
3724 _TableViewItem::GetPressedControl(void)
3725 {
3726         return __pressedControl;
3727 }
3728
3729 void
3730 _TableViewItem::AdjustChildControlMargin(void)
3731 {
3732         if (__childMarginState)
3733         {
3734                 return;
3735         }
3736
3737         if (IsTitleStyleItem())
3738         {
3739                 return;
3740         }
3741
3742         __childMarginState = true;
3743
3744         float margin = 0;
3745
3746         if (__pDrawingProperty->groupedLookEnabled)
3747         {
3748                 float groupedBarMargin = 0.0f;
3749                 GET_SHAPE_CONFIG(TABLEVIEW::GROUPITEM_BAR_WIDTH, _CONTROL_ORIENTATION_PORTRAIT, groupedBarMargin);
3750
3751                 margin = margin + groupedBarMargin;
3752         }
3753
3754         if (margin > 0)
3755         {
3756                 _VisualElement* pVisualElement = GetVisualElement();
3757
3758                 if (pVisualElement != null)
3759                 {
3760                         FloatPoint position;
3761
3762                         position.SetPosition(margin, 0.0f);
3763                         pVisualElement->ScrollByPoint(position, false);
3764                 }
3765         }
3766 }
3767
3768 void
3769 _TableViewItem::AdjustContextItemBounds(void)
3770 {
3771         _TableViewItem* pContextItem = GetContextItem();
3772
3773         if (pContextItem == null)
3774         {
3775                 return;
3776         }
3777
3778         FloatDimension contextItemSize = pContextItem->GetSizeF();
3779         FloatDimension itemSize = GetSizeF();
3780
3781         if (!_FloatCompare(contextItemSize.height, itemSize.height))
3782         {
3783                 contextItemSize.height = itemSize.height;
3784
3785                 pContextItem->SetSize(contextItemSize);
3786         }
3787
3788         pContextItem->AdjustChildControlCenterAlign();
3789 }
3790
3791 void
3792 _TableViewItem::AdjustAnnexBounds(void)
3793 {
3794         if (__pItemAnnex == null || __isMoveItemAnimationEnabled || __isZoomInOutItemAnimationEnabled ||__isFadeInOutItemAnimationEnabled)
3795         {
3796                 return;
3797         }
3798
3799         // h align
3800         if (__annexStyle == TABLE_VIEW_ANNEX_STYLE_ONOFF_SLIDING || __annexStyle == TABLE_VIEW_ANNEX_STYLE_ONOFF_SLIDING_WITH_DIVIDER || __annexStyle == TABLE_VIEW_ANNEX_STYLE_DETAILED)
3801         {
3802                 _Label* pAnnexCore = GetLabelCore(__pItemAnnex);
3803                 if (pAnnexCore->HasParent())
3804                 {
3805                         FloatRectangle annexBounds = __pItemAnnex->GetBoundsF();
3806                         float annexPositionX = annexBounds.x;
3807                         float leftMargin = 0.0f;
3808
3809                         GET_SHAPE_CONFIG(TABLEVIEW::ITEM_LEFT_MARGIN, _CONTROL_ORIENTATION_PORTRAIT, leftMargin);
3810                         leftMargin += __pDrawingProperty->scrollMargin;
3811
3812                         annexPositionX = GetBoundsF().width - annexBounds.width - leftMargin;
3813
3814                         if (!_FloatCompare(annexPositionX, annexBounds.x))
3815                         {
3816                                 __pItemAnnex->SetPosition(FloatPoint(annexPositionX, annexBounds.y));
3817                         }
3818                 }
3819         }
3820
3821         // v align
3822         FloatRectangle itemBounds = GetBoundsF();
3823         FloatRectangle annexBounds = __pItemAnnex->GetBoundsF();
3824
3825         if (__customHeight > 0)
3826         {
3827                 itemBounds.height = __customHeight;
3828         }
3829
3830         annexBounds.y = (itemBounds.height - annexBounds.height) / 2;
3831         __pItemAnnex->SetPosition(FloatPoint(annexBounds.x, annexBounds.y));
3832 }
3833
3834 void
3835 _TableViewItem::SetItemCustomHeight(float height)
3836 {
3837         __customHeight = height;
3838 }
3839
3840 float
3841 _TableViewItem::GetItemCustomHeight(void)
3842 {
3843         return __customHeight;
3844 }
3845
3846 void
3847 _TableViewItem::AdjustChildControlCenterAlign(void)
3848 {
3849         if (__childControlCenterAlign)
3850         {
3851                 FloatDimension itemSize = GetSizeF();
3852
3853                 int childControlCount = GetChildCount();
3854
3855                 for (int i = 0; i < childControlCount; i++)
3856                 {
3857                         _Control* pChildControl = GetChild(i);
3858
3859                         if (pChildControl == null)
3860                         {
3861                                 continue;
3862                         }
3863
3864                         if (__pItemDivider == pChildControl)
3865                         {
3866                                 float positionX = pChildControl->GetPositionF().x;
3867                                 pChildControl->SetPosition(FloatPoint(positionX, itemSize.height - 1));
3868                                 continue;
3869                         }
3870
3871                         if (__pItemTopDivider == pChildControl)
3872                         {
3873                                 float positionX = pChildControl->GetPositionF().x;
3874                                 pChildControl->SetPosition(FloatPoint(positionX, 0));
3875                                 continue;
3876                         }
3877
3878                         FloatRectangle itemBounds = pChildControl->GetBoundsF();
3879
3880                         itemBounds.y = (itemSize.height - itemBounds.height) / 2;
3881
3882                         pChildControl->SetPosition(FloatPoint(itemBounds.x, itemBounds.y));
3883                 }
3884         }
3885 }
3886
3887 void
3888 _TableViewItem::SetChildControlCenterAlign(bool centerAlign)
3889 {
3890         __childControlCenterAlign = centerAlign;
3891 }
3892
3893 Point
3894 _TableViewItem::GetLastTouchPressedPosition(void)
3895 {
3896         return _CoordinateSystemUtils::ConvertToInteger(__touchStartPosition);
3897 }
3898
3899 FloatPoint
3900 _TableViewItem::GetLastTouchPressedPositionF(void)
3901 {
3902         return __touchStartPosition;
3903 }
3904
3905 void
3906 _TableViewItem::SetLastTouchPressedPosition(FloatPoint position)
3907 {
3908         // This function was made to modify of ListView::RefreshList().
3909         // This function could adversely affect touch event handling. So, you should be used with caution.
3910         __touchStartPosition = position;
3911 }
3912
3913 void
3914 _TableViewItem::SetLastTouchPressedPosition(Point position)
3915 {
3916         // This function was made to modify of ListView::RefreshList().
3917         // This function could adversely affect touch event handling. So, you should be used with caution.
3918         __touchStartPosition = _CoordinateSystemUtils::ConvertToFloat(position);
3919 }
3920
3921 bool
3922 _TableViewItem::GetSelectionState(void)
3923 {
3924         return __itemSelected;
3925 }
3926
3927 void
3928 _TableViewItem::SetSelectionState(bool selected)
3929 {
3930         // This function was made to modify of ListView::RefreshList().
3931         // This function could adversely affect touch event handling. So, you should be used with caution.
3932         __itemSelected = selected;
3933 }
3934
3935 bool
3936 _TableViewItem::MoveItem(FloatPoint position, int duration, int delay)
3937 {
3938         _VisualElement* pVisualElement = GetVisualElement();
3939         VisualElementValueAnimation* pAnimation = null;
3940         String animationName = L"MOVE_ITEM";
3941         FloatPoint itemPosition = GetPositionF();
3942         result r = E_SUCCESS;
3943
3944         if (position == itemPosition)
3945         {
3946                 return false;
3947         }
3948
3949         if (__pMoveItemAnimation == null)
3950         {
3951                 __pMoveItemAnimation = new (std::nothrow) VisualElementValueAnimation;
3952                 SysTryCatch(NID_UI_CTRL, __pMoveItemAnimation != null, , E_OUT_OF_MEMORY, ("[E_OUT_OF_MEMORY] The memory is insufficient."));
3953
3954                 __pMoveItemAnimation->SetVisualElementAnimationTickEventListener(this);
3955                 r = GetLastResult();
3956                 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
3957
3958                 __pMoveItemAnimation->SetVisualElementAnimationStatusEventListener(this);
3959                 r = GetLastResult();
3960                 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
3961         }
3962
3963         pAnimation = __pMoveItemAnimation;
3964
3965         pAnimation->SetTimingFunction(VisualElementAnimation::GetTimingFunctionByName("EaseInOut"));
3966         pAnimation->SetDuration(duration);
3967         pAnimation->SetDelay(delay);
3968         pAnimation->SetStartValue(Variant(GetPositionF()));
3969         pAnimation->SetEndValue(Variant(position));
3970
3971         if (pVisualElement->AddAnimation(animationName, *pAnimation) != E_SUCCESS)
3972         {
3973                 return false;
3974         }
3975
3976         __animationCount++;
3977
3978         return true;
3979
3980 CATCH:
3981
3982         delete __pMoveItemAnimation;
3983         __pMoveItemAnimation = null;
3984
3985         return false;
3986 }
3987
3988 bool
3989 _TableViewItem::ZoomInOutItem(bool zoomOut, int duration, int delay)
3990 {
3991         _VisualElement* pVisualElement = GetVisualElement();
3992         VisualElementValueAnimation* pAnimation = null;
3993         String animationName = L"ZOOM_IN_OUT_ITEM";
3994         FloatDimension itemSize = GetSizeF();
3995         FloatDimension startValue;
3996         FloatDimension endValue;
3997         result r = E_SUCCESS;
3998
3999         if (__pZoomInOutItemAnimation == null)
4000         {
4001                 __pZoomInOutItemAnimation = new (std::nothrow) VisualElementValueAnimation;
4002                 SysTryCatch(NID_UI_CTRL, __pZoomInOutItemAnimation != null, , E_OUT_OF_MEMORY, ("[E_OUT_OF_MEMORY] The memory is insufficient."));
4003
4004                 __pZoomInOutItemAnimation->SetVisualElementAnimationTickEventListener(this);
4005                 r = GetLastResult();
4006                 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
4007
4008                 __pZoomInOutItemAnimation->SetVisualElementAnimationStatusEventListener(this);
4009                 r = GetLastResult();
4010                 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
4011         }
4012
4013         pAnimation = __pZoomInOutItemAnimation;
4014
4015         if (zoomOut)
4016         {
4017                 startValue = itemSize;
4018                 endValue = FloatDimension(itemSize.width, itemSize.height / 2);
4019                 pAnimation->SetTimingFunction(VisualElementAnimation::GetTimingFunctionByName(L"EaseOut"));
4020         }
4021         else
4022         {
4023                 startValue = FloatDimension(itemSize.width, itemSize.height / 2);
4024                 endValue = itemSize;
4025                 pAnimation->SetTimingFunction(VisualElementAnimation::GetTimingFunctionByName(L"EaseIn"));
4026         }
4027
4028         pAnimation->SetDuration(duration);
4029         pAnimation->SetDelay(delay);
4030         pAnimation->SetStartValue(Variant(startValue));
4031         pAnimation->SetEndValue(Variant(endValue));
4032
4033         if (pVisualElement->AddAnimation(animationName, *pAnimation) != E_SUCCESS)
4034         {
4035                 return false;
4036         }
4037
4038         __animationCount++;
4039
4040         return true;
4041
4042 CATCH:
4043         delete __pZoomInOutItemAnimation;
4044         __pZoomInOutItemAnimation = null;
4045
4046         return false;
4047 }
4048
4049 bool
4050 _TableViewItem::FadeInOutItem(bool fadeOut, int duration, int delay)
4051 {
4052         _VisualElement* pVisualElement = GetVisualElement();
4053         VisualElementValueAnimation* pAnimation = null;
4054         String animationName = L"FADE_IN_OUT_ITEM";
4055         float startValue = 0.0f;
4056         float endValue = 1.0f;
4057         result r = E_SUCCESS;
4058
4059         if (__pFadeInOutItemtAnimation == null)
4060         {
4061                 __pFadeInOutItemtAnimation = new (std::nothrow) VisualElementValueAnimation;
4062                 SysTryCatch(NID_UI_CTRL, __pFadeInOutItemtAnimation != null, , E_OUT_OF_MEMORY, ("[E_OUT_OF_MEMORY] The memory is insufficient."));
4063
4064                 __pFadeInOutItemtAnimation->SetVisualElementAnimationTickEventListener(this);
4065                 r = GetLastResult();
4066                 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
4067
4068                 __pFadeInOutItemtAnimation->SetVisualElementAnimationStatusEventListener(this);
4069                 r = GetLastResult();
4070                 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
4071         }
4072
4073         pAnimation = __pFadeInOutItemtAnimation;
4074
4075         if (fadeOut)
4076         {
4077                 startValue = 1.0f;
4078                 endValue = 0.0f;
4079                 pAnimation->SetTimingFunction(VisualElementAnimation::GetTimingFunctionByName(L"EaseOut"));
4080         }
4081         else
4082         {
4083                 pAnimation->SetTimingFunction(VisualElementAnimation::GetTimingFunctionByName(L"EaseIn"));
4084         }
4085
4086         pAnimation->SetTimingFunction(VisualElementAnimation::GetTimingFunctionByName("EaseIn"));
4087         pAnimation->SetDuration(duration);
4088         pAnimation->SetDelay(delay);
4089         pAnimation->SetStartValue(Variant(startValue));
4090         pAnimation->SetEndValue(Variant(endValue));
4091
4092         if (pVisualElement->AddAnimation(animationName, *pAnimation) != E_SUCCESS)
4093         {
4094                 return false;
4095         }
4096
4097         pVisualElement->SetOpacity(startValue);
4098
4099         __animationCount++;
4100
4101         return true;
4102
4103 CATCH:
4104
4105         delete __pFadeInOutItemtAnimation;
4106         __pFadeInOutItemtAnimation = null;
4107
4108         return false;
4109 }
4110
4111 result
4112 _TableViewItem::SetIndividualSelectionEnabled(const _Control& control, bool enable)
4113 {
4114         result r = E_SUCCESS;
4115         if (enable)
4116         {
4117                 if (!__individualSelectionControls.Contains(control))
4118                 {
4119                         r =  __individualSelectionControls.Add(control);
4120                 }
4121
4122                 _AccessibilityContainer* pContainer = const_cast<_Control*>(&control)->GetAccessibilityContainer();
4123                 pContainer->Activate(true);
4124         }
4125         else
4126         {
4127                 if (__individualSelectionControls.Contains(control))
4128                 {
4129                         r = __individualSelectionControls.Remove(control, false);
4130                 }
4131         }
4132         return r;
4133 }
4134
4135 bool
4136 _TableViewItem::IsIndividualSelectionEnabled(const _Control& control)
4137 {
4138         return __individualSelectionControls.Contains(control);
4139 }
4140
4141 int
4142 _TableViewItem::AddRef(void)
4143 {
4144         return ++__refCount;
4145 }
4146
4147 int
4148 _TableViewItem::Release(void)
4149 {
4150         --__refCount;
4151         if (__refCount <= 0)
4152         {
4153                 delete this;
4154                 return 0;
4155         }
4156
4157         return __refCount;
4158 }
4159
4160 bool
4161 _TableViewItem::IsAnimationPlaying(void)
4162 {
4163         if (__animationCount > 0)
4164         {
4165                 return true;
4166         }
4167
4168         return false;
4169 }
4170
4171 void
4172 _TableViewItem::StopAllAnimation(void)
4173 {
4174         _VisualElement* pVisualElement = GetVisualElement();
4175
4176         pVisualElement->RemoveAllAnimations();
4177 }
4178
4179 void
4180 _TableViewItem::SetItemDividerEnabled(bool enable)
4181 {
4182         __itemDividerEnabled = enable;
4183 }
4184
4185 void
4186 _TableViewItem::OnTickOccurred(const Tizen::Ui::Animations::VisualElementAnimation& animation, const Tizen::Base::String& keyName, Tizen::Ui::Animations::VisualElement& target, const Tizen::Ui::Variant& currentValue)
4187 {
4188         if (keyName == L"MOVE_ITEM")
4189         {
4190                 FloatPoint position = currentValue.ToFloatPoint();
4191                 SetPosition(position);
4192         }
4193         else if (keyName == L"FADE_IN_OUT_ITEM")
4194         {
4195                 float opacity = currentValue.ToFloat();
4196
4197                 _VisualElement* pVisualElement = GetVisualElement();
4198
4199                 if (pVisualElement != null)
4200                 {
4201                         pVisualElement->SetOpacity(opacity);
4202                 }
4203         }
4204         else if (keyName == L"ZOOM_IN_OUT_ITEM")
4205         {
4206                 FloatDimension size = currentValue.ToFloatDimension();
4207                 SetSize(size);
4208         }
4209 }
4210
4211 void
4212 _TableViewItem::OnVisualElementAnimationStarted(const Tizen::Ui::Animations::VisualElementAnimation& animation, const Tizen::Base::String& keyName, Tizen::Ui::Animations::VisualElement& target)
4213 {
4214         if (keyName == L"MOVE_ITEM")
4215         {
4216                 __isMoveItemAnimationEnabled = true;
4217         }
4218         else if (keyName == L"FADE_IN_OUT_ITEM")
4219         {
4220                 __isFadeInOutItemAnimationEnabled = true;
4221         }
4222         else if (keyName == L"ZOOM_IN_OUT_ITEM")
4223         {
4224                 __isZoomInOutItemAnimationEnabled = true;
4225         }
4226 }
4227
4228 void
4229 _TableViewItem::OnVisualElementAnimationRepeated(const Tizen::Ui::Animations::VisualElementAnimation& animation, const Tizen::Base::String& keyName, Tizen::Ui::Animations::VisualElement& target, long currentRepeatCount)
4230 {
4231 }
4232
4233 void
4234 _TableViewItem::OnVisualElementAnimationFinished(const Tizen::Ui::Animations::VisualElementAnimation& animation, const Tizen::Base::String& keyName, Tizen::Ui::Animations::VisualElement& target, bool completedNormally)
4235 {
4236         if (__isAnimationCallbackBlocked)
4237         {
4238                 return;
4239         }
4240
4241         bool tableViewItemAnimation = true;
4242         const VisualElementValueAnimation *pAnimation = dynamic_cast<const VisualElementValueAnimation*>(&(animation));
4243
4244         if (keyName == L"MOVE_ITEM")
4245         {
4246                 if (pAnimation != null)
4247                 {
4248                         FloatPoint position = pAnimation->GetEndValue().ToFloatPoint();
4249
4250                         SetPosition(position);
4251                 }
4252                 __isMoveItemAnimationEnabled = false;
4253         }
4254         else if (keyName == L"FADE_IN_OUT_ITEM")
4255         {
4256                 if (pAnimation != null)
4257                 {
4258                         float opacity = pAnimation->GetEndValue().ToFloat();
4259
4260                         _VisualElement* pVisualElement = GetVisualElement();
4261
4262                         if (pVisualElement != null)
4263                         {
4264                                 pVisualElement->SetOpacity(opacity);
4265                                 Invalidate();
4266                         }
4267                 }
4268                 __isFadeInOutItemAnimationEnabled = false;
4269         }
4270         else if (keyName == L"ZOOM_IN_OUT_ITEM")
4271         {
4272                 if (pAnimation != null)
4273                 {
4274                         FloatDimension size = pAnimation->GetEndValue().ToFloatDimension();
4275
4276                         SetSize(size);
4277                 }
4278                 __isZoomInOutItemAnimationEnabled = false;
4279         }
4280         else
4281         {
4282                 tableViewItemAnimation = false;
4283         }
4284
4285         if (tableViewItemAnimation)
4286         {
4287                 __animationCount--;
4288         }
4289
4290         return;
4291 }
4292
4293 result
4294 _TableViewItem::OnAttachedToMainTree(void)
4295 {
4296         if (!_FloatCompare(GetBoundsF().height, 0.0f))
4297         {
4298                 SetAccessibilityElement();
4299         }
4300
4301         return E_SUCCESS;
4302 }
4303
4304 void
4305 _TableViewItem::SetAccessibilityElement(void)
4306 {
4307         _AccessibilityContainer* pContainer = GetAccessibilityContainer();
4308         if(pContainer != null)
4309         {
4310                 if(__pAccessibilityElement == null)
4311                 {
4312                         __pAccessibilityElement = new (std::nothrow) _AccessibilityElement(true);
4313                         SysTryReturnVoidResult(NID_UI_CTRL, __pAccessibilityElement, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory shortage.");
4314
4315                         __pAccessibilityElement->SetTrait(ACCESSIBILITY_TRAITS_NONE);
4316                         __pAccessibilityElement->SetName(L"TableViewItem");
4317
4318                         pContainer->AddElement(*__pAccessibilityElement);
4319                 }
4320                 __pAccessibilityElement->SetBounds(FloatRectangle(0.0f,0.0f, GetBoundsF().width, GetBoundsF().height));
4321         }
4322 }
4323
4324 _AccessibilityElement*
4325 _TableViewItem::GetAccessibilityElement(void)
4326 {
4327         return __pAccessibilityElement;
4328 }
4329
4330 void
4331 _TableViewItem::SetAccessibilityElementLabel(void)
4332 {
4333         String accessibilityLabel;
4334         int childControlCount = GetChildCount();
4335         int groupIndex = -1;
4336         int itemIndex = -1;
4337
4338         for (int i = 0; i < childControlCount; i++)
4339         {
4340                 _Control* pChildControl = GetChild(i);
4341
4342                 if (pChildControl == null)
4343                 {
4344                         continue;
4345                 }
4346
4347                 if (__pItemDivider == pChildControl || __pItemTopDivider == pChildControl || __pItemCover == pChildControl)
4348                 {
4349                         continue;
4350                 }
4351
4352                 if (!IsIndividualSelectionEnabled(*pChildControl))
4353                 {
4354                         _AccessibilityContainer* pContainer = pChildControl->GetAccessibilityContainer();
4355                         LinkedListT<_AccessibilityElement*> accessibilityElements;
4356                         _AccessibilityElement* pElement = null;
4357
4358                         pContainer->GetElements(accessibilityElements);
4359                         pContainer->Activate(false);
4360                         int elementCount = accessibilityElements.GetCount();
4361
4362                         for (int i = 0; i < elementCount; i++)
4363                         {
4364                                 if (accessibilityElements.GetAt(i, pElement) == E_SUCCESS)
4365                                 {
4366                                         accessibilityLabel += pElement->GetLabel();
4367                                 }
4368                         }
4369                 }
4370         }
4371
4372         switch (__annexStyle)
4373         {
4374         case TABLE_VIEW_ANNEX_STYLE_NORMAL:
4375                 GetItemIndex(groupIndex, itemIndex);
4376                 if (groupIndex != -1 && itemIndex == -1)
4377                 {
4378                         accessibilityLabel += L"group index";
4379                 }
4380                 break;
4381
4382         case TABLE_VIEW_ANNEX_STYLE_MARK:
4383                 if (IsChecked())
4384                 {
4385                         accessibilityLabel += L"Tickbox ticked";
4386                 }
4387                 else
4388                 {
4389                         accessibilityLabel += L"Tickbox unticked";
4390                 }
4391                 break;
4392
4393         case TABLE_VIEW_ANNEX_STYLE_ONOFF_SLIDING:
4394         case TABLE_VIEW_ANNEX_STYLE_ONOFF_SLIDING_WITH_DIVIDER:
4395                 if (IsChecked())
4396                 {
4397                         accessibilityLabel += L"On/Off button On";
4398                 }
4399                 else
4400                 {
4401                         accessibilityLabel += L"On/Off button Off";
4402                 }
4403                 break;
4404
4405         case TABLE_VIEW_ANNEX_STYLE_DETAILED:
4406                 accessibilityLabel += L"button";
4407                 break;
4408
4409         case TABLE_VIEW_ANNEX_STYLE_RADIO:
4410                 if (IsChecked())
4411                 {
4412                         accessibilityLabel += L"Radio button selected";
4413                 }
4414                 else
4415                 {
4416                         accessibilityLabel += L"Radio button unselected";
4417                 }
4418                 break;
4419
4420         default:
4421                 break;
4422         }
4423
4424         if (!accessibilityLabel.IsEmpty())
4425         {
4426                 __pAccessibilityElement->SetLabel(accessibilityLabel);
4427         }
4428 }
4429
4430
4431 bool
4432 _TableViewItem::OnAccessibilityFocusMovedNext(const _AccessibilityContainer& control, const _AccessibilityElement& element)
4433 {
4434         return false;
4435 }
4436
4437 bool
4438 _TableViewItem::OnAccessibilityFocusMovedPrevious(const _AccessibilityContainer& control, const _AccessibilityElement& element)
4439 {
4440         return false;
4441 }
4442
4443 bool
4444 _TableViewItem::OnAccessibilityReadElement(const _AccessibilityContainer& control, const _AccessibilityElement& element)
4445 {
4446         return false;
4447 }
4448
4449 bool
4450 _TableViewItem::OnAccessibilityReadingElement(const _AccessibilityContainer& control, const _AccessibilityElement& element)
4451 {
4452         SetAccessibilityElementLabel();
4453
4454         return false;
4455 }
4456
4457 bool
4458 _TableViewItem::OnAccessibilityFocusIn(const _AccessibilityContainer& control, const _AccessibilityElement& element)
4459 {
4460         return false;
4461 }
4462
4463 bool
4464 _TableViewItem::OnAccessibilityFocusOut(const _AccessibilityContainer& control, const _AccessibilityElement& element)
4465 {
4466         return false;
4467 }
4468
4469 bool
4470 _TableViewItem::OnAccessibilityActionPerformed(const _AccessibilityContainer& control, const _AccessibilityElement& element)
4471 {
4472         switch (__annexStyle)
4473         {
4474         case TABLE_VIEW_ANNEX_STYLE_NORMAL:
4475                 break;
4476
4477         case TABLE_VIEW_ANNEX_STYLE_MARK:
4478                 if (IsChecked())
4479                 {
4480                         _AccessibilityManager::GetInstance()->ReadContent(L"ticked");
4481                 }
4482                 else
4483                 {
4484                         _AccessibilityManager::GetInstance()->ReadContent(L"unticked");
4485                 }
4486                 break;
4487
4488         case TABLE_VIEW_ANNEX_STYLE_ONOFF_SLIDING:
4489         case TABLE_VIEW_ANNEX_STYLE_ONOFF_SLIDING_WITH_DIVIDER:
4490                 if (IsChecked())
4491                 {
4492                         _AccessibilityManager::GetInstance()->ReadContent(L"On");
4493                 }
4494                 else
4495                 {
4496                         _AccessibilityManager::GetInstance()->ReadContent(L"Off");
4497                 }
4498                 break;
4499
4500         case TABLE_VIEW_ANNEX_STYLE_DETAILED:
4501                 break;
4502
4503         case TABLE_VIEW_ANNEX_STYLE_RADIO:
4504                 if (IsChecked())
4505                 {
4506                         _AccessibilityManager::GetInstance()->ReadContent(L"selected");
4507                 }
4508                 else
4509                 {
4510                         _AccessibilityManager::GetInstance()->ReadContent(L"unselected");
4511                 }
4512                 break;
4513
4514         default:
4515                 break;
4516         }
4517
4518         return false;
4519 }
4520
4521 bool
4522 _TableViewItem::OnAccessibilityValueIncreased(const _AccessibilityContainer& control, const _AccessibilityElement& element)
4523 {
4524         return false;
4525 }
4526
4527 bool
4528 _TableViewItem::OnAccessibilityValueDecreased(const _AccessibilityContainer& control, const _AccessibilityElement& element)
4529 {
4530         return false;
4531 }
4532
4533 }}} // Tizen::Ui::Controls
4534