2 // Open Service Platform
3 // Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
5 // Licensed under the Apache License, Version 2.0 (the License);
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
9 // http://www.apache.org/licenses/LICENSE-2.0/
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an "AS IS" BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
19 * @file FUiCtrl_TableViewItem.cpp
20 * @brief This is the implementation file for _TableViewItem class.
22 * This file contains the implementation of _TableViewItem class.
25 #include <FBaseUtilMath.h>
26 #include <FGrp_BitmapImpl.h>
27 #include "FUi_ResourceManager.h"
28 #include "FUi_UiTouchEvent.h"
29 #include "FUiAnim_VisualElement.h"
30 #include "FUiAnim_ControlVisualElement.h"
31 #include "FUiCtrl_TableViewItem.h"
32 #include "FUiCtrl_TableView.h"
33 #include "FUi_CoordinateSystemUtils.h"
35 #include "FUiCtrl_LabelImpl.h"
36 #include "FUi_Window.h"
38 using namespace Tizen::Base;
39 using namespace Tizen::Base::Runtime;
40 using namespace Tizen::Base::Collection;
41 using namespace Tizen::Ui::Animations;
42 using namespace Tizen::Graphics;
44 namespace Tizen { namespace Ui { namespace Controls
47 _TableViewItemControl::_TableViewItemControl(void)
48 :__pBackgroundBitmap(null)
52 _TableViewItemControl::~_TableViewItemControl(void)
54 if (__pBackgroundBitmap)
56 delete __pBackgroundBitmap;
57 __pBackgroundBitmap = null;
63 _TableViewItemControl::OnDraw(void)
65 Bitmap* pBitmap = GetBackgroundBitmap();
67 FloatRectangle bounds(0.0f, 0.0f, GetBoundsF().width, GetBoundsF().height); // +++ check floating
69 Color bgColor = GetBackgroundColor();
71 Canvas* pCanvas = null;
75 pCanvas = GetCanvasN();
78 SysLog(NID_UI_CTRL, "Cannot get a canvas.");
83 pCanvas->SetBackgroundColor(Color(0, 0, 0, 0));
86 if (_BitmapImpl::CheckNinePatchedBitmapStrictly(*pBitmap))
88 pCanvas->DrawNinePatchedBitmap(bounds, *pBitmap);
92 FloatRectangle drawingRect(0.0f, 0.0f, bounds.width, bounds.height);
93 pCanvas->DrawBitmap(drawingRect, *pBitmap);
99 if (IsCalledGetCanvasN() == false)
101 GetVisualElement()->SetBackgroundColor(_Colorf((float)bgColor.GetRed() / 255, (float)bgColor.GetGreen() / 255, (float)bgColor.GetBlue() / 255, (float)bgColor.GetAlpha() / 255));
105 pCanvas = GetCanvasN();
108 SysLog(NID_UI_CTRL, "Cannot get a canvas.");
113 pCanvas->SetBackgroundColor(Color(0, 0, 0, 0));
115 pCanvas->FillRectangle(GetBackgroundColor(), bounds); // +++ check floating
128 _TableViewItemControl::HitTest(const Graphics :: FloatPoint & point)
130 return HIT_TEST_NOWHERE;
133 _TableViewItemControl*
134 _TableViewItemControl::CreateTableViewItemControlN(void)
136 _TableViewItemControl* pItemControl = new (std::nothrow) _TableViewItemControl();
137 SysTryReturn(NID_UI_CTRL, pItemControl, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
138 SysTryCatch(NID_UI_CTRL, GetLastResult() == E_SUCCESS, , E_SYSTEM, "[%s] A system error has been occurred.", GetErrorMessage(E_SYSTEM));
141 pItemControl->AcquireHandle();
151 _TableViewItemControl::SetBackgroundBitmap(const Bitmap& bitmap)
155 Bitmap* pClonedBitmap = _BitmapImpl::CloneN(bitmap);
159 if (__pBackgroundBitmap != null)
161 delete __pBackgroundBitmap;
164 __pBackgroundBitmap = pClonedBitmap;
173 _TableViewItemControl::GetBackgroundBitmap(void) const
175 return __pBackgroundBitmap;
178 _TableViewItem::_TableViewItem(float itemHeight)
182 , __itemHeight(itemHeight)
183 , __itemGroupIndex(-1)
185 , __checkedState(false)
186 , __enabledState(true)
187 , __itemChanged(true)
188 , __reorderMode(false)
189 , __itemSelected(false)
190 , __itemTouchMoved(false)
191 , __childMarginState(false)
192 , __annexStyle(TABLE_VIEW_ANNEX_STYLE_NORMAL)
193 , __drawingStatus(TABLE_VIEW_ITEM_DRAWING_STATUS_NORMAL)
194 , __selectionStyle(TABLE_VIEW_ITEM_SELECTION_STYLE_WHOLE)
195 , __itemType(TABLE_VIEW_ITEM_TYPE_NONE)
196 , __pContextItem(null)
197 , __isContextItem(false)
198 , __isContextItemActivated(false)
199 , __checkItemHeightNeeded(false)
200 , __pItemDivider(null)
201 , __pItemTopDivider(null)
204 , __pItemAnnexLeftDivider(null)
205 , __pItemAnnexRightDivider(null)
207 , __pDrawingProperty(null)
208 , __itemDividerEnabled(true)
209 , __pSimpleItemText(null)
210 , __pSimpleItemBitmap(null)
211 , __simpleItemTextSize(0)
212 , __pHeaderFooterItemText(null)
214 , __touchStartPosition(0.0f, 0.0f)
215 , __annexTouchStartPosition(0)
216 , __annexOnOffHandlerMoved(false)
217 , __annexOnOffHandlerPositionX(0.0f)
218 , __childControlCenterAlign(false)
219 , __customHeight(0.0f)
220 , __animationCount(0)
221 , __pAccessibilityElement(null)
222 , __pAccessibilityOnOffElement(null)
223 , __pPressedTimer(null)
224 , __pReleasedTimer(null)
225 , __isPressedTimerEnabled(false)
226 , __isReleasedTimerEnabled(false)
227 , __pressedControl(TABLE_VIEW_ITEM_PRESSED_NONE)
228 , __releasedControl(TABLE_VIEW_ITEM_PRESSED_NONE)
229 , __pCheckedTimer(null)
230 , __isCheckedTimerEnabled(false)
231 , __isCheckedAnimationEnabled(false)
233 , __checkedBounds(FloatRectangle(0.0f, 0.0f, 0.0f, 0.0f))
234 , __isItemLayoutEnabled(false)
235 , __isMoveItemAnimationEnabled(false)
236 , __isZoomInOutItemAnimationEnabled(false)
237 , __isFadeInOutItemAnimationEnabled(false)
238 , __isAnimationCallbackBlocked(false)
239 , __isItemTapSoundEnabled(true)
240 , __isTabSoundPlayed(false)
241 , __isSelectedDetailButton(false)
242 , __isSimpleLastItem(false)
243 , __isSectionItem(false)
244 , __isTouchPressOnScroll(false)
245 , __isTouchCancelOnPressRelease(false)
246 , __pHighlightVisualElement(null)
247 , __pBitmapVisualElement(null)
248 , __pMoveItemAnimation(null)
249 , __pZoomInOutItemAnimation(null)
250 , __pFadeInOutItemtAnimation(null)
252 for (int i = 0; i < 3; i++)
254 __pItemBgBitmap[i] = null;
257 GET_COLOR_CONFIG(TABLEVIEW::ITEM_BG_NORMAL, __colorItemBg[TABLE_VIEW_ITEM_DRAWING_STATUS_NORMAL]); // for support opacity 0x00
258 GET_COLOR_CONFIG(TABLEVIEW::ITEM_BG_PRESSED, __colorItemBg[TABLE_VIEW_ITEM_DRAWING_STATUS_PRESSED]);
259 GET_COLOR_CONFIG(TABLEVIEW::ITEM_BG_HIGHLIGHTED, __colorItemBg[TABLE_VIEW_ITEM_DRAWING_STATUS_HIGHLIGHTED]);
261 GET_COLOR_CONFIG(TABLEVIEW::ITEM_TEXT_NORMAL, __simpleItemTextColor[TABLE_VIEW_ITEM_DRAWING_STATUS_NORMAL]);
262 GET_COLOR_CONFIG(TABLEVIEW::ITEM_TEXT_PRESSED, __simpleItemTextColor[TABLE_VIEW_ITEM_DRAWING_STATUS_PRESSED]);
263 GET_COLOR_CONFIG(TABLEVIEW::ITEM_TEXT_HIGHLIGHTED, __simpleItemTextColor[TABLE_VIEW_ITEM_DRAWING_STATUS_HIGHLIGHTED]);
264 GET_COLOR_CONFIG(TABLEVIEW::GROUPITEM_TEXT_NORMAL, __simpleItemTextColor[TABLE_VIEW_GROUPITEM_DRAWING_STATUS_NORMAL]);
265 GET_COLOR_CONFIG(TABLEVIEW::GROUPITEM_TEXT_PRESSED, __simpleItemTextColor[TABLE_VIEW_GROUPITEM_DRAWING_STATUS_PRESSED]);
266 GET_COLOR_CONFIG(TABLEVIEW::ITEM_TEXT_DISABLED, __simpleItemTextColor[TABLE_VIEW_SIMPLEITEM_DRAWING_STATUS_DISABLED]);
269 _AccessibilityContainer* pContainer = GetAccessibilityContainer();
272 pContainer->Activate(true);
273 pContainer->AddListener(*this);
277 _TableViewItem::~_TableViewItem()
279 __isAnimationCallbackBlocked = true;
281 StopTouchPressedTimer(true);
282 delete __pPressedTimer;
283 __pPressedTimer = null;
285 StopTouchReleasedTimer(true);
286 delete __pReleasedTimer;
287 __pReleasedTimer = null;
289 _VisualElement* pVisualElement = GetVisualElement();
290 if (pVisualElement != null)
292 if (__pMoveItemAnimation != null)
294 __pMoveItemAnimation->SetVisualElementAnimationTickEventListener(null);
295 __pMoveItemAnimation->SetVisualElementAnimationStatusEventListener(null);
298 if (__pZoomInOutItemAnimation != null)
300 __pZoomInOutItemAnimation->SetVisualElementAnimationTickEventListener(null);
301 __pZoomInOutItemAnimation->SetVisualElementAnimationStatusEventListener(null);
304 if (__pFadeInOutItemtAnimation != null)
306 __pFadeInOutItemtAnimation->SetVisualElementAnimationTickEventListener(null);
307 __pFadeInOutItemtAnimation->SetVisualElementAnimationStatusEventListener(null);
309 pVisualElement->RemoveAllAnimations();
312 for (int j = 0; j < 3; j++)
314 delete __pItemBgBitmap[j];
315 __pItemBgBitmap[j] = null;
318 if (__pHighlightVisualElement != null)
320 __pHighlightVisualElement->RemoveAllAnimations();
321 __pHighlightVisualElement->SetAnimationProvider(null);
322 __pHighlightVisualElement->Destroy();
323 __pHighlightVisualElement = null;
326 if (__pBitmapVisualElement != null)
328 __pBitmapVisualElement->RemoveAllAnimations();
329 __pBitmapVisualElement->SetAnimationProvider(null);
330 __pBitmapVisualElement->Destroy();
331 __pBitmapVisualElement = null;
336 if (GetParent() != null && __isContextItem == true)
338 GetParent()->DetachChild(*this);
341 delete __pItemDivider;
342 __pItemDivider = null;
344 delete __pItemTopDivider;
345 __pItemTopDivider = null;
347 delete __pItemAnnexLeftDivider;
348 __pItemAnnexLeftDivider = null;
350 delete __pItemAnnexRightDivider;
351 __pItemAnnexRightDivider = null;
362 delete __pHeaderFooterItemText;
363 __pHeaderFooterItemText = null;
365 delete __pMoveItemAnimation;
366 __pMoveItemAnimation = null;
368 delete __pZoomInOutItemAnimation;
369 __pZoomInOutItemAnimation = null;
371 delete __pFadeInOutItemtAnimation;
372 __pFadeInOutItemtAnimation = null;
374 if (__isCheckedTimerEnabled)
376 __pCheckedTimer->Cancel();
379 delete __pCheckedTimer;
380 __pCheckedTimer = null;
382 if (__pAccessibilityElement)
384 _AccessibilityContainer* pContainer = GetAccessibilityContainer();
387 pContainer->RemoveAllElement();
389 __pAccessibilityElement = null;
391 if (__pAccessibilityOnOffElement)
393 __pAccessibilityOnOffElement = null;
399 _TableViewItem::CreateTableViewItemN(float itemHeight)
401 result r = E_SUCCESS;
403 _TableViewItem* pItem = null;
404 pItem = new (std::nothrow) _TableViewItem(itemHeight);
405 SysTryReturn(NID_UI_CTRL, pItem, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
407 pItem->AcquireHandle();
409 r = pItem->Initialize();
410 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r = E_SYSTEM, "[%s] A system error has been occurred.", GetErrorMessage(E_SYSTEM));
422 _TableViewItem::Initialize(void)
424 GetVisualElement()->SetSurfaceOpaque(false);
426 result r = E_SUCCESS;
428 __pHighlightVisualElement = new (std::nothrow) _VisualElement();
429 SysTryCatch(NID_UI_CTRL, __pHighlightVisualElement != null, r = E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
431 r = __pHighlightVisualElement->Construct();
432 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Failed to construct Visual Element.", GetErrorMessage(r));
434 r = __pHighlightVisualElement->SetSurfaceOpaque(false);
435 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Failed to set surface opaque.", GetErrorMessage(r));
437 __pHighlightVisualElement->SetImplicitAnimationEnabled(false);
439 r = GetVisualElement()->AttachChild(*__pHighlightVisualElement);
440 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Failed to attach child to the control VisualElement.", GetErrorMessage(r));
442 r = SetItemHighlightBounds(*__pHighlightVisualElement, CalculateItemHighlightBounds());
443 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Failed to set bounds.", GetErrorMessage(r));
445 __pHighlightVisualElement->SetBackgroundColor(_Colorf(0.0f, 0.0f, 0.0f, 0.0f));
446 __pHighlightVisualElement->SetShowState(true);
448 r = __individualSelectionControls.Construct(DEFAULT_CAPTURED_CONTROL_COUNT);
449 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Failed to construct ArrayList", GetErrorMessage(r));
451 SetTouchPressThreshold(SENSITIVE);
453 if (!_FloatCompare(__itemHeight, 0.0f))
455 SetAccessibilityElement();
458 GetAccessibilityContainer()->Activate(false);
463 if (__pHighlightVisualElement != null)
465 __pHighlightVisualElement->RemoveAllAnimations();
466 __pHighlightVisualElement->SetAnimationProvider(null);
467 __pHighlightVisualElement->Destroy();
468 __pHighlightVisualElement = null;
475 _TableViewItem::GetContextItem(void) const
477 return __pContextItem;
481 _TableViewItem::SetContextItem(_TableViewItem* pContextItem)
483 if (pContextItem != null)
485 pContextItem->__isContextItem = true;
488 __pContextItem = pContextItem;
492 _TableViewItem::IsContextItem(void) const
494 return __isContextItem;
498 _TableViewItem::SetContextItemActivation(bool activated)
500 __isContextItemActivated = activated;
504 _TableViewItem::IsContextItemActivated(void) const
506 return __isContextItemActivated;
510 _TableViewItem::CreateItemDimLayer(void)
512 result r = E_SUCCESS;
514 if (__pDimLayer == null)
516 __pDimLayer = _Label::CreateLabelN();
519 SysTryReturn(NID_UI_CTRL, __pDimLayer != null, r, r, "[%s] Propagating.", GetErrorMessage(r));
521 __pDimLayer->SetBackgroundColor(Color(0, 0, 0, BACKGROUND_DIMMED_OPACITY * 0xff));
522 __pDimLayer->SetVisibleState(false);
524 AttachSystemChild(*__pDimLayer);
531 _TableViewItem::CreateItemDivider(void)
533 result r = E_SUCCESS;
535 if (__pItemDivider == null)
537 __pItemDivider = _TableViewItemControl::CreateTableViewItemControlN();
539 SysTryReturn(NID_UI_CTRL, __pItemDivider != null, r, r, "[%s] Propagating.", GetErrorMessage(r));
540 __pItemDivider->SetFocusable(false);
541 AttachSystemChild(*__pItemDivider);
543 _AccessibilityContainer* pContainer = __pItemDivider->GetAccessibilityContainer();
544 pContainer->Activate(false);
547 if (__pItemTopDivider == null)
549 __pItemTopDivider = _TableViewItemControl::CreateTableViewItemControlN();
550 SysTryReturn(NID_UI_CTRL, __pItemTopDivider != null, r, r, "[%s] Propagating.", GetErrorMessage(r));
551 __pItemTopDivider->SetFocusable(false);
552 AttachSystemChild(*__pItemTopDivider);
554 _AccessibilityContainer* pContainer = __pItemTopDivider->GetAccessibilityContainer();
555 pContainer->Activate(false);
562 _TableViewItem::CreateItemAnnexDivider(void)
564 result r = E_SUCCESS;
566 if (__pItemAnnexLeftDivider == null)
568 __pItemAnnexLeftDivider = _TableViewItemControl::CreateTableViewItemControlN();
570 SysTryReturn(NID_UI_CTRL, __pItemAnnexLeftDivider != null, r, r, "[%s] Propagating.", GetErrorMessage(r));
571 __pItemAnnexLeftDivider->SetFocusable(false);
572 AttachSystemChild(*__pItemAnnexLeftDivider);
575 if (__pItemAnnexRightDivider == null)
577 __pItemAnnexRightDivider = _TableViewItemControl::CreateTableViewItemControlN();
578 SysTryReturn(NID_UI_CTRL, __pItemAnnexRightDivider != null, r, r, "[%s] Propagating.", GetErrorMessage(r));
579 __pItemAnnexRightDivider->SetFocusable(false);
580 AttachSystemChild(*__pItemAnnexRightDivider);
587 _TableViewItem::CreateItemCover(void)
589 result r = E_SUCCESS;
591 if (__pItemCover == null)
593 __pItemCover = _TableViewItemControl::CreateTableViewItemControlN();
595 SysTryReturn(NID_UI_CTRL, __pItemCover != null, r, r, "[%s] Propagating.", GetErrorMessage(r));
596 __pItemCover->SetFocusable(false);
597 AttachSystemChild(*__pItemCover);
604 _TableViewItem::CreateCheckBox(void)
606 result r = E_SUCCESS;
608 if (__pItemAnnex == null)
610 float annexWidth = 0.0f;
611 float annexHeight = 0.0f;
612 GET_SHAPE_CONFIG(TABLEVIEW::ITEM_ANNEX_WIDTH, _CONTROL_ORIENTATION_PORTRAIT, annexWidth);
613 GET_SHAPE_CONFIG(TABLEVIEW::ITEM_ANNEX_HEIGHT, _CONTROL_ORIENTATION_PORTRAIT, annexHeight);
615 __pItemAnnex = new (std::nothrow) Label();
617 SysTryReturn(NID_UI_CTRL, __pItemAnnex != null, r, r, "[%s] Propagating.", GetErrorMessage(r));
619 float leftMargin = 0.0f;
620 GET_SHAPE_CONFIG(TABLEVIEW::ITEM_LEFT_MARGIN, _CONTROL_ORIENTATION_PORTRAIT, leftMargin);
622 float itemHeight = ((__customHeight > 0) ? __customHeight : GetBoundsF().height);
623 __pItemAnnex->Construct(FloatRectangle(leftMargin, ((itemHeight - annexHeight) / 2), annexWidth, annexHeight), L"");
624 __pItemAnnex->SetBackgroundColor(Color(0, 0, 0, 0));
625 GetLabelCore(__pItemAnnex)->SetFocusable(true);
627 AttachSystemChild(*GetLabelCore(__pItemAnnex));
635 _TableViewItem::CreateRadioBox(void)
637 result r = E_SUCCESS;
639 if (__pItemAnnex == null)
641 float annexWidth = 0.0f;
642 float annexHeight = 0.0f;
643 GET_SHAPE_CONFIG(TABLEVIEW::ITEM_ANNEX_WIDTH, _CONTROL_ORIENTATION_PORTRAIT, annexWidth);
644 GET_SHAPE_CONFIG(TABLEVIEW::ITEM_ANNEX_HEIGHT, _CONTROL_ORIENTATION_PORTRAIT, annexHeight);
646 __pItemAnnex = new (std::nothrow) Label();
648 SysTryReturn(NID_UI_CTRL, __pItemAnnex != null, r, r, "[%s] Propagating.", GetErrorMessage(r));
650 float leftMargin = 0.0f;
651 GET_SHAPE_CONFIG(TABLEVIEW::ITEM_LEFT_MARGIN, _CONTROL_ORIENTATION_PORTRAIT, leftMargin);
653 float itemHeight = ((__customHeight > 0) ? __customHeight : GetBoundsF().height);
654 __pItemAnnex->Construct(FloatRectangle(leftMargin, ((itemHeight - annexHeight) / 2), annexWidth, annexHeight), L"");
655 __pItemAnnex->SetBackgroundColor(Color(0, 0, 0, 0));
656 GetLabelCore(__pItemAnnex)->SetFocusable(true);
658 AttachSystemChild(*GetLabelCore(__pItemAnnex));
665 _TableViewItem::CreateOnOffButton(void)
667 result r = E_SUCCESS;
669 if (__pItemAnnex == null)
671 float annexWidth = 0.0f;
672 float annexHeight = 0.0f;
674 GET_SHAPE_CONFIG(TABLEVIEW::ITEM_ANNEX_ONOFF_WIDTH, _CONTROL_ORIENTATION_PORTRAIT, annexWidth);
675 GET_SHAPE_CONFIG(TABLEVIEW::ITEM_ANNEX_ONOFF_HEIGHT, _CONTROL_ORIENTATION_PORTRAIT, annexHeight);
677 __pItemAnnex = new (std::nothrow) Label();
679 SysTryReturn(NID_UI_CTRL, __pItemAnnex != null, r, r, "[%s] Propagating.", GetErrorMessage(r));
681 float leftMargin = 0.0f;
682 GET_SHAPE_CONFIG(TABLEVIEW::ITEM_LEFT_MARGIN, _CONTROL_ORIENTATION_PORTRAIT, leftMargin);
684 leftMargin += __pDrawingProperty->scrollMargin;
686 float itemHeight = ((__customHeight > 0) ? __customHeight : GetBoundsF().height);
687 __pItemAnnex->Construct(FloatRectangle((GetBoundsF().width - annexWidth - leftMargin), ((itemHeight - annexHeight) / 2), annexWidth, annexHeight), L"");
688 __pItemAnnex->SetBackgroundColor(Color(0, 0, 0, 0));
689 GetLabelCore(__pItemAnnex)->SetFocusable(true);
691 AttachSystemChild(*GetLabelCore(__pItemAnnex));
698 _TableViewItem::CreateDetailButton(void)
700 result r = E_SUCCESS;
702 if (__pItemAnnex == null)
704 float annexWidth = 0.0f;
705 float annexHeight = 0.0f;
707 GET_SHAPE_CONFIG(TABLEVIEW::ITEM_ANNEX_MORE_WIDTH, _CONTROL_ORIENTATION_PORTRAIT, annexWidth);
708 GET_SHAPE_CONFIG(TABLEVIEW::ITEM_ANNEX_MORE_HEIGHT, _CONTROL_ORIENTATION_PORTRAIT, annexHeight);
709 __pItemAnnex = new (std::nothrow) Label();
711 SysTryReturn(NID_UI_CTRL, __pItemAnnex != null, r, r, "[%s] Propagating.", GetErrorMessage(r));
713 float leftMargin = 0.0f;
714 GET_SHAPE_CONFIG(TABLEVIEW::ITEM_LEFT_MARGIN, _CONTROL_ORIENTATION_PORTRAIT, leftMargin);
716 leftMargin += __pDrawingProperty->scrollMargin;
717 float itemHeight = ((__customHeight > 0) ? __customHeight : GetBoundsF().height);
718 __pItemAnnex->Construct(FloatRectangle((GetBoundsF().width - annexWidth - leftMargin), ((itemHeight - annexHeight) / 2), annexWidth, annexHeight), L"");
719 __pItemAnnex->SetBackgroundColor(Color(0, 0, 0, 0));
720 GetLabelCore(__pItemAnnex)->SetFocusable(true);
722 AttachSystemChild(*GetLabelCore(__pItemAnnex));
729 _TableViewItem::GetLabelCore(Label* pLabel)
736 _LabelImpl* pImpl = _LabelImpl::GetInstance(*pLabel);
737 return &pImpl->GetCore();
741 _TableViewItem::ExposeContextItem(FloatRectangle itemBounds, float targetWidth)
744 if (__pDimLayer == null)
746 if (CreateItemDimLayer() != E_SUCCESS)
752 SetBounds(itemBounds);
756 if ((itemBounds.width <= 0) || (itemBounds.width >= targetWidth)) // +++ check floating
763 float rightMargin = 0.0f;
764 float dimLayerOpacity = 0.0f;
766 GET_SHAPE_CONFIG(TABLEVIEW::CONTEXTITEM_RIGHT_MARGIN, _CONTROL_ORIENTATION_PORTRAIT, rightMargin);
768 dimLayerOpacity = BACKGROUND_DIMMED_OPACITY - ((itemBounds.width * BACKGROUND_DIMMED_OPACITY) / (targetWidth - rightMargin));
769 dimLayerOpacity = ((dimLayerOpacity < 0) ? 0 : dimLayerOpacity); // +++ check floating
771 __pDimLayer->SetBounds(FloatRectangle(0.0f, 0.0f, itemBounds.width, itemBounds.height));
772 __pDimLayer->SetBackgroundColor(Color(0.0f, 0.0f, 0.0f, dimLayerOpacity * 0xff));
775 __pDimLayer->SetVisibleState(visible);
780 _TableViewItem::DrawItemDimLayer(bool visible)
782 if (__pDimLayer == null)
784 if (CreateItemDimLayer() != E_SUCCESS)
792 FloatDimension itemSize = GetSizeF();
793 __pDimLayer->SetBounds(FloatRectangle(0.0f, 0.0f, itemSize.width, itemSize.height));
794 __pDimLayer->SetBackgroundColor(Color(0, 0, 0, BACKGROUND_DISABLED_OPACITY * 0xff));
797 __pDimLayer->SetVisibleState(visible);
801 _TableViewItem::SetItemWidth(float width)
807 _TableViewItem::SetItemBackgroundBitmap(ListItemState itemState, const Bitmap* pBitmap)
809 Bitmap* pCopyBitmap = null;
811 pCopyBitmap = _BitmapImpl::CloneN(*pBitmap);
812 SysTryReturn(NID_UI_CTRL, pCopyBitmap != null, false, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
814 delete __pItemBgBitmap[itemState];
815 __pItemBgBitmap[itemState] = pCopyBitmap;
818 if (__pItemBgBitmap[TABLE_VIEW_ITEM_DRAWING_STATUS_NORMAL] == null &&
819 __pItemBgBitmap[TABLE_VIEW_ITEM_DRAWING_STATUS_PRESSED] == null &&
820 __pItemBgBitmap[TABLE_VIEW_ITEM_DRAWING_STATUS_HIGHLIGHTED] == null)
822 if (__pBitmapVisualElement != null)
824 __pBitmapVisualElement->Destroy();
825 __pBitmapVisualElement = null;
830 if (__pBitmapVisualElement == null)
832 FloatRectangle bounds = GetBoundsF();
833 result r = E_SUCCESS;
835 __pBitmapVisualElement = new (std::nothrow) _VisualElement();
836 SysTryCatch(NID_UI_CTRL, __pBitmapVisualElement != null, , E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
838 r = __pBitmapVisualElement->Construct();
839 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
841 __pBitmapVisualElement->SetSurfaceOpaque(false);
842 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Failed to set surface opaque.", GetErrorMessage(r));
844 __pBitmapVisualElement->SetImplicitAnimationEnabled(false);
845 __pBitmapVisualElement->SetBounds(FloatRectangle(0.0f, 0.0f, bounds.width, bounds.height));
846 __pBitmapVisualElement->SetShowState(true);
848 GetVisualElement()->AttachChild(*__pBitmapVisualElement);
852 SetItemChanged(true);
855 if (__pBitmapVisualElement != null)
857 __pBitmapVisualElement->RemoveAllAnimations();
858 __pBitmapVisualElement->SetAnimationProvider(null);
859 __pBitmapVisualElement->Destroy();
860 __pBitmapVisualElement = null;
865 Tizen::Graphics::Bitmap*
866 _TableViewItem::GetItemBackgroundBitmap(ListItemState itemState) const
868 return __pItemBgBitmap[itemState];
872 _TableViewItem::SetItemBackgroundColor(ListItemState itemState, const Color bgColor)
874 if (__colorItemBg[itemState] == bgColor)
879 __colorItemBg[itemState] = bgColor;
881 SetItemChanged(true);
885 _TableViewItem::GetItemBackgroundColor(ListItemState itemState) const
887 return __colorItemBg[itemState];
891 _TableViewItem::SetItemStyle(TableViewAnnexStyle style)
893 if (__annexStyle == style)
898 __annexStyle = style;
902 _TableViewItem::SetSelectionStyle(TableViewItemSelectionStyle style)
904 __selectionStyle = style;
909 TableViewItemSelectionStyle
910 _TableViewItem::GetSelectionStyle(void) const
912 return __selectionStyle;
916 _TableViewItem::GetItemHeight(void) const
918 return GetSizeF().height;
922 _TableViewItem::SetItemHeight(int itemHeight)
924 SetItemHeight(_CoordinateSystemUtils::ConvertToFloat(itemHeight));
928 _TableViewItem::SetItemHeight(float itemHeight)
930 if (_FloatCompare(GetSizeF().height, itemHeight))
935 SetSize(FloatDimension(GetSizeF().width, itemHeight));
939 _TableViewItem::SetChecked(bool checked)
941 if (__checkedState == checked)
946 __checkedState = checked;
948 SetItemChanged(true);
952 _TableViewItem::IsChecked(void) const
954 return __checkedState;
958 _TableViewItem::SetCheckedAnimationEnabled(bool enabled)
960 if (__isCheckedAnimationEnabled == enabled)
965 __isCheckedAnimationEnabled = enabled;
967 if (__isCheckedAnimationEnabled == false)
969 StopCheckBoxAnimation();
974 _TableViewItem::SetItemEnabled(bool enabled)
976 if (__enabledState == enabled)
981 __enabledState = enabled;
983 SetEnableState(enabled);
985 SetItemChanged(true);
993 _TableViewItem::IsItemEnabled(void) const
995 return __enabledState;
999 _TableViewItem::SetItemType(const TableViewItemType itemType)
1001 if (__itemType == itemType)
1006 __itemType = itemType;
1008 if (__pContextItem != null)
1010 __pContextItem->SetItemType(__itemType);
1013 if (itemType == TABLE_VIEW_ITEM_TYPE_TITLE)
1016 GET_COLOR_CONFIG(TABLEVIEW::ITEM_BG_PRESSED, titleColor);
1017 if (titleColor == __colorItemBg[TABLE_VIEW_ITEM_DRAWING_STATUS_PRESSED])
1019 GET_COLOR_CONFIG(TABLEVIEW::GROUPITEM_BG_PRESSED, __colorItemBg[TABLE_VIEW_ITEM_DRAWING_STATUS_PRESSED]);
1021 GetAccessibilityContainer()->Activate(true);
1026 _TableViewItem::SetItemIndex(int groupIndex, int itemIndex)
1028 __itemGroupIndex = groupIndex;
1029 __itemIndex = itemIndex;
1033 _TableViewItem::GetItemIndex(int& groupIndex, int& itemIndex) const
1035 groupIndex = __itemGroupIndex;
1036 itemIndex = __itemIndex;
1041 _TableViewItem::GetItemType(void) const
1047 _TableViewItem::IsReorderMode(void) const
1049 return __reorderMode;
1053 _TableViewItem::SetReorderMode(bool enabled)
1055 __reorderMode = enabled;
1059 _TableViewItem::SetAppInfo(const void* pAppInfo)
1061 __pAppInfo = const_cast<void*>(pAppInfo);
1065 _TableViewItem::GetAppInfo(void) const
1071 _TableViewItem::SetItemChanged(bool changed)
1073 __itemChanged = changed;
1077 _TableViewItem::IsItemChanged(void) const
1079 return __itemChanged;
1083 _TableViewItem::IsAnnexOnOffSliding(void)
1085 return __annexOnOffHandlerMoved;
1089 _TableViewItem::GetItemStyle(void) const
1091 return __annexStyle;
1095 _TableViewItem::DrawItem(FloatRectangle& rcItem, ListItemState itemState, bool itemDivider)
1101 _TableViewItem::SetItemTapSoundEnabled(bool tapSoundEnabled)
1103 bool oldValue = __isItemTapSoundEnabled;
1104 __isItemTapSoundEnabled = tapSoundEnabled;
1109 _TableViewItem::GetItemTapSoundEnabled(void)
1111 return __isItemTapSoundEnabled;
1115 _TableViewItem::DrawAnnexFocus(void)
1119 __pItemAnnex->SetFocus();
1124 Tizen::Graphics::Canvas*
1125 _TableViewItem::OnCanvasRequestedN(const Tizen::Graphics::FloatRectangle& bounds)
1127 Canvas* pCanvas = null;
1129 if (__pBitmapVisualElement != null && __pBitmapVisualElement->GetImageSource().IsEmpty())
1131 Bitmap* pDrawBitmap = __pItemBgBitmap[__drawingStatus];
1132 if (pDrawBitmap != null)
1134 pCanvas = __pBitmapVisualElement->GetCanvasN();
1135 SysTryCatch(NID_UI_CTRL, pCanvas != null, , E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
1136 pCanvas->SetBackgroundColor(Color(0, 0, 0, 0));
1139 pDrawBitmap->IsNinePatchedBitmap();
1140 DrawBitmap(*pCanvas, FloatRectangle(0.0f, 0.0f, bounds.width, bounds.height), *pDrawBitmap);
1150 _TableViewItem::FireItemEvent(bool selectedItem)
1154 || __itemType == TABLE_VIEW_ITEM_TYPE_HEADER
1155 || __itemType == TABLE_VIEW_ITEM_TYPE_FOOTER)
1160 _TableView* pParent = dynamic_cast<_TableView*>(GetParent());
1161 if (pParent == null)
1166 TableViewNotifyType eventType = TABLEVIEW_NOTIFY_TYPE_SELECTED_ITEM;
1168 if ((__annexStyle == TABLE_VIEW_ANNEX_STYLE_MARK)
1169 || (__annexStyle == TABLE_VIEW_ANNEX_STYLE_RADIO)
1170 || (__annexStyle == TABLE_VIEW_ANNEX_STYLE_ONOFF_SLIDING))
1174 eventType = TABLEVIEW_NOTIFY_TYPE_ANNEX_CHECK;
1178 eventType = TABLEVIEW_NOTIFY_TYPE_ANNEX_UNCHECK;
1181 else if (__annexStyle == TABLE_VIEW_ANNEX_STYLE_DETAILED)
1185 eventType = TABLEVIEW_NOTIFY_TYPE_ANNEX_MORE;
1188 else if (__annexStyle == TABLE_VIEW_ANNEX_STYLE_ONOFF_SLIDING_WITH_DIVIDER)
1192 eventType = TABLEVIEW_NOTIFY_TYPE_SELECTED_ITEM;
1198 eventType = TABLEVIEW_NOTIFY_TYPE_ANNEX_CHECK;
1202 eventType = TABLEVIEW_NOTIFY_TYPE_ANNEX_UNCHECK;
1207 if (__isItemTapSoundEnabled)
1209 if (!__isTabSoundPlayed)
1211 PLAY_FEEDBACK(_RESOURCE_FEEDBACK_PATTERN_TAP, this);
1215 __isTabSoundPlayed = false;
1216 __checkItemHeightNeeded = true;
1218 int groupIndex = -1;
1220 GetItemIndex(groupIndex, itemIndex);
1221 pParent->FireTableViewItemEvent(groupIndex, itemIndex, eventType, this);
1225 _TableViewItem::FireItemSweepEvent(TableViewSweepDirection direction)
1227 if (HasParent() == false)
1232 _TableView* pParent = dynamic_cast<_TableView*>(GetParent());
1233 if (pParent == null)
1238 int groupIndex = -1;
1240 GetItemIndex(groupIndex, itemIndex);
1242 pParent->FireTableViewItemSweepEvent(groupIndex, itemIndex, direction);
1246 _TableViewItem::OnTouchPressed(const _Control& source, const _TouchInfo& touchinfo)
1248 __isTouchCancelOnPressRelease = false;
1250 if (IsContextItem() ||
1251 __isContextItemActivated ||
1252 IsAnimationPlaying() ||
1258 if (IsTouchPressOnScroll())
1263 __annexOnOffHandlerMoved = false;
1264 __touchStartPosition = touchinfo.GetCurrentPosition();
1266 if (&source == this)
1268 __pressedControl = TABLE_VIEW_ITEM_PRESSED_ITEM;
1270 else if (&source == GetLabelCore(__pItemAnnex))
1272 __pressedControl = TABLE_VIEW_ITEM_PRESSED_ANNEX;
1274 if (__annexStyle == TABLE_VIEW_ANNEX_STYLE_ONOFF_SLIDING ||
1275 __annexStyle == TABLE_VIEW_ANNEX_STYLE_ONOFF_SLIDING_WITH_DIVIDER)
1277 __annexTouchStartPosition = touchinfo.GetCurrentPosition().x;
1280 else if (IsIndividualSelectionEnabled(source))
1282 __pressedControl = TABLE_VIEW_ITEM_PRESSED_INDIVIDUAL;
1286 __pressedControl = TABLE_VIEW_ITEM_PRESSED_NONE;
1289 if (__isReleasedTimerEnabled)
1291 StopTouchReleasedTimer();
1293 _TableView* pParent = dynamic_cast<_TableView*>(GetParent());
1294 if (pParent != null)
1296 int groupIndex = -1;
1298 GetItemIndex(groupIndex, itemIndex);
1299 pParent->FireItemTouchReleasedEventDuringPressing(groupIndex, itemIndex);
1304 if (!IsIndividualSelectionEnabled(source))
1306 __itemSelected = true;
1307 if (unlikely((_AccessibilityManager::IsActivated())))
1309 FireItemTouchPressed();
1313 StartTouchPressedTimer(source, touchinfo);
1322 _TableViewItem::OnTouchReleased(const _Control& source, const _TouchInfo& touchinfo)
1324 if (IsReorderMode())
1329 if (IsTouchPressOnScroll())
1331 SetTouchPressOnScroll(false);
1335 if (&source == this)
1337 __releasedControl = TABLE_VIEW_ITEM_PRESSED_ITEM;
1339 else if (&source == GetLabelCore(__pItemAnnex))
1341 __releasedControl = TABLE_VIEW_ITEM_PRESSED_ANNEX;
1343 else if (IsIndividualSelectionEnabled(source))
1345 __releasedControl = TABLE_VIEW_ITEM_PRESSED_INDIVIDUAL;
1349 __releasedControl = TABLE_VIEW_ITEM_PRESSED_NONE;
1352 __isTabSoundPlayed = IS_PLAYED_FEEDBACK();
1354 if (!__itemTouchMoved && __isPressedTimerEnabled)
1356 StopTouchPressedTimer();
1358 if (!IsContextItem())
1360 FireItemTouchPressed();
1363 StartTouchReleasedTimer();
1367 FireItemTouchReleased();
1372 _TableViewItem::FireItemTouchPressed()
1374 if (__isTouchCancelOnPressRelease == true)
1379 if (__pressedControl == TABLE_VIEW_ITEM_PRESSED_ITEM)
1381 __drawingStatus = TABLE_VIEW_ITEM_DRAWING_STATUS_PRESSED;
1382 SetItemChanged(true);
1385 else if (__pressedControl == TABLE_VIEW_ITEM_PRESSED_ANNEX)
1387 if (__annexStyle == TABLE_VIEW_ANNEX_STYLE_DETAILED)
1389 __drawingStatus = TABLE_VIEW_ITEM_DRAWING_STATUS_NORMAL;
1390 __isSelectedDetailButton = true;
1393 else if (__annexStyle == TABLE_VIEW_ANNEX_STYLE_ONOFF_SLIDING ||
1394 __annexStyle == TABLE_VIEW_ANNEX_STYLE_ONOFF_SLIDING_WITH_DIVIDER)
1396 __drawingStatus = TABLE_VIEW_ITEM_DRAWING_STATUS_NORMAL;
1400 __drawingStatus = TABLE_VIEW_ITEM_DRAWING_STATUS_PRESSED;
1401 SetItemChanged(true);
1407 if (__pressedControl != TABLE_VIEW_ITEM_PRESSED_INDIVIDUAL)
1409 __drawingStatus = TABLE_VIEW_ITEM_DRAWING_STATUS_PRESSED;
1410 SetItemChanged(true);
1417 _TableViewItem::FireItemTouchReleased()
1419 if (__isTouchCancelOnPressRelease == true)
1424 bool fireItemEvent = false;
1425 bool selectedItem = true;
1427 __drawingStatus = TABLE_VIEW_ITEM_DRAWING_STATUS_NORMAL;
1429 if (__itemSelected == true)
1431 bool checked = IsChecked();
1432 fireItemEvent = true;
1434 if (__releasedControl == TABLE_VIEW_ITEM_PRESSED_ITEM)
1436 if ((__annexStyle == TABLE_VIEW_ANNEX_STYLE_RADIO)
1437 || (__annexStyle == TABLE_VIEW_ANNEX_STYLE_ONOFF_SLIDING))
1439 SetChecked(!checked);
1441 else if (__annexStyle == TABLE_VIEW_ANNEX_STYLE_MARK)
1443 SetChecked(!checked);
1444 SetCheckedAnimationEnabled(!checked);
1447 else if (__releasedControl == TABLE_VIEW_ITEM_PRESSED_ANNEX)
1449 if (__annexStyle == TABLE_VIEW_ANNEX_STYLE_DETAILED)
1451 __isSelectedDetailButton = false;
1453 selectedItem = false;
1455 else if (__annexStyle == TABLE_VIEW_ANNEX_STYLE_ONOFF_SLIDING ||
1456 __annexStyle == TABLE_VIEW_ANNEX_STYLE_ONOFF_SLIDING_WITH_DIVIDER)
1458 bool isPreviousChecked = IsChecked();
1459 AdjustAnnexOnOffHandlerPosition();
1460 selectedItem = false;
1461 if (isPreviousChecked == IsChecked())
1463 fireItemEvent = false;
1468 SetChecked(!checked);
1469 SetCheckedAnimationEnabled(!checked);
1474 if (__releasedControl != TABLE_VIEW_ITEM_PRESSED_INDIVIDUAL)
1476 if ((__annexStyle == TABLE_VIEW_ANNEX_STYLE_MARK)
1477 || (__annexStyle == TABLE_VIEW_ANNEX_STYLE_RADIO)
1478 || (__annexStyle == TABLE_VIEW_ANNEX_STYLE_ONOFF_SLIDING))
1480 SetChecked(!checked);
1481 SetCheckedAnimationEnabled(!checked);
1486 fireItemEvent = false;
1490 SetItemChanged(true);
1495 if (__releasedControl == TABLE_VIEW_ITEM_PRESSED_ANNEX)
1497 if (__annexStyle == TABLE_VIEW_ANNEX_STYLE_ONOFF_SLIDING ||
1498 __annexStyle == TABLE_VIEW_ANNEX_STYLE_ONOFF_SLIDING_WITH_DIVIDER)
1500 bool isPreviousChecked = IsChecked();
1501 AdjustAnnexOnOffHandlerPosition();
1502 fireItemEvent = true;
1503 if (isPreviousChecked == IsChecked())
1505 fireItemEvent = false;
1511 __itemSelected = false;
1512 __annexOnOffHandlerMoved = false;
1513 __itemTouchMoved = false;
1517 int groupIndex = -1;
1519 GetItemIndex(groupIndex, itemIndex);
1522 _TableView* pTableView = dynamic_cast<_TableView*>(GetParent());
1525 pTableView->SetFocusItemOnPressedState(groupIndex, itemIndex);
1528 FireItemEvent(selectedItem);
1533 _TableViewItem::OnTouchMoved(const _Control& source, const _TouchInfo& touchinfo)
1535 if (IsReorderMode())
1540 if (IsTouchPressOnScroll())
1542 SetTouchPressOnScroll(false);
1545 if (__isPressedTimerEnabled)
1547 StopTouchPressedTimer();
1550 bool retVal = false;
1552 if (&source == this)
1554 __itemSelected = false;
1555 __drawingStatus = TABLE_VIEW_ITEM_DRAWING_STATUS_NORMAL;
1557 SetItemChanged(true);
1560 else if (&source == GetLabelCore(__pItemAnnex))
1562 if (__annexStyle == TABLE_VIEW_ANNEX_STYLE_DETAILED)
1564 __isSelectedDetailButton = false;
1565 __itemSelected = false;
1568 else if (__annexStyle == TABLE_VIEW_ANNEX_STYLE_ONOFF_SLIDING ||
1569 __annexStyle == TABLE_VIEW_ANNEX_STYLE_ONOFF_SLIDING_WITH_DIVIDER)
1571 __annexOnOffHandlerMoved = true;
1572 DrawAnnexOnOffHandler(touchinfo.GetCurrentPosition().x);
1577 __itemSelected = false;
1578 __drawingStatus = TABLE_VIEW_ITEM_DRAWING_STATUS_NORMAL;
1580 SetItemChanged(true);
1586 if (!IsIndividualSelectionEnabled(source))
1588 __itemSelected = false;
1589 __drawingStatus = TABLE_VIEW_ITEM_DRAWING_STATUS_NORMAL;
1591 SetItemChanged(true);
1596 __itemTouchMoved = true;
1602 _TableViewItem::OnTouchCanceled(const _Control& source, const _TouchInfo& touchinfo)
1604 __isTouchCancelOnPressRelease = true;
1606 if (__isPressedTimerEnabled)
1608 StopTouchPressedTimer();
1611 __annexOnOffHandlerMoved = false;
1612 __itemTouchMoved = false;
1616 if (&source != this)
1624 _UiTouchEventDelivery
1625 _TableViewItem::OnPreviewTouchPressed(const _Control& source, const _TouchInfo& touchinfo)
1627 if (IsTouchPressOnScroll())
1629 SetTouchPressOnScroll(false);
1630 return _UI_TOUCH_EVENT_DELIVERY_NO;
1632 return _UI_TOUCH_EVENT_DELIVERY_FORCED_YES;
1635 _UiTouchEventDelivery
1636 _TableViewItem::OnPreviewTouchReleased(const _Control& source, const _TouchInfo& touchinfo)
1638 return _UI_TOUCH_EVENT_DELIVERY_FORCED_YES;
1641 _UiTouchEventDelivery
1642 _TableViewItem::OnPreviewTouchMoved(const _Control& source, const _TouchInfo& touchinfo)
1644 return _UI_TOUCH_EVENT_DELIVERY_YES;
1647 _UiTouchEventDelivery
1648 _TableViewItem::OnPreviewTouchCanceled(const _Control& source, const _TouchInfo& touchinfo)
1650 return _UI_TOUCH_EVENT_DELIVERY_FORCED_YES;
1654 _TableViewItem::OnDraw(void)
1656 if (IsItemChanged() == true)
1658 DrawItemBackground();
1662 DrawSectionStyleBackgroundCover();
1664 SetItemChanged(false);
1669 _TableViewItem::OnChildAttached(const _Control& child)
1671 _Control* pControl = const_cast<_Control*>(&child);
1672 _AccessibilityContainer* pContainer = pControl->GetAccessibilityContainer();
1674 if (__individualSelectionControls.Contains(child))
1676 pContainer->Activate(true);
1680 pContainer->Activate(false);
1682 if (!(pControl == static_cast<_Control*>(__pItemAnnexLeftDivider)
1683 || pControl == static_cast<_Control*>(__pItemAnnexRightDivider)
1684 || pControl == static_cast<_Control*>(__pItemCover)
1685 || pControl == static_cast<_Control*>(__pItemDivider)
1686 || pControl== static_cast<_Control*>(__pItemTopDivider)))
1688 GetAccessibilityContainer()->Activate(true);
1692 DeactivateChildAccessibilityContainer(child);
1694 pControl->SetTouchPressThreshold(SENSITIVE);
1696 FloatRectangle bounds = child.GetBoundsF();
1698 if (__pDrawingProperty != null && __pDrawingProperty->groupedLookEnabled)
1700 float groupedBarMargin = 0.0f;
1701 GET_SHAPE_CONFIG(TABLEVIEW::GROUPITEM_BAR_WIDTH, _CONTROL_ORIENTATION_PORTRAIT, groupedBarMargin);
1703 bounds.x += groupedBarMargin;
1706 if ((__annexStyle == TABLE_VIEW_ANNEX_STYLE_MARK) || (__annexStyle == TABLE_VIEW_ANNEX_STYLE_RADIO))
1708 if (GetLabelCore(__pItemAnnex) == &child ||
1709 GetLabelCore(__pSimpleItemBitmap) == &child ||
1710 GetLabelCore(__pSimpleItemText) == &child)
1715 float leftMargin = 0.0f;
1716 float annexWidth = 0.0f;
1718 GET_SHAPE_CONFIG(TABLEVIEW::ITEM_LEFT_MARGIN, _CONTROL_ORIENTATION_PORTRAIT, leftMargin);
1719 GET_SHAPE_CONFIG(TABLEVIEW::ITEM_ANNEX_WIDTH, _CONTROL_ORIENTATION_PORTRAIT, annexWidth);
1721 bounds.x += (leftMargin * 2) + annexWidth;
1724 pControl->SetBounds(bounds);
1728 _TableViewItem::OnChildDetached(const _Control& child)
1730 if (__individualSelectionControls.Contains(child))
1732 __individualSelectionControls.Remove(child, false);
1735 _Label* pSimpleItemTextCore = GetLabelCore(__pSimpleItemText);
1736 _Label* pSimpleItemBitmapCore = GetLabelCore(__pSimpleItemBitmap);
1738 if (&child == pSimpleItemTextCore)
1740 __pSimpleItemText = null;
1743 if (&child == pSimpleItemBitmapCore)
1745 __pSimpleItemBitmap = null;
1750 _TableViewItem::OnTimerExpired(Tizen::Base::Runtime::Timer& timer)
1752 result r = E_SUCCESS;
1754 if (&timer == __pCheckedTimer)
1756 if (__checkedCount < MAX_CHECKED_COUNT)
1758 r = __pCheckedTimer->Start(CHECKED_ANIMATION_DURATION);
1759 SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
1762 r = PlayCheckBoxAnimation();
1763 SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
1765 if (__checkedCount < MAX_CHECKED_COUNT)
1772 __isCheckedAnimationEnabled = false;
1773 __isCheckedTimerEnabled = false;
1776 else if (&timer == __pPressedTimer)
1778 __isPressedTimerEnabled = false;
1779 FireItemTouchPressed();
1781 else if (&timer == __pReleasedTimer)
1783 __isReleasedTimerEnabled = false;
1784 FireItemTouchReleased();
1789 _TableViewItem::StartTouchPressedTimer(const _Control& source, const _TouchInfo& touchinfo)
1791 result r = E_SUCCESS;
1793 if (__pPressedTimer == null)
1795 __pPressedTimer = new (std::nothrow) Timer();
1796 SysTryCatch(NID_UI_CTRL, __pPressedTimer != null, r = E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
1798 r = __pPressedTimer->Construct(*this);
1799 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage);
1802 if (__isPressedTimerEnabled == false)
1804 r = __pPressedTimer->Start(TOUCH_PRESSED_DURATION);
1805 SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "Propagating.");
1807 __isPressedTimerEnabled = true;
1813 if (__isPressedTimerEnabled && __pPressedTimer != null)
1815 __pPressedTimer->Cancel();
1818 delete __pPressedTimer;
1819 __pPressedTimer = null;
1825 _TableViewItem::StopTouchPressedTimer(bool forceStop)
1827 result r = E_SUCCESS;
1829 if (__pPressedTimer == null)
1834 if (__isPressedTimerEnabled || forceStop)
1836 r = __pPressedTimer->Cancel();
1837 SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
1840 __isPressedTimerEnabled = false;
1846 _TableViewItem::StartTouchReleasedTimer()
1848 result r = E_SUCCESS;
1850 if (__pReleasedTimer == null)
1852 __pReleasedTimer = new (std::nothrow) Timer();
1853 SysTryCatch(NID_UI_CTRL, __pReleasedTimer != null, r = E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
1856 r = __pReleasedTimer->Construct(*this);
1857 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage);
1860 if (!__isReleasedTimerEnabled)
1862 r = __pReleasedTimer->Start(TOUCH_RELEASED_DURATION);
1863 SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "Propagating.");
1865 __isReleasedTimerEnabled = true;
1870 if (__isReleasedTimerEnabled && __pReleasedTimer != null)
1872 __pReleasedTimer->Cancel();
1875 delete __pReleasedTimer;
1876 __pReleasedTimer = null;
1882 _TableViewItem::StopTouchReleasedTimer(bool forceStop)
1884 result r = E_SUCCESS;
1886 if (__pReleasedTimer == null)
1891 if (__isReleasedTimerEnabled || forceStop)
1893 r = __pReleasedTimer->Cancel();
1894 SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
1897 __isReleasedTimerEnabled = false;
1903 _TableViewItem::OnAncestorInputEnableStateChanged(const _Control& control)
1905 if (__isPressedTimerEnabled)
1907 StopTouchPressedTimer();
1910 __annexOnOffHandlerMoved = false;
1911 __itemTouchMoved = false;
1913 __itemSelected = false;
1914 __drawingStatus = TABLE_VIEW_ITEM_DRAWING_STATUS_NORMAL;
1916 if (__annexStyle == TABLE_VIEW_ANNEX_STYLE_DETAILED)
1918 __isSelectedDetailButton = false;
1921 SetItemChanged(true);
1926 _TableViewItem::StartCheckBoxAnimation(void)
1928 result r = E_SUCCESS;
1930 if (__pCheckedTimer == null)
1932 __pCheckedTimer = new (std::nothrow) Timer();
1933 SysTryCatch(NID_UI_CTRL, __pCheckedTimer != null, r = E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
1936 r = __pCheckedTimer->Construct(*this);
1937 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage);
1940 if (__isCheckedTimerEnabled == false)
1942 r = __pCheckedTimer->Start(CHECKED_ANIMATION_DURATION);
1943 SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "Propagating.");
1945 __isCheckedTimerEnabled = true;
1951 if (__isCheckedTimerEnabled)
1953 __pCheckedTimer->Cancel();
1956 delete __pCheckedTimer;
1957 __pCheckedTimer = null;
1963 _TableViewItem::StopCheckBoxAnimation(void)
1965 result r = E_SUCCESS;
1967 SysTryReturnVoidResult(NID_UI_CTRL, __pCheckedTimer != null, E_SYSTEM, "[%s] A system error has been occurred. Timer is invalid.", GetErrorMessage(E_SYSTEM));
1970 if (__isCheckedTimerEnabled)
1972 r = __pCheckedTimer->Cancel();
1973 SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
1977 __isCheckedAnimationEnabled = false;
1978 __isCheckedTimerEnabled = false;
1984 _TableViewItem::PlayCheckBoxAnimation(void)
1986 Bitmap* pCheckBox = null;
1987 Bitmap* pCheckBoxBg = null;
1988 Bitmap* pMergeBitmap = null;
1989 Canvas* pCanvas = null;
1990 result r = E_SUCCESS;
1992 FloatRectangle bounds;
1994 float annexWidth = 0.0f;
1995 float annexHeight = 0.0f;
1997 if (__drawingStatus == TABLE_VIEW_ITEM_DRAWING_STATUS_NORMAL)
1999 r = GET_BITMAP_CONFIG_N(TABLEVIEW::CHECKBOX_BG_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, pCheckBoxBg);
2001 else if ((__drawingStatus == TABLE_VIEW_ITEM_DRAWING_STATUS_PRESSED) || (__drawingStatus == TABLE_VIEW_ITEM_DRAWING_STATUS_HIGHLIGHTED))
2003 r = GET_BITMAP_CONFIG_N(TABLEVIEW::CHECKBOX_BG_PRESSED, BITMAP_PIXEL_FORMAT_ARGB8888, pCheckBoxBg);
2005 SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS) && (pCheckBoxBg != null), , E_SYSTEM, "[%s] Propagating.", GetErrorMessage(r));
2007 r = GET_BITMAP_CONFIG_N(TABLEVIEW::CHECKBOX_CHECK_MARK_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, pCheckBox);
2008 SysTryCatch(NID_UI_CTRL,(r == E_SUCCESS) && (pCheckBox != null), , E_SYSTEM, "[%s] Propagating.", GetErrorMessage(r));
2010 GET_SHAPE_CONFIG(TABLEVIEW::ITEM_ANNEX_WIDTH, _CONTROL_ORIENTATION_PORTRAIT, annexWidth);
2011 GET_SHAPE_CONFIG(TABLEVIEW::ITEM_ANNEX_HEIGHT, _CONTROL_ORIENTATION_PORTRAIT, annexHeight);
2013 bounds.SetBounds(0, 0, annexWidth, annexHeight);
2015 pCanvas = new (std::nothrow) Canvas();
2016 SysTryCatch(NID_UI_CTRL, pCanvas != null, , E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
2018 r = pCanvas->Construct(bounds);
2019 pCanvas->SetBackgroundColor(Color(0, 0, 0, 0));
2022 DrawBitmap(*pCanvas, CalculateAnnexBitmapBounds(annexWidth, annexHeight, *pCheckBoxBg), *pCheckBoxBg);
2024 __checkedBounds = CalculateAnnexBitmapBounds(annexWidth, annexHeight, *pCheckBox);
2025 if (IsChecked() == true)
2027 if (_BitmapImpl::CheckNinePatchedBitmapStrictly(*pCheckBox))
2029 FloatRectangle drawingRect(__checkedBounds.x, __checkedBounds.y, __checkedBounds.width, __checkedBounds.height);
2030 r = pCanvas->DrawNinePatchedBitmap(drawingRect, *pCheckBox); // +++ check floating
2034 FloatRectangle bitmapSourceRect(0.0f, 0.0f, pCheckBox->GetWidthF()*__checkedCount * 0.1, pCheckBox->GetHeightF());
2035 FloatRectangle drawingRect(__checkedBounds.x, __checkedBounds.y, __checkedBounds.width * __checkedCount * 0.1, __checkedBounds.height);
2036 r = pCanvas->DrawBitmap(drawingRect, *pCheckBox, bitmapSourceRect); // +++ check floating
2040 pMergeBitmap = new (std::nothrow) Bitmap();
2041 SysTryCatch(NID_UI_CTRL, pMergeBitmap != null, , E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
2043 pMergeBitmap->Construct(*pCanvas, bounds);
2044 _BitmapImpl::ConvertToNonpremultiplied(*pMergeBitmap, true);
2048 __pItemAnnex->SetBackgroundBitmap(*pMergeBitmap);
2049 __pItemAnnex->Invalidate(false);
2055 delete pMergeBitmap;
2062 _TableViewItem::SetItemLayoutEnabled(bool enabled)
2064 __isItemLayoutEnabled = enabled;
2068 _TableViewItem::GetItemLayoutEnabled(void)
2070 return __isItemLayoutEnabled;
2074 _TableViewItem::OnBoundsChanged(void)
2076 if (__checkItemHeightNeeded && HasParent())
2078 _TableView* pParent = dynamic_cast<_TableView*>(GetParent());
2079 if (pParent != null)
2081 int groupIndex = -1;
2083 GetItemIndex(groupIndex, itemIndex);
2085 pParent->CheckItemHeightAndRefreshLayout(groupIndex, itemIndex);
2088 __checkItemHeightNeeded = false;
2091 AdjustAnnexBounds();
2093 SetItemHighlightBounds(*__pHighlightVisualElement, CalculateItemHighlightBounds());
2095 if (__pHeaderFooterItemText != null)
2097 FloatRectangle textBounds = __pHeaderFooterItemText->GetBoundsF();
2098 textBounds.width = GetBoundsF().width;
2100 if (__itemType == TABLE_VIEW_ITEM_TYPE_FOOTER)
2102 textBounds.x -= __pDrawingProperty->scrollMargin;
2105 __pHeaderFooterItemText->SetBounds(textBounds);
2108 if (__pBitmapVisualElement != null)
2110 FloatRectangle bounds = GetBoundsF();
2111 __pBitmapVisualElement->SetBounds(FloatRectangle(0.0f, 0.0f, bounds.width, bounds.height));
2114 if (__pAccessibilityElement != null)
2116 __pAccessibilityElement->SetBounds(FloatRectangle(0.0f,0.0f, GetBoundsF().width, GetBoundsF().height));
2120 if (IsFocusModeStateEnabled())
2122 RemoveFocusRing(true);
2124 if (GetRootWindow() && GetRootWindow()->IsActivated()
2133 _TableViewItem::SetDrawingProperty(_ItemDrawingProperty* pDrawingProperty)
2136 SysTryReturnVoidResult(NID_UI_CTRL, pDrawingProperty != null, E_INVALID_ARG, "[%s] Invalid argument(s) is used. The pDrawingProperty is null.", GetErrorMessage(E_INVALID_ARG));
2138 __pDrawingProperty = pDrawingProperty;
2140 if (__pDrawingProperty->sectionStyleEnabled == true &&
2146 if (__pDrawingProperty->itemDividerEnabled)
2148 CreateItemDivider();
2154 _ItemDrawingProperty*
2155 _TableViewItem::GetDrawingProperty(void)
2157 return __pDrawingProperty;
2161 _TableViewItem::DrawItemBackground(void)
2163 Canvas* pCanvas = null;
2164 Bitmap* pDrawBitmap = __pItemBgBitmap[__drawingStatus];
2165 Color bgColor = __colorItemBg[__drawingStatus];
2166 FloatRectangle bounds = GetBoundsF();
2168 SetItemHighlightBounds(*__pHighlightVisualElement, CalculateItemHighlightBounds());
2169 __pHighlightVisualElement->SetBackgroundColor(_Colorf(0.0f, 0.0f, 0.0f, 0.0f));
2171 if (pDrawBitmap != null && __enabledState)
2173 if (__pBitmapVisualElement == null)
2178 String imagePath = null;
2179 if (_BitmapImpl::CheckNinePatchedBitmapStrictly(*pDrawBitmap) == false)
2181 imagePath = _BitmapImpl::GetInstance(*pDrawBitmap)->GetFileName();
2184 if (imagePath.IsEmpty() == false)
2186 __pBitmapVisualElement->SetBackgroundColor(_Colorf((float)bgColor.GetRed() /255, (float)bgColor.GetGreen() / 255, (float)bgColor.GetBlue() / 255, (float)bgColor.GetAlpha() / 255));
2187 __pBitmapVisualElement->SetImageSource(imagePath);
2191 pCanvas = __pBitmapVisualElement->GetCanvasN();
2192 SysTryCatch(NID_UI_CTRL, pCanvas != null, , E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
2193 pCanvas->SetBackgroundColor(Color(0, 0, 0, 0));
2196 DrawBitmap(*pCanvas, FloatRectangle(0.0f, 0.0f, bounds.width, bounds.height), *pDrawBitmap);
2200 if (IsContextItem())
2202 DrawContextItemBackground();
2204 else if (__pDrawingProperty->sectionStyleEnabled == true)
2206 DrawSectionStyleBackground();
2212 if (__itemType == TABLE_VIEW_ITEM_TYPE_HEADER || __itemType == TABLE_VIEW_ITEM_TYPE_FOOTER)
2214 SetBackgroundColor(Color(0, 0, 0, 0));
2215 __pHighlightVisualElement->SetBackgroundColor(_Colorf(0.0f, 0.0f, 0.0f, 0.0f));
2217 else if (__itemType == TABLE_VIEW_ITEM_TYPE_TITLE)
2219 __pHighlightVisualElement->SetBackgroundColor(_Colorf((float)bgColor.GetRed() / 255.0f, (float)bgColor.GetGreen() / 255.0f, (float)bgColor.GetBlue() / 255.0f, (float)bgColor.GetAlpha() / 255.0f));
2223 SetBackgroundColor(__colorItemBg[TABLE_VIEW_ITEM_DRAWING_STATUS_NORMAL]);
2225 __pHighlightVisualElement->SetBackgroundColor(_Colorf((float)bgColor.GetRed() / 255.0f, (float)bgColor.GetGreen() / 255.0f, (float)bgColor.GetBlue() / 255.0f, (float)bgColor.GetAlpha() / 255.0f));
2227 if (__pDrawingProperty->groupedLookEnabled == true)
2235 GET_COLOR_CONFIG(TABLEVIEW::ITEM_BG_DISABLED, bgColor);
2236 SetBackgroundColor(bgColor);
2237 __pHighlightVisualElement->SetBackgroundColor(_Colorf((float)bgColor.GetRed() / 255.0f, (float)bgColor.GetGreen() / 255.0f, (float)bgColor.GetBlue() / 255.0f, (float)bgColor.GetAlpha() / 255.0f));
2239 if (__pDrawingProperty->groupedLookEnabled == true)
2251 if (__pBitmapVisualElement != null)
2253 __pBitmapVisualElement->RemoveAllAnimations();
2254 __pBitmapVisualElement->SetAnimationProvider(null);
2255 __pBitmapVisualElement->Destroy();
2256 __pBitmapVisualElement = null;
2261 _TableViewItem::DrawGroupedLook(void)
2263 if (IsTitleStyleItem() || IsContextItem())
2269 Color outlineColor = __pDrawingProperty->dividerColor;
2271 float barWidth = 0.0f;
2273 Canvas* pCanvas = GetVisualElement()->GetCanvasN();
2274 SysTryReturnVoidResult(NID_UI_CTRL, pCanvas != null, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
2276 FloatRectangle bounds = GetBoundsF();
2277 pCanvas->SetBackgroundColor(GetBackgroundColor());
2280 GET_COLOR_CONFIG(TABLEVIEW::GROUPITEM_BAR_NORMAL, barColor);
2281 GET_SHAPE_CONFIG(TABLEVIEW::GROUPITEM_BAR_WIDTH, _CONTROL_ORIENTATION_PORTRAIT, barWidth);
2283 pCanvas->FillRectangle(barColor, FloatRectangle(0.0f, 0.0f, barWidth, bounds.height));
2285 if (__pDrawingProperty->sectionStyleEnabled == true)
2287 pCanvas->FillRectangle(outlineColor, FloatRectangle(bounds.width - 1.0f, 0.0f, 1.0f, bounds.height));
2289 if (__itemType == TABLE_VIEW_ITEM_TYPE_TOP || __itemType == TABLE_VIEW_ITEM_TYPE_ONE)
2291 pCanvas->FillRectangle(outlineColor, FloatRectangle(0.0f, 0.0f, bounds.width, 1.0f));
2299 _TableViewItem::DrawSectionStyleBackground(void)
2301 Canvas* pCanvas = null;
2302 Bitmap* pReplacementSectionPressBg = null;
2303 Bitmap* pReplacementSectionBg = null;
2304 Bitmap* pReplacementSectionDisabledBg = null;
2305 Color bgColor = __colorItemBg[__drawingStatus];
2306 FloatRectangle bounds = GetBoundsF();
2307 float dividerHeight = 0.0f;
2309 result r = E_SUCCESS;
2311 pCanvas = GetVisualElement()->GetCanvasN();
2312 SysTryReturnVoidResult(NID_UI_CTRL, pCanvas != null, GetLastResult(), "[%s] Propagating.", GetErrorMessage(r));
2314 pCanvas->SetBackgroundColor(Color(0, 0, 0, 0));
2317 if (bgColor != null)
2319 if (__itemType == TABLE_VIEW_ITEM_TYPE_ONE)
2321 r = GET_REPLACED_BITMAP_CONFIG_N(TABLEVIEW::SECTIONITEM_SINGLE_BG_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, bgColor, pReplacementSectionBg);
2323 else if (__itemType == TABLE_VIEW_ITEM_TYPE_TOP)
2325 r = GET_REPLACED_BITMAP_CONFIG_N(TABLEVIEW::SECTIONITEM_TOP_BG_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, bgColor, pReplacementSectionBg);
2327 else if (__itemType == TABLE_VIEW_ITEM_TYPE_MIDDLE)
2329 r = GET_REPLACED_BITMAP_CONFIG_N(TABLEVIEW::SECTIONITEM_CENTER_BG_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, bgColor, pReplacementSectionBg);
2331 else if (__itemType == TABLE_VIEW_ITEM_TYPE_BOTTOM)
2333 r = GET_REPLACED_BITMAP_CONFIG_N(TABLEVIEW::SECTIONITEM_BOTTOM_BG_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, bgColor, pReplacementSectionBg);
2342 if (__itemType == TABLE_VIEW_ITEM_TYPE_ONE)
2344 r = GET_REPLACED_BITMAP_CONFIG_N(TABLEVIEW::SECTIONITEM_SINGLE_BG_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, __pDrawingProperty->sectionStyleBgColor, pReplacementSectionBg);
2346 else if (__itemType == TABLE_VIEW_ITEM_TYPE_TOP)
2348 r = GET_REPLACED_BITMAP_CONFIG_N(TABLEVIEW::SECTIONITEM_TOP_BG_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, __pDrawingProperty->sectionStyleBgColor, pReplacementSectionBg);
2350 else if (__itemType == TABLE_VIEW_ITEM_TYPE_MIDDLE)
2352 r = GET_REPLACED_BITMAP_CONFIG_N(TABLEVIEW::SECTIONITEM_CENTER_BG_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, __pDrawingProperty->sectionStyleBgColor, pReplacementSectionBg);
2354 else if (__itemType == TABLE_VIEW_ITEM_TYPE_BOTTOM)
2356 r = GET_REPLACED_BITMAP_CONFIG_N(TABLEVIEW::SECTIONITEM_BOTTOM_BG_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, __pDrawingProperty->sectionStyleBgColor, pReplacementSectionBg);
2363 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , E_SYSTEM, "[%s] A system error has been occurred. SectionStyle image load failed", GetErrorMessage(E_SYSTEM) );
2367 if (__drawingStatus == TABLE_VIEW_ITEM_DRAWING_STATUS_PRESSED || __drawingStatus == TABLE_VIEW_ITEM_DRAWING_STATUS_HIGHLIGHTED)
2369 if (__itemType == TABLE_VIEW_ITEM_TYPE_ONE)
2371 if (IS_CUSTOM_BITMAP(TABLEVIEW::SECTIONITEM_SINGLE_BG_PRESSED))
2373 r = GET_REPLACED_BITMAP_CONFIG_N(TABLEVIEW::SECTIONITEM_SINGLE_BG_PRESSED, BITMAP_PIXEL_FORMAT_ARGB8888, bgColor, pReplacementSectionPressBg);
2374 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , E_SYSTEM, "[%s] A system error has been occurred. SectionStyle image load failed", GetErrorMessage(E_SYSTEM) );
2377 else if (__itemType == TABLE_VIEW_ITEM_TYPE_TOP)
2379 if (IS_CUSTOM_BITMAP(TABLEVIEW::SECTIONITEM_TOP_BG_PRESSED))
2381 r = GET_REPLACED_BITMAP_CONFIG_N(TABLEVIEW::SECTIONITEM_TOP_BG_PRESSED, BITMAP_PIXEL_FORMAT_ARGB8888, bgColor, pReplacementSectionPressBg);
2382 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , E_SYSTEM, "[%s] A system error has been occurred. SectionStyle image load failed", GetErrorMessage(E_SYSTEM) );
2385 else if (__itemType == TABLE_VIEW_ITEM_TYPE_MIDDLE)
2387 if (IS_CUSTOM_BITMAP(TABLEVIEW::SECTIONITEM_CENTER_BG_PRESSED))
2389 r = GET_REPLACED_BITMAP_CONFIG_N(TABLEVIEW::SECTIONITEM_CENTER_BG_PRESSED, BITMAP_PIXEL_FORMAT_ARGB8888, bgColor, pReplacementSectionPressBg);
2390 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , E_SYSTEM, "[%s] A system error has been occurred. SectionStyle image load failed", GetErrorMessage(E_SYSTEM) );
2393 else if (__itemType == TABLE_VIEW_ITEM_TYPE_BOTTOM)
2395 if (IS_CUSTOM_BITMAP(TABLEVIEW::SECTIONITEM_BOTTOM_BG_PRESSED))
2397 r = GET_REPLACED_BITMAP_CONFIG_N(TABLEVIEW::SECTIONITEM_BOTTOM_BG_PRESSED, BITMAP_PIXEL_FORMAT_ARGB8888, bgColor, pReplacementSectionPressBg);
2398 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , E_SYSTEM, "[%s] A system error has been occurred. SectionStyle image load failed", GetErrorMessage(E_SYSTEM) );
2402 GET_FIXED_VALUE_CONFIG(TABLEVIEW::ITEM_DIVIDER_HEIGHT, _CONTROL_ORIENTATION_PORTRAIT, dividerHeight);
2404 if (pReplacementSectionPressBg)
2406 DrawBitmap(*pCanvas, FloatRectangle(0.0f, dividerHeight, bounds.width, bounds.height - (dividerHeight * 2)), *pReplacementSectionPressBg);
2410 DrawBitmap(*pCanvas, FloatRectangle(0.0f, dividerHeight, bounds.width, bounds.height - (dividerHeight * 2)), *pReplacementSectionBg);
2415 DrawBitmap(*pCanvas, FloatRectangle(0.0f, 0.0f, bounds.width, bounds.height), *pReplacementSectionBg);
2420 GET_COLOR_CONFIG(TABLEVIEW::ITEM_BG_DISABLED, bgColor);
2422 if (__itemType == TABLE_VIEW_ITEM_TYPE_ONE)
2424 if (IS_CUSTOM_BITMAP(TABLEVIEW::SECTIONITEM_SINGLE_BG_DISABLED))
2426 r = GET_REPLACED_BITMAP_CONFIG_N(TABLEVIEW::SECTIONITEM_SINGLE_BG_DISABLED, BITMAP_PIXEL_FORMAT_ARGB8888, bgColor, pReplacementSectionDisabledBg);
2427 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , E_SYSTEM, "[%s] A system error has been occurred. SectionStyle image load failed", GetErrorMessage(E_SYSTEM) );
2430 else if (__itemType == TABLE_VIEW_ITEM_TYPE_TOP)
2432 if (IS_CUSTOM_BITMAP(TABLEVIEW::SECTIONITEM_TOP_BG_DISABLED))
2434 r = GET_REPLACED_BITMAP_CONFIG_N(TABLEVIEW::SECTIONITEM_TOP_BG_DISABLED, BITMAP_PIXEL_FORMAT_ARGB8888, bgColor, pReplacementSectionDisabledBg);
2435 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , E_SYSTEM, "[%s] A system error has been occurred. SectionStyle image load failed", GetErrorMessage(E_SYSTEM) );
2438 else if (__itemType == TABLE_VIEW_ITEM_TYPE_MIDDLE)
2440 if (IS_CUSTOM_BITMAP(TABLEVIEW::SECTIONITEM_CENTER_BG_DISABLED))
2442 r = GET_REPLACED_BITMAP_CONFIG_N(TABLEVIEW::SECTIONITEM_CENTER_BG_DISABLED, BITMAP_PIXEL_FORMAT_ARGB8888, bgColor, pReplacementSectionDisabledBg);
2443 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , E_SYSTEM, "[%s] A system error has been occurred. SectionStyle image load failed", GetErrorMessage(E_SYSTEM) );
2446 else if (__itemType == TABLE_VIEW_ITEM_TYPE_BOTTOM)
2448 if (IS_CUSTOM_BITMAP(TABLEVIEW::SECTIONITEM_BOTTOM_BG_DISABLED))
2450 r = GET_REPLACED_BITMAP_CONFIG_N(TABLEVIEW::SECTIONITEM_BOTTOM_BG_DISABLED, BITMAP_PIXEL_FORMAT_ARGB8888, bgColor, pReplacementSectionDisabledBg);
2451 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , E_SYSTEM, "[%s] A system error has been occurred. SectionStyle image load failed", GetErrorMessage(E_SYSTEM) );
2455 if (pReplacementSectionDisabledBg)
2457 DrawBitmap(*pCanvas, FloatRectangle(0.0f, 0.0f, bounds.width, bounds.height), *pReplacementSectionDisabledBg);
2461 DrawBitmap(*pCanvas, FloatRectangle(0.0f, 0.0f, bounds.width, bounds.height), *pReplacementSectionBg);
2465 if (__pDrawingProperty->groupedLookEnabled == true)
2469 float barWidth = 0.0f;
2470 float barMargin = 0.0f;
2472 GET_COLOR_CONFIG(TABLEVIEW::GROUPITEM_BAR_NORMAL, barColor);
2473 GET_SHAPE_CONFIG(TABLEVIEW::GROUPITEM_BAR_WIDTH, _CONTROL_ORIENTATION_PORTRAIT, barWidth);
2474 GET_SHAPE_CONFIG(TABLEVIEW::GROUPITEM_BAR_TOP_MARGIN, _CONTROL_ORIENTATION_PORTRAIT, barMargin);
2476 pCanvas->FillRectangle(barColor, FloatRectangle(0.0f, barMargin, barWidth, bounds.height-barMargin));
2480 delete pReplacementSectionPressBg;
2481 delete pReplacementSectionBg;
2482 delete pReplacementSectionDisabledBg;
2487 _TableViewItem::DrawSectionStyleBackgroundCover(void)
2489 if (!__pDrawingProperty->sectionStyleEnabled ||
2490 __pItemCover == null)
2495 Bitmap* pReplacementSectionBgEf = null;
2496 Bitmap* pReplacementSectionBg = null;
2497 Bitmap* pMergeBitmap = null;
2498 Canvas* pCanvas = null;
2501 result r = E_SUCCESS;
2502 FloatRectangle bounds = GetBoundsF();
2506 _TableView* pParent = dynamic_cast<_TableView*>(GetParent());
2507 SysTryCatch(NID_UI_CTRL, pParent != null, , E_SYSTEM, "[%s] A system error has been occurred. SectionTableView load failed", GetErrorMessage(E_SYSTEM) );
2509 bgColor = pParent->GetBackgroundColor();
2513 GET_COLOR_CONFIG(TABLEVIEW::ITEM_BG_DISABLED, bgColor);
2516 if (__itemType == TABLE_VIEW_ITEM_TYPE_ONE)
2518 r = GET_REPLACED_BITMAP_CONFIG_N(TABLEVIEW::SECTIONITEM_SINGLE_COVER_BG_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, bgColor, pReplacementSectionBgEf);
2520 else if (__itemType == TABLE_VIEW_ITEM_TYPE_TOP)
2522 r = GET_REPLACED_BITMAP_CONFIG_N(TABLEVIEW::SECTIONITEM_TOP_COVER_BG_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, bgColor, pReplacementSectionBgEf);
2524 else if (__itemType == TABLE_VIEW_ITEM_TYPE_MIDDLE)
2526 r = GET_REPLACED_BITMAP_CONFIG_N(TABLEVIEW::SECTIONITEM_CENTER_COVER_BG_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, bgColor, pReplacementSectionBgEf);
2528 else if (__itemType == TABLE_VIEW_ITEM_TYPE_BOTTOM)
2530 r = GET_REPLACED_BITMAP_CONFIG_N(TABLEVIEW::SECTIONITEM_BOTTOM_COVER_BG_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, bgColor, pReplacementSectionBgEf);
2536 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , E_SYSTEM, "[%s] A system error has been occurred. SectionStyle image load failed", GetErrorMessage(E_SYSTEM) );
2538 if (__itemType == TABLE_VIEW_ITEM_TYPE_ONE)
2540 r = GET_REPLACED_BITMAP_CONFIG_N(TABLEVIEW::SECTIONITEM_SINGLE_COVER_ROUND_BG_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, bgColor, pReplacementSectionBg);
2542 else if (__itemType == TABLE_VIEW_ITEM_TYPE_TOP)
2544 r = GET_REPLACED_BITMAP_CONFIG_N(TABLEVIEW::SECTIONITEM_TOP_COVER_ROUND_BG_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, bgColor, pReplacementSectionBg);
2546 else if (__itemType == TABLE_VIEW_ITEM_TYPE_MIDDLE)
2548 r = GET_REPLACED_BITMAP_CONFIG_N(TABLEVIEW::SECTIONITEM_CENTER_COVER_ROUND_BG_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, bgColor, pReplacementSectionBg);
2550 else if (__itemType == TABLE_VIEW_ITEM_TYPE_BOTTOM)
2552 r = GET_REPLACED_BITMAP_CONFIG_N(TABLEVIEW::SECTIONITEM_BOTTOM_COVER_ROUND_BG_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, bgColor, pReplacementSectionBg);
2558 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , E_SYSTEM, "[%s] A system error has been occurred. SectionStyle image load failed", GetErrorMessage(E_SYSTEM) );
2560 __pItemCover->SetBounds(FloatRectangle(0.0f, 0.0f, bounds.width, bounds.height));
2562 pCanvas = new (std::nothrow) Canvas();
2563 SysTryCatch(NID_UI_CTRL, pCanvas != null, , E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
2564 pCanvas->Construct(FloatRectangle(0.0f, 0.0f, bounds.width, bounds.height));
2565 pCanvas->SetBackgroundColor(Color(0, 0, 0, 0));
2568 DrawBitmap(*pCanvas, FloatRectangle(0.0f, 0.0f, bounds.width, bounds.height), *pReplacementSectionBg);
2569 DrawBitmap(*pCanvas, FloatRectangle(0.0f, 0.0f, bounds.width, bounds.height), *pReplacementSectionBgEf);
2571 pMergeBitmap = new (std::nothrow) Bitmap();
2572 SysTryCatch(NID_UI_CTRL, pMergeBitmap != null, , E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
2574 pMergeBitmap->Construct(*pCanvas, FloatRectangle(0.0f, 0.0f, bounds.width, bounds.height));
2576 _BitmapImpl::ConvertToNonpremultiplied(*pMergeBitmap, true);
2578 __pItemCover->SetBackgroundBitmap(*pMergeBitmap);
2581 delete pReplacementSectionBgEf;
2582 delete pReplacementSectionBg;
2584 delete pMergeBitmap;
2588 _TableViewItem::DrawContextItemBackground(void)
2590 Canvas* pCanvas = null;
2591 Bitmap* pContextBgEf = null;
2592 Bitmap* pReplacementContextBg = null;
2593 Color bgColor = __colorItemBg[__drawingStatus];
2595 FloatRectangle bounds = GetBoundsF();
2596 result r = E_SUCCESS;
2600 if (bgColor == null)
2602 GET_COLOR_CONFIG(TABLEVIEW::CONTEXTITEM_BG_NORMAL, bgColor);
2607 GET_COLOR_CONFIG(TABLEVIEW::ITEM_BG_DISABLED, bgColor);
2610 r = GET_REPLACED_BITMAP_CONFIG_N(TABLEVIEW::QUICK_MENU_BG_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, bgColor, pReplacementContextBg);
2611 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , E_SYSTEM, "[%s] A system error has been occurred. ContextItem image load failed", GetErrorMessage(E_SYSTEM));
2613 r = GET_BITMAP_CONFIG_N(TABLEVIEW::QUICK_MENU_BG_EFFECT, BITMAP_PIXEL_FORMAT_ARGB8888, pContextBgEf);
2614 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , E_SYSTEM, "[%s] A system error has been occurred. ContextItem image load failed", GetErrorMessage(E_SYSTEM));
2616 pCanvas = GetVisualElement()->GetCanvasN();
2617 SysTryCatch(NID_UI_CTRL, pCanvas != null, , E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
2619 pCanvas->SetBackgroundColor(Color(0, 0, 0, 0));
2622 DrawBitmap(*pCanvas, FloatRectangle(0.0f, 0.0f, bounds.width, bounds.height), *pReplacementContextBg);
2623 DrawBitmap(*pCanvas, FloatRectangle(0.0f, 0.0f, bounds.width, bounds.height), *pContextBgEf);
2627 delete pContextBgEf;
2628 delete pReplacementContextBg;
2633 _TableViewItem::CreateAnnexStyle(void)
2635 switch (__annexStyle)
2637 case TABLE_VIEW_ANNEX_STYLE_MARK:
2640 case TABLE_VIEW_ANNEX_STYLE_RADIO:
2643 case TABLE_VIEW_ANNEX_STYLE_ONOFF_SLIDING:
2644 CreateOnOffButton();
2646 case TABLE_VIEW_ANNEX_STYLE_ONOFF_SLIDING_WITH_DIVIDER:
2647 CreateItemAnnexDivider();
2648 CreateOnOffButton();
2650 case TABLE_VIEW_ANNEX_STYLE_DETAILED:
2651 CreateDetailButton();
2659 _TableViewItem::DrawAnnexStyle(void)
2661 switch (__annexStyle)
2663 case TABLE_VIEW_ANNEX_STYLE_MARK:
2666 case TABLE_VIEW_ANNEX_STYLE_RADIO:
2669 case TABLE_VIEW_ANNEX_STYLE_ONOFF_SLIDING:
2672 case TABLE_VIEW_ANNEX_STYLE_ONOFF_SLIDING_WITH_DIVIDER:
2673 DrawItemAnnexDivider();
2676 case TABLE_VIEW_ANNEX_STYLE_DETAILED:
2685 _TableViewItem::DrawCheckBox(void)
2687 Bitmap* pCheckBox = null;
2688 Bitmap* pCheckBoxBg = null;
2689 Bitmap* pMergeBitmap = null;
2690 Canvas* pCanvas = null;
2691 result r = E_SUCCESS;
2693 FloatRectangle bounds;
2694 float annexWidth = 0.0f;
2695 float annexHeight = 0.0f;
2699 if (__drawingStatus == TABLE_VIEW_ITEM_DRAWING_STATUS_NORMAL)
2701 r = GET_BITMAP_CONFIG_N(TABLEVIEW::CHECKBOX_BG_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, pCheckBoxBg);
2702 SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS) && (pCheckBoxBg != null), , E_SYSTEM, "[%s] Propagating.", GetErrorMessage(r));
2704 r = GET_BITMAP_CONFIG_N(TABLEVIEW::CHECKBOX_CHECK_MARK_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, pCheckBox);
2705 SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS) && (pCheckBox != null), , E_SYSTEM, "[%s] Propagating.", GetErrorMessage(r));
2707 else if ((__drawingStatus == TABLE_VIEW_ITEM_DRAWING_STATUS_PRESSED) || (__drawingStatus == TABLE_VIEW_ITEM_DRAWING_STATUS_HIGHLIGHTED))
2709 r = GET_BITMAP_CONFIG_N(TABLEVIEW::CHECKBOX_BG_PRESSED, BITMAP_PIXEL_FORMAT_ARGB8888, pCheckBoxBg);
2710 SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS) && (pCheckBoxBg != null), , E_SYSTEM, "[%s] Propagating.", GetErrorMessage(r));
2712 r = GET_BITMAP_CONFIG_N(TABLEVIEW::CHECKBOX_CHECK_MARK_PRESSED, BITMAP_PIXEL_FORMAT_ARGB8888, pCheckBox);
2713 SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS) && (pCheckBox != null), , E_SYSTEM, "[%s] Propagating.", GetErrorMessage(r));
2719 r = GET_BITMAP_CONFIG_N(TABLEVIEW::CHECKBOX_BG_DISABLED, BITMAP_PIXEL_FORMAT_ARGB8888, pCheckBoxBg);
2720 SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS) && (pCheckBoxBg != null), , E_SYSTEM, "[%s] Propagating.", GetErrorMessage(r));
2722 r = GET_BITMAP_CONFIG_N(TABLEVIEW::CHECKBOX_CHECK_MARK_DISABLED, BITMAP_PIXEL_FORMAT_ARGB8888, pCheckBox);
2723 SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS) && (pCheckBox != null), , E_SYSTEM, "[%s] Propagating.", GetErrorMessage(r));
2726 GET_SHAPE_CONFIG(TABLEVIEW::ITEM_ANNEX_WIDTH, _CONTROL_ORIENTATION_PORTRAIT, annexWidth);
2727 GET_SHAPE_CONFIG(TABLEVIEW::ITEM_ANNEX_HEIGHT, _CONTROL_ORIENTATION_PORTRAIT, annexHeight);
2729 bounds.SetBounds(0.0f, 0.0f, annexWidth, annexHeight);
2731 pCanvas = new (std::nothrow) Canvas();
2732 SysTryCatch(NID_UI_CTRL, pCanvas != null, , E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
2734 pCanvas->Construct(bounds);
2735 pCanvas->SetBackgroundColor(Color(0, 0, 0, 0));
2738 DrawBitmap(*pCanvas, CalculateAnnexBitmapBounds(annexWidth, annexHeight, *pCheckBoxBg), *pCheckBoxBg);
2740 if (__isCheckedAnimationEnabled == true)
2742 StartCheckBoxAnimation();
2746 if (IsChecked() == true && pCheckBox != null)
2748 DrawBitmap(*pCanvas, CalculateAnnexBitmapBounds(annexWidth, annexHeight, *pCheckBox), *pCheckBox);
2752 pMergeBitmap = new (std::nothrow) Bitmap();
2753 SysTryCatch(NID_UI_CTRL, pMergeBitmap != null, , E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
2755 pMergeBitmap->Construct(*pCanvas, bounds);
2756 _BitmapImpl::ConvertToNonpremultiplied(*pMergeBitmap, true);
2758 __pItemAnnex->SetBackgroundBitmap(*pMergeBitmap);
2759 __pItemAnnex->Invalidate(false);
2764 delete pMergeBitmap;
2771 _TableViewItem::DrawRadioBox(void)
2773 Bitmap* pRadioButton = null;
2774 Bitmap* pRadioButtonBg = null;
2775 Bitmap* pMergeBitmap = null;
2776 Canvas* pCanvas = null;
2777 result r = E_SUCCESS;
2779 FloatRectangle bounds;
2780 float annexWidth = 0.0f;
2781 float annexHeight = 0.0f;
2785 if (__drawingStatus == TABLE_VIEW_ITEM_DRAWING_STATUS_NORMAL)
2787 r = GET_BITMAP_CONFIG_N(TABLEVIEW::RADIOBUTTON_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, pRadioButtonBg);
2788 SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS) && (pRadioButtonBg != null), , E_SYSTEM, "[%s] A system error has been occurred. RadioButtonBg image load failed", GetErrorMessage(E_SYSTEM));
2790 r = GET_BITMAP_CONFIG_N(TABLEVIEW::RADIOBUTTON_BUTTON_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, pRadioButton);
2791 SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS) && (pRadioButton != null), , E_SYSTEM, "[%s] A system error has been occurred.CheckBox image load failed", GetErrorMessage(E_SYSTEM));
2793 else if ((__drawingStatus == TABLE_VIEW_ITEM_DRAWING_STATUS_PRESSED) || (__drawingStatus == TABLE_VIEW_ITEM_DRAWING_STATUS_HIGHLIGHTED))
2795 r = GET_BITMAP_CONFIG_N(TABLEVIEW::RADIOBUTTON_PRESSED, BITMAP_PIXEL_FORMAT_ARGB8888, pRadioButtonBg);
2796 SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS) && (pRadioButtonBg != null), , E_SYSTEM, "[%s] A system error has been occurred. RadioButtonBg image load failed", GetErrorMessage(E_SYSTEM));
2799 r = GET_BITMAP_CONFIG_N(TABLEVIEW::RADIOBUTTON_BUTTON_PRESSED, BITMAP_PIXEL_FORMAT_ARGB8888, pRadioButton);
2800 SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS) && (pRadioButton != null), , E_SYSTEM, "[%s] A system error has been occurred.CheckBox image load failed", GetErrorMessage(E_SYSTEM));
2805 r = GET_BITMAP_CONFIG_N(TABLEVIEW::RADIOBUTTON_NORMAL_DISABLED, BITMAP_PIXEL_FORMAT_ARGB8888, pRadioButtonBg);
2806 SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS) && (pRadioButtonBg != null), , E_SYSTEM, "[%s] A system error has been occurred. RadioButtonBg image load failed", GetErrorMessage(E_SYSTEM));
2808 r = GET_BITMAP_CONFIG_N(TABLEVIEW::RADIOBUTTON_BUTTON_DISABLED, BITMAP_PIXEL_FORMAT_ARGB8888, pRadioButton);
2809 SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS) && (pRadioButton != null), , E_SYSTEM, "[%s] A system error has been occurred.CheckBox image load failed", GetErrorMessage(E_SYSTEM));
2812 GET_SHAPE_CONFIG(TABLEVIEW::ITEM_ANNEX_WIDTH, _CONTROL_ORIENTATION_PORTRAIT, annexWidth);
2813 GET_SHAPE_CONFIG(TABLEVIEW::ITEM_ANNEX_HEIGHT, _CONTROL_ORIENTATION_PORTRAIT, annexHeight);
2814 bounds.SetBounds(0.0f, 0.0f, annexWidth, annexHeight);
2816 pCanvas = new (std::nothrow) Canvas();
2817 SysTryCatch(NID_UI_CTRL, pCanvas != null, , E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
2819 pCanvas->Construct(bounds);
2820 pCanvas->SetBackgroundColor(Color(0, 0, 0, 0));
2823 DrawBitmap(*pCanvas, CalculateAnnexBitmapBounds(annexWidth, annexHeight, *pRadioButtonBg), *pRadioButtonBg);
2825 if (pRadioButton != null && IsChecked() == true)
2827 DrawBitmap(*pCanvas, CalculateAnnexBitmapBounds(annexWidth, annexHeight, *pRadioButton), *pRadioButton);
2830 pMergeBitmap = new (std::nothrow) Bitmap();
2831 SysTryCatch(NID_UI_CTRL, pMergeBitmap != null, , E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
2833 pMergeBitmap->Construct(*pCanvas, bounds);
2834 _BitmapImpl::ConvertToNonpremultiplied(*pMergeBitmap, true);
2836 __pItemAnnex->SetBackgroundBitmap(*pMergeBitmap);
2837 __pItemAnnex->Invalidate(false);
2840 delete pRadioButton;
2841 delete pRadioButtonBg;
2842 delete pMergeBitmap;
2849 _TableViewItem::DrawOnOffButton(void)
2851 Bitmap* pOnOffButton = null;
2852 Bitmap* pOnOffButtonHandler = null;
2853 Bitmap* pMergeBitmap = null;
2854 Canvas* pCanvas = null;
2855 result r = E_SUCCESS;
2857 FloatRectangle bounds;
2858 FloatRectangle backgroundBounds;
2859 FloatRectangle handlerBounds;
2860 float annexWidth = 0.0f;
2861 float annexHeight = 0.0f;
2862 float annexMargin = 0.0f;
2864 if (IsChecked() == true)
2868 r = GET_BITMAP_CONFIG_N(TABLEVIEW::ONOFFBUTTON_ON_HANDLER, BITMAP_PIXEL_FORMAT_ARGB8888, pOnOffButtonHandler);
2872 r = GET_BITMAP_CONFIG_N(TABLEVIEW::ONOFFBUTTON_ON_HANDLER_DISABLED, BITMAP_PIXEL_FORMAT_ARGB8888, pOnOffButtonHandler);
2879 r = GET_BITMAP_CONFIG_N(TABLEVIEW::ONOFFBUTTON_OFF_HANDLER, BITMAP_PIXEL_FORMAT_ARGB8888, pOnOffButtonHandler);
2883 r = GET_BITMAP_CONFIG_N(TABLEVIEW::ONOFFBUTTON_OFF_HANDLER_DISABLED, BITMAP_PIXEL_FORMAT_ARGB8888, pOnOffButtonHandler);
2886 SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS) && (pOnOffButtonHandler != null), , E_SYSTEM, "[%s] A system error has been occurred. OnOffButtonHandler image load failed", GetErrorMessage(E_SYSTEM));
2890 r = GET_BITMAP_CONFIG_N(TABLEVIEW::ONOFFBUTTON_BG, BITMAP_PIXEL_FORMAT_ARGB8888, pOnOffButton);
2894 r = GET_BITMAP_CONFIG_N(TABLEVIEW::ONOFFBUTTON_BG_DISABLED, BITMAP_PIXEL_FORMAT_ARGB8888, pOnOffButton);
2896 SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS) && (pOnOffButton != null), , E_SYSTEM, "[%s] A system error has been occurred. OnOffButton image load failed", GetErrorMessage(E_SYSTEM));
2898 GET_SHAPE_CONFIG(TABLEVIEW::ITEM_ANNEX_ONOFF_WIDTH, _CONTROL_ORIENTATION_PORTRAIT, annexWidth);
2899 GET_SHAPE_CONFIG(TABLEVIEW::ITEM_ANNEX_ONOFF_HEIGHT, _CONTROL_ORIENTATION_PORTRAIT, annexHeight);
2900 bounds.SetBounds(0, 0, annexWidth, annexHeight);
2902 pCanvas = new (std::nothrow) Canvas();
2903 SysTryCatch(NID_UI_CTRL, pCanvas != null, , E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
2905 pCanvas->Construct(bounds);
2906 pCanvas->SetBackgroundColor(Color(0, 0, 0, 0));
2909 backgroundBounds = CalculateAnnexBitmapBounds(annexWidth, annexHeight, *pOnOffButton);
2910 DrawBitmap(*pCanvas, backgroundBounds, *pOnOffButton);
2912 handlerBounds = CalculateAnnexBitmapBounds(annexWidth, annexHeight, *pOnOffButtonHandler);
2913 GET_SHAPE_CONFIG(TABLEVIEW::ITEM_ANNEX_ONOFF_MARGIN, _CONTROL_ORIENTATION_PORTRAIT, annexMargin);
2914 if (IsChecked() == true)
2916 handlerBounds.x = backgroundBounds.width - handlerBounds.width - annexMargin;
2920 handlerBounds.x = backgroundBounds.x + annexMargin;
2923 DrawBitmap(*pCanvas, handlerBounds, *pOnOffButtonHandler);
2925 pMergeBitmap = new (std::nothrow) Bitmap();
2926 SysTryCatch(NID_UI_CTRL, pMergeBitmap != null, , E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
2928 pMergeBitmap->Construct(*pCanvas, bounds);
2929 _BitmapImpl::ConvertToNonpremultiplied(*pMergeBitmap, true);
2931 __pItemAnnex->SetBackgroundBitmap(*pMergeBitmap);
2932 __pItemAnnex->Invalidate(false);
2935 delete pOnOffButton;
2936 delete pOnOffButtonHandler;
2937 delete pMergeBitmap;
2944 _TableViewItem::AdjustAnnexOnOffHandlerPosition()
2946 float annexWidth = 0.0f;
2947 float annexHeight = 0.0f;
2948 float annexMargin = 0.0f;
2950 float annexStartPositionX = 0.0f;
2951 float annexEndPositionX = 0.0f;
2952 float handlerPositionX = 0.0f;
2953 FloatRectangle handlerBounds;
2954 result r = E_SUCCESS;
2956 GET_SHAPE_CONFIG(TABLEVIEW::ITEM_ANNEX_ONOFF_MARGIN, _CONTROL_ORIENTATION_PORTRAIT, annexMargin);
2958 Bitmap* pOnOffButtonHandler = null;
2959 if (IsChecked() == true)
2961 r = GET_BITMAP_CONFIG_N(TABLEVIEW::ONOFFBUTTON_ON_HANDLER, BITMAP_PIXEL_FORMAT_ARGB8888, pOnOffButtonHandler);
2965 r = GET_BITMAP_CONFIG_N(TABLEVIEW::ONOFFBUTTON_OFF_HANDLER, BITMAP_PIXEL_FORMAT_ARGB8888, pOnOffButtonHandler);
2967 SysTryReturnVoidResult(NID_UI_CTRL, (r == E_SUCCESS) && (pOnOffButtonHandler != null), E_SYSTEM, "[%s] A system error has been occurred. OnOffHandlerButton button image load failed.", GetErrorMessage(E_SYSTEM));
2969 GET_SHAPE_CONFIG(TABLEVIEW::ITEM_ANNEX_ONOFF_WIDTH, _CONTROL_ORIENTATION_PORTRAIT, annexWidth);
2970 GET_SHAPE_CONFIG(TABLEVIEW::ITEM_ANNEX_ONOFF_HEIGHT, _CONTROL_ORIENTATION_PORTRAIT, annexHeight);
2972 annexStartPositionX = __pItemAnnex->GetBoundsF().x;
2973 annexEndPositionX = annexStartPositionX + annexWidth + annexMargin;
2975 handlerBounds = CalculateAnnexBitmapBounds(annexWidth, annexHeight, *pOnOffButtonHandler);
2977 if (__annexOnOffHandlerMoved)
2979 if (annexStartPositionX <= __annexOnOffHandlerPositionX
2980 && annexEndPositionX >= __annexOnOffHandlerPositionX)
2982 if (((annexEndPositionX - annexStartPositionX) / 2) < (__annexOnOffHandlerPositionX + (handlerBounds.width / 2)) - annexStartPositionX )
2984 handlerPositionX = annexEndPositionX;
2989 handlerPositionX = annexStartPositionX;
2996 SetChecked(!IsChecked());
2999 handlerPositionX = annexEndPositionX;
3003 handlerPositionX = annexStartPositionX;
3007 DrawAnnexOnOffHandler(handlerPositionX);
3009 delete pOnOffButtonHandler;
3015 _TableViewItem::DrawAnnexOnOffHandler(float touchEndPosition)
3017 if (__pItemAnnex == null)
3022 Bitmap* pOnOffButton = null;
3023 Bitmap* pOnOffButtonHandler = null;
3024 Bitmap* pMergeBitmap = null;
3025 Canvas* pCanvas = null;
3026 result r = E_SUCCESS;
3028 FloatRectangle backgroundBounds;
3029 FloatRectangle handlerBounds;
3030 float annexWidth = 0.0f;
3031 float annexHeight = 0.0f;
3032 float annexMargin = 0.0f;
3033 float annexX = 0.0f;
3034 float nextHandlerX = 0.0f;
3036 r = GET_BITMAP_CONFIG_N(TABLEVIEW::ONOFFBUTTON_BG, BITMAP_PIXEL_FORMAT_ARGB8888, pOnOffButton);
3037 SysTryReturnVoidResult(NID_UI_CTRL, (r == E_SUCCESS) && (pOnOffButton != null), E_SYSTEM, "[%s] A system error has been occurred. OnOffButton image load failed", GetErrorMessage(E_SYSTEM));
3039 if (IsChecked() == true)
3041 r = GET_BITMAP_CONFIG_N(TABLEVIEW::ONOFFBUTTON_ON_HANDLER, BITMAP_PIXEL_FORMAT_ARGB8888, pOnOffButtonHandler);
3045 r = GET_BITMAP_CONFIG_N(TABLEVIEW::ONOFFBUTTON_OFF_HANDLER, BITMAP_PIXEL_FORMAT_ARGB8888, pOnOffButtonHandler);
3047 SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS) && (pOnOffButtonHandler != null), , E_SYSTEM, "[%s] A system error has been occurred. OnOffHandlerButton button image load failed.", GetErrorMessage(E_SYSTEM));
3049 GET_SHAPE_CONFIG(TABLEVIEW::ITEM_ANNEX_ONOFF_WIDTH, _CONTROL_ORIENTATION_PORTRAIT, annexWidth);
3050 GET_SHAPE_CONFIG(TABLEVIEW::ITEM_ANNEX_ONOFF_HEIGHT, _CONTROL_ORIENTATION_PORTRAIT, annexHeight);
3051 GET_SHAPE_CONFIG(TABLEVIEW::ITEM_ANNEX_ONOFF_MARGIN, _CONTROL_ORIENTATION_PORTRAIT, annexMargin);
3053 pCanvas = new (std::nothrow) Canvas();
3054 SysTryCatch(NID_UI_CTRL, pCanvas != null, , E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
3056 pCanvas->Construct(FloatRectangle(0, 0, annexWidth, annexHeight));
3057 pCanvas->SetBackgroundColor(Color(0, 0, 0, 0));
3060 backgroundBounds = CalculateAnnexBitmapBounds(annexWidth, annexHeight, *pOnOffButton);
3061 DrawBitmap(*pCanvas, backgroundBounds, *pOnOffButton);
3063 handlerBounds = CalculateAnnexBitmapBounds(annexWidth, annexHeight, *pOnOffButtonHandler);
3064 handlerBounds.y = backgroundBounds.y;
3068 handlerBounds.x = backgroundBounds.width - handlerBounds.width - annexMargin;
3072 handlerBounds.x = backgroundBounds.x + annexMargin;
3075 nextHandlerX = handlerBounds.x + (touchEndPosition - __annexTouchStartPosition);
3076 annexX = __pItemAnnex->GetBoundsF().x;
3078 if ((annexX + nextHandlerX + handlerBounds.width) < (annexX + annexWidth + annexMargin)
3079 && (annexX + nextHandlerX) > annexX)
3081 handlerBounds.x = nextHandlerX;
3083 else if (_FloatCompareGE((annexX + nextHandlerX + handlerBounds.width), (annexX + annexWidth + annexMargin)))
3085 handlerBounds.x = backgroundBounds.width - handlerBounds.width - annexMargin;
3087 else if (_FloatCompareLE((annexX + nextHandlerX), annexX))
3089 handlerBounds.x = backgroundBounds.x + annexMargin;
3092 __annexOnOffHandlerPositionX = annexX + handlerBounds.x;
3093 DrawBitmap(*pCanvas, handlerBounds, *pOnOffButtonHandler);
3095 pMergeBitmap = new (std::nothrow) Bitmap();
3096 SysTryCatch(NID_UI_CTRL, pMergeBitmap != null, , E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
3098 pMergeBitmap->Construct(*pCanvas, FloatRectangle(0, 0, annexWidth, annexHeight));
3099 _BitmapImpl::ConvertToNonpremultiplied(*pMergeBitmap, true);
3101 __pItemAnnex->SetBackgroundBitmap(*pMergeBitmap);
3102 __pItemAnnex->Invalidate(false);
3105 delete pOnOffButton;
3106 delete pOnOffButtonHandler;
3107 delete pMergeBitmap;
3114 _TableViewItem::DrawDetailButton(void)
3116 Bitmap* pDetailBgEffect = null;
3117 Bitmap* pDetailEffect = null;
3118 Bitmap* pReplacementDetail = null;
3119 Bitmap* pReplacementDetailBg = null;
3120 Bitmap* pMergeBitmap = null;
3121 Canvas* pCanvas = null;
3122 Color replacementNewColor;
3123 Color replacementNewBgColor;
3124 result r = E_SUCCESS;
3126 FloatRectangle bounds;
3127 float annexWidth = 0.0f;
3128 float annexHeight = 0.0f;
3129 bool themeBackgroundBitmap = false;
3131 themeBackgroundBitmap = IS_CUSTOM_BITMAP(TABLEVIEW::CIRCLE_BUTTON_BG_NORMAL);
3135 if (__isSelectedDetailButton)
3137 if (!themeBackgroundBitmap)
3139 r = GET_BITMAP_CONFIG_N(TABLEVIEW::CIRCLE_BUTTON_BG_PRESSED, BITMAP_PIXEL_FORMAT_ARGB8888, pDetailBgEffect);
3140 SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS) && (pDetailBgEffect != null), , E_SYSTEM, "[%s] A system error has been occurred. Detail button image load failed", GetErrorMessage(E_SYSTEM));
3142 r = GET_BITMAP_CONFIG_N(TABLEVIEW::CIRCLE_BUTTON_REVEAL_EFFECT, BITMAP_PIXEL_FORMAT_ARGB8888, pDetailEffect);
3143 SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS) && (pDetailEffect != null), , E_SYSTEM,"[%s] A system error has been occurred. Detail button image load failed", GetErrorMessage(E_SYSTEM));
3146 GET_COLOR_CONFIG(TABLEVIEW::ITEM_ANNEX_DETAIL_PRESSED, replacementNewColor);
3148 r = GET_REPLACED_BITMAP_CONFIG_N(TABLEVIEW::CIRCLE_BUTTON_REVEAL_PRESSED, BITMAP_PIXEL_FORMAT_ARGB8888, replacementNewColor, pReplacementDetail);
3149 SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS) && (pReplacementDetail != null), , E_SYSTEM, "[%s] A system error has been occurred. Detail button image load failed", GetErrorMessage(E_SYSTEM));
3151 GET_COLOR_CONFIG(TABLEVIEW::ITEM_ANNEX_DETAIL_BG_PRESSED, replacementNewBgColor);
3155 if (!themeBackgroundBitmap)
3157 r = GET_BITMAP_CONFIG_N(TABLEVIEW::CIRCLE_BUTTON_BG_EFFECT, BITMAP_PIXEL_FORMAT_ARGB8888, pDetailBgEffect);
3158 SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS) && (pDetailBgEffect != null), , E_SYSTEM, "[%s] A system error has been occurred. Detail button image load failed", GetErrorMessage(E_SYSTEM));
3160 r = GET_BITMAP_CONFIG_N(TABLEVIEW::CIRCLE_BUTTON_REVEAL_EFFECT, BITMAP_PIXEL_FORMAT_ARGB8888, pDetailEffect);
3161 SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS) && (pDetailEffect != null), , E_SYSTEM, "[%s] A system error has been occurred. Detail button image load failed", GetErrorMessage(E_SYSTEM));
3164 GET_COLOR_CONFIG(TABLEVIEW::ITEM_ANNEX_DETAIL_NORMAL, replacementNewColor);
3166 r = GET_REPLACED_BITMAP_CONFIG_N(TABLEVIEW::CIRCLE_BUTTON_REVEAL_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, replacementNewColor, pReplacementDetail);
3167 SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS) && (pReplacementDetail != null), , E_SYSTEM, "[%s] A system error has been occurred. Detail button image load failed", GetErrorMessage(E_SYSTEM));
3169 GET_COLOR_CONFIG(TABLEVIEW::ITEM_ANNEX_DETAIL_BG_NORMAL, replacementNewBgColor);
3174 if (!themeBackgroundBitmap)
3176 r = GET_BITMAP_CONFIG_N(TABLEVIEW::CIRCLE_BUTTON_BG_EFFECT_DISABLED, BITMAP_PIXEL_FORMAT_ARGB8888, pDetailBgEffect);
3177 SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS) && (pDetailBgEffect != null), , E_SYSTEM, "[%s] A system error has been occurred. Detail button image load failed", GetErrorMessage(E_SYSTEM));
3179 r = GET_BITMAP_CONFIG_N(TABLEVIEW::CIRCLE_BUTTON_REVEAL_EFFECT, BITMAP_PIXEL_FORMAT_ARGB8888, pDetailEffect);
3180 SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS) && (pDetailEffect != null), , E_SYSTEM, "[%s] A system error has been occurred. Detail button image load failed", GetErrorMessage(E_SYSTEM));
3183 GET_COLOR_CONFIG(TABLEVIEW::ITEM_ANNEX_DETAIL_NORMAL, replacementNewColor);
3185 r = GET_REPLACED_BITMAP_CONFIG_N(TABLEVIEW::CIRCLE_BUTTON_REVEAL_DISABLED, BITMAP_PIXEL_FORMAT_ARGB8888, replacementNewColor, pReplacementDetail);
3186 SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS) && (pReplacementDetail != null), , E_SYSTEM, "[%s] A system error has been occurred. Detail button image load failed", GetErrorMessage(E_SYSTEM));
3188 r = GET_REPLACED_BITMAP_CONFIG_N(TABLEVIEW::CIRCLE_BUTTON_BG_DISABLED, BITMAP_PIXEL_FORMAT_ARGB8888, replacementNewBgColor, pReplacementDetailBg);
3189 SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS) && (pReplacementDetailBg != null), , E_SYSTEM, "[%s] A system error has been occurred. Detail button image load failed", GetErrorMessage(E_SYSTEM));
3192 if (pReplacementDetailBg == null)
3194 r = GET_REPLACED_BITMAP_CONFIG_N(TABLEVIEW::CIRCLE_BUTTON_BG_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, replacementNewBgColor, pReplacementDetailBg);
3195 SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS) && (pReplacementDetailBg != null), , E_SYSTEM, "[%s] A system error has been occurred. Detail button image load failed", GetErrorMessage(E_SYSTEM));
3198 GET_SHAPE_CONFIG(TABLEVIEW::ITEM_ANNEX_MORE_WIDTH, _CONTROL_ORIENTATION_PORTRAIT, annexWidth);
3199 GET_SHAPE_CONFIG(TABLEVIEW::ITEM_ANNEX_MORE_HEIGHT, _CONTROL_ORIENTATION_PORTRAIT, annexHeight);
3201 bounds.SetBounds(0, 0, annexWidth, annexHeight);
3203 pCanvas = new (std::nothrow) Canvas();
3204 SysTryCatch(NID_UI_CTRL, pCanvas != null, , E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
3206 pCanvas->Construct(bounds);
3207 pCanvas->SetBackgroundColor(Color(0, 0, 0, 0));
3210 DrawBitmap(*pCanvas, CalculateAnnexBitmapBounds(annexWidth, annexHeight, *pReplacementDetailBg), *pReplacementDetailBg);
3211 if (pDetailBgEffect)
3213 DrawBitmap(*pCanvas, CalculateAnnexBitmapBounds(annexWidth, annexHeight, *pDetailBgEffect), *pDetailBgEffect);
3215 DrawBitmap(*pCanvas, CalculateAnnexBitmapBounds(annexWidth, annexHeight, *pReplacementDetail), *pReplacementDetail);
3218 DrawBitmap(*pCanvas, CalculateAnnexBitmapBounds(annexWidth, annexHeight, *pDetailEffect), *pDetailEffect);
3221 pMergeBitmap = new (std::nothrow) Bitmap();
3222 SysTryCatch(NID_UI_CTRL, pMergeBitmap != null, , E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
3223 pMergeBitmap->Construct(*pCanvas, bounds);
3224 _BitmapImpl::ConvertToNonpremultiplied(*pMergeBitmap, true);
3226 __pItemAnnex->SetBackgroundBitmap(*pMergeBitmap);
3227 __pItemAnnex->Invalidate(false);
3230 delete pDetailBgEffect;
3231 delete pDetailEffect;
3232 delete pReplacementDetail;
3233 delete pReplacementDetailBg;
3234 delete pMergeBitmap;
3241 _TableViewItem::DrawItemDivider(void)
3243 if (__pItemDivider == null || __pItemTopDivider == null)
3248 if (__pDrawingProperty->itemDividerEnabled == false ||
3249 __itemType == TABLE_VIEW_ITEM_TYPE_HEADER ||
3250 __itemType == TABLE_VIEW_ITEM_TYPE_FOOTER ||
3251 __itemDividerEnabled == false ||
3254 __pItemDivider->SetVisibleState(false);
3255 __pItemTopDivider->SetVisibleState(false);
3260 FloatRectangle dividerBottomBounds;
3261 FloatRectangle dividerTopBounds;
3263 Color bottomLineColor;
3264 Color customDividerColor;
3265 FloatRectangle bounds;
3266 FloatPoint bottomPoint;
3268 __pItemDivider->SetVisibleState(true);
3269 __pItemTopDivider->SetVisibleState(true);
3271 if ( __drawingStatus == TABLE_VIEW_ITEM_DRAWING_STATUS_PRESSED ||
3272 __drawingStatus == TABLE_VIEW_ITEM_DRAWING_STATUS_HIGHLIGHTED)
3274 if (__colorItemBg[TABLE_VIEW_ITEM_DRAWING_STATUS_NORMAL] != __colorItemBg[TABLE_VIEW_ITEM_DRAWING_STATUS_PRESSED])
3276 if (__itemType != TABLE_VIEW_ITEM_TYPE_TITLE)
3278 __pItemDivider->SetVisibleState(false);
3281 __pItemTopDivider->SetVisibleState(false);
3285 if (__itemType == TABLE_VIEW_ITEM_TYPE_TITLE)
3287 if (__pItemBgBitmap[__drawingStatus] != null)
3289 __pItemDivider->SetVisibleState(false);
3293 float lineHeight = 0.0f;
3294 float lineLeftMargin = 0.0f;
3295 float lineBottomMargin = 0.0f;
3296 bounds = GetBoundsF();
3298 if (__drawingStatus == TABLE_VIEW_ITEM_DRAWING_STATUS_NORMAL)
3300 GET_COLOR_CONFIG(TABLEVIEW::GROUPITEM_INDEX_BAR_NORMAL, bottomLineColor);
3304 GET_COLOR_CONFIG(TABLEVIEW::GROUPITEM_INDEX_BAR_PRESSED, bottomLineColor);
3307 GET_SHAPE_CONFIG(TABLEVIEW::GROUPITEM_INDEX_BAR_HEIGHT, _CONTROL_ORIENTATION_PORTRAIT, lineHeight);
3308 GET_SHAPE_CONFIG(TABLEVIEW::GROUPITEM_INDEX_BAR_LEFT_MARGIN, _CONTROL_ORIENTATION_PORTRAIT, lineLeftMargin);
3309 GET_SHAPE_CONFIG(TABLEVIEW::GROUPITEM_INDEX_BAR_BOTTOM_MARGIN, _CONTROL_ORIENTATION_PORTRAIT, lineBottomMargin);
3311 lineHeight = Tizen::Graphics::CoordinateSystem::ConvertToLogicalY(lineHeight);
3312 lineBottomMargin = Tizen::Graphics::CoordinateSystem::ConvertToLogicalY(lineBottomMargin);
3313 bottomPoint = Tizen::Graphics::CoordinateSystem::AlignToDevice(FloatPoint(lineLeftMargin, bounds.height));
3314 dividerBottomBounds = FloatRectangle(bottomPoint.x, bottomPoint.y - lineBottomMargin, bounds.width - lineLeftMargin * 2.0f, lineHeight);
3319 float lineLeftMargin = 0.0f;
3320 float lineHeight = 0.0f;
3321 bounds = GetBoundsF();
3323 if (!IsContextItem())
3325 if (!__isSimpleLastItem)
3327 if (__itemType == TABLE_VIEW_ITEM_TYPE_BOTTOM || __itemType == TABLE_VIEW_ITEM_TYPE_ONE)
3329 __pItemDivider->SetVisibleState(false);
3330 __pItemTopDivider->SetVisibleState(false);
3335 customDividerColor = __pDrawingProperty->dividerColor;
3336 GET_COLOR_CONFIG(TABLEVIEW::ITEM_DIVIDER_TOP_BG_NORMAL, topLineColor);
3337 GET_COLOR_CONFIG(TABLEVIEW::ITEM_DIVIDER_BOTTOM_BG_NORMAL, bottomLineColor);
3338 GET_FIXED_VALUE_CONFIG(TABLEVIEW::ITEM_DIVIDER_LEFT_MARGIN, _CONTROL_ORIENTATION_PORTRAIT, lineLeftMargin);
3339 GET_FIXED_VALUE_CONFIG(TABLEVIEW::ITEM_DIVIDER_HEIGHT, _CONTROL_ORIENTATION_PORTRAIT, lineHeight);
3341 lineLeftMargin = Tizen::Graphics::CoordinateSystem::ConvertToLogicalX(lineLeftMargin);
3342 lineHeight = Tizen::Graphics::CoordinateSystem::ConvertToLogicalY(lineHeight);
3343 bottomPoint = Tizen::Graphics::CoordinateSystem::AlignToDevice(FloatPoint(lineLeftMargin, (bounds.height)));
3345 dividerTopBounds.SetBounds(lineLeftMargin, bottomPoint.y - (lineHeight * 2.0f), bounds.width - lineLeftMargin * 2.0f, lineHeight);
3346 dividerBottomBounds.SetBounds(lineLeftMargin, bottomPoint.y - lineHeight, bounds.width - lineLeftMargin * 2.0f, lineHeight);
3349 if (__pItemDivider->GetVisibleState())
3351 __pItemDivider->SetBounds(dividerBottomBounds);
3352 if (customDividerColor == bottomLineColor || __itemType == TABLE_VIEW_ITEM_TYPE_TITLE)
3354 __pItemDivider->SetBackgroundColor(bottomLineColor);
3358 __pItemDivider->SetBackgroundColor(customDividerColor);
3359 __pItemDivider->GetVisualElement()->SetOpacity(ITEM_BOTTOM_DIVIDER_OPACITY);
3361 __pItemDivider->Invalidate();
3364 if (__pItemTopDivider->GetVisibleState())
3366 __pItemTopDivider->SetBounds(dividerTopBounds);
3367 if (customDividerColor == bottomLineColor)
3369 __pItemTopDivider->SetBackgroundColor(topLineColor);
3373 __pItemTopDivider->SetBackgroundColor(customDividerColor);
3374 __pItemTopDivider->GetVisualElement()->SetOpacity(ITEM_TOP_DIVIDER_OPACITY);
3376 __pItemTopDivider->Invalidate();
3381 _TableViewItem::DrawItemAnnexDivider(void)
3383 if (__itemType == TABLE_VIEW_ITEM_TYPE_HEADER || __itemType == TABLE_VIEW_ITEM_TYPE_FOOTER)
3385 if (__pItemAnnexLeftDivider != null)
3387 __pItemAnnexLeftDivider->SetVisibleState(false);
3390 if (__pItemAnnexRightDivider != null)
3392 __pItemAnnexRightDivider->SetVisibleState(false);
3397 Color dividerLeftColor;
3398 Color dividerRightColor;
3399 Color customDividerColor;
3400 Color bottomLineColor;
3401 FloatRectangle bounds = GetBoundsF();
3402 float dividerHeight = 0;
3403 float itemHeight = 0;
3404 float dividerWidth = 0.0f;
3405 float dividerTopMargin = 0.0f;
3406 float annexWidth = 0.0f;
3407 float annexLeftMargin = 0.0f;
3408 float itemLeftMargin = 0.0f;
3410 customDividerColor = __pDrawingProperty->dividerColor;
3411 GET_SHAPE_CONFIG(TABLEVIEW::ITEM_LEFT_MARGIN, _CONTROL_ORIENTATION_PORTRAIT, itemLeftMargin);
3412 GET_SHAPE_CONFIG(TABLEVIEW::ITEM_ANNEX_MARGIN, _CONTROL_ORIENTATION_PORTRAIT, annexLeftMargin);
3413 GET_SHAPE_CONFIG(TABLEVIEW::ITEM_ANNEX_ONOFF_WIDTH, _CONTROL_ORIENTATION_PORTRAIT, annexWidth);
3414 GET_COLOR_CONFIG(TABLEVIEW::ITEM_ANNEX_DIVIDER_LEFT_BG_NORMAL, dividerLeftColor);
3415 GET_COLOR_CONFIG(TABLEVIEW::ITEM_ANNEX_DIVIDER_RIGHT_BG_NORMAL, dividerRightColor);
3416 GET_COLOR_CONFIG(TABLEVIEW::ITEM_DIVIDER_BOTTOM_BG_NORMAL, bottomLineColor);
3417 GET_FIXED_VALUE_CONFIG(TABLEVIEW::ITEM_ANNEX_DIVIDER_WIDTH, _CONTROL_ORIENTATION_PORTRAIT, dividerWidth);
3418 GET_FIXED_VALUE_CONFIG(TABLEVIEW::ITEM_ANNEX_DIVIDER_MARGIN, _CONTROL_ORIENTATION_PORTRAIT, dividerTopMargin);
3420 itemLeftMargin += __pDrawingProperty->scrollMargin;
3421 itemHeight = ((__customHeight > 0) ? __customHeight : GetBoundsF().height);
3422 dividerHeight = itemHeight - (dividerTopMargin*2);
3423 dividerHeight = (dividerHeight > 0) ? dividerHeight : 0;
3424 __pItemAnnexLeftDivider->SetBounds(FloatRectangle((GetBoundsF().width - annexWidth - (itemLeftMargin + annexLeftMargin) - (dividerWidth*2)), dividerTopMargin, dividerWidth, dividerHeight));
3425 __pItemAnnexRightDivider->SetBounds(FloatRectangle((GetBoundsF().width - annexWidth - (itemLeftMargin + annexLeftMargin) - dividerWidth), dividerTopMargin, dividerWidth, dividerHeight));
3427 if (customDividerColor == bottomLineColor)
3429 __pItemAnnexLeftDivider->SetBackgroundColor(dividerLeftColor);
3433 __pItemAnnexLeftDivider->SetBackgroundColor(customDividerColor);
3434 __pItemAnnexLeftDivider->GetVisualElement()->SetOpacity(ITEM_TOP_DIVIDER_OPACITY);
3437 if (customDividerColor == bottomLineColor)
3439 __pItemAnnexRightDivider->SetBackgroundColor(dividerRightColor);
3443 __pItemAnnexRightDivider->SetBackgroundColor(customDividerColor);
3444 __pItemAnnexRightDivider->GetVisualElement()->SetOpacity(ITEM_BOTTOM_DIVIDER_OPACITY);
3447 __pItemAnnexLeftDivider->Invalidate();
3448 __pItemAnnexRightDivider->Invalidate();
3451 if (__pItemAnnexLeftDivider != null)
3453 _AccessibilityContainer* pContainer = __pItemAnnexLeftDivider->GetAccessibilityContainer();
3454 pContainer->Activate(false);
3457 if (__pItemAnnexRightDivider != null)
3459 _AccessibilityContainer* pContainer = __pItemAnnexRightDivider->GetAccessibilityContainer();
3460 pContainer->Activate(false);
3466 _TableViewItem::DrawBitmap(Canvas& canvas, const FloatRectangle& bounds, const Bitmap& bitmap)
3468 result r = E_SUCCESS;
3469 if (_BitmapImpl::CheckNinePatchedBitmapStrictly(bitmap))
3471 r = canvas.DrawNinePatchedBitmap(bounds, bitmap);
3472 SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "Fail to draw ninepatched bitmap.");
3476 r = canvas.DrawBitmap(bounds, bitmap);
3477 SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "Fail to draw bitmap.");
3484 _TableViewItem::SetItemHighlightBounds(_VisualElement& highlightVisualElement, const FloatRectangle& bounds)
3486 return highlightVisualElement.SetBounds(bounds);
3490 _TableViewItem::CalculateItemHighlightBounds(void)
3492 FloatRectangle itemBounds = GetBoundsF();
3493 return FloatRectangle(0.0f, 0.0f, itemBounds.width, itemBounds.height);
3497 _TableViewItem::CalculateAnnexBitmapBounds(float annexWidth, float annexHeight, const Bitmap& bitmap)
3499 FloatRectangle bounds;
3502 float leftMargin = 0;
3503 float topMargin = 0;
3505 if (annexWidth > bitmap.GetWidthF())
3507 leftMargin = (annexWidth - bitmap.GetWidthF()) / 2;
3508 width = bitmap.GetWidthF();
3515 if (annexHeight > bitmap.GetHeightF())
3517 topMargin = (annexHeight - bitmap.GetHeightF()) / 2;
3518 height = bitmap.GetHeightF();
3522 height = annexHeight;
3525 bounds.SetBounds(leftMargin, topMargin, width, height);
3531 _TableViewItem::IsTitleStyleItem(void) const
3533 if (__itemType == TABLE_VIEW_ITEM_TYPE_TITLE || __itemType == TABLE_VIEW_ITEM_TYPE_HEADER || __itemType == TABLE_VIEW_ITEM_TYPE_FOOTER)
3542 _TableViewItem::IsValidSelectionState(void)
3544 _TableView* pParent = dynamic_cast<_TableView*>(GetParent());
3545 if (pParent == null)
3550 if (pParent->GetPressedItemCount() > 0)
3559 _TableViewItem::DrawSimpleItem(void)
3561 if (__pSimpleItemText != null)
3563 Color textColor = __simpleItemTextColor[__drawingStatus];
3566 textColor = __simpleItemTextColor[TABLE_VIEW_SIMPLEITEM_DRAWING_STATUS_DISABLED];
3569 if (__itemType == TABLE_VIEW_ITEM_TYPE_TITLE)
3571 if (__drawingStatus == TABLE_VIEW_ITEM_DRAWING_STATUS_NORMAL)
3573 textColor = __simpleItemTextColor[TABLE_VIEW_GROUPITEM_DRAWING_STATUS_NORMAL];
3577 textColor = __simpleItemTextColor[TABLE_VIEW_GROUPITEM_DRAWING_STATUS_PRESSED];
3581 __pSimpleItemText->SetTextColor(textColor);
3582 __pSimpleItemText->Invalidate(false);
3586 _TableViewItem::SetSimpleItemContents(const Tizen::Base::String& text, const Tizen::Graphics::Bitmap* pBitmap, bool groupType)
3588 result r = E_SUCCESS;
3589 bool textOnly = true;
3591 if (pBitmap != null)
3596 r = CreateSimpleItemContents(textOnly);
3597 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
3599 FloatRectangle bitmapRect = FloatRectangle(0.0f, 0.0f, 0.0f, 0.0f);
3600 FloatRectangle textRect = FloatRectangle(0.0f, 0.0f, 0.0f, 0.0f);
3601 float leftMargin = 0.0f;
3602 float annexMargin = 0.0f;
3603 float elementWidth = 0;
3604 float elementHeight = 0;
3605 float itemHeight = GetBoundsF().height;
3606 float itemWidth = GetBoundsF().width;
3607 float annexWidth = GetAnnexWidth(__annexStyle);
3611 if (__simpleItemTextSize == 0)
3613 GET_SHAPE_CONFIG(TABLEVIEW::GROUPITEM_DEFAULT_FONT_SIZE, _CONTROL_ORIENTATION_PORTRAIT, __simpleItemTextSize);
3615 GET_SHAPE_CONFIG(TABLEVIEW::GROUPITEM_LEFT_MARGIN, _CONTROL_ORIENTATION_PORTRAIT, leftMargin);
3619 if (__simpleItemTextSize == 0)
3621 GET_SHAPE_CONFIG(TABLEVIEW::ITEM_DEFAULT_FONT_SIZE, _CONTROL_ORIENTATION_PORTRAIT, __simpleItemTextSize);
3623 GET_SHAPE_CONFIG(TABLEVIEW::ITEM_LEFT_MARGIN, _CONTROL_ORIENTATION_PORTRAIT, leftMargin);
3628 elementWidth = itemHeight * SIMPLE_ITEM_ELEMENT_BITMAP_SIZE_RATIO;
3629 elementHeight = elementWidth;
3631 bitmapRect.x = leftMargin;
3632 bitmapRect.y = (itemHeight - elementHeight) / 2;
3633 bitmapRect.width = elementWidth;
3634 bitmapRect.height = elementHeight;
3637 if (__annexStyle == TABLE_VIEW_ANNEX_STYLE_NORMAL)
3639 textRect.x = bitmapRect.x + elementWidth + leftMargin;
3640 elementWidth = itemWidth - textRect.x - leftMargin;
3644 GET_SHAPE_CONFIG(TABLEVIEW::ITEM_ANNEX_MARGIN, _CONTROL_ORIENTATION_PORTRAIT, annexMargin);
3645 if (__annexStyle == TABLE_VIEW_ANNEX_STYLE_MARK || __annexStyle == TABLE_VIEW_ANNEX_STYLE_RADIO)
3647 bitmapRect.x = leftMargin + annexWidth + annexMargin;
3648 textRect.x = bitmapRect.x + elementWidth + leftMargin;
3649 elementWidth = itemWidth - textRect.x - leftMargin;
3653 textRect.x = bitmapRect.x + elementWidth + leftMargin;
3654 elementWidth = itemWidth - textRect.x - annexWidth - leftMargin - annexMargin;
3659 textRect.width = elementWidth < 0 ? 0 : elementWidth;;
3660 textRect.height = itemHeight;
3662 if (__pSimpleItemBitmap != null && pBitmap != null)
3664 __pSimpleItemBitmap->SetBackgroundBitmap(*pBitmap);
3665 __pSimpleItemBitmap->SetBounds(bitmapRect);
3667 _Label* pSimpleItemBitmapCore = GetLabelCore(__pSimpleItemBitmap);
3668 if (!pSimpleItemBitmapCore->HasParent())
3670 r = AttachChild(*pSimpleItemBitmapCore);
3671 SysTryReturn(NID_UI_CTRL, __pSimpleItemBitmap != null, r, r, "[%s] Propagating.", GetErrorMessage(r));
3675 if (__pSimpleItemText != null)
3677 __pSimpleItemText->SetTextConfig(__simpleItemTextSize, LABEL_TEXT_STYLE_NORMAL);
3678 __pSimpleItemText->SetText(text);
3679 __pSimpleItemText->SetBounds(textRect);
3681 _Label* pSimpleItemTextCore = GetLabelCore(__pSimpleItemText);
3682 if (!pSimpleItemTextCore->HasParent())
3684 r = AttachChild(*pSimpleItemTextCore);
3685 SysTryReturn(NID_UI_CTRL, __pSimpleItemText != null, r, r, "[%s] Propagating.", GetErrorMessage(r));
3693 _TableViewItem::CreateSimpleItemContents(bool textOnly)
3695 result r = E_SUCCESS;
3697 if (__pSimpleItemText == null)
3699 __pSimpleItemText = new (std::nothrow) Label();
3701 r = GetLastResult();
3702 SysTryReturn(NID_UI_CTRL, __pSimpleItemText != null, r, r, "[%s] Propagating.", GetErrorMessage(r));
3704 __pSimpleItemText->Construct(FloatRectangle(0.0f, 0.0f, 0.0f, 0.0f), L"");
3706 __pSimpleItemText->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
3707 __pSimpleItemText->SetTextVerticalAlignment(ALIGNMENT_MIDDLE);
3708 if (__itemType == TABLE_VIEW_ITEM_TYPE_TITLE)
3710 __pSimpleItemText->SetTextColor(__simpleItemTextColor[TABLE_VIEW_GROUPITEM_DRAWING_STATUS_NORMAL]);
3714 __pSimpleItemText->SetTextColor(__simpleItemTextColor[TABLE_VIEW_ITEM_DRAWING_STATUS_NORMAL]);
3716 __pSimpleItemText->SetBackgroundColor(Color(0, 0, 0, 0));
3717 GetLabelCore(__pSimpleItemText)->SetFocusable(true);
3723 if (__pSimpleItemBitmap == null)
3725 __pSimpleItemBitmap = new (std::nothrow) Label();
3727 r = GetLastResult();
3728 SysTryReturn(NID_UI_CTRL, __pSimpleItemBitmap != null, r, r, "[%s] Propagating.", GetErrorMessage(r));
3730 __pSimpleItemBitmap->Construct(FloatRectangle(0.0f, 0.0f, 0.0f, 0.0f), L"");
3731 __pSimpleItemBitmap->SetBackgroundColor(Color(0, 0, 0, 0));
3732 GetLabelCore(__pSimpleItemBitmap)->SetFocusable(true);
3738 if (__pSimpleItemBitmap != null)
3740 delete __pSimpleItemBitmap;
3741 __pSimpleItemBitmap = null;
3749 _TableViewItem::SetSimpleTextColor(const Tizen::Graphics::Color& color, TableViewItemDrawingStatus status)
3751 __simpleItemTextColor[status] = color;
3756 Tizen::Graphics::Color
3757 _TableViewItem::GetSimpleItemTextColor(TableViewItemDrawingStatus status) const
3759 return __simpleItemTextColor[status];
3763 _TableViewItem::SetSimpleGroupItemTextColor(const Tizen::Graphics::Color& color, TableViewItemDrawingStatus status)
3765 if (status == TABLE_VIEW_ITEM_DRAWING_STATUS_NORMAL)
3767 __simpleItemTextColor[TABLE_VIEW_GROUPITEM_DRAWING_STATUS_NORMAL] = color;
3769 else if (status == TABLE_VIEW_ITEM_DRAWING_STATUS_PRESSED)
3771 __simpleItemTextColor[TABLE_VIEW_GROUPITEM_DRAWING_STATUS_PRESSED] = color;
3777 Tizen::Graphics::Color
3778 _TableViewItem::GetSimpleGroupItemTextColor(TableViewItemDrawingStatus status) const
3780 if (status == TABLE_VIEW_ITEM_DRAWING_STATUS_PRESSED)
3782 return __simpleItemTextColor[TABLE_VIEW_GROUPITEM_DRAWING_STATUS_PRESSED];
3786 return __simpleItemTextColor[TABLE_VIEW_GROUPITEM_DRAWING_STATUS_NORMAL];
3791 _TableViewItem::SetSimpleItemTextSize(int size)
3793 if (__simpleItemTextSize == size)
3798 __simpleItemTextSize = size;
3800 if (__pSimpleItemText != null)
3802 __pSimpleItemText->SetTextConfig(__simpleItemTextSize, LABEL_TEXT_STYLE_NORMAL);
3808 _TableViewItem::GetSimpleItemTextSize(void) const
3810 return __simpleItemTextSize;
3814 _TableViewItem::SetSectionHeaderFooterContents(const Tizen::Base::String& text, HorizontalAlignment alignment, bool isHeader)
3816 if (__pHeaderFooterItemText == null)
3818 result r = E_SUCCESS;
3819 float contentsHeight = 0.0f;
3820 float positionY = 0.0f;
3823 GET_COLOR_CONFIG(TABLEVIEW::GROUPITEM_TEXT_NORMAL, textColor);
3824 GET_SHAPE_CONFIG(TABLEVIEW::GROUPITEM_DEFAULT_TEXT_HEIGHT, _CONTROL_ORIENTATION_PORTRAIT, contentsHeight);
3826 __pHeaderFooterItemText = new (std::nothrow) Label();
3828 r = GetLastResult();
3829 SysTryReturn(NID_UI_CTRL, __pHeaderFooterItemText != null, r, r, "[%s] Propagating.", GetErrorMessage(r));
3833 positionY = GetBoundsF().height - contentsHeight;
3835 __pHeaderFooterItemText->Construct(FloatRectangle(0.0f, positionY, GetBoundsF().width, contentsHeight), text);
3836 __pHeaderFooterItemText->SetTextHorizontalAlignment(alignment);
3837 __pHeaderFooterItemText->SetTextColor(textColor);
3838 __pHeaderFooterItemText->SetBackgroundColor(Color(0, 0, 0, 0));
3840 _Label* pHeaderFooterItemTextCore = GetLabelCore(__pHeaderFooterItemText);
3841 pHeaderFooterItemTextCore->SetFocusable(false);
3842 AttachChild(*pHeaderFooterItemTextCore);
3849 _TableViewItem::SetSectionHeaderFooterAlignment(HorizontalAlignment alignment)
3851 if (__pHeaderFooterItemText != null)
3853 __pHeaderFooterItemText->SetTextHorizontalAlignment(alignment);
3854 __pHeaderFooterItemText->Invalidate(false);
3861 _TableViewItem::GetAnnexWidth(TableViewAnnexStyle style)
3863 float annexWidth = 0.0f;
3864 float annexDividerWidth = 0.0f;
3868 case TABLE_VIEW_ANNEX_STYLE_NORMAL:
3872 case TABLE_VIEW_ANNEX_STYLE_MARK:
3873 GET_SHAPE_CONFIG(TABLEVIEW::ITEM_ANNEX_WIDTH, _CONTROL_ORIENTATION_PORTRAIT, annexWidth);
3876 case TABLE_VIEW_ANNEX_STYLE_ONOFF_SLIDING:
3877 GET_SHAPE_CONFIG(TABLEVIEW::ITEM_ANNEX_ONOFF_WIDTH, _CONTROL_ORIENTATION_PORTRAIT, annexWidth);
3880 case TABLE_VIEW_ANNEX_STYLE_ONOFF_SLIDING_WITH_DIVIDER:
3881 GET_SHAPE_CONFIG(TABLEVIEW::ITEM_ANNEX_MARGIN, _CONTROL_ORIENTATION_PORTRAIT, annexDividerWidth);
3882 GET_FIXED_VALUE_CONFIG(TABLEVIEW::ITEM_ANNEX_DIVIDER_WIDTH, _CONTROL_ORIENTATION_PORTRAIT, annexDividerWidth);
3883 GET_SHAPE_CONFIG(TABLEVIEW::ITEM_ANNEX_ONOFF_WIDTH, _CONTROL_ORIENTATION_PORTRAIT, annexWidth);
3884 annexWidth = annexWidth + (annexDividerWidth*2) + annexDividerWidth;
3887 case TABLE_VIEW_ANNEX_STYLE_DETAILED:
3888 GET_SHAPE_CONFIG(TABLEVIEW::ITEM_ANNEX_MORE_WIDTH, _CONTROL_ORIENTATION_PORTRAIT, annexWidth);
3891 case TABLE_VIEW_ANNEX_STYLE_RADIO:
3892 GET_SHAPE_CONFIG(TABLEVIEW::ITEM_ANNEX_WIDTH, _CONTROL_ORIENTATION_PORTRAIT, annexWidth);
3903 _TableViewItem::SetDrawingStatus(TableViewItemDrawingStatus status)
3905 __drawingStatus = status;
3908 TableViewItemDrawingStatus
3909 _TableViewItem::GetDrawingStatus(void)
3911 return __drawingStatus;
3915 _TableViewItem::SetPressedControl(TableViewItemPressedControl pressedControl)
3917 __pressedControl = pressedControl;
3919 if (__pressedControl == TABLE_VIEW_ITEM_PRESSED_ITEM)
3921 __drawingStatus = TABLE_VIEW_ITEM_DRAWING_STATUS_PRESSED;
3923 else if (__pressedControl == TABLE_VIEW_ITEM_PRESSED_ANNEX)
3925 if (__annexStyle == TABLE_VIEW_ANNEX_STYLE_DETAILED)
3927 __isSelectedDetailButton = true;
3928 __drawingStatus = TABLE_VIEW_ITEM_DRAWING_STATUS_NORMAL;
3930 else if (__annexStyle == TABLE_VIEW_ANNEX_STYLE_ONOFF_SLIDING ||
3931 __annexStyle == TABLE_VIEW_ANNEX_STYLE_ONOFF_SLIDING_WITH_DIVIDER)
3933 __drawingStatus = TABLE_VIEW_ITEM_DRAWING_STATUS_NORMAL;
3937 __drawingStatus = TABLE_VIEW_ITEM_DRAWING_STATUS_PRESSED;
3942 if (__pressedControl != TABLE_VIEW_ITEM_PRESSED_INDIVIDUAL)
3944 __drawingStatus = TABLE_VIEW_ITEM_DRAWING_STATUS_PRESSED;
3949 TableViewItemPressedControl
3950 _TableViewItem::GetPressedControl(void)
3952 return __pressedControl;
3956 _TableViewItem::AdjustChildControlMargin(void)
3958 if (__childMarginState)
3963 if (IsTitleStyleItem())
3968 __childMarginState = true;
3972 if (__pDrawingProperty->groupedLookEnabled)
3974 float groupedBarMargin = 0.0f;
3975 GET_SHAPE_CONFIG(TABLEVIEW::GROUPITEM_BAR_WIDTH, _CONTROL_ORIENTATION_PORTRAIT, groupedBarMargin);
3977 margin = margin + groupedBarMargin;
3982 _VisualElement* pVisualElement = GetVisualElement();
3984 if (pVisualElement != null)
3986 FloatPoint position;
3988 position.SetPosition(margin, 0.0f);
3989 pVisualElement->ScrollByPoint(position, false);
3995 _TableViewItem::AdjustContextItemBounds(void)
3997 _TableViewItem* pContextItem = GetContextItem();
3999 if (pContextItem == null)
4004 FloatDimension contextItemSize = pContextItem->GetSizeF();
4005 FloatDimension itemSize = GetSizeF();
4007 if (!_FloatCompare(contextItemSize.height, itemSize.height))
4009 contextItemSize.height = itemSize.height;
4011 pContextItem->SetSize(contextItemSize);
4014 pContextItem->AdjustChildControlCenterAlign();
4018 _TableViewItem::AdjustAnnexBounds(void)
4020 if (__pItemAnnex == null || __isMoveItemAnimationEnabled || __isZoomInOutItemAnimationEnabled ||__isFadeInOutItemAnimationEnabled)
4026 if (__annexStyle == TABLE_VIEW_ANNEX_STYLE_ONOFF_SLIDING || __annexStyle == TABLE_VIEW_ANNEX_STYLE_ONOFF_SLIDING_WITH_DIVIDER || __annexStyle == TABLE_VIEW_ANNEX_STYLE_DETAILED)
4028 _Label* pAnnexCore = GetLabelCore(__pItemAnnex);
4029 if (pAnnexCore->HasParent())
4031 FloatRectangle annexBounds = __pItemAnnex->GetBoundsF();
4032 float annexPositionX = annexBounds.x;
4033 float leftMargin = 0.0f;
4035 GET_SHAPE_CONFIG(TABLEVIEW::ITEM_LEFT_MARGIN, _CONTROL_ORIENTATION_PORTRAIT, leftMargin);
4037 if (__pDrawingProperty != null)
4039 leftMargin += __pDrawingProperty->scrollMargin;
4042 annexPositionX = GetBoundsF().width - annexBounds.width - leftMargin;
4043 if (__pDrawingProperty != null && __pDrawingProperty->groupedLookEnabled)
4045 float groupedBarMargin = 0.0f;
4046 GET_SHAPE_CONFIG(TABLEVIEW::GROUPITEM_BAR_WIDTH, _CONTROL_ORIENTATION_PORTRAIT, groupedBarMargin);
4048 annexPositionX += groupedBarMargin;
4051 if (!_FloatCompare(annexPositionX, annexBounds.x))
4053 __pItemAnnex->SetPosition(FloatPoint(annexPositionX, annexBounds.y));
4055 if (__pAccessibilityOnOffElement != null)
4057 __pAccessibilityOnOffElement->SetBounds(__pItemAnnex->GetBoundsF());
4064 FloatRectangle itemBounds = GetBoundsF();
4065 FloatRectangle annexBounds = __pItemAnnex->GetBoundsF();
4067 if (__customHeight > 0)
4069 itemBounds.height = __customHeight;
4072 annexBounds.y = (itemBounds.height - annexBounds.height) / 2;
4073 __pItemAnnex->SetPosition(FloatPoint(annexBounds.x, annexBounds.y));
4074 if (__pAccessibilityOnOffElement != null)
4076 __pAccessibilityOnOffElement->SetBounds(__pItemAnnex->GetBoundsF());
4081 _TableViewItem::SetItemCustomHeight(float height)
4083 __customHeight = height;
4087 _TableViewItem::GetItemCustomHeight(void)
4089 return __customHeight;
4093 _TableViewItem::AdjustChildControlCenterAlign(void)
4095 if (__childControlCenterAlign)
4097 FloatDimension itemSize = GetSizeF();
4099 int childControlCount = GetChildCount();
4101 for (int i = 0; i < childControlCount; i++)
4103 _Control* pChildControl = GetChild(i);
4105 if (pChildControl == null)
4110 if (__pItemDivider == pChildControl)
4112 float positionX = pChildControl->GetPositionF().x;
4113 pChildControl->SetPosition(FloatPoint(positionX, itemSize.height - 1));
4117 if (__pItemTopDivider == pChildControl)
4119 float positionX = pChildControl->GetPositionF().x;
4120 pChildControl->SetPosition(FloatPoint(positionX, 0));
4124 FloatRectangle itemBounds = pChildControl->GetBoundsF();
4126 itemBounds.y = (itemSize.height - itemBounds.height) / 2;
4128 pChildControl->SetPosition(FloatPoint(itemBounds.x, itemBounds.y));
4134 _TableViewItem::SetChildControlCenterAlign(bool centerAlign)
4136 __childControlCenterAlign = centerAlign;
4140 _TableViewItem::GetLastTouchPressedPosition(void)
4142 return _CoordinateSystemUtils::ConvertToInteger(__touchStartPosition);
4146 _TableViewItem::GetLastTouchPressedPositionF(void)
4148 return __touchStartPosition;
4152 _TableViewItem::SetLastTouchPressedPosition(FloatPoint position)
4154 // This function was made to modify of ListView::RefreshList().
4155 // This function could adversely affect touch event handling. So, you should be used with caution.
4156 __touchStartPosition = position;
4160 _TableViewItem::SetLastTouchPressedPosition(Point position)
4162 // This function was made to modify of ListView::RefreshList().
4163 // This function could adversely affect touch event handling. So, you should be used with caution.
4164 __touchStartPosition = _CoordinateSystemUtils::ConvertToFloat(position);
4168 _TableViewItem::GetSelectionState(void)
4170 return __itemSelected;
4174 _TableViewItem::SetSelectionState(bool selected)
4176 // This function was made to modify of ListView::RefreshList().
4177 // This function could adversely affect touch event handling. So, you should be used with caution.
4178 __itemSelected = selected;
4182 _TableViewItem::MoveItem(FloatPoint position, int duration, int delay)
4184 _VisualElement* pVisualElement = GetVisualElement();
4185 VisualElementValueAnimation* pAnimation = null;
4186 String animationName = L"MOVE_ITEM";
4187 FloatPoint itemPosition = GetPositionF();
4188 result r = E_SUCCESS;
4190 if (position == itemPosition)
4195 if (__pMoveItemAnimation == null)
4197 __pMoveItemAnimation = new (std::nothrow) VisualElementValueAnimation;
4198 SysTryCatch(NID_UI_CTRL, __pMoveItemAnimation != null, , E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
4200 __pMoveItemAnimation->SetVisualElementAnimationTickEventListener(this);
4201 r = GetLastResult();
4202 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
4204 __pMoveItemAnimation->SetVisualElementAnimationStatusEventListener(this);
4205 r = GetLastResult();
4206 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
4209 pAnimation = __pMoveItemAnimation;
4211 pAnimation->SetTimingFunction(VisualElementAnimation::GetTimingFunctionByName("EaseInOut"));
4212 pAnimation->SetDuration(duration);
4213 pAnimation->SetDelay(delay);
4214 pAnimation->SetStartValue(Variant(GetPositionF()));
4215 pAnimation->SetEndValue(Variant(position));
4217 if (pVisualElement->AddAnimation(animationName, *pAnimation) != E_SUCCESS)
4228 delete __pMoveItemAnimation;
4229 __pMoveItemAnimation = null;
4235 _TableViewItem::ZoomInOutItem(bool zoomOut, int duration, int delay)
4237 _VisualElement* pVisualElement = GetVisualElement();
4238 VisualElementValueAnimation* pAnimation = null;
4239 String animationName = L"ZOOM_IN_OUT_ITEM";
4240 FloatDimension itemSize = GetSizeF();
4241 FloatDimension startValue;
4242 FloatDimension endValue;
4243 result r = E_SUCCESS;
4245 if (__pZoomInOutItemAnimation == null)
4247 __pZoomInOutItemAnimation = new (std::nothrow) VisualElementValueAnimation;
4248 SysTryCatch(NID_UI_CTRL, __pZoomInOutItemAnimation != null, , E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
4250 __pZoomInOutItemAnimation->SetVisualElementAnimationTickEventListener(this);
4251 r = GetLastResult();
4252 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
4254 __pZoomInOutItemAnimation->SetVisualElementAnimationStatusEventListener(this);
4255 r = GetLastResult();
4256 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
4259 pAnimation = __pZoomInOutItemAnimation;
4263 startValue = itemSize;
4264 endValue = FloatDimension(itemSize.width, itemSize.height / 2);
4265 pAnimation->SetTimingFunction(VisualElementAnimation::GetTimingFunctionByName(L"EaseOut"));
4269 startValue = FloatDimension(itemSize.width, itemSize.height / 2);
4270 endValue = itemSize;
4271 pAnimation->SetTimingFunction(VisualElementAnimation::GetTimingFunctionByName(L"EaseIn"));
4274 pAnimation->SetDuration(duration);
4275 pAnimation->SetDelay(delay);
4276 pAnimation->SetStartValue(Variant(startValue));
4277 pAnimation->SetEndValue(Variant(endValue));
4279 if (pVisualElement->AddAnimation(animationName, *pAnimation) != E_SUCCESS)
4289 delete __pZoomInOutItemAnimation;
4290 __pZoomInOutItemAnimation = null;
4296 _TableViewItem::FadeInOutItem(bool fadeOut, int duration, int delay)
4298 _VisualElement* pVisualElement = GetVisualElement();
4299 VisualElementValueAnimation* pAnimation = null;
4300 String animationName = L"FADE_IN_OUT_ITEM";
4301 float startValue = 0.0f;
4302 float endValue = 1.0f;
4303 result r = E_SUCCESS;
4305 if (__pFadeInOutItemtAnimation == null)
4307 __pFadeInOutItemtAnimation = new (std::nothrow) VisualElementValueAnimation;
4308 SysTryCatch(NID_UI_CTRL, __pFadeInOutItemtAnimation != null, , E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
4310 __pFadeInOutItemtAnimation->SetVisualElementAnimationTickEventListener(this);
4311 r = GetLastResult();
4312 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
4314 __pFadeInOutItemtAnimation->SetVisualElementAnimationStatusEventListener(this);
4315 r = GetLastResult();
4316 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
4319 pAnimation = __pFadeInOutItemtAnimation;
4325 pAnimation->SetTimingFunction(VisualElementAnimation::GetTimingFunctionByName(L"EaseOut"));
4329 pAnimation->SetTimingFunction(VisualElementAnimation::GetTimingFunctionByName(L"EaseIn"));
4332 pAnimation->SetTimingFunction(VisualElementAnimation::GetTimingFunctionByName("EaseIn"));
4333 pAnimation->SetDuration(duration);
4334 pAnimation->SetDelay(delay);
4335 pAnimation->SetStartValue(Variant(startValue));
4336 pAnimation->SetEndValue(Variant(endValue));
4338 if (pVisualElement->AddAnimation(animationName, *pAnimation) != E_SUCCESS)
4343 pVisualElement->SetOpacity(startValue);
4351 delete __pFadeInOutItemtAnimation;
4352 __pFadeInOutItemtAnimation = null;
4358 _TableViewItem::SetIndividualSelectionEnabled(const _Control& control, bool enable)
4360 result r = E_SUCCESS;
4363 if (!__individualSelectionControls.Contains(control))
4365 r = __individualSelectionControls.Add(control);
4368 _AccessibilityContainer* pContainer = const_cast<_Control*>(&control)->GetAccessibilityContainer();
4369 pContainer->Activate(true);
4370 int controlCount = 0;
4371 for (int i=0; i<GetChildCount(); i++)
4373 _Control* pChildControl = GetChild(i);
4374 if (pChildControl == static_cast<_Control*>(__pItemAnnexLeftDivider)
4375 || pChildControl == static_cast<_Control*>(__pItemAnnexRightDivider)
4376 || pChildControl == static_cast<_Control*>(__pItemCover)
4377 || pChildControl == static_cast<_Control*>(__pItemDivider)
4378 || pChildControl== static_cast<_Control*>(__pItemTopDivider))
4386 if (controlCount == 0 || __individualSelectionControls.GetCount() == controlCount)
4388 GetAccessibilityContainer()->Activate(false);
4392 GetAccessibilityContainer()->Activate(true);
4397 if (__individualSelectionControls.Contains(control))
4399 r = __individualSelectionControls.Remove(control, false);
4406 _TableViewItem::IsIndividualSelectionEnabled(const _Control& control)
4408 return __individualSelectionControls.Contains(control);
4412 _TableViewItem::AddRef(void)
4414 return ++__refCount;
4418 _TableViewItem::Release(void)
4421 if (__refCount <= 0)
4431 _TableViewItem::IsAnimationPlaying(void)
4433 if (__animationCount > 0)
4442 _TableViewItem::StopAllAnimation(void)
4444 _VisualElement* pVisualElement = GetVisualElement();
4446 pVisualElement->RemoveAllAnimations();
4450 _TableViewItem::SetItemDividerEnabled(bool enable)
4452 __itemDividerEnabled = enable;
4456 _TableViewItem::OnTickOccurred(const Tizen::Ui::Animations::VisualElementAnimation& animation, const Tizen::Base::String& keyName, Tizen::Ui::Animations::VisualElement& target, const Tizen::Ui::Variant& currentValue)
4458 if (keyName == L"MOVE_ITEM")
4460 FloatPoint position = currentValue.ToFloatPoint();
4461 SetPosition(position);
4463 else if (keyName == L"FADE_IN_OUT_ITEM")
4465 float opacity = currentValue.ToFloat();
4467 _VisualElement* pVisualElement = GetVisualElement();
4469 if (pVisualElement != null)
4471 pVisualElement->SetOpacity(opacity);
4474 else if (keyName == L"ZOOM_IN_OUT_ITEM")
4476 FloatDimension size = currentValue.ToFloatDimension();
4482 _TableViewItem::OnVisualElementAnimationStarted(const Tizen::Ui::Animations::VisualElementAnimation& animation, const Tizen::Base::String& keyName, Tizen::Ui::Animations::VisualElement& target)
4484 if (keyName == L"MOVE_ITEM")
4486 __isMoveItemAnimationEnabled = true;
4488 else if (keyName == L"FADE_IN_OUT_ITEM")
4490 __isFadeInOutItemAnimationEnabled = true;
4492 else if (keyName == L"ZOOM_IN_OUT_ITEM")
4494 __isZoomInOutItemAnimationEnabled = true;
4499 _TableViewItem::OnVisualElementAnimationRepeated(const Tizen::Ui::Animations::VisualElementAnimation& animation, const Tizen::Base::String& keyName, Tizen::Ui::Animations::VisualElement& target, long currentRepeatCount)
4504 _TableViewItem::OnVisualElementAnimationFinished(const Tizen::Ui::Animations::VisualElementAnimation& animation, const Tizen::Base::String& keyName, Tizen::Ui::Animations::VisualElement& target, bool completedNormally)
4506 if (__isAnimationCallbackBlocked)
4511 bool tableViewItemAnimation = true;
4512 const VisualElementValueAnimation *pAnimation = dynamic_cast<const VisualElementValueAnimation*>(&(animation));
4514 if (keyName == L"MOVE_ITEM")
4516 if (pAnimation != null)
4518 FloatPoint position = pAnimation->GetEndValue().ToFloatPoint();
4520 SetPosition(position);
4522 __isMoveItemAnimationEnabled = false;
4524 else if (keyName == L"FADE_IN_OUT_ITEM")
4526 if (pAnimation != null)
4528 float opacity = pAnimation->GetEndValue().ToFloat();
4530 _VisualElement* pVisualElement = GetVisualElement();
4532 if (pVisualElement != null)
4534 pVisualElement->SetOpacity(opacity);
4538 __isFadeInOutItemAnimationEnabled = false;
4540 else if (keyName == L"ZOOM_IN_OUT_ITEM")
4542 if (pAnimation != null)
4544 FloatDimension size = pAnimation->GetEndValue().ToFloatDimension();
4548 __isZoomInOutItemAnimationEnabled = false;
4552 tableViewItemAnimation = false;
4555 if (tableViewItemAnimation)
4564 _TableViewItem::OnAttachedToMainTree(void)
4566 if (!_FloatCompare(GetBoundsF().height, 0.0f))
4568 SetAccessibilityElement();
4575 _TableViewItem::SetAccessibilityElement(void)
4577 _AccessibilityContainer* pContainer = GetAccessibilityContainer();
4579 if (pContainer != null)
4581 if (__pAccessibilityElement == null)
4583 __pAccessibilityElement = new (std::nothrow) _AccessibilityElement(true);
4584 SysTryReturnVoidResult(NID_UI_CTRL, __pAccessibilityElement, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
4586 __pAccessibilityElement->SetTrait(ACCESSIBILITY_TRAITS_NONE);
4587 __pAccessibilityElement->SetName(L"TableViewItem");
4589 pContainer->AddElement(*__pAccessibilityElement);
4591 __pAccessibilityElement->SetBounds(FloatRectangle(0.0f,0.0f, GetBoundsF().width, GetBoundsF().height));
4593 if (__pAccessibilityOnOffElement == null && __annexStyle == TABLE_VIEW_ANNEX_STYLE_ONOFF_SLIDING_WITH_DIVIDER)
4595 __pAccessibilityOnOffElement = new (std::nothrow) _AccessibilityElement(true);
4596 SysTryReturnVoidResult(NID_UI_CTRL, __pAccessibilityOnOffElement, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
4598 __pAccessibilityOnOffElement->SetTraitWithStringId("IDS_TPLATFORM_BODY_ON_OFF_BUTTON_T_TTS");
4599 __pAccessibilityOnOffElement->SetName(L"OnOffButton");
4600 __pAccessibilityOnOffElement->SetHintWithStringId("IDS_TPLATFORM_BODY_DOUBLE_TAP_TO_MOVE_TO_CONTENT_T_TTS");
4602 pContainer->AddElement(*__pAccessibilityOnOffElement);
4603 __pAccessibilityOnOffElement->SetBounds(FloatRectangle(0.0f, 0.0f, 0.0f, 0.0f));
4608 _AccessibilityElement*
4609 _TableViewItem::GetAccessibilityElement(void)
4611 return __pAccessibilityElement;
4614 _TableViewItem::SetAccessibilityElementTrait(void)
4616 if (__pAccessibilityElement == null)
4620 int groupIndex = -1;
4623 switch (__annexStyle)
4625 case TABLE_VIEW_ANNEX_STYLE_NORMAL:
4626 GetItemIndex(groupIndex, itemIndex);
4627 if (groupIndex != -1 && itemIndex == -1)
4629 __pAccessibilityElement->SetTraitWithStringId("IDS_TPLATFORM_BODY_GROUP_INDEX");
4633 case TABLE_VIEW_ANNEX_STYLE_MARK:
4634 __pAccessibilityElement->SetTraitWithStringId("IDS_TPLATFORM_BODY_TICKBOX_T_TTS");
4637 case TABLE_VIEW_ANNEX_STYLE_ONOFF_SLIDING:
4638 __pAccessibilityElement->SetTraitWithStringId("IDS_TPLATFORM_BODY_ON_OFF_BUTTON_T_TTS");
4641 case TABLE_VIEW_ANNEX_STYLE_ONOFF_SLIDING_WITH_DIVIDER:
4644 case TABLE_VIEW_ANNEX_STYLE_DETAILED:
4645 __pAccessibilityElement->SetTraitWithStringId("IDS_TPLATFORM_BODY_BUTTON_T_TTS");
4648 case TABLE_VIEW_ANNEX_STYLE_RADIO:
4649 __pAccessibilityElement->SetTraitWithStringId("IDS_TPLATFORM_BODY_RADIO_BUTTON_T_TTS");
4657 _TableViewItem::SetAccessibilityElementValue(void)
4659 if (__pAccessibilityElement == null)
4664 switch (__annexStyle)
4666 case TABLE_VIEW_ANNEX_STYLE_MARK:
4669 __pAccessibilityElement->SetValueWithStringId("IDS_TPLATFORM_BODY_TICK_T_TTS");
4673 __pAccessibilityElement->SetValueWithStringId("IDS_TPLATFORM_BODY_UNTICK_T_TTS");
4677 case TABLE_VIEW_ANNEX_STYLE_ONOFF_SLIDING:
4680 __pAccessibilityElement->SetValueWithStringId("IDS_TPLATFORM_BODY_ON");
4684 __pAccessibilityElement->SetValueWithStringId("IDS_TPLATFORM_BODY_OFF");
4688 case TABLE_VIEW_ANNEX_STYLE_ONOFF_SLIDING_WITH_DIVIDER:
4691 if (__pAccessibilityOnOffElement != null)
4693 __pAccessibilityOnOffElement->SetValueWithStringId("IDS_TPLATFORM_BODY_ON");
4698 if (__pAccessibilityOnOffElement != null)
4700 __pAccessibilityOnOffElement->SetValueWithStringId("IDS_TPLATFORM_BODY_OFF");
4705 case TABLE_VIEW_ANNEX_STYLE_RADIO:
4708 __pAccessibilityElement->SetValueWithStringId("IDS_TPLATFORM_BODY_SELECTED_T_TTS");
4712 __pAccessibilityElement->SetValueWithStringId("IDS_TPLATFORM_BODY_NOT_SELECTED_T_TTS");
4721 _TableViewItem::SetAccessibilityElementLabel(void)
4723 if (__pAccessibilityElement == null)
4728 if (__pAccessibilityElement->IsPublicLabelUpdated())
4733 String accessibilityLabel;
4734 String space = L" ";
4735 int childControlCount = GetChildCount();
4737 for (int i = 0; i < childControlCount; i++)
4739 _Control* pChildControl = GetChild(i);
4741 if (pChildControl == null)
4746 if (__pItemDivider == pChildControl || __pItemTopDivider == pChildControl || __pItemCover == pChildControl)
4751 accessibilityLabel += GetChildAccessibilityLabelContent(*pChildControl);
4752 accessibilityLabel += space;
4755 __pAccessibilityElement->SetLabel(accessibilityLabel);
4760 _TableViewItem::OnAccessibilityFocusMovedNext(const _AccessibilityContainer& control, const _AccessibilityElement& element)
4766 _TableViewItem::OnAccessibilityFocusMovedPrevious(const _AccessibilityContainer& control, const _AccessibilityElement& element)
4772 _TableViewItem::OnAccessibilityReadElement(const _AccessibilityContainer& control, const _AccessibilityElement& element)
4778 _TableViewItem::OnAccessibilityReadingElement(const _AccessibilityContainer& control, const _AccessibilityElement& element)
4780 SetAccessibilityElementLabel();
4781 SetAccessibilityElementTrait();
4782 SetAccessibilityElementValue();
4787 _TableViewItem::OnAccessibilityFocusIn(const _AccessibilityContainer& control, const _AccessibilityElement& element)
4793 _TableViewItem::OnAccessibilityFocusOut(const _AccessibilityContainer& control, const _AccessibilityElement& element)
4799 _TableViewItem::OnAccessibilityActionPerformed(const _AccessibilityContainer& control, const _AccessibilityElement& element)
4801 switch (__annexStyle)
4803 case TABLE_VIEW_ANNEX_STYLE_NORMAL:
4806 case TABLE_VIEW_ANNEX_STYLE_MARK:
4810 GET_STRING_CONFIG(IDS_TPLATFORM_BODY_TICK_T_TTS,string);
4811 _AccessibilityManager::GetInstance()->ReadContent(string);
4816 GET_STRING_CONFIG(IDS_TPLATFORM_BODY_UNTICK_T_TTS,string);
4817 _AccessibilityManager::GetInstance()->ReadContent(string);
4820 case TABLE_VIEW_ANNEX_STYLE_ONOFF_SLIDING:
4824 GET_STRING_CONFIG(IDS_TPLATFORM_BODY_ON,string);
4825 _AccessibilityManager::GetInstance()->ReadContent(string);
4830 GET_STRING_CONFIG(IDS_TPLATFORM_BODY_OFF,string);
4831 _AccessibilityManager::GetInstance()->ReadContent(string);
4835 case TABLE_VIEW_ANNEX_STYLE_ONOFF_SLIDING_WITH_DIVIDER:
4836 if (&element == __pAccessibilityOnOffElement && IsEnabled())
4842 GET_STRING_CONFIG(IDS_TPLATFORM_BODY_OFF,string);
4843 _AccessibilityManager::GetInstance()->ReadContent(string);
4849 GET_STRING_CONFIG(IDS_TPLATFORM_BODY_ON,string);
4850 _AccessibilityManager::GetInstance()->ReadContent(string);
4855 case TABLE_VIEW_ANNEX_STYLE_DETAILED:
4858 case TABLE_VIEW_ANNEX_STYLE_RADIO:
4862 GET_STRING_CONFIG(IDS_TPLATFORM_OPT_SELECT,string);
4863 _AccessibilityManager::GetInstance()->ReadContent(string);
4868 GET_STRING_CONFIG(IDS_TPLATFORM_BODY_NOT_SELECTED_T_TTS,string);
4869 _AccessibilityManager::GetInstance()->ReadContent(string);
4880 _TableViewItem::OnAccessibilityValueIncreased(const _AccessibilityContainer& control, const _AccessibilityElement& element)
4886 _TableViewItem::OnAccessibilityValueDecreased(const _AccessibilityContainer& control, const _AccessibilityElement& element)
4892 _TableViewItem::OnKeyPressed(const _Control& source, const _KeyInfo& keyInfo)
4894 __isTouchCancelOnPressRelease = false;
4896 if (!IsFocusModeStateEnabled())
4901 if (IsReorderMode() || IsAnimationPlaying())
4906 _TableView* pParent = dynamic_cast<_TableView*>(GetParent());
4907 _KeyCode keyCode = keyInfo.GetKeyCode();
4908 IListT<_Control*>* pFocusList = GetFocusListN();
4909 SysTryReturn(NID_UI_CTRL, pFocusList != null, true, GetLastResult(), "[%s] propagating.", GetErrorMessage(GetLastResult()));
4911 _Control* pChildControl = null;
4912 _Control* pFocusedControl = null;
4913 _Window* pTop = source.GetRootWindow();
4917 pFocusedControl = pTop->GetCurrentFocusControl();
4920 int count = pFocusList->GetCount();
4922 if (pFocusedControl == null)
4932 for (int i=count-1; i>=0; i--)
4934 pFocusList->GetAt(i, pChildControl);
4935 if (pChildControl == null)
4940 if (pChildControl->IsFocused())
4944 pChildControl = null;
4948 for (int j=i-1; j>=0; j--)
4950 pFocusList->GetAt(j, pChildControl);
4951 if (pChildControl == null)
4956 if (pChildControl->IsFocusable() && pChildControl->GetEnableState()
4957 && pChildControl->GetVisibleState())
4963 pChildControl = null;
4970 if (pChildControl && pChildControl->GetEnableState()
4971 && pChildControl->GetVisibleState() && pChildControl->IsFocusable())
4973 if (pParent != null)
4975 pParent->SetAnnexFocused(true);
4977 pChildControl->SetFocused(true);
4978 pChildControl->DrawFocus();
4982 _Control* pParentControl = pFocusedControl->GetParent();
4983 _TableViewItem* pItem = dynamic_cast<_TableViewItem*>(pParentControl);
4985 if (pItem != null && pItem->GetEnableState() && !pItem->IsFocused()
4986 && pItem->GetVisibleState() && pItem->IsFocusable())
4988 if (pParent != null)
4990 pParent->SetAnnexFocused(false);
4992 pItem->SetFocused(true);
5002 if (pChildControl == null)
5004 for (int i=0; i<count; i++)
5006 pFocusList->GetAt(i, pChildControl);
5007 if (pChildControl == null)
5012 if (pChildControl->IsFocusable() && pChildControl->GetEnableState()
5013 && pChildControl->GetVisibleState())
5019 pChildControl = null;
5026 for (int i=0; i<count; i++)
5028 pFocusList->GetAt(i, pChildControl);
5029 if (pChildControl == null)
5034 if (pChildControl->IsFocused())
5038 pChildControl = null;
5042 for (int j=i+1; j<count; j++)
5044 pFocusList->GetAt(j, pChildControl);
5045 if (pChildControl == null)
5050 if (pChildControl->IsFocusable() && pChildControl->GetEnableState()
5051 && pChildControl->GetVisibleState())
5057 pChildControl = null;
5065 if (pChildControl && pChildControl->GetEnableState() && pChildControl->GetVisibleState()
5066 && pChildControl->IsFocusable())
5068 if (pParent != null)
5070 pParent->SetAnnexFocused(true);
5072 pChildControl->SetFocused(true);
5073 pChildControl->DrawFocus();
5078 if (&source == this)
5080 __pressedControl = TABLE_VIEW_ITEM_PRESSED_ITEM;
5082 else if (&source == GetLabelCore(__pItemAnnex))
5084 __pressedControl = TABLE_VIEW_ITEM_PRESSED_ANNEX;
5086 else if (IsIndividualSelectionEnabled(source))
5088 __pressedControl = TABLE_VIEW_ITEM_PRESSED_INDIVIDUAL;
5092 __pressedControl = TABLE_VIEW_ITEM_PRESSED_NONE;
5094 __itemSelected = true;
5095 FireItemTouchPressed();
5101 __annexOnOffHandlerMoved = false;
5102 __itemTouchMoved = false;
5104 __itemSelected = false;
5105 __drawingStatus = TABLE_VIEW_ITEM_DRAWING_STATUS_NORMAL;
5107 if (__annexStyle == TABLE_VIEW_ANNEX_STYLE_DETAILED)
5109 __isSelectedDetailButton = false;
5112 SetItemChanged(true);
5122 _TableViewItem::OnKeyReleased(const _Control& source, const _KeyInfo& keyInfo)
5124 if (!IsFocusModeStateEnabled())
5129 if (IsReorderMode() || IsAnimationPlaying())
5134 _KeyCode keyCode = keyInfo.GetKeyCode();
5136 if (keyCode == _KEY_ENTER)
5138 _TableView* pParent = dynamic_cast<_TableView*>(GetParent());
5139 SysTryReturn(NID_UI_CTRL, pParent != null, true, GetLastResult(), "[%s] propagating.", GetErrorMessage(GetLastResult()));
5141 pParent->StopExpandCollapseAnimation();
5142 if (&source == this)
5144 __releasedControl = TABLE_VIEW_ITEM_PRESSED_ITEM;
5146 else if (&source == GetLabelCore(__pItemAnnex))
5148 __releasedControl = TABLE_VIEW_ITEM_PRESSED_ANNEX;
5150 else if (IsIndividualSelectionEnabled(source))
5152 __releasedControl = TABLE_VIEW_ITEM_PRESSED_INDIVIDUAL;
5156 __releasedControl = TABLE_VIEW_ITEM_PRESSED_NONE;
5158 FireItemTouchReleased();
5161 else if (keyCode == _KEY_LEFT || keyCode == _KEY_RIGHT)
5170 _TableViewItem::OnFocusModeStateChanged(void)
5176 _TableViewItem::ResetItemState(void)
5178 __itemSelected = false;
5179 __drawingStatus = TABLE_VIEW_ITEM_DRAWING_STATUS_NORMAL;
5180 __releasedControl = TABLE_VIEW_ITEM_PRESSED_NONE;
5182 if (__annexStyle == TABLE_VIEW_ANNEX_STYLE_DETAILED)
5184 __isSelectedDetailButton = false;
5187 SetItemChanged(true);
5192 _TableViewItem::GetPreviousFocusChildControl(const _Control& source)
5194 _Control* pParentControl = null;
5195 float sourcePosition = 0.0f;
5197 _Control* pSource = const_cast<_Control*>(&source);
5198 _TableViewItem* pItem = dynamic_cast<_TableViewItem*>(pSource);
5201 pParentControl = pSource;
5202 sourcePosition = pParentControl->GetBoundsF().width;
5206 pParentControl = source.GetParent();
5207 sourcePosition = source.GetBoundsF().x;
5210 if (pParentControl == null)
5215 int childControlCount = pParentControl->GetChildCount();
5216 float position = 0.0f;
5217 _Control* destination = null;
5219 for (int i=0; i<childControlCount; i++)
5221 _Control* pChildControl = pParentControl->GetChild(i);
5222 if (pChildControl != null && pChildControl->IsFocusable())
5224 float childPosition = pChildControl->GetBoundsF().x;
5225 if (childPosition < sourcePosition)
5227 if (childPosition > position)
5229 position = childPosition;
5230 destination = pChildControl;
5232 else if (_FloatCompare(position, 0.0f))
5234 position = childPosition;
5235 destination = pChildControl;
5244 _TableViewItem::GetNextFocusChildControl(const _Control& source)
5246 _Control* pParentControl = null;
5247 float sourcePosition = 0.0f;
5249 _Control* pSource = const_cast<_Control*>(&source);
5250 _TableViewItem* pItem = dynamic_cast<_TableViewItem*>(pSource);
5253 pParentControl = pSource;
5254 sourcePosition = 0.0f;
5258 pParentControl = source.GetParent();
5259 sourcePosition = source.GetBoundsF().x;
5262 if (pParentControl == null)
5267 int childControlCount = pParentControl->GetChildCount();
5268 float position = 0.0f;
5269 _Control* destination = null;
5271 for (int i=0; i<childControlCount; i++)
5273 _Control* pChildControl = pParentControl->GetChild(i);
5274 if (pChildControl != null && pChildControl->IsFocusable())
5276 float childPosition = pChildControl->GetBoundsF().x;
5277 if (childPosition > sourcePosition)
5279 if (childPosition < position)
5281 position = childPosition;
5282 destination = pChildControl;
5284 else if (_FloatCompare(position, 0.0f))
5286 position = childPosition;
5287 destination = pChildControl;
5296 _TableViewItem::IsChildControlFocusManage(void) const
5302 _TableViewItem::SetSimpleLastItemEnabled(bool enable)
5304 __isSimpleLastItem = enable;
5308 _TableViewItem::SetSectionItem(bool isSectionItem)
5310 __isSectionItem = isSectionItem;
5314 _TableViewItem::SetTouchPressOnScroll(bool isTouch)
5316 __isTouchPressOnScroll = isTouch;
5320 _TableViewItem::IsTouchPressOnScroll(void) const
5322 return __isTouchPressOnScroll;
5326 _TableViewItem::OnVisibleStateChanged(void)
5328 if (IsFocused() && !GetVisibleState())
5335 _TableViewItem::OnAncestorEnableStateChanged(const _Control& control)
5337 if (IsFocused() && !IsEnabled())
5344 _TableViewItem::OnAncestorVisibleStateChanged(const _Control& control)
5346 if (IsFocused() && !IsVisible())
5353 _TableViewItem::OnFocusableStateChanged(bool focusableState)
5355 if (IsFocused() && !focusableState)
5362 _TableViewItem::SetPublicLabelUpdate(bool resetPublicLabelUpdate)
5364 if (__pAccessibilityElement)
5366 __pAccessibilityElement->SetPublicLabelUpdate(resetPublicLabelUpdate);
5371 _TableViewItem::GetChildAccessibilityLabelContent(const _Control& source)
5373 String accessibilityLabel = L"";
5374 String space = L" ";
5376 if (IsIndividualSelectionEnabled(source))
5378 return accessibilityLabel;
5381 if (!source.IsVisible() || !source.GetEnableState())
5383 return accessibilityLabel;
5386 _Control* pSource = const_cast<_Control*>(&source);
5390 _AccessibilityContainer* pContainer = pSource->GetAccessibilityContainer();
5391 LinkedListT<_AccessibilityElement*> accessibilityElements;
5392 _AccessibilityElement* pElement = null;
5396 pContainer->GetElements(accessibilityElements);
5397 int elementCount = accessibilityElements.GetCount();
5399 for (int i = 0; i < elementCount; i++)
5401 if (accessibilityElements.GetAt(i, pElement) == E_SUCCESS)
5403 accessibilityLabel += pElement->GetLabel();
5404 accessibilityLabel += space;
5410 //check for children
5411 int childControlCount = source.GetChildCount();
5413 for (int i = 0; i < childControlCount; i++)
5415 _Control* pChildControl = source.GetChild(i);
5417 if (pChildControl == null)
5422 accessibilityLabel += GetChildAccessibilityLabelContent(*pChildControl);
5425 return accessibilityLabel;
5429 _TableViewItem::DeactivateChildAccessibilityContainer(const _Control& source)
5431 _Control* pControl = const_cast<_Control*>(&source);
5435 _AccessibilityContainer* pContainer = pControl->GetAccessibilityContainer();
5439 if (__individualSelectionControls.Contains(source))
5441 pContainer->Activate(true);
5445 pContainer->Activate(false);
5450 //check for children
5451 int childControlCount = source.GetChildCount();
5453 for (int i = 0; i < childControlCount; i++)
5455 _Control* pChildControl = source.GetChild(i);
5457 if (pChildControl == null)
5462 DeactivateChildAccessibilityContainer(*pChildControl);
5466 }}} // Tizen::Ui::Controls