2 // Open Service Platform
3 // Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
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
9 // http://www.apache.org/licenses/LICENSE-2.0/
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.
19 * @file FUiCtrl_TableViewItem.cpp
20 * @brief This is the implementation file for _TableViewItem class.
22 * This file contains the implementation of _TableViewItem class.
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"
35 #include "FUiCtrl_LabelImpl.h"
36 #include "FUi_Window.h"
38 using namespace Tizen::Base;
39 using namespace Tizen::Base::Runtime;
40 using namespace Tizen::Base::Collection;
41 using namespace Tizen::Ui::Animations;
42 using namespace Tizen::Graphics;
44 namespace Tizen { namespace Ui { namespace Controls
47 _TableViewItemControl::_TableViewItemControl(void)
48 :__pBackgroundBitmap(null)
52 _TableViewItemControl::~_TableViewItemControl(void)
54 if(__pBackgroundBitmap)
56 delete __pBackgroundBitmap;
57 __pBackgroundBitmap = null;
63 _TableViewItemControl::OnDraw(void)
65 Bitmap* pBitmap = GetBackgroundBitmap();
67 FloatRectangle bounds(0.0f, 0.0f, GetBoundsF().width, GetBoundsF().height); // +++ check floating
69 Color bgColor = GetBackgroundColor();
71 Canvas* pCanvas = null;
75 pCanvas = GetCanvasN();
78 SysLog(NID_UI_CTRL, "Cannot get a canvas.");
83 pCanvas->SetBackgroundColor(Color(0, 0, 0, 0));
86 if (_BitmapImpl::CheckNinePatchedBitmapStrictly(*pBitmap))
88 pCanvas->DrawNinePatchedBitmap(bounds, *pBitmap);
92 FloatRectangle drawingRect(0.0f, 0.0f, bounds.width, bounds.height);
93 pCanvas->DrawBitmap(drawingRect, *pBitmap);
99 if (IsCalledGetCanvasN() == false)
101 GetVisualElement()->SetBackgroundColor(_Colorf((float)bgColor.GetRed() / 255, (float)bgColor.GetGreen() / 255, (float)bgColor.GetBlue() / 255, (float)bgColor.GetAlpha() / 255));
105 pCanvas = GetCanvasN();
108 SysLog(NID_UI_CTRL, "Cannot get a canvas.");
113 pCanvas->SetBackgroundColor(Color(0, 0, 0, 0));
115 pCanvas->FillRectangle(GetBackgroundColor(), bounds); // +++ check floating
128 _TableViewItemControl::HitTest(const Graphics :: FloatPoint & point)
130 return HIT_TEST_NOWHERE;
133 _TableViewItemControl*
134 _TableViewItemControl::CreateTableViewItemControlN(void)
136 _TableViewItemControl* pItemControl = new (std::nothrow) _TableViewItemControl();
137 SysTryReturn(NID_UI_CTRL, pItemControl, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory is insufficient.");
138 SysTryCatch(NID_UI_CTRL, GetLastResult() == E_SUCCESS, , E_SYSTEM, "[E_SYSTEM] A system error occurred.");
140 pItemControl->AcquireHandle();
150 _TableViewItemControl::SetBackgroundBitmap(const Bitmap& bitmap)
154 Bitmap* pClonedBitmap = _BitmapImpl::CloneN(bitmap);
158 if (__pBackgroundBitmap != null)
160 delete __pBackgroundBitmap;
163 __pBackgroundBitmap = pClonedBitmap;
172 _TableViewItemControl::GetBackgroundBitmap(void) const
174 return __pBackgroundBitmap;
177 _TableViewItem::_TableViewItem(float itemHeight)
181 , __itemHeight(itemHeight)
182 , __itemGroupIndex(-1)
184 , __checkedState(false)
185 , __enabledState(true)
186 , __itemChanged(true)
187 , __reorderMode(false)
188 , __itemSelected(false)
189 , __itemTouchMoved(false)
190 , __childMarginState(false)
191 , __annexStyle(TABLE_VIEW_ANNEX_STYLE_NORMAL)
192 , __drawingStatus(TABLE_VIEW_ITEM_DRAWING_STATUS_NORMAL)
193 , __selectionStyle(TABLE_VIEW_ITEM_SELECTION_STYLE_WHOLE)
194 , __itemType(TABLE_VIEW_ITEM_TYPE_NONE)
195 , __pContextItem(null)
196 , __isContextItem(false)
197 , __isContextItemActivated(false)
198 , __checkItemHeightNeeded(false)
199 , __pItemDivider(null)
200 , __pItemTopDivider(null)
203 , __pItemAnnexLeftDivider(null)
204 , __pItemAnnexRightDivider(null)
206 , __pDrawingProperty(null)
207 , __itemDividerEnabled(true)
208 , __pSimpleItemText(null)
209 , __pSimpleItemBitmap(null)
210 , __simpleItemTextSize(0)
211 , __pHeaderFooterItemText(null)
213 , __touchStartPosition(0.0f, 0.0f)
214 , __annexTouchStartPosition(0)
215 , __annexOnOffHandlerMoved(false)
216 , __annexOnOffHandlerPositionX(0.0f)
217 , __childControlCenterAlign(false)
218 , __customHeight(0.0f)
219 , __animationCount(0)
220 , __pAccessibilityElement(null)
221 , __pPressedTimer(null)
222 , __pReleasedTimer(null)
223 , __isPressedTimerEnabled(false)
224 , __isReleasedTimerEnabled(false)
225 , __pressedControl(TABLE_VIEW_ITEM_PRESSED_NONE)
226 , __releasedControl(TABLE_VIEW_ITEM_PRESSED_NONE)
227 , __pCheckedTimer(null)
228 , __isCheckedTimerEnabled(false)
229 , __isCheckedAnimationEnabled(false)
231 , __checkedBounds(FloatRectangle(0.0f, 0.0f, 0.0f, 0.0f))
232 , __isItemLayoutEnabled(false)
233 , __isMoveItemAnimationEnabled(false)
234 , __isZoomInOutItemAnimationEnabled(false)
235 , __isFadeInOutItemAnimationEnabled(false)
236 , __isAnimationCallbackBlocked(false)
237 , __isItemTapSoundEnabled(true)
238 , __isTabSoundPlayed(false)
239 , __isSelectedDetailButton(false)
240 , __isSimpleLastItem(false)
241 , __isTouchPressOnScroll(false)
242 , __pHighlightVisualElement(null)
243 , __pBitmapVisualElement(null)
244 , __pMoveItemAnimation(null)
245 , __pZoomInOutItemAnimation(null)
246 , __pFadeInOutItemtAnimation(null)
248 for (int i = 0; i < 3; i++)
250 __pItemBgBitmap[i] = null;
253 GET_COLOR_CONFIG(TABLEVIEW::ITEM_BG_NORMAL, __colorItemBg[TABLE_VIEW_ITEM_DRAWING_STATUS_NORMAL]); // for support opacity 0x00
254 GET_COLOR_CONFIG(TABLEVIEW::ITEM_BG_PRESSED, __colorItemBg[TABLE_VIEW_ITEM_DRAWING_STATUS_PRESSED]);
255 GET_COLOR_CONFIG(TABLEVIEW::ITEM_BG_HIGHLIGHTED, __colorItemBg[TABLE_VIEW_ITEM_DRAWING_STATUS_HIGHLIGHTED]);
257 GET_COLOR_CONFIG(TABLEVIEW::ITEM_TEXT_NORMAL, __simpleItemTextColor[TABLE_VIEW_ITEM_DRAWING_STATUS_NORMAL]);
258 GET_COLOR_CONFIG(TABLEVIEW::ITEM_TEXT_PRESSED, __simpleItemTextColor[TABLE_VIEW_ITEM_DRAWING_STATUS_PRESSED]);
259 GET_COLOR_CONFIG(TABLEVIEW::ITEM_TEXT_HIGHLIGHTED, __simpleItemTextColor[TABLE_VIEW_ITEM_DRAWING_STATUS_HIGHLIGHTED]);
260 GET_COLOR_CONFIG(TABLEVIEW::GROUPITEM_TEXT_NORMAL, __simpleItemTextColor[TABLE_VIEW_GROUPITEM_DRAWING_STATUS_NORMAL]);
261 GET_COLOR_CONFIG(TABLEVIEW::GROUPITEM_TEXT_PRESSED, __simpleItemTextColor[TABLE_VIEW_GROUPITEM_DRAWING_STATUS_PRESSED]);
262 GET_COLOR_CONFIG(TABLEVIEW::ITEM_TEXT_DISABLED, __simpleItemTextColor[TABLE_VIEW_SIMPLEITEM_DRAWING_STATUS_DISABLED]);
265 _AccessibilityContainer* pContainer = GetAccessibilityContainer();
268 pContainer->Activate(true);
269 pContainer->AddListener(*this);
273 _TableViewItem::~_TableViewItem()
275 __isAnimationCallbackBlocked = true;
277 StopTouchPressedTimer();
278 delete __pPressedTimer;
279 __pPressedTimer = null;
281 StopTouchReleasedTimer();
282 delete __pReleasedTimer;
283 __pReleasedTimer = null;
285 _VisualElement* pVisualElement = GetVisualElement();
286 if (pVisualElement != null)
288 if(__pMoveItemAnimation != null)
290 __pMoveItemAnimation->SetVisualElementAnimationTickEventListener(null);
291 __pMoveItemAnimation->SetVisualElementAnimationStatusEventListener(null);
294 if(__pZoomInOutItemAnimation != null)
296 __pZoomInOutItemAnimation->SetVisualElementAnimationTickEventListener(null);
297 __pZoomInOutItemAnimation->SetVisualElementAnimationStatusEventListener(null);
300 if(__pFadeInOutItemtAnimation != null)
302 __pFadeInOutItemtAnimation->SetVisualElementAnimationTickEventListener(null);
303 __pFadeInOutItemtAnimation->SetVisualElementAnimationStatusEventListener(null);
305 pVisualElement->RemoveAllAnimations();
308 for (int j = 0; j < 3; j++)
310 delete __pItemBgBitmap[j];
311 __pItemBgBitmap[j] = null;
314 if (__pHighlightVisualElement != null)
316 __pHighlightVisualElement->RemoveAllAnimations();
317 __pHighlightVisualElement->SetAnimationProvider(null);
318 __pHighlightVisualElement->Destroy();
319 __pHighlightVisualElement = null;
322 if (__pBitmapVisualElement != null)
324 __pBitmapVisualElement->RemoveAllAnimations();
325 __pBitmapVisualElement->SetAnimationProvider(null);
326 __pBitmapVisualElement->Destroy();
327 __pBitmapVisualElement = null;
332 if (GetParent() != null && __isContextItem == true)
334 GetParent()->DetachChild(*this);
337 delete __pItemDivider;
338 __pItemDivider = null;
340 delete __pItemTopDivider;
341 __pItemTopDivider = null;
343 delete __pItemAnnexLeftDivider;
344 __pItemAnnexLeftDivider = null;
346 delete __pItemAnnexRightDivider;
347 __pItemAnnexRightDivider = null;
358 delete __pHeaderFooterItemText;
359 __pHeaderFooterItemText = null;
361 delete __pMoveItemAnimation;
362 __pMoveItemAnimation = null;
364 delete __pZoomInOutItemAnimation;
365 __pZoomInOutItemAnimation = null;
367 delete __pFadeInOutItemtAnimation;
368 __pFadeInOutItemtAnimation = null;
370 if (__isCheckedTimerEnabled)
372 __pCheckedTimer->Cancel();
375 delete __pCheckedTimer;
376 __pCheckedTimer = null;
378 if (__pAccessibilityElement)
380 _AccessibilityContainer* pContainer = GetAccessibilityContainer();
383 pContainer->RemoveAllElement();
385 __pAccessibilityElement = null;
390 _TableViewItem::CreateTableViewItemN(float itemHeight)
392 result r = E_SUCCESS;
394 _TableViewItem* pItem = null;
395 pItem = new (std::nothrow) _TableViewItem(itemHeight);
396 SysTryReturn(NID_UI_CTRL, pItem, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient.");
398 pItem->AcquireHandle();
400 r = pItem->Initialize();
401 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r = E_SYSTEM, "[E_SYSTEM] Unable to create TableView Item");
412 _TableViewItem::Initialize(void)
414 GetVisualElement()->SetSurfaceOpaque(false);
416 result r = E_SUCCESS;
418 __pHighlightVisualElement = new (std::nothrow) _VisualElement();
419 SysTryCatch(NID_UI_CTRL, __pHighlightVisualElement != null, r = E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
421 r = __pHighlightVisualElement->Construct();
422 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Failed to construct Visual Element.", GetErrorMessage(r));
424 r = __pHighlightVisualElement->SetSurfaceOpaque(false);
425 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Failed to set surface opaque.", GetErrorMessage(r));
427 __pHighlightVisualElement->SetImplicitAnimationEnabled(false);
429 r = GetVisualElement()->AttachChild(*__pHighlightVisualElement);
430 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Failed to attach child to the control VisualElement.", GetErrorMessage(r));
432 r = SetItemHighlightBounds(*__pHighlightVisualElement, CalculateItemHighlightBounds());
433 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Failed to set bounds.", GetErrorMessage(r));
435 __pHighlightVisualElement->SetBackgroundColor(_Colorf(0.0f, 0.0f, 0.0f, 0.0f));
436 __pHighlightVisualElement->SetShowState(true);
438 r = __individualSelectionControls.Construct(DEFAULT_CAPTURED_CONTROL_COUNT);
439 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Failed to construct ArrayList", GetErrorMessage(r));
441 SetTouchPressThreshold(SENSITIVE);
443 if (!_FloatCompare(__itemHeight, 0.0f))
445 SetAccessibilityElement();
448 GetAccessibilityContainer()->Activate(false);
453 if (__pHighlightVisualElement != null)
455 __pHighlightVisualElement->RemoveAllAnimations();
456 __pHighlightVisualElement->SetAnimationProvider(null);
457 __pHighlightVisualElement->Destroy();
458 __pHighlightVisualElement = null;
465 _TableViewItem::GetContextItem(void) const
467 return __pContextItem;
471 _TableViewItem::SetContextItem(_TableViewItem* pContextItem)
473 if (pContextItem != null)
475 pContextItem->__isContextItem = true;
478 __pContextItem = pContextItem;
482 _TableViewItem::IsContextItem(void) const
484 return __isContextItem;
488 _TableViewItem::SetContextItemActivation(bool activated)
490 __isContextItemActivated = activated;
494 _TableViewItem::IsContextItemActivated(void) const
496 return __isContextItemActivated;
500 _TableViewItem::CreateItemDimLayer(void)
502 result r = E_SUCCESS;
504 if (__pDimLayer == null)
506 __pDimLayer = _Label::CreateLabelN();
509 SysTryReturn(NID_UI_CTRL, __pDimLayer != null, r, r, "[%s] Propagating.", GetErrorMessage(r));
511 __pDimLayer->SetBackgroundColor(Color(0, 0, 0, BACKGROUND_DIMMED_OPACITY * 0xff));
512 __pDimLayer->SetVisibleState(false);
514 AttachSystemChild(*__pDimLayer);
521 _TableViewItem::CreateItemDivider(void)
523 result r = E_SUCCESS;
525 if (__pItemDivider == null)
527 __pItemDivider = _TableViewItemControl::CreateTableViewItemControlN();
529 SysTryReturn(NID_UI_CTRL, __pItemDivider != null, r, r, "[%s] Propagating.", GetErrorMessage(r));
530 __pItemDivider->SetFocusable(false);
531 AttachSystemChild(*__pItemDivider);
533 _AccessibilityContainer* pContainer = __pItemDivider->GetAccessibilityContainer();
534 pContainer->Activate(false);
537 if (__pItemTopDivider == null)
539 __pItemTopDivider = _TableViewItemControl::CreateTableViewItemControlN();
540 SysTryReturn(NID_UI_CTRL, __pItemTopDivider != null, r, r, "[%s] Propagating.", GetErrorMessage(r));
541 __pItemTopDivider->SetFocusable(false);
542 AttachSystemChild(*__pItemTopDivider);
544 _AccessibilityContainer* pContainer = __pItemTopDivider->GetAccessibilityContainer();
545 pContainer->Activate(false);
552 _TableViewItem::CreateItemAnnexDivider(void)
554 result r = E_SUCCESS;
556 if (__pItemAnnexLeftDivider == null)
558 __pItemAnnexLeftDivider = _TableViewItemControl::CreateTableViewItemControlN();
560 SysTryReturn(NID_UI_CTRL, __pItemAnnexLeftDivider != null, r, r, "[%s] Propagating.", GetErrorMessage(r));
561 __pItemAnnexLeftDivider->SetFocusable(false);
562 AttachSystemChild(*__pItemAnnexLeftDivider);
565 if (__pItemAnnexRightDivider == null)
567 __pItemAnnexRightDivider = _TableViewItemControl::CreateTableViewItemControlN();
568 SysTryReturn(NID_UI_CTRL, __pItemAnnexRightDivider != null, r, r, "[%s] Propagating.", GetErrorMessage(r));
569 __pItemAnnexRightDivider->SetFocusable(false);
570 AttachSystemChild(*__pItemAnnexRightDivider);
577 _TableViewItem::CreateItemCover(void)
579 result r = E_SUCCESS;
581 if (__pItemCover == null)
583 __pItemCover = _TableViewItemControl::CreateTableViewItemControlN();
585 SysTryReturn(NID_UI_CTRL, __pItemCover != null, r, r, "[%s] Propagating.", GetErrorMessage(r));
586 __pItemCover->SetFocusable(false);
587 AttachSystemChild(*__pItemCover);
594 _TableViewItem::CreateCheckBox(void)
596 result r = E_SUCCESS;
598 if (__pItemAnnex == null)
600 float annexWidth = 0.0f;
601 float annexHeight = 0.0f;
602 GET_SHAPE_CONFIG(TABLEVIEW::ITEM_ANNEX_WIDTH, _CONTROL_ORIENTATION_PORTRAIT, annexWidth);
603 GET_SHAPE_CONFIG(TABLEVIEW::ITEM_ANNEX_HEIGHT, _CONTROL_ORIENTATION_PORTRAIT, annexHeight);
605 __pItemAnnex = new (std::nothrow) Label();
607 SysTryReturn(NID_UI_CTRL, __pItemAnnex != null, r, r, "[%s] Propagating.", GetErrorMessage(r));
609 float leftMargin = 0.0f;
610 GET_SHAPE_CONFIG(TABLEVIEW::ITEM_LEFT_MARGIN, _CONTROL_ORIENTATION_PORTRAIT, leftMargin);
612 float itemHeight = ((__customHeight > 0) ? __customHeight : GetBoundsF().height);
613 __pItemAnnex->Construct(FloatRectangle(leftMargin, ((itemHeight - annexHeight) / 2), annexWidth, annexHeight), L"");
614 __pItemAnnex->SetBackgroundColor(Color(0, 0, 0, 0));
615 GetLabelCore(__pItemAnnex)->SetFocusable(true);
617 AttachSystemChild(*GetLabelCore(__pItemAnnex));
625 _TableViewItem::CreateRadioBox(void)
627 result r = E_SUCCESS;
629 if (__pItemAnnex == null)
631 float annexWidth = 0.0f;
632 float annexHeight = 0.0f;
633 GET_SHAPE_CONFIG(TABLEVIEW::ITEM_ANNEX_WIDTH, _CONTROL_ORIENTATION_PORTRAIT, annexWidth);
634 GET_SHAPE_CONFIG(TABLEVIEW::ITEM_ANNEX_HEIGHT, _CONTROL_ORIENTATION_PORTRAIT, annexHeight);
636 __pItemAnnex = new (std::nothrow) Label();
638 SysTryReturn(NID_UI_CTRL, __pItemAnnex != null, r, r, "[%s] Propagating.", GetErrorMessage(r));
640 float leftMargin = 0.0f;
641 GET_SHAPE_CONFIG(TABLEVIEW::ITEM_LEFT_MARGIN, _CONTROL_ORIENTATION_PORTRAIT, leftMargin);
643 float itemHeight = ((__customHeight > 0) ? __customHeight : GetBoundsF().height);
644 __pItemAnnex->Construct(FloatRectangle(leftMargin, ((itemHeight - annexHeight) / 2), annexWidth, annexHeight), L"");
645 __pItemAnnex->SetBackgroundColor(Color(0, 0, 0, 0));
646 GetLabelCore(__pItemAnnex)->SetFocusable(true);
648 AttachSystemChild(*GetLabelCore(__pItemAnnex));
655 _TableViewItem::CreateOnOffButton(void)
657 result r = E_SUCCESS;
659 if (__pItemAnnex == null)
661 float annexWidth = 0.0f;
662 float annexHeight = 0.0f;
664 GET_SHAPE_CONFIG(TABLEVIEW::ITEM_ANNEX_ONOFF_WIDTH, _CONTROL_ORIENTATION_PORTRAIT, annexWidth);
665 GET_SHAPE_CONFIG(TABLEVIEW::ITEM_ANNEX_ONOFF_HEIGHT, _CONTROL_ORIENTATION_PORTRAIT, annexHeight);
667 __pItemAnnex = new (std::nothrow) Label();
669 SysTryReturn(NID_UI_CTRL, __pItemAnnex != null, r, r, "[%s] Propagating.", GetErrorMessage(r));
671 float leftMargin = 0.0f;
672 GET_SHAPE_CONFIG(TABLEVIEW::ITEM_LEFT_MARGIN, _CONTROL_ORIENTATION_PORTRAIT, leftMargin);
674 leftMargin += __pDrawingProperty->scrollMargin;
676 float itemHeight = ((__customHeight > 0) ? __customHeight : GetBoundsF().height);
677 __pItemAnnex->Construct(FloatRectangle((GetBoundsF().width - annexWidth - leftMargin), ((itemHeight - annexHeight) / 2), annexWidth, annexHeight), L"");
678 __pItemAnnex->SetBackgroundColor(Color(0, 0, 0, 0));
679 GetLabelCore(__pItemAnnex)->SetFocusable(true);
681 AttachSystemChild(*GetLabelCore(__pItemAnnex));
688 _TableViewItem::CreateDetailButton(void)
690 result r = E_SUCCESS;
692 if (__pItemAnnex == null)
694 float annexWidth = 0.0f;
695 float annexHeight = 0.0f;
697 GET_SHAPE_CONFIG(TABLEVIEW::ITEM_ANNEX_MORE_WIDTH, _CONTROL_ORIENTATION_PORTRAIT, annexWidth);
698 GET_SHAPE_CONFIG(TABLEVIEW::ITEM_ANNEX_MORE_HEIGHT, _CONTROL_ORIENTATION_PORTRAIT, annexHeight);
699 __pItemAnnex = new (std::nothrow) Label();
701 SysTryReturn(NID_UI_CTRL, __pItemAnnex != null, r, r, "[%s] Propagating.", GetErrorMessage(r));
703 float leftMargin = 0.0f;
704 GET_SHAPE_CONFIG(TABLEVIEW::ITEM_LEFT_MARGIN, _CONTROL_ORIENTATION_PORTRAIT, leftMargin);
706 leftMargin += __pDrawingProperty->scrollMargin;
707 float itemHeight = ((__customHeight > 0) ? __customHeight : GetBoundsF().height);
708 __pItemAnnex->Construct(FloatRectangle((GetBoundsF().width - annexWidth - leftMargin), ((itemHeight - annexHeight) / 2), annexWidth, annexHeight), L"");
709 __pItemAnnex->SetBackgroundColor(Color(0, 0, 0, 0));
710 GetLabelCore(__pItemAnnex)->SetFocusable(true);
712 AttachSystemChild(*GetLabelCore(__pItemAnnex));
719 _TableViewItem::GetLabelCore(Label* label)
726 _LabelImpl* pImpl = _LabelImpl::GetInstance(*label);
727 return &pImpl->GetCore();
731 _TableViewItem::ExposeContextItem(FloatRectangle itemBounds, float targetWidth)
734 if (__pDimLayer == null)
736 if (CreateItemDimLayer() != E_SUCCESS)
742 SetBounds(itemBounds);
746 if ((itemBounds.width <= 0) || (itemBounds.width >= targetWidth)) // +++ check floating
753 float rightMargin = 0.0f;
754 float dimLayerOpacity = 0.0f;
756 GET_SHAPE_CONFIG(TABLEVIEW::CONTEXTITEM_RIGHT_MARGIN, _CONTROL_ORIENTATION_PORTRAIT, rightMargin);
758 dimLayerOpacity = BACKGROUND_DIMMED_OPACITY - ((itemBounds.width * BACKGROUND_DIMMED_OPACITY) / (targetWidth - rightMargin));
759 dimLayerOpacity = ((dimLayerOpacity < 0) ? 0 : dimLayerOpacity); // +++ check floating
761 __pDimLayer->SetBounds(FloatRectangle(0.0f, 0.0f, itemBounds.width, itemBounds.height));
762 __pDimLayer->SetBackgroundColor(Color(0.0f, 0.0f, 0.0f, dimLayerOpacity * 0xff));
765 __pDimLayer->SetVisibleState(visible);
770 _TableViewItem::DrawItemDimLayer(bool visible)
772 if (__pDimLayer == null)
774 if (CreateItemDimLayer() != E_SUCCESS)
782 FloatDimension itemSize = GetSizeF();
783 __pDimLayer->SetBounds(FloatRectangle(0.0f, 0.0f, itemSize.width, itemSize.height));
784 __pDimLayer->SetBackgroundColor(Color(0, 0, 0, BACKGROUND_DISABLED_OPACITY * 0xff));
787 __pDimLayer->SetVisibleState(visible);
791 _TableViewItem::SetItemWidth(float width)
797 _TableViewItem::SetItemBackgroundBitmap(ListItemState itemState, const Bitmap* pBitmap)
799 Bitmap* pCopyBitmap = null;
801 pCopyBitmap = _BitmapImpl::CloneN(*pBitmap);
802 SysTryReturn(NID_UI_CTRL, pCopyBitmap != null, false, E_OUT_OF_MEMORY, ("[E_OUT_OF_MEMORY] The memory is insufficient."));
804 delete __pItemBgBitmap[itemState];
805 __pItemBgBitmap[itemState] = pCopyBitmap;
808 if(__pItemBgBitmap[TABLE_VIEW_ITEM_DRAWING_STATUS_NORMAL] == null &&
809 __pItemBgBitmap[TABLE_VIEW_ITEM_DRAWING_STATUS_PRESSED] == null &&
810 __pItemBgBitmap[TABLE_VIEW_ITEM_DRAWING_STATUS_HIGHLIGHTED] == null)
812 if(__pBitmapVisualElement != null)
814 __pBitmapVisualElement->Destroy();
815 __pBitmapVisualElement = null;
820 if(__pBitmapVisualElement == null)
822 FloatRectangle bounds = GetBoundsF();
823 result r = E_SUCCESS;
825 __pBitmapVisualElement = new (std::nothrow) _VisualElement();
826 SysTryCatch(NID_UI_CTRL, __pBitmapVisualElement != null, , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient.");
828 r = __pBitmapVisualElement->Construct();
829 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
831 __pBitmapVisualElement->SetSurfaceOpaque(false);
832 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Failed to set surface opaque.", GetErrorMessage(r));
834 __pBitmapVisualElement->SetImplicitAnimationEnabled(false);
835 __pBitmapVisualElement->SetBounds(FloatRectangle(0.0f, 0.0f, bounds.width, bounds.height));
836 __pBitmapVisualElement->SetShowState(true);
838 GetVisualElement()->AttachChild(*__pBitmapVisualElement);
842 SetItemChanged(true);
845 if (__pBitmapVisualElement != null)
847 __pBitmapVisualElement->RemoveAllAnimations();
848 __pBitmapVisualElement->SetAnimationProvider(null);
849 __pBitmapVisualElement->Destroy();
850 __pBitmapVisualElement = null;
855 Tizen::Graphics::Bitmap*
856 _TableViewItem::GetItemBackgroundBitmap(ListItemState itemState) const
858 return __pItemBgBitmap[itemState];
862 _TableViewItem::SetItemBackgroundColor(ListItemState itemState, const Color bgColor)
864 if(__colorItemBg[itemState] == bgColor)
869 __colorItemBg[itemState] = bgColor;
871 SetItemChanged(true);
875 _TableViewItem::GetItemBackgroundColor(ListItemState itemState) const
877 return __colorItemBg[itemState];
881 _TableViewItem::SetItemStyle(TableViewAnnexStyle style)
883 if (__annexStyle == style)
888 __annexStyle = style;
892 _TableViewItem::SetSelectionStyle(TableViewItemSelectionStyle style)
894 __selectionStyle = style;
899 TableViewItemSelectionStyle
900 _TableViewItem::GetSelectionStyle(void) const
902 return __selectionStyle;
906 _TableViewItem::GetItemHeight(void) const
908 return GetSizeF().height;
912 _TableViewItem::SetItemHeight(int itemHeight)
914 SetItemHeight(_CoordinateSystemUtils::ConvertToFloat(itemHeight));
918 _TableViewItem::SetItemHeight(float itemHeight)
920 if(_FloatCompare(GetSizeF().height, itemHeight))
925 SetSize(FloatDimension(GetSizeF().width, itemHeight));
929 _TableViewItem::SetChecked(bool checked)
931 if (__checkedState == checked)
936 __checkedState = checked;
938 SetItemChanged(true);
942 _TableViewItem::IsChecked(void) const
944 return __checkedState;
948 _TableViewItem::SetCheckedAnimationEnabled(bool enabled)
950 if(__isCheckedAnimationEnabled == enabled)
955 __isCheckedAnimationEnabled = enabled;
957 if (__isCheckedAnimationEnabled == false)
959 StopCheckBoxAnimation();
964 _TableViewItem::SetItemEnabled(bool enabled)
966 if (__enabledState == enabled)
971 __enabledState = enabled;
973 SetEnableState(enabled);
975 SetItemChanged(true);
983 _TableViewItem::IsItemEnabled(void) const
985 return __enabledState;
989 _TableViewItem::SetItemType(const TableViewItemType itemType)
991 if(__itemType == itemType)
996 __itemType = itemType;
998 if (__pContextItem != null)
1000 __pContextItem->SetItemType(__itemType);
1003 if(itemType == TABLE_VIEW_ITEM_TYPE_TITLE)
1006 GET_COLOR_CONFIG(TABLEVIEW::ITEM_BG_PRESSED, titleColor);
1007 if(titleColor == __colorItemBg[TABLE_VIEW_ITEM_DRAWING_STATUS_PRESSED])
1009 GET_COLOR_CONFIG(TABLEVIEW::GROUPITEM_BG_PRESSED, __colorItemBg[TABLE_VIEW_ITEM_DRAWING_STATUS_PRESSED]);
1011 GetAccessibilityContainer()->Activate(true);
1016 _TableViewItem::SetItemIndex(int groupIndex, int itemIndex)
1018 __itemGroupIndex = groupIndex;
1019 __itemIndex = itemIndex;
1023 _TableViewItem::GetItemIndex(int& groupIndex, int& itemIndex) const
1025 groupIndex = __itemGroupIndex;
1026 itemIndex = __itemIndex;
1031 _TableViewItem::GetItemType(void) const
1037 _TableViewItem::IsReorderMode(void) const
1039 return __reorderMode;
1043 _TableViewItem::SetReorderMode(bool enabled)
1045 __reorderMode = enabled;
1049 _TableViewItem::SetAppInfo(const void* pAppInfo)
1051 __pAppInfo = const_cast<void*>(pAppInfo);
1055 _TableViewItem::GetAppInfo(void) const
1061 _TableViewItem::SetItemChanged(bool changed)
1063 __itemChanged = changed;
1067 _TableViewItem::IsItemChanged(void) const
1069 return __itemChanged;
1073 _TableViewItem::IsAnnexOnOffSliding(void)
1075 return __annexOnOffHandlerMoved;
1079 _TableViewItem::GetItemStyle(void) const
1081 return __annexStyle;
1085 _TableViewItem::DrawItem(FloatRectangle& rcItem, ListItemState itemState, bool itemDivider)
1091 _TableViewItem::SetItemTapSoundEnabled(bool tapSoundEnabled)
1093 bool oldValue = __isItemTapSoundEnabled;
1094 __isItemTapSoundEnabled = tapSoundEnabled;
1099 _TableViewItem::GetItemTapSoundEnabled(void)
1101 return __isItemTapSoundEnabled;
1104 Tizen::Graphics::Canvas*
1105 _TableViewItem::OnCanvasRequestedN(const Tizen::Graphics::FloatRectangle& bounds)
1107 Canvas* pCanvas = null;
1109 if(__pBitmapVisualElement != null && __pBitmapVisualElement->GetImageSource().IsEmpty())
1111 Bitmap* pDrawBitmap = __pItemBgBitmap[__drawingStatus];
1112 if(pDrawBitmap != null)
1114 pCanvas = __pBitmapVisualElement->GetCanvasN();
1115 SysTryCatch(NID_UI_CTRL, pCanvas != null, , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient.");
1116 pCanvas->SetBackgroundColor(Color(0, 0, 0, 0));
1119 pDrawBitmap->IsNinePatchedBitmap();
1120 DrawBitmap(*pCanvas, FloatRectangle(0.0f, 0.0f, bounds.width, bounds.height), *pDrawBitmap);
1130 _TableViewItem::FireItemEvent(bool selectedItem)
1134 || __itemType == TABLE_VIEW_ITEM_TYPE_HEADER
1135 || __itemType == TABLE_VIEW_ITEM_TYPE_FOOTER)
1140 _TableView* pParent = dynamic_cast<_TableView*>(GetParent());
1141 if (pParent == null)
1146 TableViewNotifyType eventType = TABLEVIEW_NOTIFY_TYPE_SELECTED_ITEM;
1148 if ((__annexStyle == TABLE_VIEW_ANNEX_STYLE_MARK)
1149 || (__annexStyle == TABLE_VIEW_ANNEX_STYLE_RADIO)
1150 || (__annexStyle == TABLE_VIEW_ANNEX_STYLE_ONOFF_SLIDING))
1154 eventType = TABLEVIEW_NOTIFY_TYPE_ANNEX_CHECK;
1158 eventType = TABLEVIEW_NOTIFY_TYPE_ANNEX_UNCHECK;
1161 else if (__annexStyle == TABLE_VIEW_ANNEX_STYLE_DETAILED)
1165 eventType = TABLEVIEW_NOTIFY_TYPE_ANNEX_MORE;
1168 else if(__annexStyle == TABLE_VIEW_ANNEX_STYLE_ONOFF_SLIDING_WITH_DIVIDER)
1172 eventType = TABLEVIEW_NOTIFY_TYPE_SELECTED_ITEM;
1178 eventType = TABLEVIEW_NOTIFY_TYPE_ANNEX_CHECK;
1182 eventType = TABLEVIEW_NOTIFY_TYPE_ANNEX_UNCHECK;
1187 if (__isItemTapSoundEnabled)
1189 if (!__isTabSoundPlayed)
1191 PLAY_FEEDBACK(_RESOURCE_FEEDBACK_PATTERN_TAP, this);
1195 __isTabSoundPlayed = false;
1196 __checkItemHeightNeeded = true;
1198 int groupIndex = -1;
1200 GetItemIndex(groupIndex, itemIndex);
1201 pParent->FireTableViewItemEvent(groupIndex, itemIndex, eventType, this);
1205 _TableViewItem::FireItemSweepEvent(TableViewSweepDirection direction)
1207 if (HasParent() == false)
1212 _TableView* pParent = dynamic_cast<_TableView*>(GetParent());
1213 if (pParent == null)
1218 int groupIndex = -1;
1220 GetItemIndex(groupIndex, itemIndex);
1222 pParent->FireTableViewItemSweepEvent(groupIndex, itemIndex, direction);
1226 _TableViewItem::OnTouchPressed(const _Control& source, const _TouchInfo& touchinfo)
1228 if (IsContextItem() ||
1229 __isContextItemActivated ||
1230 IsAnimationPlaying() ||
1236 if (IsTouchPressOnScroll())
1241 __annexOnOffHandlerMoved = false;
1242 __touchStartPosition = touchinfo.GetCurrentPosition();
1244 if (&source == this)
1246 __pressedControl = TABLE_VIEW_ITEM_PRESSED_ITEM;
1248 else if (&source == GetLabelCore(__pItemAnnex))
1250 __pressedControl = TABLE_VIEW_ITEM_PRESSED_ANNEX;
1252 if (__annexStyle == TABLE_VIEW_ANNEX_STYLE_ONOFF_SLIDING ||
1253 __annexStyle == TABLE_VIEW_ANNEX_STYLE_ONOFF_SLIDING_WITH_DIVIDER)
1255 __annexTouchStartPosition = touchinfo.GetCurrentPosition().x;
1258 else if (IsIndividualSelectionEnabled(source))
1260 __pressedControl = TABLE_VIEW_ITEM_PRESSED_INDIVIDUAL;
1264 __pressedControl = TABLE_VIEW_ITEM_PRESSED_NONE;
1267 if(__isReleasedTimerEnabled)
1269 StopTouchReleasedTimer();
1271 _TableView* pParent = dynamic_cast<_TableView*>(GetParent());
1272 if (pParent != null)
1274 int groupIndex = -1;
1276 GetItemIndex(groupIndex, itemIndex);
1277 pParent->FireItemTouchReleasedEventDuringPressing(groupIndex, itemIndex);
1282 if (!IsIndividualSelectionEnabled(source))
1284 __itemSelected = true;
1285 if(unlikely((_AccessibilityManager::IsActivated())))
1287 FireItemTouchPressed();
1291 StartTouchPressedTimer(source, touchinfo);
1300 _TableViewItem::OnTouchReleased(const _Control& source, const _TouchInfo& touchinfo)
1302 if (IsReorderMode())
1307 if (IsTouchPressOnScroll())
1309 SetTouchPressOnScroll(false);
1313 if (&source == this)
1315 __releasedControl = TABLE_VIEW_ITEM_PRESSED_ITEM;
1317 else if (&source == GetLabelCore(__pItemAnnex))
1319 __releasedControl = TABLE_VIEW_ITEM_PRESSED_ANNEX;
1321 else if (IsIndividualSelectionEnabled(source))
1323 __releasedControl = TABLE_VIEW_ITEM_PRESSED_INDIVIDUAL;
1327 __releasedControl = TABLE_VIEW_ITEM_PRESSED_NONE;
1330 __isTabSoundPlayed = IS_PLAYED_FEEDBACK();
1332 if(!__itemTouchMoved && __isPressedTimerEnabled)
1334 StopTouchPressedTimer();
1336 if(!IsContextItem())
1338 FireItemTouchPressed();
1341 StartTouchReleasedTimer();
1345 FireItemTouchReleased();
1350 _TableViewItem::FireItemTouchPressed()
1352 if(__pressedControl == TABLE_VIEW_ITEM_PRESSED_ITEM)
1354 __drawingStatus = TABLE_VIEW_ITEM_DRAWING_STATUS_PRESSED;
1355 SetItemChanged(true);
1358 else if(__pressedControl == TABLE_VIEW_ITEM_PRESSED_ANNEX)
1360 if (__annexStyle == TABLE_VIEW_ANNEX_STYLE_DETAILED)
1362 __drawingStatus = TABLE_VIEW_ITEM_DRAWING_STATUS_NORMAL;
1363 __isSelectedDetailButton = true;
1366 else if (__annexStyle == TABLE_VIEW_ANNEX_STYLE_ONOFF_SLIDING ||
1367 __annexStyle == TABLE_VIEW_ANNEX_STYLE_ONOFF_SLIDING_WITH_DIVIDER)
1369 __drawingStatus = TABLE_VIEW_ITEM_DRAWING_STATUS_NORMAL;
1373 __drawingStatus = TABLE_VIEW_ITEM_DRAWING_STATUS_PRESSED;
1374 SetItemChanged(true);
1380 if(__pressedControl != TABLE_VIEW_ITEM_PRESSED_INDIVIDUAL)
1382 __drawingStatus = TABLE_VIEW_ITEM_DRAWING_STATUS_PRESSED;
1383 SetItemChanged(true);
1390 _TableViewItem::FireItemTouchReleased()
1392 bool fireItemEvent = false;
1393 bool selectedItem = true;
1395 __drawingStatus = TABLE_VIEW_ITEM_DRAWING_STATUS_NORMAL;
1397 if (__itemSelected == true)
1399 bool checked = IsChecked();
1400 fireItemEvent = true;
1402 if (__releasedControl == TABLE_VIEW_ITEM_PRESSED_ITEM)
1404 if ((__annexStyle == TABLE_VIEW_ANNEX_STYLE_RADIO)
1405 || (__annexStyle == TABLE_VIEW_ANNEX_STYLE_ONOFF_SLIDING))
1407 SetChecked(!checked);
1409 else if(__annexStyle == TABLE_VIEW_ANNEX_STYLE_MARK)
1411 SetChecked(!checked);
1412 SetCheckedAnimationEnabled(!checked);
1415 else if(__releasedControl == TABLE_VIEW_ITEM_PRESSED_ANNEX)
1417 if (__annexStyle == TABLE_VIEW_ANNEX_STYLE_DETAILED)
1419 __isSelectedDetailButton = false;
1421 selectedItem = false;
1423 else if (__annexStyle == TABLE_VIEW_ANNEX_STYLE_ONOFF_SLIDING ||
1424 __annexStyle == TABLE_VIEW_ANNEX_STYLE_ONOFF_SLIDING_WITH_DIVIDER)
1426 bool isPreviousChecked = IsChecked();
1427 AdjustAnnexOnOffHandlerPosition();
1428 selectedItem = false;
1429 if (isPreviousChecked == IsChecked())
1431 fireItemEvent = false;
1436 SetChecked(!checked);
1437 SetCheckedAnimationEnabled(!checked);
1442 if(__releasedControl != TABLE_VIEW_ITEM_PRESSED_INDIVIDUAL)
1444 if ((__annexStyle == TABLE_VIEW_ANNEX_STYLE_MARK)
1445 || (__annexStyle == TABLE_VIEW_ANNEX_STYLE_RADIO)
1446 || (__annexStyle == TABLE_VIEW_ANNEX_STYLE_ONOFF_SLIDING))
1448 SetChecked(!checked);
1449 SetCheckedAnimationEnabled(!checked);
1454 fireItemEvent = false;
1458 SetItemChanged(true);
1464 if (__releasedControl == TABLE_VIEW_ITEM_PRESSED_ANNEX)
1466 if (__annexStyle == TABLE_VIEW_ANNEX_STYLE_ONOFF_SLIDING ||
1467 __annexStyle == TABLE_VIEW_ANNEX_STYLE_ONOFF_SLIDING_WITH_DIVIDER)
1469 bool isPreviousChecked = IsChecked();
1470 AdjustAnnexOnOffHandlerPosition();
1471 fireItemEvent = true;
1472 if (isPreviousChecked == IsChecked())
1474 fireItemEvent = false;
1480 __itemSelected = false;
1481 __annexOnOffHandlerMoved = false;
1482 __itemTouchMoved = false;
1486 FireItemEvent(selectedItem);
1491 _TableViewItem::OnTouchMoved(const _Control& source, const _TouchInfo& touchinfo)
1498 if (IsTouchPressOnScroll())
1500 SetTouchPressOnScroll(false);
1503 if (__isPressedTimerEnabled)
1505 StopTouchPressedTimer();
1508 bool retVal = false;
1510 if (&source == this)
1512 __itemSelected = false;
1513 __drawingStatus = TABLE_VIEW_ITEM_DRAWING_STATUS_NORMAL;
1515 SetItemChanged(true);
1518 else if (&source == GetLabelCore(__pItemAnnex))
1520 if (__annexStyle == TABLE_VIEW_ANNEX_STYLE_DETAILED)
1522 __isSelectedDetailButton = false;
1523 __itemSelected = false;
1526 else if(__annexStyle == TABLE_VIEW_ANNEX_STYLE_ONOFF_SLIDING ||
1527 __annexStyle == TABLE_VIEW_ANNEX_STYLE_ONOFF_SLIDING_WITH_DIVIDER)
1529 __annexOnOffHandlerMoved = true;
1530 DrawAnnexOnOffHandler(touchinfo.GetCurrentPosition().x);
1535 __itemSelected = false;
1536 __drawingStatus = TABLE_VIEW_ITEM_DRAWING_STATUS_NORMAL;
1538 SetItemChanged(true);
1544 if(!IsIndividualSelectionEnabled(source))
1546 __itemSelected = false;
1547 __drawingStatus = TABLE_VIEW_ITEM_DRAWING_STATUS_NORMAL;
1549 SetItemChanged(true);
1554 __itemTouchMoved = true;
1560 _TableViewItem::OnTouchCanceled(const _Control& source, const _TouchInfo& touchinfo)
1562 if (__isPressedTimerEnabled)
1564 StopTouchPressedTimer();
1567 __annexOnOffHandlerMoved = false;
1568 __itemTouchMoved = false;
1570 __itemSelected = false;
1571 __drawingStatus = TABLE_VIEW_ITEM_DRAWING_STATUS_NORMAL;
1573 if (__annexStyle == TABLE_VIEW_ANNEX_STYLE_DETAILED)
1575 __isSelectedDetailButton = false;
1578 SetItemChanged(true);
1581 if (&source != this)
1589 _UiTouchEventDelivery
1590 _TableViewItem::OnPreviewTouchPressed(const _Control& source, const _TouchInfo& touchinfo)
1592 if (IsTouchPressOnScroll())
1594 SetTouchPressOnScroll(false);
1595 return _UI_TOUCH_EVENT_DELIVERY_NO;
1597 return _UI_TOUCH_EVENT_DELIVERY_FORCED_YES;
1600 _UiTouchEventDelivery
1601 _TableViewItem::OnPreviewTouchReleased(const _Control& source, const _TouchInfo& touchinfo)
1603 return _UI_TOUCH_EVENT_DELIVERY_FORCED_YES;
1606 _UiTouchEventDelivery
1607 _TableViewItem::OnPreviewTouchMoved(const _Control& source, const _TouchInfo& touchinfo)
1609 return _UI_TOUCH_EVENT_DELIVERY_YES;
1612 _UiTouchEventDelivery
1613 _TableViewItem::OnPreviewTouchCanceled(const _Control& source, const _TouchInfo& touchinfo)
1615 return _UI_TOUCH_EVENT_DELIVERY_FORCED_YES;
1619 _TableViewItem::OnDraw(void)
1621 if (IsItemChanged() == true)
1623 DrawItemBackground();
1627 DrawSectionStyleBackgroundCover();
1629 SetItemChanged(false);
1634 _TableViewItem::OnChildAttached(const _Control& child)
1636 _Control* pControl = const_cast<_Control*>(&child);
1637 _AccessibilityContainer* pContainer = pControl->GetAccessibilityContainer();
1639 if (__individualSelectionControls.Contains(child))
1641 pContainer->Activate(true);
1645 pContainer->Activate(false);
1647 if(!(pControl == static_cast<_Control*>(__pItemAnnexLeftDivider)
1648 || pControl == static_cast<_Control*>(__pItemAnnexRightDivider)
1649 || pControl == static_cast<_Control*>(__pItemCover)
1650 || pControl == static_cast<_Control*>(__pItemDivider)
1651 || pControl== static_cast<_Control*>(__pItemTopDivider)))
1653 GetAccessibilityContainer()->Activate(true);
1657 pControl->SetTouchPressThreshold(SENSITIVE);
1659 FloatRectangle bounds = child.GetBoundsF();
1661 if (__pDrawingProperty != null && __pDrawingProperty->groupedLookEnabled)
1663 float groupedBarMargin = 0.0f;
1664 GET_SHAPE_CONFIG(TABLEVIEW::GROUPITEM_BAR_WIDTH, _CONTROL_ORIENTATION_PORTRAIT, groupedBarMargin);
1666 bounds.x += groupedBarMargin;
1669 if ((__annexStyle == TABLE_VIEW_ANNEX_STYLE_MARK) || (__annexStyle == TABLE_VIEW_ANNEX_STYLE_RADIO))
1671 if (GetLabelCore(__pItemAnnex) == &child ||
1672 GetLabelCore(__pSimpleItemBitmap) == &child ||
1673 GetLabelCore(__pSimpleItemText) == &child)
1678 float leftMargin = 0.0f;
1679 float annexWidth = 0.0f;
1681 GET_SHAPE_CONFIG(TABLEVIEW::ITEM_LEFT_MARGIN, _CONTROL_ORIENTATION_PORTRAIT, leftMargin);
1682 GET_SHAPE_CONFIG(TABLEVIEW::ITEM_ANNEX_WIDTH, _CONTROL_ORIENTATION_PORTRAIT, annexWidth);
1684 bounds.x += (leftMargin * 2) + annexWidth;
1687 pControl->SetBounds(bounds);
1691 _TableViewItem::OnChildDetached(const _Control& child)
1693 if (__individualSelectionControls.Contains(child))
1695 __individualSelectionControls.Remove(child, false);
1698 _Label* pSimpleItemTextCore = GetLabelCore(__pSimpleItemText);
1699 _Label* pSimpleItemBitmapCore = GetLabelCore(__pSimpleItemBitmap);
1701 if (&child == pSimpleItemTextCore)
1703 __pSimpleItemText = null;
1706 if (&child == pSimpleItemBitmapCore)
1708 __pSimpleItemBitmap = null;
1713 _TableViewItem::OnTimerExpired(Tizen::Base::Runtime::Timer& timer)
1715 result r = E_SUCCESS;
1717 if (&timer == __pCheckedTimer)
1719 if (__checkedCount < MAX_CHECKED_COUNT)
1721 r = __pCheckedTimer->Start(CHECKED_ANIMATION_DURATION);
1722 SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
1725 r = PlayCheckBoxAnimation();
1726 SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
1728 if (__checkedCount < MAX_CHECKED_COUNT)
1735 __isCheckedAnimationEnabled = false;
1736 __isCheckedTimerEnabled = false;
1739 else if (&timer == __pPressedTimer)
1741 __isPressedTimerEnabled = false;
1742 FireItemTouchPressed();
1744 else if(&timer == __pReleasedTimer)
1746 __isReleasedTimerEnabled = false;
1747 FireItemTouchReleased();
1752 _TableViewItem::StartTouchPressedTimer(const _Control& source, const _TouchInfo& touchinfo)
1754 result r = E_SUCCESS;
1756 if (__pPressedTimer == null)
1758 __pPressedTimer = new (std::nothrow) Timer();
1759 SysTryCatch(NID_UI_CTRL, __pPressedTimer != null, r = E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
1761 r = __pPressedTimer->Construct(*this);
1762 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage);
1765 if (__isPressedTimerEnabled == false)
1767 r = __pPressedTimer->Start(TOUCH_PRESSED_DURATION);
1768 SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage);
1770 __isPressedTimerEnabled = true;
1776 if (__isPressedTimerEnabled && __pPressedTimer != null)
1778 __pPressedTimer->Cancel();
1781 delete __pPressedTimer;
1782 __pPressedTimer = null;
1788 _TableViewItem::StopTouchPressedTimer(void)
1790 result r = E_SUCCESS;
1792 SysTryReturnVoidResult(NID_UI_CTRL, __pPressedTimer != null, E_SYSTEM, "[E_SYSTEM] Timer is invalid.");
1794 if (__isPressedTimerEnabled)
1796 r = __pPressedTimer->Cancel();
1797 SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
1800 __isPressedTimerEnabled = false;
1806 _TableViewItem::StartTouchReleasedTimer()
1808 result r = E_SUCCESS;
1810 if(__pReleasedTimer == null)
1812 __pReleasedTimer = new (std::nothrow) Timer();
1813 SysTryCatch(NID_UI_CTRL, __pReleasedTimer != null, r = E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
1815 r = __pReleasedTimer->Construct(*this);
1816 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage);
1819 if(!__isReleasedTimerEnabled)
1821 r = __pReleasedTimer->Start(TOUCH_RELEASED_DURATION);
1822 SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage);
1824 __isReleasedTimerEnabled = true;
1829 if (__isReleasedTimerEnabled && __pReleasedTimer != null)
1831 __pReleasedTimer->Cancel();
1834 delete __pReleasedTimer;
1835 __pReleasedTimer = null;
1841 _TableViewItem::StopTouchReleasedTimer(void)
1843 result r = E_SUCCESS;
1845 SysTryReturnVoidResult(NID_UI_CTRL, __pReleasedTimer != null, E_SYSTEM, "[E_SYSTEM] Timer is invalid.");
1847 if (__isReleasedTimerEnabled)
1849 r = __pReleasedTimer->Cancel();
1850 SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
1853 __isReleasedTimerEnabled = false;
1859 _TableViewItem::OnAncestorInputEnableStateChanged(const _Control& control)
1861 if (__isPressedTimerEnabled)
1863 StopTouchPressedTimer();
1866 __annexOnOffHandlerMoved = false;
1867 __itemTouchMoved = false;
1869 __itemSelected = false;
1870 __drawingStatus = TABLE_VIEW_ITEM_DRAWING_STATUS_NORMAL;
1872 if (__annexStyle == TABLE_VIEW_ANNEX_STYLE_DETAILED)
1874 __isSelectedDetailButton = false;
1877 SetItemChanged(true);
1882 _TableViewItem::StartCheckBoxAnimation(void)
1884 result r = E_SUCCESS;
1886 if (__pCheckedTimer == null)
1888 __pCheckedTimer = new (std::nothrow) Timer();
1889 SysTryCatch(NID_UI_CTRL, __pCheckedTimer != null, r = E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
1891 r = __pCheckedTimer->Construct(*this);
1892 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage);
1895 if (__isCheckedTimerEnabled == false)
1897 r = __pCheckedTimer->Start(CHECKED_ANIMATION_DURATION);
1898 SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage);
1900 __isCheckedTimerEnabled = true;
1906 if (__isCheckedTimerEnabled)
1908 __pCheckedTimer->Cancel();
1911 delete __pCheckedTimer;
1912 __pCheckedTimer = null;
1918 _TableViewItem::StopCheckBoxAnimation(void)
1920 result r = E_SUCCESS;
1922 SysTryReturnVoidResult(NID_UI_CTRL, __pCheckedTimer != null, E_SYSTEM, "[E_SYSTEM] Timer is invalid.");
1924 if (__isCheckedTimerEnabled)
1926 r = __pCheckedTimer->Cancel();
1927 SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
1931 __isCheckedAnimationEnabled = false;
1932 __isCheckedTimerEnabled = false;
1938 _TableViewItem::PlayCheckBoxAnimation(void)
1940 Bitmap* pCheckBox = null;
1941 Bitmap* pCheckBoxBg = null;
1942 Bitmap* pMergeBitmap = null;
1943 Canvas* pCanvas = null;
1944 result r = E_SUCCESS;
1946 FloatRectangle bounds;
1948 float annexWidth = 0.0f;
1949 float annexHeight = 0.0f;
1951 if (__drawingStatus == TABLE_VIEW_ITEM_DRAWING_STATUS_NORMAL)
1953 r = GET_BITMAP_CONFIG_N(TABLEVIEW::CHECKBOX_BG_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, pCheckBoxBg);
1955 else if ((__drawingStatus == TABLE_VIEW_ITEM_DRAWING_STATUS_PRESSED) || (__drawingStatus == TABLE_VIEW_ITEM_DRAWING_STATUS_HIGHLIGHTED))
1957 r = GET_BITMAP_CONFIG_N(TABLEVIEW::CHECKBOX_BG_PRESSED, BITMAP_PIXEL_FORMAT_ARGB8888, pCheckBoxBg);
1959 SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS) && (pCheckBoxBg != null), , E_SYSTEM, "[%s] Propagating.", GetErrorMessage(r));
1961 r = GET_BITMAP_CONFIG_N(TABLEVIEW::CHECKBOX_CHECK_MARK_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, pCheckBox);
1962 SysTryCatch(NID_UI_CTRL,(r == E_SUCCESS) && (pCheckBox != null), , E_SYSTEM, "[%s] Propagating.", GetErrorMessage(r));
1964 GET_SHAPE_CONFIG(TABLEVIEW::ITEM_ANNEX_WIDTH, _CONTROL_ORIENTATION_PORTRAIT, annexWidth);
1965 GET_SHAPE_CONFIG(TABLEVIEW::ITEM_ANNEX_HEIGHT, _CONTROL_ORIENTATION_PORTRAIT, annexHeight);
1967 bounds.SetBounds(0, 0, annexWidth, annexHeight);
1969 pCanvas = new (std::nothrow) Canvas();
1970 SysTryCatch(NID_UI_CTRL, pCanvas != null, , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient.");
1972 r = pCanvas->Construct(bounds);
1973 pCanvas->SetBackgroundColor(Color(0, 0, 0, 0));
1976 DrawBitmap(*pCanvas, CalculateAnnexBitmapBounds(annexWidth, annexHeight, *pCheckBoxBg), *pCheckBoxBg);
1978 __checkedBounds = CalculateAnnexBitmapBounds(annexWidth, annexHeight, *pCheckBox);
1979 if (IsChecked() == true)
1981 if (_BitmapImpl::CheckNinePatchedBitmapStrictly(*pCheckBox))
1983 FloatRectangle drawingRect(__checkedBounds.x, __checkedBounds.y, __checkedBounds.width, __checkedBounds.height);
1984 r = pCanvas->DrawNinePatchedBitmap(drawingRect, *pCheckBox); // +++ check floating
1988 FloatRectangle bitmapSourceRect(0.0f, 0.0f, pCheckBox->GetWidthF()*__checkedCount * 0.1, pCheckBox->GetHeightF());
1989 FloatRectangle drawingRect(__checkedBounds.x, __checkedBounds.y, __checkedBounds.width * __checkedCount * 0.1, __checkedBounds.height);
1990 r = pCanvas->DrawBitmap(drawingRect, *pCheckBox, bitmapSourceRect); // +++ check floating
1994 pMergeBitmap = new (std::nothrow) Bitmap();
1995 SysTryCatch(NID_UI_CTRL, pMergeBitmap != null, , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient.");
1997 pMergeBitmap->Construct(*pCanvas, bounds);
1998 _BitmapImpl::ConvertToNonpremultiplied(*pMergeBitmap, true);
2002 __pItemAnnex->SetBackgroundBitmap(*pMergeBitmap);
2003 __pItemAnnex->Invalidate(false);
2009 delete pMergeBitmap;
2016 _TableViewItem::SetItemLayoutEnabled(bool enabled)
2018 __isItemLayoutEnabled = enabled;
2022 _TableViewItem::GetItemLayoutEnabled(void)
2024 return __isItemLayoutEnabled;
2028 _TableViewItem::OnBoundsChanged(void)
2030 if (__checkItemHeightNeeded && HasParent())
2032 _TableView* pParent = dynamic_cast<_TableView*>(GetParent());
2033 if (pParent != null)
2035 int groupIndex = -1;
2037 GetItemIndex(groupIndex, itemIndex);
2039 pParent->CheckItemHeightAndRefreshLayout(groupIndex, itemIndex);
2042 __checkItemHeightNeeded = false;
2045 AdjustAnnexBounds();
2047 SetItemHighlightBounds(*__pHighlightVisualElement, CalculateItemHighlightBounds());
2049 if (__pHeaderFooterItemText != null)
2051 FloatRectangle textBounds = __pHeaderFooterItemText->GetBoundsF();
2052 textBounds.width = GetBoundsF().width;
2054 if (__itemType == TABLE_VIEW_ITEM_TYPE_FOOTER)
2056 textBounds.x -= __pDrawingProperty->scrollMargin;
2059 __pHeaderFooterItemText->SetBounds(textBounds);
2062 if(__pBitmapVisualElement != null)
2064 FloatRectangle bounds = GetBoundsF();
2065 __pBitmapVisualElement->SetBounds(FloatRectangle(0.0f, 0.0f, bounds.width, bounds.height));
2068 if(__pAccessibilityElement != null)
2070 __pAccessibilityElement->SetBounds(FloatRectangle(0.0f,0.0f, GetBoundsF().width, GetBoundsF().height));
2075 _TableViewItem::SetDrawingProperty(_ItemDrawingProperty* pDrawingProperty)
2078 SysTryReturnVoidResult(NID_UI_CTRL, pDrawingProperty != null, E_INVALID_ARG, "[E_INAVLID_ARG] pDrawingProperty is null");
2080 __pDrawingProperty = pDrawingProperty;
2082 if (__pDrawingProperty->sectionStyleEnabled == true &&
2088 if(__pDrawingProperty->itemDividerEnabled)
2090 CreateItemDivider();
2096 _ItemDrawingProperty*
2097 _TableViewItem::GetDrawingProperty(void)
2099 return __pDrawingProperty;
2103 _TableViewItem::DrawItemBackground(void)
2105 Canvas* pCanvas = null;
2106 Bitmap* pDrawBitmap = __pItemBgBitmap[__drawingStatus];
2107 Color bgColor = __colorItemBg[__drawingStatus];
2108 FloatRectangle bounds = GetBoundsF();
2110 SetItemHighlightBounds(*__pHighlightVisualElement, CalculateItemHighlightBounds());
2111 __pHighlightVisualElement->SetBackgroundColor(_Colorf(0.0f, 0.0f, 0.0f, 0.0f));
2113 if(pDrawBitmap != null && __enabledState)
2115 if(__pBitmapVisualElement == null)
2120 String imagePath = null;
2121 if(_BitmapImpl::CheckNinePatchedBitmapStrictly(*pDrawBitmap) == false)
2123 imagePath = _BitmapImpl::GetInstance(*pDrawBitmap)->GetFileName();
2126 if(imagePath.IsEmpty() == false)
2128 __pBitmapVisualElement->SetBackgroundColor(_Colorf((float)bgColor.GetRed() /255, (float)bgColor.GetGreen() / 255, (float)bgColor.GetBlue() / 255, (float)bgColor.GetAlpha() / 255));
2129 __pBitmapVisualElement->SetImageSource(imagePath);
2133 pCanvas = __pBitmapVisualElement->GetCanvasN();
2134 SysTryCatch(NID_UI_CTRL, pCanvas != null, , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient.");
2135 pCanvas->SetBackgroundColor(Color(0, 0, 0, 0));
2138 DrawBitmap(*pCanvas, FloatRectangle(0.0f, 0.0f, bounds.width, bounds.height), *pDrawBitmap);
2144 DrawContextItemBackground();
2146 else if (__pDrawingProperty->sectionStyleEnabled == true)
2148 DrawSectionStyleBackground();
2154 if (__itemType == TABLE_VIEW_ITEM_TYPE_HEADER || __itemType == TABLE_VIEW_ITEM_TYPE_FOOTER)
2156 SetBackgroundColor(Color(0, 0, 0, 0));
2157 __pHighlightVisualElement->SetBackgroundColor(_Colorf(0.0f, 0.0f, 0.0f, 0.0f));
2159 else if(__itemType == TABLE_VIEW_ITEM_TYPE_TITLE)
2161 __pHighlightVisualElement->SetBackgroundColor(_Colorf((float)bgColor.GetRed() / 255.0f, (float)bgColor.GetGreen() / 255.0f, (float)bgColor.GetBlue() / 255.0f, (float)bgColor.GetAlpha() / 255.0f));
2165 SetBackgroundColor(__colorItemBg[TABLE_VIEW_ITEM_DRAWING_STATUS_NORMAL]);
2167 __pHighlightVisualElement->SetBackgroundColor(_Colorf((float)bgColor.GetRed() / 255.0f, (float)bgColor.GetGreen() / 255.0f, (float)bgColor.GetBlue() / 255.0f, (float)bgColor.GetAlpha() / 255.0f));
2169 if (__pDrawingProperty->groupedLookEnabled == true)
2177 GET_COLOR_CONFIG(TABLEVIEW::ITEM_BG_DISABLED, bgColor);
2178 SetBackgroundColor(bgColor);
2179 __pHighlightVisualElement->SetBackgroundColor(_Colorf((float)bgColor.GetRed() / 255.0f, (float)bgColor.GetGreen() / 255.0f, (float)bgColor.GetBlue() / 255.0f, (float)bgColor.GetAlpha() / 255.0f));
2181 if (__pDrawingProperty->groupedLookEnabled == true)
2193 if (__pBitmapVisualElement != null)
2195 __pBitmapVisualElement->RemoveAllAnimations();
2196 __pBitmapVisualElement->SetAnimationProvider(null);
2197 __pBitmapVisualElement->Destroy();
2198 __pBitmapVisualElement = null;
2203 _TableViewItem::DrawGroupedLook(void)
2205 if (IsTitleStyleItem() || IsContextItem())
2211 Color outlineColor = __pDrawingProperty->dividerColor;
2213 float barWidth = 0.0f;
2215 Canvas* pCanvas = GetVisualElement()->GetCanvasN();
2216 SysTryReturnVoidResult(NID_UI_CTRL, pCanvas != null, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
2218 FloatRectangle bounds = GetBoundsF();
2219 pCanvas->SetBackgroundColor(GetBackgroundColor());
2222 GET_COLOR_CONFIG(TABLEVIEW::GROUPITEM_BAR_NORMAL, barColor);
2223 GET_SHAPE_CONFIG(TABLEVIEW::GROUPITEM_BAR_WIDTH, _CONTROL_ORIENTATION_PORTRAIT, barWidth);
2225 pCanvas->FillRectangle(barColor, FloatRectangle(0.0f, 0.0f, barWidth, bounds.height));
2227 if (__pDrawingProperty->sectionStyleEnabled == true)
2229 pCanvas->FillRectangle(outlineColor, FloatRectangle(bounds.width - 1.0f, 0.0f, 1.0f, bounds.height));
2231 if (__itemType == TABLE_VIEW_ITEM_TYPE_TOP || __itemType == TABLE_VIEW_ITEM_TYPE_ONE)
2233 pCanvas->FillRectangle(outlineColor, FloatRectangle(0.0f, 0.0f, bounds.width, 1.0f));
2241 _TableViewItem::DrawSectionStyleBackground(void)
2243 Canvas* pCanvas = null;
2244 Bitmap* pSectionBg = null;
2245 Bitmap* pSectionPressBg = null;
2246 Bitmap* pSectionDisabledBg = null;
2247 Bitmap* pReplacementSectionPressBg = null;
2248 Bitmap* pReplacementSectionBg = null;
2249 Color bgColor = __colorItemBg[__drawingStatus];
2250 FloatRectangle bounds = GetBoundsF();
2251 float dividerHeight = 0.0f;
2253 result r = E_SUCCESS;
2255 pCanvas = GetVisualElement()->GetCanvasN();
2256 SysTryReturnVoidResult(NID_UI_CTRL, pCanvas != null, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
2258 pCanvas->SetBackgroundColor(Color(0, 0, 0, 0));
2261 if (__itemType == TABLE_VIEW_ITEM_TYPE_ONE)
2263 r = GET_BITMAP_CONFIG_N(TABLEVIEW::SECTIONITEM_SINGLE_BG_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, pSectionBg);
2265 else if (__itemType == TABLE_VIEW_ITEM_TYPE_TOP)
2267 r = GET_BITMAP_CONFIG_N(TABLEVIEW::SECTIONITEM_TOP_BG_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, pSectionBg);
2269 else if (__itemType == TABLE_VIEW_ITEM_TYPE_MIDDLE)
2271 r = GET_BITMAP_CONFIG_N(TABLEVIEW::SECTIONITEM_CENTER_BG_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, pSectionBg);
2273 else if (__itemType == TABLE_VIEW_ITEM_TYPE_BOTTOM)
2275 r = GET_BITMAP_CONFIG_N(TABLEVIEW::SECTIONITEM_BOTTOM_BG_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, pSectionBg);
2281 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , E_SYSTEM, "[E_SYSTEM] SectionStyle image load failed");
2285 if(__drawingStatus == TABLE_VIEW_ITEM_DRAWING_STATUS_PRESSED || __drawingStatus == TABLE_VIEW_ITEM_DRAWING_STATUS_HIGHLIGHTED)
2287 if (__itemType == TABLE_VIEW_ITEM_TYPE_ONE)
2289 if(IS_CUSTOM_BITMAP(TABLEVIEW::SECTIONITEM_SINGLE_BG_PRESSED))
2291 r = GET_BITMAP_CONFIG_N(TABLEVIEW::SECTIONITEM_SINGLE_BG_PRESSED, BITMAP_PIXEL_FORMAT_ARGB8888, pSectionPressBg);
2292 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , E_SYSTEM, "[E_SYSTEM] SectionStyle image load failed");
2295 else if (__itemType == TABLE_VIEW_ITEM_TYPE_TOP)
2297 if(IS_CUSTOM_BITMAP(TABLEVIEW::SECTIONITEM_TOP_BG_PRESSED))
2299 r = GET_BITMAP_CONFIG_N(TABLEVIEW::SECTIONITEM_TOP_BG_PRESSED, BITMAP_PIXEL_FORMAT_ARGB8888, pSectionPressBg);
2300 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , E_SYSTEM, "[E_SYSTEM] SectionStyle image load failed");
2303 else if (__itemType == TABLE_VIEW_ITEM_TYPE_MIDDLE)
2305 if(IS_CUSTOM_BITMAP(TABLEVIEW::SECTIONITEM_CENTER_BG_PRESSED))
2307 r = GET_BITMAP_CONFIG_N(TABLEVIEW::SECTIONITEM_CENTER_BG_PRESSED, BITMAP_PIXEL_FORMAT_ARGB8888, pSectionPressBg);
2308 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , E_SYSTEM, "[E_SYSTEM] SectionStyle image load failed");
2311 else if (__itemType == TABLE_VIEW_ITEM_TYPE_BOTTOM)
2313 if(IS_CUSTOM_BITMAP(TABLEVIEW::SECTIONITEM_BOTTOM_BG_PRESSED))
2315 r = GET_BITMAP_CONFIG_N(TABLEVIEW::SECTIONITEM_BOTTOM_BG_PRESSED, BITMAP_PIXEL_FORMAT_ARGB8888, pSectionPressBg);
2316 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , E_SYSTEM, "[E_SYSTEM] SectionStyle image load failed");
2320 GET_FIXED_VALUE_CONFIG(TABLEVIEW::ITEM_DIVIDER_HEIGHT, _CONTROL_ORIENTATION_PORTRAIT, dividerHeight);
2324 pReplacementSectionPressBg = Tizen::Graphics::_BitmapImpl::GetColorReplacedBitmapN(*pSectionPressBg, Color::GetColor(COLOR_ID_MAGENTA), bgColor);
2328 pReplacementSectionPressBg = Tizen::Graphics::_BitmapImpl::GetColorReplacedBitmapN(*pSectionBg, Color::GetColor(COLOR_ID_MAGENTA), bgColor);
2331 DrawBitmap(*pCanvas, FloatRectangle(0.0f, dividerHeight, bounds.width, bounds.height - (dividerHeight * 2)), *pReplacementSectionPressBg);
2337 pReplacementSectionBg = Tizen::Graphics::_BitmapImpl::GetColorReplacedBitmapN(*pSectionBg, Color::GetColor(COLOR_ID_MAGENTA), bgColor);
2341 pReplacementSectionBg = Tizen::Graphics::_BitmapImpl::GetColorReplacedBitmapN(*pSectionBg, Color::GetColor(COLOR_ID_MAGENTA), __pDrawingProperty->sectionStyleBgColor);
2344 DrawBitmap(*pCanvas, FloatRectangle(0.0f, 0.0f, bounds.width, bounds.height), *pReplacementSectionBg);
2349 if (__itemType == TABLE_VIEW_ITEM_TYPE_ONE)
2351 if(IS_CUSTOM_BITMAP(TABLEVIEW::SECTIONITEM_SINGLE_BG_DISABLED))
2353 r = GET_BITMAP_CONFIG_N(TABLEVIEW::SECTIONITEM_SINGLE_BG_DISABLED, BITMAP_PIXEL_FORMAT_ARGB8888, pSectionDisabledBg);
2354 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , E_SYSTEM, "[E_SYSTEM] SectionStyle image load failed");
2357 else if (__itemType == TABLE_VIEW_ITEM_TYPE_TOP)
2359 if(IS_CUSTOM_BITMAP(TABLEVIEW::SECTIONITEM_TOP_BG_DISABLED))
2361 r = GET_BITMAP_CONFIG_N(TABLEVIEW::SECTIONITEM_TOP_BG_DISABLED, BITMAP_PIXEL_FORMAT_ARGB8888, pSectionDisabledBg);
2362 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , E_SYSTEM, "[E_SYSTEM] SectionStyle image load failed");
2365 else if (__itemType == TABLE_VIEW_ITEM_TYPE_MIDDLE)
2367 if(IS_CUSTOM_BITMAP(TABLEVIEW::SECTIONITEM_CENTER_BG_DISABLED))
2369 r = GET_BITMAP_CONFIG_N(TABLEVIEW::SECTIONITEM_CENTER_BG_DISABLED, BITMAP_PIXEL_FORMAT_ARGB8888, pSectionDisabledBg);
2370 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , E_SYSTEM, "[E_SYSTEM] SectionStyle image load failed");
2373 else if (__itemType == TABLE_VIEW_ITEM_TYPE_BOTTOM)
2375 if(IS_CUSTOM_BITMAP(TABLEVIEW::SECTIONITEM_BOTTOM_BG_DISABLED))
2377 r = GET_BITMAP_CONFIG_N(TABLEVIEW::SECTIONITEM_BOTTOM_BG_DISABLED, BITMAP_PIXEL_FORMAT_ARGB8888, pSectionDisabledBg);
2378 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , E_SYSTEM, "[E_SYSTEM] SectionStyle image load failed");
2382 GET_COLOR_CONFIG(TABLEVIEW::ITEM_BG_DISABLED, bgColor);
2383 if(pSectionDisabledBg)
2385 pReplacementSectionBg = Tizen::Graphics::_BitmapImpl::GetColorReplacedBitmapN(*pSectionDisabledBg, Color::GetColor(COLOR_ID_MAGENTA), bgColor);
2389 pReplacementSectionBg = Tizen::Graphics::_BitmapImpl::GetColorReplacedBitmapN(*pSectionBg, Color::GetColor(COLOR_ID_MAGENTA), bgColor);
2391 DrawBitmap(*pCanvas, FloatRectangle(0.0f, 0.0f, bounds.width, bounds.height), *pReplacementSectionBg);
2394 if (__pDrawingProperty->groupedLookEnabled == true)
2398 float barWidth = 0.0f;
2399 float barMargin = 0.0f;
2401 GET_COLOR_CONFIG(TABLEVIEW::GROUPITEM_BAR_NORMAL, barColor);
2402 GET_SHAPE_CONFIG(TABLEVIEW::GROUPITEM_BAR_WIDTH, _CONTROL_ORIENTATION_PORTRAIT, barWidth);
2403 GET_SHAPE_CONFIG(TABLEVIEW::GROUPITEM_BAR_TOP_MARGIN, _CONTROL_ORIENTATION_PORTRAIT, barMargin);
2405 pCanvas->FillRectangle(barColor, FloatRectangle(0.0f, barMargin, barWidth, bounds.height-barMargin));
2410 delete pSectionPressBg;
2411 delete pSectionDisabledBg;
2412 delete pReplacementSectionPressBg;
2413 delete pReplacementSectionBg;
2418 _TableViewItem::DrawSectionStyleBackgroundCover(void)
2420 if (!__pDrawingProperty->sectionStyleEnabled ||
2421 __pItemCover == null)
2426 Bitmap* pSectionBgCoverEf = null;
2427 Bitmap* pReplacementSectionBgEf = null;
2428 Bitmap* pReplacementSectionBg = null;
2429 Bitmap* pSectionBgCoverBg = null;
2430 Bitmap* pMergeBitmap = null;
2431 Canvas* pCanvas = null;
2434 result r = E_SUCCESS;
2435 FloatRectangle bounds = GetBoundsF();
2436 if (__itemType == TABLE_VIEW_ITEM_TYPE_ONE)
2438 r = GET_BITMAP_CONFIG_N(TABLEVIEW::SECTIONITEM_SINGLE_COVER_BG_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, pSectionBgCoverEf);
2440 else if (__itemType == TABLE_VIEW_ITEM_TYPE_TOP)
2442 r = GET_BITMAP_CONFIG_N(TABLEVIEW::SECTIONITEM_TOP_COVER_BG_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, pSectionBgCoverEf);
2444 else if (__itemType == TABLE_VIEW_ITEM_TYPE_MIDDLE)
2446 r = GET_BITMAP_CONFIG_N(TABLEVIEW::SECTIONITEM_CENTER_COVER_BG_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, pSectionBgCoverEf);
2448 else if (__itemType == TABLE_VIEW_ITEM_TYPE_BOTTOM)
2450 r = GET_BITMAP_CONFIG_N(TABLEVIEW::SECTIONITEM_BOTTOM_COVER_BG_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, pSectionBgCoverEf);
2456 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , E_SYSTEM, "[E_SYSTEM] SectionStyle image load failed");
2458 if (__itemType == TABLE_VIEW_ITEM_TYPE_ONE)
2460 r = GET_BITMAP_CONFIG_N(TABLEVIEW::SECTIONITEM_SINGLE_COVER_ROUND_BG_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, pSectionBgCoverBg);
2462 else if (__itemType == TABLE_VIEW_ITEM_TYPE_TOP)
2464 r = GET_BITMAP_CONFIG_N(TABLEVIEW::SECTIONITEM_TOP_COVER_ROUND_BG_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, pSectionBgCoverBg);
2466 else if (__itemType == TABLE_VIEW_ITEM_TYPE_MIDDLE)
2468 r = GET_BITMAP_CONFIG_N(TABLEVIEW::SECTIONITEM_CENTER_COVER_ROUND_BG_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, pSectionBgCoverBg);
2470 else if (__itemType == TABLE_VIEW_ITEM_TYPE_BOTTOM)
2472 r = GET_BITMAP_CONFIG_N(TABLEVIEW::SECTIONITEM_BOTTOM_COVER_ROUND_BG_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, pSectionBgCoverBg);
2478 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , E_SYSTEM, "[E_SYSTEM] SectionStyle image load failed");
2480 __pItemCover->SetBounds(FloatRectangle(0.0f, 0.0f, bounds.width, bounds.height));
2484 _TableView* pParent = dynamic_cast<_TableView*>(GetParent());
2485 SysTryCatch(NID_UI_CTRL, pParent != null, , E_SYSTEM, "[E_SYSTEM] SectionTableView load failed");
2487 bgColor = pParent->GetBackgroundColor();
2491 GET_COLOR_CONFIG(TABLEVIEW::ITEM_BG_DISABLED, bgColor);
2494 pReplacementSectionBg = Tizen::Graphics::_BitmapImpl::GetColorReplacedBitmapN(*pSectionBgCoverBg, Color::GetColor(COLOR_ID_MAGENTA), bgColor);
2495 pReplacementSectionBgEf = Tizen::Graphics::_BitmapImpl::GetColorReplacedBitmapN(*pSectionBgCoverEf, Color::GetColor(COLOR_ID_MAGENTA), bgColor);
2497 pCanvas = new (std::nothrow) Canvas();
2498 SysTryCatch(NID_UI_CTRL, pCanvas != null, , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient.");
2500 pCanvas->Construct(FloatRectangle(0.0f, 0.0f, bounds.width, bounds.height));
2501 pCanvas->SetBackgroundColor(Color(0, 0, 0, 0));
2504 DrawBitmap(*pCanvas, FloatRectangle(0.0f, 0.0f, bounds.width, bounds.height), *pReplacementSectionBg);
2505 DrawBitmap(*pCanvas, FloatRectangle(0.0f, 0.0f, bounds.width, bounds.height), *pReplacementSectionBgEf);
2507 pMergeBitmap = new (std::nothrow) Bitmap();
2508 SysTryCatch(NID_UI_CTRL, pMergeBitmap != null, , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient.");
2510 pMergeBitmap->Construct(*pCanvas, FloatRectangle(0.0f, 0.0f, bounds.width, bounds.height));
2512 _BitmapImpl::ConvertToNonpremultiplied(*pMergeBitmap, true);
2514 __pItemCover->SetBackgroundBitmap(*pMergeBitmap);
2517 delete pSectionBgCoverEf;
2518 delete pReplacementSectionBgEf;
2519 delete pReplacementSectionBg;
2520 delete pSectionBgCoverBg;
2522 delete pMergeBitmap;
2526 _TableViewItem::DrawContextItemBackground(void)
2528 Canvas* pCanvas = null;
2529 Bitmap* pContextBg = null;
2530 Bitmap* pContextBgEf = null;
2531 Bitmap* pReplacementContextBg = null;
2532 Color bgColor = __colorItemBg[__drawingStatus];
2534 FloatRectangle bounds = GetBoundsF();
2535 result r = E_SUCCESS;
2537 r = GET_BITMAP_CONFIG_N(TABLEVIEW::QUICK_MENU_BG_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, pContextBg);
2538 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , E_SYSTEM, "[E_SYSTEM] ContextItem image load failed");
2540 r = GET_BITMAP_CONFIG_N(TABLEVIEW::QUICK_MENU_BG_EFFECT, BITMAP_PIXEL_FORMAT_ARGB8888, pContextBgEf);
2541 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , E_SYSTEM, "[E_SYSTEM] ContextItem image load failed");
2543 pCanvas = GetVisualElement()->GetCanvasN();
2544 SysTryCatch(NID_UI_CTRL, pCanvas != null, , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient.");
2546 pCanvas->SetBackgroundColor(Color(0, 0, 0, 0));
2553 GET_COLOR_CONFIG(TABLEVIEW::CONTEXTITEM_BG_NORMAL, bgColor);
2558 GET_COLOR_CONFIG(TABLEVIEW::ITEM_BG_DISABLED, bgColor);
2560 pReplacementContextBg = Tizen::Graphics::_BitmapImpl::GetColorReplacedBitmapN(*pContextBg, Color::GetColor(COLOR_ID_MAGENTA), bgColor);
2561 SysTryCatch(NID_UI_CTRL, pReplacementContextBg != null, , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient.");
2563 DrawBitmap(*pCanvas, FloatRectangle(0.0f, 0.0f, bounds.width, bounds.height), *pReplacementContextBg);
2564 DrawBitmap(*pCanvas, FloatRectangle(0.0f, 0.0f, bounds.width, bounds.height), *pContextBgEf);
2569 delete pContextBgEf;
2570 delete pReplacementContextBg;
2575 _TableViewItem::CreateAnnexStyle(void)
2577 switch (__annexStyle)
2579 case TABLE_VIEW_ANNEX_STYLE_MARK:
2582 case TABLE_VIEW_ANNEX_STYLE_RADIO:
2585 case TABLE_VIEW_ANNEX_STYLE_ONOFF_SLIDING:
2586 CreateOnOffButton();
2588 case TABLE_VIEW_ANNEX_STYLE_ONOFF_SLIDING_WITH_DIVIDER:
2589 CreateItemAnnexDivider();
2590 CreateOnOffButton();
2592 case TABLE_VIEW_ANNEX_STYLE_DETAILED:
2593 CreateDetailButton();
2601 _TableViewItem::DrawAnnexStyle(void)
2603 switch (__annexStyle)
2605 case TABLE_VIEW_ANNEX_STYLE_MARK:
2608 case TABLE_VIEW_ANNEX_STYLE_RADIO:
2611 case TABLE_VIEW_ANNEX_STYLE_ONOFF_SLIDING:
2614 case TABLE_VIEW_ANNEX_STYLE_ONOFF_SLIDING_WITH_DIVIDER:
2615 DrawItemAnnexDivider();
2618 case TABLE_VIEW_ANNEX_STYLE_DETAILED:
2627 _TableViewItem::DrawCheckBox(void)
2629 Bitmap* pCheckBox = null;
2630 Bitmap* pCheckBoxBg = null;
2631 Bitmap* pMergeBitmap = null;
2632 Canvas* pCanvas = null;
2633 result r = E_SUCCESS;
2635 FloatRectangle bounds;
2636 float annexWidth = 0.0f;
2637 float annexHeight = 0.0f;
2641 if (__drawingStatus == TABLE_VIEW_ITEM_DRAWING_STATUS_NORMAL)
2643 r = GET_BITMAP_CONFIG_N(TABLEVIEW::CHECKBOX_BG_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, pCheckBoxBg);
2644 SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS) && (pCheckBoxBg != null), , E_SYSTEM, "[%s] Propagating.", GetErrorMessage(r));
2646 r = GET_BITMAP_CONFIG_N(TABLEVIEW::CHECKBOX_CHECK_MARK_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, pCheckBox);
2647 SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS) && (pCheckBox != null), , E_SYSTEM, "[%s] Propagating.", GetErrorMessage(r));
2649 else if ((__drawingStatus == TABLE_VIEW_ITEM_DRAWING_STATUS_PRESSED) || (__drawingStatus == TABLE_VIEW_ITEM_DRAWING_STATUS_HIGHLIGHTED))
2651 r = GET_BITMAP_CONFIG_N(TABLEVIEW::CHECKBOX_BG_PRESSED, BITMAP_PIXEL_FORMAT_ARGB8888, pCheckBoxBg);
2652 SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS) && (pCheckBoxBg != null), , E_SYSTEM, "[%s] Propagating.", GetErrorMessage(r));
2654 r = GET_BITMAP_CONFIG_N(TABLEVIEW::CHECKBOX_CHECK_MARK_PRESSED, BITMAP_PIXEL_FORMAT_ARGB8888, pCheckBox);
2655 SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS) && (pCheckBox != null), , E_SYSTEM, "[%s] Propagating.", GetErrorMessage(r));
2661 r = GET_BITMAP_CONFIG_N(TABLEVIEW::CHECKBOX_BG_DISABLED, BITMAP_PIXEL_FORMAT_ARGB8888, pCheckBoxBg);
2662 SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS) && (pCheckBoxBg != null), , E_SYSTEM, "[%s] Propagating.", GetErrorMessage(r));
2664 r = GET_BITMAP_CONFIG_N(TABLEVIEW::CHECKBOX_CHECK_MARK_DISABLED, BITMAP_PIXEL_FORMAT_ARGB8888, pCheckBox);
2665 SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS) && (pCheckBox != null), , E_SYSTEM, "[%s] Propagating.", GetErrorMessage(r));
2668 GET_SHAPE_CONFIG(TABLEVIEW::ITEM_ANNEX_WIDTH, _CONTROL_ORIENTATION_PORTRAIT, annexWidth);
2669 GET_SHAPE_CONFIG(TABLEVIEW::ITEM_ANNEX_HEIGHT, _CONTROL_ORIENTATION_PORTRAIT, annexHeight);
2671 bounds.SetBounds(0.0f, 0.0f, annexWidth, annexHeight);
2673 pCanvas = new (std::nothrow) Canvas();
2674 SysTryCatch(NID_UI_CTRL, pCanvas != null, , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient.");
2676 pCanvas->Construct(bounds);
2677 pCanvas->SetBackgroundColor(Color(0, 0, 0, 0));
2680 DrawBitmap(*pCanvas, CalculateAnnexBitmapBounds(annexWidth, annexHeight, *pCheckBoxBg), *pCheckBoxBg);
2682 if (__isCheckedAnimationEnabled == true)
2684 StartCheckBoxAnimation();
2688 if (IsChecked() == true && pCheckBox != null)
2690 DrawBitmap(*pCanvas, CalculateAnnexBitmapBounds(annexWidth, annexHeight, *pCheckBox), *pCheckBox);
2694 pMergeBitmap = new (std::nothrow) Bitmap();
2695 SysTryCatch(NID_UI_CTRL, pMergeBitmap != null, , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient.");
2697 pMergeBitmap->Construct(*pCanvas, bounds);
2698 _BitmapImpl::ConvertToNonpremultiplied(*pMergeBitmap, true);
2700 __pItemAnnex->SetBackgroundBitmap(*pMergeBitmap);
2701 __pItemAnnex->Invalidate(false);
2706 delete pMergeBitmap;
2713 _TableViewItem::DrawRadioBox(void)
2715 Bitmap* pRadioButton = null;
2716 Bitmap* pRadioButtonBg = null;
2717 Bitmap* pMergeBitmap = null;
2718 Canvas* pCanvas = null;
2719 result r = E_SUCCESS;
2721 FloatRectangle bounds;
2722 float annexWidth = 0.0f;
2723 float annexHeight = 0.0f;
2727 if (__drawingStatus == TABLE_VIEW_ITEM_DRAWING_STATUS_NORMAL)
2729 r = GET_BITMAP_CONFIG_N(TABLEVIEW::RADIOBUTTON_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, pRadioButtonBg);
2730 SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS) && (pRadioButtonBg != null), , E_SYSTEM, "[E_SYSTEM] RadioButtonBg image load failed");
2732 r = GET_BITMAP_CONFIG_N(TABLEVIEW::RADIOBUTTON_BUTTON_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, pRadioButton);
2733 SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS) && (pRadioButton != null), , E_SYSTEM, "[E_SYSTEM] CheckBox image load failed");
2735 else if ((__drawingStatus == TABLE_VIEW_ITEM_DRAWING_STATUS_PRESSED) || (__drawingStatus == TABLE_VIEW_ITEM_DRAWING_STATUS_HIGHLIGHTED))
2737 r = GET_BITMAP_CONFIG_N(TABLEVIEW::RADIOBUTTON_PRESSED, BITMAP_PIXEL_FORMAT_ARGB8888, pRadioButtonBg);
2738 SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS) && (pRadioButtonBg != null), , E_SYSTEM, "[E_SYSTEM] RadioButtonBg image load failed");
2740 r = GET_BITMAP_CONFIG_N(TABLEVIEW::RADIOBUTTON_BUTTON_PRESSED, BITMAP_PIXEL_FORMAT_ARGB8888, pRadioButton);
2741 SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS) && (pRadioButton != null), , E_SYSTEM, "[E_SYSTEM] CheckBox image load failed");
2746 r = GET_BITMAP_CONFIG_N(TABLEVIEW::RADIOBUTTON_NORMAL_DISABLED, BITMAP_PIXEL_FORMAT_ARGB8888, pRadioButtonBg);
2747 SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS) && (pRadioButtonBg != null), , E_SYSTEM, "[E_SYSTEM] RadioButtonBg image load failed");
2749 r = GET_BITMAP_CONFIG_N(TABLEVIEW::RADIOBUTTON_BUTTON_DISABLED, BITMAP_PIXEL_FORMAT_ARGB8888, pRadioButton);
2750 SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS) && (pRadioButton != null), , E_SYSTEM, "[E_SYSTEM] CheckBox image load failed");
2753 GET_SHAPE_CONFIG(TABLEVIEW::ITEM_ANNEX_WIDTH, _CONTROL_ORIENTATION_PORTRAIT, annexWidth);
2754 GET_SHAPE_CONFIG(TABLEVIEW::ITEM_ANNEX_HEIGHT, _CONTROL_ORIENTATION_PORTRAIT, annexHeight);
2755 bounds.SetBounds(0.0f, 0.0f, annexWidth, annexHeight);
2757 pCanvas = new (std::nothrow) Canvas();
2758 SysTryCatch(NID_UI_CTRL, pCanvas != null, , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient.");
2760 pCanvas->Construct(bounds);
2761 pCanvas->SetBackgroundColor(Color(0, 0, 0, 0));
2764 DrawBitmap(*pCanvas, CalculateAnnexBitmapBounds(annexWidth, annexHeight, *pRadioButtonBg), *pRadioButtonBg);
2766 if (pRadioButton != null && IsChecked() == true)
2768 DrawBitmap(*pCanvas, CalculateAnnexBitmapBounds(annexWidth, annexHeight, *pRadioButton), *pRadioButton);
2771 pMergeBitmap = new (std::nothrow) Bitmap();
2772 SysTryCatch(NID_UI_CTRL, pMergeBitmap != null, , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient.");
2774 pMergeBitmap->Construct(*pCanvas, bounds);
2775 _BitmapImpl::ConvertToNonpremultiplied(*pMergeBitmap, true);
2777 __pItemAnnex->SetBackgroundBitmap(*pMergeBitmap);
2778 __pItemAnnex->Invalidate(false);
2781 delete pRadioButton;
2782 delete pRadioButtonBg;
2783 delete pMergeBitmap;
2790 _TableViewItem::DrawOnOffButton(void)
2792 Bitmap* pOnOffButton = null;
2793 Bitmap* pOnOffButtonHandler = null;
2794 Bitmap* pMergeBitmap = null;
2795 Canvas* pCanvas = null;
2796 result r = E_SUCCESS;
2798 FloatRectangle bounds;
2799 FloatRectangle backgroundBounds;
2800 FloatRectangle handlerBounds;
2801 float annexWidth = 0.0f;
2802 float annexHeight = 0.0f;
2803 float annexMargin = 0.0f;
2805 if (IsChecked() == true)
2809 r = GET_BITMAP_CONFIG_N(TABLEVIEW::ONOFFBUTTON_ON_HANDLER, BITMAP_PIXEL_FORMAT_ARGB8888, pOnOffButtonHandler);
2813 r = GET_BITMAP_CONFIG_N(TABLEVIEW::ONOFFBUTTON_ON_HANDLER_DISABLED, BITMAP_PIXEL_FORMAT_ARGB8888, pOnOffButtonHandler);
2820 r = GET_BITMAP_CONFIG_N(TABLEVIEW::ONOFFBUTTON_OFF_HANDLER, BITMAP_PIXEL_FORMAT_ARGB8888, pOnOffButtonHandler);
2824 r = GET_BITMAP_CONFIG_N(TABLEVIEW::ONOFFBUTTON_OFF_HANDLER_DISABLED, BITMAP_PIXEL_FORMAT_ARGB8888, pOnOffButtonHandler);
2827 SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS) && (pOnOffButtonHandler != null), , E_SYSTEM, "[E_SYSTEM] OnOffButtonHandler image load failed");
2831 r = GET_BITMAP_CONFIG_N(TABLEVIEW::ONOFFBUTTON_BG, BITMAP_PIXEL_FORMAT_ARGB8888, pOnOffButton);
2835 r = GET_BITMAP_CONFIG_N(TABLEVIEW::ONOFFBUTTON_BG_DISABLED, BITMAP_PIXEL_FORMAT_ARGB8888, pOnOffButton);
2837 SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS) && (pOnOffButton != null), , E_SYSTEM, "[E_SYSTEM] OnOffButton image load failed");
2839 GET_SHAPE_CONFIG(TABLEVIEW::ITEM_ANNEX_ONOFF_WIDTH, _CONTROL_ORIENTATION_PORTRAIT, annexWidth);
2840 GET_SHAPE_CONFIG(TABLEVIEW::ITEM_ANNEX_ONOFF_HEIGHT, _CONTROL_ORIENTATION_PORTRAIT, annexHeight);
2841 bounds.SetBounds(0, 0, annexWidth, annexHeight);
2843 pCanvas = new (std::nothrow) Canvas();
2844 SysTryCatch(NID_UI_CTRL, pCanvas != null, , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient.");
2846 pCanvas->Construct(bounds);
2847 pCanvas->SetBackgroundColor(Color(0, 0, 0, 0));
2850 backgroundBounds = CalculateAnnexBitmapBounds(annexWidth, annexHeight, *pOnOffButton);
2851 DrawBitmap(*pCanvas, backgroundBounds, *pOnOffButton);
2853 handlerBounds = CalculateAnnexBitmapBounds(annexWidth, annexHeight, *pOnOffButtonHandler);
2854 GET_SHAPE_CONFIG(TABLEVIEW::ITEM_ANNEX_ONOFF_MARGIN, _CONTROL_ORIENTATION_PORTRAIT, annexMargin);
2855 if (IsChecked() == true)
2857 handlerBounds.x = backgroundBounds.width - handlerBounds.width - annexMargin;
2861 handlerBounds.x = backgroundBounds.x + annexMargin;
2864 DrawBitmap(*pCanvas, handlerBounds, *pOnOffButtonHandler);
2866 pMergeBitmap = new (std::nothrow) Bitmap();
2867 SysTryCatch(NID_UI_CTRL, pMergeBitmap != null, , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient.");
2869 pMergeBitmap->Construct(*pCanvas, bounds);
2870 _BitmapImpl::ConvertToNonpremultiplied(*pMergeBitmap, true);
2872 __pItemAnnex->SetBackgroundBitmap(*pMergeBitmap);
2873 __pItemAnnex->Invalidate(false);
2876 delete pOnOffButton;
2877 delete pOnOffButtonHandler;
2878 delete pMergeBitmap;
2885 _TableViewItem::AdjustAnnexOnOffHandlerPosition()
2887 float annexWidth = 0.0f;
2888 float annexHeight = 0.0f;
2889 float annexMargin = 0.0f;
2891 float annexStartPositionX = 0.0f;
2892 float annexEndPositionX = 0.0f;
2893 float handlerPositionX = 0.0f;
2894 FloatRectangle handlerBounds;
2895 result r = E_SUCCESS;
2897 GET_SHAPE_CONFIG(TABLEVIEW::ITEM_ANNEX_ONOFF_MARGIN, _CONTROL_ORIENTATION_PORTRAIT, annexMargin);
2899 Bitmap* pOnOffButtonHandler = null;
2900 if (IsChecked() == true)
2902 r = GET_BITMAP_CONFIG_N(TABLEVIEW::ONOFFBUTTON_ON_HANDLER, BITMAP_PIXEL_FORMAT_ARGB8888, pOnOffButtonHandler);
2906 r = GET_BITMAP_CONFIG_N(TABLEVIEW::ONOFFBUTTON_OFF_HANDLER, BITMAP_PIXEL_FORMAT_ARGB8888, pOnOffButtonHandler);
2908 SysTryReturnVoidResult(NID_UI_CTRL, (r == E_SUCCESS) && (pOnOffButtonHandler != null), E_SYSTEM, "[E_SYSTEM] OnOffHandlerButton button image load failed.");
2910 GET_SHAPE_CONFIG(TABLEVIEW::ITEM_ANNEX_ONOFF_WIDTH, _CONTROL_ORIENTATION_PORTRAIT, annexWidth);
2911 GET_SHAPE_CONFIG(TABLEVIEW::ITEM_ANNEX_ONOFF_HEIGHT, _CONTROL_ORIENTATION_PORTRAIT, annexHeight);
2913 annexStartPositionX = __pItemAnnex->GetBoundsF().x;
2914 annexEndPositionX = annexStartPositionX + annexWidth + annexMargin;
2916 handlerBounds = CalculateAnnexBitmapBounds(annexWidth, annexHeight, *pOnOffButtonHandler);
2918 if(__annexOnOffHandlerMoved)
2920 if(annexStartPositionX <= __annexOnOffHandlerPositionX
2921 && annexEndPositionX >= __annexOnOffHandlerPositionX)
2923 if(((annexEndPositionX - annexStartPositionX) / 2) < (__annexOnOffHandlerPositionX + (handlerBounds.width / 2)) - annexStartPositionX )
2925 handlerPositionX = annexEndPositionX;
2930 handlerPositionX = annexStartPositionX;
2937 SetChecked(!IsChecked());
2940 handlerPositionX = annexEndPositionX;
2944 handlerPositionX = annexStartPositionX;
2948 DrawAnnexOnOffHandler(handlerPositionX);
2950 delete pOnOffButtonHandler;
2956 _TableViewItem::DrawAnnexOnOffHandler(float touchEndPosition)
2958 if (__pItemAnnex == null)
2963 Bitmap* pOnOffButton = null;
2964 Bitmap* pOnOffButtonHandler = null;
2965 Bitmap* pMergeBitmap = null;
2966 Canvas* pCanvas = null;
2967 result r = E_SUCCESS;
2969 FloatRectangle backgroundBounds;
2970 FloatRectangle handlerBounds;
2971 float annexWidth = 0.0f;
2972 float annexHeight = 0.0f;
2973 float annexMargin = 0.0f;
2974 float annexX = 0.0f;
2975 float nextHandlerX = 0.0f;
2977 r = GET_BITMAP_CONFIG_N(TABLEVIEW::ONOFFBUTTON_BG, BITMAP_PIXEL_FORMAT_ARGB8888, pOnOffButton);
2978 SysTryReturnVoidResult(NID_UI_CTRL, (r == E_SUCCESS) && (pOnOffButton != null), E_SYSTEM, "[E_SYSTEM] OnOffButton image load failed.");
2980 if (IsChecked() == true)
2982 r = GET_BITMAP_CONFIG_N(TABLEVIEW::ONOFFBUTTON_ON_HANDLER, BITMAP_PIXEL_FORMAT_ARGB8888, pOnOffButtonHandler);
2986 r = GET_BITMAP_CONFIG_N(TABLEVIEW::ONOFFBUTTON_OFF_HANDLER, BITMAP_PIXEL_FORMAT_ARGB8888, pOnOffButtonHandler);
2988 SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS) && (pOnOffButtonHandler != null), , E_SYSTEM, "[E_SYSTEM] OnOffHandlerButton image load failed");
2990 GET_SHAPE_CONFIG(TABLEVIEW::ITEM_ANNEX_ONOFF_WIDTH, _CONTROL_ORIENTATION_PORTRAIT, annexWidth);
2991 GET_SHAPE_CONFIG(TABLEVIEW::ITEM_ANNEX_ONOFF_HEIGHT, _CONTROL_ORIENTATION_PORTRAIT, annexHeight);
2992 GET_SHAPE_CONFIG(TABLEVIEW::ITEM_ANNEX_ONOFF_MARGIN, _CONTROL_ORIENTATION_PORTRAIT, annexMargin);
2994 pCanvas = new (std::nothrow) Canvas();
2995 SysTryCatch(NID_UI_CTRL, pCanvas != null, , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient.");
2997 pCanvas->Construct(FloatRectangle(0, 0, annexWidth, annexHeight));
2998 pCanvas->SetBackgroundColor(Color(0, 0, 0, 0));
3001 backgroundBounds = CalculateAnnexBitmapBounds(annexWidth, annexHeight, *pOnOffButton);
3002 DrawBitmap(*pCanvas, backgroundBounds, *pOnOffButton);
3004 handlerBounds = CalculateAnnexBitmapBounds(annexWidth, annexHeight, *pOnOffButtonHandler);
3005 handlerBounds.y = backgroundBounds.y;
3009 handlerBounds.x = backgroundBounds.width - handlerBounds.width - annexMargin;
3013 handlerBounds.x = backgroundBounds.x + annexMargin;
3016 nextHandlerX = handlerBounds.x + (touchEndPosition - __annexTouchStartPosition);
3017 annexX = __pItemAnnex->GetBoundsF().x;
3019 if((annexX + nextHandlerX + handlerBounds.width) < (annexX + annexWidth + annexMargin)
3020 && (annexX + nextHandlerX) > annexX)
3022 handlerBounds.x = nextHandlerX;
3024 else if(_FloatCompareGE((annexX + nextHandlerX + handlerBounds.width), (annexX + annexWidth + annexMargin)))
3026 handlerBounds.x = backgroundBounds.width - handlerBounds.width - annexMargin;
3028 else if(_FloatCompareLE((annexX + nextHandlerX), annexX))
3030 handlerBounds.x = backgroundBounds.x + annexMargin;
3033 __annexOnOffHandlerPositionX = annexX + handlerBounds.x;
3034 DrawBitmap(*pCanvas, handlerBounds, *pOnOffButtonHandler);
3036 pMergeBitmap = new (std::nothrow) Bitmap();
3037 SysTryCatch(NID_UI_CTRL, pMergeBitmap != null, , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient.");
3039 pMergeBitmap->Construct(*pCanvas, FloatRectangle(0, 0, annexWidth, annexHeight));
3040 _BitmapImpl::ConvertToNonpremultiplied(*pMergeBitmap, true);
3042 __pItemAnnex->SetBackgroundBitmap(*pMergeBitmap);
3043 __pItemAnnex->Invalidate(false);
3046 delete pOnOffButton;
3047 delete pOnOffButtonHandler;
3048 delete pMergeBitmap;
3055 _TableViewItem::DrawDetailButton(void)
3057 Bitmap* pDetail = null;
3058 Bitmap* pDetailBg = null;
3059 Bitmap* pDetailBgEffect = null;
3060 Bitmap* pDetailEffect = null;
3061 Bitmap* pReplacementDetail = null;
3062 Bitmap* pReplacementDetailBg = null;
3063 Bitmap* pMergeBitmap = null;
3064 Canvas* pCanvas = null;
3065 Color replacementNewColor;
3066 Color replacementNewBgColor;
3067 result r = E_SUCCESS;
3069 FloatRectangle bounds;
3070 float annexWidth = 0.0f;
3071 float annexHeight = 0.0f;
3072 bool themeBackgroundBitmap = false;
3074 themeBackgroundBitmap = IS_CUSTOM_BITMAP(TABLEVIEW::CIRCLE_BUTTON_BG_NORMAL);
3078 r = GET_BITMAP_CONFIG_N(TABLEVIEW::CIRCLE_BUTTON_BG_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, pDetailBg);
3079 SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS) && (pDetailBg != null), , E_SYSTEM, "[E_SYSTEM] Detail button image load failed");
3081 if (__isSelectedDetailButton)
3083 if (!themeBackgroundBitmap)
3085 r = GET_BITMAP_CONFIG_N(TABLEVIEW::CIRCLE_BUTTON_BG_PRESSED, BITMAP_PIXEL_FORMAT_ARGB8888, pDetailBgEffect);
3086 SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS) && (pDetailBgEffect != null), , E_SYSTEM, "[E_SYSTEM] Detail button image load failed");
3088 r = GET_BITMAP_CONFIG_N(TABLEVIEW::CIRCLE_BUTTON_REVEAL_EFFECT, BITMAP_PIXEL_FORMAT_ARGB8888, pDetailEffect);
3089 SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS) && (pDetailEffect != null), , E_SYSTEM, "[E_SYSTEM] Detail button image load failed");
3092 r = GET_BITMAP_CONFIG_N(TABLEVIEW::CIRCLE_BUTTON_REVEAL_PRESSED, BITMAP_PIXEL_FORMAT_ARGB8888, pDetail);
3093 SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS) && (pDetail != null), , E_SYSTEM, "[E_SYSTEM] Detail button image load failed");
3095 GET_COLOR_CONFIG(TABLEVIEW::ITEM_ANNEX_DETAIL_PRESSED, replacementNewColor);
3096 GET_COLOR_CONFIG(TABLEVIEW::ITEM_ANNEX_DETAIL_BG_PRESSED, replacementNewBgColor);
3100 if (!themeBackgroundBitmap)
3102 r = GET_BITMAP_CONFIG_N(TABLEVIEW::CIRCLE_BUTTON_BG_EFFECT, BITMAP_PIXEL_FORMAT_ARGB8888, pDetailBgEffect);
3103 SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS) && (pDetailBgEffect != null), , E_SYSTEM, "[E_SYSTEM] Detail button image load failed");
3105 r = GET_BITMAP_CONFIG_N(TABLEVIEW::CIRCLE_BUTTON_REVEAL_EFFECT, BITMAP_PIXEL_FORMAT_ARGB8888, pDetailEffect);
3106 SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS) && (pDetailEffect != null), , E_SYSTEM, "[E_SYSTEM] Detail button image load failed");
3109 r = GET_BITMAP_CONFIG_N(TABLEVIEW::CIRCLE_BUTTON_REVEAL_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, pDetail);
3110 SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS) && (pDetail != null), , E_SYSTEM, "[E_SYSTEM] Detail button image load failed");
3112 GET_COLOR_CONFIG(TABLEVIEW::ITEM_ANNEX_DETAIL_NORMAL, replacementNewColor);
3113 GET_COLOR_CONFIG(TABLEVIEW::ITEM_ANNEX_DETAIL_BG_NORMAL, replacementNewBgColor);
3119 if (!themeBackgroundBitmap)
3121 r = GET_BITMAP_CONFIG_N(TABLEVIEW::CIRCLE_BUTTON_BG_EFFECT_DISABLED, BITMAP_PIXEL_FORMAT_ARGB8888, pDetailBgEffect);
3122 SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS) && (pDetailBgEffect != null), , E_SYSTEM, "[E_SYSTEM] Detail button image load failed");
3124 r = GET_BITMAP_CONFIG_N(TABLEVIEW::CIRCLE_BUTTON_REVEAL_EFFECT, BITMAP_PIXEL_FORMAT_ARGB8888, pDetailEffect);
3125 SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS) && (pDetailEffect != null), , E_SYSTEM, "[E_SYSTEM] Detail button image load failed");
3128 r = GET_BITMAP_CONFIG_N(TABLEVIEW::CIRCLE_BUTTON_REVEAL_DISABLED, BITMAP_PIXEL_FORMAT_ARGB8888, pDetail);
3129 SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS) && (pDetail != null), , E_SYSTEM, "[E_SYSTEM] Detail button image load failed");
3131 r = GET_BITMAP_CONFIG_N(TABLEVIEW::CIRCLE_BUTTON_BG_DISABLED, BITMAP_PIXEL_FORMAT_ARGB8888, pDetailBg);
3132 SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS) && (pDetailBg != null), , E_SYSTEM, "[E_SYSTEM] Detail button image load failed");
3134 GET_COLOR_CONFIG(TABLEVIEW::ITEM_ANNEX_DETAIL_NORMAL, replacementNewColor);
3136 pReplacementDetailBg = Tizen::Graphics::_BitmapImpl::GetColorReplacedBitmapN(*pDetailBg, Color::GetColor(COLOR_ID_MAGENTA), replacementNewBgColor);
3137 SysTryCatch(NID_UI_CTRL, pReplacementDetailBg != null, r = E_SYSTEM, E_SYSTEM, "[E_SYSTEM] Detail button image load failed");
3139 pReplacementDetail = Tizen::Graphics::_BitmapImpl::GetColorReplacedBitmapN(*pDetail, Color::GetColor(COLOR_ID_MAGENTA), replacementNewColor);
3140 SysTryCatch(NID_UI_CTRL, pReplacementDetail != null, r = E_SYSTEM, E_SYSTEM, "[E_SYSTEM] Detail button image load failed");
3142 GET_SHAPE_CONFIG(TABLEVIEW::ITEM_ANNEX_MORE_WIDTH, _CONTROL_ORIENTATION_PORTRAIT, annexWidth);
3143 GET_SHAPE_CONFIG(TABLEVIEW::ITEM_ANNEX_MORE_HEIGHT, _CONTROL_ORIENTATION_PORTRAIT, annexHeight);
3145 bounds.SetBounds(0, 0, annexWidth, annexHeight);
3147 pCanvas = new (std::nothrow) Canvas();
3148 SysTryCatch(NID_UI_CTRL, pCanvas != null, , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient.");
3150 pCanvas->Construct(bounds);
3151 pCanvas->SetBackgroundColor(Color(0, 0, 0, 0));
3154 DrawBitmap(*pCanvas, CalculateAnnexBitmapBounds(annexWidth, annexHeight, *pReplacementDetailBg), *pReplacementDetailBg);
3155 if (pDetailBgEffect)
3157 DrawBitmap(*pCanvas, CalculateAnnexBitmapBounds(annexWidth, annexHeight, *pDetailBgEffect), *pDetailBgEffect);
3159 DrawBitmap(*pCanvas, CalculateAnnexBitmapBounds(annexWidth, annexHeight, *pReplacementDetail), *pReplacementDetail);
3162 DrawBitmap(*pCanvas, CalculateAnnexBitmapBounds(annexWidth, annexHeight, *pDetailEffect), *pDetailEffect);
3165 pMergeBitmap = new (std::nothrow) Bitmap();
3166 SysTryCatch(NID_UI_CTRL, pMergeBitmap != null, , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient.");
3168 pMergeBitmap->Construct(*pCanvas, bounds);
3169 _BitmapImpl::ConvertToNonpremultiplied(*pMergeBitmap, true);
3171 __pItemAnnex->SetBackgroundBitmap(*pMergeBitmap);
3172 __pItemAnnex->Invalidate(false);
3177 delete pDetailBgEffect;
3178 delete pDetailEffect;
3179 delete pReplacementDetail;
3180 delete pReplacementDetailBg;
3181 delete pMergeBitmap;
3188 _TableViewItem::DrawItemDivider(void)
3190 if(__pItemDivider == null || __pItemTopDivider == null)
3195 if (__pDrawingProperty->itemDividerEnabled == false ||
3196 __itemType == TABLE_VIEW_ITEM_TYPE_HEADER ||
3197 __itemType == TABLE_VIEW_ITEM_TYPE_FOOTER ||
3198 __itemDividerEnabled == false)
3200 __pItemDivider->SetVisibleState(false);
3201 __pItemTopDivider->SetVisibleState(false);
3206 FloatRectangle dividerBottomBounds;
3207 FloatRectangle dividerTopBounds;
3209 Color bottomLineColor;
3210 Color customDividerColor;
3211 FloatRectangle bounds;
3212 FloatPoint bottomPoint;
3214 __pItemDivider->SetVisibleState(true);
3215 __pItemTopDivider->SetVisibleState(true);
3217 if( __drawingStatus == TABLE_VIEW_ITEM_DRAWING_STATUS_PRESSED ||
3218 __drawingStatus == TABLE_VIEW_ITEM_DRAWING_STATUS_HIGHLIGHTED)
3220 if(__colorItemBg[TABLE_VIEW_ITEM_DRAWING_STATUS_NORMAL] != __colorItemBg[TABLE_VIEW_ITEM_DRAWING_STATUS_PRESSED])
3222 if(__itemType != TABLE_VIEW_ITEM_TYPE_TITLE)
3224 __pItemDivider->SetVisibleState(false);
3227 __pItemTopDivider->SetVisibleState(false);
3231 if (__itemType == TABLE_VIEW_ITEM_TYPE_TITLE)
3233 if(__pItemBgBitmap[__drawingStatus] != null)
3235 __pItemDivider->SetVisibleState(false);
3239 float lineHeight = 0.0f;
3240 float lineLeftMargin = 0.0f;
3241 float lineBottomMargin = 0.0f;
3242 bounds = GetBoundsF();
3244 if (__drawingStatus == TABLE_VIEW_ITEM_DRAWING_STATUS_NORMAL)
3246 GET_COLOR_CONFIG(TABLEVIEW::GROUPITEM_INDEX_BAR_NORMAL, bottomLineColor);
3250 GET_COLOR_CONFIG(TABLEVIEW::GROUPITEM_INDEX_BAR_PRESSED, bottomLineColor);
3253 GET_SHAPE_CONFIG(TABLEVIEW::GROUPITEM_INDEX_BAR_HEIGHT, _CONTROL_ORIENTATION_PORTRAIT, lineHeight);
3254 GET_SHAPE_CONFIG(TABLEVIEW::GROUPITEM_INDEX_BAR_LEFT_MARGIN, _CONTROL_ORIENTATION_PORTRAIT, lineLeftMargin);
3255 GET_SHAPE_CONFIG(TABLEVIEW::GROUPITEM_INDEX_BAR_BOTTOM_MARGIN, _CONTROL_ORIENTATION_PORTRAIT, lineBottomMargin);
3257 lineHeight = Tizen::Graphics::CoordinateSystem::ConvertToLogicalY(lineHeight);
3258 lineBottomMargin = Tizen::Graphics::CoordinateSystem::ConvertToLogicalY(lineBottomMargin);
3259 bottomPoint = Tizen::Graphics::CoordinateSystem::AlignToDevice(FloatPoint(lineLeftMargin, bounds.height));
3260 dividerBottomBounds = FloatRectangle(bottomPoint.x, bottomPoint.y - lineBottomMargin, bounds.width - lineLeftMargin * 2.0f, lineHeight);
3265 float lineLeftMargin = 0.0f;
3266 float lineHeight = 0.0f;
3267 bounds = GetBoundsF();
3268 int groupIndex = -1;
3271 GetItemIndex(groupIndex, itemIndex);
3275 __pItemTopDivider->SetVisibleState(false);
3278 if(!IsContextItem())
3280 if (!__isSimpleLastItem)
3282 if(__itemType == TABLE_VIEW_ITEM_TYPE_BOTTOM || __itemType == TABLE_VIEW_ITEM_TYPE_ONE)
3284 __pItemDivider->SetVisibleState(false);
3289 customDividerColor = __pDrawingProperty->dividerColor;
3290 GET_COLOR_CONFIG(TABLEVIEW::ITEM_DIVIDER_TOP_BG_NORMAL, topLineColor);
3291 GET_COLOR_CONFIG(TABLEVIEW::ITEM_DIVIDER_BOTTOM_BG_NORMAL, bottomLineColor);
3292 GET_FIXED_VALUE_CONFIG(TABLEVIEW::ITEM_DIVIDER_LEFT_MARGIN, _CONTROL_ORIENTATION_PORTRAIT, lineLeftMargin);
3293 GET_FIXED_VALUE_CONFIG(TABLEVIEW::ITEM_DIVIDER_HEIGHT, _CONTROL_ORIENTATION_PORTRAIT, lineHeight);
3295 lineLeftMargin = Tizen::Graphics::CoordinateSystem::ConvertToLogicalX(lineLeftMargin);
3296 lineHeight = Tizen::Graphics::CoordinateSystem::ConvertToLogicalY(lineHeight);
3297 bottomPoint = Tizen::Graphics::CoordinateSystem::AlignToDevice(FloatPoint(lineLeftMargin, (bounds.height)));
3299 dividerTopBounds.SetBounds(lineLeftMargin, 0.0f, bounds.width - lineLeftMargin * 2.0f, lineHeight);
3300 dividerBottomBounds.SetBounds(lineLeftMargin, bottomPoint.y - lineHeight, bounds.width - lineLeftMargin * 2.0f, lineHeight);
3303 if(__pItemDivider->GetVisibleState())
3305 __pItemDivider->SetBounds(dividerBottomBounds);
3306 if(customDividerColor == bottomLineColor || __itemType == TABLE_VIEW_ITEM_TYPE_TITLE)
3308 __pItemDivider->SetBackgroundColor(bottomLineColor);
3312 __pItemDivider->SetBackgroundColor(customDividerColor);
3313 __pItemDivider->GetVisualElement()->SetOpacity(ITEM_BOTTOM_DIVIDER_OPACITY);
3315 __pItemDivider->Invalidate();
3318 if(__pItemTopDivider->GetVisibleState())
3320 __pItemTopDivider->SetBounds(dividerTopBounds);
3321 if(customDividerColor == bottomLineColor)
3323 __pItemTopDivider->SetBackgroundColor(topLineColor);
3327 __pItemTopDivider->SetBackgroundColor(customDividerColor);
3328 __pItemTopDivider->GetVisualElement()->SetOpacity(ITEM_TOP_DIVIDER_OPACITY);
3330 __pItemTopDivider->Invalidate();
3335 _TableViewItem::DrawItemAnnexDivider(void)
3337 if (__itemType == TABLE_VIEW_ITEM_TYPE_HEADER || __itemType == TABLE_VIEW_ITEM_TYPE_FOOTER)
3339 if (__pItemAnnexLeftDivider != null)
3341 __pItemAnnexLeftDivider->SetVisibleState(false);
3344 if (__pItemAnnexRightDivider != null)
3346 __pItemAnnexRightDivider->SetVisibleState(false);
3351 Color dividerLeftColor;
3352 Color dividerRightColor;
3353 Color customDividerColor;
3354 Color bottomLineColor;
3355 FloatRectangle bounds = GetBoundsF();
3356 float dividerHeight = 0;
3357 float itemHeight = 0;
3358 float dividerWidth = 0.0f;
3359 float dividerTopMargin = 0.0f;
3360 float annexWidth = 0.0f;
3361 float annexLeftMargin = 0.0f;
3362 float itemLeftMargin = 0.0f;
3364 customDividerColor = __pDrawingProperty->dividerColor;
3365 GET_SHAPE_CONFIG(TABLEVIEW::ITEM_LEFT_MARGIN, _CONTROL_ORIENTATION_PORTRAIT, itemLeftMargin);
3366 GET_SHAPE_CONFIG(TABLEVIEW::ITEM_ANNEX_MARGIN, _CONTROL_ORIENTATION_PORTRAIT, annexLeftMargin);
3367 GET_SHAPE_CONFIG(TABLEVIEW::ITEM_ANNEX_ONOFF_WIDTH, _CONTROL_ORIENTATION_PORTRAIT, annexWidth);
3368 GET_COLOR_CONFIG(TABLEVIEW::ITEM_ANNEX_DIVIDER_LEFT_BG_NORMAL, dividerLeftColor);
3369 GET_COLOR_CONFIG(TABLEVIEW::ITEM_ANNEX_DIVIDER_RIGHT_BG_NORMAL, dividerRightColor);
3370 GET_COLOR_CONFIG(TABLEVIEW::ITEM_DIVIDER_BOTTOM_BG_NORMAL, bottomLineColor);
3371 GET_FIXED_VALUE_CONFIG(TABLEVIEW::ITEM_ANNEX_DIVIDER_WIDTH, _CONTROL_ORIENTATION_PORTRAIT, dividerWidth);
3372 GET_FIXED_VALUE_CONFIG(TABLEVIEW::ITEM_ANNEX_DIVIDER_MARGIN, _CONTROL_ORIENTATION_PORTRAIT, dividerTopMargin);
3374 itemLeftMargin += __pDrawingProperty->scrollMargin;
3375 itemHeight = ((__customHeight > 0) ? __customHeight : GetBoundsF().height);
3376 dividerHeight = itemHeight - (dividerTopMargin*2);
3377 dividerHeight = (dividerHeight > 0) ? dividerHeight : 0;
3378 __pItemAnnexLeftDivider->SetBounds(FloatRectangle((GetBoundsF().width - annexWidth - (itemLeftMargin + annexLeftMargin) - (dividerWidth*2)), dividerTopMargin, dividerWidth, dividerHeight));
3379 __pItemAnnexRightDivider->SetBounds(FloatRectangle((GetBoundsF().width - annexWidth - (itemLeftMargin + annexLeftMargin) - dividerWidth), dividerTopMargin, dividerWidth, dividerHeight));
3381 if (customDividerColor == bottomLineColor)
3383 __pItemAnnexLeftDivider->SetBackgroundColor(dividerLeftColor);
3387 __pItemAnnexLeftDivider->SetBackgroundColor(customDividerColor);
3388 __pItemAnnexLeftDivider->GetVisualElement()->SetOpacity(ITEM_TOP_DIVIDER_OPACITY);
3391 if (customDividerColor == bottomLineColor)
3393 __pItemAnnexRightDivider->SetBackgroundColor(dividerRightColor);
3397 __pItemAnnexRightDivider->SetBackgroundColor(customDividerColor);
3398 __pItemAnnexRightDivider->GetVisualElement()->SetOpacity(ITEM_BOTTOM_DIVIDER_OPACITY);
3401 __pItemAnnexLeftDivider->Invalidate();
3402 __pItemAnnexRightDivider->Invalidate();
3405 if (__pItemAnnexLeftDivider != null)
3407 _AccessibilityContainer* pContainer = __pItemAnnexLeftDivider->GetAccessibilityContainer();
3408 pContainer->Activate(false);
3411 if (__pItemAnnexRightDivider != null)
3413 _AccessibilityContainer* pContainer = __pItemAnnexRightDivider->GetAccessibilityContainer();
3414 pContainer->Activate(false);
3420 _TableViewItem::DrawBitmap(Canvas& canvas, const FloatRectangle& bounds, const Bitmap& bitmap)
3422 result r = E_SUCCESS;
3423 if (_BitmapImpl::CheckNinePatchedBitmapStrictly(bitmap))
3425 r = canvas.DrawNinePatchedBitmap(bounds, bitmap);
3426 SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Fail to draw ninepatched bitmap.", GetErrorMessage(r))
3430 r = canvas.DrawBitmap(bounds, bitmap);
3431 SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Fail to draw bitmap.", GetErrorMessage(r))
3438 _TableViewItem::SetItemHighlightBounds(_VisualElement& highlightVisualElement, const FloatRectangle& bounds)
3440 return highlightVisualElement.SetBounds(bounds);
3444 _TableViewItem::CalculateItemHighlightBounds(void)
3446 FloatRectangle itemBounds = GetBoundsF();
3447 return FloatRectangle(0.0f, 0.0f, itemBounds.width, itemBounds.height);
3451 _TableViewItem::CalculateAnnexBitmapBounds(float annexWidth, float annexHeight, const Bitmap& bitmap)
3453 FloatRectangle bounds;
3456 float leftMargin = 0;
3457 float topMargin = 0;
3459 if (annexWidth > bitmap.GetWidthF())
3461 leftMargin = (annexWidth - bitmap.GetWidthF()) / 2;
3462 width = bitmap.GetWidthF();
3469 if(annexHeight > bitmap.GetHeightF())
3471 topMargin = (annexHeight - bitmap.GetHeightF()) / 2;
3472 height = bitmap.GetHeightF();
3476 height = annexHeight;
3479 bounds.SetBounds(leftMargin, topMargin, width, height);
3485 _TableViewItem::IsTitleStyleItem(void) const
3487 if (__itemType == TABLE_VIEW_ITEM_TYPE_TITLE || __itemType == TABLE_VIEW_ITEM_TYPE_HEADER || __itemType == TABLE_VIEW_ITEM_TYPE_FOOTER)
3496 _TableViewItem::IsValidSelectionState(void)
3498 _TableView* pParent = dynamic_cast<_TableView*>(GetParent());
3499 if (pParent == null)
3504 if (pParent->GetPressedItemCount() > 0)
3513 _TableViewItem::DrawSimpleItem(void)
3515 if (__pSimpleItemText != null)
3517 Color textColor = __simpleItemTextColor[__drawingStatus];
3520 textColor = __simpleItemTextColor[TABLE_VIEW_SIMPLEITEM_DRAWING_STATUS_DISABLED];
3523 if (__itemType == TABLE_VIEW_ITEM_TYPE_TITLE)
3525 if (__drawingStatus == TABLE_VIEW_ITEM_DRAWING_STATUS_NORMAL)
3527 textColor = __simpleItemTextColor[TABLE_VIEW_GROUPITEM_DRAWING_STATUS_NORMAL];
3531 textColor = __simpleItemTextColor[TABLE_VIEW_GROUPITEM_DRAWING_STATUS_PRESSED];
3535 __pSimpleItemText->SetTextColor(textColor);
3536 __pSimpleItemText->Invalidate(false);
3540 _TableViewItem::SetSimpleItemContents(const Tizen::Base::String& text, const Tizen::Graphics::Bitmap* pBitmap, bool groupType)
3542 result r = E_SUCCESS;
3543 bool textOnly = true;
3545 if (pBitmap != null)
3550 r = CreateSimpleItemContents(textOnly);
3551 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
3553 FloatRectangle bitmapRect = FloatRectangle(0.0f, 0.0f, 0.0f, 0.0f);
3554 FloatRectangle textRect = FloatRectangle(0.0f, 0.0f, 0.0f, 0.0f);
3555 float leftMargin = 0.0f;
3556 float annexMargin = 0.0f;
3557 float elementWidth = 0;
3558 float elementHeight = 0;
3559 float itemHeight = GetBoundsF().height;
3560 float itemWidth = GetBoundsF().width;
3561 float annexWidth = GetAnnexWidth(__annexStyle);
3565 if (__simpleItemTextSize == 0)
3567 GET_SHAPE_CONFIG(TABLEVIEW::GROUPITEM_DEFAULT_FONT_SIZE, _CONTROL_ORIENTATION_PORTRAIT, __simpleItemTextSize);
3569 GET_SHAPE_CONFIG(TABLEVIEW::GROUPITEM_LEFT_MARGIN, _CONTROL_ORIENTATION_PORTRAIT, leftMargin);
3573 if (__simpleItemTextSize == 0)
3575 GET_SHAPE_CONFIG(TABLEVIEW::ITEM_DEFAULT_FONT_SIZE, _CONTROL_ORIENTATION_PORTRAIT, __simpleItemTextSize);
3577 GET_SHAPE_CONFIG(TABLEVIEW::ITEM_LEFT_MARGIN, _CONTROL_ORIENTATION_PORTRAIT, leftMargin);
3582 elementWidth = itemHeight * SIMPLE_ITEM_ELEMENT_BITMAP_SIZE_RATIO;
3583 elementHeight = elementWidth;
3585 bitmapRect.x = leftMargin;
3586 bitmapRect.y = (itemHeight - elementHeight) / 2;
3587 bitmapRect.width = elementWidth;
3588 bitmapRect.height = elementHeight;
3591 if(__annexStyle == TABLE_VIEW_ANNEX_STYLE_NORMAL)
3593 textRect.x = bitmapRect.x + elementWidth + leftMargin;
3594 elementWidth = itemWidth - textRect.x - leftMargin;
3598 GET_SHAPE_CONFIG(TABLEVIEW::ITEM_ANNEX_MARGIN, _CONTROL_ORIENTATION_PORTRAIT, annexMargin);
3599 if (__annexStyle == TABLE_VIEW_ANNEX_STYLE_MARK || __annexStyle == TABLE_VIEW_ANNEX_STYLE_RADIO)
3601 bitmapRect.x = leftMargin + annexWidth + annexMargin;
3602 textRect.x = bitmapRect.x + elementWidth + leftMargin;
3603 elementWidth = itemWidth - textRect.x - leftMargin;
3607 textRect.x = bitmapRect.x + elementWidth + leftMargin;
3608 elementWidth = itemWidth - textRect.x - annexWidth - leftMargin - annexMargin;
3613 textRect.width = elementWidth < 0 ? 0 : elementWidth;;
3614 textRect.height = itemHeight;
3616 if (__pSimpleItemBitmap != null && pBitmap != null)
3618 __pSimpleItemBitmap->SetBackgroundBitmap(*pBitmap);
3619 __pSimpleItemBitmap->SetBounds(bitmapRect);
3621 _Label* pSimpleItemBitmapCore = GetLabelCore(__pSimpleItemBitmap);
3622 if (!pSimpleItemBitmapCore->HasParent())
3624 r = AttachChild(*pSimpleItemBitmapCore);
3625 SysTryReturn(NID_UI_CTRL, __pSimpleItemBitmap != null, r, r, "[%s] Propagating.", GetErrorMessage(r));
3629 if (__pSimpleItemText != null)
3631 __pSimpleItemText->SetTextConfig(__simpleItemTextSize, LABEL_TEXT_STYLE_NORMAL);
3632 __pSimpleItemText->SetText(text);
3633 __pSimpleItemText->SetBounds(textRect);
3635 _Label* pSimpleItemTextCore = GetLabelCore(__pSimpleItemText);
3636 if (!pSimpleItemTextCore->HasParent())
3638 r = AttachChild(*pSimpleItemTextCore);
3639 SysTryReturn(NID_UI_CTRL, __pSimpleItemText != null, r, r, "[%s] Propagating.", GetErrorMessage(r));
3647 _TableViewItem::CreateSimpleItemContents(bool textOnly)
3649 result r = E_SUCCESS;
3651 if (__pSimpleItemText == null)
3653 __pSimpleItemText = new (std::nothrow) Label();
3655 r = GetLastResult();
3656 SysTryReturn(NID_UI_CTRL, __pSimpleItemText != null, r, r, "[%s] Propagating.", GetErrorMessage(r));
3658 __pSimpleItemText->Construct(FloatRectangle(0.0f, 0.0f, 0.0f, 0.0f), L"");
3660 __pSimpleItemText->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
3661 __pSimpleItemText->SetTextVerticalAlignment(ALIGNMENT_MIDDLE);
3662 if (__itemType == TABLE_VIEW_ITEM_TYPE_TITLE)
3664 __pSimpleItemText->SetTextColor(__simpleItemTextColor[TABLE_VIEW_GROUPITEM_DRAWING_STATUS_NORMAL]);
3668 __pSimpleItemText->SetTextColor(__simpleItemTextColor[TABLE_VIEW_ITEM_DRAWING_STATUS_NORMAL]);
3670 __pSimpleItemText->SetBackgroundColor(Color(0, 0, 0, 0));
3671 GetLabelCore(__pSimpleItemText)->SetFocusable(true);
3677 if (__pSimpleItemBitmap == null)
3679 __pSimpleItemBitmap = new (std::nothrow) Label();
3681 r = GetLastResult();
3682 SysTryReturn(NID_UI_CTRL, __pSimpleItemBitmap != null, r, r, "[%s] Propagating.", GetErrorMessage(r));
3684 __pSimpleItemBitmap->Construct(FloatRectangle(0.0f, 0.0f, 0.0f, 0.0f), L"");
3685 __pSimpleItemBitmap->SetBackgroundColor(Color(0, 0, 0, 0));
3686 GetLabelCore(__pSimpleItemBitmap)->SetFocusable(true);
3692 if (__pSimpleItemBitmap != null)
3694 delete __pSimpleItemBitmap;
3695 __pSimpleItemBitmap = null;
3703 _TableViewItem::SetSimpleTextColor(const Tizen::Graphics::Color& color, TableViewItemDrawingStatus status)
3705 __simpleItemTextColor[status] = color;
3710 Tizen::Graphics::Color
3711 _TableViewItem::GetSimpleItemTextColor(TableViewItemDrawingStatus status) const
3713 return __simpleItemTextColor[status];
3717 _TableViewItem::SetSimpleGroupItemTextColor(const Tizen::Graphics::Color& color, TableViewItemDrawingStatus status)
3719 if (status == TABLE_VIEW_ITEM_DRAWING_STATUS_NORMAL)
3721 __simpleItemTextColor[TABLE_VIEW_GROUPITEM_DRAWING_STATUS_NORMAL] = color;
3723 else if (status == TABLE_VIEW_ITEM_DRAWING_STATUS_PRESSED)
3725 __simpleItemTextColor[TABLE_VIEW_GROUPITEM_DRAWING_STATUS_PRESSED] = color;
3731 Tizen::Graphics::Color
3732 _TableViewItem::GetSimpleGroupItemTextColor(TableViewItemDrawingStatus status) const
3734 if (status == TABLE_VIEW_ITEM_DRAWING_STATUS_PRESSED)
3736 return __simpleItemTextColor[TABLE_VIEW_GROUPITEM_DRAWING_STATUS_PRESSED];
3740 return __simpleItemTextColor[TABLE_VIEW_GROUPITEM_DRAWING_STATUS_NORMAL];
3745 _TableViewItem::SetSimpleItemTextSize(int size)
3747 if(__simpleItemTextSize == size)
3752 __simpleItemTextSize = size;
3754 if (__pSimpleItemText != null)
3756 __pSimpleItemText->SetTextConfig(__simpleItemTextSize, LABEL_TEXT_STYLE_NORMAL);
3762 _TableViewItem::GetSimpleItemTextSize(void) const
3764 return __simpleItemTextSize;
3768 _TableViewItem::SetSectionHeaderFooterContents(const Tizen::Base::String& text, HorizontalAlignment alignment, bool isHeader)
3770 if (__pHeaderFooterItemText == null)
3772 result r = E_SUCCESS;
3773 float contentsHeight = 0.0f;
3774 float positionY = 0.0f;
3777 GET_COLOR_CONFIG(TABLEVIEW::GROUPITEM_TEXT_NORMAL, textColor);
3778 GET_SHAPE_CONFIG(TABLEVIEW::GROUPITEM_DEFAULT_TEXT_HEIGHT, _CONTROL_ORIENTATION_PORTRAIT, contentsHeight);
3780 __pHeaderFooterItemText = new (std::nothrow) Label();
3782 r = GetLastResult();
3783 SysTryReturn(NID_UI_CTRL, __pHeaderFooterItemText != null, r, r, "[%s] Propagating.", GetErrorMessage(r));
3787 positionY = GetBoundsF().height - contentsHeight;
3789 __pHeaderFooterItemText->Construct(FloatRectangle(0.0f, positionY, GetBoundsF().width, contentsHeight), text);
3790 __pHeaderFooterItemText->SetTextHorizontalAlignment(alignment);
3791 __pHeaderFooterItemText->SetTextColor(textColor);
3792 __pHeaderFooterItemText->SetBackgroundColor(Color(0, 0, 0, 0));
3794 _Label* pHeaderFooterItemTextCore = GetLabelCore(__pHeaderFooterItemText);
3795 pHeaderFooterItemTextCore->SetFocusable(false);
3796 AttachChild(*pHeaderFooterItemTextCore);
3803 _TableViewItem::SetSectionHeaderFooterAlignment(HorizontalAlignment alignment)
3805 if (__pHeaderFooterItemText != null)
3807 __pHeaderFooterItemText->SetTextHorizontalAlignment(alignment);
3808 __pHeaderFooterItemText->Invalidate(false);
3815 _TableViewItem::GetAnnexWidth(TableViewAnnexStyle style)
3817 float annexWidth = 0.0f;
3818 float annexDividerWidth = 0.0f;
3822 case TABLE_VIEW_ANNEX_STYLE_NORMAL:
3826 case TABLE_VIEW_ANNEX_STYLE_MARK:
3827 GET_SHAPE_CONFIG(TABLEVIEW::ITEM_ANNEX_WIDTH, _CONTROL_ORIENTATION_PORTRAIT, annexWidth);
3830 case TABLE_VIEW_ANNEX_STYLE_ONOFF_SLIDING:
3831 GET_SHAPE_CONFIG(TABLEVIEW::ITEM_ANNEX_ONOFF_WIDTH, _CONTROL_ORIENTATION_PORTRAIT, annexWidth);
3834 case TABLE_VIEW_ANNEX_STYLE_ONOFF_SLIDING_WITH_DIVIDER:
3835 GET_SHAPE_CONFIG(TABLEVIEW::ITEM_ANNEX_MARGIN, _CONTROL_ORIENTATION_PORTRAIT, annexDividerWidth);
3836 GET_FIXED_VALUE_CONFIG(TABLEVIEW::ITEM_ANNEX_DIVIDER_WIDTH, _CONTROL_ORIENTATION_PORTRAIT, annexDividerWidth);
3837 GET_SHAPE_CONFIG(TABLEVIEW::ITEM_ANNEX_ONOFF_WIDTH, _CONTROL_ORIENTATION_PORTRAIT, annexWidth);
3838 annexWidth = annexWidth + (annexDividerWidth*2) + annexDividerWidth;
3841 case TABLE_VIEW_ANNEX_STYLE_DETAILED:
3842 GET_SHAPE_CONFIG(TABLEVIEW::ITEM_ANNEX_MORE_WIDTH, _CONTROL_ORIENTATION_PORTRAIT, annexWidth);
3845 case TABLE_VIEW_ANNEX_STYLE_RADIO:
3846 GET_SHAPE_CONFIG(TABLEVIEW::ITEM_ANNEX_WIDTH, _CONTROL_ORIENTATION_PORTRAIT, annexWidth);
3857 _TableViewItem::SetDrawingStatus(TableViewItemDrawingStatus status)
3859 __drawingStatus = status;
3862 TableViewItemDrawingStatus
3863 _TableViewItem::GetDrawingStatus(void)
3865 return __drawingStatus;
3869 _TableViewItem::SetPressedControl(TableViewItemPressedControl pressedControl)
3871 __pressedControl = pressedControl;
3873 if(__pressedControl == TABLE_VIEW_ITEM_PRESSED_ITEM)
3875 __drawingStatus = TABLE_VIEW_ITEM_DRAWING_STATUS_PRESSED;
3877 else if(__pressedControl == TABLE_VIEW_ITEM_PRESSED_ANNEX)
3879 if (__annexStyle == TABLE_VIEW_ANNEX_STYLE_DETAILED)
3881 __isSelectedDetailButton = true;
3882 __drawingStatus = TABLE_VIEW_ITEM_DRAWING_STATUS_NORMAL;
3884 else if (__annexStyle == TABLE_VIEW_ANNEX_STYLE_ONOFF_SLIDING ||
3885 __annexStyle == TABLE_VIEW_ANNEX_STYLE_ONOFF_SLIDING_WITH_DIVIDER)
3887 __drawingStatus = TABLE_VIEW_ITEM_DRAWING_STATUS_NORMAL;
3891 __drawingStatus = TABLE_VIEW_ITEM_DRAWING_STATUS_PRESSED;
3896 if(__pressedControl != TABLE_VIEW_ITEM_PRESSED_INDIVIDUAL)
3898 __drawingStatus = TABLE_VIEW_ITEM_DRAWING_STATUS_PRESSED;
3903 TableViewItemPressedControl
3904 _TableViewItem::GetPressedControl(void)
3906 return __pressedControl;
3910 _TableViewItem::AdjustChildControlMargin(void)
3912 if (__childMarginState)
3917 if (IsTitleStyleItem())
3922 __childMarginState = true;
3926 if (__pDrawingProperty->groupedLookEnabled)
3928 float groupedBarMargin = 0.0f;
3929 GET_SHAPE_CONFIG(TABLEVIEW::GROUPITEM_BAR_WIDTH, _CONTROL_ORIENTATION_PORTRAIT, groupedBarMargin);
3931 margin = margin + groupedBarMargin;
3936 _VisualElement* pVisualElement = GetVisualElement();
3938 if (pVisualElement != null)
3940 FloatPoint position;
3942 position.SetPosition(margin, 0.0f);
3943 pVisualElement->ScrollByPoint(position, false);
3949 _TableViewItem::AdjustContextItemBounds(void)
3951 _TableViewItem* pContextItem = GetContextItem();
3953 if (pContextItem == null)
3958 FloatDimension contextItemSize = pContextItem->GetSizeF();
3959 FloatDimension itemSize = GetSizeF();
3961 if (!_FloatCompare(contextItemSize.height, itemSize.height))
3963 contextItemSize.height = itemSize.height;
3965 pContextItem->SetSize(contextItemSize);
3968 pContextItem->AdjustChildControlCenterAlign();
3972 _TableViewItem::AdjustAnnexBounds(void)
3974 if (__pItemAnnex == null || __isMoveItemAnimationEnabled || __isZoomInOutItemAnimationEnabled ||__isFadeInOutItemAnimationEnabled)
3980 if (__annexStyle == TABLE_VIEW_ANNEX_STYLE_ONOFF_SLIDING || __annexStyle == TABLE_VIEW_ANNEX_STYLE_ONOFF_SLIDING_WITH_DIVIDER || __annexStyle == TABLE_VIEW_ANNEX_STYLE_DETAILED)
3982 _Label* pAnnexCore = GetLabelCore(__pItemAnnex);
3983 if (pAnnexCore->HasParent())
3985 FloatRectangle annexBounds = __pItemAnnex->GetBoundsF();
3986 float annexPositionX = annexBounds.x;
3987 float leftMargin = 0.0f;
3989 GET_SHAPE_CONFIG(TABLEVIEW::ITEM_LEFT_MARGIN, _CONTROL_ORIENTATION_PORTRAIT, leftMargin);
3990 leftMargin += __pDrawingProperty->scrollMargin;
3992 annexPositionX = GetBoundsF().width - annexBounds.width - leftMargin;
3994 if (!_FloatCompare(annexPositionX, annexBounds.x))
3996 __pItemAnnex->SetPosition(FloatPoint(annexPositionX, annexBounds.y));
4002 FloatRectangle itemBounds = GetBoundsF();
4003 FloatRectangle annexBounds = __pItemAnnex->GetBoundsF();
4005 if (__customHeight > 0)
4007 itemBounds.height = __customHeight;
4010 annexBounds.y = (itemBounds.height - annexBounds.height) / 2;
4011 __pItemAnnex->SetPosition(FloatPoint(annexBounds.x, annexBounds.y));
4015 _TableViewItem::SetItemCustomHeight(float height)
4017 __customHeight = height;
4021 _TableViewItem::GetItemCustomHeight(void)
4023 return __customHeight;
4027 _TableViewItem::AdjustChildControlCenterAlign(void)
4029 if (__childControlCenterAlign)
4031 FloatDimension itemSize = GetSizeF();
4033 int childControlCount = GetChildCount();
4035 for (int i = 0; i < childControlCount; i++)
4037 _Control* pChildControl = GetChild(i);
4039 if (pChildControl == null)
4044 if (__pItemDivider == pChildControl)
4046 float positionX = pChildControl->GetPositionF().x;
4047 pChildControl->SetPosition(FloatPoint(positionX, itemSize.height - 1));
4051 if (__pItemTopDivider == pChildControl)
4053 float positionX = pChildControl->GetPositionF().x;
4054 pChildControl->SetPosition(FloatPoint(positionX, 0));
4058 FloatRectangle itemBounds = pChildControl->GetBoundsF();
4060 itemBounds.y = (itemSize.height - itemBounds.height) / 2;
4062 pChildControl->SetPosition(FloatPoint(itemBounds.x, itemBounds.y));
4068 _TableViewItem::SetChildControlCenterAlign(bool centerAlign)
4070 __childControlCenterAlign = centerAlign;
4074 _TableViewItem::GetLastTouchPressedPosition(void)
4076 return _CoordinateSystemUtils::ConvertToInteger(__touchStartPosition);
4080 _TableViewItem::GetLastTouchPressedPositionF(void)
4082 return __touchStartPosition;
4086 _TableViewItem::SetLastTouchPressedPosition(FloatPoint position)
4088 // This function was made to modify of ListView::RefreshList().
4089 // This function could adversely affect touch event handling. So, you should be used with caution.
4090 __touchStartPosition = position;
4094 _TableViewItem::SetLastTouchPressedPosition(Point position)
4096 // This function was made to modify of ListView::RefreshList().
4097 // This function could adversely affect touch event handling. So, you should be used with caution.
4098 __touchStartPosition = _CoordinateSystemUtils::ConvertToFloat(position);
4102 _TableViewItem::GetSelectionState(void)
4104 return __itemSelected;
4108 _TableViewItem::SetSelectionState(bool selected)
4110 // This function was made to modify of ListView::RefreshList().
4111 // This function could adversely affect touch event handling. So, you should be used with caution.
4112 __itemSelected = selected;
4116 _TableViewItem::MoveItem(FloatPoint position, int duration, int delay)
4118 _VisualElement* pVisualElement = GetVisualElement();
4119 VisualElementValueAnimation* pAnimation = null;
4120 String animationName = L"MOVE_ITEM";
4121 FloatPoint itemPosition = GetPositionF();
4122 result r = E_SUCCESS;
4124 if (position == itemPosition)
4129 if (__pMoveItemAnimation == null)
4131 __pMoveItemAnimation = new (std::nothrow) VisualElementValueAnimation;
4132 SysTryCatch(NID_UI_CTRL, __pMoveItemAnimation != null, , E_OUT_OF_MEMORY, ("[E_OUT_OF_MEMORY] The memory is insufficient."));
4134 __pMoveItemAnimation->SetVisualElementAnimationTickEventListener(this);
4135 r = GetLastResult();
4136 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
4138 __pMoveItemAnimation->SetVisualElementAnimationStatusEventListener(this);
4139 r = GetLastResult();
4140 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
4143 pAnimation = __pMoveItemAnimation;
4145 pAnimation->SetTimingFunction(VisualElementAnimation::GetTimingFunctionByName("EaseInOut"));
4146 pAnimation->SetDuration(duration);
4147 pAnimation->SetDelay(delay);
4148 pAnimation->SetStartValue(Variant(GetPositionF()));
4149 pAnimation->SetEndValue(Variant(position));
4151 if (pVisualElement->AddAnimation(animationName, *pAnimation) != E_SUCCESS)
4162 delete __pMoveItemAnimation;
4163 __pMoveItemAnimation = null;
4169 _TableViewItem::ZoomInOutItem(bool zoomOut, int duration, int delay)
4171 _VisualElement* pVisualElement = GetVisualElement();
4172 VisualElementValueAnimation* pAnimation = null;
4173 String animationName = L"ZOOM_IN_OUT_ITEM";
4174 FloatDimension itemSize = GetSizeF();
4175 FloatDimension startValue;
4176 FloatDimension endValue;
4177 result r = E_SUCCESS;
4179 if (__pZoomInOutItemAnimation == null)
4181 __pZoomInOutItemAnimation = new (std::nothrow) VisualElementValueAnimation;
4182 SysTryCatch(NID_UI_CTRL, __pZoomInOutItemAnimation != null, , E_OUT_OF_MEMORY, ("[E_OUT_OF_MEMORY] The memory is insufficient."));
4184 __pZoomInOutItemAnimation->SetVisualElementAnimationTickEventListener(this);
4185 r = GetLastResult();
4186 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
4188 __pZoomInOutItemAnimation->SetVisualElementAnimationStatusEventListener(this);
4189 r = GetLastResult();
4190 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
4193 pAnimation = __pZoomInOutItemAnimation;
4197 startValue = itemSize;
4198 endValue = FloatDimension(itemSize.width, itemSize.height / 2);
4199 pAnimation->SetTimingFunction(VisualElementAnimation::GetTimingFunctionByName(L"EaseOut"));
4203 startValue = FloatDimension(itemSize.width, itemSize.height / 2);
4204 endValue = itemSize;
4205 pAnimation->SetTimingFunction(VisualElementAnimation::GetTimingFunctionByName(L"EaseIn"));
4208 pAnimation->SetDuration(duration);
4209 pAnimation->SetDelay(delay);
4210 pAnimation->SetStartValue(Variant(startValue));
4211 pAnimation->SetEndValue(Variant(endValue));
4213 if (pVisualElement->AddAnimation(animationName, *pAnimation) != E_SUCCESS)
4223 delete __pZoomInOutItemAnimation;
4224 __pZoomInOutItemAnimation = null;
4230 _TableViewItem::FadeInOutItem(bool fadeOut, int duration, int delay)
4232 _VisualElement* pVisualElement = GetVisualElement();
4233 VisualElementValueAnimation* pAnimation = null;
4234 String animationName = L"FADE_IN_OUT_ITEM";
4235 float startValue = 0.0f;
4236 float endValue = 1.0f;
4237 result r = E_SUCCESS;
4239 if (__pFadeInOutItemtAnimation == null)
4241 __pFadeInOutItemtAnimation = new (std::nothrow) VisualElementValueAnimation;
4242 SysTryCatch(NID_UI_CTRL, __pFadeInOutItemtAnimation != null, , E_OUT_OF_MEMORY, ("[E_OUT_OF_MEMORY] The memory is insufficient."));
4244 __pFadeInOutItemtAnimation->SetVisualElementAnimationTickEventListener(this);
4245 r = GetLastResult();
4246 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
4248 __pFadeInOutItemtAnimation->SetVisualElementAnimationStatusEventListener(this);
4249 r = GetLastResult();
4250 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
4253 pAnimation = __pFadeInOutItemtAnimation;
4259 pAnimation->SetTimingFunction(VisualElementAnimation::GetTimingFunctionByName(L"EaseOut"));
4263 pAnimation->SetTimingFunction(VisualElementAnimation::GetTimingFunctionByName(L"EaseIn"));
4266 pAnimation->SetTimingFunction(VisualElementAnimation::GetTimingFunctionByName("EaseIn"));
4267 pAnimation->SetDuration(duration);
4268 pAnimation->SetDelay(delay);
4269 pAnimation->SetStartValue(Variant(startValue));
4270 pAnimation->SetEndValue(Variant(endValue));
4272 if (pVisualElement->AddAnimation(animationName, *pAnimation) != E_SUCCESS)
4277 pVisualElement->SetOpacity(startValue);
4285 delete __pFadeInOutItemtAnimation;
4286 __pFadeInOutItemtAnimation = null;
4292 _TableViewItem::SetIndividualSelectionEnabled(const _Control& control, bool enable)
4294 result r = E_SUCCESS;
4297 if (!__individualSelectionControls.Contains(control))
4299 r = __individualSelectionControls.Add(control);
4302 _AccessibilityContainer* pContainer = const_cast<_Control*>(&control)->GetAccessibilityContainer();
4303 pContainer->Activate(true);
4304 int controlCount = 0;
4305 for(int i=0; i<GetChildCount(); i++)
4307 _Control* pChildControl = GetChild(i);
4308 if(pChildControl == static_cast<_Control*>(__pItemAnnexLeftDivider)
4309 || pChildControl == static_cast<_Control*>(__pItemAnnexRightDivider)
4310 || pChildControl == static_cast<_Control*>(__pItemCover)
4311 || pChildControl == static_cast<_Control*>(__pItemDivider)
4312 || pChildControl== static_cast<_Control*>(__pItemTopDivider))
4320 if(controlCount == 0 || __individualSelectionControls.GetCount() == controlCount)
4322 GetAccessibilityContainer()->Activate(false);
4326 GetAccessibilityContainer()->Activate(true);
4331 if (__individualSelectionControls.Contains(control))
4333 r = __individualSelectionControls.Remove(control, false);
4340 _TableViewItem::IsIndividualSelectionEnabled(const _Control& control)
4342 return __individualSelectionControls.Contains(control);
4346 _TableViewItem::AddRef(void)
4348 return ++__refCount;
4352 _TableViewItem::Release(void)
4355 if (__refCount <= 0)
4365 _TableViewItem::IsAnimationPlaying(void)
4367 if (__animationCount > 0)
4376 _TableViewItem::StopAllAnimation(void)
4378 _VisualElement* pVisualElement = GetVisualElement();
4380 pVisualElement->RemoveAllAnimations();
4384 _TableViewItem::SetItemDividerEnabled(bool enable)
4386 __itemDividerEnabled = enable;
4390 _TableViewItem::OnTickOccurred(const Tizen::Ui::Animations::VisualElementAnimation& animation, const Tizen::Base::String& keyName, Tizen::Ui::Animations::VisualElement& target, const Tizen::Ui::Variant& currentValue)
4392 if (keyName == L"MOVE_ITEM")
4394 FloatPoint position = currentValue.ToFloatPoint();
4395 SetPosition(position);
4397 else if (keyName == L"FADE_IN_OUT_ITEM")
4399 float opacity = currentValue.ToFloat();
4401 _VisualElement* pVisualElement = GetVisualElement();
4403 if (pVisualElement != null)
4405 pVisualElement->SetOpacity(opacity);
4408 else if (keyName == L"ZOOM_IN_OUT_ITEM")
4410 FloatDimension size = currentValue.ToFloatDimension();
4416 _TableViewItem::OnVisualElementAnimationStarted(const Tizen::Ui::Animations::VisualElementAnimation& animation, const Tizen::Base::String& keyName, Tizen::Ui::Animations::VisualElement& target)
4418 if (keyName == L"MOVE_ITEM")
4420 __isMoveItemAnimationEnabled = true;
4422 else if (keyName == L"FADE_IN_OUT_ITEM")
4424 __isFadeInOutItemAnimationEnabled = true;
4426 else if (keyName == L"ZOOM_IN_OUT_ITEM")
4428 __isZoomInOutItemAnimationEnabled = true;
4433 _TableViewItem::OnVisualElementAnimationRepeated(const Tizen::Ui::Animations::VisualElementAnimation& animation, const Tizen::Base::String& keyName, Tizen::Ui::Animations::VisualElement& target, long currentRepeatCount)
4438 _TableViewItem::OnVisualElementAnimationFinished(const Tizen::Ui::Animations::VisualElementAnimation& animation, const Tizen::Base::String& keyName, Tizen::Ui::Animations::VisualElement& target, bool completedNormally)
4440 if (__isAnimationCallbackBlocked)
4445 bool tableViewItemAnimation = true;
4446 const VisualElementValueAnimation *pAnimation = dynamic_cast<const VisualElementValueAnimation*>(&(animation));
4448 if (keyName == L"MOVE_ITEM")
4450 if (pAnimation != null)
4452 FloatPoint position = pAnimation->GetEndValue().ToFloatPoint();
4454 SetPosition(position);
4456 __isMoveItemAnimationEnabled = false;
4458 else if (keyName == L"FADE_IN_OUT_ITEM")
4460 if (pAnimation != null)
4462 float opacity = pAnimation->GetEndValue().ToFloat();
4464 _VisualElement* pVisualElement = GetVisualElement();
4466 if (pVisualElement != null)
4468 pVisualElement->SetOpacity(opacity);
4472 __isFadeInOutItemAnimationEnabled = false;
4474 else if (keyName == L"ZOOM_IN_OUT_ITEM")
4476 if (pAnimation != null)
4478 FloatDimension size = pAnimation->GetEndValue().ToFloatDimension();
4482 __isZoomInOutItemAnimationEnabled = false;
4486 tableViewItemAnimation = false;
4489 if (tableViewItemAnimation)
4498 _TableViewItem::OnAttachedToMainTree(void)
4500 if (!_FloatCompare(GetBoundsF().height, 0.0f))
4502 SetAccessibilityElement();
4509 _TableViewItem::SetAccessibilityElement(void)
4511 _AccessibilityContainer* pContainer = GetAccessibilityContainer();
4513 if(pContainer != null)
4515 if(__pAccessibilityElement == null)
4517 __pAccessibilityElement = new (std::nothrow) _AccessibilityElement(true);
4518 SysTryReturnVoidResult(NID_UI_CTRL, __pAccessibilityElement, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory shortage.");
4520 __pAccessibilityElement->SetTrait(ACCESSIBILITY_TRAITS_NONE);
4521 __pAccessibilityElement->SetName(L"TableViewItem");
4523 pContainer->AddElement(*__pAccessibilityElement);
4525 __pAccessibilityElement->SetBounds(FloatRectangle(0.0f,0.0f, GetBoundsF().width, GetBoundsF().height));
4529 _AccessibilityElement*
4530 _TableViewItem::GetAccessibilityElement(void)
4532 return __pAccessibilityElement;
4535 _TableViewItem::SetAccessibilityElementTrait(void)
4537 if(__pAccessibilityElement == null)
4541 int groupIndex = -1;
4544 switch (__annexStyle)
4546 case TABLE_VIEW_ANNEX_STYLE_NORMAL:
4547 GetItemIndex(groupIndex, itemIndex);
4548 if(groupIndex != -1 && itemIndex == -1)
4550 __pAccessibilityElement->SetTraitWithStringId("IDS_TPLATFORM_BODY_GROUP_INDEX");
4554 case TABLE_VIEW_ANNEX_STYLE_MARK:
4555 __pAccessibilityElement->SetTraitWithStringId("IDS_TPLATFORM_BODY_TICKBOX_T_TTS");
4558 case TABLE_VIEW_ANNEX_STYLE_ONOFF_SLIDING:
4559 case TABLE_VIEW_ANNEX_STYLE_ONOFF_SLIDING_WITH_DIVIDER:
4560 __pAccessibilityElement->SetTraitWithStringId("IDS_TPLATFORM_BODY_ON_OFF_BUTTON_T_TTS");
4563 case TABLE_VIEW_ANNEX_STYLE_DETAILED:
4564 __pAccessibilityElement->SetTraitWithStringId("IDS_TPLATFORM_BODY_BUTTON_T_TTS");
4567 case TABLE_VIEW_ANNEX_STYLE_RADIO:
4568 __pAccessibilityElement->SetTraitWithStringId("IDS_TPLATFORM_BODY_RADIO_BUTTON_T_TTS");
4576 _TableViewItem::SetAccessibilityElementValue(void)
4578 if(__pAccessibilityElement == null)
4583 switch (__annexStyle)
4585 case TABLE_VIEW_ANNEX_STYLE_MARK:
4588 __pAccessibilityElement->SetValueWithStringId("IDS_TPLATFORM_BODY_TICK_T_TTS");
4592 __pAccessibilityElement->SetValueWithStringId("IDS_TPLATFORM_BODY_UNTICK_T_TTS");
4596 case TABLE_VIEW_ANNEX_STYLE_ONOFF_SLIDING:
4597 case TABLE_VIEW_ANNEX_STYLE_ONOFF_SLIDING_WITH_DIVIDER:
4600 __pAccessibilityElement->SetValueWithStringId("IDS_TPLATFORM_BODY_ON");
4604 __pAccessibilityElement->SetValueWithStringId("IDS_TPLATFORM_BODY_OFF");
4608 case TABLE_VIEW_ANNEX_STYLE_RADIO:
4611 __pAccessibilityElement->SetValueWithStringId("IDS_TPLATFORM_BODY_SELECTED_T_TTS");
4615 __pAccessibilityElement->SetValue(L"Unselected");
4624 _TableViewItem::SetAccessibilityElementLabel(void)
4626 if(__pAccessibilityElement == null)
4630 if(__pAccessibilityElement->GetLabel().GetLength() > 0)
4634 String accessibilityLabel;
4635 String space = L" ";
4636 int childControlCount = GetChildCount();
4637 int groupIndex = -1;
4640 for (int i = 0; i < childControlCount; i++)
4642 _Control* pChildControl = GetChild(i);
4644 if (pChildControl == null)
4649 if (__pItemDivider == pChildControl || __pItemTopDivider == pChildControl || __pItemCover == pChildControl)
4654 if (!IsIndividualSelectionEnabled(*pChildControl))
4656 _AccessibilityContainer* pContainer = pChildControl->GetAccessibilityContainer();
4657 LinkedListT<_AccessibilityElement*> accessibilityElements;
4658 _AccessibilityElement* pElement = null;
4660 pContainer->GetElements(accessibilityElements);
4661 pContainer->Activate(false);
4662 int elementCount = accessibilityElements.GetCount();
4664 for (int i = 0; i < elementCount; i++)
4666 if (accessibilityElements.GetAt(i, pElement) == E_SUCCESS)
4668 accessibilityLabel += pElement->GetLabel();
4669 accessibilityLabel += space;
4675 __pAccessibilityElement->SetLabel(accessibilityLabel);
4680 _TableViewItem::OnAccessibilityFocusMovedNext(const _AccessibilityContainer& control, const _AccessibilityElement& element)
4686 _TableViewItem::OnAccessibilityFocusMovedPrevious(const _AccessibilityContainer& control, const _AccessibilityElement& element)
4692 _TableViewItem::OnAccessibilityReadElement(const _AccessibilityContainer& control, const _AccessibilityElement& element)
4698 _TableViewItem::OnAccessibilityReadingElement(const _AccessibilityContainer& control, const _AccessibilityElement& element)
4700 SetAccessibilityElementLabel();
4701 SetAccessibilityElementTrait();
4702 SetAccessibilityElementValue();
4707 _TableViewItem::OnAccessibilityFocusIn(const _AccessibilityContainer& control, const _AccessibilityElement& element)
4713 _TableViewItem::OnAccessibilityFocusOut(const _AccessibilityContainer& control, const _AccessibilityElement& element)
4719 _TableViewItem::OnAccessibilityActionPerformed(const _AccessibilityContainer& control, const _AccessibilityElement& element)
4721 switch (__annexStyle)
4723 case TABLE_VIEW_ANNEX_STYLE_NORMAL:
4726 case TABLE_VIEW_ANNEX_STYLE_MARK:
4729 _AccessibilityManager::GetInstance()->ReadContent(L"ticked");
4733 _AccessibilityManager::GetInstance()->ReadContent(L"unticked");
4737 case TABLE_VIEW_ANNEX_STYLE_ONOFF_SLIDING:
4738 case TABLE_VIEW_ANNEX_STYLE_ONOFF_SLIDING_WITH_DIVIDER:
4741 _AccessibilityManager::GetInstance()->ReadContent(L"On");
4745 _AccessibilityManager::GetInstance()->ReadContent(L"Off");
4749 case TABLE_VIEW_ANNEX_STYLE_DETAILED:
4752 case TABLE_VIEW_ANNEX_STYLE_RADIO:
4755 _AccessibilityManager::GetInstance()->ReadContent(L"selected");
4759 _AccessibilityManager::GetInstance()->ReadContent(L"unselected");
4771 _TableViewItem::OnAccessibilityValueIncreased(const _AccessibilityContainer& control, const _AccessibilityElement& element)
4777 _TableViewItem::OnAccessibilityValueDecreased(const _AccessibilityContainer& control, const _AccessibilityElement& element)
4783 _TableViewItem::OnKeyPressed(const _Control& source, const _KeyInfo& keyInfo)
4785 if (!IsFocusModeStateEnabled())
4790 _KeyCode keyCode = keyInfo.GetKeyCode();
4791 IListT<_Control*>* pFocusList = GetFocusListN();
4792 SysTryReturn(NID_UI_CTRL, pFocusList != null, true, GetLastResult(), "[%s] propagating.", GetErrorMessage(GetLastResult()));
4794 _Control* pChildControl = null;
4795 _Control* pFocusedControl = null;
4796 _Window* pTop = source.GetRootWindow();
4800 pFocusedControl = pTop->GetCurrentFocusControl();
4803 int count = pFocusList->GetCount();
4805 if (pFocusedControl == null)
4815 if (pChildControl == null)
4817 for (int i=count-1; i>=0; i--)
4819 pFocusList->GetAt(i, pChildControl);
4820 if (pChildControl == null)
4825 if (pChildControl->IsFocusable())
4831 pChildControl = null;
4838 for(int i=count-1; i>=0; i--)
4840 pFocusList->GetAt(i, pChildControl);
4841 if (pChildControl == null)
4846 if (pChildControl->IsFocused())
4850 pChildControl = null;
4854 for(int j=i-1; j>=0; j--)
4856 pFocusList->GetAt(j, pChildControl);
4857 if (pChildControl == null)
4862 if (pChildControl->IsFocusable())
4868 pChildControl = null;
4878 pChildControl->SetFocused(true);
4879 pChildControl->DrawFocus();
4883 _Control* pParentControl = pFocusedControl->GetParent();
4884 _TableViewItem* pItem = dynamic_cast<_TableViewItem*>(pParentControl);
4886 if (pItem != null && pItem->GetEnableState() && !pItem->IsFocused())
4888 pItem->SetFocused(true);
4897 if (pChildControl == null)
4899 for (int i=0; i<count; i++)
4901 pFocusList->GetAt(i, pChildControl);
4902 if (pChildControl == null)
4907 if (pChildControl->IsFocusable())
4913 pChildControl = null;
4920 for(int i=0; i<count; i++)
4922 pFocusList->GetAt(i, pChildControl);
4923 if (pChildControl == null)
4928 if (pChildControl->IsFocused())
4932 pChildControl = null;
4936 for (int j=i+1; j<count; j++)
4938 pFocusList->GetAt(j, pChildControl);
4939 if (pChildControl == null)
4944 if (pChildControl->IsFocusable())
4950 pChildControl = null;
4960 pChildControl->SetFocused(true);
4961 pChildControl->DrawFocus();
4965 _Control* pParentControl = pFocusedControl->GetParent();
4966 _TableViewItem* pItem = dynamic_cast<_TableViewItem*>(pParentControl);
4968 if (pItem != null && pItem->GetEnableState() && !pItem->IsFocused())
4970 pItem->SetFocused(true);
4977 if (&source == this)
4979 __pressedControl = TABLE_VIEW_ITEM_PRESSED_ITEM;
4981 else if (&source == GetLabelCore(__pItemAnnex))
4983 __pressedControl = TABLE_VIEW_ITEM_PRESSED_ANNEX;
4985 else if (IsIndividualSelectionEnabled(source))
4987 __pressedControl = TABLE_VIEW_ITEM_PRESSED_INDIVIDUAL;
4991 __pressedControl = TABLE_VIEW_ITEM_PRESSED_NONE;
4993 __itemSelected = true;
4994 FireItemTouchPressed();
5000 __annexOnOffHandlerMoved = false;
5001 __itemTouchMoved = false;
5003 __itemSelected = false;
5004 __drawingStatus = TABLE_VIEW_ITEM_DRAWING_STATUS_NORMAL;
5006 if (__annexStyle == TABLE_VIEW_ANNEX_STYLE_DETAILED)
5008 __isSelectedDetailButton = false;
5011 SetItemChanged(true);
5021 _TableViewItem::OnKeyReleased(const _Control& source, const _KeyInfo& keyInfo)
5023 if (!IsFocusModeStateEnabled())
5028 _KeyCode keyCode = keyInfo.GetKeyCode();
5030 if(keyCode == _KEY_ENTER)
5032 _TableView* pParent = dynamic_cast<_TableView*>(GetParent());
5033 SysTryReturn(NID_UI_CTRL, pParent != null, true, GetLastResult(), "[%s] propagating.", GetErrorMessage(GetLastResult()));
5035 pParent->StopExpandCollapseAnimation();
5036 if (&source == this)
5038 __releasedControl = TABLE_VIEW_ITEM_PRESSED_ITEM;
5040 else if (&source == GetLabelCore(__pItemAnnex))
5042 __releasedControl = TABLE_VIEW_ITEM_PRESSED_ANNEX;
5044 else if (IsIndividualSelectionEnabled(source))
5046 __releasedControl = TABLE_VIEW_ITEM_PRESSED_INDIVIDUAL;
5050 __releasedControl = TABLE_VIEW_ITEM_PRESSED_NONE;
5052 FireItemTouchReleased();
5055 else if (keyCode == _KEY_LEFT || keyCode == _KEY_RIGHT)
5064 _TableViewItem::GetPreviousFocusChildControl(const _Control& source)
5066 _Control* pParentControl = null;
5067 float sourcePosition = 0.0f;
5069 _Control* pSource = const_cast<_Control*>(&source);
5070 _TableViewItem* pItem = dynamic_cast<_TableViewItem*>(pSource);
5073 pParentControl = pSource;
5074 sourcePosition = pParentControl->GetBoundsF().width;
5078 pParentControl = source.GetParent();
5079 sourcePosition = source.GetBoundsF().x;
5082 if (pParentControl == null)
5087 int childControlCount = pParentControl->GetChildCount();
5088 float position = 0.0f;
5089 _Control* destination = null;
5091 for(int i=0; i<childControlCount; i++)
5093 _Control* pChildControl = pParentControl->GetChild(i);
5094 if (pChildControl != null && pChildControl->IsFocusable())
5096 float childPosition = pChildControl->GetBoundsF().x;
5097 if (childPosition < sourcePosition)
5099 if (childPosition > position)
5101 position = childPosition;
5102 destination = pChildControl;
5104 else if (_FloatCompare(position, 0.0f))
5106 position = childPosition;
5107 destination = pChildControl;
5116 _TableViewItem::GetNextFocusChildControl(const _Control& source)
5118 _Control* pParentControl = null;
5119 float sourcePosition = 0.0f;
5121 _Control* pSource = const_cast<_Control*>(&source);
5122 _TableViewItem* pItem = dynamic_cast<_TableViewItem*>(pSource);
5125 pParentControl = pSource;
5126 sourcePosition = 0.0f;
5130 pParentControl = source.GetParent();
5131 sourcePosition = source.GetBoundsF().x;
5134 if (pParentControl == null)
5139 int childControlCount = pParentControl->GetChildCount();
5140 float position = 0.0f;
5141 _Control* destination = null;
5143 for(int i=0; i<childControlCount; i++)
5145 _Control* pChildControl = pParentControl->GetChild(i);
5146 if (pChildControl != null && pChildControl->IsFocusable())
5148 float childPosition = pChildControl->GetBoundsF().x;
5149 if (childPosition > sourcePosition)
5151 if (childPosition < position)
5153 position = childPosition;
5154 destination = pChildControl;
5156 else if (_FloatCompare(position, 0.0f))
5158 position = childPosition;
5159 destination = pChildControl;
5168 _TableViewItem::IsChildControlFocusManage(void) const
5174 _TableViewItem::SetSimpleLastItemEnabled(bool enable)
5176 __isSimpleLastItem = enable;
5180 _TableViewItem::SetTouchPressOnScroll(bool isTouch)
5182 __isTouchPressOnScroll = isTouch;
5186 _TableViewItem::IsTouchPressOnScroll(void) const
5188 return __isTouchPressOnScroll;
5191 }}} // Tizen::Ui::Controls