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(bool isTouchRelease)
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;
1519 int groupIndex = -1;
1521 GetItemIndex(groupIndex, itemIndex);
1524 _TableView* pTableView = dynamic_cast<_TableView*>(GetParent());
1527 pTableView->SetFocusItemOnPressedState(groupIndex, itemIndex);
1531 FireItemEvent(selectedItem);
1536 _TableViewItem::OnTouchMoved(const _Control& source, const _TouchInfo& touchinfo)
1538 if (IsReorderMode())
1543 if (IsTouchPressOnScroll())
1545 SetTouchPressOnScroll(false);
1548 if (__isPressedTimerEnabled)
1550 StopTouchPressedTimer();
1553 bool retVal = false;
1555 if (&source == this)
1557 __itemSelected = false;
1558 __drawingStatus = TABLE_VIEW_ITEM_DRAWING_STATUS_NORMAL;
1560 SetItemChanged(true);
1563 else if (&source == GetLabelCore(__pItemAnnex))
1565 if (__annexStyle == TABLE_VIEW_ANNEX_STYLE_DETAILED)
1567 __isSelectedDetailButton = false;
1568 __itemSelected = false;
1571 else if (__annexStyle == TABLE_VIEW_ANNEX_STYLE_ONOFF_SLIDING ||
1572 __annexStyle == TABLE_VIEW_ANNEX_STYLE_ONOFF_SLIDING_WITH_DIVIDER)
1574 __annexOnOffHandlerMoved = true;
1575 DrawAnnexOnOffHandler(touchinfo.GetCurrentPosition().x);
1580 __itemSelected = false;
1581 __drawingStatus = TABLE_VIEW_ITEM_DRAWING_STATUS_NORMAL;
1583 SetItemChanged(true);
1589 if (!IsIndividualSelectionEnabled(source))
1591 __itemSelected = false;
1592 __drawingStatus = TABLE_VIEW_ITEM_DRAWING_STATUS_NORMAL;
1594 SetItemChanged(true);
1599 __itemTouchMoved = true;
1605 _TableViewItem::OnTouchCanceled(const _Control& source, const _TouchInfo& touchinfo)
1607 __isTouchCancelOnPressRelease = true;
1609 if (__isPressedTimerEnabled)
1611 StopTouchPressedTimer();
1614 __annexOnOffHandlerMoved = false;
1615 __itemTouchMoved = false;
1619 if (&source != this)
1627 _UiTouchEventDelivery
1628 _TableViewItem::OnPreviewTouchPressed(const _Control& source, const _TouchInfo& touchinfo)
1630 if (IsTouchPressOnScroll())
1632 SetTouchPressOnScroll(false);
1633 return _UI_TOUCH_EVENT_DELIVERY_NO;
1635 return _UI_TOUCH_EVENT_DELIVERY_FORCED_YES;
1638 _UiTouchEventDelivery
1639 _TableViewItem::OnPreviewTouchReleased(const _Control& source, const _TouchInfo& touchinfo)
1641 return _UI_TOUCH_EVENT_DELIVERY_FORCED_YES;
1644 _UiTouchEventDelivery
1645 _TableViewItem::OnPreviewTouchMoved(const _Control& source, const _TouchInfo& touchinfo)
1647 return _UI_TOUCH_EVENT_DELIVERY_YES;
1650 _UiTouchEventDelivery
1651 _TableViewItem::OnPreviewTouchCanceled(const _Control& source, const _TouchInfo& touchinfo)
1653 return _UI_TOUCH_EVENT_DELIVERY_FORCED_YES;
1657 _TableViewItem::OnDraw(void)
1659 if (IsItemChanged() == true)
1661 DrawItemBackground();
1665 DrawSectionStyleBackgroundCover();
1667 SetItemChanged(false);
1672 _TableViewItem::OnChildAttached(const _Control& child)
1674 _Control* pControl = const_cast<_Control*>(&child);
1675 _AccessibilityContainer* pContainer = pControl->GetAccessibilityContainer();
1677 if (__individualSelectionControls.Contains(child))
1679 pContainer->Activate(true);
1683 pContainer->Activate(false);
1685 if (!(pControl == static_cast<_Control*>(__pItemAnnexLeftDivider)
1686 || pControl == static_cast<_Control*>(__pItemAnnexRightDivider)
1687 || pControl == static_cast<_Control*>(__pItemCover)
1688 || pControl == static_cast<_Control*>(__pItemDivider)
1689 || pControl== static_cast<_Control*>(__pItemTopDivider)))
1691 GetAccessibilityContainer()->Activate(true);
1695 DeactivateChildAccessibilityContainer(child);
1697 pControl->SetTouchPressThreshold(SENSITIVE);
1699 FloatRectangle bounds = child.GetBoundsF();
1701 if (__pDrawingProperty != null && __pDrawingProperty->groupedLookEnabled)
1703 float groupedBarMargin = 0.0f;
1704 GET_SHAPE_CONFIG(TABLEVIEW::GROUPITEM_BAR_WIDTH, _CONTROL_ORIENTATION_PORTRAIT, groupedBarMargin);
1706 bounds.x += groupedBarMargin;
1709 if ((__annexStyle == TABLE_VIEW_ANNEX_STYLE_MARK) || (__annexStyle == TABLE_VIEW_ANNEX_STYLE_RADIO))
1711 if (GetLabelCore(__pItemAnnex) == &child ||
1712 GetLabelCore(__pSimpleItemBitmap) == &child ||
1713 GetLabelCore(__pSimpleItemText) == &child)
1718 float leftMargin = 0.0f;
1719 float annexWidth = 0.0f;
1721 GET_SHAPE_CONFIG(TABLEVIEW::ITEM_LEFT_MARGIN, _CONTROL_ORIENTATION_PORTRAIT, leftMargin);
1722 GET_SHAPE_CONFIG(TABLEVIEW::ITEM_ANNEX_WIDTH, _CONTROL_ORIENTATION_PORTRAIT, annexWidth);
1724 bounds.x += (leftMargin * 2) + annexWidth;
1727 pControl->SetBounds(bounds);
1731 _TableViewItem::OnChildDetached(const _Control& child)
1733 if (__individualSelectionControls.Contains(child))
1735 __individualSelectionControls.Remove(child, false);
1738 _Label* pSimpleItemTextCore = GetLabelCore(__pSimpleItemText);
1739 _Label* pSimpleItemBitmapCore = GetLabelCore(__pSimpleItemBitmap);
1741 if (&child == pSimpleItemTextCore)
1743 __pSimpleItemText = null;
1746 if (&child == pSimpleItemBitmapCore)
1748 __pSimpleItemBitmap = null;
1753 _TableViewItem::OnTimerExpired(Tizen::Base::Runtime::Timer& timer)
1755 result r = E_SUCCESS;
1757 if (&timer == __pCheckedTimer)
1759 if (__checkedCount < MAX_CHECKED_COUNT)
1761 r = __pCheckedTimer->Start(CHECKED_ANIMATION_DURATION);
1762 SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
1765 r = PlayCheckBoxAnimation();
1766 SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
1768 if (__checkedCount < MAX_CHECKED_COUNT)
1775 __isCheckedAnimationEnabled = false;
1776 __isCheckedTimerEnabled = false;
1779 else if (&timer == __pPressedTimer)
1781 __isPressedTimerEnabled = false;
1782 FireItemTouchPressed();
1784 else if (&timer == __pReleasedTimer)
1786 __isReleasedTimerEnabled = false;
1787 FireItemTouchReleased();
1792 _TableViewItem::StartTouchPressedTimer(const _Control& source, const _TouchInfo& touchinfo)
1794 result r = E_SUCCESS;
1796 if (__pPressedTimer == null)
1798 __pPressedTimer = new (std::nothrow) Timer();
1799 SysTryCatch(NID_UI_CTRL, __pPressedTimer != null, r = E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
1801 r = __pPressedTimer->Construct(*this);
1802 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage);
1805 if (__isPressedTimerEnabled == false)
1807 r = __pPressedTimer->Start(TOUCH_PRESSED_DURATION);
1808 SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "Propagating.");
1810 __isPressedTimerEnabled = true;
1816 if (__isPressedTimerEnabled && __pPressedTimer != null)
1818 __pPressedTimer->Cancel();
1821 delete __pPressedTimer;
1822 __pPressedTimer = null;
1828 _TableViewItem::StopTouchPressedTimer(bool forceStop)
1830 result r = E_SUCCESS;
1832 if (__pPressedTimer == null)
1837 if (__isPressedTimerEnabled || forceStop)
1839 r = __pPressedTimer->Cancel();
1840 SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
1843 __isPressedTimerEnabled = false;
1849 _TableViewItem::StartTouchReleasedTimer()
1851 result r = E_SUCCESS;
1853 if (__pReleasedTimer == null)
1855 __pReleasedTimer = new (std::nothrow) Timer();
1856 SysTryCatch(NID_UI_CTRL, __pReleasedTimer != null, r = E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
1859 r = __pReleasedTimer->Construct(*this);
1860 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage);
1863 if (!__isReleasedTimerEnabled)
1865 r = __pReleasedTimer->Start(TOUCH_RELEASED_DURATION);
1866 SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "Propagating.");
1868 __isReleasedTimerEnabled = true;
1873 if (__isReleasedTimerEnabled && __pReleasedTimer != null)
1875 __pReleasedTimer->Cancel();
1878 delete __pReleasedTimer;
1879 __pReleasedTimer = null;
1885 _TableViewItem::StopTouchReleasedTimer(bool forceStop)
1887 result r = E_SUCCESS;
1889 if (__pReleasedTimer == null)
1894 if (__isReleasedTimerEnabled || forceStop)
1896 r = __pReleasedTimer->Cancel();
1897 SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
1900 __isReleasedTimerEnabled = false;
1906 _TableViewItem::OnAncestorInputEnableStateChanged(const _Control& control)
1908 if (__isPressedTimerEnabled)
1910 StopTouchPressedTimer();
1913 __annexOnOffHandlerMoved = false;
1914 __itemTouchMoved = false;
1916 __itemSelected = false;
1917 __drawingStatus = TABLE_VIEW_ITEM_DRAWING_STATUS_NORMAL;
1919 if (__annexStyle == TABLE_VIEW_ANNEX_STYLE_DETAILED)
1921 __isSelectedDetailButton = false;
1924 SetItemChanged(true);
1929 _TableViewItem::StartCheckBoxAnimation(void)
1931 result r = E_SUCCESS;
1933 if (__pCheckedTimer == null)
1935 __pCheckedTimer = new (std::nothrow) Timer();
1936 SysTryCatch(NID_UI_CTRL, __pCheckedTimer != null, r = E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
1939 r = __pCheckedTimer->Construct(*this);
1940 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage);
1943 if (__isCheckedTimerEnabled == false)
1945 r = __pCheckedTimer->Start(CHECKED_ANIMATION_DURATION);
1946 SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "Propagating.");
1948 __isCheckedTimerEnabled = true;
1954 if (__isCheckedTimerEnabled)
1956 __pCheckedTimer->Cancel();
1959 delete __pCheckedTimer;
1960 __pCheckedTimer = null;
1966 _TableViewItem::StopCheckBoxAnimation(void)
1968 result r = E_SUCCESS;
1970 SysTryReturnVoidResult(NID_UI_CTRL, __pCheckedTimer != null, E_SYSTEM, "[%s] A system error has been occurred. Timer is invalid.", GetErrorMessage(E_SYSTEM));
1973 if (__isCheckedTimerEnabled)
1975 r = __pCheckedTimer->Cancel();
1976 SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
1980 __isCheckedAnimationEnabled = false;
1981 __isCheckedTimerEnabled = false;
1987 _TableViewItem::PlayCheckBoxAnimation(void)
1989 Bitmap* pCheckBox = null;
1990 Bitmap* pCheckBoxBg = null;
1991 Bitmap* pMergeBitmap = null;
1992 Canvas* pCanvas = null;
1993 result r = E_SUCCESS;
1995 FloatRectangle bounds;
1997 float annexWidth = 0.0f;
1998 float annexHeight = 0.0f;
2000 if (__drawingStatus == TABLE_VIEW_ITEM_DRAWING_STATUS_NORMAL)
2002 r = GET_BITMAP_CONFIG_N(TABLEVIEW::CHECKBOX_BG_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, pCheckBoxBg);
2004 else if ((__drawingStatus == TABLE_VIEW_ITEM_DRAWING_STATUS_PRESSED) || (__drawingStatus == TABLE_VIEW_ITEM_DRAWING_STATUS_HIGHLIGHTED))
2006 r = GET_BITMAP_CONFIG_N(TABLEVIEW::CHECKBOX_BG_PRESSED, BITMAP_PIXEL_FORMAT_ARGB8888, pCheckBoxBg);
2008 SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS) && (pCheckBoxBg != null), , E_SYSTEM, "[%s] Propagating.", GetErrorMessage(r));
2010 r = GET_BITMAP_CONFIG_N(TABLEVIEW::CHECKBOX_CHECK_MARK_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, pCheckBox);
2011 SysTryCatch(NID_UI_CTRL,(r == E_SUCCESS) && (pCheckBox != null), , E_SYSTEM, "[%s] Propagating.", GetErrorMessage(r));
2013 GET_SHAPE_CONFIG(TABLEVIEW::ITEM_ANNEX_WIDTH, _CONTROL_ORIENTATION_PORTRAIT, annexWidth);
2014 GET_SHAPE_CONFIG(TABLEVIEW::ITEM_ANNEX_HEIGHT, _CONTROL_ORIENTATION_PORTRAIT, annexHeight);
2016 bounds.SetBounds(0, 0, annexWidth, annexHeight);
2018 pCanvas = new (std::nothrow) Canvas();
2019 SysTryCatch(NID_UI_CTRL, pCanvas != null, , E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
2021 r = pCanvas->Construct(bounds);
2022 pCanvas->SetBackgroundColor(Color(0, 0, 0, 0));
2025 DrawBitmap(*pCanvas, CalculateAnnexBitmapBounds(annexWidth, annexHeight, *pCheckBoxBg), *pCheckBoxBg);
2027 __checkedBounds = CalculateAnnexBitmapBounds(annexWidth, annexHeight, *pCheckBox);
2028 if (IsChecked() == true)
2030 if (_BitmapImpl::CheckNinePatchedBitmapStrictly(*pCheckBox))
2032 FloatRectangle drawingRect(__checkedBounds.x, __checkedBounds.y, __checkedBounds.width, __checkedBounds.height);
2033 r = pCanvas->DrawNinePatchedBitmap(drawingRect, *pCheckBox); // +++ check floating
2037 FloatRectangle bitmapSourceRect(0.0f, 0.0f, pCheckBox->GetWidthF()*__checkedCount * 0.1, pCheckBox->GetHeightF());
2038 FloatRectangle drawingRect(__checkedBounds.x, __checkedBounds.y, __checkedBounds.width * __checkedCount * 0.1, __checkedBounds.height);
2039 r = pCanvas->DrawBitmap(drawingRect, *pCheckBox, bitmapSourceRect); // +++ check floating
2043 pMergeBitmap = new (std::nothrow) Bitmap();
2044 SysTryCatch(NID_UI_CTRL, pMergeBitmap != null, , E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
2046 pMergeBitmap->Construct(*pCanvas, bounds);
2047 _BitmapImpl::ConvertToNonpremultiplied(*pMergeBitmap, true);
2051 __pItemAnnex->SetBackgroundBitmap(*pMergeBitmap);
2052 __pItemAnnex->Invalidate(false);
2058 delete pMergeBitmap;
2065 _TableViewItem::SetItemLayoutEnabled(bool enabled)
2067 __isItemLayoutEnabled = enabled;
2071 _TableViewItem::GetItemLayoutEnabled(void)
2073 return __isItemLayoutEnabled;
2077 _TableViewItem::OnBoundsChanged(void)
2079 if (__checkItemHeightNeeded && HasParent())
2081 _TableView* pParent = dynamic_cast<_TableView*>(GetParent());
2082 if (pParent != null)
2084 int groupIndex = -1;
2086 GetItemIndex(groupIndex, itemIndex);
2088 pParent->CheckItemHeightAndRefreshLayout(groupIndex, itemIndex);
2091 __checkItemHeightNeeded = false;
2094 AdjustAnnexBounds();
2096 SetItemHighlightBounds(*__pHighlightVisualElement, CalculateItemHighlightBounds());
2098 if (__pHeaderFooterItemText != null)
2100 FloatRectangle textBounds = __pHeaderFooterItemText->GetBoundsF();
2101 textBounds.width = GetBoundsF().width;
2103 if (__itemType == TABLE_VIEW_ITEM_TYPE_FOOTER)
2105 textBounds.x -= __pDrawingProperty->scrollMargin;
2108 __pHeaderFooterItemText->SetBounds(textBounds);
2111 if (__pBitmapVisualElement != null)
2113 FloatRectangle bounds = GetBoundsF();
2114 __pBitmapVisualElement->SetBounds(FloatRectangle(0.0f, 0.0f, bounds.width, bounds.height));
2117 if (__pAccessibilityElement != null)
2119 __pAccessibilityElement->SetBounds(FloatRectangle(0.0f,0.0f, GetBoundsF().width, GetBoundsF().height));
2122 RemoveFocusRing(true);
2123 if (IsFocusModeStateEnabled())
2125 if (GetRootWindow() && GetRootWindow()->IsActivated()
2134 _TableViewItem::SetDrawingProperty(_ItemDrawingProperty* pDrawingProperty)
2137 SysTryReturnVoidResult(NID_UI_CTRL, pDrawingProperty != null, E_INVALID_ARG, "[%s] Invalid argument(s) is used. The pDrawingProperty is null.", GetErrorMessage(E_INVALID_ARG));
2139 __pDrawingProperty = pDrawingProperty;
2141 if (__pDrawingProperty->sectionStyleEnabled == true &&
2147 if (__pDrawingProperty->itemDividerEnabled)
2149 CreateItemDivider();
2155 _ItemDrawingProperty*
2156 _TableViewItem::GetDrawingProperty(void)
2158 return __pDrawingProperty;
2162 _TableViewItem::DrawItemBackground(void)
2164 Canvas* pCanvas = null;
2165 Bitmap* pDrawBitmap = __pItemBgBitmap[__drawingStatus];
2166 Color bgColor = __colorItemBg[__drawingStatus];
2167 FloatRectangle bounds = GetBoundsF();
2169 SetItemHighlightBounds(*__pHighlightVisualElement, CalculateItemHighlightBounds());
2170 __pHighlightVisualElement->SetBackgroundColor(_Colorf(0.0f, 0.0f, 0.0f, 0.0f));
2172 if (pDrawBitmap != null && __enabledState)
2174 if (__pBitmapVisualElement == null)
2179 String imagePath = null;
2180 if (_BitmapImpl::CheckNinePatchedBitmapStrictly(*pDrawBitmap) == false)
2182 imagePath = _BitmapImpl::GetInstance(*pDrawBitmap)->GetFileName();
2185 if (imagePath.IsEmpty() == false)
2187 __pBitmapVisualElement->SetBackgroundColor(_Colorf((float)bgColor.GetRed() /255, (float)bgColor.GetGreen() / 255, (float)bgColor.GetBlue() / 255, (float)bgColor.GetAlpha() / 255));
2188 __pBitmapVisualElement->SetImageSource(imagePath);
2192 pCanvas = __pBitmapVisualElement->GetCanvasN();
2193 SysTryCatch(NID_UI_CTRL, pCanvas != null, , E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
2194 pCanvas->SetBackgroundColor(Color(0, 0, 0, 0));
2197 DrawBitmap(*pCanvas, FloatRectangle(0.0f, 0.0f, bounds.width, bounds.height), *pDrawBitmap);
2201 if (IsContextItem())
2203 DrawContextItemBackground();
2205 else if (__pDrawingProperty->sectionStyleEnabled == true)
2207 DrawSectionStyleBackground();
2213 if (__itemType == TABLE_VIEW_ITEM_TYPE_HEADER || __itemType == TABLE_VIEW_ITEM_TYPE_FOOTER)
2215 SetBackgroundColor(Color(0, 0, 0, 0));
2216 __pHighlightVisualElement->SetBackgroundColor(_Colorf(0.0f, 0.0f, 0.0f, 0.0f));
2218 else if (__itemType == TABLE_VIEW_ITEM_TYPE_TITLE)
2220 __pHighlightVisualElement->SetBackgroundColor(_Colorf((float)bgColor.GetRed() / 255.0f, (float)bgColor.GetGreen() / 255.0f, (float)bgColor.GetBlue() / 255.0f, (float)bgColor.GetAlpha() / 255.0f));
2224 SetBackgroundColor(__colorItemBg[TABLE_VIEW_ITEM_DRAWING_STATUS_NORMAL]);
2226 __pHighlightVisualElement->SetBackgroundColor(_Colorf((float)bgColor.GetRed() / 255.0f, (float)bgColor.GetGreen() / 255.0f, (float)bgColor.GetBlue() / 255.0f, (float)bgColor.GetAlpha() / 255.0f));
2228 if (__pDrawingProperty->groupedLookEnabled == true)
2236 GET_COLOR_CONFIG(TABLEVIEW::ITEM_BG_DISABLED, bgColor);
2237 SetBackgroundColor(bgColor);
2238 __pHighlightVisualElement->SetBackgroundColor(_Colorf((float)bgColor.GetRed() / 255.0f, (float)bgColor.GetGreen() / 255.0f, (float)bgColor.GetBlue() / 255.0f, (float)bgColor.GetAlpha() / 255.0f));
2240 if (__pDrawingProperty->groupedLookEnabled == true)
2252 if (__pBitmapVisualElement != null)
2254 __pBitmapVisualElement->RemoveAllAnimations();
2255 __pBitmapVisualElement->SetAnimationProvider(null);
2256 __pBitmapVisualElement->Destroy();
2257 __pBitmapVisualElement = null;
2262 _TableViewItem::DrawGroupedLook(void)
2264 if (IsTitleStyleItem() || IsContextItem())
2270 Color outlineColor = __pDrawingProperty->dividerColor;
2272 float barWidth = 0.0f;
2274 Canvas* pCanvas = GetVisualElement()->GetCanvasN();
2275 SysTryReturnVoidResult(NID_UI_CTRL, pCanvas != null, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
2277 FloatRectangle bounds = GetBoundsF();
2278 pCanvas->SetBackgroundColor(GetBackgroundColor());
2281 GET_COLOR_CONFIG(TABLEVIEW::GROUPITEM_BAR_NORMAL, barColor);
2282 GET_SHAPE_CONFIG(TABLEVIEW::GROUPITEM_BAR_WIDTH, _CONTROL_ORIENTATION_PORTRAIT, barWidth);
2284 pCanvas->FillRectangle(barColor, FloatRectangle(0.0f, 0.0f, barWidth, bounds.height));
2286 if (__pDrawingProperty->sectionStyleEnabled == true)
2288 pCanvas->FillRectangle(outlineColor, FloatRectangle(bounds.width - 1.0f, 0.0f, 1.0f, bounds.height));
2290 if (__itemType == TABLE_VIEW_ITEM_TYPE_TOP || __itemType == TABLE_VIEW_ITEM_TYPE_ONE)
2292 pCanvas->FillRectangle(outlineColor, FloatRectangle(0.0f, 0.0f, bounds.width, 1.0f));
2300 _TableViewItem::DrawSectionStyleBackground(void)
2302 Canvas* pCanvas = null;
2303 Bitmap* pReplacementSectionPressBg = null;
2304 Bitmap* pReplacementSectionBg = null;
2305 Bitmap* pReplacementSectionDisabledBg = null;
2306 Color bgColor = __colorItemBg[__drawingStatus];
2307 FloatRectangle bounds = GetBoundsF();
2308 float dividerHeight = 0.0f;
2310 result r = E_SUCCESS;
2312 pCanvas = GetVisualElement()->GetCanvasN();
2313 SysTryReturnVoidResult(NID_UI_CTRL, pCanvas != null, GetLastResult(), "[%s] Propagating.", GetErrorMessage(r));
2315 pCanvas->SetBackgroundColor(Color(0, 0, 0, 0));
2318 if (bgColor != null)
2320 if (__itemType == TABLE_VIEW_ITEM_TYPE_ONE)
2322 r = GET_REPLACED_BITMAP_CONFIG_N(TABLEVIEW::SECTIONITEM_SINGLE_BG_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, bgColor, pReplacementSectionBg);
2324 else if (__itemType == TABLE_VIEW_ITEM_TYPE_TOP)
2326 r = GET_REPLACED_BITMAP_CONFIG_N(TABLEVIEW::SECTIONITEM_TOP_BG_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, bgColor, pReplacementSectionBg);
2328 else if (__itemType == TABLE_VIEW_ITEM_TYPE_MIDDLE)
2330 r = GET_REPLACED_BITMAP_CONFIG_N(TABLEVIEW::SECTIONITEM_CENTER_BG_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, bgColor, pReplacementSectionBg);
2332 else if (__itemType == TABLE_VIEW_ITEM_TYPE_BOTTOM)
2334 r = GET_REPLACED_BITMAP_CONFIG_N(TABLEVIEW::SECTIONITEM_BOTTOM_BG_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, bgColor, pReplacementSectionBg);
2343 if (__itemType == TABLE_VIEW_ITEM_TYPE_ONE)
2345 r = GET_REPLACED_BITMAP_CONFIG_N(TABLEVIEW::SECTIONITEM_SINGLE_BG_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, __pDrawingProperty->sectionStyleBgColor, pReplacementSectionBg);
2347 else if (__itemType == TABLE_VIEW_ITEM_TYPE_TOP)
2349 r = GET_REPLACED_BITMAP_CONFIG_N(TABLEVIEW::SECTIONITEM_TOP_BG_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, __pDrawingProperty->sectionStyleBgColor, pReplacementSectionBg);
2351 else if (__itemType == TABLE_VIEW_ITEM_TYPE_MIDDLE)
2353 r = GET_REPLACED_BITMAP_CONFIG_N(TABLEVIEW::SECTIONITEM_CENTER_BG_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, __pDrawingProperty->sectionStyleBgColor, pReplacementSectionBg);
2355 else if (__itemType == TABLE_VIEW_ITEM_TYPE_BOTTOM)
2357 r = GET_REPLACED_BITMAP_CONFIG_N(TABLEVIEW::SECTIONITEM_BOTTOM_BG_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, __pDrawingProperty->sectionStyleBgColor, pReplacementSectionBg);
2364 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , E_SYSTEM, "[%s] A system error has been occurred. SectionStyle image load failed", GetErrorMessage(E_SYSTEM));
2368 if (__drawingStatus == TABLE_VIEW_ITEM_DRAWING_STATUS_PRESSED || __drawingStatus == TABLE_VIEW_ITEM_DRAWING_STATUS_HIGHLIGHTED)
2370 if (__itemType == TABLE_VIEW_ITEM_TYPE_ONE)
2372 if (IS_CUSTOM_BITMAP(TABLEVIEW::SECTIONITEM_SINGLE_BG_PRESSED))
2374 r = GET_REPLACED_BITMAP_CONFIG_N(TABLEVIEW::SECTIONITEM_SINGLE_BG_PRESSED, BITMAP_PIXEL_FORMAT_ARGB8888, bgColor, pReplacementSectionPressBg);
2375 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , E_SYSTEM, "[%s] A system error has been occurred. SectionStyle image load failed", GetErrorMessage(E_SYSTEM));
2378 else if (__itemType == TABLE_VIEW_ITEM_TYPE_TOP)
2380 if (IS_CUSTOM_BITMAP(TABLEVIEW::SECTIONITEM_TOP_BG_PRESSED))
2382 r = GET_REPLACED_BITMAP_CONFIG_N(TABLEVIEW::SECTIONITEM_TOP_BG_PRESSED, BITMAP_PIXEL_FORMAT_ARGB8888, bgColor, pReplacementSectionPressBg);
2383 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , E_SYSTEM, "[%s] A system error has been occurred. SectionStyle image load failed", GetErrorMessage(E_SYSTEM));
2386 else if (__itemType == TABLE_VIEW_ITEM_TYPE_MIDDLE)
2388 if (IS_CUSTOM_BITMAP(TABLEVIEW::SECTIONITEM_CENTER_BG_PRESSED))
2390 r = GET_REPLACED_BITMAP_CONFIG_N(TABLEVIEW::SECTIONITEM_CENTER_BG_PRESSED, BITMAP_PIXEL_FORMAT_ARGB8888, bgColor, pReplacementSectionPressBg);
2391 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , E_SYSTEM, "[%s] A system error has been occurred. SectionStyle image load failed", GetErrorMessage(E_SYSTEM));
2394 else if (__itemType == TABLE_VIEW_ITEM_TYPE_BOTTOM)
2396 if (IS_CUSTOM_BITMAP(TABLEVIEW::SECTIONITEM_BOTTOM_BG_PRESSED))
2398 r = GET_REPLACED_BITMAP_CONFIG_N(TABLEVIEW::SECTIONITEM_BOTTOM_BG_PRESSED, BITMAP_PIXEL_FORMAT_ARGB8888, bgColor, pReplacementSectionPressBg);
2399 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , E_SYSTEM, "[%s] A system error has been occurred. SectionStyle image load failed", GetErrorMessage(E_SYSTEM));
2403 GET_FIXED_VALUE_CONFIG(TABLEVIEW::ITEM_DIVIDER_HEIGHT, _CONTROL_ORIENTATION_PORTRAIT, dividerHeight);
2405 if (pReplacementSectionPressBg)
2407 DrawBitmap(*pCanvas, FloatRectangle(0.0f, dividerHeight, bounds.width, bounds.height - (dividerHeight * 2)), *pReplacementSectionPressBg);
2411 DrawBitmap(*pCanvas, FloatRectangle(0.0f, dividerHeight, bounds.width, bounds.height - (dividerHeight * 2)), *pReplacementSectionBg);
2416 DrawBitmap(*pCanvas, FloatRectangle(0.0f, 0.0f, bounds.width, bounds.height), *pReplacementSectionBg);
2421 GET_COLOR_CONFIG(TABLEVIEW::ITEM_BG_DISABLED, bgColor);
2423 if (__itemType == TABLE_VIEW_ITEM_TYPE_ONE)
2425 if (IS_CUSTOM_BITMAP(TABLEVIEW::SECTIONITEM_SINGLE_BG_DISABLED))
2427 r = GET_REPLACED_BITMAP_CONFIG_N(TABLEVIEW::SECTIONITEM_SINGLE_BG_DISABLED, BITMAP_PIXEL_FORMAT_ARGB8888, bgColor, pReplacementSectionDisabledBg);
2428 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , E_SYSTEM, "[%s] A system error has been occurred. SectionStyle image load failed", GetErrorMessage(E_SYSTEM));
2431 else if (__itemType == TABLE_VIEW_ITEM_TYPE_TOP)
2433 if (IS_CUSTOM_BITMAP(TABLEVIEW::SECTIONITEM_TOP_BG_DISABLED))
2435 r = GET_REPLACED_BITMAP_CONFIG_N(TABLEVIEW::SECTIONITEM_TOP_BG_DISABLED, BITMAP_PIXEL_FORMAT_ARGB8888, bgColor, pReplacementSectionDisabledBg);
2436 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , E_SYSTEM, "[%s] A system error has been occurred. SectionStyle image load failed", GetErrorMessage(E_SYSTEM));
2439 else if (__itemType == TABLE_VIEW_ITEM_TYPE_MIDDLE)
2441 if (IS_CUSTOM_BITMAP(TABLEVIEW::SECTIONITEM_CENTER_BG_DISABLED))
2443 r = GET_REPLACED_BITMAP_CONFIG_N(TABLEVIEW::SECTIONITEM_CENTER_BG_DISABLED, BITMAP_PIXEL_FORMAT_ARGB8888, bgColor, pReplacementSectionDisabledBg);
2444 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , E_SYSTEM, "[%s] A system error has been occurred. SectionStyle image load failed", GetErrorMessage(E_SYSTEM));
2447 else if (__itemType == TABLE_VIEW_ITEM_TYPE_BOTTOM)
2449 if (IS_CUSTOM_BITMAP(TABLEVIEW::SECTIONITEM_BOTTOM_BG_DISABLED))
2451 r = GET_REPLACED_BITMAP_CONFIG_N(TABLEVIEW::SECTIONITEM_BOTTOM_BG_DISABLED, BITMAP_PIXEL_FORMAT_ARGB8888, bgColor, pReplacementSectionDisabledBg);
2452 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , E_SYSTEM, "[%s] A system error has been occurred. SectionStyle image load failed", GetErrorMessage(E_SYSTEM));
2456 if (pReplacementSectionDisabledBg)
2458 DrawBitmap(*pCanvas, FloatRectangle(0.0f, 0.0f, bounds.width, bounds.height), *pReplacementSectionDisabledBg);
2462 DrawBitmap(*pCanvas, FloatRectangle(0.0f, 0.0f, bounds.width, bounds.height), *pReplacementSectionBg);
2466 if (__pDrawingProperty->groupedLookEnabled == true)
2470 float barWidth = 0.0f;
2471 float barMargin = 0.0f;
2473 GET_COLOR_CONFIG(TABLEVIEW::GROUPITEM_BAR_NORMAL, barColor);
2474 GET_SHAPE_CONFIG(TABLEVIEW::GROUPITEM_BAR_WIDTH, _CONTROL_ORIENTATION_PORTRAIT, barWidth);
2475 GET_SHAPE_CONFIG(TABLEVIEW::GROUPITEM_BAR_TOP_MARGIN, _CONTROL_ORIENTATION_PORTRAIT, barMargin);
2477 pCanvas->FillRectangle(barColor, FloatRectangle(0.0f, barMargin, barWidth, bounds.height-barMargin));
2481 delete pReplacementSectionPressBg;
2482 delete pReplacementSectionBg;
2483 delete pReplacementSectionDisabledBg;
2488 _TableViewItem::DrawSectionStyleBackgroundCover(void)
2490 if (!__pDrawingProperty->sectionStyleEnabled ||
2491 __pItemCover == null)
2496 Bitmap* pReplacementSectionBgEf = null;
2497 Bitmap* pReplacementSectionBg = null;
2498 Bitmap* pMergeBitmap = null;
2499 Canvas* pCanvas = null;
2502 result r = E_SUCCESS;
2503 FloatRectangle bounds = GetBoundsF();
2507 _TableView* pParent = dynamic_cast<_TableView*>(GetParent());
2508 SysTryCatch(NID_UI_CTRL, pParent != null, , E_SYSTEM, "[%s] A system error has been occurred. SectionTableView load failed", GetErrorMessage(E_SYSTEM));
2510 bgColor = pParent->GetBackgroundColor();
2514 GET_COLOR_CONFIG(TABLEVIEW::ITEM_BG_DISABLED, bgColor);
2517 if (__itemType == TABLE_VIEW_ITEM_TYPE_ONE)
2519 r = GET_REPLACED_BITMAP_CONFIG_N(TABLEVIEW::SECTIONITEM_SINGLE_COVER_BG_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, bgColor, pReplacementSectionBgEf);
2521 else if (__itemType == TABLE_VIEW_ITEM_TYPE_TOP)
2523 r = GET_REPLACED_BITMAP_CONFIG_N(TABLEVIEW::SECTIONITEM_TOP_COVER_BG_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, bgColor, pReplacementSectionBgEf);
2525 else if (__itemType == TABLE_VIEW_ITEM_TYPE_MIDDLE)
2527 r = GET_REPLACED_BITMAP_CONFIG_N(TABLEVIEW::SECTIONITEM_CENTER_COVER_BG_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, bgColor, pReplacementSectionBgEf);
2529 else if (__itemType == TABLE_VIEW_ITEM_TYPE_BOTTOM)
2531 r = GET_REPLACED_BITMAP_CONFIG_N(TABLEVIEW::SECTIONITEM_BOTTOM_COVER_BG_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, bgColor, pReplacementSectionBgEf);
2537 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , E_SYSTEM, "[%s] A system error has been occurred. SectionStyle image load failed", GetErrorMessage(E_SYSTEM));
2539 if (__itemType == TABLE_VIEW_ITEM_TYPE_ONE)
2541 r = GET_REPLACED_BITMAP_CONFIG_N(TABLEVIEW::SECTIONITEM_SINGLE_COVER_ROUND_BG_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, bgColor, pReplacementSectionBg);
2543 else if (__itemType == TABLE_VIEW_ITEM_TYPE_TOP)
2545 r = GET_REPLACED_BITMAP_CONFIG_N(TABLEVIEW::SECTIONITEM_TOP_COVER_ROUND_BG_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, bgColor, pReplacementSectionBg);
2547 else if (__itemType == TABLE_VIEW_ITEM_TYPE_MIDDLE)
2549 r = GET_REPLACED_BITMAP_CONFIG_N(TABLEVIEW::SECTIONITEM_CENTER_COVER_ROUND_BG_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, bgColor, pReplacementSectionBg);
2551 else if (__itemType == TABLE_VIEW_ITEM_TYPE_BOTTOM)
2553 r = GET_REPLACED_BITMAP_CONFIG_N(TABLEVIEW::SECTIONITEM_BOTTOM_COVER_ROUND_BG_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, bgColor, pReplacementSectionBg);
2559 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , E_SYSTEM, "[%s] A system error has been occurred. SectionStyle image load failed", GetErrorMessage(E_SYSTEM));
2561 __pItemCover->SetBounds(FloatRectangle(0.0f, 0.0f, bounds.width, bounds.height));
2563 pCanvas = new (std::nothrow) Canvas();
2564 SysTryCatch(NID_UI_CTRL, pCanvas != null, , E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
2565 pCanvas->Construct(FloatRectangle(0.0f, 0.0f, bounds.width, bounds.height));
2566 pCanvas->SetBackgroundColor(Color(0, 0, 0, 0));
2569 DrawBitmap(*pCanvas, FloatRectangle(0.0f, 0.0f, bounds.width, bounds.height), *pReplacementSectionBg);
2570 DrawBitmap(*pCanvas, FloatRectangle(0.0f, 0.0f, bounds.width, bounds.height), *pReplacementSectionBgEf);
2572 pMergeBitmap = new (std::nothrow) Bitmap();
2573 SysTryCatch(NID_UI_CTRL, pMergeBitmap != null, , E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
2575 pMergeBitmap->Construct(*pCanvas, FloatRectangle(0.0f, 0.0f, bounds.width, bounds.height));
2577 _BitmapImpl::ConvertToNonpremultiplied(*pMergeBitmap, true);
2579 __pItemCover->SetBackgroundBitmap(*pMergeBitmap);
2582 delete pReplacementSectionBgEf;
2583 delete pReplacementSectionBg;
2585 delete pMergeBitmap;
2589 _TableViewItem::DrawContextItemBackground(void)
2591 Canvas* pCanvas = null;
2592 Bitmap* pContextBgEf = null;
2593 Bitmap* pReplacementContextBg = null;
2594 Color bgColor = __colorItemBg[__drawingStatus];
2596 FloatRectangle bounds = GetBoundsF();
2597 result r = E_SUCCESS;
2601 if (bgColor == null)
2603 GET_COLOR_CONFIG(TABLEVIEW::CONTEXTITEM_BG_NORMAL, bgColor);
2608 GET_COLOR_CONFIG(TABLEVIEW::ITEM_BG_DISABLED, bgColor);
2611 r = GET_REPLACED_BITMAP_CONFIG_N(TABLEVIEW::QUICK_MENU_BG_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, bgColor, pReplacementContextBg);
2612 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , E_SYSTEM, "[%s] A system error has been occurred. ContextItem image load failed", GetErrorMessage(E_SYSTEM));
2614 r = GET_BITMAP_CONFIG_N(TABLEVIEW::QUICK_MENU_BG_EFFECT, BITMAP_PIXEL_FORMAT_ARGB8888, pContextBgEf);
2615 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , E_SYSTEM, "[%s] A system error has been occurred. ContextItem image load failed", GetErrorMessage(E_SYSTEM));
2617 pCanvas = GetVisualElement()->GetCanvasN();
2618 SysTryCatch(NID_UI_CTRL, pCanvas != null, , E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
2620 pCanvas->SetBackgroundColor(Color(0, 0, 0, 0));
2623 DrawBitmap(*pCanvas, FloatRectangle(0.0f, 0.0f, bounds.width, bounds.height), *pReplacementContextBg);
2624 DrawBitmap(*pCanvas, FloatRectangle(0.0f, 0.0f, bounds.width, bounds.height), *pContextBgEf);
2628 delete pContextBgEf;
2629 delete pReplacementContextBg;
2634 _TableViewItem::CreateAnnexStyle(void)
2636 switch (__annexStyle)
2638 case TABLE_VIEW_ANNEX_STYLE_MARK:
2641 case TABLE_VIEW_ANNEX_STYLE_RADIO:
2644 case TABLE_VIEW_ANNEX_STYLE_ONOFF_SLIDING:
2645 CreateOnOffButton();
2647 case TABLE_VIEW_ANNEX_STYLE_ONOFF_SLIDING_WITH_DIVIDER:
2648 CreateItemAnnexDivider();
2649 CreateOnOffButton();
2651 case TABLE_VIEW_ANNEX_STYLE_DETAILED:
2652 CreateDetailButton();
2660 _TableViewItem::DrawAnnexStyle(void)
2662 switch (__annexStyle)
2664 case TABLE_VIEW_ANNEX_STYLE_MARK:
2667 case TABLE_VIEW_ANNEX_STYLE_RADIO:
2670 case TABLE_VIEW_ANNEX_STYLE_ONOFF_SLIDING:
2673 case TABLE_VIEW_ANNEX_STYLE_ONOFF_SLIDING_WITH_DIVIDER:
2674 DrawItemAnnexDivider();
2677 case TABLE_VIEW_ANNEX_STYLE_DETAILED:
2686 _TableViewItem::DrawCheckBox(void)
2688 Bitmap* pCheckBox = null;
2689 Bitmap* pCheckBoxBg = null;
2690 Bitmap* pMergeBitmap = null;
2691 Canvas* pCanvas = null;
2692 result r = E_SUCCESS;
2694 FloatRectangle bounds;
2695 float annexWidth = 0.0f;
2696 float annexHeight = 0.0f;
2700 if (__drawingStatus == TABLE_VIEW_ITEM_DRAWING_STATUS_NORMAL)
2702 r = GET_BITMAP_CONFIG_N(TABLEVIEW::CHECKBOX_BG_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, pCheckBoxBg);
2703 SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS) && (pCheckBoxBg != null), , E_SYSTEM, "[%s] Propagating.", GetErrorMessage(r));
2705 r = GET_BITMAP_CONFIG_N(TABLEVIEW::CHECKBOX_CHECK_MARK_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, pCheckBox);
2706 SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS) && (pCheckBox != null), , E_SYSTEM, "[%s] Propagating.", GetErrorMessage(r));
2708 else if ((__drawingStatus == TABLE_VIEW_ITEM_DRAWING_STATUS_PRESSED) || (__drawingStatus == TABLE_VIEW_ITEM_DRAWING_STATUS_HIGHLIGHTED))
2710 r = GET_BITMAP_CONFIG_N(TABLEVIEW::CHECKBOX_BG_PRESSED, BITMAP_PIXEL_FORMAT_ARGB8888, pCheckBoxBg);
2711 SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS) && (pCheckBoxBg != null), , E_SYSTEM, "[%s] Propagating.", GetErrorMessage(r));
2713 r = GET_BITMAP_CONFIG_N(TABLEVIEW::CHECKBOX_CHECK_MARK_PRESSED, BITMAP_PIXEL_FORMAT_ARGB8888, pCheckBox);
2714 SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS) && (pCheckBox != null), , E_SYSTEM, "[%s] Propagating.", GetErrorMessage(r));
2720 r = GET_BITMAP_CONFIG_N(TABLEVIEW::CHECKBOX_BG_DISABLED, BITMAP_PIXEL_FORMAT_ARGB8888, pCheckBoxBg);
2721 SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS) && (pCheckBoxBg != null), , E_SYSTEM, "[%s] Propagating.", GetErrorMessage(r));
2723 r = GET_BITMAP_CONFIG_N(TABLEVIEW::CHECKBOX_CHECK_MARK_DISABLED, BITMAP_PIXEL_FORMAT_ARGB8888, pCheckBox);
2724 SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS) && (pCheckBox != null), , E_SYSTEM, "[%s] Propagating.", GetErrorMessage(r));
2727 GET_SHAPE_CONFIG(TABLEVIEW::ITEM_ANNEX_WIDTH, _CONTROL_ORIENTATION_PORTRAIT, annexWidth);
2728 GET_SHAPE_CONFIG(TABLEVIEW::ITEM_ANNEX_HEIGHT, _CONTROL_ORIENTATION_PORTRAIT, annexHeight);
2730 bounds.SetBounds(0.0f, 0.0f, annexWidth, annexHeight);
2732 pCanvas = new (std::nothrow) Canvas();
2733 SysTryCatch(NID_UI_CTRL, pCanvas != null, , E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
2735 pCanvas->Construct(bounds);
2736 pCanvas->SetBackgroundColor(Color(0, 0, 0, 0));
2739 DrawBitmap(*pCanvas, CalculateAnnexBitmapBounds(annexWidth, annexHeight, *pCheckBoxBg), *pCheckBoxBg);
2741 if (__isCheckedAnimationEnabled == true)
2743 StartCheckBoxAnimation();
2747 if (IsChecked() == true && pCheckBox != null)
2749 DrawBitmap(*pCanvas, CalculateAnnexBitmapBounds(annexWidth, annexHeight, *pCheckBox), *pCheckBox);
2753 pMergeBitmap = new (std::nothrow) Bitmap();
2754 SysTryCatch(NID_UI_CTRL, pMergeBitmap != null, , E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
2756 pMergeBitmap->Construct(*pCanvas, bounds);
2757 _BitmapImpl::ConvertToNonpremultiplied(*pMergeBitmap, true);
2759 __pItemAnnex->SetBackgroundBitmap(*pMergeBitmap);
2760 __pItemAnnex->Invalidate(false);
2765 delete pMergeBitmap;
2772 _TableViewItem::DrawRadioBox(void)
2774 Bitmap* pRadioButton = null;
2775 Bitmap* pRadioButtonBg = null;
2776 Bitmap* pMergeBitmap = null;
2777 Canvas* pCanvas = null;
2778 result r = E_SUCCESS;
2780 FloatRectangle bounds;
2781 float annexWidth = 0.0f;
2782 float annexHeight = 0.0f;
2786 if (__drawingStatus == TABLE_VIEW_ITEM_DRAWING_STATUS_NORMAL)
2788 r = GET_BITMAP_CONFIG_N(TABLEVIEW::RADIOBUTTON_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, pRadioButtonBg);
2789 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));
2791 r = GET_BITMAP_CONFIG_N(TABLEVIEW::RADIOBUTTON_BUTTON_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, pRadioButton);
2792 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));
2794 else if ((__drawingStatus == TABLE_VIEW_ITEM_DRAWING_STATUS_PRESSED) || (__drawingStatus == TABLE_VIEW_ITEM_DRAWING_STATUS_HIGHLIGHTED))
2796 r = GET_BITMAP_CONFIG_N(TABLEVIEW::RADIOBUTTON_PRESSED, BITMAP_PIXEL_FORMAT_ARGB8888, pRadioButtonBg);
2797 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));
2800 r = GET_BITMAP_CONFIG_N(TABLEVIEW::RADIOBUTTON_BUTTON_PRESSED, BITMAP_PIXEL_FORMAT_ARGB8888, pRadioButton);
2801 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));
2806 r = GET_BITMAP_CONFIG_N(TABLEVIEW::RADIOBUTTON_NORMAL_DISABLED, BITMAP_PIXEL_FORMAT_ARGB8888, pRadioButtonBg);
2807 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));
2809 r = GET_BITMAP_CONFIG_N(TABLEVIEW::RADIOBUTTON_BUTTON_DISABLED, BITMAP_PIXEL_FORMAT_ARGB8888, pRadioButton);
2810 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));
2813 GET_SHAPE_CONFIG(TABLEVIEW::ITEM_ANNEX_WIDTH, _CONTROL_ORIENTATION_PORTRAIT, annexWidth);
2814 GET_SHAPE_CONFIG(TABLEVIEW::ITEM_ANNEX_HEIGHT, _CONTROL_ORIENTATION_PORTRAIT, annexHeight);
2815 bounds.SetBounds(0.0f, 0.0f, annexWidth, annexHeight);
2817 pCanvas = new (std::nothrow) Canvas();
2818 SysTryCatch(NID_UI_CTRL, pCanvas != null, , E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
2820 pCanvas->Construct(bounds);
2821 pCanvas->SetBackgroundColor(Color(0, 0, 0, 0));
2824 DrawBitmap(*pCanvas, CalculateAnnexBitmapBounds(annexWidth, annexHeight, *pRadioButtonBg), *pRadioButtonBg);
2826 if (pRadioButton != null && IsChecked() == true)
2828 DrawBitmap(*pCanvas, CalculateAnnexBitmapBounds(annexWidth, annexHeight, *pRadioButton), *pRadioButton);
2831 pMergeBitmap = new (std::nothrow) Bitmap();
2832 SysTryCatch(NID_UI_CTRL, pMergeBitmap != null, , E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
2834 pMergeBitmap->Construct(*pCanvas, bounds);
2835 _BitmapImpl::ConvertToNonpremultiplied(*pMergeBitmap, true);
2837 __pItemAnnex->SetBackgroundBitmap(*pMergeBitmap);
2838 __pItemAnnex->Invalidate(false);
2841 delete pRadioButton;
2842 delete pRadioButtonBg;
2843 delete pMergeBitmap;
2850 _TableViewItem::DrawOnOffButton(void)
2852 Bitmap* pOnOffButton = null;
2853 Bitmap* pOnOffButtonHandler = null;
2854 Bitmap* pMergeBitmap = null;
2855 Canvas* pCanvas = null;
2856 result r = E_SUCCESS;
2858 FloatRectangle bounds;
2859 FloatRectangle backgroundBounds;
2860 FloatRectangle handlerBounds;
2861 float annexWidth = 0.0f;
2862 float annexHeight = 0.0f;
2863 float annexMargin = 0.0f;
2865 if (IsChecked() == true)
2869 r = GET_BITMAP_CONFIG_N(TABLEVIEW::ONOFFBUTTON_ON_HANDLER, BITMAP_PIXEL_FORMAT_ARGB8888, pOnOffButtonHandler);
2873 r = GET_BITMAP_CONFIG_N(TABLEVIEW::ONOFFBUTTON_ON_HANDLER_DISABLED, BITMAP_PIXEL_FORMAT_ARGB8888, pOnOffButtonHandler);
2880 r = GET_BITMAP_CONFIG_N(TABLEVIEW::ONOFFBUTTON_OFF_HANDLER, BITMAP_PIXEL_FORMAT_ARGB8888, pOnOffButtonHandler);
2884 r = GET_BITMAP_CONFIG_N(TABLEVIEW::ONOFFBUTTON_OFF_HANDLER_DISABLED, BITMAP_PIXEL_FORMAT_ARGB8888, pOnOffButtonHandler);
2887 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));
2891 r = GET_BITMAP_CONFIG_N(TABLEVIEW::ONOFFBUTTON_BG, BITMAP_PIXEL_FORMAT_ARGB8888, pOnOffButton);
2895 r = GET_BITMAP_CONFIG_N(TABLEVIEW::ONOFFBUTTON_BG_DISABLED, BITMAP_PIXEL_FORMAT_ARGB8888, pOnOffButton);
2897 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));
2899 GET_SHAPE_CONFIG(TABLEVIEW::ITEM_ANNEX_ONOFF_WIDTH, _CONTROL_ORIENTATION_PORTRAIT, annexWidth);
2900 GET_SHAPE_CONFIG(TABLEVIEW::ITEM_ANNEX_ONOFF_HEIGHT, _CONTROL_ORIENTATION_PORTRAIT, annexHeight);
2901 bounds.SetBounds(0, 0, annexWidth, annexHeight);
2903 pCanvas = new (std::nothrow) Canvas();
2904 SysTryCatch(NID_UI_CTRL, pCanvas != null, , E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
2906 pCanvas->Construct(bounds);
2907 pCanvas->SetBackgroundColor(Color(0, 0, 0, 0));
2910 backgroundBounds = CalculateAnnexBitmapBounds(annexWidth, annexHeight, *pOnOffButton);
2911 DrawBitmap(*pCanvas, backgroundBounds, *pOnOffButton);
2913 handlerBounds = CalculateAnnexBitmapBounds(annexWidth, annexHeight, *pOnOffButtonHandler);
2914 GET_SHAPE_CONFIG(TABLEVIEW::ITEM_ANNEX_ONOFF_MARGIN, _CONTROL_ORIENTATION_PORTRAIT, annexMargin);
2915 if (IsChecked() == true)
2917 handlerBounds.x = backgroundBounds.width - handlerBounds.width - annexMargin;
2921 handlerBounds.x = backgroundBounds.x + annexMargin;
2924 DrawBitmap(*pCanvas, handlerBounds, *pOnOffButtonHandler);
2926 pMergeBitmap = new (std::nothrow) Bitmap();
2927 SysTryCatch(NID_UI_CTRL, pMergeBitmap != null, , E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
2929 pMergeBitmap->Construct(*pCanvas, bounds);
2930 _BitmapImpl::ConvertToNonpremultiplied(*pMergeBitmap, true);
2932 __pItemAnnex->SetBackgroundBitmap(*pMergeBitmap);
2933 __pItemAnnex->Invalidate(false);
2936 delete pOnOffButton;
2937 delete pOnOffButtonHandler;
2938 delete pMergeBitmap;
2945 _TableViewItem::AdjustAnnexOnOffHandlerPosition()
2947 float annexWidth = 0.0f;
2948 float annexHeight = 0.0f;
2949 float annexMargin = 0.0f;
2951 float annexStartPositionX = 0.0f;
2952 float annexEndPositionX = 0.0f;
2953 float handlerPositionX = 0.0f;
2954 FloatRectangle handlerBounds;
2955 result r = E_SUCCESS;
2957 GET_SHAPE_CONFIG(TABLEVIEW::ITEM_ANNEX_ONOFF_MARGIN, _CONTROL_ORIENTATION_PORTRAIT, annexMargin);
2959 Bitmap* pOnOffButtonHandler = null;
2960 if (IsChecked() == true)
2962 r = GET_BITMAP_CONFIG_N(TABLEVIEW::ONOFFBUTTON_ON_HANDLER, BITMAP_PIXEL_FORMAT_ARGB8888, pOnOffButtonHandler);
2966 r = GET_BITMAP_CONFIG_N(TABLEVIEW::ONOFFBUTTON_OFF_HANDLER, BITMAP_PIXEL_FORMAT_ARGB8888, pOnOffButtonHandler);
2968 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));
2970 GET_SHAPE_CONFIG(TABLEVIEW::ITEM_ANNEX_ONOFF_WIDTH, _CONTROL_ORIENTATION_PORTRAIT, annexWidth);
2971 GET_SHAPE_CONFIG(TABLEVIEW::ITEM_ANNEX_ONOFF_HEIGHT, _CONTROL_ORIENTATION_PORTRAIT, annexHeight);
2973 annexStartPositionX = __pItemAnnex->GetBoundsF().x;
2974 annexEndPositionX = annexStartPositionX + annexWidth + annexMargin;
2976 handlerBounds = CalculateAnnexBitmapBounds(annexWidth, annexHeight, *pOnOffButtonHandler);
2978 if (__annexOnOffHandlerMoved)
2980 if (annexStartPositionX <= __annexOnOffHandlerPositionX
2981 && annexEndPositionX >= __annexOnOffHandlerPositionX)
2983 if (((annexEndPositionX - annexStartPositionX) / 2) < (__annexOnOffHandlerPositionX + (handlerBounds.width / 2)) - annexStartPositionX)
2985 handlerPositionX = annexEndPositionX;
2990 handlerPositionX = annexStartPositionX;
2997 SetChecked(!IsChecked());
3000 handlerPositionX = annexEndPositionX;
3004 handlerPositionX = annexStartPositionX;
3008 DrawAnnexOnOffHandler(handlerPositionX);
3010 delete pOnOffButtonHandler;
3016 _TableViewItem::DrawAnnexOnOffHandler(float touchEndPosition)
3018 if (__pItemAnnex == null)
3023 Bitmap* pOnOffButton = null;
3024 Bitmap* pOnOffButtonHandler = null;
3025 Bitmap* pMergeBitmap = null;
3026 Canvas* pCanvas = null;
3027 result r = E_SUCCESS;
3029 FloatRectangle backgroundBounds;
3030 FloatRectangle handlerBounds;
3031 float annexWidth = 0.0f;
3032 float annexHeight = 0.0f;
3033 float annexMargin = 0.0f;
3034 float annexX = 0.0f;
3035 float nextHandlerX = 0.0f;
3037 r = GET_BITMAP_CONFIG_N(TABLEVIEW::ONOFFBUTTON_BG, BITMAP_PIXEL_FORMAT_ARGB8888, pOnOffButton);
3038 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));
3040 if (IsChecked() == true)
3042 r = GET_BITMAP_CONFIG_N(TABLEVIEW::ONOFFBUTTON_ON_HANDLER, BITMAP_PIXEL_FORMAT_ARGB8888, pOnOffButtonHandler);
3046 r = GET_BITMAP_CONFIG_N(TABLEVIEW::ONOFFBUTTON_OFF_HANDLER, BITMAP_PIXEL_FORMAT_ARGB8888, pOnOffButtonHandler);
3048 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));
3050 GET_SHAPE_CONFIG(TABLEVIEW::ITEM_ANNEX_ONOFF_WIDTH, _CONTROL_ORIENTATION_PORTRAIT, annexWidth);
3051 GET_SHAPE_CONFIG(TABLEVIEW::ITEM_ANNEX_ONOFF_HEIGHT, _CONTROL_ORIENTATION_PORTRAIT, annexHeight);
3052 GET_SHAPE_CONFIG(TABLEVIEW::ITEM_ANNEX_ONOFF_MARGIN, _CONTROL_ORIENTATION_PORTRAIT, annexMargin);
3054 pCanvas = new (std::nothrow) Canvas();
3055 SysTryCatch(NID_UI_CTRL, pCanvas != null, , E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
3057 pCanvas->Construct(FloatRectangle(0, 0, annexWidth, annexHeight));
3058 pCanvas->SetBackgroundColor(Color(0, 0, 0, 0));
3061 backgroundBounds = CalculateAnnexBitmapBounds(annexWidth, annexHeight, *pOnOffButton);
3062 DrawBitmap(*pCanvas, backgroundBounds, *pOnOffButton);
3064 handlerBounds = CalculateAnnexBitmapBounds(annexWidth, annexHeight, *pOnOffButtonHandler);
3065 handlerBounds.y = backgroundBounds.y;
3069 handlerBounds.x = backgroundBounds.width - handlerBounds.width - annexMargin;
3073 handlerBounds.x = backgroundBounds.x + annexMargin;
3076 nextHandlerX = handlerBounds.x + (touchEndPosition - __annexTouchStartPosition);
3077 annexX = __pItemAnnex->GetBoundsF().x;
3079 if ((annexX + nextHandlerX + handlerBounds.width) < (annexX + annexWidth + annexMargin)
3080 && (annexX + nextHandlerX) > annexX)
3082 handlerBounds.x = nextHandlerX;
3084 else if (_FloatCompareGE((annexX + nextHandlerX + handlerBounds.width), (annexX + annexWidth + annexMargin)))
3086 handlerBounds.x = backgroundBounds.width - handlerBounds.width - annexMargin;
3088 else if (_FloatCompareLE((annexX + nextHandlerX), annexX))
3090 handlerBounds.x = backgroundBounds.x + annexMargin;
3093 __annexOnOffHandlerPositionX = annexX + handlerBounds.x;
3094 DrawBitmap(*pCanvas, handlerBounds, *pOnOffButtonHandler);
3096 pMergeBitmap = new (std::nothrow) Bitmap();
3097 SysTryCatch(NID_UI_CTRL, pMergeBitmap != null, , E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
3099 pMergeBitmap->Construct(*pCanvas, FloatRectangle(0, 0, annexWidth, annexHeight));
3100 _BitmapImpl::ConvertToNonpremultiplied(*pMergeBitmap, true);
3102 __pItemAnnex->SetBackgroundBitmap(*pMergeBitmap);
3103 __pItemAnnex->Invalidate(false);
3106 delete pOnOffButton;
3107 delete pOnOffButtonHandler;
3108 delete pMergeBitmap;
3115 _TableViewItem::DrawDetailButton(void)
3117 Bitmap* pDetailBgEffect = null;
3118 Bitmap* pDetailEffect = null;
3119 Bitmap* pReplacementDetail = null;
3120 Bitmap* pReplacementDetailBg = null;
3121 Bitmap* pMergeBitmap = null;
3122 Canvas* pCanvas = null;
3123 Color replacementNewColor;
3124 Color replacementNewBgColor;
3125 result r = E_SUCCESS;
3127 FloatRectangle bounds;
3128 float annexWidth = 0.0f;
3129 float annexHeight = 0.0f;
3130 bool themeBackgroundBitmap = false;
3132 themeBackgroundBitmap = IS_CUSTOM_BITMAP(TABLEVIEW::CIRCLE_BUTTON_BG_NORMAL);
3136 if (__isSelectedDetailButton)
3138 if (!themeBackgroundBitmap)
3140 r = GET_BITMAP_CONFIG_N(TABLEVIEW::CIRCLE_BUTTON_BG_PRESSED, BITMAP_PIXEL_FORMAT_ARGB8888, pDetailBgEffect);
3141 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));
3143 r = GET_BITMAP_CONFIG_N(TABLEVIEW::CIRCLE_BUTTON_REVEAL_EFFECT, BITMAP_PIXEL_FORMAT_ARGB8888, pDetailEffect);
3144 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));
3147 GET_COLOR_CONFIG(TABLEVIEW::ITEM_ANNEX_DETAIL_PRESSED, replacementNewColor);
3149 r = GET_REPLACED_BITMAP_CONFIG_N(TABLEVIEW::CIRCLE_BUTTON_REVEAL_PRESSED, BITMAP_PIXEL_FORMAT_ARGB8888, replacementNewColor, pReplacementDetail);
3150 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));
3152 GET_COLOR_CONFIG(TABLEVIEW::ITEM_ANNEX_DETAIL_BG_PRESSED, replacementNewBgColor);
3156 if (!themeBackgroundBitmap)
3158 r = GET_BITMAP_CONFIG_N(TABLEVIEW::CIRCLE_BUTTON_BG_EFFECT, BITMAP_PIXEL_FORMAT_ARGB8888, pDetailBgEffect);
3159 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));
3161 r = GET_BITMAP_CONFIG_N(TABLEVIEW::CIRCLE_BUTTON_REVEAL_EFFECT, BITMAP_PIXEL_FORMAT_ARGB8888, pDetailEffect);
3162 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));
3165 GET_COLOR_CONFIG(TABLEVIEW::ITEM_ANNEX_DETAIL_NORMAL, replacementNewColor);
3167 r = GET_REPLACED_BITMAP_CONFIG_N(TABLEVIEW::CIRCLE_BUTTON_REVEAL_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, replacementNewColor, pReplacementDetail);
3168 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));
3170 GET_COLOR_CONFIG(TABLEVIEW::ITEM_ANNEX_DETAIL_BG_NORMAL, replacementNewBgColor);
3175 if (!themeBackgroundBitmap)
3177 r = GET_BITMAP_CONFIG_N(TABLEVIEW::CIRCLE_BUTTON_BG_EFFECT_DISABLED, BITMAP_PIXEL_FORMAT_ARGB8888, pDetailBgEffect);
3178 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));
3180 r = GET_BITMAP_CONFIG_N(TABLEVIEW::CIRCLE_BUTTON_REVEAL_EFFECT, BITMAP_PIXEL_FORMAT_ARGB8888, pDetailEffect);
3181 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));
3184 GET_COLOR_CONFIG(TABLEVIEW::ITEM_ANNEX_DETAIL_NORMAL, replacementNewColor);
3186 r = GET_REPLACED_BITMAP_CONFIG_N(TABLEVIEW::CIRCLE_BUTTON_REVEAL_DISABLED, BITMAP_PIXEL_FORMAT_ARGB8888, replacementNewColor, pReplacementDetail);
3187 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));
3189 r = GET_REPLACED_BITMAP_CONFIG_N(TABLEVIEW::CIRCLE_BUTTON_BG_DISABLED, BITMAP_PIXEL_FORMAT_ARGB8888, replacementNewBgColor, pReplacementDetailBg);
3190 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));
3193 if (pReplacementDetailBg == null)
3195 r = GET_REPLACED_BITMAP_CONFIG_N(TABLEVIEW::CIRCLE_BUTTON_BG_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, replacementNewBgColor, pReplacementDetailBg);
3196 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));
3199 GET_SHAPE_CONFIG(TABLEVIEW::ITEM_ANNEX_MORE_WIDTH, _CONTROL_ORIENTATION_PORTRAIT, annexWidth);
3200 GET_SHAPE_CONFIG(TABLEVIEW::ITEM_ANNEX_MORE_HEIGHT, _CONTROL_ORIENTATION_PORTRAIT, annexHeight);
3202 bounds.SetBounds(0, 0, annexWidth, annexHeight);
3204 pCanvas = new (std::nothrow) Canvas();
3205 SysTryCatch(NID_UI_CTRL, pCanvas != null, , E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
3207 pCanvas->Construct(bounds);
3208 pCanvas->SetBackgroundColor(Color(0, 0, 0, 0));
3211 DrawBitmap(*pCanvas, CalculateAnnexBitmapBounds(annexWidth, annexHeight, *pReplacementDetailBg), *pReplacementDetailBg);
3212 if (pDetailBgEffect)
3214 DrawBitmap(*pCanvas, CalculateAnnexBitmapBounds(annexWidth, annexHeight, *pDetailBgEffect), *pDetailBgEffect);
3216 DrawBitmap(*pCanvas, CalculateAnnexBitmapBounds(annexWidth, annexHeight, *pReplacementDetail), *pReplacementDetail);
3219 DrawBitmap(*pCanvas, CalculateAnnexBitmapBounds(annexWidth, annexHeight, *pDetailEffect), *pDetailEffect);
3222 pMergeBitmap = new (std::nothrow) Bitmap();
3223 SysTryCatch(NID_UI_CTRL, pMergeBitmap != null, , E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
3224 pMergeBitmap->Construct(*pCanvas, bounds);
3225 _BitmapImpl::ConvertToNonpremultiplied(*pMergeBitmap, true);
3227 __pItemAnnex->SetBackgroundBitmap(*pMergeBitmap);
3228 __pItemAnnex->Invalidate(false);
3231 delete pDetailBgEffect;
3232 delete pDetailEffect;
3233 delete pReplacementDetail;
3234 delete pReplacementDetailBg;
3235 delete pMergeBitmap;
3242 _TableViewItem::DrawItemDivider(void)
3244 if (__pItemDivider == null || __pItemTopDivider == null)
3249 if (__pDrawingProperty->itemDividerEnabled == false ||
3250 __itemType == TABLE_VIEW_ITEM_TYPE_HEADER ||
3251 __itemType == TABLE_VIEW_ITEM_TYPE_FOOTER ||
3252 __itemDividerEnabled == false ||
3255 __pItemDivider->SetVisibleState(false);
3256 __pItemTopDivider->SetVisibleState(false);
3261 FloatRectangle dividerBottomBounds;
3262 FloatRectangle dividerTopBounds;
3264 Color bottomLineColor;
3265 Color customDividerColor;
3266 FloatRectangle bounds;
3267 FloatPoint bottomPoint;
3269 __pItemDivider->SetVisibleState(true);
3270 __pItemTopDivider->SetVisibleState(true);
3272 if ( __drawingStatus == TABLE_VIEW_ITEM_DRAWING_STATUS_PRESSED ||
3273 __drawingStatus == TABLE_VIEW_ITEM_DRAWING_STATUS_HIGHLIGHTED)
3275 if (__colorItemBg[TABLE_VIEW_ITEM_DRAWING_STATUS_NORMAL] != __colorItemBg[TABLE_VIEW_ITEM_DRAWING_STATUS_PRESSED])
3277 if (__itemType != TABLE_VIEW_ITEM_TYPE_TITLE)
3279 __pItemDivider->SetVisibleState(false);
3282 __pItemTopDivider->SetVisibleState(false);
3286 if (__itemType == TABLE_VIEW_ITEM_TYPE_TITLE)
3288 if (__pItemBgBitmap[__drawingStatus] != null)
3290 __pItemDivider->SetVisibleState(false);
3294 float lineHeight = 0.0f;
3295 float lineLeftMargin = 0.0f;
3296 float lineBottomMargin = 0.0f;
3297 bounds = GetBoundsF();
3299 if (__drawingStatus == TABLE_VIEW_ITEM_DRAWING_STATUS_NORMAL)
3301 GET_COLOR_CONFIG(TABLEVIEW::GROUPITEM_INDEX_BAR_NORMAL, bottomLineColor);
3305 GET_COLOR_CONFIG(TABLEVIEW::GROUPITEM_INDEX_BAR_PRESSED, bottomLineColor);
3308 GET_SHAPE_CONFIG(TABLEVIEW::GROUPITEM_INDEX_BAR_HEIGHT, _CONTROL_ORIENTATION_PORTRAIT, lineHeight);
3309 GET_SHAPE_CONFIG(TABLEVIEW::GROUPITEM_INDEX_BAR_LEFT_MARGIN, _CONTROL_ORIENTATION_PORTRAIT, lineLeftMargin);
3310 GET_SHAPE_CONFIG(TABLEVIEW::GROUPITEM_INDEX_BAR_BOTTOM_MARGIN, _CONTROL_ORIENTATION_PORTRAIT, lineBottomMargin);
3312 lineHeight = Tizen::Graphics::CoordinateSystem::ConvertToLogicalY(lineHeight);
3313 lineBottomMargin = Tizen::Graphics::CoordinateSystem::ConvertToLogicalY(lineBottomMargin);
3314 bottomPoint = Tizen::Graphics::CoordinateSystem::AlignToDevice(FloatPoint(lineLeftMargin, bounds.height));
3315 dividerBottomBounds = FloatRectangle(bottomPoint.x, bottomPoint.y - lineBottomMargin, bounds.width - lineLeftMargin * 2.0f, lineHeight);
3320 float lineLeftMargin = 0.0f;
3321 float lineHeight = 0.0f;
3322 bounds = GetBoundsF();
3324 if (!IsContextItem())
3326 if (!__isSimpleLastItem)
3328 if (__itemType == TABLE_VIEW_ITEM_TYPE_BOTTOM || __itemType == TABLE_VIEW_ITEM_TYPE_ONE)
3330 __pItemDivider->SetVisibleState(false);
3331 __pItemTopDivider->SetVisibleState(false);
3336 customDividerColor = __pDrawingProperty->dividerColor;
3337 GET_COLOR_CONFIG(TABLEVIEW::ITEM_DIVIDER_TOP_BG_NORMAL, topLineColor);
3338 GET_COLOR_CONFIG(TABLEVIEW::ITEM_DIVIDER_BOTTOM_BG_NORMAL, bottomLineColor);
3339 GET_FIXED_VALUE_CONFIG(TABLEVIEW::ITEM_DIVIDER_LEFT_MARGIN, _CONTROL_ORIENTATION_PORTRAIT, lineLeftMargin);
3340 GET_FIXED_VALUE_CONFIG(TABLEVIEW::ITEM_DIVIDER_HEIGHT, _CONTROL_ORIENTATION_PORTRAIT, lineHeight);
3342 lineLeftMargin = Tizen::Graphics::CoordinateSystem::ConvertToLogicalX(lineLeftMargin);
3343 lineHeight = Tizen::Graphics::CoordinateSystem::ConvertToLogicalY(lineHeight);
3344 bottomPoint = Tizen::Graphics::CoordinateSystem::AlignToDevice(FloatPoint(lineLeftMargin, (bounds.height)));
3346 dividerTopBounds.SetBounds(lineLeftMargin, bottomPoint.y - (lineHeight * 2.0f), bounds.width - lineLeftMargin * 2.0f, lineHeight);
3347 dividerBottomBounds.SetBounds(lineLeftMargin, bottomPoint.y - lineHeight, bounds.width - lineLeftMargin * 2.0f, lineHeight);
3350 if (__pItemDivider->GetVisibleState())
3352 __pItemDivider->SetBounds(dividerBottomBounds);
3353 if (customDividerColor == bottomLineColor || __itemType == TABLE_VIEW_ITEM_TYPE_TITLE)
3355 __pItemDivider->SetBackgroundColor(bottomLineColor);
3359 __pItemDivider->SetBackgroundColor(customDividerColor);
3360 __pItemDivider->GetVisualElement()->SetOpacity(ITEM_BOTTOM_DIVIDER_OPACITY);
3362 __pItemDivider->Invalidate();
3365 if (__pItemTopDivider->GetVisibleState())
3367 __pItemTopDivider->SetBounds(dividerTopBounds);
3368 if (customDividerColor == bottomLineColor)
3370 __pItemTopDivider->SetBackgroundColor(topLineColor);
3374 __pItemTopDivider->SetBackgroundColor(customDividerColor);
3375 __pItemTopDivider->GetVisualElement()->SetOpacity(ITEM_TOP_DIVIDER_OPACITY);
3377 __pItemTopDivider->Invalidate();
3382 _TableViewItem::DrawItemAnnexDivider(void)
3384 if (__itemType == TABLE_VIEW_ITEM_TYPE_HEADER || __itemType == TABLE_VIEW_ITEM_TYPE_FOOTER)
3386 if (__pItemAnnexLeftDivider != null)
3388 __pItemAnnexLeftDivider->SetVisibleState(false);
3391 if (__pItemAnnexRightDivider != null)
3393 __pItemAnnexRightDivider->SetVisibleState(false);
3398 Color dividerLeftColor;
3399 Color dividerRightColor;
3400 Color customDividerColor;
3401 Color bottomLineColor;
3402 FloatRectangle bounds = GetBoundsF();
3403 float dividerHeight = 0;
3404 float itemHeight = 0;
3405 float dividerWidth = 0.0f;
3406 float dividerTopMargin = 0.0f;
3407 float annexWidth = 0.0f;
3408 float annexLeftMargin = 0.0f;
3409 float itemLeftMargin = 0.0f;
3411 customDividerColor = __pDrawingProperty->dividerColor;
3412 GET_SHAPE_CONFIG(TABLEVIEW::ITEM_LEFT_MARGIN, _CONTROL_ORIENTATION_PORTRAIT, itemLeftMargin);
3413 GET_SHAPE_CONFIG(TABLEVIEW::ITEM_ANNEX_MARGIN, _CONTROL_ORIENTATION_PORTRAIT, annexLeftMargin);
3414 GET_SHAPE_CONFIG(TABLEVIEW::ITEM_ANNEX_ONOFF_WIDTH, _CONTROL_ORIENTATION_PORTRAIT, annexWidth);
3415 GET_COLOR_CONFIG(TABLEVIEW::ITEM_ANNEX_DIVIDER_LEFT_BG_NORMAL, dividerLeftColor);
3416 GET_COLOR_CONFIG(TABLEVIEW::ITEM_ANNEX_DIVIDER_RIGHT_BG_NORMAL, dividerRightColor);
3417 GET_COLOR_CONFIG(TABLEVIEW::ITEM_DIVIDER_BOTTOM_BG_NORMAL, bottomLineColor);
3418 GET_FIXED_VALUE_CONFIG(TABLEVIEW::ITEM_ANNEX_DIVIDER_WIDTH, _CONTROL_ORIENTATION_PORTRAIT, dividerWidth);
3419 GET_FIXED_VALUE_CONFIG(TABLEVIEW::ITEM_ANNEX_DIVIDER_MARGIN, _CONTROL_ORIENTATION_PORTRAIT, dividerTopMargin);
3421 itemLeftMargin += __pDrawingProperty->scrollMargin;
3422 itemHeight = ((__customHeight > 0) ? __customHeight : GetBoundsF().height);
3423 dividerHeight = itemHeight - (dividerTopMargin*2);
3424 dividerHeight = (dividerHeight > 0) ? dividerHeight : 0;
3425 __pItemAnnexLeftDivider->SetBounds(FloatRectangle((GetBoundsF().width - annexWidth - (itemLeftMargin + annexLeftMargin) - (dividerWidth*2)), dividerTopMargin, dividerWidth, dividerHeight));
3426 __pItemAnnexRightDivider->SetBounds(FloatRectangle((GetBoundsF().width - annexWidth - (itemLeftMargin + annexLeftMargin) - dividerWidth), dividerTopMargin, dividerWidth, dividerHeight));
3428 if (customDividerColor == bottomLineColor)
3430 __pItemAnnexLeftDivider->SetBackgroundColor(dividerLeftColor);
3434 __pItemAnnexLeftDivider->SetBackgroundColor(customDividerColor);
3435 __pItemAnnexLeftDivider->GetVisualElement()->SetOpacity(ITEM_TOP_DIVIDER_OPACITY);
3438 if (customDividerColor == bottomLineColor)
3440 __pItemAnnexRightDivider->SetBackgroundColor(dividerRightColor);
3444 __pItemAnnexRightDivider->SetBackgroundColor(customDividerColor);
3445 __pItemAnnexRightDivider->GetVisualElement()->SetOpacity(ITEM_BOTTOM_DIVIDER_OPACITY);
3448 __pItemAnnexLeftDivider->Invalidate();
3449 __pItemAnnexRightDivider->Invalidate();
3452 if (__pItemAnnexLeftDivider != null)
3454 _AccessibilityContainer* pContainer = __pItemAnnexLeftDivider->GetAccessibilityContainer();
3455 pContainer->Activate(false);
3458 if (__pItemAnnexRightDivider != null)
3460 _AccessibilityContainer* pContainer = __pItemAnnexRightDivider->GetAccessibilityContainer();
3461 pContainer->Activate(false);
3467 _TableViewItem::DrawBitmap(Canvas& canvas, const FloatRectangle& bounds, const Bitmap& bitmap)
3469 result r = E_SUCCESS;
3470 if (_BitmapImpl::CheckNinePatchedBitmapStrictly(bitmap))
3472 r = canvas.DrawNinePatchedBitmap(bounds, bitmap);
3473 SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "Fail to draw ninepatched bitmap.");
3477 r = canvas.DrawBitmap(bounds, bitmap);
3478 SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "Fail to draw bitmap.");
3485 _TableViewItem::SetItemHighlightBounds(_VisualElement& highlightVisualElement, const FloatRectangle& bounds)
3487 return highlightVisualElement.SetBounds(bounds);
3491 _TableViewItem::CalculateItemHighlightBounds(void)
3493 FloatRectangle itemBounds = GetBoundsF();
3494 return FloatRectangle(0.0f, 0.0f, itemBounds.width, itemBounds.height);
3498 _TableViewItem::CalculateAnnexBitmapBounds(float annexWidth, float annexHeight, const Bitmap& bitmap)
3500 FloatRectangle bounds;
3503 float leftMargin = 0;
3504 float topMargin = 0;
3506 if (annexWidth > bitmap.GetWidthF())
3508 leftMargin = (annexWidth - bitmap.GetWidthF()) / 2;
3509 width = bitmap.GetWidthF();
3516 if (annexHeight > bitmap.GetHeightF())
3518 topMargin = (annexHeight - bitmap.GetHeightF()) / 2;
3519 height = bitmap.GetHeightF();
3523 height = annexHeight;
3526 bounds.SetBounds(leftMargin, topMargin, width, height);
3532 _TableViewItem::IsTitleStyleItem(void) const
3534 if (__itemType == TABLE_VIEW_ITEM_TYPE_TITLE || __itemType == TABLE_VIEW_ITEM_TYPE_HEADER || __itemType == TABLE_VIEW_ITEM_TYPE_FOOTER)
3543 _TableViewItem::IsValidSelectionState(void)
3545 _TableView* pParent = dynamic_cast<_TableView*>(GetParent());
3546 if (pParent == null)
3551 if (pParent->GetPressedItemCount() > 0)
3560 _TableViewItem::DrawSimpleItem(void)
3562 if (__pSimpleItemText != null)
3564 Color textColor = __simpleItemTextColor[__drawingStatus];
3567 textColor = __simpleItemTextColor[TABLE_VIEW_SIMPLEITEM_DRAWING_STATUS_DISABLED];
3570 if (__itemType == TABLE_VIEW_ITEM_TYPE_TITLE)
3572 if (__drawingStatus == TABLE_VIEW_ITEM_DRAWING_STATUS_NORMAL)
3574 textColor = __simpleItemTextColor[TABLE_VIEW_GROUPITEM_DRAWING_STATUS_NORMAL];
3578 textColor = __simpleItemTextColor[TABLE_VIEW_GROUPITEM_DRAWING_STATUS_PRESSED];
3582 __pSimpleItemText->SetTextColor(textColor);
3583 __pSimpleItemText->Invalidate(false);
3587 _TableViewItem::SetSimpleItemContents(const Tizen::Base::String& text, const Tizen::Graphics::Bitmap* pBitmap, bool groupType)
3589 result r = E_SUCCESS;
3590 bool textOnly = true;
3592 if (pBitmap != null)
3597 r = CreateSimpleItemContents(textOnly);
3598 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
3600 FloatRectangle bitmapRect = FloatRectangle(0.0f, 0.0f, 0.0f, 0.0f);
3601 FloatRectangle textRect = FloatRectangle(0.0f, 0.0f, 0.0f, 0.0f);
3602 float leftMargin = 0.0f;
3603 float annexMargin = 0.0f;
3604 float elementWidth = 0;
3605 float elementHeight = 0;
3606 float itemHeight = GetBoundsF().height;
3607 float itemWidth = GetBoundsF().width;
3608 float annexWidth = GetAnnexWidth(__annexStyle);
3612 if (__simpleItemTextSize == 0)
3614 GET_SHAPE_CONFIG(TABLEVIEW::GROUPITEM_DEFAULT_FONT_SIZE, _CONTROL_ORIENTATION_PORTRAIT, __simpleItemTextSize);
3616 GET_SHAPE_CONFIG(TABLEVIEW::GROUPITEM_LEFT_MARGIN, _CONTROL_ORIENTATION_PORTRAIT, leftMargin);
3620 if (__simpleItemTextSize == 0)
3622 GET_SHAPE_CONFIG(TABLEVIEW::ITEM_DEFAULT_FONT_SIZE, _CONTROL_ORIENTATION_PORTRAIT, __simpleItemTextSize);
3624 GET_SHAPE_CONFIG(TABLEVIEW::ITEM_LEFT_MARGIN, _CONTROL_ORIENTATION_PORTRAIT, leftMargin);
3629 elementWidth = itemHeight * SIMPLE_ITEM_ELEMENT_BITMAP_SIZE_RATIO;
3630 elementHeight = elementWidth;
3632 bitmapRect.x = leftMargin;
3633 bitmapRect.y = (itemHeight - elementHeight) / 2;
3634 bitmapRect.width = elementWidth;
3635 bitmapRect.height = elementHeight;
3638 if (__annexStyle == TABLE_VIEW_ANNEX_STYLE_NORMAL)
3640 textRect.x = bitmapRect.x + elementWidth + leftMargin;
3641 elementWidth = itemWidth - textRect.x - leftMargin;
3645 GET_SHAPE_CONFIG(TABLEVIEW::ITEM_ANNEX_MARGIN, _CONTROL_ORIENTATION_PORTRAIT, annexMargin);
3646 if (__annexStyle == TABLE_VIEW_ANNEX_STYLE_MARK || __annexStyle == TABLE_VIEW_ANNEX_STYLE_RADIO)
3648 bitmapRect.x = leftMargin + annexWidth + annexMargin;
3649 textRect.x = bitmapRect.x + elementWidth + leftMargin;
3650 elementWidth = itemWidth - textRect.x - leftMargin;
3654 textRect.x = bitmapRect.x + elementWidth + leftMargin;
3655 elementWidth = itemWidth - textRect.x - annexWidth - leftMargin - annexMargin;
3660 textRect.width = elementWidth < 0 ? 0 : elementWidth;;
3661 textRect.height = itemHeight;
3663 if (__pSimpleItemBitmap != null && pBitmap != null)
3665 __pSimpleItemBitmap->SetBackgroundBitmap(*pBitmap);
3666 __pSimpleItemBitmap->SetBounds(bitmapRect);
3668 _Label* pSimpleItemBitmapCore = GetLabelCore(__pSimpleItemBitmap);
3669 if (!pSimpleItemBitmapCore->HasParent())
3671 r = AttachChild(*pSimpleItemBitmapCore);
3672 SysTryReturn(NID_UI_CTRL, __pSimpleItemBitmap != null, r, r, "[%s] Propagating.", GetErrorMessage(r));
3676 if (__pSimpleItemText != null)
3678 __pSimpleItemText->SetTextConfig(__simpleItemTextSize, LABEL_TEXT_STYLE_NORMAL);
3679 __pSimpleItemText->SetText(text);
3680 __pSimpleItemText->SetBounds(textRect);
3682 _Label* pSimpleItemTextCore = GetLabelCore(__pSimpleItemText);
3683 if (!pSimpleItemTextCore->HasParent())
3685 r = AttachChild(*pSimpleItemTextCore);
3686 SysTryReturn(NID_UI_CTRL, __pSimpleItemText != null, r, r, "[%s] Propagating.", GetErrorMessage(r));
3694 _TableViewItem::CreateSimpleItemContents(bool textOnly)
3696 result r = E_SUCCESS;
3698 if (__pSimpleItemText == null)
3700 __pSimpleItemText = new (std::nothrow) Label();
3702 r = GetLastResult();
3703 SysTryReturn(NID_UI_CTRL, __pSimpleItemText != null, r, r, "[%s] Propagating.", GetErrorMessage(r));
3705 __pSimpleItemText->Construct(FloatRectangle(0.0f, 0.0f, 0.0f, 0.0f), L"");
3707 __pSimpleItemText->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
3708 __pSimpleItemText->SetTextVerticalAlignment(ALIGNMENT_MIDDLE);
3709 if (__itemType == TABLE_VIEW_ITEM_TYPE_TITLE)
3711 __pSimpleItemText->SetTextColor(__simpleItemTextColor[TABLE_VIEW_GROUPITEM_DRAWING_STATUS_NORMAL]);
3715 __pSimpleItemText->SetTextColor(__simpleItemTextColor[TABLE_VIEW_ITEM_DRAWING_STATUS_NORMAL]);
3717 __pSimpleItemText->SetBackgroundColor(Color(0, 0, 0, 0));
3718 GetLabelCore(__pSimpleItemText)->SetFocusable(true);
3724 if (__pSimpleItemBitmap == null)
3726 __pSimpleItemBitmap = new (std::nothrow) Label();
3728 r = GetLastResult();
3729 SysTryReturn(NID_UI_CTRL, __pSimpleItemBitmap != null, r, r, "[%s] Propagating.", GetErrorMessage(r));
3731 __pSimpleItemBitmap->Construct(FloatRectangle(0.0f, 0.0f, 0.0f, 0.0f), L"");
3732 __pSimpleItemBitmap->SetBackgroundColor(Color(0, 0, 0, 0));
3733 GetLabelCore(__pSimpleItemBitmap)->SetFocusable(true);
3739 if (__pSimpleItemBitmap != null)
3741 delete __pSimpleItemBitmap;
3742 __pSimpleItemBitmap = null;
3750 _TableViewItem::SetSimpleTextColor(const Tizen::Graphics::Color& color, TableViewItemDrawingStatus status)
3752 __simpleItemTextColor[status] = color;
3757 Tizen::Graphics::Color
3758 _TableViewItem::GetSimpleItemTextColor(TableViewItemDrawingStatus status) const
3760 return __simpleItemTextColor[status];
3764 _TableViewItem::SetSimpleGroupItemTextColor(const Tizen::Graphics::Color& color, TableViewItemDrawingStatus status)
3766 if (status == TABLE_VIEW_ITEM_DRAWING_STATUS_NORMAL)
3768 __simpleItemTextColor[TABLE_VIEW_GROUPITEM_DRAWING_STATUS_NORMAL] = color;
3770 else if (status == TABLE_VIEW_ITEM_DRAWING_STATUS_PRESSED)
3772 __simpleItemTextColor[TABLE_VIEW_GROUPITEM_DRAWING_STATUS_PRESSED] = color;
3778 Tizen::Graphics::Color
3779 _TableViewItem::GetSimpleGroupItemTextColor(TableViewItemDrawingStatus status) const
3781 if (status == TABLE_VIEW_ITEM_DRAWING_STATUS_PRESSED)
3783 return __simpleItemTextColor[TABLE_VIEW_GROUPITEM_DRAWING_STATUS_PRESSED];
3787 return __simpleItemTextColor[TABLE_VIEW_GROUPITEM_DRAWING_STATUS_NORMAL];
3792 _TableViewItem::SetSimpleItemTextSize(int size)
3794 if (__simpleItemTextSize == size)
3799 __simpleItemTextSize = size;
3801 if (__pSimpleItemText != null)
3803 __pSimpleItemText->SetTextConfig(__simpleItemTextSize, LABEL_TEXT_STYLE_NORMAL);
3809 _TableViewItem::GetSimpleItemTextSize(void) const
3811 return __simpleItemTextSize;
3815 _TableViewItem::SetSectionHeaderFooterContents(const Tizen::Base::String& text, HorizontalAlignment alignment, bool isHeader)
3817 if (__pHeaderFooterItemText == null)
3819 result r = E_SUCCESS;
3820 float contentsHeight = 0.0f;
3821 float positionY = 0.0f;
3824 GET_COLOR_CONFIG(TABLEVIEW::GROUPITEM_TEXT_NORMAL, textColor);
3825 GET_SHAPE_CONFIG(TABLEVIEW::GROUPITEM_DEFAULT_TEXT_HEIGHT, _CONTROL_ORIENTATION_PORTRAIT, contentsHeight);
3827 __pHeaderFooterItemText = new (std::nothrow) Label();
3829 r = GetLastResult();
3830 SysTryReturn(NID_UI_CTRL, __pHeaderFooterItemText != null, r, r, "[%s] Propagating.", GetErrorMessage(r));
3834 positionY = GetBoundsF().height - contentsHeight;
3836 __pHeaderFooterItemText->Construct(FloatRectangle(0.0f, positionY, GetBoundsF().width, contentsHeight), text);
3837 __pHeaderFooterItemText->SetTextHorizontalAlignment(alignment);
3838 __pHeaderFooterItemText->SetTextColor(textColor);
3839 __pHeaderFooterItemText->SetBackgroundColor(Color(0, 0, 0, 0));
3841 _Label* pHeaderFooterItemTextCore = GetLabelCore(__pHeaderFooterItemText);
3842 pHeaderFooterItemTextCore->SetFocusable(false);
3843 AttachChild(*pHeaderFooterItemTextCore);
3850 _TableViewItem::SetSectionHeaderFooterAlignment(HorizontalAlignment alignment)
3852 if (__pHeaderFooterItemText != null)
3854 __pHeaderFooterItemText->SetTextHorizontalAlignment(alignment);
3855 __pHeaderFooterItemText->Invalidate(false);
3862 _TableViewItem::GetAnnexWidth(TableViewAnnexStyle style)
3864 float annexWidth = 0.0f;
3865 float annexDividerWidth = 0.0f;
3869 case TABLE_VIEW_ANNEX_STYLE_NORMAL:
3873 case TABLE_VIEW_ANNEX_STYLE_MARK:
3874 GET_SHAPE_CONFIG(TABLEVIEW::ITEM_ANNEX_WIDTH, _CONTROL_ORIENTATION_PORTRAIT, annexWidth);
3877 case TABLE_VIEW_ANNEX_STYLE_ONOFF_SLIDING:
3878 GET_SHAPE_CONFIG(TABLEVIEW::ITEM_ANNEX_ONOFF_WIDTH, _CONTROL_ORIENTATION_PORTRAIT, annexWidth);
3881 case TABLE_VIEW_ANNEX_STYLE_ONOFF_SLIDING_WITH_DIVIDER:
3882 GET_SHAPE_CONFIG(TABLEVIEW::ITEM_ANNEX_MARGIN, _CONTROL_ORIENTATION_PORTRAIT, annexDividerWidth);
3883 GET_FIXED_VALUE_CONFIG(TABLEVIEW::ITEM_ANNEX_DIVIDER_WIDTH, _CONTROL_ORIENTATION_PORTRAIT, annexDividerWidth);
3884 GET_SHAPE_CONFIG(TABLEVIEW::ITEM_ANNEX_ONOFF_WIDTH, _CONTROL_ORIENTATION_PORTRAIT, annexWidth);
3885 annexWidth = annexWidth + (annexDividerWidth*2) + annexDividerWidth;
3888 case TABLE_VIEW_ANNEX_STYLE_DETAILED:
3889 GET_SHAPE_CONFIG(TABLEVIEW::ITEM_ANNEX_MORE_WIDTH, _CONTROL_ORIENTATION_PORTRAIT, annexWidth);
3892 case TABLE_VIEW_ANNEX_STYLE_RADIO:
3893 GET_SHAPE_CONFIG(TABLEVIEW::ITEM_ANNEX_WIDTH, _CONTROL_ORIENTATION_PORTRAIT, annexWidth);
3904 _TableViewItem::SetDrawingStatus(TableViewItemDrawingStatus status)
3906 __drawingStatus = status;
3909 TableViewItemDrawingStatus
3910 _TableViewItem::GetDrawingStatus(void)
3912 return __drawingStatus;
3916 _TableViewItem::SetPressedControl(TableViewItemPressedControl pressedControl)
3918 __pressedControl = pressedControl;
3920 if (__pressedControl == TABLE_VIEW_ITEM_PRESSED_ITEM)
3922 __drawingStatus = TABLE_VIEW_ITEM_DRAWING_STATUS_PRESSED;
3924 else if (__pressedControl == TABLE_VIEW_ITEM_PRESSED_ANNEX)
3926 if (__annexStyle == TABLE_VIEW_ANNEX_STYLE_DETAILED)
3928 __isSelectedDetailButton = true;
3929 __drawingStatus = TABLE_VIEW_ITEM_DRAWING_STATUS_NORMAL;
3931 else if (__annexStyle == TABLE_VIEW_ANNEX_STYLE_ONOFF_SLIDING ||
3932 __annexStyle == TABLE_VIEW_ANNEX_STYLE_ONOFF_SLIDING_WITH_DIVIDER)
3934 __drawingStatus = TABLE_VIEW_ITEM_DRAWING_STATUS_NORMAL;
3938 __drawingStatus = TABLE_VIEW_ITEM_DRAWING_STATUS_PRESSED;
3943 if (__pressedControl != TABLE_VIEW_ITEM_PRESSED_INDIVIDUAL)
3945 __drawingStatus = TABLE_VIEW_ITEM_DRAWING_STATUS_PRESSED;
3950 TableViewItemPressedControl
3951 _TableViewItem::GetPressedControl(void)
3953 return __pressedControl;
3957 _TableViewItem::AdjustChildControlMargin(void)
3959 if (__childMarginState)
3964 if (IsTitleStyleItem())
3969 __childMarginState = true;
3973 if (__pDrawingProperty->groupedLookEnabled)
3975 float groupedBarMargin = 0.0f;
3976 GET_SHAPE_CONFIG(TABLEVIEW::GROUPITEM_BAR_WIDTH, _CONTROL_ORIENTATION_PORTRAIT, groupedBarMargin);
3978 margin = margin + groupedBarMargin;
3983 _VisualElement* pVisualElement = GetVisualElement();
3985 if (pVisualElement != null)
3987 FloatPoint position;
3989 position.SetPosition(margin, 0.0f);
3990 pVisualElement->ScrollByPoint(position, false);
3996 _TableViewItem::AdjustContextItemBounds(void)
3998 _TableViewItem* pContextItem = GetContextItem();
4000 if (pContextItem == null)
4005 FloatDimension contextItemSize = pContextItem->GetSizeF();
4006 FloatDimension itemSize = GetSizeF();
4008 if (!_FloatCompare(contextItemSize.height, itemSize.height))
4010 contextItemSize.height = itemSize.height;
4012 pContextItem->SetSize(contextItemSize);
4015 pContextItem->AdjustChildControlCenterAlign();
4019 _TableViewItem::AdjustAnnexBounds(void)
4021 if (__pItemAnnex == null || __isMoveItemAnimationEnabled || __isZoomInOutItemAnimationEnabled ||__isFadeInOutItemAnimationEnabled)
4027 if (__annexStyle == TABLE_VIEW_ANNEX_STYLE_ONOFF_SLIDING || __annexStyle == TABLE_VIEW_ANNEX_STYLE_ONOFF_SLIDING_WITH_DIVIDER || __annexStyle == TABLE_VIEW_ANNEX_STYLE_DETAILED)
4029 _Label* pAnnexCore = GetLabelCore(__pItemAnnex);
4030 if (pAnnexCore->HasParent())
4032 FloatRectangle annexBounds = __pItemAnnex->GetBoundsF();
4033 float annexPositionX = annexBounds.x;
4034 float leftMargin = 0.0f;
4036 GET_SHAPE_CONFIG(TABLEVIEW::ITEM_LEFT_MARGIN, _CONTROL_ORIENTATION_PORTRAIT, leftMargin);
4038 if (__pDrawingProperty != null)
4040 leftMargin += __pDrawingProperty->scrollMargin;
4043 annexPositionX = GetBoundsF().width - annexBounds.width - leftMargin;
4044 if (__pDrawingProperty != null && __pDrawingProperty->groupedLookEnabled)
4046 float groupedBarMargin = 0.0f;
4047 GET_SHAPE_CONFIG(TABLEVIEW::GROUPITEM_BAR_WIDTH, _CONTROL_ORIENTATION_PORTRAIT, groupedBarMargin);
4049 annexPositionX += groupedBarMargin;
4052 if (!_FloatCompare(annexPositionX, annexBounds.x))
4054 __pItemAnnex->SetPosition(FloatPoint(annexPositionX, annexBounds.y));
4056 if (__pAccessibilityOnOffElement != null)
4058 __pAccessibilityOnOffElement->SetBounds(__pItemAnnex->GetBoundsF());
4065 FloatRectangle itemBounds = GetBoundsF();
4066 FloatRectangle annexBounds = __pItemAnnex->GetBoundsF();
4068 if (__customHeight > 0)
4070 itemBounds.height = __customHeight;
4073 annexBounds.y = (itemBounds.height - annexBounds.height) / 2;
4074 __pItemAnnex->SetPosition(FloatPoint(annexBounds.x, annexBounds.y));
4075 if (__pAccessibilityOnOffElement != null)
4077 __pAccessibilityOnOffElement->SetBounds(__pItemAnnex->GetBoundsF());
4082 _TableViewItem::SetItemCustomHeight(float height)
4084 __customHeight = height;
4088 _TableViewItem::GetItemCustomHeight(void)
4090 return __customHeight;
4094 _TableViewItem::AdjustChildControlCenterAlign(void)
4096 if (__childControlCenterAlign)
4098 FloatDimension itemSize = GetSizeF();
4100 int childControlCount = GetChildCount();
4102 for (int i = 0; i < childControlCount; i++)
4104 _Control* pChildControl = GetChild(i);
4106 if (pChildControl == null)
4111 if (__pItemDivider == pChildControl)
4113 float positionX = pChildControl->GetPositionF().x;
4114 pChildControl->SetPosition(FloatPoint(positionX, itemSize.height - 1));
4118 if (__pItemTopDivider == pChildControl)
4120 float positionX = pChildControl->GetPositionF().x;
4121 pChildControl->SetPosition(FloatPoint(positionX, 0));
4125 FloatRectangle itemBounds = pChildControl->GetBoundsF();
4127 itemBounds.y = (itemSize.height - itemBounds.height) / 2;
4129 pChildControl->SetPosition(FloatPoint(itemBounds.x, itemBounds.y));
4135 _TableViewItem::SetChildControlCenterAlign(bool centerAlign)
4137 __childControlCenterAlign = centerAlign;
4141 _TableViewItem::GetLastTouchPressedPosition(void)
4143 return _CoordinateSystemUtils::ConvertToInteger(__touchStartPosition);
4147 _TableViewItem::GetLastTouchPressedPositionF(void)
4149 return __touchStartPosition;
4153 _TableViewItem::SetLastTouchPressedPosition(FloatPoint position)
4155 // This function was made to modify of ListView::RefreshList().
4156 // This function could adversely affect touch event handling. So, you should be used with caution.
4157 __touchStartPosition = position;
4161 _TableViewItem::SetLastTouchPressedPosition(Point position)
4163 // This function was made to modify of ListView::RefreshList().
4164 // This function could adversely affect touch event handling. So, you should be used with caution.
4165 __touchStartPosition = _CoordinateSystemUtils::ConvertToFloat(position);
4169 _TableViewItem::GetSelectionState(void)
4171 return __itemSelected;
4175 _TableViewItem::SetSelectionState(bool selected)
4177 // This function was made to modify of ListView::RefreshList().
4178 // This function could adversely affect touch event handling. So, you should be used with caution.
4179 __itemSelected = selected;
4183 _TableViewItem::MoveItem(FloatPoint position, int duration, int delay)
4185 _VisualElement* pVisualElement = GetVisualElement();
4186 VisualElementValueAnimation* pAnimation = null;
4187 String animationName = L"MOVE_ITEM";
4188 FloatPoint itemPosition = GetPositionF();
4189 result r = E_SUCCESS;
4191 if (position == itemPosition)
4196 if (__pMoveItemAnimation == null)
4198 __pMoveItemAnimation = new (std::nothrow) VisualElementValueAnimation;
4199 SysTryCatch(NID_UI_CTRL, __pMoveItemAnimation != null, , E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
4201 __pMoveItemAnimation->SetVisualElementAnimationTickEventListener(this);
4202 r = GetLastResult();
4203 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
4205 __pMoveItemAnimation->SetVisualElementAnimationStatusEventListener(this);
4206 r = GetLastResult();
4207 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
4210 pAnimation = __pMoveItemAnimation;
4212 pAnimation->SetTimingFunction(VisualElementAnimation::GetTimingFunctionByName("EaseInOut"));
4213 pAnimation->SetDuration(duration);
4214 pAnimation->SetDelay(delay);
4215 pAnimation->SetStartValue(Variant(GetPositionF()));
4216 pAnimation->SetEndValue(Variant(position));
4218 if (pVisualElement->AddAnimation(animationName, *pAnimation) != E_SUCCESS)
4229 delete __pMoveItemAnimation;
4230 __pMoveItemAnimation = null;
4236 _TableViewItem::ZoomInOutItem(bool zoomOut, int duration, int delay)
4238 _VisualElement* pVisualElement = GetVisualElement();
4239 VisualElementValueAnimation* pAnimation = null;
4240 String animationName = L"ZOOM_IN_OUT_ITEM";
4241 FloatDimension itemSize = GetSizeF();
4242 FloatDimension startValue;
4243 FloatDimension endValue;
4244 result r = E_SUCCESS;
4246 if (__pZoomInOutItemAnimation == null)
4248 __pZoomInOutItemAnimation = new (std::nothrow) VisualElementValueAnimation;
4249 SysTryCatch(NID_UI_CTRL, __pZoomInOutItemAnimation != null, , E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
4251 __pZoomInOutItemAnimation->SetVisualElementAnimationTickEventListener(this);
4252 r = GetLastResult();
4253 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
4255 __pZoomInOutItemAnimation->SetVisualElementAnimationStatusEventListener(this);
4256 r = GetLastResult();
4257 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
4260 pAnimation = __pZoomInOutItemAnimation;
4264 startValue = itemSize;
4265 endValue = FloatDimension(itemSize.width, itemSize.height / 2);
4266 pAnimation->SetTimingFunction(VisualElementAnimation::GetTimingFunctionByName(L"EaseOut"));
4270 startValue = FloatDimension(itemSize.width, itemSize.height / 2);
4271 endValue = itemSize;
4272 pAnimation->SetTimingFunction(VisualElementAnimation::GetTimingFunctionByName(L"EaseIn"));
4275 pAnimation->SetDuration(duration);
4276 pAnimation->SetDelay(delay);
4277 pAnimation->SetStartValue(Variant(startValue));
4278 pAnimation->SetEndValue(Variant(endValue));
4280 if (pVisualElement->AddAnimation(animationName, *pAnimation) != E_SUCCESS)
4290 delete __pZoomInOutItemAnimation;
4291 __pZoomInOutItemAnimation = null;
4297 _TableViewItem::FadeInOutItem(bool fadeOut, int duration, int delay)
4299 _VisualElement* pVisualElement = GetVisualElement();
4300 VisualElementValueAnimation* pAnimation = null;
4301 String animationName = L"FADE_IN_OUT_ITEM";
4302 float startValue = 0.0f;
4303 float endValue = 1.0f;
4304 result r = E_SUCCESS;
4306 if (__pFadeInOutItemtAnimation == null)
4308 __pFadeInOutItemtAnimation = new (std::nothrow) VisualElementValueAnimation;
4309 SysTryCatch(NID_UI_CTRL, __pFadeInOutItemtAnimation != null, , E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
4311 __pFadeInOutItemtAnimation->SetVisualElementAnimationTickEventListener(this);
4312 r = GetLastResult();
4313 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
4315 __pFadeInOutItemtAnimation->SetVisualElementAnimationStatusEventListener(this);
4316 r = GetLastResult();
4317 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
4320 pAnimation = __pFadeInOutItemtAnimation;
4326 pAnimation->SetTimingFunction(VisualElementAnimation::GetTimingFunctionByName(L"EaseOut"));
4330 pAnimation->SetTimingFunction(VisualElementAnimation::GetTimingFunctionByName(L"EaseIn"));
4333 pAnimation->SetTimingFunction(VisualElementAnimation::GetTimingFunctionByName("EaseIn"));
4334 pAnimation->SetDuration(duration);
4335 pAnimation->SetDelay(delay);
4336 pAnimation->SetStartValue(Variant(startValue));
4337 pAnimation->SetEndValue(Variant(endValue));
4339 if (pVisualElement->AddAnimation(animationName, *pAnimation) != E_SUCCESS)
4344 pVisualElement->SetOpacity(startValue);
4352 delete __pFadeInOutItemtAnimation;
4353 __pFadeInOutItemtAnimation = null;
4359 _TableViewItem::SetIndividualSelectionEnabled(const _Control& control, bool enable)
4361 result r = E_SUCCESS;
4364 if (!__individualSelectionControls.Contains(control))
4366 r = __individualSelectionControls.Add(control);
4369 _AccessibilityContainer* pContainer = const_cast<_Control*>(&control)->GetAccessibilityContainer();
4370 pContainer->Activate(true);
4371 int controlCount = 0;
4372 for (int i=0; i<GetChildCount(); i++)
4374 _Control* pChildControl = GetChild(i);
4375 if (pChildControl == static_cast<_Control*>(__pItemAnnexLeftDivider)
4376 || pChildControl == static_cast<_Control*>(__pItemAnnexRightDivider)
4377 || pChildControl == static_cast<_Control*>(__pItemCover)
4378 || pChildControl == static_cast<_Control*>(__pItemDivider)
4379 || pChildControl== static_cast<_Control*>(__pItemTopDivider))
4387 if (controlCount == 0 || __individualSelectionControls.GetCount() == controlCount)
4389 GetAccessibilityContainer()->Activate(false);
4393 GetAccessibilityContainer()->Activate(true);
4398 if (__individualSelectionControls.Contains(control))
4400 r = __individualSelectionControls.Remove(control, false);
4407 _TableViewItem::IsIndividualSelectionEnabled(const _Control& control)
4409 return __individualSelectionControls.Contains(control);
4413 _TableViewItem::AddRef(void)
4415 return ++__refCount;
4419 _TableViewItem::Release(void)
4422 if (__refCount <= 0)
4432 _TableViewItem::IsAnimationPlaying(void)
4434 if (__animationCount > 0)
4443 _TableViewItem::StopAllAnimation(void)
4445 _VisualElement* pVisualElement = GetVisualElement();
4447 pVisualElement->RemoveAllAnimations();
4451 _TableViewItem::SetItemDividerEnabled(bool enable)
4453 __itemDividerEnabled = enable;
4457 _TableViewItem::OnTickOccurred(const Tizen::Ui::Animations::VisualElementAnimation& animation, const Tizen::Base::String& keyName, Tizen::Ui::Animations::VisualElement& target, const Tizen::Ui::Variant& currentValue)
4459 if (keyName == L"MOVE_ITEM")
4461 FloatPoint position = currentValue.ToFloatPoint();
4462 SetPosition(position);
4464 else if (keyName == L"FADE_IN_OUT_ITEM")
4466 float opacity = currentValue.ToFloat();
4468 _VisualElement* pVisualElement = GetVisualElement();
4470 if (pVisualElement != null)
4472 pVisualElement->SetOpacity(opacity);
4475 else if (keyName == L"ZOOM_IN_OUT_ITEM")
4477 FloatDimension size = currentValue.ToFloatDimension();
4483 _TableViewItem::OnVisualElementAnimationStarted(const Tizen::Ui::Animations::VisualElementAnimation& animation, const Tizen::Base::String& keyName, Tizen::Ui::Animations::VisualElement& target)
4485 if (keyName == L"MOVE_ITEM")
4487 __isMoveItemAnimationEnabled = true;
4489 else if (keyName == L"FADE_IN_OUT_ITEM")
4491 __isFadeInOutItemAnimationEnabled = true;
4493 else if (keyName == L"ZOOM_IN_OUT_ITEM")
4495 __isZoomInOutItemAnimationEnabled = true;
4500 _TableViewItem::OnVisualElementAnimationRepeated(const Tizen::Ui::Animations::VisualElementAnimation& animation, const Tizen::Base::String& keyName, Tizen::Ui::Animations::VisualElement& target, long currentRepeatCount)
4505 _TableViewItem::OnVisualElementAnimationFinished(const Tizen::Ui::Animations::VisualElementAnimation& animation, const Tizen::Base::String& keyName, Tizen::Ui::Animations::VisualElement& target, bool completedNormally)
4507 if (__isAnimationCallbackBlocked)
4512 bool tableViewItemAnimation = true;
4513 const VisualElementValueAnimation *pAnimation = dynamic_cast<const VisualElementValueAnimation*>(&(animation));
4515 if (keyName == L"MOVE_ITEM")
4517 if (pAnimation != null)
4519 FloatPoint position = pAnimation->GetEndValue().ToFloatPoint();
4521 SetPosition(position);
4523 __isMoveItemAnimationEnabled = false;
4525 else if (keyName == L"FADE_IN_OUT_ITEM")
4527 if (pAnimation != null)
4529 float opacity = pAnimation->GetEndValue().ToFloat();
4531 _VisualElement* pVisualElement = GetVisualElement();
4533 if (pVisualElement != null)
4535 pVisualElement->SetOpacity(opacity);
4539 __isFadeInOutItemAnimationEnabled = false;
4541 else if (keyName == L"ZOOM_IN_OUT_ITEM")
4543 if (pAnimation != null)
4545 FloatDimension size = pAnimation->GetEndValue().ToFloatDimension();
4549 __isZoomInOutItemAnimationEnabled = false;
4553 tableViewItemAnimation = false;
4556 if (tableViewItemAnimation)
4565 _TableViewItem::OnAttachedToMainTree(void)
4567 if (!_FloatCompare(GetBoundsF().height, 0.0f))
4569 SetAccessibilityElement();
4576 _TableViewItem::SetAccessibilityElement(void)
4578 _AccessibilityContainer* pContainer = GetAccessibilityContainer();
4580 if (pContainer != null)
4582 if (__pAccessibilityElement == null)
4584 __pAccessibilityElement = new (std::nothrow) _AccessibilityElement(true);
4585 SysTryReturnVoidResult(NID_UI_CTRL, __pAccessibilityElement, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
4587 __pAccessibilityElement->SetTrait(ACCESSIBILITY_TRAITS_NONE);
4588 __pAccessibilityElement->SetName(L"TableViewItem");
4590 pContainer->AddElement(*__pAccessibilityElement);
4592 __pAccessibilityElement->SetBounds(FloatRectangle(0.0f,0.0f, GetBoundsF().width, GetBoundsF().height));
4594 if (__pAccessibilityOnOffElement == null && __annexStyle == TABLE_VIEW_ANNEX_STYLE_ONOFF_SLIDING_WITH_DIVIDER)
4596 __pAccessibilityOnOffElement = new (std::nothrow) _AccessibilityElement(true);
4597 SysTryReturnVoidResult(NID_UI_CTRL, __pAccessibilityOnOffElement, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
4599 __pAccessibilityOnOffElement->SetTraitWithStringId("IDS_TPLATFORM_BODY_ON_OFF_BUTTON_T_TTS");
4600 __pAccessibilityOnOffElement->SetName(L"OnOffButton");
4601 __pAccessibilityOnOffElement->SetHintWithStringId("IDS_TPLATFORM_BODY_DOUBLE_TAP_TO_MOVE_TO_CONTENT_T_TTS");
4603 pContainer->AddElement(*__pAccessibilityOnOffElement);
4604 __pAccessibilityOnOffElement->SetBounds(FloatRectangle(0.0f, 0.0f, 0.0f, 0.0f));
4609 _AccessibilityElement*
4610 _TableViewItem::GetAccessibilityElement(void)
4612 return __pAccessibilityElement;
4615 _TableViewItem::SetAccessibilityElementTrait(void)
4617 if (__pAccessibilityElement == null)
4621 int groupIndex = -1;
4624 switch (__annexStyle)
4626 case TABLE_VIEW_ANNEX_STYLE_NORMAL:
4627 GetItemIndex(groupIndex, itemIndex);
4628 if (groupIndex != -1 && itemIndex == -1)
4630 __pAccessibilityElement->SetTraitWithStringId("IDS_TPLATFORM_BODY_GROUP_INDEX");
4634 case TABLE_VIEW_ANNEX_STYLE_MARK:
4635 __pAccessibilityElement->SetTraitWithStringId("IDS_TPLATFORM_BODY_TICKBOX_T_TTS");
4638 case TABLE_VIEW_ANNEX_STYLE_ONOFF_SLIDING:
4639 __pAccessibilityElement->SetTraitWithStringId("IDS_TPLATFORM_BODY_ON_OFF_BUTTON_T_TTS");
4642 case TABLE_VIEW_ANNEX_STYLE_ONOFF_SLIDING_WITH_DIVIDER:
4645 case TABLE_VIEW_ANNEX_STYLE_DETAILED:
4646 __pAccessibilityElement->SetTraitWithStringId("IDS_TPLATFORM_BODY_BUTTON_T_TTS");
4649 case TABLE_VIEW_ANNEX_STYLE_RADIO:
4650 __pAccessibilityElement->SetTraitWithStringId("IDS_TPLATFORM_BODY_RADIO_BUTTON_T_TTS");
4658 _TableViewItem::SetAccessibilityElementValue(void)
4660 if (__pAccessibilityElement == null)
4665 switch (__annexStyle)
4667 case TABLE_VIEW_ANNEX_STYLE_MARK:
4670 __pAccessibilityElement->SetValueWithStringId("IDS_TPLATFORM_BODY_TICK_T_TTS");
4674 __pAccessibilityElement->SetValueWithStringId("IDS_TPLATFORM_BODY_UNTICK_T_TTS");
4678 case TABLE_VIEW_ANNEX_STYLE_ONOFF_SLIDING:
4681 __pAccessibilityElement->SetValueWithStringId("IDS_TPLATFORM_BODY_ON");
4685 __pAccessibilityElement->SetValueWithStringId("IDS_TPLATFORM_BODY_OFF");
4689 case TABLE_VIEW_ANNEX_STYLE_ONOFF_SLIDING_WITH_DIVIDER:
4692 if (__pAccessibilityOnOffElement != null)
4694 __pAccessibilityOnOffElement->SetValueWithStringId("IDS_TPLATFORM_BODY_ON");
4699 if (__pAccessibilityOnOffElement != null)
4701 __pAccessibilityOnOffElement->SetValueWithStringId("IDS_TPLATFORM_BODY_OFF");
4706 case TABLE_VIEW_ANNEX_STYLE_RADIO:
4709 __pAccessibilityElement->SetValueWithStringId("IDS_TPLATFORM_BODY_SELECTED_T_TTS");
4713 __pAccessibilityElement->SetValueWithStringId("IDS_TPLATFORM_BODY_NOT_SELECTED_T_TTS");
4722 _TableViewItem::SetAccessibilityElementLabel(void)
4724 if (__pAccessibilityElement == null)
4729 if (__pAccessibilityElement->IsPublicLabelUpdated())
4734 String accessibilityLabel;
4735 String space = L" ";
4736 int childControlCount = GetChildCount();
4738 for (int i = 0; i < childControlCount; i++)
4740 _Control* pChildControl = GetChild(i);
4742 if (pChildControl == null)
4747 if (__pItemDivider == pChildControl || __pItemTopDivider == pChildControl || __pItemCover == pChildControl)
4752 accessibilityLabel += GetChildAccessibilityLabelContent(*pChildControl);
4753 accessibilityLabel += space;
4756 __pAccessibilityElement->SetLabel(accessibilityLabel);
4761 _TableViewItem::OnAccessibilityFocusMovedNext(const _AccessibilityContainer& control, const _AccessibilityElement& element)
4767 _TableViewItem::OnAccessibilityFocusMovedPrevious(const _AccessibilityContainer& control, const _AccessibilityElement& element)
4773 _TableViewItem::OnAccessibilityReadElement(const _AccessibilityContainer& control, const _AccessibilityElement& element)
4779 _TableViewItem::OnAccessibilityReadingElement(const _AccessibilityContainer& control, const _AccessibilityElement& element)
4781 SetAccessibilityElementLabel();
4782 SetAccessibilityElementTrait();
4783 SetAccessibilityElementValue();
4788 _TableViewItem::OnAccessibilityFocusIn(const _AccessibilityContainer& control, const _AccessibilityElement& element)
4794 _TableViewItem::OnAccessibilityFocusOut(const _AccessibilityContainer& control, const _AccessibilityElement& element)
4800 _TableViewItem::OnAccessibilityActionPerformed(const _AccessibilityContainer& control, const _AccessibilityElement& element)
4802 switch (__annexStyle)
4804 case TABLE_VIEW_ANNEX_STYLE_NORMAL:
4807 case TABLE_VIEW_ANNEX_STYLE_MARK:
4811 GET_STRING_CONFIG(IDS_TPLATFORM_BODY_TICK_T_TTS,string);
4812 _AccessibilityManager::GetInstance()->ReadContent(string);
4817 GET_STRING_CONFIG(IDS_TPLATFORM_BODY_UNTICK_T_TTS,string);
4818 _AccessibilityManager::GetInstance()->ReadContent(string);
4821 case TABLE_VIEW_ANNEX_STYLE_ONOFF_SLIDING:
4825 GET_STRING_CONFIG(IDS_TPLATFORM_BODY_ON,string);
4826 _AccessibilityManager::GetInstance()->ReadContent(string);
4831 GET_STRING_CONFIG(IDS_TPLATFORM_BODY_OFF,string);
4832 _AccessibilityManager::GetInstance()->ReadContent(string);
4836 case TABLE_VIEW_ANNEX_STYLE_ONOFF_SLIDING_WITH_DIVIDER:
4837 if (&element == __pAccessibilityOnOffElement && IsEnabled())
4843 GET_STRING_CONFIG(IDS_TPLATFORM_BODY_OFF,string);
4844 _AccessibilityManager::GetInstance()->ReadContent(string);
4850 GET_STRING_CONFIG(IDS_TPLATFORM_BODY_ON,string);
4851 _AccessibilityManager::GetInstance()->ReadContent(string);
4856 case TABLE_VIEW_ANNEX_STYLE_DETAILED:
4859 case TABLE_VIEW_ANNEX_STYLE_RADIO:
4863 GET_STRING_CONFIG(IDS_TPLATFORM_OPT_SELECT,string);
4864 _AccessibilityManager::GetInstance()->ReadContent(string);
4869 GET_STRING_CONFIG(IDS_TPLATFORM_BODY_NOT_SELECTED_T_TTS,string);
4870 _AccessibilityManager::GetInstance()->ReadContent(string);
4881 _TableViewItem::OnAccessibilityValueIncreased(const _AccessibilityContainer& control, const _AccessibilityElement& element)
4887 _TableViewItem::OnAccessibilityValueDecreased(const _AccessibilityContainer& control, const _AccessibilityElement& element)
4893 _TableViewItem::OnKeyPressed(const _Control& source, const _KeyInfo& keyInfo)
4895 __isTouchCancelOnPressRelease = false;
4897 if (!IsFocusModeStateEnabled())
4902 if (IsReorderMode() || IsAnimationPlaying())
4907 _TableView* pParent = dynamic_cast<_TableView*>(GetParent());
4908 _KeyCode keyCode = keyInfo.GetKeyCode();
4909 IListT<_Control*>* pFocusList = GetFocusListN();
4910 SysTryReturn(NID_UI_CTRL, pFocusList != null, true, GetLastResult(), "[%s] propagating.", GetErrorMessage(GetLastResult()));
4912 _Control* pChildControl = null;
4913 _Control* pFocusedControl = null;
4914 _Window* pTop = source.GetRootWindow();
4918 pFocusedControl = pTop->GetCurrentFocusControl();
4921 int count = pFocusList->GetCount();
4923 if (pFocusedControl == null)
4933 for (int i=count-1; i>=0; i--)
4935 pFocusList->GetAt(i, pChildControl);
4936 if (pChildControl == null)
4941 if (pChildControl->IsFocused())
4945 pChildControl = null;
4949 for (int j=i-1; j>=0; j--)
4951 pFocusList->GetAt(j, pChildControl);
4952 if (pChildControl == null)
4957 if (pChildControl->IsFocusable() && pChildControl->GetEnableState()
4958 && pChildControl->GetVisibleState())
4964 pChildControl = null;
4971 if (pChildControl && pChildControl->GetEnableState()
4972 && pChildControl->GetVisibleState() && pChildControl->IsFocusable())
4974 if (pParent != null)
4976 pParent->SetAnnexFocused(true);
4978 pChildControl->SetFocused(true);
4979 pChildControl->DrawFocus();
4983 _Control* pParentControl = pFocusedControl->GetParent();
4984 _TableViewItem* pItem = dynamic_cast<_TableViewItem*>(pParentControl);
4986 if (pItem != null && pItem->GetEnableState() && !pItem->IsFocused()
4987 && pItem->GetVisibleState() && pItem->IsFocusable())
4989 if (pParent != null)
4991 pParent->SetAnnexFocused(false);
4993 pItem->SetFocused(true);
5003 if (pChildControl == null)
5005 for (int i=0; i<count; i++)
5007 pFocusList->GetAt(i, pChildControl);
5008 if (pChildControl == null)
5013 if (pChildControl->IsFocusable() && pChildControl->GetEnableState()
5014 && pChildControl->GetVisibleState())
5020 pChildControl = null;
5027 for (int i=0; i<count; i++)
5029 pFocusList->GetAt(i, pChildControl);
5030 if (pChildControl == null)
5035 if (pChildControl->IsFocused())
5039 pChildControl = null;
5043 for (int j=i+1; j<count; j++)
5045 pFocusList->GetAt(j, pChildControl);
5046 if (pChildControl == null)
5051 if (pChildControl->IsFocusable() && pChildControl->GetEnableState()
5052 && pChildControl->GetVisibleState())
5058 pChildControl = null;
5066 if (pChildControl && pChildControl->GetEnableState() && pChildControl->GetVisibleState()
5067 && pChildControl->IsFocusable())
5069 if (pParent != null)
5071 pParent->SetAnnexFocused(true);
5073 pChildControl->SetFocused(true);
5074 pChildControl->DrawFocus();
5079 if (&source == this)
5081 __pressedControl = TABLE_VIEW_ITEM_PRESSED_ITEM;
5083 else if (&source == GetLabelCore(__pItemAnnex))
5085 __pressedControl = TABLE_VIEW_ITEM_PRESSED_ANNEX;
5087 else if (IsIndividualSelectionEnabled(source))
5089 __pressedControl = TABLE_VIEW_ITEM_PRESSED_INDIVIDUAL;
5093 __pressedControl = TABLE_VIEW_ITEM_PRESSED_NONE;
5095 __itemSelected = true;
5096 FireItemTouchPressed();
5102 __annexOnOffHandlerMoved = false;
5103 __itemTouchMoved = false;
5105 __itemSelected = false;
5106 __drawingStatus = TABLE_VIEW_ITEM_DRAWING_STATUS_NORMAL;
5108 if (__annexStyle == TABLE_VIEW_ANNEX_STYLE_DETAILED)
5110 __isSelectedDetailButton = false;
5113 SetItemChanged(true);
5123 _TableViewItem::OnKeyReleased(const _Control& source, const _KeyInfo& keyInfo)
5125 if (!IsFocusModeStateEnabled())
5130 if (IsReorderMode() || IsAnimationPlaying())
5135 _KeyCode keyCode = keyInfo.GetKeyCode();
5137 if (keyCode == _KEY_ENTER)
5139 _TableView* pParent = dynamic_cast<_TableView*>(GetParent());
5140 SysTryReturn(NID_UI_CTRL, pParent != null, true, GetLastResult(), "[%s] propagating.", GetErrorMessage(GetLastResult()));
5142 pParent->StopExpandCollapseAnimation();
5143 if (&source == this)
5145 __releasedControl = TABLE_VIEW_ITEM_PRESSED_ITEM;
5147 else if (&source == GetLabelCore(__pItemAnnex))
5149 __releasedControl = TABLE_VIEW_ITEM_PRESSED_ANNEX;
5151 else if (IsIndividualSelectionEnabled(source))
5153 __releasedControl = TABLE_VIEW_ITEM_PRESSED_INDIVIDUAL;
5157 __releasedControl = TABLE_VIEW_ITEM_PRESSED_NONE;
5159 FireItemTouchReleased(false);
5162 else if (keyCode == _KEY_LEFT || keyCode == _KEY_RIGHT)
5171 _TableViewItem::OnFocusModeStateChanged(void)
5177 _TableViewItem::ResetItemState(void)
5179 __itemSelected = false;
5180 __drawingStatus = TABLE_VIEW_ITEM_DRAWING_STATUS_NORMAL;
5181 __releasedControl = TABLE_VIEW_ITEM_PRESSED_NONE;
5183 if (__annexStyle == TABLE_VIEW_ANNEX_STYLE_DETAILED)
5185 __isSelectedDetailButton = false;
5188 SetItemChanged(true);
5193 _TableViewItem::GetPreviousFocusChildControl(const _Control& source)
5195 _Control* pParentControl = null;
5196 float sourcePosition = 0.0f;
5198 _Control* pSource = const_cast<_Control*>(&source);
5199 _TableViewItem* pItem = dynamic_cast<_TableViewItem*>(pSource);
5202 pParentControl = pSource;
5203 sourcePosition = pParentControl->GetBoundsF().width;
5207 pParentControl = source.GetParent();
5208 sourcePosition = source.GetBoundsF().x;
5211 if (pParentControl == null)
5216 int childControlCount = pParentControl->GetChildCount();
5217 float position = 0.0f;
5218 _Control* destination = null;
5220 for (int i=0; i<childControlCount; i++)
5222 _Control* pChildControl = pParentControl->GetChild(i);
5223 if (pChildControl != null && pChildControl->IsFocusable())
5225 float childPosition = pChildControl->GetBoundsF().x;
5226 if (childPosition < sourcePosition)
5228 if (childPosition > position)
5230 position = childPosition;
5231 destination = pChildControl;
5233 else if (_FloatCompare(position, 0.0f))
5235 position = childPosition;
5236 destination = pChildControl;
5245 _TableViewItem::GetNextFocusChildControl(const _Control& source)
5247 _Control* pParentControl = null;
5248 float sourcePosition = 0.0f;
5250 _Control* pSource = const_cast<_Control*>(&source);
5251 _TableViewItem* pItem = dynamic_cast<_TableViewItem*>(pSource);
5254 pParentControl = pSource;
5255 sourcePosition = 0.0f;
5259 pParentControl = source.GetParent();
5260 sourcePosition = source.GetBoundsF().x;
5263 if (pParentControl == null)
5268 int childControlCount = pParentControl->GetChildCount();
5269 float position = 0.0f;
5270 _Control* destination = null;
5272 for (int i=0; i<childControlCount; i++)
5274 _Control* pChildControl = pParentControl->GetChild(i);
5275 if (pChildControl != null && pChildControl->IsFocusable())
5277 float childPosition = pChildControl->GetBoundsF().x;
5278 if (childPosition > sourcePosition)
5280 if (childPosition < position)
5282 position = childPosition;
5283 destination = pChildControl;
5285 else if (_FloatCompare(position, 0.0f))
5287 position = childPosition;
5288 destination = pChildControl;
5297 _TableViewItem::IsChildControlFocusManage(void) const
5303 _TableViewItem::SetSimpleLastItemEnabled(bool enable)
5305 __isSimpleLastItem = enable;
5309 _TableViewItem::SetSectionItem(bool isSectionItem)
5311 __isSectionItem = isSectionItem;
5315 _TableViewItem::SetTouchPressOnScroll(bool isTouch)
5317 __isTouchPressOnScroll = isTouch;
5321 _TableViewItem::IsTouchPressOnScroll(void) const
5323 return __isTouchPressOnScroll;
5327 _TableViewItem::OnVisibleStateChanged(void)
5329 if (IsFocused() && !GetVisibleState())
5336 _TableViewItem::OnAncestorEnableStateChanged(const _Control& control)
5338 if (IsFocused() && !IsEnabled())
5345 _TableViewItem::OnAncestorVisibleStateChanged(const _Control& control)
5347 if (IsFocused() && !IsVisible())
5354 _TableViewItem::OnFocusableStateChanged(bool focusableState)
5356 if (IsFocused() && !focusableState)
5363 _TableViewItem::SetPublicLabelUpdate(bool resetPublicLabelUpdate)
5365 if (__pAccessibilityElement)
5367 __pAccessibilityElement->SetPublicLabelUpdate(resetPublicLabelUpdate);
5372 _TableViewItem::GetChildAccessibilityLabelContent(const _Control& source)
5374 String accessibilityLabel = L"";
5375 String space = L" ";
5377 if (IsIndividualSelectionEnabled(source))
5379 return accessibilityLabel;
5382 if (!source.IsVisible() || !source.GetEnableState())
5384 return accessibilityLabel;
5387 _Control* pSource = const_cast<_Control*>(&source);
5391 _AccessibilityContainer* pContainer = pSource->GetAccessibilityContainer();
5392 LinkedListT<_AccessibilityElement*> accessibilityElements;
5393 _AccessibilityElement* pElement = null;
5397 pContainer->GetElements(accessibilityElements);
5398 int elementCount = accessibilityElements.GetCount();
5400 for (int i = 0; i < elementCount; i++)
5402 if (accessibilityElements.GetAt(i, pElement) == E_SUCCESS)
5404 accessibilityLabel += pElement->GetLabel();
5405 accessibilityLabel += space;
5411 //check for children
5412 int childControlCount = source.GetChildCount();
5414 for (int i = 0; i < childControlCount; i++)
5416 _Control* pChildControl = source.GetChild(i);
5418 if (pChildControl == null)
5423 accessibilityLabel += GetChildAccessibilityLabelContent(*pChildControl);
5426 return accessibilityLabel;
5430 _TableViewItem::DeactivateChildAccessibilityContainer(const _Control& source)
5432 _Control* pControl = const_cast<_Control*>(&source);
5436 _AccessibilityContainer* pContainer = pControl->GetAccessibilityContainer();
5440 if (__individualSelectionControls.Contains(source))
5442 pContainer->Activate(true);
5446 pContainer->Activate(false);
5451 //check for children
5452 int childControlCount = source.GetChildCount();
5454 for (int i = 0; i < childControlCount; i++)
5456 _Control* pChildControl = source.GetChild(i);
5458 if (pChildControl == null)
5463 DeactivateChildAccessibilityContainer(*pChildControl);
5467 }}} // Tizen::Ui::Controls