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"
37 using namespace Tizen::Base;
38 using namespace Tizen::Base::Runtime;
39 using namespace Tizen::Base::Collection;
40 using namespace Tizen::Ui::Animations;
41 using namespace Tizen::Graphics;
43 namespace Tizen { namespace Ui { namespace Controls
46 _TableViewItemControl::_TableViewItemControl(void)
47 :__pBackgroundBitmap(null)
51 _TableViewItemControl::~_TableViewItemControl(void)
53 if(__pBackgroundBitmap)
55 delete __pBackgroundBitmap;
56 __pBackgroundBitmap = null;
62 _TableViewItemControl::OnDraw(void)
64 Bitmap* pBitmap = GetBackgroundBitmap();
66 FloatRectangle bounds(0.0f, 0.0f, GetBoundsF().width, GetBoundsF().height); // +++ check floating
68 Color bgColor = GetBackgroundColor();
70 Canvas* pCanvas = null;
74 pCanvas = GetCanvasN();
77 SysLog(NID_UI_CTRL, "Cannot get a canvas.");
82 pCanvas->SetBackgroundColor(Color(0, 0, 0, 0));
85 if (_BitmapImpl::CheckNinePatchedBitmapStrictly(*pBitmap))
87 pCanvas->DrawNinePatchedBitmap(bounds, *pBitmap);
91 FloatRectangle drawingRect(0.0f, 0.0f, bounds.width, bounds.height);
92 pCanvas->DrawBitmap(drawingRect, *pBitmap);
98 if (IsCalledGetCanvasN() == false)
100 GetVisualElement()->SetBackgroundColor(_Colorf((float)bgColor.GetRed() / 255, (float)bgColor.GetGreen() / 255, (float)bgColor.GetBlue() / 255, (float)bgColor.GetAlpha() / 255));
104 pCanvas = GetCanvasN();
107 SysLog(NID_UI_CTRL, "Cannot get a canvas.");
112 pCanvas->SetBackgroundColor(Color(0, 0, 0, 0));
114 pCanvas->FillRectangle(GetBackgroundColor(), bounds); // +++ check floating
127 _TableViewItemControl::HitTest(const Graphics :: FloatPoint & point)
129 return HIT_TEST_NOWHERE;
132 _TableViewItemControl*
133 _TableViewItemControl::CreateTableViewItemControlN(void)
135 _TableViewItemControl* pItemControl = new (std::nothrow) _TableViewItemControl();
136 SysTryReturn(NID_UI_CTRL, pItemControl, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory is insufficient.");
137 SysTryCatch(NID_UI_CTRL, GetLastResult() == E_SUCCESS, , E_SYSTEM, "[E_SYSTEM] A system error occurred.");
139 pItemControl->AcquireHandle();
149 _TableViewItemControl::SetBackgroundBitmap(const Bitmap& bitmap)
153 Bitmap* pClonedBitmap = _BitmapImpl::CloneN(bitmap);
157 if (__pBackgroundBitmap != null)
159 delete __pBackgroundBitmap;
162 __pBackgroundBitmap = pClonedBitmap;
171 _TableViewItemControl::GetBackgroundBitmap(void) const
173 return __pBackgroundBitmap;
176 _TableViewItem::_TableViewItem(float itemHeight)
180 , __itemHeight(itemHeight)
181 , __itemGroupIndex(-1)
183 , __checkedState(false)
184 , __enabledState(true)
185 , __itemChanged(true)
186 , __reorderMode(false)
187 , __itemSelected(false)
188 , __itemTouchMoved(false)
189 , __childMarginState(false)
190 , __annexStyle(TABLE_VIEW_ANNEX_STYLE_NORMAL)
191 , __drawingStatus(TABLE_VIEW_ITEM_DRAWING_STATUS_NORMAL)
192 , __selectionStyle(TABLE_VIEW_ITEM_SELECTION_STYLE_WHOLE)
193 , __itemType(TABLE_VIEW_ITEM_TYPE_NONE)
194 , __pContextItem(null)
195 , __isContextItem(false)
196 , __isContextItemActivated(false)
197 , __checkItemHeightNeeded(false)
198 , __pItemDivider(null)
199 , __pItemTopDivider(null)
202 , __pItemAnnexLeftDivider(null)
203 , __pItemAnnexRightDivider(null)
205 , __pDrawingProperty(null)
206 , __itemDividerEnabled(true)
207 , __pSimpleItemText(null)
208 , __pSimpleItemBitmap(null)
209 , __simpleItemTextSize(0)
210 , __pHeaderFooterItemText(null)
212 , __touchStartPosition(0.0f, 0.0f)
213 , __annexOnOffTouchPosition(0)
214 , __annexOnOffHandlerMoved(false)
215 , __annexOnOffHandlerLastPosition(0.0f)
216 , __childControlCenterAlign(false)
217 , __customHeight(0.0f)
218 , __animationCount(0)
219 , __pAccessibilityElement(null)
220 , __pPressedTimer(null)
221 , __pReleasedTimer(null)
222 , __isPressedTimerEnabled(false)
223 , __isReleasedTimerEnabled(false)
224 , __pressedControl(TABLE_VIEW_ITEM_PRESSED_NONE)
225 , __releasedControl(TABLE_VIEW_ITEM_PRESSED_NONE)
226 , __pCheckedTimer(null)
227 , __isCheckedTimerEnabled(false)
228 , __isCheckedAnimationEnabled(false)
230 , __checkedBounds(FloatRectangle(0.0f, 0.0f, 0.0f, 0.0f))
231 , __isItemLayoutEnabled(false)
232 , __isMoveItemAnimationEnabled(false)
233 , __isZoomInOutItemAnimationEnabled(false)
234 , __isFadeInOutItemAnimationEnabled(false)
235 , __isAnimationCallbackBlocked(false)
236 , __isItemTapSoundEnabled(true)
237 , __isTabSoundPlayed(false)
238 , __isSelectedDetailButton(false)
239 , __pHighlightVisualElement(null)
240 , __pBitmapVisualElement(null)
241 , __pMoveItemAnimation(null)
242 , __pZoomInOutItemAnimation(null)
243 , __pFadeInOutItemtAnimation(null)
245 for (int i = 0; i < 3; i++)
247 __pItemBgBitmap[i] = null;
250 GET_COLOR_CONFIG(TABLEVIEW::ITEM_BG_NORMAL, __colorItemBg[TABLE_VIEW_ITEM_DRAWING_STATUS_NORMAL]); // for support opacity 0x00
251 GET_COLOR_CONFIG(TABLEVIEW::ITEM_BG_PRESSED, __colorItemBg[TABLE_VIEW_ITEM_DRAWING_STATUS_PRESSED]);
252 GET_COLOR_CONFIG(TABLEVIEW::ITEM_BG_HIGHLIGHTED, __colorItemBg[TABLE_VIEW_ITEM_DRAWING_STATUS_HIGHLIGHTED]);
254 GET_COLOR_CONFIG(TABLEVIEW::ITEM_TEXT_NORMAL, __simpleItemTextColor[TABLE_VIEW_ITEM_DRAWING_STATUS_NORMAL]);
255 GET_COLOR_CONFIG(TABLEVIEW::ITEM_TEXT_PRESSED, __simpleItemTextColor[TABLE_VIEW_ITEM_DRAWING_STATUS_PRESSED]);
256 GET_COLOR_CONFIG(TABLEVIEW::ITEM_TEXT_HIGHLIGHTED, __simpleItemTextColor[TABLE_VIEW_ITEM_DRAWING_STATUS_HIGHLIGHTED]);
257 GET_COLOR_CONFIG(TABLEVIEW::GROUPITEM_TEXT_NORMAL, __simpleItemTextColor[TABLE_VIEW_GROUPITEM_DRAWING_STATUS_NORMAL]);
258 GET_COLOR_CONFIG(TABLEVIEW::GROUPITEM_TEXT_PRESSED, __simpleItemTextColor[TABLE_VIEW_GROUPITEM_DRAWING_STATUS_PRESSED]);
259 GET_COLOR_CONFIG(TABLEVIEW::ITEM_TEXT_DISABLED, __simpleItemTextColor[TABLE_VIEW_SIMPLEITEM_DRAWING_STATUS_DISABLED]);
262 _AccessibilityContainer* pContainer = GetAccessibilityContainer();
265 pContainer->Activate(true);
266 pContainer->AddListener(*this);
270 _TableViewItem::~_TableViewItem()
272 __isAnimationCallbackBlocked = true;
274 StopTouchPressedTimer();
275 delete __pPressedTimer;
276 __pPressedTimer = null;
278 StopTouchReleasedTimer();
279 delete __pReleasedTimer;
280 __pReleasedTimer = null;
282 _VisualElement* pVisualElement = GetVisualElement();
283 if (pVisualElement != null)
285 if(__pMoveItemAnimation != null)
287 __pMoveItemAnimation->SetVisualElementAnimationTickEventListener(null);
288 __pMoveItemAnimation->SetVisualElementAnimationStatusEventListener(null);
291 if(__pZoomInOutItemAnimation != null)
293 __pZoomInOutItemAnimation->SetVisualElementAnimationTickEventListener(null);
294 __pZoomInOutItemAnimation->SetVisualElementAnimationStatusEventListener(null);
297 if(__pFadeInOutItemtAnimation != null)
299 __pFadeInOutItemtAnimation->SetVisualElementAnimationTickEventListener(null);
300 __pFadeInOutItemtAnimation->SetVisualElementAnimationStatusEventListener(null);
302 pVisualElement->RemoveAllAnimations();
305 for (int j = 0; j < 3; j++)
307 delete __pItemBgBitmap[j];
308 __pItemBgBitmap[j] = null;
311 if (__pHighlightVisualElement != null)
313 __pHighlightVisualElement->RemoveAllAnimations();
314 __pHighlightVisualElement->SetAnimationProvider(null);
315 __pHighlightVisualElement->Destroy();
316 __pHighlightVisualElement = null;
319 if (__pBitmapVisualElement != null)
321 __pBitmapVisualElement->RemoveAllAnimations();
322 __pBitmapVisualElement->SetAnimationProvider(null);
323 __pBitmapVisualElement->Destroy();
324 __pBitmapVisualElement = null;
329 if (GetParent() != null && __isContextItem == true)
331 GetParent()->DetachChild(*this);
334 delete __pItemDivider;
335 __pItemDivider = null;
337 delete __pItemTopDivider;
338 __pItemTopDivider = null;
340 delete __pItemAnnexLeftDivider;
341 __pItemAnnexLeftDivider = null;
343 delete __pItemAnnexRightDivider;
344 __pItemAnnexRightDivider = null;
355 delete __pHeaderFooterItemText;
356 __pHeaderFooterItemText = null;
358 delete __pMoveItemAnimation;
359 __pMoveItemAnimation = null;
361 delete __pZoomInOutItemAnimation;
362 __pZoomInOutItemAnimation = null;
364 delete __pFadeInOutItemtAnimation;
365 __pFadeInOutItemtAnimation = null;
367 if (__isCheckedTimerEnabled)
369 __pCheckedTimer->Cancel();
372 delete __pCheckedTimer;
373 __pCheckedTimer = null;
375 if (__pAccessibilityElement)
377 _AccessibilityContainer* pContainer = GetAccessibilityContainer();
380 pContainer->RemoveAllElement();
382 __pAccessibilityElement = null;
387 _TableViewItem::CreateTableViewItemN(float itemHeight)
389 result r = E_SUCCESS;
391 _TableViewItem* pItem = null;
392 pItem = new (std::nothrow) _TableViewItem(itemHeight);
393 SysTryReturn(NID_UI_CTRL, pItem, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient.");
395 pItem->AcquireHandle();
397 r = pItem->Initialize();
398 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r = E_SYSTEM, "[E_SYSTEM] Unable to create TableView Item");
409 _TableViewItem::Initialize(void)
411 GetVisualElement()->SetSurfaceOpaque(false);
413 result r = E_SUCCESS;
415 __pHighlightVisualElement = new (std::nothrow) _VisualElement();
416 SysTryCatch(NID_UI_CTRL, __pHighlightVisualElement != null, r = E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
418 r = __pHighlightVisualElement->Construct();
419 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Failed to construct Visual Element.", GetErrorMessage(r));
421 r = __pHighlightVisualElement->SetSurfaceOpaque(false);
422 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Failed to set surface opaque.", GetErrorMessage(r));
424 __pHighlightVisualElement->SetImplicitAnimationEnabled(false);
426 r = GetVisualElement()->AttachChild(*__pHighlightVisualElement);
427 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Failed to attach child to the control VisualElement.", GetErrorMessage(r));
429 r = SetItemHighlightBounds(*__pHighlightVisualElement, CalculateItemHighlightBounds());
430 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Failed to set bounds.", GetErrorMessage(r));
432 __pHighlightVisualElement->SetBackgroundColor(_Colorf(0.0f, 0.0f, 0.0f, 0.0f));
433 __pHighlightVisualElement->SetShowState(true);
435 r = __individualSelectionControls.Construct(DEFAULT_CAPTURED_CONTROL_COUNT);
436 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Failed to construct ArrayList", GetErrorMessage(r));
438 SetTouchPressThreshold(SENSITIVE);
440 if (!_FloatCompare(__itemHeight, 0.0f))
442 SetAccessibilityElement();
448 if (__pHighlightVisualElement != null)
450 __pHighlightVisualElement->RemoveAllAnimations();
451 __pHighlightVisualElement->SetAnimationProvider(null);
452 __pHighlightVisualElement->Destroy();
453 __pHighlightVisualElement = null;
460 _TableViewItem::GetContextItem(void) const
462 return __pContextItem;
466 _TableViewItem::SetContextItem(_TableViewItem* pContextItem)
468 if (pContextItem != null)
470 pContextItem->__isContextItem = true;
473 __pContextItem = pContextItem;
477 _TableViewItem::IsContextItem(void) const
479 return __isContextItem;
483 _TableViewItem::SetContextItemActivation(bool activated)
485 __isContextItemActivated = activated;
489 _TableViewItem::IsContextItemActivated(void) const
491 return __isContextItemActivated;
495 _TableViewItem::CreateItemDimLayer(void)
497 result r = E_SUCCESS;
499 if (__pDimLayer == null)
501 __pDimLayer = _Label::CreateLabelN();
504 SysTryReturn(NID_UI_CTRL, __pDimLayer != null, r, r, "[%s] Propagating.", GetErrorMessage(r));
506 __pDimLayer->SetBackgroundColor(Color(0, 0, 0, BACKGROUND_DIMMED_OPACITY * 0xff));
507 __pDimLayer->SetVisibleState(false);
509 AttachSystemChild(*__pDimLayer);
516 _TableViewItem::CreateItemDivider(void)
518 result r = E_SUCCESS;
520 if (__pItemDivider == null)
522 __pItemDivider = _TableViewItemControl::CreateTableViewItemControlN();
524 SysTryReturn(NID_UI_CTRL, __pItemDivider != null, r, r, "[%s] Propagating.", GetErrorMessage(r));
526 AttachSystemChild(*__pItemDivider);
528 _AccessibilityContainer* pContainer = __pItemDivider->GetAccessibilityContainer();
529 pContainer->Activate(false);
532 if (__pItemTopDivider == null)
534 __pItemTopDivider = _TableViewItemControl::CreateTableViewItemControlN();
535 SysTryReturn(NID_UI_CTRL, __pItemTopDivider != null, r, r, "[%s] Propagating.", GetErrorMessage(r));
537 AttachSystemChild(*__pItemTopDivider);
539 _AccessibilityContainer* pContainer = __pItemTopDivider->GetAccessibilityContainer();
540 pContainer->Activate(false);
547 _TableViewItem::CreateItemAnnexDivider(void)
549 result r = E_SUCCESS;
551 if (__pItemAnnexLeftDivider == null)
553 __pItemAnnexLeftDivider = _TableViewItemControl::CreateTableViewItemControlN();
555 SysTryReturn(NID_UI_CTRL, __pItemAnnexLeftDivider != null, r, r, "[%s] Propagating.", GetErrorMessage(r));
557 AttachSystemChild(*__pItemAnnexLeftDivider);
560 if (__pItemAnnexRightDivider == null)
562 __pItemAnnexRightDivider = _TableViewItemControl::CreateTableViewItemControlN();
563 SysTryReturn(NID_UI_CTRL, __pItemAnnexRightDivider != null, r, r, "[%s] Propagating.", GetErrorMessage(r));
565 AttachSystemChild(*__pItemAnnexRightDivider);
572 _TableViewItem::CreateItemCover(void)
574 result r = E_SUCCESS;
576 if (__pItemCover == null)
578 __pItemCover = _TableViewItemControl::CreateTableViewItemControlN();
580 SysTryReturn(NID_UI_CTRL, __pItemCover != null, r, r, "[%s] Propagating.", GetErrorMessage(r));
582 AttachSystemChild(*__pItemCover);
589 _TableViewItem::CreateCheckBox(void)
591 result r = E_SUCCESS;
593 if (__pItemAnnex == null)
595 float annexWidth = 0.0f;
596 float annexHeight = 0.0f;
597 GET_SHAPE_CONFIG(TABLEVIEW::ITEM_ANNEX_WIDTH, _CONTROL_ORIENTATION_PORTRAIT, annexWidth);
598 GET_SHAPE_CONFIG(TABLEVIEW::ITEM_ANNEX_HEIGHT, _CONTROL_ORIENTATION_PORTRAIT, annexHeight);
600 __pItemAnnex = new (std::nothrow) Label();
602 SysTryReturn(NID_UI_CTRL, __pItemAnnex != null, r, r, "[%s] Propagating.", GetErrorMessage(r));
604 float leftMargin = 0.0f;
605 GET_SHAPE_CONFIG(TABLEVIEW::ITEM_LEFT_MARGIN, _CONTROL_ORIENTATION_PORTRAIT, leftMargin);
607 float itemHeight = ((__customHeight > 0) ? __customHeight : GetBoundsF().height);
608 __pItemAnnex->Construct(FloatRectangle(leftMargin, ((itemHeight - annexHeight) / 2), annexWidth, annexHeight), L"");
609 __pItemAnnex->SetBackgroundColor(Color(0, 0, 0, 0));
611 AttachSystemChild(*GetLabelCore(__pItemAnnex));
619 _TableViewItem::CreateRadioBox(void)
621 result r = E_SUCCESS;
623 if (__pItemAnnex == null)
625 float annexWidth = 0.0f;
626 float annexHeight = 0.0f;
627 GET_SHAPE_CONFIG(TABLEVIEW::ITEM_ANNEX_WIDTH, _CONTROL_ORIENTATION_PORTRAIT, annexWidth);
628 GET_SHAPE_CONFIG(TABLEVIEW::ITEM_ANNEX_HEIGHT, _CONTROL_ORIENTATION_PORTRAIT, annexHeight);
630 __pItemAnnex = new (std::nothrow) Label();
632 SysTryReturn(NID_UI_CTRL, __pItemAnnex != null, r, r, "[%s] Propagating.", GetErrorMessage(r));
634 float leftMargin = 0.0f;
635 GET_SHAPE_CONFIG(TABLEVIEW::ITEM_LEFT_MARGIN, _CONTROL_ORIENTATION_PORTRAIT, leftMargin);
637 float itemHeight = ((__customHeight > 0) ? __customHeight : GetBoundsF().height);
638 __pItemAnnex->Construct(FloatRectangle(leftMargin, ((itemHeight - annexHeight) / 2), annexWidth, annexHeight), L"");
639 __pItemAnnex->SetBackgroundColor(Color(0, 0, 0, 0));
641 AttachSystemChild(*GetLabelCore(__pItemAnnex));
648 _TableViewItem::CreateOnOffButton(void)
650 result r = E_SUCCESS;
652 if (__pItemAnnex == null)
654 float annexWidth = 0.0f;
655 float annexHeight = 0.0f;
657 GET_SHAPE_CONFIG(TABLEVIEW::ITEM_ANNEX_ONOFF_WIDTH, _CONTROL_ORIENTATION_PORTRAIT, annexWidth);
658 GET_SHAPE_CONFIG(TABLEVIEW::ITEM_ANNEX_ONOFF_HEIGHT, _CONTROL_ORIENTATION_PORTRAIT, annexHeight);
660 __pItemAnnex = new (std::nothrow) Label();
662 SysTryReturn(NID_UI_CTRL, __pItemAnnex != null, r, r, "[%s] Propagating.", GetErrorMessage(r));
664 float leftMargin = 0.0f;
665 GET_SHAPE_CONFIG(TABLEVIEW::ITEM_LEFT_MARGIN, _CONTROL_ORIENTATION_PORTRAIT, leftMargin);
667 leftMargin += __pDrawingProperty->scrollMargin;
669 float itemHeight = ((__customHeight > 0) ? __customHeight : GetBoundsF().height);
670 __pItemAnnex->Construct(FloatRectangle((GetBoundsF().width - annexWidth - leftMargin), ((itemHeight - annexHeight) / 2), annexWidth, annexHeight), L"");
671 __pItemAnnex->SetBackgroundColor(Color(0, 0, 0, 0));
673 AttachSystemChild(*GetLabelCore(__pItemAnnex));
680 _TableViewItem::CreateDetailButton(void)
682 result r = E_SUCCESS;
684 if (__pItemAnnex == null)
686 float annexWidth = 0.0f;
687 float annexHeight = 0.0f;
689 GET_SHAPE_CONFIG(TABLEVIEW::ITEM_ANNEX_MORE_WIDTH, _CONTROL_ORIENTATION_PORTRAIT, annexWidth);
690 GET_SHAPE_CONFIG(TABLEVIEW::ITEM_ANNEX_MORE_HEIGHT, _CONTROL_ORIENTATION_PORTRAIT, annexHeight);
691 __pItemAnnex = new (std::nothrow) Label();
693 SysTryReturn(NID_UI_CTRL, __pItemAnnex != null, r, r, "[%s] Propagating.", GetErrorMessage(r));
695 float leftMargin = 0.0f;
696 GET_SHAPE_CONFIG(TABLEVIEW::ITEM_LEFT_MARGIN, _CONTROL_ORIENTATION_PORTRAIT, leftMargin);
698 leftMargin += __pDrawingProperty->scrollMargin;
699 float itemHeight = ((__customHeight > 0) ? __customHeight : GetBoundsF().height);
700 __pItemAnnex->Construct(FloatRectangle((GetBoundsF().width - annexWidth - leftMargin), ((itemHeight - annexHeight) / 2), annexWidth, annexHeight), L"");
701 __pItemAnnex->SetBackgroundColor(Color(0, 0, 0, 0));
703 AttachSystemChild(*GetLabelCore(__pItemAnnex));
710 _TableViewItem::GetLabelCore(Label* label)
717 _LabelImpl* pImpl = _LabelImpl::GetInstance(*label);
718 return &pImpl->GetCore();
722 _TableViewItem::ExposeContextItem(FloatRectangle itemBounds, float targetWidth)
725 if (__pDimLayer == null)
727 if (CreateItemDimLayer() != E_SUCCESS)
733 SetBounds(itemBounds);
737 if ((itemBounds.width <= 0) || (itemBounds.width >= targetWidth)) // +++ check floating
744 float rightMargin = 0.0f;
745 float dimLayerOpacity = 0.0f;
747 GET_SHAPE_CONFIG(TABLEVIEW::CONTEXTITEM_RIGHT_MARGIN, _CONTROL_ORIENTATION_PORTRAIT, rightMargin);
749 dimLayerOpacity = BACKGROUND_DIMMED_OPACITY - ((itemBounds.width * BACKGROUND_DIMMED_OPACITY) / (targetWidth - rightMargin));
750 dimLayerOpacity = ((dimLayerOpacity < 0) ? 0 : dimLayerOpacity); // +++ check floating
752 __pDimLayer->SetBounds(FloatRectangle(0.0f, 0.0f, itemBounds.width, itemBounds.height));
753 __pDimLayer->SetBackgroundColor(Color(0.0f, 0.0f, 0.0f, dimLayerOpacity * 0xff));
756 __pDimLayer->SetVisibleState(visible);
761 _TableViewItem::DrawItemDimLayer(bool visible)
763 if (__pDimLayer == null)
765 if (CreateItemDimLayer() != E_SUCCESS)
773 FloatDimension itemSize = GetSizeF();
774 __pDimLayer->SetBounds(FloatRectangle(0.0f, 0.0f, itemSize.width, itemSize.height));
775 __pDimLayer->SetBackgroundColor(Color(0, 0, 0, BACKGROUND_DISABLED_OPACITY * 0xff));
778 __pDimLayer->SetVisibleState(visible);
782 _TableViewItem::SetItemWidth(float width)
788 _TableViewItem::SetItemBackgroundBitmap(ListItemState itemState, const Bitmap* pBitmap)
790 Bitmap* pCopyBitmap = null;
792 pCopyBitmap = _BitmapImpl::CloneN(*pBitmap);
793 SysTryReturn(NID_UI_CTRL, pCopyBitmap != null, false, E_OUT_OF_MEMORY, ("[E_OUT_OF_MEMORY] The memory is insufficient."));
795 delete __pItemBgBitmap[itemState];
796 __pItemBgBitmap[itemState] = pCopyBitmap;
799 if(__pItemBgBitmap[TABLE_VIEW_ITEM_DRAWING_STATUS_NORMAL] == null &&
800 __pItemBgBitmap[TABLE_VIEW_ITEM_DRAWING_STATUS_PRESSED] == null &&
801 __pItemBgBitmap[TABLE_VIEW_ITEM_DRAWING_STATUS_HIGHLIGHTED] == null)
803 if(__pBitmapVisualElement != null)
805 __pBitmapVisualElement->Destroy();
806 __pBitmapVisualElement = null;
811 if(__pBitmapVisualElement == null)
813 FloatRectangle bounds = GetBoundsF();
814 result r = E_SUCCESS;
816 __pBitmapVisualElement = new (std::nothrow) _VisualElement();
817 SysTryCatch(NID_UI_CTRL, __pBitmapVisualElement != null, , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient.");
819 r = __pBitmapVisualElement->Construct();
820 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
822 __pBitmapVisualElement->SetSurfaceOpaque(false);
823 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Failed to set surface opaque.", GetErrorMessage(r));
825 __pBitmapVisualElement->SetImplicitAnimationEnabled(false);
826 __pBitmapVisualElement->SetBounds(FloatRectangle(0.0f, 0.0f, bounds.width, bounds.height));
827 __pBitmapVisualElement->SetShowState(true);
829 GetVisualElement()->AttachChild(*__pBitmapVisualElement);
833 SetItemChanged(true);
836 if (__pBitmapVisualElement != null)
838 __pBitmapVisualElement->RemoveAllAnimations();
839 __pBitmapVisualElement->SetAnimationProvider(null);
840 __pBitmapVisualElement->Destroy();
841 __pBitmapVisualElement = null;
846 Tizen::Graphics::Bitmap*
847 _TableViewItem::GetItemBackgroundBitmap(ListItemState itemState) const
849 return __pItemBgBitmap[itemState];
853 _TableViewItem::SetItemBackgroundColor(ListItemState itemState, const Color bgColor)
855 __colorItemBg[itemState] = bgColor;
857 SetItemChanged(true);
861 _TableViewItem::GetItemBackgroundColor(ListItemState itemState) const
863 return __colorItemBg[itemState];
867 _TableViewItem::SetItemStyle(TableViewAnnexStyle style)
869 if (__annexStyle == style)
874 __annexStyle = style;
878 _TableViewItem::SetSelectionStyle(TableViewItemSelectionStyle style)
880 __selectionStyle = style;
885 TableViewItemSelectionStyle
886 _TableViewItem::GetSelectionStyle(void) const
888 return __selectionStyle;
892 _TableViewItem::GetItemHeight(void) const
894 return GetSizeF().height;
898 _TableViewItem::SetItemHeight(int itemHeight)
900 SetItemHeight(_CoordinateSystemUtils::ConvertToFloat(itemHeight));
904 _TableViewItem::SetItemHeight(float itemHeight)
906 SetSize(FloatDimension(GetSizeF().width, itemHeight));
910 _TableViewItem::SetChecked(bool checked)
912 if (__checkedState == checked)
917 __checkedState = checked;
919 SetItemChanged(true);
923 _TableViewItem::IsChecked(void) const
925 return __checkedState;
929 _TableViewItem::SetCheckedAnimationEnabled(bool enabled)
931 __isCheckedAnimationEnabled = enabled;
933 if (__isCheckedAnimationEnabled == false)
935 StopCheckBoxAnimation();
940 _TableViewItem::SetItemEnabled(bool enabled)
942 if (__enabledState == enabled)
947 __enabledState = enabled;
949 SetEnableState(enabled);
951 SetItemChanged(true);
959 _TableViewItem::IsItemEnabled(void) const
961 return __enabledState;
965 _TableViewItem::SetItemType(const TableViewItemType itemType)
967 __itemType = itemType;
969 if (__pContextItem != null)
971 __pContextItem->SetItemType(__itemType);
974 if(itemType == TABLE_VIEW_ITEM_TYPE_TITLE)
977 GET_COLOR_CONFIG(TABLEVIEW::ITEM_BG_PRESSED, titleColor);
978 if(titleColor == __colorItemBg[TABLE_VIEW_ITEM_DRAWING_STATUS_PRESSED])
980 GET_COLOR_CONFIG(TABLEVIEW::GROUPITEM_BG_PRESSED, __colorItemBg[TABLE_VIEW_ITEM_DRAWING_STATUS_PRESSED]);
986 _TableViewItem::SetItemIndex(int groupIndex, int itemIndex)
988 __itemGroupIndex = groupIndex;
989 __itemIndex = itemIndex;
993 _TableViewItem::GetItemIndex(int& groupIndex, int& itemIndex) const
995 groupIndex = __itemGroupIndex;
996 itemIndex = __itemIndex;
1001 _TableViewItem::GetItemType(void) const
1007 _TableViewItem::IsReorderMode(void) const
1009 return __reorderMode;
1013 _TableViewItem::SetReorderMode(bool enabled)
1015 __reorderMode = enabled;
1019 _TableViewItem::SetAppInfo(const void* pAppInfo)
1021 __pAppInfo = const_cast<void*>(pAppInfo);
1025 _TableViewItem::GetAppInfo(void) const
1031 _TableViewItem::SetItemChanged(bool changed)
1033 __itemChanged = changed;
1037 _TableViewItem::IsItemChanged(void) const
1039 return __itemChanged;
1043 _TableViewItem::IsAnnexOnOffSliding(void)
1045 return __annexOnOffHandlerMoved;
1049 _TableViewItem::GetItemStyle(void) const
1051 return __annexStyle;
1055 _TableViewItem::DrawItem(FloatRectangle& rcItem, ListItemState itemState, bool itemDivider)
1061 _TableViewItem::SetItemTapSoundEnabled(bool tapSoundEnabled)
1063 bool oldValue = __isItemTapSoundEnabled;
1064 __isItemTapSoundEnabled = tapSoundEnabled;
1069 _TableViewItem::GetItemTapSoundEnabled(void)
1071 return __isItemTapSoundEnabled;
1075 _TableViewItem::FireItemEvent(bool selectedItem)
1077 if (HasParent() == false)
1082 if (IsContextItem())
1087 _TableView* pParent = dynamic_cast<_TableView*>(GetParent());
1088 if (pParent == null)
1093 TableViewNotifyType eventType = TABLEVIEW_NOTIFY_TYPE_SELECTED_ITEM;
1095 if ((__annexStyle == TABLE_VIEW_ANNEX_STYLE_MARK)
1096 || (__annexStyle == TABLE_VIEW_ANNEX_STYLE_RADIO)
1097 || (__annexStyle == TABLE_VIEW_ANNEX_STYLE_ONOFF_SLIDING))
1101 eventType = TABLEVIEW_NOTIFY_TYPE_ANNEX_CHECK;
1105 eventType = TABLEVIEW_NOTIFY_TYPE_ANNEX_UNCHECK;
1108 else if (__annexStyle == TABLE_VIEW_ANNEX_STYLE_DETAILED)
1112 eventType = TABLEVIEW_NOTIFY_TYPE_ANNEX_MORE;
1115 else if(__annexStyle == TABLE_VIEW_ANNEX_STYLE_ONOFF_SLIDING_WITH_DIVIDER)
1119 eventType = TABLEVIEW_NOTIFY_TYPE_SELECTED_ITEM;
1125 eventType = TABLEVIEW_NOTIFY_TYPE_ANNEX_CHECK;
1129 eventType = TABLEVIEW_NOTIFY_TYPE_ANNEX_UNCHECK;
1134 if (__isItemTapSoundEnabled)
1136 if (!__isTabSoundPlayed)
1138 PLAY_FEEDBACK(_RESOURCE_FEEDBACK_PATTERN_TAP);
1142 __isTabSoundPlayed = false;
1143 __checkItemHeightNeeded = true;
1145 int groupIndex = -1;
1147 GetItemIndex(groupIndex, itemIndex);
1148 pParent->FireTableViewItemEvent(groupIndex, itemIndex, eventType, this);
1152 _TableViewItem::FireItemSweepEvent(TableViewSweepDirection direction)
1154 if (HasParent() == false)
1159 _TableView* pParent = dynamic_cast<_TableView*>(GetParent());
1160 if (pParent == null)
1165 int groupIndex = -1;
1167 GetItemIndex(groupIndex, itemIndex);
1169 pParent->FireTableViewItemSweepEvent(groupIndex, itemIndex, direction);
1173 _TableViewItem::OnTouchPressed(const _Control& source, const _TouchInfo& touchinfo)
1175 if (IsContextItem() ||
1176 __isContextItemActivated ||
1177 IsAnimationPlaying() ||
1183 __annexOnOffHandlerMoved = false;
1184 __touchStartPosition = touchinfo.GetCurrentPosition(); // +++ check floating
1186 if (&source == this)
1188 __pressedControl = TABLE_VIEW_ITEM_PRESSED_ITEM;
1190 else if (&source == GetLabelCore(__pItemAnnex))
1192 __pressedControl = TABLE_VIEW_ITEM_PRESSED_ANNEX;
1194 if (__annexStyle == TABLE_VIEW_ANNEX_STYLE_ONOFF_SLIDING ||
1195 __annexStyle == TABLE_VIEW_ANNEX_STYLE_ONOFF_SLIDING_WITH_DIVIDER)
1197 __annexOnOffTouchPosition = touchinfo.GetCurrentPosition().x; // +++ check floating
1200 else if (IsIndividualSelectionEnabled(source))
1202 __pressedControl = TABLE_VIEW_ITEM_PRESSED_INDIVIDUAL;
1206 __pressedControl = TABLE_VIEW_ITEM_PRESSED_NONE;
1209 if(__isReleasedTimerEnabled)
1211 StopTouchReleasedTimer();
1213 _TableView* pParent = dynamic_cast<_TableView*>(GetParent());
1214 if (pParent != null)
1216 int groupIndex = -1;
1218 GetItemIndex(groupIndex, itemIndex);
1219 pParent->FireItemTouchReleasedEventDuringPressing(groupIndex, itemIndex);
1224 if (!IsIndividualSelectionEnabled(source))
1226 __itemSelected = true;
1227 if(unlikely((_AccessibilityManager::IsActivated())))
1229 FireItemTouchPressed();
1233 StartTouchPressedTimer(source, touchinfo);
1242 _TableViewItem::OnTouchReleased(const _Control& source, const _TouchInfo& touchinfo)
1249 if (&source == this)
1251 __releasedControl = TABLE_VIEW_ITEM_PRESSED_ITEM;
1253 else if (&source == GetLabelCore(__pItemAnnex))
1255 __releasedControl = TABLE_VIEW_ITEM_PRESSED_ANNEX;
1257 else if (IsIndividualSelectionEnabled(source))
1259 __releasedControl = TABLE_VIEW_ITEM_PRESSED_INDIVIDUAL;
1263 __releasedControl = TABLE_VIEW_ITEM_PRESSED_NONE;
1266 __isTabSoundPlayed = IS_PLAYED_FEEDBACK();
1268 if(!__itemTouchMoved && __isPressedTimerEnabled)
1270 StopTouchPressedTimer();
1272 if(!IsContextItem())
1274 FireItemTouchPressed();
1277 StartTouchReleasedTimer();
1281 FireItemTouchReleased();
1286 _TableViewItem::FireItemTouchPressed()
1288 if(__pressedControl == TABLE_VIEW_ITEM_PRESSED_ITEM)
1290 __drawingStatus = TABLE_VIEW_ITEM_DRAWING_STATUS_PRESSED;
1291 SetItemChanged(true);
1294 else if(__pressedControl == TABLE_VIEW_ITEM_PRESSED_ANNEX)
1296 if (__annexStyle == TABLE_VIEW_ANNEX_STYLE_DETAILED)
1298 __drawingStatus = TABLE_VIEW_ITEM_DRAWING_STATUS_NORMAL;
1299 __isSelectedDetailButton = true;
1302 else if (__annexStyle == TABLE_VIEW_ANNEX_STYLE_ONOFF_SLIDING ||
1303 __annexStyle == TABLE_VIEW_ANNEX_STYLE_ONOFF_SLIDING_WITH_DIVIDER)
1305 __drawingStatus = TABLE_VIEW_ITEM_DRAWING_STATUS_NORMAL;
1309 __drawingStatus = TABLE_VIEW_ITEM_DRAWING_STATUS_PRESSED;
1310 SetItemChanged(true);
1316 if(__pressedControl != TABLE_VIEW_ITEM_PRESSED_INDIVIDUAL)
1318 __drawingStatus = TABLE_VIEW_ITEM_DRAWING_STATUS_PRESSED;
1319 SetItemChanged(true);
1326 _TableViewItem::FireItemTouchReleased()
1328 bool fireItemEvent = false;
1329 bool selectedItem = true;
1331 __drawingStatus = TABLE_VIEW_ITEM_DRAWING_STATUS_NORMAL;
1333 if (__itemSelected == true)
1335 bool checked = IsChecked();
1336 fireItemEvent = true;
1338 if (__releasedControl == TABLE_VIEW_ITEM_PRESSED_ITEM)
1340 if ((__annexStyle == TABLE_VIEW_ANNEX_STYLE_RADIO)
1341 || (__annexStyle == TABLE_VIEW_ANNEX_STYLE_ONOFF_SLIDING))
1343 SetChecked(!checked);
1345 else if(__annexStyle == TABLE_VIEW_ANNEX_STYLE_MARK)
1347 SetChecked(!checked);
1348 SetCheckedAnimationEnabled(!checked);
1351 else if(__releasedControl == TABLE_VIEW_ITEM_PRESSED_ANNEX)
1353 if (__annexStyle == TABLE_VIEW_ANNEX_STYLE_DETAILED)
1355 __isSelectedDetailButton = false;
1357 selectedItem = false;
1359 else if (__annexStyle == TABLE_VIEW_ANNEX_STYLE_ONOFF_SLIDING ||
1360 __annexStyle == TABLE_VIEW_ANNEX_STYLE_ONOFF_SLIDING_WITH_DIVIDER)
1362 AdjustAnnexOnOffHandlerPosition();
1363 selectedItem = false;
1367 SetChecked(!checked);
1368 SetCheckedAnimationEnabled(!checked);
1373 if(__releasedControl != TABLE_VIEW_ITEM_PRESSED_INDIVIDUAL)
1375 if ((__annexStyle == TABLE_VIEW_ANNEX_STYLE_MARK)
1376 || (__annexStyle == TABLE_VIEW_ANNEX_STYLE_RADIO)
1377 || (__annexStyle == TABLE_VIEW_ANNEX_STYLE_ONOFF_SLIDING))
1379 SetChecked(!checked);
1380 SetCheckedAnimationEnabled(!checked);
1385 fireItemEvent = false;
1389 SetItemChanged(true);
1395 if (__releasedControl == TABLE_VIEW_ITEM_PRESSED_ANNEX)
1397 if (__annexStyle == TABLE_VIEW_ANNEX_STYLE_ONOFF_SLIDING ||
1398 __annexStyle == TABLE_VIEW_ANNEX_STYLE_ONOFF_SLIDING_WITH_DIVIDER)
1400 AdjustAnnexOnOffHandlerPosition();
1401 fireItemEvent = true;
1406 __itemSelected = false;
1407 __annexOnOffHandlerMoved = false;
1408 __itemTouchMoved = false;
1412 FireItemEvent(selectedItem);
1417 _TableViewItem::OnTouchMoved(const _Control& source, const _TouchInfo& touchinfo)
1424 if (__isPressedTimerEnabled)
1426 StopTouchPressedTimer();
1429 bool retVal = false;
1431 if (&source == this)
1433 __itemSelected = false;
1434 __drawingStatus = TABLE_VIEW_ITEM_DRAWING_STATUS_NORMAL;
1436 SetItemChanged(true);
1439 else if (&source == GetLabelCore(__pItemAnnex))
1441 if (__annexStyle == TABLE_VIEW_ANNEX_STYLE_DETAILED)
1443 __isSelectedDetailButton = false;
1446 else if(__annexStyle == TABLE_VIEW_ANNEX_STYLE_ONOFF_SLIDING ||
1447 __annexStyle == TABLE_VIEW_ANNEX_STYLE_ONOFF_SLIDING_WITH_DIVIDER)
1449 __annexOnOffHandlerMoved = true;
1450 DrawAnnexOnOffHandler(touchinfo.GetCurrentPosition().x); // +++ check floating
1455 __itemSelected = false;
1456 __drawingStatus = TABLE_VIEW_ITEM_DRAWING_STATUS_NORMAL;
1458 SetItemChanged(true);
1464 if(!IsIndividualSelectionEnabled(source))
1466 __itemSelected = false;
1467 __drawingStatus = TABLE_VIEW_ITEM_DRAWING_STATUS_NORMAL;
1469 SetItemChanged(true);
1474 __itemTouchMoved = true;
1480 _TableViewItem::OnTouchCanceled(const _Control& source, const _TouchInfo& touchinfo)
1482 if (__isPressedTimerEnabled)
1484 StopTouchPressedTimer();
1487 __annexOnOffHandlerMoved = false;
1488 __itemTouchMoved = false;
1490 __itemSelected = false;
1491 __drawingStatus = TABLE_VIEW_ITEM_DRAWING_STATUS_NORMAL;
1493 if (__annexStyle == TABLE_VIEW_ANNEX_STYLE_DETAILED)
1495 __isSelectedDetailButton = false;
1498 SetItemChanged(true);
1501 if (&source != this)
1509 _UiTouchEventDelivery
1510 _TableViewItem::OnPreviewTouchPressed(const _Control& source, const _TouchInfo& touchinfo)
1513 return _UI_TOUCH_EVENT_DELIVERY_FORCED_YES;
1516 _UiTouchEventDelivery
1517 _TableViewItem::OnPreviewTouchReleased(const _Control& source, const _TouchInfo& touchinfo)
1519 return _UI_TOUCH_EVENT_DELIVERY_FORCED_YES;
1522 _UiTouchEventDelivery
1523 _TableViewItem::OnPreviewTouchMoved(const _Control& source, const _TouchInfo& touchinfo)
1525 return _UI_TOUCH_EVENT_DELIVERY_YES;
1528 _UiTouchEventDelivery
1529 _TableViewItem::OnPreviewTouchCanceled(const _Control& source, const _TouchInfo& touchinfo)
1531 return _UI_TOUCH_EVENT_DELIVERY_FORCED_YES;
1535 _TableViewItem::OnDraw(void)
1537 if (IsItemChanged() == true)
1539 DrawItemBackground();
1543 DrawSectionStyleBackgroundCover();
1545 SetItemChanged(false);
1550 _TableViewItem::OnChildAttached(const _Control& child)
1552 _AccessibilityContainer* pContainer = const_cast<_Control*>(&child)->GetAccessibilityContainer();
1553 pContainer->Activate(false);
1555 _Control* pControl = const_cast<_Control*>(&child);
1556 pControl->SetTouchPressThreshold(SENSITIVE);
1558 if ((__annexStyle == TABLE_VIEW_ANNEX_STYLE_MARK) || (__annexStyle == TABLE_VIEW_ANNEX_STYLE_RADIO))
1560 if (GetLabelCore(__pItemAnnex) == &child)
1565 FloatRectangle bounds = child.GetBoundsF();
1566 float leftMargin = 0.0f;
1567 float annexWidth = 0.0f;
1569 GET_SHAPE_CONFIG(TABLEVIEW::ITEM_LEFT_MARGIN, _CONTROL_ORIENTATION_PORTRAIT, leftMargin);
1570 GET_SHAPE_CONFIG(TABLEVIEW::ITEM_ANNEX_WIDTH, _CONTROL_ORIENTATION_PORTRAIT, annexWidth);
1572 bounds.x += (leftMargin * 2) + annexWidth;
1573 pControl->SetBounds(bounds);
1578 _TableViewItem::OnChildDetached(const _Control& child)
1580 if (__individualSelectionControls.Contains(child))
1582 __individualSelectionControls.Remove(child, false);
1585 _Label* pSimpleItemTextCore = GetLabelCore(__pSimpleItemText);
1586 _Label* pSimpleItemBitmapCore = GetLabelCore(__pSimpleItemBitmap);
1588 if (&child == pSimpleItemTextCore)
1590 __pSimpleItemText = null;
1593 if (&child == pSimpleItemBitmapCore)
1595 __pSimpleItemBitmap = null;
1600 _TableViewItem::OnTimerExpired(Tizen::Base::Runtime::Timer& timer)
1602 result r = E_SUCCESS;
1604 if (&timer == __pCheckedTimer)
1606 if (__checkedCount < MAX_CHECKED_COUNT)
1608 r = __pCheckedTimer->Start(CHECKED_ANIMATION_DURATION);
1609 SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
1612 r = PlayCheckBoxAnimation();
1613 SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
1615 if (__checkedCount < MAX_CHECKED_COUNT)
1622 __isCheckedAnimationEnabled = false;
1623 __isCheckedTimerEnabled = false;
1626 else if (&timer == __pPressedTimer)
1628 __isPressedTimerEnabled = false;
1629 FireItemTouchPressed();
1631 else if(&timer == __pReleasedTimer)
1633 __isReleasedTimerEnabled = false;
1634 FireItemTouchReleased();
1639 _TableViewItem::StartTouchPressedTimer(const _Control& source, const _TouchInfo& touchinfo)
1641 result r = E_SUCCESS;
1643 if (__pPressedTimer == null)
1645 __pPressedTimer = new (std::nothrow) Timer();
1646 SysTryCatch(NID_UI_CTRL, __pPressedTimer != null, r = E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
1648 r = __pPressedTimer->Construct(*this);
1649 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage);
1652 if (__isPressedTimerEnabled == false)
1654 r = __pPressedTimer->Start(TOUCH_PRESSED_DURATION);
1655 SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage);
1657 __isPressedTimerEnabled = true;
1663 if (__isPressedTimerEnabled && __pPressedTimer != null)
1665 __pPressedTimer->Cancel();
1668 delete __pPressedTimer;
1669 __pPressedTimer = null;
1675 _TableViewItem::StopTouchPressedTimer(void)
1677 result r = E_SUCCESS;
1679 SysTryReturnVoidResult(NID_UI_CTRL, __pPressedTimer != null, E_SYSTEM, "[E_SYSTEM] Timer is invalid.");
1681 if (__isPressedTimerEnabled)
1683 r = __pPressedTimer->Cancel();
1684 SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
1687 __isPressedTimerEnabled = false;
1693 _TableViewItem::StartTouchReleasedTimer()
1695 result r = E_SUCCESS;
1697 if(__pReleasedTimer == null)
1699 __pReleasedTimer = new (std::nothrow) Timer();
1700 SysTryCatch(NID_UI_CTRL, __pReleasedTimer != null, r = E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
1702 r = __pReleasedTimer->Construct(*this);
1703 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage);
1706 if(!__isReleasedTimerEnabled)
1708 r = __pReleasedTimer->Start(TOUCH_RELEASED_DURATION);
1709 SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage);
1711 __isReleasedTimerEnabled = true;
1716 if (__isReleasedTimerEnabled && __pReleasedTimer != null)
1718 __pReleasedTimer->Cancel();
1721 delete __pReleasedTimer;
1722 __pReleasedTimer = null;
1728 _TableViewItem::StopTouchReleasedTimer(void)
1730 result r = E_SUCCESS;
1732 SysTryReturnVoidResult(NID_UI_CTRL, __pReleasedTimer != null, E_SYSTEM, "[E_SYSTEM] Timer is invalid.");
1734 if (__isReleasedTimerEnabled)
1736 r = __pReleasedTimer->Cancel();
1737 SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
1740 __isReleasedTimerEnabled = false;
1746 _TableViewItem::OnAncestorInputEnableStateChanged(const _Control& control)
1748 if (__isPressedTimerEnabled)
1750 StopTouchPressedTimer();
1753 __annexOnOffHandlerMoved = false;
1754 __itemTouchMoved = false;
1756 __itemSelected = false;
1757 __drawingStatus = TABLE_VIEW_ITEM_DRAWING_STATUS_NORMAL;
1759 if (__annexStyle == TABLE_VIEW_ANNEX_STYLE_DETAILED)
1761 __isSelectedDetailButton = false;
1764 SetItemChanged(true);
1769 _TableViewItem::StartCheckBoxAnimation(void)
1771 result r = E_SUCCESS;
1773 if (__pCheckedTimer == null)
1775 __pCheckedTimer = new (std::nothrow) Timer();
1776 SysTryCatch(NID_UI_CTRL, __pCheckedTimer != null, r = E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
1778 r = __pCheckedTimer->Construct(*this);
1779 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage);
1782 if (__isCheckedTimerEnabled == false)
1784 r = __pCheckedTimer->Start(CHECKED_ANIMATION_DURATION);
1785 SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage);
1787 __isCheckedTimerEnabled = true;
1793 if (__isCheckedTimerEnabled)
1795 __pCheckedTimer->Cancel();
1798 delete __pCheckedTimer;
1799 __pCheckedTimer = null;
1805 _TableViewItem::StopCheckBoxAnimation(void)
1807 result r = E_SUCCESS;
1809 SysTryReturnVoidResult(NID_UI_CTRL, __pCheckedTimer != null, E_SYSTEM, "[E_SYSTEM] Timer is invalid.");
1811 if (__isCheckedTimerEnabled)
1813 r = __pCheckedTimer->Cancel();
1814 SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
1818 __isCheckedAnimationEnabled = false;
1819 __isCheckedTimerEnabled = false;
1825 _TableViewItem::PlayCheckBoxAnimation(void)
1827 Bitmap* pCheckBox = null;
1828 Bitmap* pCheckBoxBg = null;
1829 Bitmap* pMergeBitmap = null;
1830 Canvas* pCanvas = null;
1831 result r = E_SUCCESS;
1833 FloatRectangle bounds;
1835 float annexWidth = 0.0f;
1836 float annexHeight = 0.0f;
1838 if (__drawingStatus == TABLE_VIEW_ITEM_DRAWING_STATUS_NORMAL)
1840 r = GET_BITMAP_CONFIG_N(TABLEVIEW::CHECKBOX_BG_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, pCheckBoxBg);
1842 else if ((__drawingStatus == TABLE_VIEW_ITEM_DRAWING_STATUS_PRESSED) || (__drawingStatus == TABLE_VIEW_ITEM_DRAWING_STATUS_HIGHLIGHTED))
1844 r = GET_BITMAP_CONFIG_N(TABLEVIEW::CHECKBOX_BG_PRESSED, BITMAP_PIXEL_FORMAT_ARGB8888, pCheckBoxBg);
1846 SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS) && (pCheckBoxBg != null), , E_SYSTEM, "[%s] Propagating.", GetErrorMessage(r));
1848 r = GET_BITMAP_CONFIG_N(TABLEVIEW::CHECKBOX_CHECK_MARK_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, pCheckBox);
1849 SysTryCatch(NID_UI_CTRL,(r == E_SUCCESS) && (pCheckBox != null), , E_SYSTEM, "[%s] Propagating.", GetErrorMessage(r));
1851 GET_SHAPE_CONFIG(TABLEVIEW::ITEM_ANNEX_WIDTH, _CONTROL_ORIENTATION_PORTRAIT, annexWidth);
1852 GET_SHAPE_CONFIG(TABLEVIEW::ITEM_ANNEX_HEIGHT, _CONTROL_ORIENTATION_PORTRAIT, annexHeight);
1854 bounds.SetBounds(0, 0, annexWidth, annexHeight);
1856 pCanvas = new (std::nothrow) Canvas();
1857 SysTryCatch(NID_UI_CTRL, pCanvas != null, , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient.");
1859 r = pCanvas->Construct(bounds);
1860 pCanvas->SetBackgroundColor(Color(0, 0, 0, 0));
1863 DrawBitmap(*pCanvas, CalculateAnnexBitmapBounds(annexWidth, annexHeight, *pCheckBoxBg), *pCheckBoxBg);
1865 __checkedBounds = CalculateAnnexBitmapBounds(annexWidth, annexHeight, *pCheckBox);
1866 if (IsChecked() == true)
1868 if (_BitmapImpl::CheckNinePatchedBitmapStrictly(*pCheckBox))
1870 FloatRectangle drawingRect(__checkedBounds.x, __checkedBounds.y, __checkedBounds.width, __checkedBounds.height);
1871 r = pCanvas->DrawNinePatchedBitmap(drawingRect, *pCheckBox); // +++ check floating
1875 FloatRectangle bitmapSourceRect(0.0f, 0.0f, pCheckBox->GetWidthF()*__checkedCount * 0.1, pCheckBox->GetHeightF());
1876 FloatRectangle drawingRect(__checkedBounds.x, __checkedBounds.y, __checkedBounds.width * __checkedCount * 0.1, __checkedBounds.height);
1877 r = pCanvas->DrawBitmap(drawingRect, *pCheckBox, bitmapSourceRect); // +++ check floating
1881 pMergeBitmap = new (std::nothrow) Bitmap();
1882 SysTryCatch(NID_UI_CTRL, pMergeBitmap != null, , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient.");
1884 pMergeBitmap->Construct(*pCanvas, bounds);
1885 _BitmapImpl::ConvertToNonpremultiplied(*pMergeBitmap, true);
1889 __pItemAnnex->SetBackgroundBitmap(*pMergeBitmap);
1890 __pItemAnnex->Invalidate(false);
1896 delete pMergeBitmap;
1903 _TableViewItem::SetItemLayoutEnabled(bool enabled)
1905 __isItemLayoutEnabled = enabled;
1909 _TableViewItem::GetItemLayoutEnabled(void)
1911 return __isItemLayoutEnabled;
1915 _TableViewItem::OnBoundsChanged(void)
1917 if (__checkItemHeightNeeded && HasParent())
1919 _TableView* pParent = dynamic_cast<_TableView*>(GetParent());
1920 if (pParent != null)
1922 int groupIndex = -1;
1924 GetItemIndex(groupIndex, itemIndex);
1926 pParent->CheckItemHeightAndRefreshLayout(groupIndex, itemIndex);
1929 __checkItemHeightNeeded = false;
1932 AdjustAnnexBounds();
1934 SetItemHighlightBounds(*__pHighlightVisualElement, CalculateItemHighlightBounds());
1936 if (__pHeaderFooterItemText != null)
1938 FloatRectangle textBounds = __pHeaderFooterItemText->GetBoundsF();
1939 textBounds.width = GetBoundsF().width;
1941 __pHeaderFooterItemText->SetBounds(textBounds);
1944 if(__pBitmapVisualElement != null)
1946 FloatRectangle bounds = GetBoundsF();
1947 __pBitmapVisualElement->SetBounds(FloatRectangle(0.0f, 0.0f, bounds.width, bounds.height));
1950 if(__pAccessibilityElement != null)
1952 __pAccessibilityElement->SetBounds(FloatRectangle(0.0f,0.0f, GetBoundsF().width, GetBoundsF().height));
1957 _TableViewItem::SetDrawingProperty(_ItemDrawingProperty* pDrawingProperty)
1960 SysTryReturnVoidResult(NID_UI_CTRL, pDrawingProperty != null, E_INVALID_ARG, "[E_INAVLID_ARG] pDrawingProperty is null");
1962 __pDrawingProperty = pDrawingProperty;
1964 if(__pDrawingProperty != null)
1966 if (__pDrawingProperty->sectionStyleEnabled == true &&
1972 if(__pDrawingProperty->itemDividerEnabled)
1974 CreateItemDivider();
1981 _ItemDrawingProperty*
1982 _TableViewItem::GetDrawingProperty(void)
1984 return __pDrawingProperty;
1988 _TableViewItem::DrawItemBackground(void)
1990 Canvas* pCanvas = null;
1991 Bitmap* pDrawBitmap = __pItemBgBitmap[__drawingStatus];
1992 Color bgColor = __colorItemBg[__drawingStatus];
1993 FloatRectangle bounds = GetBoundsF();
1995 SetItemHighlightBounds(*__pHighlightVisualElement, CalculateItemHighlightBounds());
1997 if(__pBitmapVisualElement != null)
1999 pCanvas = __pBitmapVisualElement->GetCanvasN();
2000 SysTryCatch(NID_UI_CTRL, pCanvas != null, , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient.");
2001 pCanvas->SetBackgroundColor(Color(0, 0, 0, 0));
2005 if(pDrawBitmap != null && __enabledState)
2009 __pHighlightVisualElement->SetBackgroundColor(_Colorf(0.0f, 0.0f, 0.0f, 0.0f));
2010 DrawBitmap(*pCanvas, FloatRectangle(0.0f, 0.0f, bounds.width, bounds.height), *pDrawBitmap);
2016 DrawContextItemBackground();
2018 else if (__pDrawingProperty->sectionStyleEnabled == true)
2020 DrawSectionStyleBackground();
2026 if (__itemType == TABLE_VIEW_ITEM_TYPE_HEADER || __itemType == TABLE_VIEW_ITEM_TYPE_FOOTER)
2028 SetBackgroundColor(Color(0, 0, 0, 0));
2029 __pHighlightVisualElement->SetBackgroundColor(_Colorf(0.0f, 0.0f, 0.0f, 0.0f));
2031 else if(__itemType == TABLE_VIEW_ITEM_TYPE_TITLE)
2033 __pHighlightVisualElement->SetBackgroundColor(_Colorf((float)bgColor.GetRed() / 255.0f, (float)bgColor.GetGreen() / 255.0f, (float)bgColor.GetBlue() / 255.0f, (float)bgColor.GetAlpha() / 255.0f));
2037 SetBackgroundColor(__colorItemBg[TABLE_VIEW_ITEM_DRAWING_STATUS_NORMAL]);
2039 __pHighlightVisualElement->SetBackgroundColor(_Colorf((float)bgColor.GetRed() / 255.0f, (float)bgColor.GetGreen() / 255.0f, (float)bgColor.GetBlue() / 255.0f, (float)bgColor.GetAlpha() / 255.0f));
2041 if (__pDrawingProperty->groupedLookEnabled == true)
2049 GET_COLOR_CONFIG(TABLEVIEW::ITEM_BG_DISABLED, bgColor);
2050 SetBackgroundColor(bgColor);
2051 __pHighlightVisualElement->SetBackgroundColor(_Colorf((float)bgColor.GetRed() / 255.0f, (float)bgColor.GetGreen() / 255.0f, (float)bgColor.GetBlue() / 255.0f, (float)bgColor.GetAlpha() / 255.0f));
2053 if (__pDrawingProperty->groupedLookEnabled == true)
2065 if (__pBitmapVisualElement != null)
2067 __pBitmapVisualElement->RemoveAllAnimations();
2068 __pBitmapVisualElement->SetAnimationProvider(null);
2069 __pBitmapVisualElement->Destroy();
2070 __pBitmapVisualElement = null;
2075 _TableViewItem::DrawGroupedLook(void)
2077 if (IsTitleStyleItem() || IsContextItem())
2083 Color outlineColor = __pDrawingProperty->dividerColor;
2085 float barWidth = 0.0f;
2087 Canvas* pCanvas = GetVisualElement()->GetCanvasN();
2088 SysTryReturnVoidResult(NID_UI_CTRL, pCanvas != null, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
2090 FloatRectangle bounds = GetBoundsF();
2091 pCanvas->SetBackgroundColor(GetBackgroundColor());
2094 GET_COLOR_CONFIG(TABLEVIEW::GROUPITEM_BAR_NORMAL, barColor);
2095 GET_SHAPE_CONFIG(TABLEVIEW::GROUPITEM_BAR_WIDTH, _CONTROL_ORIENTATION_PORTRAIT, barWidth);
2097 pCanvas->FillRectangle(barColor, FloatRectangle(0.0f, 0.0f, barWidth, bounds.height));
2099 if (__pDrawingProperty->sectionStyleEnabled == true)
2101 pCanvas->FillRectangle(outlineColor, FloatRectangle(bounds.width - 1.0f, 0.0f, 1.0f, bounds.height));
2103 if (__itemType == TABLE_VIEW_ITEM_TYPE_TOP || __itemType == TABLE_VIEW_ITEM_TYPE_ONE)
2105 pCanvas->FillRectangle(outlineColor, FloatRectangle(0.0f, 0.0f, bounds.width, 1.0f));
2113 _TableViewItem::DrawSectionStyleBackground(void)
2115 Canvas* pCanvas = null;
2116 Bitmap* pSectionBg = null;
2117 Bitmap* pSectionPressBg = null;
2118 Bitmap* pSectionDisabledBg = null;
2119 Bitmap* pReplacementSectionPressBg = null;
2120 Bitmap* pReplacementSectionBg = null;
2121 Color bgColor = __colorItemBg[__drawingStatus];
2122 FloatRectangle bounds = GetBoundsF();
2123 float dividerHeight = 0.0f;
2125 result r = E_SUCCESS;
2127 pCanvas = GetVisualElement()->GetCanvasN();
2128 SysTryReturnVoidResult(NID_UI_CTRL, pCanvas != null, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
2130 pCanvas->SetBackgroundColor(Color(0, 0, 0, 0));
2133 if (__itemType == TABLE_VIEW_ITEM_TYPE_ONE)
2135 r = GET_BITMAP_CONFIG_N(TABLEVIEW::SECTIONITEM_SINGLE_BG_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, pSectionBg);
2137 else if (__itemType == TABLE_VIEW_ITEM_TYPE_TOP)
2139 r = GET_BITMAP_CONFIG_N(TABLEVIEW::SECTIONITEM_TOP_BG_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, pSectionBg);
2141 else if (__itemType == TABLE_VIEW_ITEM_TYPE_MIDDLE)
2143 r = GET_BITMAP_CONFIG_N(TABLEVIEW::SECTIONITEM_CENTER_BG_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, pSectionBg);
2145 else if (__itemType == TABLE_VIEW_ITEM_TYPE_BOTTOM)
2147 r = GET_BITMAP_CONFIG_N(TABLEVIEW::SECTIONITEM_BOTTOM_BG_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, pSectionBg);
2153 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , E_SYSTEM, "[E_SYSTEM] SectionStyle image load failed");
2157 if(__drawingStatus == TABLE_VIEW_ITEM_DRAWING_STATUS_PRESSED || __drawingStatus == TABLE_VIEW_ITEM_DRAWING_STATUS_HIGHLIGHTED)
2159 if (__itemType == TABLE_VIEW_ITEM_TYPE_ONE)
2161 if(IS_CUSTOM_BITMAP(TABLEVIEW::SECTIONITEM_SINGLE_BG_PRESSED))
2163 r = GET_BITMAP_CONFIG_N(TABLEVIEW::SECTIONITEM_SINGLE_BG_PRESSED, BITMAP_PIXEL_FORMAT_ARGB8888, pSectionPressBg);
2164 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , E_SYSTEM, "[E_SYSTEM] SectionStyle image load failed");
2167 else if (__itemType == TABLE_VIEW_ITEM_TYPE_TOP)
2169 if(IS_CUSTOM_BITMAP(TABLEVIEW::SECTIONITEM_TOP_BG_PRESSED))
2171 r = GET_BITMAP_CONFIG_N(TABLEVIEW::SECTIONITEM_TOP_BG_PRESSED, BITMAP_PIXEL_FORMAT_ARGB8888, pSectionPressBg);
2172 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , E_SYSTEM, "[E_SYSTEM] SectionStyle image load failed");
2175 else if (__itemType == TABLE_VIEW_ITEM_TYPE_MIDDLE)
2177 if(IS_CUSTOM_BITMAP(TABLEVIEW::SECTIONITEM_CENTER_BG_PRESSED))
2179 r = GET_BITMAP_CONFIG_N(TABLEVIEW::SECTIONITEM_CENTER_BG_PRESSED, BITMAP_PIXEL_FORMAT_ARGB8888, pSectionPressBg);
2180 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , E_SYSTEM, "[E_SYSTEM] SectionStyle image load failed");
2183 else if (__itemType == TABLE_VIEW_ITEM_TYPE_BOTTOM)
2185 if(IS_CUSTOM_BITMAP(TABLEVIEW::SECTIONITEM_BOTTOM_BG_PRESSED))
2187 r = GET_BITMAP_CONFIG_N(TABLEVIEW::SECTIONITEM_BOTTOM_BG_PRESSED, BITMAP_PIXEL_FORMAT_ARGB8888, pSectionPressBg);
2188 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , E_SYSTEM, "[E_SYSTEM] SectionStyle image load failed");
2192 GET_FIXED_VALUE_CONFIG(TABLEVIEW::ITEM_DIVIDER_HEIGHT, _CONTROL_ORIENTATION_PORTRAIT, dividerHeight);
2196 pReplacementSectionPressBg = Tizen::Graphics::_BitmapImpl::GetColorReplacedBitmapN(*pSectionPressBg, Color::GetColor(COLOR_ID_MAGENTA), bgColor);
2200 pReplacementSectionPressBg = Tizen::Graphics::_BitmapImpl::GetColorReplacedBitmapN(*pSectionBg, Color::GetColor(COLOR_ID_MAGENTA), bgColor);
2203 DrawBitmap(*pCanvas, FloatRectangle(0.0f, dividerHeight, bounds.width, bounds.height - (dividerHeight * 2)), *pReplacementSectionPressBg);
2209 pReplacementSectionBg = Tizen::Graphics::_BitmapImpl::GetColorReplacedBitmapN(*pSectionBg, Color::GetColor(COLOR_ID_MAGENTA), bgColor);
2213 pReplacementSectionBg = Tizen::Graphics::_BitmapImpl::GetColorReplacedBitmapN(*pSectionBg, Color::GetColor(COLOR_ID_MAGENTA), __pDrawingProperty->sectionStyleBgColor);
2216 DrawBitmap(*pCanvas, FloatRectangle(0.0f, 0.0f, bounds.width, bounds.height), *pReplacementSectionBg);
2221 if (__itemType == TABLE_VIEW_ITEM_TYPE_ONE)
2223 if(IS_CUSTOM_BITMAP(TABLEVIEW::SECTIONITEM_SINGLE_BG_DISABLED))
2225 r = GET_BITMAP_CONFIG_N(TABLEVIEW::SECTIONITEM_SINGLE_BG_DISABLED, BITMAP_PIXEL_FORMAT_ARGB8888, pSectionDisabledBg);
2226 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , E_SYSTEM, "[E_SYSTEM] SectionStyle image load failed");
2229 else if (__itemType == TABLE_VIEW_ITEM_TYPE_TOP)
2231 if(IS_CUSTOM_BITMAP(TABLEVIEW::SECTIONITEM_TOP_BG_DISABLED))
2233 r = GET_BITMAP_CONFIG_N(TABLEVIEW::SECTIONITEM_TOP_BG_DISABLED, BITMAP_PIXEL_FORMAT_ARGB8888, pSectionDisabledBg);
2234 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , E_SYSTEM, "[E_SYSTEM] SectionStyle image load failed");
2237 else if (__itemType == TABLE_VIEW_ITEM_TYPE_MIDDLE)
2239 if(IS_CUSTOM_BITMAP(TABLEVIEW::SECTIONITEM_CENTER_BG_DISABLED))
2241 r = GET_BITMAP_CONFIG_N(TABLEVIEW::SECTIONITEM_CENTER_BG_DISABLED, BITMAP_PIXEL_FORMAT_ARGB8888, pSectionDisabledBg);
2242 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , E_SYSTEM, "[E_SYSTEM] SectionStyle image load failed");
2245 else if (__itemType == TABLE_VIEW_ITEM_TYPE_BOTTOM)
2247 if(IS_CUSTOM_BITMAP(TABLEVIEW::SECTIONITEM_BOTTOM_BG_DISABLED))
2249 r = GET_BITMAP_CONFIG_N(TABLEVIEW::SECTIONITEM_BOTTOM_BG_DISABLED, BITMAP_PIXEL_FORMAT_ARGB8888, pSectionDisabledBg);
2250 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , E_SYSTEM, "[E_SYSTEM] SectionStyle image load failed");
2254 GET_COLOR_CONFIG(TABLEVIEW::ITEM_BG_DISABLED, bgColor);
2255 if(pSectionDisabledBg)
2257 pReplacementSectionBg = Tizen::Graphics::_BitmapImpl::GetColorReplacedBitmapN(*pSectionDisabledBg, Color::GetColor(COLOR_ID_MAGENTA), bgColor);
2261 pReplacementSectionBg = Tizen::Graphics::_BitmapImpl::GetColorReplacedBitmapN(*pSectionBg, Color::GetColor(COLOR_ID_MAGENTA), bgColor);
2263 DrawBitmap(*pCanvas, FloatRectangle(0.0f, 0.0f, bounds.width, bounds.height), *pReplacementSectionBg);
2266 if (__pDrawingProperty->groupedLookEnabled == true)
2270 float barWidth = 0.0f;
2271 float barMargin = 0.0f;
2273 GET_COLOR_CONFIG(TABLEVIEW::GROUPITEM_BAR_NORMAL, barColor);
2274 GET_SHAPE_CONFIG(TABLEVIEW::GROUPITEM_BAR_WIDTH, _CONTROL_ORIENTATION_PORTRAIT, barWidth);
2275 GET_SHAPE_CONFIG(TABLEVIEW::GROUPITEM_BAR_TOP_MARGIN, _CONTROL_ORIENTATION_PORTRAIT, barMargin);
2277 pCanvas->FillRectangle(barColor, FloatRectangle(0.0f, barMargin, barWidth, bounds.height-barMargin));
2282 delete pSectionPressBg;
2283 delete pSectionDisabledBg;
2284 delete pReplacementSectionPressBg;
2285 delete pReplacementSectionBg;
2290 _TableViewItem::DrawSectionStyleBackgroundCover(void)
2292 if (!__pDrawingProperty->sectionStyleEnabled ||
2293 __pItemCover == null)
2298 Bitmap* pSectionBgCoverEf = null;
2299 Bitmap* pReplacementSectionBgEf = null;
2300 Bitmap* pReplacementSectionBg = null;
2301 Bitmap* pSectionBgCoverBg = null;
2302 Bitmap* pMergeBitmap = null;
2303 Canvas* pCanvas = null;
2306 result r = E_SUCCESS;
2307 FloatRectangle bounds = GetBoundsF();
2308 if (__itemType == TABLE_VIEW_ITEM_TYPE_ONE)
2310 r = GET_BITMAP_CONFIG_N(TABLEVIEW::SECTIONITEM_SINGLE_COVER_BG_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, pSectionBgCoverEf);
2312 else if (__itemType == TABLE_VIEW_ITEM_TYPE_TOP)
2314 r = GET_BITMAP_CONFIG_N(TABLEVIEW::SECTIONITEM_TOP_COVER_BG_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, pSectionBgCoverEf);
2316 else if (__itemType == TABLE_VIEW_ITEM_TYPE_MIDDLE)
2318 r = GET_BITMAP_CONFIG_N(TABLEVIEW::SECTIONITEM_CENTER_COVER_BG_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, pSectionBgCoverEf);
2320 else if (__itemType == TABLE_VIEW_ITEM_TYPE_BOTTOM)
2322 r = GET_BITMAP_CONFIG_N(TABLEVIEW::SECTIONITEM_BOTTOM_COVER_BG_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, pSectionBgCoverEf);
2328 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , E_SYSTEM, "[E_SYSTEM] SectionStyle image load failed");
2330 if (__itemType == TABLE_VIEW_ITEM_TYPE_ONE)
2332 r = GET_BITMAP_CONFIG_N(TABLEVIEW::SECTIONITEM_SINGLE_COVER_ROUND_BG_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, pSectionBgCoverBg);
2334 else if (__itemType == TABLE_VIEW_ITEM_TYPE_TOP)
2336 r = GET_BITMAP_CONFIG_N(TABLEVIEW::SECTIONITEM_TOP_COVER_ROUND_BG_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, pSectionBgCoverBg);
2338 else if (__itemType == TABLE_VIEW_ITEM_TYPE_MIDDLE)
2340 r = GET_BITMAP_CONFIG_N(TABLEVIEW::SECTIONITEM_CENTER_COVER_ROUND_BG_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, pSectionBgCoverBg);
2342 else if (__itemType == TABLE_VIEW_ITEM_TYPE_BOTTOM)
2344 r = GET_BITMAP_CONFIG_N(TABLEVIEW::SECTIONITEM_BOTTOM_COVER_ROUND_BG_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, pSectionBgCoverBg);
2350 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , E_SYSTEM, "[E_SYSTEM] SectionStyle image load failed");
2352 __pItemCover->SetBounds(FloatRectangle(0.0f, 0.0f, bounds.width, bounds.height));
2356 _TableView* pParent = dynamic_cast<_TableView*>(GetParent());
2357 SysTryCatch(NID_UI_CTRL, pParent != null, , E_SYSTEM, "[E_SYSTEM] SectionTableView load failed");
2359 bgColor = pParent->GetBackgroundColor();
2363 GET_COLOR_CONFIG(TABLEVIEW::ITEM_BG_DISABLED, bgColor);
2366 pReplacementSectionBg = Tizen::Graphics::_BitmapImpl::GetColorReplacedBitmapN(*pSectionBgCoverBg, Color::GetColor(COLOR_ID_MAGENTA), bgColor);
2367 pReplacementSectionBgEf = Tizen::Graphics::_BitmapImpl::GetColorReplacedBitmapN(*pSectionBgCoverEf, Color::GetColor(COLOR_ID_MAGENTA), bgColor);
2369 pCanvas = new (std::nothrow) Canvas();
2370 SysTryCatch(NID_UI_CTRL, pCanvas != null, , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient.");
2372 pCanvas->Construct(FloatRectangle(0.0f, 0.0f, bounds.width, bounds.height));
2373 pCanvas->SetBackgroundColor(Color(0, 0, 0, 0));
2376 DrawBitmap(*pCanvas, FloatRectangle(0.0f, 0.0f, bounds.width, bounds.height), *pReplacementSectionBg);
2377 DrawBitmap(*pCanvas, FloatRectangle(0.0f, 0.0f, bounds.width, bounds.height), *pReplacementSectionBgEf);
2379 pMergeBitmap = new (std::nothrow) Bitmap();
2380 SysTryCatch(NID_UI_CTRL, pMergeBitmap != null, , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient.");
2382 pMergeBitmap->Construct(*pCanvas, FloatRectangle(0.0f, 0.0f, bounds.width, bounds.height));
2384 _BitmapImpl::ConvertToNonpremultiplied(*pMergeBitmap, true);
2386 __pItemCover->SetBackgroundBitmap(*pMergeBitmap);
2389 delete pSectionBgCoverEf;
2390 delete pReplacementSectionBgEf;
2391 delete pReplacementSectionBg;
2392 delete pSectionBgCoverBg;
2394 delete pMergeBitmap;
2398 _TableViewItem::DrawContextItemBackground(void)
2400 Canvas* pCanvas = null;
2401 Bitmap* pContextBg = null;
2402 Bitmap* pContextBgEf = null;
2403 Bitmap* pReplacementContextBg = null;
2404 Color bgColor = __colorItemBg[__drawingStatus];
2406 FloatRectangle bounds = GetBoundsF();
2407 result r = E_SUCCESS;
2409 r = GET_BITMAP_CONFIG_N(TABLEVIEW::QUICK_MENU_BG_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, pContextBg);
2410 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , E_SYSTEM, "[E_SYSTEM] ContextItem image load failed");
2412 r = GET_BITMAP_CONFIG_N(TABLEVIEW::QUICK_MENU_BG_EFFECT, BITMAP_PIXEL_FORMAT_ARGB8888, pContextBgEf);
2413 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , E_SYSTEM, "[E_SYSTEM] ContextItem image load failed");
2415 pCanvas = GetVisualElement()->GetCanvasN();
2416 SysTryCatch(NID_UI_CTRL, pCanvas != null, , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient.");
2418 pCanvas->SetBackgroundColor(Color(0, 0, 0, 0));
2425 GET_COLOR_CONFIG(TABLEVIEW::CONTEXTITEM_BG_NORMAL, bgColor);
2430 GET_COLOR_CONFIG(TABLEVIEW::ITEM_BG_DISABLED, bgColor);
2432 pReplacementContextBg = Tizen::Graphics::_BitmapImpl::GetColorReplacedBitmapN(*pContextBg, Color::GetColor(COLOR_ID_MAGENTA), bgColor);
2433 SysTryCatch(NID_UI_CTRL, pReplacementContextBg != null, , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient.");
2435 DrawBitmap(*pCanvas, FloatRectangle(0.0f, 0.0f, bounds.width, bounds.height), *pReplacementContextBg);
2436 DrawBitmap(*pCanvas, FloatRectangle(0.0f, 0.0f, bounds.width, bounds.height), *pContextBgEf);
2441 delete pContextBgEf;
2442 delete pReplacementContextBg;
2447 _TableViewItem::CreateAnnexStyle(void)
2449 switch (__annexStyle)
2451 case TABLE_VIEW_ANNEX_STYLE_MARK:
2454 case TABLE_VIEW_ANNEX_STYLE_RADIO:
2457 case TABLE_VIEW_ANNEX_STYLE_ONOFF_SLIDING:
2458 CreateOnOffButton();
2460 case TABLE_VIEW_ANNEX_STYLE_ONOFF_SLIDING_WITH_DIVIDER:
2461 CreateItemAnnexDivider();
2462 CreateOnOffButton();
2464 case TABLE_VIEW_ANNEX_STYLE_DETAILED:
2465 CreateDetailButton();
2473 _TableViewItem::DrawAnnexStyle(void)
2475 switch (__annexStyle)
2477 case TABLE_VIEW_ANNEX_STYLE_MARK:
2480 case TABLE_VIEW_ANNEX_STYLE_RADIO:
2483 case TABLE_VIEW_ANNEX_STYLE_ONOFF_SLIDING:
2486 case TABLE_VIEW_ANNEX_STYLE_ONOFF_SLIDING_WITH_DIVIDER:
2487 DrawItemAnnexDivider();
2490 case TABLE_VIEW_ANNEX_STYLE_DETAILED:
2499 _TableViewItem::DrawCheckBox(void)
2501 Bitmap* pCheckBox = null;
2502 Bitmap* pCheckBoxBg = null;
2503 Bitmap* pMergeBitmap = null;
2504 Canvas* pCanvas = null;
2505 result r = E_SUCCESS;
2507 FloatRectangle bounds;
2508 float annexWidth = 0.0f;
2509 float annexHeight = 0.0f;
2513 if (__drawingStatus == TABLE_VIEW_ITEM_DRAWING_STATUS_NORMAL)
2515 r = GET_BITMAP_CONFIG_N(TABLEVIEW::CHECKBOX_BG_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, pCheckBoxBg);
2516 SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS) && (pCheckBoxBg != null), , E_SYSTEM, "[%s] Propagating.", GetErrorMessage(r));
2518 r = GET_BITMAP_CONFIG_N(TABLEVIEW::CHECKBOX_CHECK_MARK_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, pCheckBox);
2519 SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS) && (pCheckBox != null), , E_SYSTEM, "[%s] Propagating.", GetErrorMessage(r));
2521 else if ((__drawingStatus == TABLE_VIEW_ITEM_DRAWING_STATUS_PRESSED) || (__drawingStatus == TABLE_VIEW_ITEM_DRAWING_STATUS_HIGHLIGHTED))
2523 r = GET_BITMAP_CONFIG_N(TABLEVIEW::CHECKBOX_BG_PRESSED, BITMAP_PIXEL_FORMAT_ARGB8888, pCheckBoxBg);
2524 SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS) && (pCheckBoxBg != null), , E_SYSTEM, "[%s] Propagating.", GetErrorMessage(r));
2526 r = GET_BITMAP_CONFIG_N(TABLEVIEW::CHECKBOX_CHECK_MARK_PRESSED, BITMAP_PIXEL_FORMAT_ARGB8888, pCheckBox);
2527 SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS) && (pCheckBox != null), , E_SYSTEM, "[%s] Propagating.", GetErrorMessage(r));
2533 r = GET_BITMAP_CONFIG_N(TABLEVIEW::CHECKBOX_BG_DISABLED, BITMAP_PIXEL_FORMAT_ARGB8888, pCheckBoxBg);
2534 SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS) && (pCheckBoxBg != null), , E_SYSTEM, "[%s] Propagating.", GetErrorMessage(r));
2536 r = GET_BITMAP_CONFIG_N(TABLEVIEW::CHECKBOX_CHECK_MARK_DISABLED, BITMAP_PIXEL_FORMAT_ARGB8888, pCheckBox);
2537 SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS) && (pCheckBox != null), , E_SYSTEM, "[%s] Propagating.", GetErrorMessage(r));
2540 GET_SHAPE_CONFIG(TABLEVIEW::ITEM_ANNEX_WIDTH, _CONTROL_ORIENTATION_PORTRAIT, annexWidth);
2541 GET_SHAPE_CONFIG(TABLEVIEW::ITEM_ANNEX_HEIGHT, _CONTROL_ORIENTATION_PORTRAIT, annexHeight);
2543 bounds.SetBounds(0.0f, 0.0f, annexWidth, annexHeight);
2545 pCanvas = new (std::nothrow) Canvas();
2546 SysTryCatch(NID_UI_CTRL, pCanvas != null, , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient.");
2548 pCanvas->Construct(bounds);
2549 pCanvas->SetBackgroundColor(Color(0, 0, 0, 0));
2552 DrawBitmap(*pCanvas, CalculateAnnexBitmapBounds(annexWidth, annexHeight, *pCheckBoxBg), *pCheckBoxBg);
2554 if (__isCheckedAnimationEnabled == true)
2556 StartCheckBoxAnimation();
2560 if (IsChecked() == true && pCheckBox != null)
2562 DrawBitmap(*pCanvas, CalculateAnnexBitmapBounds(annexWidth, annexHeight, *pCheckBox), *pCheckBox);
2566 pMergeBitmap = new (std::nothrow) Bitmap();
2567 SysTryCatch(NID_UI_CTRL, pMergeBitmap != null, , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient.");
2569 pMergeBitmap->Construct(*pCanvas, bounds);
2570 _BitmapImpl::ConvertToNonpremultiplied(*pMergeBitmap, true);
2572 __pItemAnnex->SetBackgroundBitmap(*pMergeBitmap);
2573 __pItemAnnex->Invalidate(false);
2578 delete pMergeBitmap;
2585 _TableViewItem::DrawRadioBox(void)
2587 Bitmap* pRadioButton = null;
2588 Bitmap* pRadioButtonBg = null;
2589 Bitmap* pMergeBitmap = null;
2590 Canvas* pCanvas = null;
2591 result r = E_SUCCESS;
2593 FloatRectangle bounds;
2594 float annexWidth = 0.0f;
2595 float annexHeight = 0.0f;
2599 if (__drawingStatus == TABLE_VIEW_ITEM_DRAWING_STATUS_NORMAL)
2601 r = GET_BITMAP_CONFIG_N(TABLEVIEW::RADIOBUTTON_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, pRadioButtonBg);
2602 SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS) && (pRadioButtonBg != null), , E_SYSTEM, "[E_SYSTEM] RadioButtonBg image load failed");
2604 r = GET_BITMAP_CONFIG_N(TABLEVIEW::RADIOBUTTON_BUTTON_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, pRadioButton);
2605 SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS) && (pRadioButton != null), , E_SYSTEM, "[E_SYSTEM] CheckBox image load failed");
2607 else if ((__drawingStatus == TABLE_VIEW_ITEM_DRAWING_STATUS_PRESSED) || (__drawingStatus == TABLE_VIEW_ITEM_DRAWING_STATUS_HIGHLIGHTED))
2609 r = GET_BITMAP_CONFIG_N(TABLEVIEW::RADIOBUTTON_PRESSED, BITMAP_PIXEL_FORMAT_ARGB8888, pRadioButtonBg);
2610 SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS) && (pRadioButtonBg != null), , E_SYSTEM, "[E_SYSTEM] RadioButtonBg image load failed");
2612 r = GET_BITMAP_CONFIG_N(TABLEVIEW::RADIOBUTTON_BUTTON_PRESSED, BITMAP_PIXEL_FORMAT_ARGB8888, pRadioButton);
2613 SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS) && (pRadioButton != null), , E_SYSTEM, "[E_SYSTEM] CheckBox image load failed");
2618 r = GET_BITMAP_CONFIG_N(TABLEVIEW::RADIOBUTTON_NORMAL_DISABLED, BITMAP_PIXEL_FORMAT_ARGB8888, pRadioButtonBg);
2619 SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS) && (pRadioButtonBg != null), , E_SYSTEM, "[E_SYSTEM] RadioButtonBg image load failed");
2621 r = GET_BITMAP_CONFIG_N(TABLEVIEW::RADIOBUTTON_BUTTON_DISABLED, BITMAP_PIXEL_FORMAT_ARGB8888, pRadioButton);
2622 SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS) && (pRadioButton != null), , E_SYSTEM, "[E_SYSTEM] CheckBox image load failed");
2625 GET_SHAPE_CONFIG(TABLEVIEW::ITEM_ANNEX_WIDTH, _CONTROL_ORIENTATION_PORTRAIT, annexWidth);
2626 GET_SHAPE_CONFIG(TABLEVIEW::ITEM_ANNEX_HEIGHT, _CONTROL_ORIENTATION_PORTRAIT, annexHeight);
2627 bounds.SetBounds(0.0f, 0.0f, annexWidth, annexHeight);
2629 pCanvas = new (std::nothrow) Canvas();
2630 SysTryCatch(NID_UI_CTRL, pCanvas != null, , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient.");
2632 pCanvas->Construct(bounds);
2633 pCanvas->SetBackgroundColor(Color(0, 0, 0, 0));
2636 DrawBitmap(*pCanvas, CalculateAnnexBitmapBounds(annexWidth, annexHeight, *pRadioButtonBg), *pRadioButtonBg);
2638 if (pRadioButton != null && IsChecked() == true)
2640 DrawBitmap(*pCanvas, CalculateAnnexBitmapBounds(annexWidth, annexHeight, *pRadioButton), *pRadioButton);
2643 pMergeBitmap = new (std::nothrow) Bitmap();
2644 SysTryCatch(NID_UI_CTRL, pMergeBitmap != null, , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient.");
2646 pMergeBitmap->Construct(*pCanvas, bounds);
2647 _BitmapImpl::ConvertToNonpremultiplied(*pMergeBitmap, true);
2649 __pItemAnnex->SetBackgroundBitmap(*pMergeBitmap);
2650 __pItemAnnex->Invalidate(false);
2653 delete pRadioButton;
2654 delete pRadioButtonBg;
2655 delete pMergeBitmap;
2662 _TableViewItem::DrawOnOffButton(void)
2664 Bitmap* pOnOffButton = null;
2665 Bitmap* pOnOffButtonHandler = null;
2666 Bitmap* pMergeBitmap = null;
2667 Canvas* pCanvas = null;
2668 result r = E_SUCCESS;
2670 FloatRectangle bounds;
2671 FloatRectangle backgroundBounds;
2672 FloatRectangle handlerBounds;
2673 float annexWidth = 0.0f;
2674 float annexHeight = 0.0f;
2675 float annexMargin = 0.0f;
2677 if (IsChecked() == true)
2681 r = GET_BITMAP_CONFIG_N(TABLEVIEW::ONOFFBUTTON_ON, BITMAP_PIXEL_FORMAT_ARGB8888, pOnOffButton);
2685 r = GET_BITMAP_CONFIG_N(TABLEVIEW::ONOFFBUTTON_ON_DISABLED, BITMAP_PIXEL_FORMAT_ARGB8888, pOnOffButton);
2692 r = GET_BITMAP_CONFIG_N(TABLEVIEW::ONOFFBUTTON_OFF, BITMAP_PIXEL_FORMAT_ARGB8888, pOnOffButton);
2696 r = GET_BITMAP_CONFIG_N(TABLEVIEW::ONOFFBUTTON_OFF_DISABLED, BITMAP_PIXEL_FORMAT_ARGB8888, pOnOffButton);
2699 SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS) && (pOnOffButton != null), , E_SYSTEM, "[E_SYSTEM] OnOffButton_On image load failed");
2703 r = GET_BITMAP_CONFIG_N(TABLEVIEW::ONOFFBUTTON_HANDLER, BITMAP_PIXEL_FORMAT_ARGB8888, pOnOffButtonHandler);
2707 r = GET_BITMAP_CONFIG_N(TABLEVIEW::ONOFFBUTTON_HANDLER_DISABLED, BITMAP_PIXEL_FORMAT_ARGB8888, pOnOffButtonHandler);
2709 SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS) && (pOnOffButtonHandler != null), , E_SYSTEM, "[E_SYSTEM] OnOffHandlerButton button image load failed");
2711 GET_SHAPE_CONFIG(TABLEVIEW::ITEM_ANNEX_ONOFF_WIDTH, _CONTROL_ORIENTATION_PORTRAIT, annexWidth);
2712 GET_SHAPE_CONFIG(TABLEVIEW::ITEM_ANNEX_ONOFF_HEIGHT, _CONTROL_ORIENTATION_PORTRAIT, annexHeight);
2713 bounds.SetBounds(0, 0, annexWidth, annexHeight);
2715 pCanvas = new (std::nothrow) Canvas();
2716 SysTryCatch(NID_UI_CTRL, pCanvas != null, , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient.");
2718 pCanvas->Construct(bounds);
2719 pCanvas->SetBackgroundColor(Color(0, 0, 0, 0));
2722 backgroundBounds = CalculateAnnexBitmapBounds(annexWidth, annexHeight, *pOnOffButton);
2723 DrawBitmap(*pCanvas, backgroundBounds, *pOnOffButton);
2725 handlerBounds = CalculateAnnexBitmapBounds(annexWidth, annexHeight, *pOnOffButtonHandler);
2726 GET_SHAPE_CONFIG(TABLEVIEW::ITEM_ANNEX_ONOFF_MARGIN, _CONTROL_ORIENTATION_PORTRAIT, annexMargin);
2727 if (IsChecked() == true)
2729 handlerBounds.x = backgroundBounds.width - handlerBounds.width - annexMargin;
2730 handlerBounds.y = backgroundBounds.y - annexMargin;
2734 handlerBounds.x = backgroundBounds.x + annexMargin;
2735 handlerBounds.y = backgroundBounds.y - annexMargin;
2738 DrawBitmap(*pCanvas, handlerBounds, *pOnOffButtonHandler);
2740 pMergeBitmap = new (std::nothrow) Bitmap();
2741 SysTryCatch(NID_UI_CTRL, pMergeBitmap != null, , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient.");
2743 pMergeBitmap->Construct(*pCanvas, bounds);
2744 _BitmapImpl::ConvertToNonpremultiplied(*pMergeBitmap, true);
2746 __pItemAnnex->SetBackgroundBitmap(*pMergeBitmap);
2747 __pItemAnnex->Invalidate(false);
2750 delete pOnOffButton;
2751 delete pOnOffButtonHandler;
2752 delete pMergeBitmap;
2759 _TableViewItem::AdjustAnnexOnOffHandlerPosition()
2761 float annexWidth = 0.0f;
2762 float annexHeight = 0.0f;
2763 float annexMargin = 0.0f;
2765 float annexStartPosition = 0.0f;
2766 float annexEndPosition = 0.0f;
2767 float finalEndPosition = 0.0f;
2768 FloatRectangle handlerBounds;
2769 result r = E_SUCCESS;
2771 GET_SHAPE_CONFIG(TABLEVIEW::ITEM_ANNEX_ONOFF_MARGIN, _CONTROL_ORIENTATION_PORTRAIT, annexMargin);
2773 annexStartPosition = __pItemAnnex->GetBoundsF().x;
2774 annexEndPosition = __pItemAnnex->GetBoundsF().x + __pItemAnnex->GetBoundsF().width + annexMargin;
2776 Bitmap* pOnOffButtonHandler = null;
2777 r = GET_BITMAP_CONFIG_N(TABLEVIEW::ONOFFBUTTON_HANDLER, BITMAP_PIXEL_FORMAT_ARGB8888, pOnOffButtonHandler);
2778 SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS) && (pOnOffButtonHandler != null), , E_SYSTEM, "[E_SYSTEM] OnOffHandlerButton button image load failed");
2780 GET_SHAPE_CONFIG(TABLEVIEW::ITEM_ANNEX_ONOFF_WIDTH, _CONTROL_ORIENTATION_PORTRAIT, annexWidth);
2781 GET_SHAPE_CONFIG(TABLEVIEW::ITEM_ANNEX_ONOFF_HEIGHT, _CONTROL_ORIENTATION_PORTRAIT, annexHeight);
2783 handlerBounds = CalculateAnnexBitmapBounds(annexWidth, annexHeight, *pOnOffButtonHandler);
2785 if(__annexOnOffHandlerMoved)
2787 if(annexStartPosition < __annexOnOffHandlerLastPosition
2788 && annexEndPosition > __annexOnOffHandlerLastPosition)
2790 if(((annexEndPosition - annexStartPosition) / 2) < __annexOnOffHandlerLastPosition - annexStartPosition + (handlerBounds.width / 2)) // +++ check floating
2792 finalEndPosition = annexEndPosition;
2797 finalEndPosition = annexStartPosition;
2803 if(annexEndPosition < __annexOnOffHandlerLastPosition)
2805 finalEndPosition = annexEndPosition;
2810 finalEndPosition = annexStartPosition;
2817 SetChecked(!IsChecked());
2820 finalEndPosition = annexEndPosition;
2824 finalEndPosition = annexStartPosition;
2828 DrawAnnexOnOffHandler(finalEndPosition);
2831 delete pOnOffButtonHandler;
2837 _TableViewItem::DrawAnnexOnOffHandler(float position)
2839 if (__pItemAnnex == null)
2844 Bitmap* pOnOffButton = null;
2845 Bitmap* pOnOffButtonHandler = null;
2846 Bitmap* pMergeBitmap = null;
2847 Canvas* pCanvas = null;
2848 result r = E_SUCCESS;
2850 FloatRectangle bounds;
2851 FloatRectangle backgroundBounds;
2852 FloatRectangle handlerBounds;
2853 float annexWidth = 0.0f;
2854 float annexHeight = 0.0f;
2855 float annexMargin = 0.0f;
2856 float annexAbsoluteBoundsStart = 0.0f;
2857 float annexAbsoluteBoundsEnd = 0.0f;
2858 float nextHandlerBounds = 0;
2860 r = GET_BITMAP_CONFIG_N(TABLEVIEW::ONOFFBUTTON_HANDLER, BITMAP_PIXEL_FORMAT_ARGB8888, pOnOffButtonHandler);
2861 SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS) && (pOnOffButtonHandler != null), , E_SYSTEM, "[E_SYSTEM] OnOffHandlerButton button image load failed");
2863 if (IsChecked() == true)
2865 r = GET_BITMAP_CONFIG_N(TABLEVIEW::ONOFFBUTTON_ON, BITMAP_PIXEL_FORMAT_ARGB8888, pOnOffButton);
2869 r = GET_BITMAP_CONFIG_N(TABLEVIEW::ONOFFBUTTON_OFF, BITMAP_PIXEL_FORMAT_ARGB8888, pOnOffButton);
2871 SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS) && (pOnOffButton != null), , E_SYSTEM, "[E_SYSTEM] OnOffButton_On image load failed");
2873 GET_SHAPE_CONFIG(TABLEVIEW::ITEM_ANNEX_ONOFF_WIDTH, _CONTROL_ORIENTATION_PORTRAIT, annexWidth);
2874 GET_SHAPE_CONFIG(TABLEVIEW::ITEM_ANNEX_ONOFF_HEIGHT, _CONTROL_ORIENTATION_PORTRAIT, annexHeight);
2875 GET_SHAPE_CONFIG(TABLEVIEW::ITEM_ANNEX_ONOFF_MARGIN, _CONTROL_ORIENTATION_PORTRAIT, annexMargin);
2877 bounds.SetBounds(0, 0, annexWidth, annexHeight);
2879 pCanvas = new (std::nothrow) Canvas();
2880 SysTryCatch(NID_UI_CTRL, pCanvas != null, , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient.");
2882 pCanvas->Construct(bounds);
2883 pCanvas->SetBackgroundColor(Color(0, 0, 0, 0));
2886 backgroundBounds = CalculateAnnexBitmapBounds(annexWidth, annexHeight, *pOnOffButton);
2887 DrawBitmap(*pCanvas, backgroundBounds, *pOnOffButton);
2889 handlerBounds = CalculateAnnexBitmapBounds(annexWidth, annexHeight, *pOnOffButtonHandler);
2890 handlerBounds.y = backgroundBounds.y - annexMargin;
2894 handlerBounds.x = backgroundBounds.width - handlerBounds.width - annexMargin;
2898 handlerBounds.x = backgroundBounds.x + annexMargin;
2901 nextHandlerBounds = handlerBounds.x + (position - __annexOnOffTouchPosition);
2902 annexAbsoluteBoundsStart = __pItemAnnex->GetBoundsF().x;
2903 annexAbsoluteBoundsEnd = __pItemAnnex->GetBoundsF().x + __pItemAnnex->GetBoundsF().width + annexMargin;
2905 if((annexAbsoluteBoundsStart + nextHandlerBounds + handlerBounds.width) < annexAbsoluteBoundsEnd &&
2906 (annexAbsoluteBoundsStart + nextHandlerBounds) > annexAbsoluteBoundsStart)
2908 handlerBounds.x = nextHandlerBounds;
2909 __annexOnOffHandlerLastPosition = annexAbsoluteBoundsStart + nextHandlerBounds;
2911 else if(_FloatCompareGE((annexAbsoluteBoundsStart + nextHandlerBounds + handlerBounds.width), annexAbsoluteBoundsEnd))
2913 handlerBounds.x = backgroundBounds.width - handlerBounds.width - annexMargin;
2915 else if(_FloatCompareLE((annexAbsoluteBoundsStart + nextHandlerBounds), annexAbsoluteBoundsStart))
2917 handlerBounds.x = backgroundBounds.x + annexMargin;
2920 DrawBitmap(*pCanvas, handlerBounds, *pOnOffButtonHandler);
2922 pMergeBitmap = new (std::nothrow) Bitmap();
2923 SysTryCatch(NID_UI_CTRL, pMergeBitmap != null, , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient.");
2925 pMergeBitmap->Construct(*pCanvas, bounds);
2926 _BitmapImpl::ConvertToNonpremultiplied(*pMergeBitmap, true);
2928 __pItemAnnex->SetBackgroundBitmap(*pMergeBitmap);
2929 __pItemAnnex->Invalidate(false);
2932 delete pOnOffButton;
2933 delete pOnOffButtonHandler;
2934 delete pMergeBitmap;
2941 _TableViewItem::DrawDetailButton(void)
2943 Bitmap* pDetail = null;
2944 Bitmap* pDetailBg = null;
2945 Bitmap* pDetailBgEffect = null;
2946 Bitmap* pDetailEffect = null;
2947 Bitmap* pReplacementDetail = null;
2948 Bitmap* pReplacementDetailBg = null;
2949 Bitmap* pMergeBitmap = null;
2950 Canvas* pCanvas = null;
2951 Color replacementNewColor;
2952 Color replacementNewBgColor;
2953 result r = E_SUCCESS;
2955 FloatRectangle bounds;
2956 float annexWidth = 0.0f;
2957 float annexHeight = 0.0f;
2958 bool themeBackgroundBitmap = false;
2960 themeBackgroundBitmap = IS_CUSTOM_BITMAP(TABLEVIEW::CIRCLE_BUTTON_BG_NORMAL);
2964 r = GET_BITMAP_CONFIG_N(TABLEVIEW::CIRCLE_BUTTON_BG_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, pDetailBg);
2965 SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS) && (pDetailBg != null), , E_SYSTEM, "[E_SYSTEM] Detail button image load failed");
2967 if (__isSelectedDetailButton)
2969 if (!themeBackgroundBitmap)
2971 r = GET_BITMAP_CONFIG_N(TABLEVIEW::CIRCLE_BUTTON_BG_PRESSED, BITMAP_PIXEL_FORMAT_ARGB8888, pDetailBgEffect);
2972 SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS) && (pDetailBgEffect != null), , E_SYSTEM, "[E_SYSTEM] Detail button image load failed");
2974 r = GET_BITMAP_CONFIG_N(TABLEVIEW::CIRCLE_BUTTON_REVEAL_EFFECT, BITMAP_PIXEL_FORMAT_ARGB8888, pDetailEffect);
2975 SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS) && (pDetailEffect != null), , E_SYSTEM, "[E_SYSTEM] Detail button image load failed");
2978 r = GET_BITMAP_CONFIG_N(TABLEVIEW::CIRCLE_BUTTON_REVEAL_PRESSED, BITMAP_PIXEL_FORMAT_ARGB8888, pDetail);
2979 SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS) && (pDetail != null), , E_SYSTEM, "[E_SYSTEM] Detail button image load failed");
2981 GET_COLOR_CONFIG(TABLEVIEW::ITEM_ANNEX_DETAIL_PRESSED, replacementNewColor);
2982 GET_COLOR_CONFIG(TABLEVIEW::ITEM_ANNEX_DETAIL_BG_PRESSED, replacementNewBgColor);
2986 if (!themeBackgroundBitmap)
2988 r = GET_BITMAP_CONFIG_N(TABLEVIEW::CIRCLE_BUTTON_BG_EFFECT, BITMAP_PIXEL_FORMAT_ARGB8888, pDetailBgEffect);
2989 SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS) && (pDetailBgEffect != null), , E_SYSTEM, "[E_SYSTEM] Detail button image load failed");
2991 r = GET_BITMAP_CONFIG_N(TABLEVIEW::CIRCLE_BUTTON_REVEAL_EFFECT, BITMAP_PIXEL_FORMAT_ARGB8888, pDetailEffect);
2992 SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS) && (pDetailEffect != null), , E_SYSTEM, "[E_SYSTEM] Detail button image load failed");
2995 r = GET_BITMAP_CONFIG_N(TABLEVIEW::CIRCLE_BUTTON_REVEAL_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, pDetail);
2996 SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS) && (pDetail != null), , E_SYSTEM, "[E_SYSTEM] Detail button image load failed");
2998 GET_COLOR_CONFIG(TABLEVIEW::ITEM_ANNEX_DETAIL_NORMAL, replacementNewColor);
2999 GET_COLOR_CONFIG(TABLEVIEW::ITEM_ANNEX_DETAIL_BG_NORMAL, replacementNewBgColor);
3005 if (!themeBackgroundBitmap)
3007 r = GET_BITMAP_CONFIG_N(TABLEVIEW::CIRCLE_BUTTON_BG_EFFECT_DISABLED, BITMAP_PIXEL_FORMAT_ARGB8888, pDetailBgEffect);
3008 SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS) && (pDetailBgEffect != null), , E_SYSTEM, "[E_SYSTEM] Detail button image load failed");
3010 r = GET_BITMAP_CONFIG_N(TABLEVIEW::CIRCLE_BUTTON_REVEAL_EFFECT, BITMAP_PIXEL_FORMAT_ARGB8888, pDetailEffect);
3011 SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS) && (pDetailEffect != null), , E_SYSTEM, "[E_SYSTEM] Detail button image load failed");
3014 r = GET_BITMAP_CONFIG_N(TABLEVIEW::CIRCLE_BUTTON_REVEAL_DISABLED, BITMAP_PIXEL_FORMAT_ARGB8888, pDetail);
3015 SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS) && (pDetail != null), , E_SYSTEM, "[E_SYSTEM] Detail button image load failed");
3017 r = GET_BITMAP_CONFIG_N(TABLEVIEW::CIRCLE_BUTTON_BG_DISABLED, BITMAP_PIXEL_FORMAT_ARGB8888, pDetailBg);
3018 SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS) && (pDetailBg != null), , E_SYSTEM, "[E_SYSTEM] Detail button image load failed");
3020 GET_COLOR_CONFIG(TABLEVIEW::ITEM_ANNEX_DETAIL_NORMAL, replacementNewColor);
3022 pReplacementDetailBg = Tizen::Graphics::_BitmapImpl::GetColorReplacedBitmapN(*pDetailBg, Color::GetColor(COLOR_ID_MAGENTA), replacementNewBgColor);
3023 SysTryCatch(NID_UI_CTRL, pReplacementDetailBg != null, r = E_SYSTEM, E_SYSTEM, "[E_SYSTEM] Detail button image load failed");
3025 pReplacementDetail = Tizen::Graphics::_BitmapImpl::GetColorReplacedBitmapN(*pDetail, Color::GetColor(COLOR_ID_MAGENTA), replacementNewColor);
3026 SysTryCatch(NID_UI_CTRL, pReplacementDetail != null, r = E_SYSTEM, E_SYSTEM, "[E_SYSTEM] Detail button image load failed");
3028 GET_SHAPE_CONFIG(TABLEVIEW::ITEM_ANNEX_MORE_WIDTH, _CONTROL_ORIENTATION_PORTRAIT, annexWidth);
3029 GET_SHAPE_CONFIG(TABLEVIEW::ITEM_ANNEX_MORE_HEIGHT, _CONTROL_ORIENTATION_PORTRAIT, annexHeight);
3031 bounds.SetBounds(0, 0, annexWidth, annexHeight);
3033 pCanvas = new (std::nothrow) Canvas();
3034 SysTryCatch(NID_UI_CTRL, pCanvas != null, , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient.");
3036 pCanvas->Construct(bounds);
3037 pCanvas->SetBackgroundColor(Color(0, 0, 0, 0));
3040 DrawBitmap(*pCanvas, CalculateAnnexBitmapBounds(annexWidth, annexHeight, *pReplacementDetailBg), *pReplacementDetailBg);
3041 if (pDetailBgEffect)
3043 DrawBitmap(*pCanvas, CalculateAnnexBitmapBounds(annexWidth, annexHeight, *pDetailBgEffect), *pDetailBgEffect);
3045 DrawBitmap(*pCanvas, CalculateAnnexBitmapBounds(annexWidth, annexHeight, *pReplacementDetail), *pReplacementDetail);
3048 DrawBitmap(*pCanvas, CalculateAnnexBitmapBounds(annexWidth, annexHeight, *pDetailEffect), *pDetailEffect);
3051 pMergeBitmap = new (std::nothrow) Bitmap();
3052 SysTryCatch(NID_UI_CTRL, pMergeBitmap != null, , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient.");
3054 pMergeBitmap->Construct(*pCanvas, bounds);
3055 _BitmapImpl::ConvertToNonpremultiplied(*pMergeBitmap, true);
3057 __pItemAnnex->SetBackgroundBitmap(*pMergeBitmap);
3058 __pItemAnnex->Invalidate(false);
3063 delete pDetailBgEffect;
3064 delete pDetailEffect;
3065 delete pReplacementDetail;
3066 delete pReplacementDetailBg;
3067 delete pMergeBitmap;
3074 _TableViewItem::DrawItemDivider(void)
3076 if(__pItemDivider == null || __pItemTopDivider == null)
3081 if (__pDrawingProperty->itemDividerEnabled == false ||
3082 __itemType == TABLE_VIEW_ITEM_TYPE_HEADER ||
3083 __itemType == TABLE_VIEW_ITEM_TYPE_FOOTER ||
3084 __itemDividerEnabled == false)
3086 __pItemDivider->SetVisibleState(false);
3087 __pItemTopDivider->SetVisibleState(false);
3092 FloatRectangle dividerBottomBounds;
3093 FloatRectangle dividerTopBounds;
3095 Color bottomLineColor;
3096 Color customDividerColor;
3097 FloatRectangle bounds;
3098 FloatPoint bottomPoint;
3100 __pItemDivider->SetVisibleState(true);
3101 __pItemTopDivider->SetVisibleState(true);
3103 if( __drawingStatus == TABLE_VIEW_ITEM_DRAWING_STATUS_PRESSED ||
3104 __drawingStatus == TABLE_VIEW_ITEM_DRAWING_STATUS_HIGHLIGHTED)
3106 if(__itemType != TABLE_VIEW_ITEM_TYPE_TITLE)
3108 __pItemDivider->SetVisibleState(false);
3111 __pItemTopDivider->SetVisibleState(false);
3114 if (__itemType == TABLE_VIEW_ITEM_TYPE_TITLE)
3116 if(__pItemBgBitmap[__drawingStatus] != null)
3118 __pItemDivider->SetVisibleState(false);
3122 float lineHeight = 0.0f;
3123 float lineLeftMargin = 0.0f;
3124 float lineBottomMargin = 0.0f;
3125 bounds = GetBoundsF();
3127 if (__drawingStatus == TABLE_VIEW_ITEM_DRAWING_STATUS_NORMAL)
3129 GET_COLOR_CONFIG(TABLEVIEW::GROUPITEM_INDEX_BAR_NORMAL, bottomLineColor);
3133 GET_COLOR_CONFIG(TABLEVIEW::GROUPITEM_INDEX_BAR_PRESSED, bottomLineColor);
3136 GET_SHAPE_CONFIG(TABLEVIEW::GROUPITEM_INDEX_BAR_HEIGHT, _CONTROL_ORIENTATION_PORTRAIT, lineHeight);
3137 GET_SHAPE_CONFIG(TABLEVIEW::GROUPITEM_INDEX_BAR_LEFT_MARGIN, _CONTROL_ORIENTATION_PORTRAIT, lineLeftMargin);
3138 GET_SHAPE_CONFIG(TABLEVIEW::GROUPITEM_INDEX_BAR_BOTTOM_MARGIN, _CONTROL_ORIENTATION_PORTRAIT, lineBottomMargin);
3140 lineHeight = Tizen::Graphics::CoordinateSystem::ConvertToLogicalY(lineHeight);
3141 lineBottomMargin = Tizen::Graphics::CoordinateSystem::ConvertToLogicalY(lineBottomMargin);
3142 bottomPoint = Tizen::Graphics::CoordinateSystem::AlignToDevice(FloatPoint(lineLeftMargin, bounds.height));
3143 dividerBottomBounds = FloatRectangle(bottomPoint.x, bottomPoint.y - lineBottomMargin, bounds.width - lineLeftMargin * 2, lineHeight);
3148 float lineLeftMargin = 0.0f;
3149 float lineHeight = 0.0f;
3150 bounds = GetBoundsF();
3151 int groupIndex = -1;
3154 GetItemIndex(groupIndex, itemIndex);
3158 __pItemTopDivider->SetVisibleState(false);
3161 if(!IsContextItem())
3163 if(__itemType == TABLE_VIEW_ITEM_TYPE_BOTTOM ||
3164 __itemType == TABLE_VIEW_ITEM_TYPE_ONE)
3166 __pItemDivider->SetVisibleState(false);
3170 customDividerColor = __pDrawingProperty->dividerColor;
3171 GET_COLOR_CONFIG(TABLEVIEW::ITEM_DIVIDER_TOP_BG_NORMAL, topLineColor);
3172 GET_COLOR_CONFIG(TABLEVIEW::ITEM_DIVIDER_BOTTOM_BG_NORMAL, bottomLineColor);
3173 GET_SHAPE_CONFIG(TABLEVIEW::GROUPITEM_INDEX_BAR_LEFT_MARGIN, _CONTROL_ORIENTATION_PORTRAIT, lineLeftMargin);
3174 GET_FIXED_VALUE_CONFIG(TABLEVIEW::ITEM_DIVIDER_HEIGHT, _CONTROL_ORIENTATION_PORTRAIT, lineHeight);
3176 lineHeight = Tizen::Graphics::CoordinateSystem::ConvertToLogicalY(lineHeight);
3177 bottomPoint = Tizen::Graphics::CoordinateSystem::AlignToDevice(FloatPoint(lineLeftMargin, (bounds.height)));
3179 dividerTopBounds.SetBounds(bottomPoint.x, 0.0f, bounds.width - lineLeftMargin * 2, lineHeight);
3180 dividerBottomBounds.SetBounds(bottomPoint.x, bottomPoint.y - lineHeight, bounds.width - lineLeftMargin * 2, lineHeight);
3183 if(__pItemDivider->GetVisibleState())
3185 __pItemDivider->SetBounds(dividerBottomBounds);
3186 if(customDividerColor == bottomLineColor || __itemType == TABLE_VIEW_ITEM_TYPE_TITLE)
3188 __pItemDivider->SetBackgroundColor(bottomLineColor);
3192 __pItemDivider->SetBackgroundColor(customDividerColor);
3193 __pItemDivider->GetVisualElement()->SetOpacity(ITEM_BOTTOM_DIVIDER_OPACITY);
3195 __pItemDivider->Invalidate();
3198 if(__pItemTopDivider->GetVisibleState())
3200 __pItemTopDivider->SetBounds(dividerTopBounds);
3201 if(customDividerColor == bottomLineColor)
3203 __pItemTopDivider->SetBackgroundColor(topLineColor);
3207 __pItemTopDivider->SetBackgroundColor(customDividerColor);
3208 __pItemTopDivider->GetVisualElement()->SetOpacity(ITEM_TOP_DIVIDER_OPACITY);
3210 __pItemTopDivider->Invalidate();
3215 _TableViewItem::DrawItemAnnexDivider(void)
3217 if (__itemType == TABLE_VIEW_ITEM_TYPE_HEADER || __itemType == TABLE_VIEW_ITEM_TYPE_FOOTER)
3219 if (__pItemAnnexLeftDivider != null)
3221 __pItemAnnexLeftDivider->SetVisibleState(false);
3224 if (__pItemAnnexRightDivider != null)
3226 __pItemAnnexRightDivider->SetVisibleState(false);
3231 Color dividerLeftColor;
3232 Color dividerRightColor;
3233 FloatRectangle bounds = GetBoundsF();
3234 float dividerHeight = 0;
3235 float itemHeight = 0;
3236 float dividerWidth = 0.0f;
3237 float dividerTopMargin = 0.0f;
3238 float annexWidth = 0.0f;
3239 float annexLeftMargin = 0.0f;
3240 float itemLeftMargin = 0.0f;
3242 GET_SHAPE_CONFIG(TABLEVIEW::ITEM_LEFT_MARGIN, _CONTROL_ORIENTATION_PORTRAIT, itemLeftMargin);
3243 GET_SHAPE_CONFIG(TABLEVIEW::ITEM_ANNEX_MARGIN, _CONTROL_ORIENTATION_PORTRAIT, annexLeftMargin);
3244 GET_SHAPE_CONFIG(TABLEVIEW::ITEM_ANNEX_ONOFF_WIDTH, _CONTROL_ORIENTATION_PORTRAIT, annexWidth);
3245 GET_COLOR_CONFIG(TABLEVIEW::ITEM_ANNEX_DIVIDER_LEFT_BG_NORMAL, dividerLeftColor);
3246 GET_COLOR_CONFIG(TABLEVIEW::ITEM_ANNEX_DIVIDER_RIGHT_BG_NORMAL, dividerRightColor);
3247 GET_FIXED_VALUE_CONFIG(TABLEVIEW::ITEM_ANNEX_DIVIDER_WIDTH, _CONTROL_ORIENTATION_PORTRAIT, dividerWidth);
3248 GET_FIXED_VALUE_CONFIG(TABLEVIEW::ITEM_ANNEX_DIVIDER_MARGIN, _CONTROL_ORIENTATION_PORTRAIT, dividerTopMargin);
3250 itemLeftMargin += __pDrawingProperty->scrollMargin;
3251 itemHeight = ((__customHeight > 0) ? __customHeight : GetBoundsF().height);
3252 dividerHeight = itemHeight - (dividerTopMargin*2);
3253 dividerHeight = (dividerHeight > 0) ? dividerHeight : 0;
3254 __pItemAnnexLeftDivider->SetBounds(FloatRectangle((GetBoundsF().width - annexWidth - (itemLeftMargin + annexLeftMargin) - (dividerWidth*2)), dividerTopMargin, dividerWidth, dividerHeight));
3255 __pItemAnnexLeftDivider->SetBackgroundColor(dividerLeftColor);
3256 __pItemAnnexLeftDivider->Invalidate();
3258 __pItemAnnexRightDivider->SetBounds(FloatRectangle((GetBoundsF().width - annexWidth - (itemLeftMargin + annexLeftMargin) - dividerWidth), dividerTopMargin, dividerWidth, dividerHeight));
3259 __pItemAnnexRightDivider->SetBackgroundColor(dividerRightColor);
3260 __pItemAnnexRightDivider->Invalidate();
3264 if (__pItemAnnexLeftDivider != null)
3266 _AccessibilityContainer* pContainer = __pItemAnnexLeftDivider->GetAccessibilityContainer();
3267 pContainer->Activate(false);
3270 if (__pItemAnnexRightDivider != null)
3272 _AccessibilityContainer* pContainer = __pItemAnnexRightDivider->GetAccessibilityContainer();
3273 pContainer->Activate(false);
3279 _TableViewItem::DrawBitmap(Canvas& canvas, const FloatRectangle& bounds, const Bitmap& bitmap)
3281 result r = E_SUCCESS;
3282 if (_BitmapImpl::CheckNinePatchedBitmapStrictly(bitmap))
3284 r = canvas.DrawNinePatchedBitmap(bounds, bitmap);
3285 SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Fail to draw ninepatched bitmap.", GetErrorMessage(r))
3289 r = canvas.DrawBitmap(bounds, bitmap);
3290 SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Fail to draw bitmap.", GetErrorMessage(r))
3297 _TableViewItem::SetItemHighlightBounds(_VisualElement& highlightVisualElement, const FloatRectangle& bounds)
3299 return highlightVisualElement.SetBounds(bounds);
3303 _TableViewItem::CalculateItemHighlightBounds(void)
3305 FloatRectangle itemBounds = GetBoundsF();
3306 return FloatRectangle(0.0f, 0.0f, itemBounds.width, itemBounds.height);
3310 _TableViewItem::CalculateAnnexBitmapBounds(float annexWidth, float annexHeight, const Bitmap& bitmap)
3312 FloatRectangle bounds;
3315 float leftMargin = 0;
3316 float topMargin = 0;
3318 if (annexWidth > bitmap.GetWidthF())
3320 leftMargin = (annexWidth - bitmap.GetWidthF()) / 2;
3321 width = bitmap.GetWidthF();
3328 if(annexHeight > bitmap.GetHeightF())
3330 topMargin = (annexHeight - bitmap.GetHeightF()) / 2;
3331 height = bitmap.GetHeightF();
3335 height = annexHeight;
3338 bounds.SetBounds(leftMargin, topMargin, width, height);
3344 _TableViewItem::IsTitleStyleItem(void) const
3346 if (__itemType == TABLE_VIEW_ITEM_TYPE_TITLE || __itemType == TABLE_VIEW_ITEM_TYPE_HEADER || __itemType == TABLE_VIEW_ITEM_TYPE_FOOTER)
3355 _TableViewItem::IsValidSelectionState(void)
3357 _TableView* pParent = dynamic_cast<_TableView*>(GetParent());
3358 if (pParent == null)
3363 if (pParent->GetPressedItemCount() > 0)
3372 _TableViewItem::DrawSimpleItem(void)
3374 if (__pSimpleItemText != null)
3376 Color textColor = __simpleItemTextColor[__drawingStatus];
3379 textColor = __simpleItemTextColor[TABLE_VIEW_SIMPLEITEM_DRAWING_STATUS_DISABLED];
3382 if (__itemType == TABLE_VIEW_ITEM_TYPE_TITLE)
3384 if (__drawingStatus == TABLE_VIEW_ITEM_DRAWING_STATUS_NORMAL)
3386 textColor = __simpleItemTextColor[TABLE_VIEW_GROUPITEM_DRAWING_STATUS_NORMAL];
3390 textColor = __simpleItemTextColor[TABLE_VIEW_GROUPITEM_DRAWING_STATUS_PRESSED];
3394 __pSimpleItemText->SetTextColor(textColor);
3395 __pSimpleItemText->Invalidate(false);
3399 _TableViewItem::SetSimpleItemContents(const Tizen::Base::String& text, const Tizen::Graphics::Bitmap* pBitmap, bool groupType)
3401 result r = E_SUCCESS;
3402 bool textOnly = true;
3404 if (pBitmap != null)
3409 r = CreateSimpleItemContents(textOnly);
3410 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
3412 FloatRectangle bitmapRect = FloatRectangle(0.0f, 0.0f, 0.0f, 0.0f);
3413 FloatRectangle textRect = FloatRectangle(0.0f, 0.0f, 0.0f, 0.0f);
3414 float leftMargin = 0.0f;
3415 float annexMargin = 0.0f;
3416 float elementWidth = 0;
3417 float elementHeight = 0;
3418 float itemHeight = __itemHeight;
3419 float annexWidth = GetAnnexWidth(__annexStyle);
3423 if (__simpleItemTextSize == 0)
3425 GET_SHAPE_CONFIG(TABLEVIEW::GROUPITEM_DEFAULT_FONT_SIZE, _CONTROL_ORIENTATION_PORTRAIT, __simpleItemTextSize);
3427 GET_SHAPE_CONFIG(TABLEVIEW::GROUPITEM_LEFT_MARGIN, _CONTROL_ORIENTATION_PORTRAIT, leftMargin);
3431 if (__simpleItemTextSize == 0)
3433 GET_SHAPE_CONFIG(TABLEVIEW::ITEM_DEFAULT_FONT_SIZE, _CONTROL_ORIENTATION_PORTRAIT, __simpleItemTextSize);
3435 GET_SHAPE_CONFIG(TABLEVIEW::ITEM_LEFT_MARGIN, _CONTROL_ORIENTATION_PORTRAIT, leftMargin);
3440 elementWidth = itemHeight * SIMPLE_ITEM_ELEMENT_BITMAP_SIZE_RATIO;
3441 elementHeight = elementWidth;
3443 bitmapRect.x = leftMargin;
3444 bitmapRect.y = (itemHeight - elementHeight) / 2;
3445 bitmapRect.width = elementWidth;
3446 bitmapRect.height = elementHeight;
3449 textRect.x = bitmapRect.x + elementWidth + leftMargin;
3451 if (__annexStyle == TABLE_VIEW_ANNEX_STYLE_MARK || __annexStyle == TABLE_VIEW_ANNEX_STYLE_RADIO)
3453 GET_SHAPE_CONFIG(TABLEVIEW::ITEM_ANNEX_MARGIN, _CONTROL_ORIENTATION_PORTRAIT, annexMargin);
3454 textRect.x = bitmapRect.x + elementWidth + annexMargin;
3457 if (annexWidth > 0) // +++ check floating
3459 elementWidth = __itemWidth - textRect.x - annexWidth - leftMargin;
3463 elementWidth = __itemWidth - textRect.x;
3467 textRect.width = elementWidth;
3468 textRect.height = itemHeight;
3470 if (__pSimpleItemBitmap != null && pBitmap != null)
3472 __pSimpleItemBitmap->SetBackgroundBitmap(*pBitmap);
3473 __pSimpleItemBitmap->SetBounds(bitmapRect);
3475 _Label* pSimpleItemBitmapCore = GetLabelCore(__pSimpleItemBitmap);
3476 if (!pSimpleItemBitmapCore->HasParent())
3478 r = AttachChild(*pSimpleItemBitmapCore);
3479 SysTryReturn(NID_UI_CTRL, __pSimpleItemBitmap != null, r, r, "[%s] Propagating.", GetErrorMessage(r));
3483 if (__pSimpleItemText != null)
3485 __pSimpleItemText->SetTextConfig(__simpleItemTextSize, LABEL_TEXT_STYLE_NORMAL);
3486 __pSimpleItemText->SetText(text);
3487 __pSimpleItemText->SetBounds(textRect);
3489 _Label* pSimpleItemTextCore = GetLabelCore(__pSimpleItemText);
3490 if (!pSimpleItemTextCore->HasParent())
3492 r = AttachChild(*pSimpleItemTextCore);
3493 SysTryReturn(NID_UI_CTRL, __pSimpleItemText != null, r, r, "[%s] Propagating.", GetErrorMessage(r));
3501 _TableViewItem::CreateSimpleItemContents(bool textOnly)
3503 result r = E_SUCCESS;
3505 if (__pSimpleItemText == null)
3507 __pSimpleItemText = new (std::nothrow) Label();
3509 r = GetLastResult();
3510 SysTryReturn(NID_UI_CTRL, __pSimpleItemText != null, r, r, "[%s] Propagating.", GetErrorMessage(r));
3512 __pSimpleItemText->Construct(FloatRectangle(0.0f, 0.0f, 0.0f, 0.0f), L"");
3514 __pSimpleItemText->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
3515 __pSimpleItemText->SetTextVerticalAlignment(ALIGNMENT_MIDDLE);
3516 if (__itemType == TABLE_VIEW_ITEM_TYPE_TITLE)
3518 __pSimpleItemText->SetTextColor(__simpleItemTextColor[TABLE_VIEW_GROUPITEM_DRAWING_STATUS_NORMAL]);
3522 __pSimpleItemText->SetTextColor(__simpleItemTextColor[TABLE_VIEW_ITEM_DRAWING_STATUS_NORMAL]);
3524 __pSimpleItemText->SetBackgroundColor(Color(0, 0, 0, 0));
3530 if (__pSimpleItemBitmap == null)
3532 __pSimpleItemBitmap = new (std::nothrow) Label();
3534 r = GetLastResult();
3535 SysTryReturn(NID_UI_CTRL, __pSimpleItemBitmap != null, r, r, "[%s] Propagating.", GetErrorMessage(r));
3537 __pSimpleItemBitmap->Construct(FloatRectangle(0.0f, 0.0f, 0.0f, 0.0f), L"");
3539 __pSimpleItemBitmap->SetBackgroundColor(Color(0, 0, 0, 0));
3545 if (__pSimpleItemBitmap != null)
3547 delete __pSimpleItemBitmap;
3548 __pSimpleItemBitmap = null;
3556 _TableViewItem::SetSimpleTextColor(const Tizen::Graphics::Color& color, TableViewItemDrawingStatus status)
3558 __simpleItemTextColor[status] = color;
3563 Tizen::Graphics::Color
3564 _TableViewItem::GetSimpleItemTextColor(TableViewItemDrawingStatus status) const
3566 return __simpleItemTextColor[status];
3570 _TableViewItem::SetSimpleItemTextSize(int size)
3572 __simpleItemTextSize = size;
3574 if (__pSimpleItemText != null)
3576 __pSimpleItemText->SetTextConfig(__simpleItemTextSize, LABEL_TEXT_STYLE_NORMAL);
3582 _TableViewItem::GetSimpleItemTextSize(void) const
3584 return __simpleItemTextSize;
3588 _TableViewItem::SetSectionHeaderFooterContents(const Tizen::Base::String& text, HorizontalAlignment alignment, bool isHeader)
3590 if (__pHeaderFooterItemText == null)
3592 result r = E_SUCCESS;
3593 float contentsHeight = 0.0f;
3594 float positionY = 0.0f;
3597 GET_COLOR_CONFIG(TABLEVIEW::GROUPITEM_TEXT_NORMAL, textColor);
3598 GET_SHAPE_CONFIG(TABLEVIEW::GROUPITEM_DEFAULT_TEXT_HEIGHT, _CONTROL_ORIENTATION_PORTRAIT, contentsHeight);
3600 __pHeaderFooterItemText = new (std::nothrow) Label();
3602 r = GetLastResult();
3603 SysTryReturn(NID_UI_CTRL, __pHeaderFooterItemText != null, r, r, "[%s] Propagating.", GetErrorMessage(r));
3607 positionY = GetBoundsF().height - contentsHeight;
3609 __pHeaderFooterItemText->Construct(FloatRectangle(0.0f, positionY, GetBoundsF().width, contentsHeight), text);
3611 __pHeaderFooterItemText->SetTextHorizontalAlignment(alignment);
3612 __pHeaderFooterItemText->SetTextColor(textColor);
3613 __pHeaderFooterItemText->SetBackgroundColor(Color(0, 0, 0, 0));
3615 _Label* pHeaderFooterItemTextCore = GetLabelCore(__pHeaderFooterItemText);
3616 AttachChild(*pHeaderFooterItemTextCore);
3623 _TableViewItem::SetSectionHeaderFooterAlignment(HorizontalAlignment alignment)
3625 if (__pHeaderFooterItemText != null)
3627 __pHeaderFooterItemText->SetTextHorizontalAlignment(alignment);
3628 __pHeaderFooterItemText->Invalidate(false);
3635 _TableViewItem::GetAnnexWidth(TableViewAnnexStyle style)
3637 float annexWidth = 0.0f;
3638 float annexDividerWidth = 0.0f;
3642 case TABLE_VIEW_ANNEX_STYLE_NORMAL:
3646 case TABLE_VIEW_ANNEX_STYLE_MARK:
3647 GET_SHAPE_CONFIG(TABLEVIEW::ITEM_ANNEX_WIDTH, _CONTROL_ORIENTATION_PORTRAIT, annexWidth);
3650 case TABLE_VIEW_ANNEX_STYLE_ONOFF_SLIDING:
3651 GET_SHAPE_CONFIG(TABLEVIEW::ITEM_ANNEX_ONOFF_WIDTH, _CONTROL_ORIENTATION_PORTRAIT, annexWidth);
3654 case TABLE_VIEW_ANNEX_STYLE_ONOFF_SLIDING_WITH_DIVIDER:
3655 GET_SHAPE_CONFIG(TABLEVIEW::ITEM_ANNEX_MARGIN, _CONTROL_ORIENTATION_PORTRAIT, annexDividerWidth);
3656 GET_FIXED_VALUE_CONFIG(TABLEVIEW::ITEM_ANNEX_DIVIDER_WIDTH, _CONTROL_ORIENTATION_PORTRAIT, annexDividerWidth);
3657 GET_SHAPE_CONFIG(TABLEVIEW::ITEM_ANNEX_ONOFF_WIDTH, _CONTROL_ORIENTATION_PORTRAIT, annexWidth);
3658 annexWidth = annexWidth + (annexDividerWidth*2) + annexDividerWidth;
3661 case TABLE_VIEW_ANNEX_STYLE_DETAILED:
3662 GET_SHAPE_CONFIG(TABLEVIEW::ITEM_ANNEX_MORE_WIDTH, _CONTROL_ORIENTATION_PORTRAIT, annexWidth);
3665 case TABLE_VIEW_ANNEX_STYLE_RADIO:
3666 GET_SHAPE_CONFIG(TABLEVIEW::ITEM_ANNEX_WIDTH, _CONTROL_ORIENTATION_PORTRAIT, annexWidth);
3677 _TableViewItem::SetDrawingStatus(TableViewItemDrawingStatus status)
3679 __drawingStatus = status;
3682 TableViewItemDrawingStatus
3683 _TableViewItem::GetDrawingStatus(void)
3685 return __drawingStatus;
3689 _TableViewItem::SetPressedControl(TableViewItemPressedControl pressedControl)
3691 __pressedControl = pressedControl;
3693 if(__pressedControl == TABLE_VIEW_ITEM_PRESSED_ITEM)
3695 __drawingStatus = TABLE_VIEW_ITEM_DRAWING_STATUS_PRESSED;
3697 else if(__pressedControl == TABLE_VIEW_ITEM_PRESSED_ANNEX)
3699 if (__annexStyle == TABLE_VIEW_ANNEX_STYLE_DETAILED)
3701 __isSelectedDetailButton = true;
3702 __drawingStatus = TABLE_VIEW_ITEM_DRAWING_STATUS_NORMAL;
3704 else if (__annexStyle == TABLE_VIEW_ANNEX_STYLE_ONOFF_SLIDING ||
3705 __annexStyle == TABLE_VIEW_ANNEX_STYLE_ONOFF_SLIDING_WITH_DIVIDER)
3707 __drawingStatus = TABLE_VIEW_ITEM_DRAWING_STATUS_NORMAL;
3711 __drawingStatus = TABLE_VIEW_ITEM_DRAWING_STATUS_PRESSED;
3716 if(__pressedControl != TABLE_VIEW_ITEM_PRESSED_INDIVIDUAL)
3718 __drawingStatus = TABLE_VIEW_ITEM_DRAWING_STATUS_PRESSED;
3723 TableViewItemPressedControl
3724 _TableViewItem::GetPressedControl(void)
3726 return __pressedControl;
3730 _TableViewItem::AdjustChildControlMargin(void)
3732 if (__childMarginState)
3737 if (IsTitleStyleItem())
3742 __childMarginState = true;
3746 if (__pDrawingProperty->groupedLookEnabled)
3748 float groupedBarMargin = 0.0f;
3749 GET_SHAPE_CONFIG(TABLEVIEW::GROUPITEM_BAR_WIDTH, _CONTROL_ORIENTATION_PORTRAIT, groupedBarMargin);
3751 margin = margin + groupedBarMargin;
3756 _VisualElement* pVisualElement = GetVisualElement();
3758 if (pVisualElement != null)
3760 FloatPoint position;
3762 position.SetPosition(margin, 0.0f);
3763 pVisualElement->ScrollByPoint(position, false);
3769 _TableViewItem::AdjustContextItemBounds(void)
3771 _TableViewItem* pContextItem = GetContextItem();
3773 if (pContextItem == null)
3778 FloatDimension contextItemSize = pContextItem->GetSizeF();
3779 FloatDimension itemSize = GetSizeF();
3781 if (!_FloatCompare(contextItemSize.height, itemSize.height))
3783 contextItemSize.height = itemSize.height;
3785 pContextItem->SetSize(contextItemSize);
3788 pContextItem->AdjustChildControlCenterAlign();
3792 _TableViewItem::AdjustAnnexBounds(void)
3794 if (__pItemAnnex == null || __isMoveItemAnimationEnabled || __isZoomInOutItemAnimationEnabled ||__isFadeInOutItemAnimationEnabled)
3800 if (__annexStyle == TABLE_VIEW_ANNEX_STYLE_ONOFF_SLIDING || __annexStyle == TABLE_VIEW_ANNEX_STYLE_ONOFF_SLIDING_WITH_DIVIDER || __annexStyle == TABLE_VIEW_ANNEX_STYLE_DETAILED)
3802 _Label* pAnnexCore = GetLabelCore(__pItemAnnex);
3803 if (pAnnexCore->HasParent())
3805 FloatRectangle annexBounds = __pItemAnnex->GetBoundsF();
3806 float annexPositionX = annexBounds.x;
3807 float leftMargin = 0.0f;
3809 GET_SHAPE_CONFIG(TABLEVIEW::ITEM_LEFT_MARGIN, _CONTROL_ORIENTATION_PORTRAIT, leftMargin);
3810 leftMargin += __pDrawingProperty->scrollMargin;
3812 annexPositionX = GetBoundsF().width - annexBounds.width - leftMargin;
3814 if (!_FloatCompare(annexPositionX, annexBounds.x))
3816 __pItemAnnex->SetPosition(FloatPoint(annexPositionX, annexBounds.y));
3822 FloatRectangle itemBounds = GetBoundsF();
3823 FloatRectangle annexBounds = __pItemAnnex->GetBoundsF();
3825 if (__customHeight > 0)
3827 itemBounds.height = __customHeight;
3830 annexBounds.y = (itemBounds.height - annexBounds.height) / 2;
3831 __pItemAnnex->SetPosition(FloatPoint(annexBounds.x, annexBounds.y));
3835 _TableViewItem::SetItemCustomHeight(float height)
3837 __customHeight = height;
3841 _TableViewItem::GetItemCustomHeight(void)
3843 return __customHeight;
3847 _TableViewItem::AdjustChildControlCenterAlign(void)
3849 if (__childControlCenterAlign)
3851 FloatDimension itemSize = GetSizeF();
3853 int childControlCount = GetChildCount();
3855 for (int i = 0; i < childControlCount; i++)
3857 _Control* pChildControl = GetChild(i);
3859 if (pChildControl == null)
3864 if (__pItemDivider == pChildControl)
3866 float positionX = pChildControl->GetPositionF().x;
3867 pChildControl->SetPosition(FloatPoint(positionX, itemSize.height - 1));
3871 if (__pItemTopDivider == pChildControl)
3873 float positionX = pChildControl->GetPositionF().x;
3874 pChildControl->SetPosition(FloatPoint(positionX, 0));
3878 FloatRectangle itemBounds = pChildControl->GetBoundsF();
3880 itemBounds.y = (itemSize.height - itemBounds.height) / 2;
3882 pChildControl->SetPosition(FloatPoint(itemBounds.x, itemBounds.y));
3888 _TableViewItem::SetChildControlCenterAlign(bool centerAlign)
3890 __childControlCenterAlign = centerAlign;
3894 _TableViewItem::GetLastTouchPressedPosition(void)
3896 return _CoordinateSystemUtils::ConvertToInteger(__touchStartPosition);
3900 _TableViewItem::GetLastTouchPressedPositionF(void)
3902 return __touchStartPosition;
3906 _TableViewItem::SetLastTouchPressedPosition(FloatPoint position)
3908 // This function was made to modify of ListView::RefreshList().
3909 // This function could adversely affect touch event handling. So, you should be used with caution.
3910 __touchStartPosition = position;
3914 _TableViewItem::SetLastTouchPressedPosition(Point position)
3916 // This function was made to modify of ListView::RefreshList().
3917 // This function could adversely affect touch event handling. So, you should be used with caution.
3918 __touchStartPosition = _CoordinateSystemUtils::ConvertToFloat(position);
3922 _TableViewItem::GetSelectionState(void)
3924 return __itemSelected;
3928 _TableViewItem::SetSelectionState(bool selected)
3930 // This function was made to modify of ListView::RefreshList().
3931 // This function could adversely affect touch event handling. So, you should be used with caution.
3932 __itemSelected = selected;
3936 _TableViewItem::MoveItem(FloatPoint position, int duration, int delay)
3938 _VisualElement* pVisualElement = GetVisualElement();
3939 VisualElementValueAnimation* pAnimation = null;
3940 String animationName = L"MOVE_ITEM";
3941 FloatPoint itemPosition = GetPositionF();
3942 result r = E_SUCCESS;
3944 if (position == itemPosition)
3949 if (__pMoveItemAnimation == null)
3951 __pMoveItemAnimation = new (std::nothrow) VisualElementValueAnimation;
3952 SysTryCatch(NID_UI_CTRL, __pMoveItemAnimation != null, , E_OUT_OF_MEMORY, ("[E_OUT_OF_MEMORY] The memory is insufficient."));
3954 __pMoveItemAnimation->SetVisualElementAnimationTickEventListener(this);
3955 r = GetLastResult();
3956 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
3958 __pMoveItemAnimation->SetVisualElementAnimationStatusEventListener(this);
3959 r = GetLastResult();
3960 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
3963 pAnimation = __pMoveItemAnimation;
3965 pAnimation->SetTimingFunction(VisualElementAnimation::GetTimingFunctionByName("EaseInOut"));
3966 pAnimation->SetDuration(duration);
3967 pAnimation->SetDelay(delay);
3968 pAnimation->SetStartValue(Variant(GetPositionF()));
3969 pAnimation->SetEndValue(Variant(position));
3971 if (pVisualElement->AddAnimation(animationName, *pAnimation) != E_SUCCESS)
3982 delete __pMoveItemAnimation;
3983 __pMoveItemAnimation = null;
3989 _TableViewItem::ZoomInOutItem(bool zoomOut, int duration, int delay)
3991 _VisualElement* pVisualElement = GetVisualElement();
3992 VisualElementValueAnimation* pAnimation = null;
3993 String animationName = L"ZOOM_IN_OUT_ITEM";
3994 FloatDimension itemSize = GetSizeF();
3995 FloatDimension startValue;
3996 FloatDimension endValue;
3997 result r = E_SUCCESS;
3999 if (__pZoomInOutItemAnimation == null)
4001 __pZoomInOutItemAnimation = new (std::nothrow) VisualElementValueAnimation;
4002 SysTryCatch(NID_UI_CTRL, __pZoomInOutItemAnimation != null, , E_OUT_OF_MEMORY, ("[E_OUT_OF_MEMORY] The memory is insufficient."));
4004 __pZoomInOutItemAnimation->SetVisualElementAnimationTickEventListener(this);
4005 r = GetLastResult();
4006 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
4008 __pZoomInOutItemAnimation->SetVisualElementAnimationStatusEventListener(this);
4009 r = GetLastResult();
4010 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
4013 pAnimation = __pZoomInOutItemAnimation;
4017 startValue = itemSize;
4018 endValue = FloatDimension(itemSize.width, itemSize.height / 2);
4019 pAnimation->SetTimingFunction(VisualElementAnimation::GetTimingFunctionByName(L"EaseOut"));
4023 startValue = FloatDimension(itemSize.width, itemSize.height / 2);
4024 endValue = itemSize;
4025 pAnimation->SetTimingFunction(VisualElementAnimation::GetTimingFunctionByName(L"EaseIn"));
4028 pAnimation->SetDuration(duration);
4029 pAnimation->SetDelay(delay);
4030 pAnimation->SetStartValue(Variant(startValue));
4031 pAnimation->SetEndValue(Variant(endValue));
4033 if (pVisualElement->AddAnimation(animationName, *pAnimation) != E_SUCCESS)
4043 delete __pZoomInOutItemAnimation;
4044 __pZoomInOutItemAnimation = null;
4050 _TableViewItem::FadeInOutItem(bool fadeOut, int duration, int delay)
4052 _VisualElement* pVisualElement = GetVisualElement();
4053 VisualElementValueAnimation* pAnimation = null;
4054 String animationName = L"FADE_IN_OUT_ITEM";
4055 float startValue = 0.0f;
4056 float endValue = 1.0f;
4057 result r = E_SUCCESS;
4059 if (__pFadeInOutItemtAnimation == null)
4061 __pFadeInOutItemtAnimation = new (std::nothrow) VisualElementValueAnimation;
4062 SysTryCatch(NID_UI_CTRL, __pFadeInOutItemtAnimation != null, , E_OUT_OF_MEMORY, ("[E_OUT_OF_MEMORY] The memory is insufficient."));
4064 __pFadeInOutItemtAnimation->SetVisualElementAnimationTickEventListener(this);
4065 r = GetLastResult();
4066 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
4068 __pFadeInOutItemtAnimation->SetVisualElementAnimationStatusEventListener(this);
4069 r = GetLastResult();
4070 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
4073 pAnimation = __pFadeInOutItemtAnimation;
4079 pAnimation->SetTimingFunction(VisualElementAnimation::GetTimingFunctionByName(L"EaseOut"));
4083 pAnimation->SetTimingFunction(VisualElementAnimation::GetTimingFunctionByName(L"EaseIn"));
4086 pAnimation->SetTimingFunction(VisualElementAnimation::GetTimingFunctionByName("EaseIn"));
4087 pAnimation->SetDuration(duration);
4088 pAnimation->SetDelay(delay);
4089 pAnimation->SetStartValue(Variant(startValue));
4090 pAnimation->SetEndValue(Variant(endValue));
4092 if (pVisualElement->AddAnimation(animationName, *pAnimation) != E_SUCCESS)
4097 pVisualElement->SetOpacity(startValue);
4105 delete __pFadeInOutItemtAnimation;
4106 __pFadeInOutItemtAnimation = null;
4112 _TableViewItem::SetIndividualSelectionEnabled(const _Control& control, bool enable)
4114 result r = E_SUCCESS;
4117 if (!__individualSelectionControls.Contains(control))
4119 r = __individualSelectionControls.Add(control);
4122 _AccessibilityContainer* pContainer = const_cast<_Control*>(&control)->GetAccessibilityContainer();
4123 pContainer->Activate(true);
4127 if (__individualSelectionControls.Contains(control))
4129 r = __individualSelectionControls.Remove(control, false);
4136 _TableViewItem::IsIndividualSelectionEnabled(const _Control& control)
4138 return __individualSelectionControls.Contains(control);
4142 _TableViewItem::AddRef(void)
4144 return ++__refCount;
4148 _TableViewItem::Release(void)
4151 if (__refCount <= 0)
4161 _TableViewItem::IsAnimationPlaying(void)
4163 if (__animationCount > 0)
4172 _TableViewItem::StopAllAnimation(void)
4174 _VisualElement* pVisualElement = GetVisualElement();
4176 pVisualElement->RemoveAllAnimations();
4180 _TableViewItem::SetItemDividerEnabled(bool enable)
4182 __itemDividerEnabled = enable;
4186 _TableViewItem::OnTickOccurred(const Tizen::Ui::Animations::VisualElementAnimation& animation, const Tizen::Base::String& keyName, Tizen::Ui::Animations::VisualElement& target, const Tizen::Ui::Variant& currentValue)
4188 if (keyName == L"MOVE_ITEM")
4190 FloatPoint position = currentValue.ToFloatPoint();
4191 SetPosition(position);
4193 else if (keyName == L"FADE_IN_OUT_ITEM")
4195 float opacity = currentValue.ToFloat();
4197 _VisualElement* pVisualElement = GetVisualElement();
4199 if (pVisualElement != null)
4201 pVisualElement->SetOpacity(opacity);
4204 else if (keyName == L"ZOOM_IN_OUT_ITEM")
4206 FloatDimension size = currentValue.ToFloatDimension();
4212 _TableViewItem::OnVisualElementAnimationStarted(const Tizen::Ui::Animations::VisualElementAnimation& animation, const Tizen::Base::String& keyName, Tizen::Ui::Animations::VisualElement& target)
4214 if (keyName == L"MOVE_ITEM")
4216 __isMoveItemAnimationEnabled = true;
4218 else if (keyName == L"FADE_IN_OUT_ITEM")
4220 __isFadeInOutItemAnimationEnabled = true;
4222 else if (keyName == L"ZOOM_IN_OUT_ITEM")
4224 __isZoomInOutItemAnimationEnabled = true;
4229 _TableViewItem::OnVisualElementAnimationRepeated(const Tizen::Ui::Animations::VisualElementAnimation& animation, const Tizen::Base::String& keyName, Tizen::Ui::Animations::VisualElement& target, long currentRepeatCount)
4234 _TableViewItem::OnVisualElementAnimationFinished(const Tizen::Ui::Animations::VisualElementAnimation& animation, const Tizen::Base::String& keyName, Tizen::Ui::Animations::VisualElement& target, bool completedNormally)
4236 if (__isAnimationCallbackBlocked)
4241 bool tableViewItemAnimation = true;
4242 const VisualElementValueAnimation *pAnimation = dynamic_cast<const VisualElementValueAnimation*>(&(animation));
4244 if (keyName == L"MOVE_ITEM")
4246 if (pAnimation != null)
4248 FloatPoint position = pAnimation->GetEndValue().ToFloatPoint();
4250 SetPosition(position);
4252 __isMoveItemAnimationEnabled = false;
4254 else if (keyName == L"FADE_IN_OUT_ITEM")
4256 if (pAnimation != null)
4258 float opacity = pAnimation->GetEndValue().ToFloat();
4260 _VisualElement* pVisualElement = GetVisualElement();
4262 if (pVisualElement != null)
4264 pVisualElement->SetOpacity(opacity);
4268 __isFadeInOutItemAnimationEnabled = false;
4270 else if (keyName == L"ZOOM_IN_OUT_ITEM")
4272 if (pAnimation != null)
4274 FloatDimension size = pAnimation->GetEndValue().ToFloatDimension();
4278 __isZoomInOutItemAnimationEnabled = false;
4282 tableViewItemAnimation = false;
4285 if (tableViewItemAnimation)
4294 _TableViewItem::OnAttachedToMainTree(void)
4296 if (!_FloatCompare(GetBoundsF().height, 0.0f))
4298 SetAccessibilityElement();
4305 _TableViewItem::SetAccessibilityElement(void)
4307 _AccessibilityContainer* pContainer = GetAccessibilityContainer();
4308 if(pContainer != null)
4310 if(__pAccessibilityElement == null)
4312 __pAccessibilityElement = new (std::nothrow) _AccessibilityElement(true);
4313 SysTryReturnVoidResult(NID_UI_CTRL, __pAccessibilityElement, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory shortage.");
4315 __pAccessibilityElement->SetTrait(ACCESSIBILITY_TRAITS_NONE);
4316 __pAccessibilityElement->SetName(L"TableViewItem");
4318 pContainer->AddElement(*__pAccessibilityElement);
4320 __pAccessibilityElement->SetBounds(FloatRectangle(0.0f,0.0f, GetBoundsF().width, GetBoundsF().height));
4324 _AccessibilityElement*
4325 _TableViewItem::GetAccessibilityElement(void)
4327 return __pAccessibilityElement;
4331 _TableViewItem::SetAccessibilityElementLabel(void)
4333 String accessibilityLabel;
4334 int childControlCount = GetChildCount();
4335 int groupIndex = -1;
4338 for (int i = 0; i < childControlCount; i++)
4340 _Control* pChildControl = GetChild(i);
4342 if (pChildControl == null)
4347 if (__pItemDivider == pChildControl || __pItemTopDivider == pChildControl || __pItemCover == pChildControl)
4352 if (!IsIndividualSelectionEnabled(*pChildControl))
4354 _AccessibilityContainer* pContainer = pChildControl->GetAccessibilityContainer();
4355 LinkedListT<_AccessibilityElement*> accessibilityElements;
4356 _AccessibilityElement* pElement = null;
4358 pContainer->GetElements(accessibilityElements);
4359 pContainer->Activate(false);
4360 int elementCount = accessibilityElements.GetCount();
4362 for (int i = 0; i < elementCount; i++)
4364 if (accessibilityElements.GetAt(i, pElement) == E_SUCCESS)
4366 accessibilityLabel += pElement->GetLabel();
4372 switch (__annexStyle)
4374 case TABLE_VIEW_ANNEX_STYLE_NORMAL:
4375 GetItemIndex(groupIndex, itemIndex);
4376 if (groupIndex != -1 && itemIndex == -1)
4378 accessibilityLabel += L"group index";
4382 case TABLE_VIEW_ANNEX_STYLE_MARK:
4385 accessibilityLabel += L"Tickbox ticked";
4389 accessibilityLabel += L"Tickbox unticked";
4393 case TABLE_VIEW_ANNEX_STYLE_ONOFF_SLIDING:
4394 case TABLE_VIEW_ANNEX_STYLE_ONOFF_SLIDING_WITH_DIVIDER:
4397 accessibilityLabel += L"On/Off button On";
4401 accessibilityLabel += L"On/Off button Off";
4405 case TABLE_VIEW_ANNEX_STYLE_DETAILED:
4406 accessibilityLabel += L"button";
4409 case TABLE_VIEW_ANNEX_STYLE_RADIO:
4412 accessibilityLabel += L"Radio button selected";
4416 accessibilityLabel += L"Radio button unselected";
4424 if (!accessibilityLabel.IsEmpty())
4426 __pAccessibilityElement->SetLabel(accessibilityLabel);
4432 _TableViewItem::OnAccessibilityFocusMovedNext(const _AccessibilityContainer& control, const _AccessibilityElement& element)
4438 _TableViewItem::OnAccessibilityFocusMovedPrevious(const _AccessibilityContainer& control, const _AccessibilityElement& element)
4444 _TableViewItem::OnAccessibilityReadElement(const _AccessibilityContainer& control, const _AccessibilityElement& element)
4450 _TableViewItem::OnAccessibilityReadingElement(const _AccessibilityContainer& control, const _AccessibilityElement& element)
4452 SetAccessibilityElementLabel();
4458 _TableViewItem::OnAccessibilityFocusIn(const _AccessibilityContainer& control, const _AccessibilityElement& element)
4464 _TableViewItem::OnAccessibilityFocusOut(const _AccessibilityContainer& control, const _AccessibilityElement& element)
4470 _TableViewItem::OnAccessibilityActionPerformed(const _AccessibilityContainer& control, const _AccessibilityElement& element)
4472 switch (__annexStyle)
4474 case TABLE_VIEW_ANNEX_STYLE_NORMAL:
4477 case TABLE_VIEW_ANNEX_STYLE_MARK:
4480 _AccessibilityManager::GetInstance()->ReadContent(L"ticked");
4484 _AccessibilityManager::GetInstance()->ReadContent(L"unticked");
4488 case TABLE_VIEW_ANNEX_STYLE_ONOFF_SLIDING:
4489 case TABLE_VIEW_ANNEX_STYLE_ONOFF_SLIDING_WITH_DIVIDER:
4492 _AccessibilityManager::GetInstance()->ReadContent(L"On");
4496 _AccessibilityManager::GetInstance()->ReadContent(L"Off");
4500 case TABLE_VIEW_ANNEX_STYLE_DETAILED:
4503 case TABLE_VIEW_ANNEX_STYLE_RADIO:
4506 _AccessibilityManager::GetInstance()->ReadContent(L"selected");
4510 _AccessibilityManager::GetInstance()->ReadContent(L"unselected");
4522 _TableViewItem::OnAccessibilityValueIncreased(const _AccessibilityContainer& control, const _AccessibilityElement& element)
4528 _TableViewItem::OnAccessibilityValueDecreased(const _AccessibilityContainer& control, const _AccessibilityElement& element)
4533 }}} // Tizen::Ui::Controls