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* label)
736 _LabelImpl* pImpl = _LabelImpl::GetInstance(*label);
737 return &pImpl->GetCore();
741 _TableViewItem::ExposeContextItem(FloatRectangle itemBounds, float targetWidth)
744 if (__pDimLayer == null)
746 if (CreateItemDimLayer() != E_SUCCESS)
752 SetBounds(itemBounds);
756 if ((itemBounds.width <= 0) || (itemBounds.width >= targetWidth)) // +++ check floating
763 float rightMargin = 0.0f;
764 float dimLayerOpacity = 0.0f;
766 GET_SHAPE_CONFIG(TABLEVIEW::CONTEXTITEM_RIGHT_MARGIN, _CONTROL_ORIENTATION_PORTRAIT, rightMargin);
768 dimLayerOpacity = BACKGROUND_DIMMED_OPACITY - ((itemBounds.width * BACKGROUND_DIMMED_OPACITY) / (targetWidth - rightMargin));
769 dimLayerOpacity = ((dimLayerOpacity < 0) ? 0 : dimLayerOpacity); // +++ check floating
771 __pDimLayer->SetBounds(FloatRectangle(0.0f, 0.0f, itemBounds.width, itemBounds.height));
772 __pDimLayer->SetBackgroundColor(Color(0.0f, 0.0f, 0.0f, dimLayerOpacity * 0xff));
775 __pDimLayer->SetVisibleState(visible);
780 _TableViewItem::DrawItemDimLayer(bool visible)
782 if (__pDimLayer == null)
784 if (CreateItemDimLayer() != E_SUCCESS)
792 FloatDimension itemSize = GetSizeF();
793 __pDimLayer->SetBounds(FloatRectangle(0.0f, 0.0f, itemSize.width, itemSize.height));
794 __pDimLayer->SetBackgroundColor(Color(0, 0, 0, BACKGROUND_DISABLED_OPACITY * 0xff));
797 __pDimLayer->SetVisibleState(visible);
801 _TableViewItem::SetItemWidth(float width)
807 _TableViewItem::SetItemBackgroundBitmap(ListItemState itemState, const Bitmap* pBitmap)
809 Bitmap* pCopyBitmap = null;
811 pCopyBitmap = _BitmapImpl::CloneN(*pBitmap);
812 SysTryReturn(NID_UI_CTRL, pCopyBitmap != null, false, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
814 delete __pItemBgBitmap[itemState];
815 __pItemBgBitmap[itemState] = pCopyBitmap;
818 if (__pItemBgBitmap[TABLE_VIEW_ITEM_DRAWING_STATUS_NORMAL] == null &&
819 __pItemBgBitmap[TABLE_VIEW_ITEM_DRAWING_STATUS_PRESSED] == null &&
820 __pItemBgBitmap[TABLE_VIEW_ITEM_DRAWING_STATUS_HIGHLIGHTED] == null)
822 if (__pBitmapVisualElement != null)
824 __pBitmapVisualElement->Destroy();
825 __pBitmapVisualElement = null;
830 if (__pBitmapVisualElement == null)
832 FloatRectangle bounds = GetBoundsF();
833 result r = E_SUCCESS;
835 __pBitmapVisualElement = new (std::nothrow) _VisualElement();
836 SysTryCatch(NID_UI_CTRL, __pBitmapVisualElement != null, , E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
838 r = __pBitmapVisualElement->Construct();
839 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
841 __pBitmapVisualElement->SetSurfaceOpaque(false);
842 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Failed to set surface opaque.", GetErrorMessage(r));
844 __pBitmapVisualElement->SetImplicitAnimationEnabled(false);
845 __pBitmapVisualElement->SetBounds(FloatRectangle(0.0f, 0.0f, bounds.width, bounds.height));
846 __pBitmapVisualElement->SetShowState(true);
848 GetVisualElement()->AttachChild(*__pBitmapVisualElement);
852 SetItemChanged(true);
855 if (__pBitmapVisualElement != null)
857 __pBitmapVisualElement->RemoveAllAnimations();
858 __pBitmapVisualElement->SetAnimationProvider(null);
859 __pBitmapVisualElement->Destroy();
860 __pBitmapVisualElement = null;
865 Tizen::Graphics::Bitmap*
866 _TableViewItem::GetItemBackgroundBitmap(ListItemState itemState) const
868 return __pItemBgBitmap[itemState];
872 _TableViewItem::SetItemBackgroundColor(ListItemState itemState, const Color bgColor)
874 if (__colorItemBg[itemState] == bgColor)
879 __colorItemBg[itemState] = bgColor;
881 SetItemChanged(true);
885 _TableViewItem::GetItemBackgroundColor(ListItemState itemState) const
887 return __colorItemBg[itemState];
891 _TableViewItem::SetItemStyle(TableViewAnnexStyle style)
893 if (__annexStyle == style)
898 __annexStyle = style;
902 _TableViewItem::SetSelectionStyle(TableViewItemSelectionStyle style)
904 __selectionStyle = style;
909 TableViewItemSelectionStyle
910 _TableViewItem::GetSelectionStyle(void) const
912 return __selectionStyle;
916 _TableViewItem::GetItemHeight(void) const
918 return GetSizeF().height;
922 _TableViewItem::SetItemHeight(int itemHeight)
924 SetItemHeight(_CoordinateSystemUtils::ConvertToFloat(itemHeight));
928 _TableViewItem::SetItemHeight(float itemHeight)
930 if (_FloatCompare(GetSizeF().height, itemHeight))
935 SetSize(FloatDimension(GetSizeF().width, itemHeight));
939 _TableViewItem::SetChecked(bool checked)
941 if (__checkedState == checked)
946 __checkedState = checked;
948 SetItemChanged(true);
952 _TableViewItem::IsChecked(void) const
954 return __checkedState;
958 _TableViewItem::SetCheckedAnimationEnabled(bool enabled)
960 if (__isCheckedAnimationEnabled == enabled)
965 __isCheckedAnimationEnabled = enabled;
967 if (__isCheckedAnimationEnabled == false)
969 StopCheckBoxAnimation();
974 _TableViewItem::SetItemEnabled(bool enabled)
976 if (__enabledState == enabled)
981 __enabledState = enabled;
983 SetEnableState(enabled);
985 SetItemChanged(true);
993 _TableViewItem::IsItemEnabled(void) const
995 return __enabledState;
999 _TableViewItem::SetItemType(const TableViewItemType itemType)
1001 if (__itemType == itemType)
1006 __itemType = itemType;
1008 if (__pContextItem != null)
1010 __pContextItem->SetItemType(__itemType);
1013 if (itemType == TABLE_VIEW_ITEM_TYPE_TITLE)
1016 GET_COLOR_CONFIG(TABLEVIEW::ITEM_BG_PRESSED, titleColor);
1017 if (titleColor == __colorItemBg[TABLE_VIEW_ITEM_DRAWING_STATUS_PRESSED])
1019 GET_COLOR_CONFIG(TABLEVIEW::GROUPITEM_BG_PRESSED, __colorItemBg[TABLE_VIEW_ITEM_DRAWING_STATUS_PRESSED]);
1021 GetAccessibilityContainer()->Activate(true);
1026 _TableViewItem::SetItemIndex(int groupIndex, int itemIndex)
1028 __itemGroupIndex = groupIndex;
1029 __itemIndex = itemIndex;
1033 _TableViewItem::GetItemIndex(int& groupIndex, int& itemIndex) const
1035 groupIndex = __itemGroupIndex;
1036 itemIndex = __itemIndex;
1041 _TableViewItem::GetItemType(void) const
1047 _TableViewItem::IsReorderMode(void) const
1049 return __reorderMode;
1053 _TableViewItem::SetReorderMode(bool enabled)
1055 __reorderMode = enabled;
1059 _TableViewItem::SetAppInfo(const void* pAppInfo)
1061 __pAppInfo = const_cast<void*>(pAppInfo);
1065 _TableViewItem::GetAppInfo(void) const
1071 _TableViewItem::SetItemChanged(bool changed)
1073 __itemChanged = changed;
1077 _TableViewItem::IsItemChanged(void) const
1079 return __itemChanged;
1083 _TableViewItem::IsAnnexOnOffSliding(void)
1085 return __annexOnOffHandlerMoved;
1089 _TableViewItem::GetItemStyle(void) const
1091 return __annexStyle;
1095 _TableViewItem::DrawItem(FloatRectangle& rcItem, ListItemState itemState, bool itemDivider)
1101 _TableViewItem::SetItemTapSoundEnabled(bool tapSoundEnabled)
1103 bool oldValue = __isItemTapSoundEnabled;
1104 __isItemTapSoundEnabled = tapSoundEnabled;
1109 _TableViewItem::GetItemTapSoundEnabled(void)
1111 return __isItemTapSoundEnabled;
1115 _TableViewItem::DrawAnnexFocus(void)
1119 __pItemAnnex->SetFocus();
1124 Tizen::Graphics::Canvas*
1125 _TableViewItem::OnCanvasRequestedN(const Tizen::Graphics::FloatRectangle& bounds)
1127 Canvas* pCanvas = null;
1129 if (__pBitmapVisualElement != null && __pBitmapVisualElement->GetImageSource().IsEmpty())
1131 Bitmap* pDrawBitmap = __pItemBgBitmap[__drawingStatus];
1132 if (pDrawBitmap != null)
1134 pCanvas = __pBitmapVisualElement->GetCanvasN();
1135 SysTryCatch(NID_UI_CTRL, pCanvas != null, , E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
1136 pCanvas->SetBackgroundColor(Color(0, 0, 0, 0));
1139 pDrawBitmap->IsNinePatchedBitmap();
1140 DrawBitmap(*pCanvas, FloatRectangle(0.0f, 0.0f, bounds.width, bounds.height), *pDrawBitmap);
1150 _TableViewItem::FireItemEvent(bool selectedItem)
1154 || __itemType == TABLE_VIEW_ITEM_TYPE_HEADER
1155 || __itemType == TABLE_VIEW_ITEM_TYPE_FOOTER)
1160 _TableView* pParent = dynamic_cast<_TableView*>(GetParent());
1161 if (pParent == null)
1166 TableViewNotifyType eventType = TABLEVIEW_NOTIFY_TYPE_SELECTED_ITEM;
1168 if ((__annexStyle == TABLE_VIEW_ANNEX_STYLE_MARK)
1169 || (__annexStyle == TABLE_VIEW_ANNEX_STYLE_RADIO)
1170 || (__annexStyle == TABLE_VIEW_ANNEX_STYLE_ONOFF_SLIDING))
1174 eventType = TABLEVIEW_NOTIFY_TYPE_ANNEX_CHECK;
1178 eventType = TABLEVIEW_NOTIFY_TYPE_ANNEX_UNCHECK;
1181 else if (__annexStyle == TABLE_VIEW_ANNEX_STYLE_DETAILED)
1185 eventType = TABLEVIEW_NOTIFY_TYPE_ANNEX_MORE;
1188 else if (__annexStyle == TABLE_VIEW_ANNEX_STYLE_ONOFF_SLIDING_WITH_DIVIDER)
1192 eventType = TABLEVIEW_NOTIFY_TYPE_SELECTED_ITEM;
1198 eventType = TABLEVIEW_NOTIFY_TYPE_ANNEX_CHECK;
1202 eventType = TABLEVIEW_NOTIFY_TYPE_ANNEX_UNCHECK;
1207 if (__isItemTapSoundEnabled)
1209 if (!__isTabSoundPlayed)
1211 PLAY_FEEDBACK(_RESOURCE_FEEDBACK_PATTERN_TAP, this);
1215 __isTabSoundPlayed = false;
1216 __checkItemHeightNeeded = true;
1218 int groupIndex = -1;
1220 GetItemIndex(groupIndex, itemIndex);
1221 pParent->FireTableViewItemEvent(groupIndex, itemIndex, eventType, this);
1225 _TableViewItem::FireItemSweepEvent(TableViewSweepDirection direction)
1227 if (HasParent() == false)
1232 _TableView* pParent = dynamic_cast<_TableView*>(GetParent());
1233 if (pParent == null)
1238 int groupIndex = -1;
1240 GetItemIndex(groupIndex, itemIndex);
1242 pParent->FireTableViewItemSweepEvent(groupIndex, itemIndex, direction);
1246 _TableViewItem::OnTouchPressed(const _Control& source, const _TouchInfo& touchinfo)
1248 __isTouchCancelOnPressRelease = false;
1250 if (IsContextItem() ||
1251 __isContextItemActivated ||
1252 IsAnimationPlaying() ||
1258 if (IsTouchPressOnScroll())
1263 __annexOnOffHandlerMoved = false;
1264 __touchStartPosition = touchinfo.GetCurrentPosition();
1266 if (&source == this)
1268 __pressedControl = TABLE_VIEW_ITEM_PRESSED_ITEM;
1270 else if (&source == GetLabelCore(__pItemAnnex))
1272 __pressedControl = TABLE_VIEW_ITEM_PRESSED_ANNEX;
1274 if (__annexStyle == TABLE_VIEW_ANNEX_STYLE_ONOFF_SLIDING ||
1275 __annexStyle == TABLE_VIEW_ANNEX_STYLE_ONOFF_SLIDING_WITH_DIVIDER)
1277 __annexTouchStartPosition = touchinfo.GetCurrentPosition().x;
1280 else if (IsIndividualSelectionEnabled(source))
1282 __pressedControl = TABLE_VIEW_ITEM_PRESSED_INDIVIDUAL;
1286 __pressedControl = TABLE_VIEW_ITEM_PRESSED_NONE;
1289 if (__isReleasedTimerEnabled)
1291 StopTouchReleasedTimer();
1293 _TableView* pParent = dynamic_cast<_TableView*>(GetParent());
1294 if (pParent != null)
1296 int groupIndex = -1;
1298 GetItemIndex(groupIndex, itemIndex);
1299 pParent->FireItemTouchReleasedEventDuringPressing(groupIndex, itemIndex);
1304 if (!IsIndividualSelectionEnabled(source))
1306 __itemSelected = true;
1307 if (unlikely((_AccessibilityManager::IsActivated())))
1309 FireItemTouchPressed();
1313 StartTouchPressedTimer(source, touchinfo);
1322 _TableViewItem::OnTouchReleased(const _Control& source, const _TouchInfo& touchinfo)
1324 if (IsReorderMode())
1329 if (IsTouchPressOnScroll())
1331 SetTouchPressOnScroll(false);
1335 if (&source == this)
1337 __releasedControl = TABLE_VIEW_ITEM_PRESSED_ITEM;
1339 else if (&source == GetLabelCore(__pItemAnnex))
1341 __releasedControl = TABLE_VIEW_ITEM_PRESSED_ANNEX;
1343 else if (IsIndividualSelectionEnabled(source))
1345 __releasedControl = TABLE_VIEW_ITEM_PRESSED_INDIVIDUAL;
1349 __releasedControl = TABLE_VIEW_ITEM_PRESSED_NONE;
1352 __isTabSoundPlayed = IS_PLAYED_FEEDBACK();
1354 if (!__itemTouchMoved && __isPressedTimerEnabled)
1356 StopTouchPressedTimer();
1358 if (!IsContextItem())
1360 FireItemTouchPressed();
1363 StartTouchReleasedTimer();
1367 FireItemTouchReleased();
1372 _TableViewItem::FireItemTouchPressed()
1374 if (__isTouchCancelOnPressRelease == true)
1379 if (__pressedControl == TABLE_VIEW_ITEM_PRESSED_ITEM)
1381 __drawingStatus = TABLE_VIEW_ITEM_DRAWING_STATUS_PRESSED;
1382 SetItemChanged(true);
1385 else if (__pressedControl == TABLE_VIEW_ITEM_PRESSED_ANNEX)
1387 if (__annexStyle == TABLE_VIEW_ANNEX_STYLE_DETAILED)
1389 __drawingStatus = TABLE_VIEW_ITEM_DRAWING_STATUS_NORMAL;
1390 __isSelectedDetailButton = true;
1393 else if (__annexStyle == TABLE_VIEW_ANNEX_STYLE_ONOFF_SLIDING ||
1394 __annexStyle == TABLE_VIEW_ANNEX_STYLE_ONOFF_SLIDING_WITH_DIVIDER)
1396 __drawingStatus = TABLE_VIEW_ITEM_DRAWING_STATUS_NORMAL;
1400 __drawingStatus = TABLE_VIEW_ITEM_DRAWING_STATUS_PRESSED;
1401 SetItemChanged(true);
1407 if (__pressedControl != TABLE_VIEW_ITEM_PRESSED_INDIVIDUAL)
1409 __drawingStatus = TABLE_VIEW_ITEM_DRAWING_STATUS_PRESSED;
1410 SetItemChanged(true);
1417 _TableViewItem::FireItemTouchReleased()
1419 if (__isTouchCancelOnPressRelease == true)
1424 bool fireItemEvent = false;
1425 bool selectedItem = true;
1427 __drawingStatus = TABLE_VIEW_ITEM_DRAWING_STATUS_NORMAL;
1429 if (__itemSelected == true)
1431 bool checked = IsChecked();
1432 fireItemEvent = true;
1434 if (__releasedControl == TABLE_VIEW_ITEM_PRESSED_ITEM)
1436 if ((__annexStyle == TABLE_VIEW_ANNEX_STYLE_RADIO)
1437 || (__annexStyle == TABLE_VIEW_ANNEX_STYLE_ONOFF_SLIDING))
1439 SetChecked(!checked);
1441 else if (__annexStyle == TABLE_VIEW_ANNEX_STYLE_MARK)
1443 SetChecked(!checked);
1444 SetCheckedAnimationEnabled(!checked);
1447 else if (__releasedControl == TABLE_VIEW_ITEM_PRESSED_ANNEX)
1449 if (__annexStyle == TABLE_VIEW_ANNEX_STYLE_DETAILED)
1451 __isSelectedDetailButton = false;
1453 selectedItem = false;
1455 else if (__annexStyle == TABLE_VIEW_ANNEX_STYLE_ONOFF_SLIDING ||
1456 __annexStyle == TABLE_VIEW_ANNEX_STYLE_ONOFF_SLIDING_WITH_DIVIDER)
1458 bool isPreviousChecked = IsChecked();
1459 AdjustAnnexOnOffHandlerPosition();
1460 selectedItem = false;
1461 if (isPreviousChecked == IsChecked())
1463 fireItemEvent = false;
1468 SetChecked(!checked);
1469 SetCheckedAnimationEnabled(!checked);
1474 if (__releasedControl != TABLE_VIEW_ITEM_PRESSED_INDIVIDUAL)
1476 if ((__annexStyle == TABLE_VIEW_ANNEX_STYLE_MARK)
1477 || (__annexStyle == TABLE_VIEW_ANNEX_STYLE_RADIO)
1478 || (__annexStyle == TABLE_VIEW_ANNEX_STYLE_ONOFF_SLIDING))
1480 SetChecked(!checked);
1481 SetCheckedAnimationEnabled(!checked);
1486 fireItemEvent = false;
1490 SetItemChanged(true);
1495 if (__releasedControl == TABLE_VIEW_ITEM_PRESSED_ANNEX)
1497 if (__annexStyle == TABLE_VIEW_ANNEX_STYLE_ONOFF_SLIDING ||
1498 __annexStyle == TABLE_VIEW_ANNEX_STYLE_ONOFF_SLIDING_WITH_DIVIDER)
1500 bool isPreviousChecked = IsChecked();
1501 AdjustAnnexOnOffHandlerPosition();
1502 fireItemEvent = true;
1503 if (isPreviousChecked == IsChecked())
1505 fireItemEvent = false;
1511 __itemSelected = false;
1512 __annexOnOffHandlerMoved = false;
1513 __itemTouchMoved = false;
1517 FireItemEvent(selectedItem);
1522 _TableViewItem::OnTouchMoved(const _Control& source, const _TouchInfo& touchinfo)
1524 if (IsReorderMode())
1529 if (IsTouchPressOnScroll())
1531 SetTouchPressOnScroll(false);
1534 if (__isPressedTimerEnabled)
1536 StopTouchPressedTimer();
1539 bool retVal = false;
1541 if (&source == this)
1543 __itemSelected = false;
1544 __drawingStatus = TABLE_VIEW_ITEM_DRAWING_STATUS_NORMAL;
1546 SetItemChanged(true);
1549 else if (&source == GetLabelCore(__pItemAnnex))
1551 if (__annexStyle == TABLE_VIEW_ANNEX_STYLE_DETAILED)
1553 __isSelectedDetailButton = false;
1554 __itemSelected = false;
1557 else if (__annexStyle == TABLE_VIEW_ANNEX_STYLE_ONOFF_SLIDING ||
1558 __annexStyle == TABLE_VIEW_ANNEX_STYLE_ONOFF_SLIDING_WITH_DIVIDER)
1560 __annexOnOffHandlerMoved = true;
1561 DrawAnnexOnOffHandler(touchinfo.GetCurrentPosition().x);
1566 __itemSelected = false;
1567 __drawingStatus = TABLE_VIEW_ITEM_DRAWING_STATUS_NORMAL;
1569 SetItemChanged(true);
1575 if (!IsIndividualSelectionEnabled(source))
1577 __itemSelected = false;
1578 __drawingStatus = TABLE_VIEW_ITEM_DRAWING_STATUS_NORMAL;
1580 SetItemChanged(true);
1585 __itemTouchMoved = true;
1591 _TableViewItem::OnTouchCanceled(const _Control& source, const _TouchInfo& touchinfo)
1593 __isTouchCancelOnPressRelease = true;
1595 if (__isPressedTimerEnabled)
1597 StopTouchPressedTimer();
1600 __annexOnOffHandlerMoved = false;
1601 __itemTouchMoved = false;
1605 if (&source != this)
1613 _UiTouchEventDelivery
1614 _TableViewItem::OnPreviewTouchPressed(const _Control& source, const _TouchInfo& touchinfo)
1616 if (IsTouchPressOnScroll())
1618 SetTouchPressOnScroll(false);
1619 return _UI_TOUCH_EVENT_DELIVERY_NO;
1621 return _UI_TOUCH_EVENT_DELIVERY_FORCED_YES;
1624 _UiTouchEventDelivery
1625 _TableViewItem::OnPreviewTouchReleased(const _Control& source, const _TouchInfo& touchinfo)
1627 return _UI_TOUCH_EVENT_DELIVERY_FORCED_YES;
1630 _UiTouchEventDelivery
1631 _TableViewItem::OnPreviewTouchMoved(const _Control& source, const _TouchInfo& touchinfo)
1633 return _UI_TOUCH_EVENT_DELIVERY_YES;
1636 _UiTouchEventDelivery
1637 _TableViewItem::OnPreviewTouchCanceled(const _Control& source, const _TouchInfo& touchinfo)
1639 return _UI_TOUCH_EVENT_DELIVERY_FORCED_YES;
1643 _TableViewItem::OnDraw(void)
1645 if (IsItemChanged() == true)
1647 DrawItemBackground();
1651 DrawSectionStyleBackgroundCover();
1653 SetItemChanged(false);
1658 _TableViewItem::OnChildAttached(const _Control& child)
1660 _Control* pControl = const_cast<_Control*>(&child);
1661 _AccessibilityContainer* pContainer = pControl->GetAccessibilityContainer();
1663 if (__individualSelectionControls.Contains(child))
1665 pContainer->Activate(true);
1669 pContainer->Activate(false);
1671 if (!(pControl == static_cast<_Control*>(__pItemAnnexLeftDivider)
1672 || pControl == static_cast<_Control*>(__pItemAnnexRightDivider)
1673 || pControl == static_cast<_Control*>(__pItemCover)
1674 || pControl == static_cast<_Control*>(__pItemDivider)
1675 || pControl== static_cast<_Control*>(__pItemTopDivider)))
1677 GetAccessibilityContainer()->Activate(true);
1681 DeactivateChildAccessibilityContainer(child);
1683 pControl->SetTouchPressThreshold(SENSITIVE);
1685 FloatRectangle bounds = child.GetBoundsF();
1687 if (__pDrawingProperty != null && __pDrawingProperty->groupedLookEnabled)
1689 float groupedBarMargin = 0.0f;
1690 GET_SHAPE_CONFIG(TABLEVIEW::GROUPITEM_BAR_WIDTH, _CONTROL_ORIENTATION_PORTRAIT, groupedBarMargin);
1692 bounds.x += groupedBarMargin;
1695 if ((__annexStyle == TABLE_VIEW_ANNEX_STYLE_MARK) || (__annexStyle == TABLE_VIEW_ANNEX_STYLE_RADIO))
1697 if (GetLabelCore(__pItemAnnex) == &child ||
1698 GetLabelCore(__pSimpleItemBitmap) == &child ||
1699 GetLabelCore(__pSimpleItemText) == &child)
1704 float leftMargin = 0.0f;
1705 float annexWidth = 0.0f;
1707 GET_SHAPE_CONFIG(TABLEVIEW::ITEM_LEFT_MARGIN, _CONTROL_ORIENTATION_PORTRAIT, leftMargin);
1708 GET_SHAPE_CONFIG(TABLEVIEW::ITEM_ANNEX_WIDTH, _CONTROL_ORIENTATION_PORTRAIT, annexWidth);
1710 bounds.x += (leftMargin * 2) + annexWidth;
1713 pControl->SetBounds(bounds);
1717 _TableViewItem::OnChildDetached(const _Control& child)
1719 if (__individualSelectionControls.Contains(child))
1721 __individualSelectionControls.Remove(child, false);
1724 _Label* pSimpleItemTextCore = GetLabelCore(__pSimpleItemText);
1725 _Label* pSimpleItemBitmapCore = GetLabelCore(__pSimpleItemBitmap);
1727 if (&child == pSimpleItemTextCore)
1729 __pSimpleItemText = null;
1732 if (&child == pSimpleItemBitmapCore)
1734 __pSimpleItemBitmap = null;
1739 _TableViewItem::OnTimerExpired(Tizen::Base::Runtime::Timer& timer)
1741 result r = E_SUCCESS;
1743 if (&timer == __pCheckedTimer)
1745 if (__checkedCount < MAX_CHECKED_COUNT)
1747 r = __pCheckedTimer->Start(CHECKED_ANIMATION_DURATION);
1748 SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
1751 r = PlayCheckBoxAnimation();
1752 SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
1754 if (__checkedCount < MAX_CHECKED_COUNT)
1761 __isCheckedAnimationEnabled = false;
1762 __isCheckedTimerEnabled = false;
1765 else if (&timer == __pPressedTimer)
1767 __isPressedTimerEnabled = false;
1768 FireItemTouchPressed();
1770 else if (&timer == __pReleasedTimer)
1772 __isReleasedTimerEnabled = false;
1773 FireItemTouchReleased();
1778 _TableViewItem::StartTouchPressedTimer(const _Control& source, const _TouchInfo& touchinfo)
1780 result r = E_SUCCESS;
1782 if (__pPressedTimer == null)
1784 __pPressedTimer = new (std::nothrow) Timer();
1785 SysTryCatch(NID_UI_CTRL, __pPressedTimer != null, r = E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
1787 r = __pPressedTimer->Construct(*this);
1788 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage);
1791 if (__isPressedTimerEnabled == false)
1793 r = __pPressedTimer->Start(TOUCH_PRESSED_DURATION);
1794 SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "Propagating.");
1796 __isPressedTimerEnabled = true;
1802 if (__isPressedTimerEnabled && __pPressedTimer != null)
1804 __pPressedTimer->Cancel();
1807 delete __pPressedTimer;
1808 __pPressedTimer = null;
1814 _TableViewItem::StopTouchPressedTimer(bool forceStop)
1816 result r = E_SUCCESS;
1818 if (__pPressedTimer == null)
1823 if (__isPressedTimerEnabled || forceStop)
1825 r = __pPressedTimer->Cancel();
1826 SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
1829 __isPressedTimerEnabled = false;
1835 _TableViewItem::StartTouchReleasedTimer()
1837 result r = E_SUCCESS;
1839 if (__pReleasedTimer == null)
1841 __pReleasedTimer = new (std::nothrow) Timer();
1842 SysTryCatch(NID_UI_CTRL, __pReleasedTimer != null, r = E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
1845 r = __pReleasedTimer->Construct(*this);
1846 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage);
1849 if (!__isReleasedTimerEnabled)
1851 r = __pReleasedTimer->Start(TOUCH_RELEASED_DURATION);
1852 SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "Propagating.");
1854 __isReleasedTimerEnabled = true;
1859 if (__isReleasedTimerEnabled && __pReleasedTimer != null)
1861 __pReleasedTimer->Cancel();
1864 delete __pReleasedTimer;
1865 __pReleasedTimer = null;
1871 _TableViewItem::StopTouchReleasedTimer(bool forceStop)
1873 result r = E_SUCCESS;
1875 if (__pReleasedTimer == null)
1880 if (__isReleasedTimerEnabled || forceStop)
1882 r = __pReleasedTimer->Cancel();
1883 SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
1886 __isReleasedTimerEnabled = false;
1892 _TableViewItem::OnAncestorInputEnableStateChanged(const _Control& control)
1894 if (__isPressedTimerEnabled)
1896 StopTouchPressedTimer();
1899 __annexOnOffHandlerMoved = false;
1900 __itemTouchMoved = false;
1902 __itemSelected = false;
1903 __drawingStatus = TABLE_VIEW_ITEM_DRAWING_STATUS_NORMAL;
1905 if (__annexStyle == TABLE_VIEW_ANNEX_STYLE_DETAILED)
1907 __isSelectedDetailButton = false;
1910 SetItemChanged(true);
1915 _TableViewItem::StartCheckBoxAnimation(void)
1917 result r = E_SUCCESS;
1919 if (__pCheckedTimer == null)
1921 __pCheckedTimer = new (std::nothrow) Timer();
1922 SysTryCatch(NID_UI_CTRL, __pCheckedTimer != null, r = E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
1925 r = __pCheckedTimer->Construct(*this);
1926 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage);
1929 if (__isCheckedTimerEnabled == false)
1931 r = __pCheckedTimer->Start(CHECKED_ANIMATION_DURATION);
1932 SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "Propagating.");
1934 __isCheckedTimerEnabled = true;
1940 if (__isCheckedTimerEnabled)
1942 __pCheckedTimer->Cancel();
1945 delete __pCheckedTimer;
1946 __pCheckedTimer = null;
1952 _TableViewItem::StopCheckBoxAnimation(void)
1954 result r = E_SUCCESS;
1956 SysTryReturnVoidResult(NID_UI_CTRL, __pCheckedTimer != null, E_SYSTEM, "[%s] A system error has been occurred. Timer is invalid.", GetErrorMessage(E_SYSTEM));
1959 if (__isCheckedTimerEnabled)
1961 r = __pCheckedTimer->Cancel();
1962 SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
1966 __isCheckedAnimationEnabled = false;
1967 __isCheckedTimerEnabled = false;
1973 _TableViewItem::PlayCheckBoxAnimation(void)
1975 Bitmap* pCheckBox = null;
1976 Bitmap* pCheckBoxBg = null;
1977 Bitmap* pMergeBitmap = null;
1978 Canvas* pCanvas = null;
1979 result r = E_SUCCESS;
1981 FloatRectangle bounds;
1983 float annexWidth = 0.0f;
1984 float annexHeight = 0.0f;
1986 if (__drawingStatus == TABLE_VIEW_ITEM_DRAWING_STATUS_NORMAL)
1988 r = GET_BITMAP_CONFIG_N(TABLEVIEW::CHECKBOX_BG_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, pCheckBoxBg);
1990 else if ((__drawingStatus == TABLE_VIEW_ITEM_DRAWING_STATUS_PRESSED) || (__drawingStatus == TABLE_VIEW_ITEM_DRAWING_STATUS_HIGHLIGHTED))
1992 r = GET_BITMAP_CONFIG_N(TABLEVIEW::CHECKBOX_BG_PRESSED, BITMAP_PIXEL_FORMAT_ARGB8888, pCheckBoxBg);
1994 SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS) && (pCheckBoxBg != null), , E_SYSTEM, "[%s] Propagating.", GetErrorMessage(r));
1996 r = GET_BITMAP_CONFIG_N(TABLEVIEW::CHECKBOX_CHECK_MARK_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, pCheckBox);
1997 SysTryCatch(NID_UI_CTRL,(r == E_SUCCESS) && (pCheckBox != null), , E_SYSTEM, "[%s] Propagating.", GetErrorMessage(r));
1999 GET_SHAPE_CONFIG(TABLEVIEW::ITEM_ANNEX_WIDTH, _CONTROL_ORIENTATION_PORTRAIT, annexWidth);
2000 GET_SHAPE_CONFIG(TABLEVIEW::ITEM_ANNEX_HEIGHT, _CONTROL_ORIENTATION_PORTRAIT, annexHeight);
2002 bounds.SetBounds(0, 0, annexWidth, annexHeight);
2004 pCanvas = new (std::nothrow) Canvas();
2005 SysTryCatch(NID_UI_CTRL, pCanvas != null, , E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
2007 r = pCanvas->Construct(bounds);
2008 pCanvas->SetBackgroundColor(Color(0, 0, 0, 0));
2011 DrawBitmap(*pCanvas, CalculateAnnexBitmapBounds(annexWidth, annexHeight, *pCheckBoxBg), *pCheckBoxBg);
2013 __checkedBounds = CalculateAnnexBitmapBounds(annexWidth, annexHeight, *pCheckBox);
2014 if (IsChecked() == true)
2016 if (_BitmapImpl::CheckNinePatchedBitmapStrictly(*pCheckBox))
2018 FloatRectangle drawingRect(__checkedBounds.x, __checkedBounds.y, __checkedBounds.width, __checkedBounds.height);
2019 r = pCanvas->DrawNinePatchedBitmap(drawingRect, *pCheckBox); // +++ check floating
2023 FloatRectangle bitmapSourceRect(0.0f, 0.0f, pCheckBox->GetWidthF()*__checkedCount * 0.1, pCheckBox->GetHeightF());
2024 FloatRectangle drawingRect(__checkedBounds.x, __checkedBounds.y, __checkedBounds.width * __checkedCount * 0.1, __checkedBounds.height);
2025 r = pCanvas->DrawBitmap(drawingRect, *pCheckBox, bitmapSourceRect); // +++ check floating
2029 pMergeBitmap = new (std::nothrow) Bitmap();
2030 SysTryCatch(NID_UI_CTRL, pMergeBitmap != null, , E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
2032 pMergeBitmap->Construct(*pCanvas, bounds);
2033 _BitmapImpl::ConvertToNonpremultiplied(*pMergeBitmap, true);
2037 __pItemAnnex->SetBackgroundBitmap(*pMergeBitmap);
2038 __pItemAnnex->Invalidate(false);
2044 delete pMergeBitmap;
2051 _TableViewItem::SetItemLayoutEnabled(bool enabled)
2053 __isItemLayoutEnabled = enabled;
2057 _TableViewItem::GetItemLayoutEnabled(void)
2059 return __isItemLayoutEnabled;
2063 _TableViewItem::OnBoundsChanged(void)
2065 if (__checkItemHeightNeeded && HasParent())
2067 _TableView* pParent = dynamic_cast<_TableView*>(GetParent());
2068 if (pParent != null)
2070 int groupIndex = -1;
2072 GetItemIndex(groupIndex, itemIndex);
2074 pParent->CheckItemHeightAndRefreshLayout(groupIndex, itemIndex);
2077 __checkItemHeightNeeded = false;
2080 AdjustAnnexBounds();
2082 SetItemHighlightBounds(*__pHighlightVisualElement, CalculateItemHighlightBounds());
2084 if (__pHeaderFooterItemText != null)
2086 FloatRectangle textBounds = __pHeaderFooterItemText->GetBoundsF();
2087 textBounds.width = GetBoundsF().width;
2089 if (__itemType == TABLE_VIEW_ITEM_TYPE_FOOTER)
2091 textBounds.x -= __pDrawingProperty->scrollMargin;
2094 __pHeaderFooterItemText->SetBounds(textBounds);
2097 if (__pBitmapVisualElement != null)
2099 FloatRectangle bounds = GetBoundsF();
2100 __pBitmapVisualElement->SetBounds(FloatRectangle(0.0f, 0.0f, bounds.width, bounds.height));
2103 if (__pAccessibilityElement != null)
2105 __pAccessibilityElement->SetBounds(FloatRectangle(0.0f,0.0f, GetBoundsF().width, GetBoundsF().height));
2110 _TableViewItem::SetDrawingProperty(_ItemDrawingProperty* pDrawingProperty)
2113 SysTryReturnVoidResult(NID_UI_CTRL, pDrawingProperty != null, E_INVALID_ARG, "[%s] Invalid argument(s) is used. The pDrawingProperty is null.", GetErrorMessage(E_INVALID_ARG));
2115 __pDrawingProperty = pDrawingProperty;
2117 if (__pDrawingProperty->sectionStyleEnabled == true &&
2123 if (__pDrawingProperty->itemDividerEnabled)
2125 CreateItemDivider();
2131 _ItemDrawingProperty*
2132 _TableViewItem::GetDrawingProperty(void)
2134 return __pDrawingProperty;
2138 _TableViewItem::DrawItemBackground(void)
2140 Canvas* pCanvas = null;
2141 Bitmap* pDrawBitmap = __pItemBgBitmap[__drawingStatus];
2142 Color bgColor = __colorItemBg[__drawingStatus];
2143 FloatRectangle bounds = GetBoundsF();
2145 SetItemHighlightBounds(*__pHighlightVisualElement, CalculateItemHighlightBounds());
2146 __pHighlightVisualElement->SetBackgroundColor(_Colorf(0.0f, 0.0f, 0.0f, 0.0f));
2148 if (pDrawBitmap != null && __enabledState)
2150 if (__pBitmapVisualElement == null)
2155 String imagePath = null;
2156 if (_BitmapImpl::CheckNinePatchedBitmapStrictly(*pDrawBitmap) == false)
2158 imagePath = _BitmapImpl::GetInstance(*pDrawBitmap)->GetFileName();
2161 if (imagePath.IsEmpty() == false)
2163 __pBitmapVisualElement->SetBackgroundColor(_Colorf((float)bgColor.GetRed() /255, (float)bgColor.GetGreen() / 255, (float)bgColor.GetBlue() / 255, (float)bgColor.GetAlpha() / 255));
2164 __pBitmapVisualElement->SetImageSource(imagePath);
2168 pCanvas = __pBitmapVisualElement->GetCanvasN();
2169 SysTryCatch(NID_UI_CTRL, pCanvas != null, , E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
2170 pCanvas->SetBackgroundColor(Color(0, 0, 0, 0));
2173 DrawBitmap(*pCanvas, FloatRectangle(0.0f, 0.0f, bounds.width, bounds.height), *pDrawBitmap);
2177 if (IsContextItem())
2179 DrawContextItemBackground();
2181 else if (__pDrawingProperty->sectionStyleEnabled == true)
2183 DrawSectionStyleBackground();
2189 if (__itemType == TABLE_VIEW_ITEM_TYPE_HEADER || __itemType == TABLE_VIEW_ITEM_TYPE_FOOTER)
2191 SetBackgroundColor(Color(0, 0, 0, 0));
2192 __pHighlightVisualElement->SetBackgroundColor(_Colorf(0.0f, 0.0f, 0.0f, 0.0f));
2194 else if (__itemType == TABLE_VIEW_ITEM_TYPE_TITLE)
2196 __pHighlightVisualElement->SetBackgroundColor(_Colorf((float)bgColor.GetRed() / 255.0f, (float)bgColor.GetGreen() / 255.0f, (float)bgColor.GetBlue() / 255.0f, (float)bgColor.GetAlpha() / 255.0f));
2200 SetBackgroundColor(__colorItemBg[TABLE_VIEW_ITEM_DRAWING_STATUS_NORMAL]);
2202 __pHighlightVisualElement->SetBackgroundColor(_Colorf((float)bgColor.GetRed() / 255.0f, (float)bgColor.GetGreen() / 255.0f, (float)bgColor.GetBlue() / 255.0f, (float)bgColor.GetAlpha() / 255.0f));
2204 if (__pDrawingProperty->groupedLookEnabled == true)
2212 GET_COLOR_CONFIG(TABLEVIEW::ITEM_BG_DISABLED, bgColor);
2213 SetBackgroundColor(bgColor);
2214 __pHighlightVisualElement->SetBackgroundColor(_Colorf((float)bgColor.GetRed() / 255.0f, (float)bgColor.GetGreen() / 255.0f, (float)bgColor.GetBlue() / 255.0f, (float)bgColor.GetAlpha() / 255.0f));
2216 if (__pDrawingProperty->groupedLookEnabled == true)
2228 if (__pBitmapVisualElement != null)
2230 __pBitmapVisualElement->RemoveAllAnimations();
2231 __pBitmapVisualElement->SetAnimationProvider(null);
2232 __pBitmapVisualElement->Destroy();
2233 __pBitmapVisualElement = null;
2238 _TableViewItem::DrawGroupedLook(void)
2240 if (IsTitleStyleItem() || IsContextItem())
2246 Color outlineColor = __pDrawingProperty->dividerColor;
2248 float barWidth = 0.0f;
2250 Canvas* pCanvas = GetVisualElement()->GetCanvasN();
2251 SysTryReturnVoidResult(NID_UI_CTRL, pCanvas != null, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
2253 FloatRectangle bounds = GetBoundsF();
2254 pCanvas->SetBackgroundColor(GetBackgroundColor());
2257 GET_COLOR_CONFIG(TABLEVIEW::GROUPITEM_BAR_NORMAL, barColor);
2258 GET_SHAPE_CONFIG(TABLEVIEW::GROUPITEM_BAR_WIDTH, _CONTROL_ORIENTATION_PORTRAIT, barWidth);
2260 pCanvas->FillRectangle(barColor, FloatRectangle(0.0f, 0.0f, barWidth, bounds.height));
2262 if (__pDrawingProperty->sectionStyleEnabled == true)
2264 pCanvas->FillRectangle(outlineColor, FloatRectangle(bounds.width - 1.0f, 0.0f, 1.0f, bounds.height));
2266 if (__itemType == TABLE_VIEW_ITEM_TYPE_TOP || __itemType == TABLE_VIEW_ITEM_TYPE_ONE)
2268 pCanvas->FillRectangle(outlineColor, FloatRectangle(0.0f, 0.0f, bounds.width, 1.0f));
2276 _TableViewItem::DrawSectionStyleBackground(void)
2278 Canvas* pCanvas = null;
2279 Bitmap* pReplacementSectionPressBg = null;
2280 Bitmap* pReplacementSectionBg = null;
2281 Bitmap* pReplacementSectionDisabledBg = null;
2282 Color bgColor = __colorItemBg[__drawingStatus];
2283 FloatRectangle bounds = GetBoundsF();
2284 float dividerHeight = 0.0f;
2286 result r = E_SUCCESS;
2288 pCanvas = GetVisualElement()->GetCanvasN();
2289 SysTryReturnVoidResult(NID_UI_CTRL, pCanvas != null, GetLastResult(), "[%s] Propagating.", GetErrorMessage(r));
2291 pCanvas->SetBackgroundColor(Color(0, 0, 0, 0));
2294 if (bgColor != null)
2296 if (__itemType == TABLE_VIEW_ITEM_TYPE_ONE)
2298 r = GET_REPLACED_BITMAP_CONFIG_N(TABLEVIEW::SECTIONITEM_SINGLE_BG_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, bgColor, pReplacementSectionBg);
2300 else if (__itemType == TABLE_VIEW_ITEM_TYPE_TOP)
2302 r = GET_REPLACED_BITMAP_CONFIG_N(TABLEVIEW::SECTIONITEM_TOP_BG_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, bgColor, pReplacementSectionBg);
2304 else if (__itemType == TABLE_VIEW_ITEM_TYPE_MIDDLE)
2306 r = GET_REPLACED_BITMAP_CONFIG_N(TABLEVIEW::SECTIONITEM_CENTER_BG_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, bgColor, pReplacementSectionBg);
2308 else if (__itemType == TABLE_VIEW_ITEM_TYPE_BOTTOM)
2310 r = GET_REPLACED_BITMAP_CONFIG_N(TABLEVIEW::SECTIONITEM_BOTTOM_BG_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, bgColor, pReplacementSectionBg);
2319 if (__itemType == TABLE_VIEW_ITEM_TYPE_ONE)
2321 r = GET_REPLACED_BITMAP_CONFIG_N(TABLEVIEW::SECTIONITEM_SINGLE_BG_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, __pDrawingProperty->sectionStyleBgColor, pReplacementSectionBg);
2323 else if (__itemType == TABLE_VIEW_ITEM_TYPE_TOP)
2325 r = GET_REPLACED_BITMAP_CONFIG_N(TABLEVIEW::SECTIONITEM_TOP_BG_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, __pDrawingProperty->sectionStyleBgColor, pReplacementSectionBg);
2327 else if (__itemType == TABLE_VIEW_ITEM_TYPE_MIDDLE)
2329 r = GET_REPLACED_BITMAP_CONFIG_N(TABLEVIEW::SECTIONITEM_CENTER_BG_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, __pDrawingProperty->sectionStyleBgColor, pReplacementSectionBg);
2331 else if (__itemType == TABLE_VIEW_ITEM_TYPE_BOTTOM)
2333 r = GET_REPLACED_BITMAP_CONFIG_N(TABLEVIEW::SECTIONITEM_BOTTOM_BG_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, __pDrawingProperty->sectionStyleBgColor, pReplacementSectionBg);
2340 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , E_SYSTEM, "[%s] A system error has been occurred. SectionStyle image load failed", GetErrorMessage(E_SYSTEM) );
2344 if (__drawingStatus == TABLE_VIEW_ITEM_DRAWING_STATUS_PRESSED || __drawingStatus == TABLE_VIEW_ITEM_DRAWING_STATUS_HIGHLIGHTED)
2346 if (__itemType == TABLE_VIEW_ITEM_TYPE_ONE)
2348 if (IS_CUSTOM_BITMAP(TABLEVIEW::SECTIONITEM_SINGLE_BG_PRESSED))
2350 r = GET_REPLACED_BITMAP_CONFIG_N(TABLEVIEW::SECTIONITEM_SINGLE_BG_PRESSED, BITMAP_PIXEL_FORMAT_ARGB8888, bgColor, pReplacementSectionPressBg);
2351 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , E_SYSTEM, "[%s] A system error has been occurred. SectionStyle image load failed", GetErrorMessage(E_SYSTEM) );
2354 else if (__itemType == TABLE_VIEW_ITEM_TYPE_TOP)
2356 if (IS_CUSTOM_BITMAP(TABLEVIEW::SECTIONITEM_TOP_BG_PRESSED))
2358 r = GET_REPLACED_BITMAP_CONFIG_N(TABLEVIEW::SECTIONITEM_TOP_BG_PRESSED, BITMAP_PIXEL_FORMAT_ARGB8888, bgColor, pReplacementSectionPressBg);
2359 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , E_SYSTEM, "[%s] A system error has been occurred. SectionStyle image load failed", GetErrorMessage(E_SYSTEM) );
2362 else if (__itemType == TABLE_VIEW_ITEM_TYPE_MIDDLE)
2364 if (IS_CUSTOM_BITMAP(TABLEVIEW::SECTIONITEM_CENTER_BG_PRESSED))
2366 r = GET_REPLACED_BITMAP_CONFIG_N(TABLEVIEW::SECTIONITEM_CENTER_BG_PRESSED, BITMAP_PIXEL_FORMAT_ARGB8888, bgColor, pReplacementSectionPressBg);
2367 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , E_SYSTEM, "[%s] A system error has been occurred. SectionStyle image load failed", GetErrorMessage(E_SYSTEM) );
2370 else if (__itemType == TABLE_VIEW_ITEM_TYPE_BOTTOM)
2372 if (IS_CUSTOM_BITMAP(TABLEVIEW::SECTIONITEM_BOTTOM_BG_PRESSED))
2374 r = GET_REPLACED_BITMAP_CONFIG_N(TABLEVIEW::SECTIONITEM_BOTTOM_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) );
2379 GET_FIXED_VALUE_CONFIG(TABLEVIEW::ITEM_DIVIDER_HEIGHT, _CONTROL_ORIENTATION_PORTRAIT, dividerHeight);
2381 if (pReplacementSectionPressBg)
2383 DrawBitmap(*pCanvas, FloatRectangle(0.0f, dividerHeight, bounds.width, bounds.height - (dividerHeight * 2)), *pReplacementSectionPressBg);
2387 DrawBitmap(*pCanvas, FloatRectangle(0.0f, dividerHeight, bounds.width, bounds.height - (dividerHeight * 2)), *pReplacementSectionBg);
2392 DrawBitmap(*pCanvas, FloatRectangle(0.0f, 0.0f, bounds.width, bounds.height), *pReplacementSectionBg);
2397 GET_COLOR_CONFIG(TABLEVIEW::ITEM_BG_DISABLED, bgColor);
2399 if (__itemType == TABLE_VIEW_ITEM_TYPE_ONE)
2401 if (IS_CUSTOM_BITMAP(TABLEVIEW::SECTIONITEM_SINGLE_BG_DISABLED))
2403 r = GET_REPLACED_BITMAP_CONFIG_N(TABLEVIEW::SECTIONITEM_SINGLE_BG_DISABLED, BITMAP_PIXEL_FORMAT_ARGB8888, bgColor, pReplacementSectionDisabledBg);
2404 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , E_SYSTEM, "[%s] A system error has been occurred. SectionStyle image load failed", GetErrorMessage(E_SYSTEM) );
2407 else if (__itemType == TABLE_VIEW_ITEM_TYPE_TOP)
2409 if (IS_CUSTOM_BITMAP(TABLEVIEW::SECTIONITEM_TOP_BG_DISABLED))
2411 r = GET_REPLACED_BITMAP_CONFIG_N(TABLEVIEW::SECTIONITEM_TOP_BG_DISABLED, BITMAP_PIXEL_FORMAT_ARGB8888, bgColor, pReplacementSectionDisabledBg);
2412 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , E_SYSTEM, "[%s] A system error has been occurred. SectionStyle image load failed", GetErrorMessage(E_SYSTEM) );
2415 else if (__itemType == TABLE_VIEW_ITEM_TYPE_MIDDLE)
2417 if (IS_CUSTOM_BITMAP(TABLEVIEW::SECTIONITEM_CENTER_BG_DISABLED))
2419 r = GET_REPLACED_BITMAP_CONFIG_N(TABLEVIEW::SECTIONITEM_CENTER_BG_DISABLED, BITMAP_PIXEL_FORMAT_ARGB8888, bgColor, pReplacementSectionDisabledBg);
2420 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , E_SYSTEM, "[%s] A system error has been occurred. SectionStyle image load failed", GetErrorMessage(E_SYSTEM) );
2423 else if (__itemType == TABLE_VIEW_ITEM_TYPE_BOTTOM)
2425 if (IS_CUSTOM_BITMAP(TABLEVIEW::SECTIONITEM_BOTTOM_BG_DISABLED))
2427 r = GET_REPLACED_BITMAP_CONFIG_N(TABLEVIEW::SECTIONITEM_BOTTOM_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) );
2432 if (pReplacementSectionDisabledBg)
2434 DrawBitmap(*pCanvas, FloatRectangle(0.0f, 0.0f, bounds.width, bounds.height), *pReplacementSectionDisabledBg);
2438 DrawBitmap(*pCanvas, FloatRectangle(0.0f, 0.0f, bounds.width, bounds.height), *pReplacementSectionBg);
2442 if (__pDrawingProperty->groupedLookEnabled == true)
2446 float barWidth = 0.0f;
2447 float barMargin = 0.0f;
2449 GET_COLOR_CONFIG(TABLEVIEW::GROUPITEM_BAR_NORMAL, barColor);
2450 GET_SHAPE_CONFIG(TABLEVIEW::GROUPITEM_BAR_WIDTH, _CONTROL_ORIENTATION_PORTRAIT, barWidth);
2451 GET_SHAPE_CONFIG(TABLEVIEW::GROUPITEM_BAR_TOP_MARGIN, _CONTROL_ORIENTATION_PORTRAIT, barMargin);
2453 pCanvas->FillRectangle(barColor, FloatRectangle(0.0f, barMargin, barWidth, bounds.height-barMargin));
2457 delete pReplacementSectionPressBg;
2458 delete pReplacementSectionBg;
2459 delete pReplacementSectionDisabledBg;
2464 _TableViewItem::DrawSectionStyleBackgroundCover(void)
2466 if (!__pDrawingProperty->sectionStyleEnabled ||
2467 __pItemCover == null)
2472 Bitmap* pReplacementSectionBgEf = null;
2473 Bitmap* pReplacementSectionBg = null;
2474 Bitmap* pMergeBitmap = null;
2475 Canvas* pCanvas = null;
2478 result r = E_SUCCESS;
2479 FloatRectangle bounds = GetBoundsF();
2483 _TableView* pParent = dynamic_cast<_TableView*>(GetParent());
2484 SysTryCatch(NID_UI_CTRL, pParent != null, , E_SYSTEM, "[%s] A system error has been occurred. SectionTableView load failed", GetErrorMessage(E_SYSTEM) );
2486 bgColor = pParent->GetBackgroundColor();
2490 GET_COLOR_CONFIG(TABLEVIEW::ITEM_BG_DISABLED, bgColor);
2493 if (__itemType == TABLE_VIEW_ITEM_TYPE_ONE)
2495 r = GET_REPLACED_BITMAP_CONFIG_N(TABLEVIEW::SECTIONITEM_SINGLE_COVER_BG_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, bgColor, pReplacementSectionBgEf);
2497 else if (__itemType == TABLE_VIEW_ITEM_TYPE_TOP)
2499 r = GET_REPLACED_BITMAP_CONFIG_N(TABLEVIEW::SECTIONITEM_TOP_COVER_BG_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, bgColor, pReplacementSectionBgEf);
2501 else if (__itemType == TABLE_VIEW_ITEM_TYPE_MIDDLE)
2503 r = GET_REPLACED_BITMAP_CONFIG_N(TABLEVIEW::SECTIONITEM_CENTER_COVER_BG_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, bgColor, pReplacementSectionBgEf);
2505 else if (__itemType == TABLE_VIEW_ITEM_TYPE_BOTTOM)
2507 r = GET_REPLACED_BITMAP_CONFIG_N(TABLEVIEW::SECTIONITEM_BOTTOM_COVER_BG_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, bgColor, pReplacementSectionBgEf);
2513 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , E_SYSTEM, "[%s] A system error has been occurred. SectionStyle image load failed", GetErrorMessage(E_SYSTEM) );
2515 if (__itemType == TABLE_VIEW_ITEM_TYPE_ONE)
2517 r = GET_REPLACED_BITMAP_CONFIG_N(TABLEVIEW::SECTIONITEM_SINGLE_COVER_ROUND_BG_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, bgColor, pReplacementSectionBg);
2519 else if (__itemType == TABLE_VIEW_ITEM_TYPE_TOP)
2521 r = GET_REPLACED_BITMAP_CONFIG_N(TABLEVIEW::SECTIONITEM_TOP_COVER_ROUND_BG_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, bgColor, pReplacementSectionBg);
2523 else if (__itemType == TABLE_VIEW_ITEM_TYPE_MIDDLE)
2525 r = GET_REPLACED_BITMAP_CONFIG_N(TABLEVIEW::SECTIONITEM_CENTER_COVER_ROUND_BG_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, bgColor, pReplacementSectionBg);
2527 else if (__itemType == TABLE_VIEW_ITEM_TYPE_BOTTOM)
2529 r = GET_REPLACED_BITMAP_CONFIG_N(TABLEVIEW::SECTIONITEM_BOTTOM_COVER_ROUND_BG_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, bgColor, pReplacementSectionBg);
2535 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , E_SYSTEM, "[%s] A system error has been occurred. SectionStyle image load failed", GetErrorMessage(E_SYSTEM) );
2537 __pItemCover->SetBounds(FloatRectangle(0.0f, 0.0f, bounds.width, bounds.height));
2539 pCanvas = new (std::nothrow) Canvas();
2540 SysTryCatch(NID_UI_CTRL, pCanvas != null, , E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
2541 pCanvas->Construct(FloatRectangle(0.0f, 0.0f, bounds.width, bounds.height));
2542 pCanvas->SetBackgroundColor(Color(0, 0, 0, 0));
2545 DrawBitmap(*pCanvas, FloatRectangle(0.0f, 0.0f, bounds.width, bounds.height), *pReplacementSectionBg);
2546 DrawBitmap(*pCanvas, FloatRectangle(0.0f, 0.0f, bounds.width, bounds.height), *pReplacementSectionBgEf);
2548 pMergeBitmap = new (std::nothrow) Bitmap();
2549 SysTryCatch(NID_UI_CTRL, pMergeBitmap != null, , E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
2551 pMergeBitmap->Construct(*pCanvas, FloatRectangle(0.0f, 0.0f, bounds.width, bounds.height));
2553 _BitmapImpl::ConvertToNonpremultiplied(*pMergeBitmap, true);
2555 __pItemCover->SetBackgroundBitmap(*pMergeBitmap);
2558 delete pReplacementSectionBgEf;
2559 delete pReplacementSectionBg;
2561 delete pMergeBitmap;
2565 _TableViewItem::DrawContextItemBackground(void)
2567 Canvas* pCanvas = null;
2568 Bitmap* pContextBgEf = null;
2569 Bitmap* pReplacementContextBg = null;
2570 Color bgColor = __colorItemBg[__drawingStatus];
2572 FloatRectangle bounds = GetBoundsF();
2573 result r = E_SUCCESS;
2577 if (bgColor == null)
2579 GET_COLOR_CONFIG(TABLEVIEW::CONTEXTITEM_BG_NORMAL, bgColor);
2584 GET_COLOR_CONFIG(TABLEVIEW::ITEM_BG_DISABLED, bgColor);
2587 r = GET_REPLACED_BITMAP_CONFIG_N(TABLEVIEW::QUICK_MENU_BG_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, bgColor, pReplacementContextBg);
2588 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , E_SYSTEM, "[%s] A system error has been occurred. ContextItem image load failed", GetErrorMessage(E_SYSTEM));
2590 r = GET_BITMAP_CONFIG_N(TABLEVIEW::QUICK_MENU_BG_EFFECT, BITMAP_PIXEL_FORMAT_ARGB8888, pContextBgEf);
2591 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , E_SYSTEM, "[%s] A system error has been occurred. ContextItem image load failed", GetErrorMessage(E_SYSTEM));
2593 pCanvas = GetVisualElement()->GetCanvasN();
2594 SysTryCatch(NID_UI_CTRL, pCanvas != null, , E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
2596 pCanvas->SetBackgroundColor(Color(0, 0, 0, 0));
2599 DrawBitmap(*pCanvas, FloatRectangle(0.0f, 0.0f, bounds.width, bounds.height), *pReplacementContextBg);
2600 DrawBitmap(*pCanvas, FloatRectangle(0.0f, 0.0f, bounds.width, bounds.height), *pContextBgEf);
2604 delete pContextBgEf;
2605 delete pReplacementContextBg;
2610 _TableViewItem::CreateAnnexStyle(void)
2612 switch (__annexStyle)
2614 case TABLE_VIEW_ANNEX_STYLE_MARK:
2617 case TABLE_VIEW_ANNEX_STYLE_RADIO:
2620 case TABLE_VIEW_ANNEX_STYLE_ONOFF_SLIDING:
2621 CreateOnOffButton();
2623 case TABLE_VIEW_ANNEX_STYLE_ONOFF_SLIDING_WITH_DIVIDER:
2624 CreateItemAnnexDivider();
2625 CreateOnOffButton();
2627 case TABLE_VIEW_ANNEX_STYLE_DETAILED:
2628 CreateDetailButton();
2636 _TableViewItem::DrawAnnexStyle(void)
2638 switch (__annexStyle)
2640 case TABLE_VIEW_ANNEX_STYLE_MARK:
2643 case TABLE_VIEW_ANNEX_STYLE_RADIO:
2646 case TABLE_VIEW_ANNEX_STYLE_ONOFF_SLIDING:
2649 case TABLE_VIEW_ANNEX_STYLE_ONOFF_SLIDING_WITH_DIVIDER:
2650 DrawItemAnnexDivider();
2653 case TABLE_VIEW_ANNEX_STYLE_DETAILED:
2662 _TableViewItem::DrawCheckBox(void)
2664 Bitmap* pCheckBox = null;
2665 Bitmap* pCheckBoxBg = null;
2666 Bitmap* pMergeBitmap = null;
2667 Canvas* pCanvas = null;
2668 result r = E_SUCCESS;
2670 FloatRectangle bounds;
2671 float annexWidth = 0.0f;
2672 float annexHeight = 0.0f;
2676 if (__drawingStatus == TABLE_VIEW_ITEM_DRAWING_STATUS_NORMAL)
2678 r = GET_BITMAP_CONFIG_N(TABLEVIEW::CHECKBOX_BG_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, pCheckBoxBg);
2679 SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS) && (pCheckBoxBg != null), , E_SYSTEM, "[%s] Propagating.", GetErrorMessage(r));
2681 r = GET_BITMAP_CONFIG_N(TABLEVIEW::CHECKBOX_CHECK_MARK_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, pCheckBox);
2682 SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS) && (pCheckBox != null), , E_SYSTEM, "[%s] Propagating.", GetErrorMessage(r));
2684 else if ((__drawingStatus == TABLE_VIEW_ITEM_DRAWING_STATUS_PRESSED) || (__drawingStatus == TABLE_VIEW_ITEM_DRAWING_STATUS_HIGHLIGHTED))
2686 r = GET_BITMAP_CONFIG_N(TABLEVIEW::CHECKBOX_BG_PRESSED, BITMAP_PIXEL_FORMAT_ARGB8888, pCheckBoxBg);
2687 SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS) && (pCheckBoxBg != null), , E_SYSTEM, "[%s] Propagating.", GetErrorMessage(r));
2689 r = GET_BITMAP_CONFIG_N(TABLEVIEW::CHECKBOX_CHECK_MARK_PRESSED, BITMAP_PIXEL_FORMAT_ARGB8888, pCheckBox);
2690 SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS) && (pCheckBox != null), , E_SYSTEM, "[%s] Propagating.", GetErrorMessage(r));
2696 r = GET_BITMAP_CONFIG_N(TABLEVIEW::CHECKBOX_BG_DISABLED, BITMAP_PIXEL_FORMAT_ARGB8888, pCheckBoxBg);
2697 SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS) && (pCheckBoxBg != null), , E_SYSTEM, "[%s] Propagating.", GetErrorMessage(r));
2699 r = GET_BITMAP_CONFIG_N(TABLEVIEW::CHECKBOX_CHECK_MARK_DISABLED, BITMAP_PIXEL_FORMAT_ARGB8888, pCheckBox);
2700 SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS) && (pCheckBox != null), , E_SYSTEM, "[%s] Propagating.", GetErrorMessage(r));
2703 GET_SHAPE_CONFIG(TABLEVIEW::ITEM_ANNEX_WIDTH, _CONTROL_ORIENTATION_PORTRAIT, annexWidth);
2704 GET_SHAPE_CONFIG(TABLEVIEW::ITEM_ANNEX_HEIGHT, _CONTROL_ORIENTATION_PORTRAIT, annexHeight);
2706 bounds.SetBounds(0.0f, 0.0f, annexWidth, annexHeight);
2708 pCanvas = new (std::nothrow) Canvas();
2709 SysTryCatch(NID_UI_CTRL, pCanvas != null, , E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
2711 pCanvas->Construct(bounds);
2712 pCanvas->SetBackgroundColor(Color(0, 0, 0, 0));
2715 DrawBitmap(*pCanvas, CalculateAnnexBitmapBounds(annexWidth, annexHeight, *pCheckBoxBg), *pCheckBoxBg);
2717 if (__isCheckedAnimationEnabled == true)
2719 StartCheckBoxAnimation();
2723 if (IsChecked() == true && pCheckBox != null)
2725 DrawBitmap(*pCanvas, CalculateAnnexBitmapBounds(annexWidth, annexHeight, *pCheckBox), *pCheckBox);
2729 pMergeBitmap = new (std::nothrow) Bitmap();
2730 SysTryCatch(NID_UI_CTRL, pMergeBitmap != null, , E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
2732 pMergeBitmap->Construct(*pCanvas, bounds);
2733 _BitmapImpl::ConvertToNonpremultiplied(*pMergeBitmap, true);
2735 __pItemAnnex->SetBackgroundBitmap(*pMergeBitmap);
2736 __pItemAnnex->Invalidate(false);
2741 delete pMergeBitmap;
2748 _TableViewItem::DrawRadioBox(void)
2750 Bitmap* pRadioButton = null;
2751 Bitmap* pRadioButtonBg = null;
2752 Bitmap* pMergeBitmap = null;
2753 Canvas* pCanvas = null;
2754 result r = E_SUCCESS;
2756 FloatRectangle bounds;
2757 float annexWidth = 0.0f;
2758 float annexHeight = 0.0f;
2762 if (__drawingStatus == TABLE_VIEW_ITEM_DRAWING_STATUS_NORMAL)
2764 r = GET_BITMAP_CONFIG_N(TABLEVIEW::RADIOBUTTON_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, pRadioButtonBg);
2765 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));
2767 r = GET_BITMAP_CONFIG_N(TABLEVIEW::RADIOBUTTON_BUTTON_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, pRadioButton);
2768 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));
2770 else if ((__drawingStatus == TABLE_VIEW_ITEM_DRAWING_STATUS_PRESSED) || (__drawingStatus == TABLE_VIEW_ITEM_DRAWING_STATUS_HIGHLIGHTED))
2772 r = GET_BITMAP_CONFIG_N(TABLEVIEW::RADIOBUTTON_PRESSED, BITMAP_PIXEL_FORMAT_ARGB8888, pRadioButtonBg);
2773 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));
2776 r = GET_BITMAP_CONFIG_N(TABLEVIEW::RADIOBUTTON_BUTTON_PRESSED, BITMAP_PIXEL_FORMAT_ARGB8888, pRadioButton);
2777 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));
2782 r = GET_BITMAP_CONFIG_N(TABLEVIEW::RADIOBUTTON_NORMAL_DISABLED, BITMAP_PIXEL_FORMAT_ARGB8888, pRadioButtonBg);
2783 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));
2785 r = GET_BITMAP_CONFIG_N(TABLEVIEW::RADIOBUTTON_BUTTON_DISABLED, BITMAP_PIXEL_FORMAT_ARGB8888, pRadioButton);
2786 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));
2789 GET_SHAPE_CONFIG(TABLEVIEW::ITEM_ANNEX_WIDTH, _CONTROL_ORIENTATION_PORTRAIT, annexWidth);
2790 GET_SHAPE_CONFIG(TABLEVIEW::ITEM_ANNEX_HEIGHT, _CONTROL_ORIENTATION_PORTRAIT, annexHeight);
2791 bounds.SetBounds(0.0f, 0.0f, annexWidth, annexHeight);
2793 pCanvas = new (std::nothrow) Canvas();
2794 SysTryCatch(NID_UI_CTRL, pCanvas != null, , E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
2796 pCanvas->Construct(bounds);
2797 pCanvas->SetBackgroundColor(Color(0, 0, 0, 0));
2800 DrawBitmap(*pCanvas, CalculateAnnexBitmapBounds(annexWidth, annexHeight, *pRadioButtonBg), *pRadioButtonBg);
2802 if (pRadioButton != null && IsChecked() == true)
2804 DrawBitmap(*pCanvas, CalculateAnnexBitmapBounds(annexWidth, annexHeight, *pRadioButton), *pRadioButton);
2807 pMergeBitmap = new (std::nothrow) Bitmap();
2808 SysTryCatch(NID_UI_CTRL, pMergeBitmap != null, , E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
2810 pMergeBitmap->Construct(*pCanvas, bounds);
2811 _BitmapImpl::ConvertToNonpremultiplied(*pMergeBitmap, true);
2813 __pItemAnnex->SetBackgroundBitmap(*pMergeBitmap);
2814 __pItemAnnex->Invalidate(false);
2817 delete pRadioButton;
2818 delete pRadioButtonBg;
2819 delete pMergeBitmap;
2826 _TableViewItem::DrawOnOffButton(void)
2828 Bitmap* pOnOffButton = null;
2829 Bitmap* pOnOffButtonHandler = null;
2830 Bitmap* pMergeBitmap = null;
2831 Canvas* pCanvas = null;
2832 result r = E_SUCCESS;
2834 FloatRectangle bounds;
2835 FloatRectangle backgroundBounds;
2836 FloatRectangle handlerBounds;
2837 float annexWidth = 0.0f;
2838 float annexHeight = 0.0f;
2839 float annexMargin = 0.0f;
2841 if (IsChecked() == true)
2845 r = GET_BITMAP_CONFIG_N(TABLEVIEW::ONOFFBUTTON_ON_HANDLER, BITMAP_PIXEL_FORMAT_ARGB8888, pOnOffButtonHandler);
2849 r = GET_BITMAP_CONFIG_N(TABLEVIEW::ONOFFBUTTON_ON_HANDLER_DISABLED, BITMAP_PIXEL_FORMAT_ARGB8888, pOnOffButtonHandler);
2856 r = GET_BITMAP_CONFIG_N(TABLEVIEW::ONOFFBUTTON_OFF_HANDLER, BITMAP_PIXEL_FORMAT_ARGB8888, pOnOffButtonHandler);
2860 r = GET_BITMAP_CONFIG_N(TABLEVIEW::ONOFFBUTTON_OFF_HANDLER_DISABLED, BITMAP_PIXEL_FORMAT_ARGB8888, pOnOffButtonHandler);
2863 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));
2867 r = GET_BITMAP_CONFIG_N(TABLEVIEW::ONOFFBUTTON_BG, BITMAP_PIXEL_FORMAT_ARGB8888, pOnOffButton);
2871 r = GET_BITMAP_CONFIG_N(TABLEVIEW::ONOFFBUTTON_BG_DISABLED, BITMAP_PIXEL_FORMAT_ARGB8888, pOnOffButton);
2873 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));
2875 GET_SHAPE_CONFIG(TABLEVIEW::ITEM_ANNEX_ONOFF_WIDTH, _CONTROL_ORIENTATION_PORTRAIT, annexWidth);
2876 GET_SHAPE_CONFIG(TABLEVIEW::ITEM_ANNEX_ONOFF_HEIGHT, _CONTROL_ORIENTATION_PORTRAIT, annexHeight);
2877 bounds.SetBounds(0, 0, annexWidth, annexHeight);
2879 pCanvas = new (std::nothrow) Canvas();
2880 SysTryCatch(NID_UI_CTRL, pCanvas != null, , E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
2882 pCanvas->Construct(bounds);
2883 pCanvas->SetBackgroundColor(Color(0, 0, 0, 0));
2886 backgroundBounds = CalculateAnnexBitmapBounds(annexWidth, annexHeight, *pOnOffButton);
2887 DrawBitmap(*pCanvas, backgroundBounds, *pOnOffButton);
2889 handlerBounds = CalculateAnnexBitmapBounds(annexWidth, annexHeight, *pOnOffButtonHandler);
2890 GET_SHAPE_CONFIG(TABLEVIEW::ITEM_ANNEX_ONOFF_MARGIN, _CONTROL_ORIENTATION_PORTRAIT, annexMargin);
2891 if (IsChecked() == true)
2893 handlerBounds.x = backgroundBounds.width - handlerBounds.width - annexMargin;
2897 handlerBounds.x = backgroundBounds.x + annexMargin;
2900 DrawBitmap(*pCanvas, handlerBounds, *pOnOffButtonHandler);
2902 pMergeBitmap = new (std::nothrow) Bitmap();
2903 SysTryCatch(NID_UI_CTRL, pMergeBitmap != null, , E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
2905 pMergeBitmap->Construct(*pCanvas, bounds);
2906 _BitmapImpl::ConvertToNonpremultiplied(*pMergeBitmap, true);
2908 __pItemAnnex->SetBackgroundBitmap(*pMergeBitmap);
2909 __pItemAnnex->Invalidate(false);
2912 delete pOnOffButton;
2913 delete pOnOffButtonHandler;
2914 delete pMergeBitmap;
2921 _TableViewItem::AdjustAnnexOnOffHandlerPosition()
2923 float annexWidth = 0.0f;
2924 float annexHeight = 0.0f;
2925 float annexMargin = 0.0f;
2927 float annexStartPositionX = 0.0f;
2928 float annexEndPositionX = 0.0f;
2929 float handlerPositionX = 0.0f;
2930 FloatRectangle handlerBounds;
2931 result r = E_SUCCESS;
2933 GET_SHAPE_CONFIG(TABLEVIEW::ITEM_ANNEX_ONOFF_MARGIN, _CONTROL_ORIENTATION_PORTRAIT, annexMargin);
2935 Bitmap* pOnOffButtonHandler = null;
2936 if (IsChecked() == true)
2938 r = GET_BITMAP_CONFIG_N(TABLEVIEW::ONOFFBUTTON_ON_HANDLER, BITMAP_PIXEL_FORMAT_ARGB8888, pOnOffButtonHandler);
2942 r = GET_BITMAP_CONFIG_N(TABLEVIEW::ONOFFBUTTON_OFF_HANDLER, BITMAP_PIXEL_FORMAT_ARGB8888, pOnOffButtonHandler);
2944 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));
2946 GET_SHAPE_CONFIG(TABLEVIEW::ITEM_ANNEX_ONOFF_WIDTH, _CONTROL_ORIENTATION_PORTRAIT, annexWidth);
2947 GET_SHAPE_CONFIG(TABLEVIEW::ITEM_ANNEX_ONOFF_HEIGHT, _CONTROL_ORIENTATION_PORTRAIT, annexHeight);
2949 annexStartPositionX = __pItemAnnex->GetBoundsF().x;
2950 annexEndPositionX = annexStartPositionX + annexWidth + annexMargin;
2952 handlerBounds = CalculateAnnexBitmapBounds(annexWidth, annexHeight, *pOnOffButtonHandler);
2954 if (__annexOnOffHandlerMoved)
2956 if (annexStartPositionX <= __annexOnOffHandlerPositionX
2957 && annexEndPositionX >= __annexOnOffHandlerPositionX)
2959 if (((annexEndPositionX - annexStartPositionX) / 2) < (__annexOnOffHandlerPositionX + (handlerBounds.width / 2)) - annexStartPositionX )
2961 handlerPositionX = annexEndPositionX;
2966 handlerPositionX = annexStartPositionX;
2973 SetChecked(!IsChecked());
2976 handlerPositionX = annexEndPositionX;
2980 handlerPositionX = annexStartPositionX;
2984 DrawAnnexOnOffHandler(handlerPositionX);
2986 delete pOnOffButtonHandler;
2992 _TableViewItem::DrawAnnexOnOffHandler(float touchEndPosition)
2994 if (__pItemAnnex == null)
2999 Bitmap* pOnOffButton = null;
3000 Bitmap* pOnOffButtonHandler = null;
3001 Bitmap* pMergeBitmap = null;
3002 Canvas* pCanvas = null;
3003 result r = E_SUCCESS;
3005 FloatRectangle backgroundBounds;
3006 FloatRectangle handlerBounds;
3007 float annexWidth = 0.0f;
3008 float annexHeight = 0.0f;
3009 float annexMargin = 0.0f;
3010 float annexX = 0.0f;
3011 float nextHandlerX = 0.0f;
3013 r = GET_BITMAP_CONFIG_N(TABLEVIEW::ONOFFBUTTON_BG, BITMAP_PIXEL_FORMAT_ARGB8888, pOnOffButton);
3014 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));
3016 if (IsChecked() == true)
3018 r = GET_BITMAP_CONFIG_N(TABLEVIEW::ONOFFBUTTON_ON_HANDLER, BITMAP_PIXEL_FORMAT_ARGB8888, pOnOffButtonHandler);
3022 r = GET_BITMAP_CONFIG_N(TABLEVIEW::ONOFFBUTTON_OFF_HANDLER, BITMAP_PIXEL_FORMAT_ARGB8888, pOnOffButtonHandler);
3024 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));
3026 GET_SHAPE_CONFIG(TABLEVIEW::ITEM_ANNEX_ONOFF_WIDTH, _CONTROL_ORIENTATION_PORTRAIT, annexWidth);
3027 GET_SHAPE_CONFIG(TABLEVIEW::ITEM_ANNEX_ONOFF_HEIGHT, _CONTROL_ORIENTATION_PORTRAIT, annexHeight);
3028 GET_SHAPE_CONFIG(TABLEVIEW::ITEM_ANNEX_ONOFF_MARGIN, _CONTROL_ORIENTATION_PORTRAIT, annexMargin);
3030 pCanvas = new (std::nothrow) Canvas();
3031 SysTryCatch(NID_UI_CTRL, pCanvas != null, , E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
3033 pCanvas->Construct(FloatRectangle(0, 0, annexWidth, annexHeight));
3034 pCanvas->SetBackgroundColor(Color(0, 0, 0, 0));
3037 backgroundBounds = CalculateAnnexBitmapBounds(annexWidth, annexHeight, *pOnOffButton);
3038 DrawBitmap(*pCanvas, backgroundBounds, *pOnOffButton);
3040 handlerBounds = CalculateAnnexBitmapBounds(annexWidth, annexHeight, *pOnOffButtonHandler);
3041 handlerBounds.y = backgroundBounds.y;
3045 handlerBounds.x = backgroundBounds.width - handlerBounds.width - annexMargin;
3049 handlerBounds.x = backgroundBounds.x + annexMargin;
3052 nextHandlerX = handlerBounds.x + (touchEndPosition - __annexTouchStartPosition);
3053 annexX = __pItemAnnex->GetBoundsF().x;
3055 if ((annexX + nextHandlerX + handlerBounds.width) < (annexX + annexWidth + annexMargin)
3056 && (annexX + nextHandlerX) > annexX)
3058 handlerBounds.x = nextHandlerX;
3060 else if (_FloatCompareGE((annexX + nextHandlerX + handlerBounds.width), (annexX + annexWidth + annexMargin)))
3062 handlerBounds.x = backgroundBounds.width - handlerBounds.width - annexMargin;
3064 else if (_FloatCompareLE((annexX + nextHandlerX), annexX))
3066 handlerBounds.x = backgroundBounds.x + annexMargin;
3069 __annexOnOffHandlerPositionX = annexX + handlerBounds.x;
3070 DrawBitmap(*pCanvas, handlerBounds, *pOnOffButtonHandler);
3072 pMergeBitmap = new (std::nothrow) Bitmap();
3073 SysTryCatch(NID_UI_CTRL, pMergeBitmap != null, , E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
3075 pMergeBitmap->Construct(*pCanvas, FloatRectangle(0, 0, annexWidth, annexHeight));
3076 _BitmapImpl::ConvertToNonpremultiplied(*pMergeBitmap, true);
3078 __pItemAnnex->SetBackgroundBitmap(*pMergeBitmap);
3079 __pItemAnnex->Invalidate(false);
3082 delete pOnOffButton;
3083 delete pOnOffButtonHandler;
3084 delete pMergeBitmap;
3091 _TableViewItem::DrawDetailButton(void)
3093 Bitmap* pDetailBgEffect = null;
3094 Bitmap* pDetailEffect = null;
3095 Bitmap* pReplacementDetail = null;
3096 Bitmap* pReplacementDetailBg = null;
3097 Bitmap* pMergeBitmap = null;
3098 Canvas* pCanvas = null;
3099 Color replacementNewColor;
3100 Color replacementNewBgColor;
3101 result r = E_SUCCESS;
3103 FloatRectangle bounds;
3104 float annexWidth = 0.0f;
3105 float annexHeight = 0.0f;
3106 bool themeBackgroundBitmap = false;
3108 themeBackgroundBitmap = IS_CUSTOM_BITMAP(TABLEVIEW::CIRCLE_BUTTON_BG_NORMAL);
3112 if (__isSelectedDetailButton)
3114 if (!themeBackgroundBitmap)
3116 r = GET_BITMAP_CONFIG_N(TABLEVIEW::CIRCLE_BUTTON_BG_PRESSED, BITMAP_PIXEL_FORMAT_ARGB8888, pDetailBgEffect);
3117 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));
3119 r = GET_BITMAP_CONFIG_N(TABLEVIEW::CIRCLE_BUTTON_REVEAL_EFFECT, BITMAP_PIXEL_FORMAT_ARGB8888, pDetailEffect);
3120 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));
3123 GET_COLOR_CONFIG(TABLEVIEW::ITEM_ANNEX_DETAIL_PRESSED, replacementNewColor);
3125 r = GET_REPLACED_BITMAP_CONFIG_N(TABLEVIEW::CIRCLE_BUTTON_REVEAL_PRESSED, BITMAP_PIXEL_FORMAT_ARGB8888, replacementNewColor, pReplacementDetail);
3126 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));
3128 GET_COLOR_CONFIG(TABLEVIEW::ITEM_ANNEX_DETAIL_BG_PRESSED, replacementNewBgColor);
3132 if (!themeBackgroundBitmap)
3134 r = GET_BITMAP_CONFIG_N(TABLEVIEW::CIRCLE_BUTTON_BG_EFFECT, BITMAP_PIXEL_FORMAT_ARGB8888, pDetailBgEffect);
3135 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));
3137 r = GET_BITMAP_CONFIG_N(TABLEVIEW::CIRCLE_BUTTON_REVEAL_EFFECT, BITMAP_PIXEL_FORMAT_ARGB8888, pDetailEffect);
3138 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));
3141 GET_COLOR_CONFIG(TABLEVIEW::ITEM_ANNEX_DETAIL_NORMAL, replacementNewColor);
3143 r = GET_REPLACED_BITMAP_CONFIG_N(TABLEVIEW::CIRCLE_BUTTON_REVEAL_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, replacementNewColor, pReplacementDetail);
3144 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));
3146 GET_COLOR_CONFIG(TABLEVIEW::ITEM_ANNEX_DETAIL_BG_NORMAL, replacementNewBgColor);
3151 if (!themeBackgroundBitmap)
3153 r = GET_BITMAP_CONFIG_N(TABLEVIEW::CIRCLE_BUTTON_BG_EFFECT_DISABLED, BITMAP_PIXEL_FORMAT_ARGB8888, pDetailBgEffect);
3154 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));
3156 r = GET_BITMAP_CONFIG_N(TABLEVIEW::CIRCLE_BUTTON_REVEAL_EFFECT, BITMAP_PIXEL_FORMAT_ARGB8888, pDetailEffect);
3157 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));
3160 GET_COLOR_CONFIG(TABLEVIEW::ITEM_ANNEX_DETAIL_NORMAL, replacementNewColor);
3162 r = GET_REPLACED_BITMAP_CONFIG_N(TABLEVIEW::CIRCLE_BUTTON_REVEAL_DISABLED, BITMAP_PIXEL_FORMAT_ARGB8888, replacementNewColor, pReplacementDetail);
3163 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));
3165 r = GET_REPLACED_BITMAP_CONFIG_N(TABLEVIEW::CIRCLE_BUTTON_BG_DISABLED, BITMAP_PIXEL_FORMAT_ARGB8888, replacementNewBgColor, pReplacementDetailBg);
3166 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));
3169 if (pReplacementDetailBg == null)
3171 r = GET_REPLACED_BITMAP_CONFIG_N(TABLEVIEW::CIRCLE_BUTTON_BG_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, replacementNewBgColor, pReplacementDetailBg);
3172 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));
3175 GET_SHAPE_CONFIG(TABLEVIEW::ITEM_ANNEX_MORE_WIDTH, _CONTROL_ORIENTATION_PORTRAIT, annexWidth);
3176 GET_SHAPE_CONFIG(TABLEVIEW::ITEM_ANNEX_MORE_HEIGHT, _CONTROL_ORIENTATION_PORTRAIT, annexHeight);
3178 bounds.SetBounds(0, 0, annexWidth, annexHeight);
3180 pCanvas = new (std::nothrow) Canvas();
3181 SysTryCatch(NID_UI_CTRL, pCanvas != null, , E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
3183 pCanvas->Construct(bounds);
3184 pCanvas->SetBackgroundColor(Color(0, 0, 0, 0));
3187 DrawBitmap(*pCanvas, CalculateAnnexBitmapBounds(annexWidth, annexHeight, *pReplacementDetailBg), *pReplacementDetailBg);
3188 if (pDetailBgEffect)
3190 DrawBitmap(*pCanvas, CalculateAnnexBitmapBounds(annexWidth, annexHeight, *pDetailBgEffect), *pDetailBgEffect);
3192 DrawBitmap(*pCanvas, CalculateAnnexBitmapBounds(annexWidth, annexHeight, *pReplacementDetail), *pReplacementDetail);
3195 DrawBitmap(*pCanvas, CalculateAnnexBitmapBounds(annexWidth, annexHeight, *pDetailEffect), *pDetailEffect);
3198 pMergeBitmap = new (std::nothrow) Bitmap();
3199 SysTryCatch(NID_UI_CTRL, pMergeBitmap != null, , E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
3200 pMergeBitmap->Construct(*pCanvas, bounds);
3201 _BitmapImpl::ConvertToNonpremultiplied(*pMergeBitmap, true);
3203 __pItemAnnex->SetBackgroundBitmap(*pMergeBitmap);
3204 __pItemAnnex->Invalidate(false);
3207 delete pDetailBgEffect;
3208 delete pDetailEffect;
3209 delete pReplacementDetail;
3210 delete pReplacementDetailBg;
3211 delete pMergeBitmap;
3218 _TableViewItem::DrawItemDivider(void)
3220 if (__pItemDivider == null || __pItemTopDivider == null)
3225 if (__pDrawingProperty->itemDividerEnabled == false ||
3226 __itemType == TABLE_VIEW_ITEM_TYPE_HEADER ||
3227 __itemType == TABLE_VIEW_ITEM_TYPE_FOOTER ||
3228 __itemDividerEnabled == false ||
3231 __pItemDivider->SetVisibleState(false);
3232 __pItemTopDivider->SetVisibleState(false);
3237 FloatRectangle dividerBottomBounds;
3238 FloatRectangle dividerTopBounds;
3240 Color bottomLineColor;
3241 Color customDividerColor;
3242 FloatRectangle bounds;
3243 FloatPoint bottomPoint;
3245 __pItemDivider->SetVisibleState(true);
3246 __pItemTopDivider->SetVisibleState(true);
3248 if ( __drawingStatus == TABLE_VIEW_ITEM_DRAWING_STATUS_PRESSED ||
3249 __drawingStatus == TABLE_VIEW_ITEM_DRAWING_STATUS_HIGHLIGHTED)
3251 if (__colorItemBg[TABLE_VIEW_ITEM_DRAWING_STATUS_NORMAL] != __colorItemBg[TABLE_VIEW_ITEM_DRAWING_STATUS_PRESSED])
3253 if (__itemType != TABLE_VIEW_ITEM_TYPE_TITLE)
3255 __pItemDivider->SetVisibleState(false);
3258 __pItemTopDivider->SetVisibleState(false);
3262 if (__itemType == TABLE_VIEW_ITEM_TYPE_TITLE)
3264 if (__pItemBgBitmap[__drawingStatus] != null)
3266 __pItemDivider->SetVisibleState(false);
3270 float lineHeight = 0.0f;
3271 float lineLeftMargin = 0.0f;
3272 float lineBottomMargin = 0.0f;
3273 bounds = GetBoundsF();
3275 if (__drawingStatus == TABLE_VIEW_ITEM_DRAWING_STATUS_NORMAL)
3277 GET_COLOR_CONFIG(TABLEVIEW::GROUPITEM_INDEX_BAR_NORMAL, bottomLineColor);
3281 GET_COLOR_CONFIG(TABLEVIEW::GROUPITEM_INDEX_BAR_PRESSED, bottomLineColor);
3284 GET_SHAPE_CONFIG(TABLEVIEW::GROUPITEM_INDEX_BAR_HEIGHT, _CONTROL_ORIENTATION_PORTRAIT, lineHeight);
3285 GET_SHAPE_CONFIG(TABLEVIEW::GROUPITEM_INDEX_BAR_LEFT_MARGIN, _CONTROL_ORIENTATION_PORTRAIT, lineLeftMargin);
3286 GET_SHAPE_CONFIG(TABLEVIEW::GROUPITEM_INDEX_BAR_BOTTOM_MARGIN, _CONTROL_ORIENTATION_PORTRAIT, lineBottomMargin);
3288 lineHeight = Tizen::Graphics::CoordinateSystem::ConvertToLogicalY(lineHeight);
3289 lineBottomMargin = Tizen::Graphics::CoordinateSystem::ConvertToLogicalY(lineBottomMargin);
3290 bottomPoint = Tizen::Graphics::CoordinateSystem::AlignToDevice(FloatPoint(lineLeftMargin, bounds.height));
3291 dividerBottomBounds = FloatRectangle(bottomPoint.x, bottomPoint.y - lineBottomMargin, bounds.width - lineLeftMargin * 2.0f, lineHeight);
3296 float lineLeftMargin = 0.0f;
3297 float lineHeight = 0.0f;
3298 bounds = GetBoundsF();
3300 if (!IsContextItem())
3302 if (!__isSimpleLastItem)
3304 if (__itemType == TABLE_VIEW_ITEM_TYPE_BOTTOM || __itemType == TABLE_VIEW_ITEM_TYPE_ONE)
3306 __pItemDivider->SetVisibleState(false);
3307 __pItemTopDivider->SetVisibleState(false);
3312 customDividerColor = __pDrawingProperty->dividerColor;
3313 GET_COLOR_CONFIG(TABLEVIEW::ITEM_DIVIDER_TOP_BG_NORMAL, topLineColor);
3314 GET_COLOR_CONFIG(TABLEVIEW::ITEM_DIVIDER_BOTTOM_BG_NORMAL, bottomLineColor);
3315 GET_FIXED_VALUE_CONFIG(TABLEVIEW::ITEM_DIVIDER_LEFT_MARGIN, _CONTROL_ORIENTATION_PORTRAIT, lineLeftMargin);
3316 GET_FIXED_VALUE_CONFIG(TABLEVIEW::ITEM_DIVIDER_HEIGHT, _CONTROL_ORIENTATION_PORTRAIT, lineHeight);
3318 lineLeftMargin = Tizen::Graphics::CoordinateSystem::ConvertToLogicalX(lineLeftMargin);
3319 lineHeight = Tizen::Graphics::CoordinateSystem::ConvertToLogicalY(lineHeight);
3320 bottomPoint = Tizen::Graphics::CoordinateSystem::AlignToDevice(FloatPoint(lineLeftMargin, (bounds.height)));
3322 dividerTopBounds.SetBounds(lineLeftMargin, bottomPoint.y - (lineHeight * 2.0f), bounds.width - lineLeftMargin * 2.0f, lineHeight);
3323 dividerBottomBounds.SetBounds(lineLeftMargin, bottomPoint.y - lineHeight, bounds.width - lineLeftMargin * 2.0f, lineHeight);
3326 if (__pItemDivider->GetVisibleState())
3328 __pItemDivider->SetBounds(dividerBottomBounds);
3329 if (customDividerColor == bottomLineColor || __itemType == TABLE_VIEW_ITEM_TYPE_TITLE)
3331 __pItemDivider->SetBackgroundColor(bottomLineColor);
3335 __pItemDivider->SetBackgroundColor(customDividerColor);
3336 __pItemDivider->GetVisualElement()->SetOpacity(ITEM_BOTTOM_DIVIDER_OPACITY);
3338 __pItemDivider->Invalidate();
3341 if (__pItemTopDivider->GetVisibleState())
3343 __pItemTopDivider->SetBounds(dividerTopBounds);
3344 if (customDividerColor == bottomLineColor)
3346 __pItemTopDivider->SetBackgroundColor(topLineColor);
3350 __pItemTopDivider->SetBackgroundColor(customDividerColor);
3351 __pItemTopDivider->GetVisualElement()->SetOpacity(ITEM_TOP_DIVIDER_OPACITY);
3353 __pItemTopDivider->Invalidate();
3358 _TableViewItem::DrawItemAnnexDivider(void)
3360 if (__itemType == TABLE_VIEW_ITEM_TYPE_HEADER || __itemType == TABLE_VIEW_ITEM_TYPE_FOOTER)
3362 if (__pItemAnnexLeftDivider != null)
3364 __pItemAnnexLeftDivider->SetVisibleState(false);
3367 if (__pItemAnnexRightDivider != null)
3369 __pItemAnnexRightDivider->SetVisibleState(false);
3374 Color dividerLeftColor;
3375 Color dividerRightColor;
3376 Color customDividerColor;
3377 Color bottomLineColor;
3378 FloatRectangle bounds = GetBoundsF();
3379 float dividerHeight = 0;
3380 float itemHeight = 0;
3381 float dividerWidth = 0.0f;
3382 float dividerTopMargin = 0.0f;
3383 float annexWidth = 0.0f;
3384 float annexLeftMargin = 0.0f;
3385 float itemLeftMargin = 0.0f;
3387 customDividerColor = __pDrawingProperty->dividerColor;
3388 GET_SHAPE_CONFIG(TABLEVIEW::ITEM_LEFT_MARGIN, _CONTROL_ORIENTATION_PORTRAIT, itemLeftMargin);
3389 GET_SHAPE_CONFIG(TABLEVIEW::ITEM_ANNEX_MARGIN, _CONTROL_ORIENTATION_PORTRAIT, annexLeftMargin);
3390 GET_SHAPE_CONFIG(TABLEVIEW::ITEM_ANNEX_ONOFF_WIDTH, _CONTROL_ORIENTATION_PORTRAIT, annexWidth);
3391 GET_COLOR_CONFIG(TABLEVIEW::ITEM_ANNEX_DIVIDER_LEFT_BG_NORMAL, dividerLeftColor);
3392 GET_COLOR_CONFIG(TABLEVIEW::ITEM_ANNEX_DIVIDER_RIGHT_BG_NORMAL, dividerRightColor);
3393 GET_COLOR_CONFIG(TABLEVIEW::ITEM_DIVIDER_BOTTOM_BG_NORMAL, bottomLineColor);
3394 GET_FIXED_VALUE_CONFIG(TABLEVIEW::ITEM_ANNEX_DIVIDER_WIDTH, _CONTROL_ORIENTATION_PORTRAIT, dividerWidth);
3395 GET_FIXED_VALUE_CONFIG(TABLEVIEW::ITEM_ANNEX_DIVIDER_MARGIN, _CONTROL_ORIENTATION_PORTRAIT, dividerTopMargin);
3397 itemLeftMargin += __pDrawingProperty->scrollMargin;
3398 itemHeight = ((__customHeight > 0) ? __customHeight : GetBoundsF().height);
3399 dividerHeight = itemHeight - (dividerTopMargin*2);
3400 dividerHeight = (dividerHeight > 0) ? dividerHeight : 0;
3401 __pItemAnnexLeftDivider->SetBounds(FloatRectangle((GetBoundsF().width - annexWidth - (itemLeftMargin + annexLeftMargin) - (dividerWidth*2)), dividerTopMargin, dividerWidth, dividerHeight));
3402 __pItemAnnexRightDivider->SetBounds(FloatRectangle((GetBoundsF().width - annexWidth - (itemLeftMargin + annexLeftMargin) - dividerWidth), dividerTopMargin, dividerWidth, dividerHeight));
3404 if (customDividerColor == bottomLineColor)
3406 __pItemAnnexLeftDivider->SetBackgroundColor(dividerLeftColor);
3410 __pItemAnnexLeftDivider->SetBackgroundColor(customDividerColor);
3411 __pItemAnnexLeftDivider->GetVisualElement()->SetOpacity(ITEM_TOP_DIVIDER_OPACITY);
3414 if (customDividerColor == bottomLineColor)
3416 __pItemAnnexRightDivider->SetBackgroundColor(dividerRightColor);
3420 __pItemAnnexRightDivider->SetBackgroundColor(customDividerColor);
3421 __pItemAnnexRightDivider->GetVisualElement()->SetOpacity(ITEM_BOTTOM_DIVIDER_OPACITY);
3424 __pItemAnnexLeftDivider->Invalidate();
3425 __pItemAnnexRightDivider->Invalidate();
3428 if (__pItemAnnexLeftDivider != null)
3430 _AccessibilityContainer* pContainer = __pItemAnnexLeftDivider->GetAccessibilityContainer();
3431 pContainer->Activate(false);
3434 if (__pItemAnnexRightDivider != null)
3436 _AccessibilityContainer* pContainer = __pItemAnnexRightDivider->GetAccessibilityContainer();
3437 pContainer->Activate(false);
3443 _TableViewItem::DrawBitmap(Canvas& canvas, const FloatRectangle& bounds, const Bitmap& bitmap)
3445 result r = E_SUCCESS;
3446 if (_BitmapImpl::CheckNinePatchedBitmapStrictly(bitmap))
3448 r = canvas.DrawNinePatchedBitmap(bounds, bitmap);
3449 SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "Fail to draw ninepatched bitmap.");
3453 r = canvas.DrawBitmap(bounds, bitmap);
3454 SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "Fail to draw bitmap.");
3461 _TableViewItem::SetItemHighlightBounds(_VisualElement& highlightVisualElement, const FloatRectangle& bounds)
3463 return highlightVisualElement.SetBounds(bounds);
3467 _TableViewItem::CalculateItemHighlightBounds(void)
3469 FloatRectangle itemBounds = GetBoundsF();
3470 return FloatRectangle(0.0f, 0.0f, itemBounds.width, itemBounds.height);
3474 _TableViewItem::CalculateAnnexBitmapBounds(float annexWidth, float annexHeight, const Bitmap& bitmap)
3476 FloatRectangle bounds;
3479 float leftMargin = 0;
3480 float topMargin = 0;
3482 if (annexWidth > bitmap.GetWidthF())
3484 leftMargin = (annexWidth - bitmap.GetWidthF()) / 2;
3485 width = bitmap.GetWidthF();
3492 if (annexHeight > bitmap.GetHeightF())
3494 topMargin = (annexHeight - bitmap.GetHeightF()) / 2;
3495 height = bitmap.GetHeightF();
3499 height = annexHeight;
3502 bounds.SetBounds(leftMargin, topMargin, width, height);
3508 _TableViewItem::IsTitleStyleItem(void) const
3510 if (__itemType == TABLE_VIEW_ITEM_TYPE_TITLE || __itemType == TABLE_VIEW_ITEM_TYPE_HEADER || __itemType == TABLE_VIEW_ITEM_TYPE_FOOTER)
3519 _TableViewItem::IsValidSelectionState(void)
3521 _TableView* pParent = dynamic_cast<_TableView*>(GetParent());
3522 if (pParent == null)
3527 if (pParent->GetPressedItemCount() > 0)
3536 _TableViewItem::DrawSimpleItem(void)
3538 if (__pSimpleItemText != null)
3540 Color textColor = __simpleItemTextColor[__drawingStatus];
3543 textColor = __simpleItemTextColor[TABLE_VIEW_SIMPLEITEM_DRAWING_STATUS_DISABLED];
3546 if (__itemType == TABLE_VIEW_ITEM_TYPE_TITLE)
3548 if (__drawingStatus == TABLE_VIEW_ITEM_DRAWING_STATUS_NORMAL)
3550 textColor = __simpleItemTextColor[TABLE_VIEW_GROUPITEM_DRAWING_STATUS_NORMAL];
3554 textColor = __simpleItemTextColor[TABLE_VIEW_GROUPITEM_DRAWING_STATUS_PRESSED];
3558 __pSimpleItemText->SetTextColor(textColor);
3559 __pSimpleItemText->Invalidate(false);
3563 _TableViewItem::SetSimpleItemContents(const Tizen::Base::String& text, const Tizen::Graphics::Bitmap* pBitmap, bool groupType)
3565 result r = E_SUCCESS;
3566 bool textOnly = true;
3568 if (pBitmap != null)
3573 r = CreateSimpleItemContents(textOnly);
3574 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
3576 FloatRectangle bitmapRect = FloatRectangle(0.0f, 0.0f, 0.0f, 0.0f);
3577 FloatRectangle textRect = FloatRectangle(0.0f, 0.0f, 0.0f, 0.0f);
3578 float leftMargin = 0.0f;
3579 float annexMargin = 0.0f;
3580 float elementWidth = 0;
3581 float elementHeight = 0;
3582 float itemHeight = GetBoundsF().height;
3583 float itemWidth = GetBoundsF().width;
3584 float annexWidth = GetAnnexWidth(__annexStyle);
3588 if (__simpleItemTextSize == 0)
3590 GET_SHAPE_CONFIG(TABLEVIEW::GROUPITEM_DEFAULT_FONT_SIZE, _CONTROL_ORIENTATION_PORTRAIT, __simpleItemTextSize);
3592 GET_SHAPE_CONFIG(TABLEVIEW::GROUPITEM_LEFT_MARGIN, _CONTROL_ORIENTATION_PORTRAIT, leftMargin);
3596 if (__simpleItemTextSize == 0)
3598 GET_SHAPE_CONFIG(TABLEVIEW::ITEM_DEFAULT_FONT_SIZE, _CONTROL_ORIENTATION_PORTRAIT, __simpleItemTextSize);
3600 GET_SHAPE_CONFIG(TABLEVIEW::ITEM_LEFT_MARGIN, _CONTROL_ORIENTATION_PORTRAIT, leftMargin);
3605 elementWidth = itemHeight * SIMPLE_ITEM_ELEMENT_BITMAP_SIZE_RATIO;
3606 elementHeight = elementWidth;
3608 bitmapRect.x = leftMargin;
3609 bitmapRect.y = (itemHeight - elementHeight) / 2;
3610 bitmapRect.width = elementWidth;
3611 bitmapRect.height = elementHeight;
3614 if (__annexStyle == TABLE_VIEW_ANNEX_STYLE_NORMAL)
3616 textRect.x = bitmapRect.x + elementWidth + leftMargin;
3617 elementWidth = itemWidth - textRect.x - leftMargin;
3621 GET_SHAPE_CONFIG(TABLEVIEW::ITEM_ANNEX_MARGIN, _CONTROL_ORIENTATION_PORTRAIT, annexMargin);
3622 if (__annexStyle == TABLE_VIEW_ANNEX_STYLE_MARK || __annexStyle == TABLE_VIEW_ANNEX_STYLE_RADIO)
3624 bitmapRect.x = leftMargin + annexWidth + annexMargin;
3625 textRect.x = bitmapRect.x + elementWidth + leftMargin;
3626 elementWidth = itemWidth - textRect.x - leftMargin;
3630 textRect.x = bitmapRect.x + elementWidth + leftMargin;
3631 elementWidth = itemWidth - textRect.x - annexWidth - leftMargin - annexMargin;
3636 textRect.width = elementWidth < 0 ? 0 : elementWidth;;
3637 textRect.height = itemHeight;
3639 if (__pSimpleItemBitmap != null && pBitmap != null)
3641 __pSimpleItemBitmap->SetBackgroundBitmap(*pBitmap);
3642 __pSimpleItemBitmap->SetBounds(bitmapRect);
3644 _Label* pSimpleItemBitmapCore = GetLabelCore(__pSimpleItemBitmap);
3645 if (!pSimpleItemBitmapCore->HasParent())
3647 r = AttachChild(*pSimpleItemBitmapCore);
3648 SysTryReturn(NID_UI_CTRL, __pSimpleItemBitmap != null, r, r, "[%s] Propagating.", GetErrorMessage(r));
3652 if (__pSimpleItemText != null)
3654 __pSimpleItemText->SetTextConfig(__simpleItemTextSize, LABEL_TEXT_STYLE_NORMAL);
3655 __pSimpleItemText->SetText(text);
3656 __pSimpleItemText->SetBounds(textRect);
3658 _Label* pSimpleItemTextCore = GetLabelCore(__pSimpleItemText);
3659 if (!pSimpleItemTextCore->HasParent())
3661 r = AttachChild(*pSimpleItemTextCore);
3662 SysTryReturn(NID_UI_CTRL, __pSimpleItemText != null, r, r, "[%s] Propagating.", GetErrorMessage(r));
3670 _TableViewItem::CreateSimpleItemContents(bool textOnly)
3672 result r = E_SUCCESS;
3674 if (__pSimpleItemText == null)
3676 __pSimpleItemText = new (std::nothrow) Label();
3678 r = GetLastResult();
3679 SysTryReturn(NID_UI_CTRL, __pSimpleItemText != null, r, r, "[%s] Propagating.", GetErrorMessage(r));
3681 __pSimpleItemText->Construct(FloatRectangle(0.0f, 0.0f, 0.0f, 0.0f), L"");
3683 __pSimpleItemText->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
3684 __pSimpleItemText->SetTextVerticalAlignment(ALIGNMENT_MIDDLE);
3685 if (__itemType == TABLE_VIEW_ITEM_TYPE_TITLE)
3687 __pSimpleItemText->SetTextColor(__simpleItemTextColor[TABLE_VIEW_GROUPITEM_DRAWING_STATUS_NORMAL]);
3691 __pSimpleItemText->SetTextColor(__simpleItemTextColor[TABLE_VIEW_ITEM_DRAWING_STATUS_NORMAL]);
3693 __pSimpleItemText->SetBackgroundColor(Color(0, 0, 0, 0));
3694 GetLabelCore(__pSimpleItemText)->SetFocusable(true);
3700 if (__pSimpleItemBitmap == null)
3702 __pSimpleItemBitmap = new (std::nothrow) Label();
3704 r = GetLastResult();
3705 SysTryReturn(NID_UI_CTRL, __pSimpleItemBitmap != null, r, r, "[%s] Propagating.", GetErrorMessage(r));
3707 __pSimpleItemBitmap->Construct(FloatRectangle(0.0f, 0.0f, 0.0f, 0.0f), L"");
3708 __pSimpleItemBitmap->SetBackgroundColor(Color(0, 0, 0, 0));
3709 GetLabelCore(__pSimpleItemBitmap)->SetFocusable(true);
3715 if (__pSimpleItemBitmap != null)
3717 delete __pSimpleItemBitmap;
3718 __pSimpleItemBitmap = null;
3726 _TableViewItem::SetSimpleTextColor(const Tizen::Graphics::Color& color, TableViewItemDrawingStatus status)
3728 __simpleItemTextColor[status] = color;
3733 Tizen::Graphics::Color
3734 _TableViewItem::GetSimpleItemTextColor(TableViewItemDrawingStatus status) const
3736 return __simpleItemTextColor[status];
3740 _TableViewItem::SetSimpleGroupItemTextColor(const Tizen::Graphics::Color& color, TableViewItemDrawingStatus status)
3742 if (status == TABLE_VIEW_ITEM_DRAWING_STATUS_NORMAL)
3744 __simpleItemTextColor[TABLE_VIEW_GROUPITEM_DRAWING_STATUS_NORMAL] = color;
3746 else if (status == TABLE_VIEW_ITEM_DRAWING_STATUS_PRESSED)
3748 __simpleItemTextColor[TABLE_VIEW_GROUPITEM_DRAWING_STATUS_PRESSED] = color;
3754 Tizen::Graphics::Color
3755 _TableViewItem::GetSimpleGroupItemTextColor(TableViewItemDrawingStatus status) const
3757 if (status == TABLE_VIEW_ITEM_DRAWING_STATUS_PRESSED)
3759 return __simpleItemTextColor[TABLE_VIEW_GROUPITEM_DRAWING_STATUS_PRESSED];
3763 return __simpleItemTextColor[TABLE_VIEW_GROUPITEM_DRAWING_STATUS_NORMAL];
3768 _TableViewItem::SetSimpleItemTextSize(int size)
3770 if (__simpleItemTextSize == size)
3775 __simpleItemTextSize = size;
3777 if (__pSimpleItemText != null)
3779 __pSimpleItemText->SetTextConfig(__simpleItemTextSize, LABEL_TEXT_STYLE_NORMAL);
3785 _TableViewItem::GetSimpleItemTextSize(void) const
3787 return __simpleItemTextSize;
3791 _TableViewItem::SetSectionHeaderFooterContents(const Tizen::Base::String& text, HorizontalAlignment alignment, bool isHeader)
3793 if (__pHeaderFooterItemText == null)
3795 result r = E_SUCCESS;
3796 float contentsHeight = 0.0f;
3797 float positionY = 0.0f;
3800 GET_COLOR_CONFIG(TABLEVIEW::GROUPITEM_TEXT_NORMAL, textColor);
3801 GET_SHAPE_CONFIG(TABLEVIEW::GROUPITEM_DEFAULT_TEXT_HEIGHT, _CONTROL_ORIENTATION_PORTRAIT, contentsHeight);
3803 __pHeaderFooterItemText = new (std::nothrow) Label();
3805 r = GetLastResult();
3806 SysTryReturn(NID_UI_CTRL, __pHeaderFooterItemText != null, r, r, "[%s] Propagating.", GetErrorMessage(r));
3810 positionY = GetBoundsF().height - contentsHeight;
3812 __pHeaderFooterItemText->Construct(FloatRectangle(0.0f, positionY, GetBoundsF().width, contentsHeight), text);
3813 __pHeaderFooterItemText->SetTextHorizontalAlignment(alignment);
3814 __pHeaderFooterItemText->SetTextColor(textColor);
3815 __pHeaderFooterItemText->SetBackgroundColor(Color(0, 0, 0, 0));
3817 _Label* pHeaderFooterItemTextCore = GetLabelCore(__pHeaderFooterItemText);
3818 pHeaderFooterItemTextCore->SetFocusable(false);
3819 AttachChild(*pHeaderFooterItemTextCore);
3826 _TableViewItem::SetSectionHeaderFooterAlignment(HorizontalAlignment alignment)
3828 if (__pHeaderFooterItemText != null)
3830 __pHeaderFooterItemText->SetTextHorizontalAlignment(alignment);
3831 __pHeaderFooterItemText->Invalidate(false);
3838 _TableViewItem::GetAnnexWidth(TableViewAnnexStyle style)
3840 float annexWidth = 0.0f;
3841 float annexDividerWidth = 0.0f;
3845 case TABLE_VIEW_ANNEX_STYLE_NORMAL:
3849 case TABLE_VIEW_ANNEX_STYLE_MARK:
3850 GET_SHAPE_CONFIG(TABLEVIEW::ITEM_ANNEX_WIDTH, _CONTROL_ORIENTATION_PORTRAIT, annexWidth);
3853 case TABLE_VIEW_ANNEX_STYLE_ONOFF_SLIDING:
3854 GET_SHAPE_CONFIG(TABLEVIEW::ITEM_ANNEX_ONOFF_WIDTH, _CONTROL_ORIENTATION_PORTRAIT, annexWidth);
3857 case TABLE_VIEW_ANNEX_STYLE_ONOFF_SLIDING_WITH_DIVIDER:
3858 GET_SHAPE_CONFIG(TABLEVIEW::ITEM_ANNEX_MARGIN, _CONTROL_ORIENTATION_PORTRAIT, annexDividerWidth);
3859 GET_FIXED_VALUE_CONFIG(TABLEVIEW::ITEM_ANNEX_DIVIDER_WIDTH, _CONTROL_ORIENTATION_PORTRAIT, annexDividerWidth);
3860 GET_SHAPE_CONFIG(TABLEVIEW::ITEM_ANNEX_ONOFF_WIDTH, _CONTROL_ORIENTATION_PORTRAIT, annexWidth);
3861 annexWidth = annexWidth + (annexDividerWidth*2) + annexDividerWidth;
3864 case TABLE_VIEW_ANNEX_STYLE_DETAILED:
3865 GET_SHAPE_CONFIG(TABLEVIEW::ITEM_ANNEX_MORE_WIDTH, _CONTROL_ORIENTATION_PORTRAIT, annexWidth);
3868 case TABLE_VIEW_ANNEX_STYLE_RADIO:
3869 GET_SHAPE_CONFIG(TABLEVIEW::ITEM_ANNEX_WIDTH, _CONTROL_ORIENTATION_PORTRAIT, annexWidth);
3880 _TableViewItem::SetDrawingStatus(TableViewItemDrawingStatus status)
3882 __drawingStatus = status;
3885 TableViewItemDrawingStatus
3886 _TableViewItem::GetDrawingStatus(void)
3888 return __drawingStatus;
3892 _TableViewItem::SetPressedControl(TableViewItemPressedControl pressedControl)
3894 __pressedControl = pressedControl;
3896 if (__pressedControl == TABLE_VIEW_ITEM_PRESSED_ITEM)
3898 __drawingStatus = TABLE_VIEW_ITEM_DRAWING_STATUS_PRESSED;
3900 else if (__pressedControl == TABLE_VIEW_ITEM_PRESSED_ANNEX)
3902 if (__annexStyle == TABLE_VIEW_ANNEX_STYLE_DETAILED)
3904 __isSelectedDetailButton = true;
3905 __drawingStatus = TABLE_VIEW_ITEM_DRAWING_STATUS_NORMAL;
3907 else if (__annexStyle == TABLE_VIEW_ANNEX_STYLE_ONOFF_SLIDING ||
3908 __annexStyle == TABLE_VIEW_ANNEX_STYLE_ONOFF_SLIDING_WITH_DIVIDER)
3910 __drawingStatus = TABLE_VIEW_ITEM_DRAWING_STATUS_NORMAL;
3914 __drawingStatus = TABLE_VIEW_ITEM_DRAWING_STATUS_PRESSED;
3919 if (__pressedControl != TABLE_VIEW_ITEM_PRESSED_INDIVIDUAL)
3921 __drawingStatus = TABLE_VIEW_ITEM_DRAWING_STATUS_PRESSED;
3926 TableViewItemPressedControl
3927 _TableViewItem::GetPressedControl(void)
3929 return __pressedControl;
3933 _TableViewItem::AdjustChildControlMargin(void)
3935 if (__childMarginState)
3940 if (IsTitleStyleItem())
3945 __childMarginState = true;
3949 if (__pDrawingProperty->groupedLookEnabled)
3951 float groupedBarMargin = 0.0f;
3952 GET_SHAPE_CONFIG(TABLEVIEW::GROUPITEM_BAR_WIDTH, _CONTROL_ORIENTATION_PORTRAIT, groupedBarMargin);
3954 margin = margin + groupedBarMargin;
3959 _VisualElement* pVisualElement = GetVisualElement();
3961 if (pVisualElement != null)
3963 FloatPoint position;
3965 position.SetPosition(margin, 0.0f);
3966 pVisualElement->ScrollByPoint(position, false);
3972 _TableViewItem::AdjustContextItemBounds(void)
3974 _TableViewItem* pContextItem = GetContextItem();
3976 if (pContextItem == null)
3981 FloatDimension contextItemSize = pContextItem->GetSizeF();
3982 FloatDimension itemSize = GetSizeF();
3984 if (!_FloatCompare(contextItemSize.height, itemSize.height))
3986 contextItemSize.height = itemSize.height;
3988 pContextItem->SetSize(contextItemSize);
3991 pContextItem->AdjustChildControlCenterAlign();
3995 _TableViewItem::AdjustAnnexBounds(void)
3997 if (__pItemAnnex == null || __isMoveItemAnimationEnabled || __isZoomInOutItemAnimationEnabled ||__isFadeInOutItemAnimationEnabled)
4003 if (__annexStyle == TABLE_VIEW_ANNEX_STYLE_ONOFF_SLIDING || __annexStyle == TABLE_VIEW_ANNEX_STYLE_ONOFF_SLIDING_WITH_DIVIDER || __annexStyle == TABLE_VIEW_ANNEX_STYLE_DETAILED)
4005 _Label* pAnnexCore = GetLabelCore(__pItemAnnex);
4006 if (pAnnexCore->HasParent())
4008 FloatRectangle annexBounds = __pItemAnnex->GetBoundsF();
4009 float annexPositionX = annexBounds.x;
4010 float leftMargin = 0.0f;
4012 GET_SHAPE_CONFIG(TABLEVIEW::ITEM_LEFT_MARGIN, _CONTROL_ORIENTATION_PORTRAIT, leftMargin);
4013 leftMargin += __pDrawingProperty->scrollMargin;
4015 annexPositionX = GetBoundsF().width - annexBounds.width - leftMargin;
4017 if (!_FloatCompare(annexPositionX, annexBounds.x))
4019 __pItemAnnex->SetPosition(FloatPoint(annexPositionX, annexBounds.y));
4021 if (__pAccessibilityOnOffElement != null)
4023 __pAccessibilityOnOffElement->SetBounds(__pItemAnnex->GetBoundsF());
4030 FloatRectangle itemBounds = GetBoundsF();
4031 FloatRectangle annexBounds = __pItemAnnex->GetBoundsF();
4033 if (__customHeight > 0)
4035 itemBounds.height = __customHeight;
4038 annexBounds.y = (itemBounds.height - annexBounds.height) / 2;
4039 __pItemAnnex->SetPosition(FloatPoint(annexBounds.x, annexBounds.y));
4040 if (__pAccessibilityOnOffElement != null)
4042 __pAccessibilityOnOffElement->SetBounds(__pItemAnnex->GetBoundsF());
4047 _TableViewItem::SetItemCustomHeight(float height)
4049 __customHeight = height;
4053 _TableViewItem::GetItemCustomHeight(void)
4055 return __customHeight;
4059 _TableViewItem::AdjustChildControlCenterAlign(void)
4061 if (__childControlCenterAlign)
4063 FloatDimension itemSize = GetSizeF();
4065 int childControlCount = GetChildCount();
4067 for (int i = 0; i < childControlCount; i++)
4069 _Control* pChildControl = GetChild(i);
4071 if (pChildControl == null)
4076 if (__pItemDivider == pChildControl)
4078 float positionX = pChildControl->GetPositionF().x;
4079 pChildControl->SetPosition(FloatPoint(positionX, itemSize.height - 1));
4083 if (__pItemTopDivider == pChildControl)
4085 float positionX = pChildControl->GetPositionF().x;
4086 pChildControl->SetPosition(FloatPoint(positionX, 0));
4090 FloatRectangle itemBounds = pChildControl->GetBoundsF();
4092 itemBounds.y = (itemSize.height - itemBounds.height) / 2;
4094 pChildControl->SetPosition(FloatPoint(itemBounds.x, itemBounds.y));
4100 _TableViewItem::SetChildControlCenterAlign(bool centerAlign)
4102 __childControlCenterAlign = centerAlign;
4106 _TableViewItem::GetLastTouchPressedPosition(void)
4108 return _CoordinateSystemUtils::ConvertToInteger(__touchStartPosition);
4112 _TableViewItem::GetLastTouchPressedPositionF(void)
4114 return __touchStartPosition;
4118 _TableViewItem::SetLastTouchPressedPosition(FloatPoint position)
4120 // This function was made to modify of ListView::RefreshList().
4121 // This function could adversely affect touch event handling. So, you should be used with caution.
4122 __touchStartPosition = position;
4126 _TableViewItem::SetLastTouchPressedPosition(Point position)
4128 // This function was made to modify of ListView::RefreshList().
4129 // This function could adversely affect touch event handling. So, you should be used with caution.
4130 __touchStartPosition = _CoordinateSystemUtils::ConvertToFloat(position);
4134 _TableViewItem::GetSelectionState(void)
4136 return __itemSelected;
4140 _TableViewItem::SetSelectionState(bool selected)
4142 // This function was made to modify of ListView::RefreshList().
4143 // This function could adversely affect touch event handling. So, you should be used with caution.
4144 __itemSelected = selected;
4148 _TableViewItem::MoveItem(FloatPoint position, int duration, int delay)
4150 _VisualElement* pVisualElement = GetVisualElement();
4151 VisualElementValueAnimation* pAnimation = null;
4152 String animationName = L"MOVE_ITEM";
4153 FloatPoint itemPosition = GetPositionF();
4154 result r = E_SUCCESS;
4156 if (position == itemPosition)
4161 if (__pMoveItemAnimation == null)
4163 __pMoveItemAnimation = new (std::nothrow) VisualElementValueAnimation;
4164 SysTryCatch(NID_UI_CTRL, __pMoveItemAnimation != null, , E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
4166 __pMoveItemAnimation->SetVisualElementAnimationTickEventListener(this);
4167 r = GetLastResult();
4168 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
4170 __pMoveItemAnimation->SetVisualElementAnimationStatusEventListener(this);
4171 r = GetLastResult();
4172 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
4175 pAnimation = __pMoveItemAnimation;
4177 pAnimation->SetTimingFunction(VisualElementAnimation::GetTimingFunctionByName("EaseInOut"));
4178 pAnimation->SetDuration(duration);
4179 pAnimation->SetDelay(delay);
4180 pAnimation->SetStartValue(Variant(GetPositionF()));
4181 pAnimation->SetEndValue(Variant(position));
4183 if (pVisualElement->AddAnimation(animationName, *pAnimation) != E_SUCCESS)
4194 delete __pMoveItemAnimation;
4195 __pMoveItemAnimation = null;
4201 _TableViewItem::ZoomInOutItem(bool zoomOut, int duration, int delay)
4203 _VisualElement* pVisualElement = GetVisualElement();
4204 VisualElementValueAnimation* pAnimation = null;
4205 String animationName = L"ZOOM_IN_OUT_ITEM";
4206 FloatDimension itemSize = GetSizeF();
4207 FloatDimension startValue;
4208 FloatDimension endValue;
4209 result r = E_SUCCESS;
4211 if (__pZoomInOutItemAnimation == null)
4213 __pZoomInOutItemAnimation = new (std::nothrow) VisualElementValueAnimation;
4214 SysTryCatch(NID_UI_CTRL, __pZoomInOutItemAnimation != null, , E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
4216 __pZoomInOutItemAnimation->SetVisualElementAnimationTickEventListener(this);
4217 r = GetLastResult();
4218 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
4220 __pZoomInOutItemAnimation->SetVisualElementAnimationStatusEventListener(this);
4221 r = GetLastResult();
4222 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
4225 pAnimation = __pZoomInOutItemAnimation;
4229 startValue = itemSize;
4230 endValue = FloatDimension(itemSize.width, itemSize.height / 2);
4231 pAnimation->SetTimingFunction(VisualElementAnimation::GetTimingFunctionByName(L"EaseOut"));
4235 startValue = FloatDimension(itemSize.width, itemSize.height / 2);
4236 endValue = itemSize;
4237 pAnimation->SetTimingFunction(VisualElementAnimation::GetTimingFunctionByName(L"EaseIn"));
4240 pAnimation->SetDuration(duration);
4241 pAnimation->SetDelay(delay);
4242 pAnimation->SetStartValue(Variant(startValue));
4243 pAnimation->SetEndValue(Variant(endValue));
4245 if (pVisualElement->AddAnimation(animationName, *pAnimation) != E_SUCCESS)
4255 delete __pZoomInOutItemAnimation;
4256 __pZoomInOutItemAnimation = null;
4262 _TableViewItem::FadeInOutItem(bool fadeOut, int duration, int delay)
4264 _VisualElement* pVisualElement = GetVisualElement();
4265 VisualElementValueAnimation* pAnimation = null;
4266 String animationName = L"FADE_IN_OUT_ITEM";
4267 float startValue = 0.0f;
4268 float endValue = 1.0f;
4269 result r = E_SUCCESS;
4271 if (__pFadeInOutItemtAnimation == null)
4273 __pFadeInOutItemtAnimation = new (std::nothrow) VisualElementValueAnimation;
4274 SysTryCatch(NID_UI_CTRL, __pFadeInOutItemtAnimation != null, , E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
4276 __pFadeInOutItemtAnimation->SetVisualElementAnimationTickEventListener(this);
4277 r = GetLastResult();
4278 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
4280 __pFadeInOutItemtAnimation->SetVisualElementAnimationStatusEventListener(this);
4281 r = GetLastResult();
4282 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
4285 pAnimation = __pFadeInOutItemtAnimation;
4291 pAnimation->SetTimingFunction(VisualElementAnimation::GetTimingFunctionByName(L"EaseOut"));
4295 pAnimation->SetTimingFunction(VisualElementAnimation::GetTimingFunctionByName(L"EaseIn"));
4298 pAnimation->SetTimingFunction(VisualElementAnimation::GetTimingFunctionByName("EaseIn"));
4299 pAnimation->SetDuration(duration);
4300 pAnimation->SetDelay(delay);
4301 pAnimation->SetStartValue(Variant(startValue));
4302 pAnimation->SetEndValue(Variant(endValue));
4304 if (pVisualElement->AddAnimation(animationName, *pAnimation) != E_SUCCESS)
4309 pVisualElement->SetOpacity(startValue);
4317 delete __pFadeInOutItemtAnimation;
4318 __pFadeInOutItemtAnimation = null;
4324 _TableViewItem::SetIndividualSelectionEnabled(const _Control& control, bool enable)
4326 result r = E_SUCCESS;
4329 if (!__individualSelectionControls.Contains(control))
4331 r = __individualSelectionControls.Add(control);
4334 _AccessibilityContainer* pContainer = const_cast<_Control*>(&control)->GetAccessibilityContainer();
4335 pContainer->Activate(true);
4336 int controlCount = 0;
4337 for (int i=0; i<GetChildCount(); i++)
4339 _Control* pChildControl = GetChild(i);
4340 if (pChildControl == static_cast<_Control*>(__pItemAnnexLeftDivider)
4341 || pChildControl == static_cast<_Control*>(__pItemAnnexRightDivider)
4342 || pChildControl == static_cast<_Control*>(__pItemCover)
4343 || pChildControl == static_cast<_Control*>(__pItemDivider)
4344 || pChildControl== static_cast<_Control*>(__pItemTopDivider))
4352 if (controlCount == 0 || __individualSelectionControls.GetCount() == controlCount)
4354 GetAccessibilityContainer()->Activate(false);
4358 GetAccessibilityContainer()->Activate(true);
4363 if (__individualSelectionControls.Contains(control))
4365 r = __individualSelectionControls.Remove(control, false);
4372 _TableViewItem::IsIndividualSelectionEnabled(const _Control& control)
4374 return __individualSelectionControls.Contains(control);
4378 _TableViewItem::AddRef(void)
4380 return ++__refCount;
4384 _TableViewItem::Release(void)
4387 if (__refCount <= 0)
4397 _TableViewItem::IsAnimationPlaying(void)
4399 if (__animationCount > 0)
4408 _TableViewItem::StopAllAnimation(void)
4410 _VisualElement* pVisualElement = GetVisualElement();
4412 pVisualElement->RemoveAllAnimations();
4416 _TableViewItem::SetItemDividerEnabled(bool enable)
4418 __itemDividerEnabled = enable;
4422 _TableViewItem::OnTickOccurred(const Tizen::Ui::Animations::VisualElementAnimation& animation, const Tizen::Base::String& keyName, Tizen::Ui::Animations::VisualElement& target, const Tizen::Ui::Variant& currentValue)
4424 if (keyName == L"MOVE_ITEM")
4426 FloatPoint position = currentValue.ToFloatPoint();
4427 SetPosition(position);
4429 else if (keyName == L"FADE_IN_OUT_ITEM")
4431 float opacity = currentValue.ToFloat();
4433 _VisualElement* pVisualElement = GetVisualElement();
4435 if (pVisualElement != null)
4437 pVisualElement->SetOpacity(opacity);
4440 else if (keyName == L"ZOOM_IN_OUT_ITEM")
4442 FloatDimension size = currentValue.ToFloatDimension();
4448 _TableViewItem::OnVisualElementAnimationStarted(const Tizen::Ui::Animations::VisualElementAnimation& animation, const Tizen::Base::String& keyName, Tizen::Ui::Animations::VisualElement& target)
4450 if (keyName == L"MOVE_ITEM")
4452 __isMoveItemAnimationEnabled = true;
4454 else if (keyName == L"FADE_IN_OUT_ITEM")
4456 __isFadeInOutItemAnimationEnabled = true;
4458 else if (keyName == L"ZOOM_IN_OUT_ITEM")
4460 __isZoomInOutItemAnimationEnabled = true;
4465 _TableViewItem::OnVisualElementAnimationRepeated(const Tizen::Ui::Animations::VisualElementAnimation& animation, const Tizen::Base::String& keyName, Tizen::Ui::Animations::VisualElement& target, long currentRepeatCount)
4470 _TableViewItem::OnVisualElementAnimationFinished(const Tizen::Ui::Animations::VisualElementAnimation& animation, const Tizen::Base::String& keyName, Tizen::Ui::Animations::VisualElement& target, bool completedNormally)
4472 if (__isAnimationCallbackBlocked)
4477 bool tableViewItemAnimation = true;
4478 const VisualElementValueAnimation *pAnimation = dynamic_cast<const VisualElementValueAnimation*>(&(animation));
4480 if (keyName == L"MOVE_ITEM")
4482 if (pAnimation != null)
4484 FloatPoint position = pAnimation->GetEndValue().ToFloatPoint();
4486 SetPosition(position);
4488 __isMoveItemAnimationEnabled = false;
4490 else if (keyName == L"FADE_IN_OUT_ITEM")
4492 if (pAnimation != null)
4494 float opacity = pAnimation->GetEndValue().ToFloat();
4496 _VisualElement* pVisualElement = GetVisualElement();
4498 if (pVisualElement != null)
4500 pVisualElement->SetOpacity(opacity);
4504 __isFadeInOutItemAnimationEnabled = false;
4506 else if (keyName == L"ZOOM_IN_OUT_ITEM")
4508 if (pAnimation != null)
4510 FloatDimension size = pAnimation->GetEndValue().ToFloatDimension();
4514 __isZoomInOutItemAnimationEnabled = false;
4518 tableViewItemAnimation = false;
4521 if (tableViewItemAnimation)
4530 _TableViewItem::OnAttachedToMainTree(void)
4532 if (!_FloatCompare(GetBoundsF().height, 0.0f))
4534 SetAccessibilityElement();
4541 _TableViewItem::SetAccessibilityElement(void)
4543 _AccessibilityContainer* pContainer = GetAccessibilityContainer();
4545 if (pContainer != null)
4547 if (__pAccessibilityElement == null)
4549 __pAccessibilityElement = new (std::nothrow) _AccessibilityElement(true);
4550 SysTryReturnVoidResult(NID_UI_CTRL, __pAccessibilityElement, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
4552 __pAccessibilityElement->SetTrait(ACCESSIBILITY_TRAITS_NONE);
4553 __pAccessibilityElement->SetName(L"TableViewItem");
4555 pContainer->AddElement(*__pAccessibilityElement);
4557 __pAccessibilityElement->SetBounds(FloatRectangle(0.0f,0.0f, GetBoundsF().width, GetBoundsF().height));
4559 if (__pAccessibilityOnOffElement == null && __annexStyle == TABLE_VIEW_ANNEX_STYLE_ONOFF_SLIDING_WITH_DIVIDER)
4561 __pAccessibilityOnOffElement = new (std::nothrow) _AccessibilityElement(true);
4562 SysTryReturnVoidResult(NID_UI_CTRL, __pAccessibilityOnOffElement, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
4564 __pAccessibilityOnOffElement->SetTraitWithStringId("IDS_TPLATFORM_BODY_ON_OFF_BUTTON_T_TTS");
4565 __pAccessibilityOnOffElement->SetName(L"OnOffButton");
4566 __pAccessibilityOnOffElement->SetHintWithStringId("IDS_TPLATFORM_BODY_DOUBLE_TAP_TO_MOVE_TO_CONTENT_T_TTS");
4568 pContainer->AddElement(*__pAccessibilityOnOffElement);
4569 __pAccessibilityOnOffElement->SetBounds(FloatRectangle(0.0f, 0.0f, 0.0f, 0.0f));
4574 _AccessibilityElement*
4575 _TableViewItem::GetAccessibilityElement(void)
4577 return __pAccessibilityElement;
4580 _TableViewItem::SetAccessibilityElementTrait(void)
4582 if (__pAccessibilityElement == null)
4586 int groupIndex = -1;
4589 switch (__annexStyle)
4591 case TABLE_VIEW_ANNEX_STYLE_NORMAL:
4592 GetItemIndex(groupIndex, itemIndex);
4593 if (groupIndex != -1 && itemIndex == -1)
4595 __pAccessibilityElement->SetTraitWithStringId("IDS_TPLATFORM_BODY_GROUP_INDEX");
4599 case TABLE_VIEW_ANNEX_STYLE_MARK:
4600 __pAccessibilityElement->SetTraitWithStringId("IDS_TPLATFORM_BODY_TICKBOX_T_TTS");
4603 case TABLE_VIEW_ANNEX_STYLE_ONOFF_SLIDING:
4604 __pAccessibilityElement->SetTraitWithStringId("IDS_TPLATFORM_BODY_ON_OFF_BUTTON_T_TTS");
4607 case TABLE_VIEW_ANNEX_STYLE_ONOFF_SLIDING_WITH_DIVIDER:
4610 case TABLE_VIEW_ANNEX_STYLE_DETAILED:
4611 __pAccessibilityElement->SetTraitWithStringId("IDS_TPLATFORM_BODY_BUTTON_T_TTS");
4614 case TABLE_VIEW_ANNEX_STYLE_RADIO:
4615 __pAccessibilityElement->SetTraitWithStringId("IDS_TPLATFORM_BODY_RADIO_BUTTON_T_TTS");
4623 _TableViewItem::SetAccessibilityElementValue(void)
4625 if (__pAccessibilityElement == null)
4630 switch (__annexStyle)
4632 case TABLE_VIEW_ANNEX_STYLE_MARK:
4635 __pAccessibilityElement->SetValueWithStringId("IDS_TPLATFORM_BODY_TICK_T_TTS");
4639 __pAccessibilityElement->SetValueWithStringId("IDS_TPLATFORM_BODY_UNTICK_T_TTS");
4643 case TABLE_VIEW_ANNEX_STYLE_ONOFF_SLIDING:
4646 __pAccessibilityElement->SetValueWithStringId("IDS_TPLATFORM_BODY_ON");
4650 __pAccessibilityElement->SetValueWithStringId("IDS_TPLATFORM_BODY_OFF");
4654 case TABLE_VIEW_ANNEX_STYLE_ONOFF_SLIDING_WITH_DIVIDER:
4657 if (__pAccessibilityOnOffElement != null)
4659 __pAccessibilityOnOffElement->SetValueWithStringId("IDS_TPLATFORM_BODY_ON");
4664 if (__pAccessibilityOnOffElement != null)
4666 __pAccessibilityOnOffElement->SetValueWithStringId("IDS_TPLATFORM_BODY_OFF");
4671 case TABLE_VIEW_ANNEX_STYLE_RADIO:
4674 __pAccessibilityElement->SetValueWithStringId("IDS_TPLATFORM_BODY_SELECTED_T_TTS");
4678 __pAccessibilityElement->SetValueWithStringId("IDS_TPLATFORM_BODY_NOT_SELECTED_T_TTS");
4687 _TableViewItem::SetAccessibilityElementLabel(void)
4689 if (__pAccessibilityElement == null)
4694 if (__pAccessibilityElement->IsPublicLabelUpdated())
4699 String accessibilityLabel;
4700 String space = L" ";
4701 int childControlCount = GetChildCount();
4703 for (int i = 0; i < childControlCount; i++)
4705 _Control* pChildControl = GetChild(i);
4707 if (pChildControl == null)
4712 if (__pItemDivider == pChildControl || __pItemTopDivider == pChildControl || __pItemCover == pChildControl)
4717 accessibilityLabel += GetChildAccessibilityLabelContent(*pChildControl);
4718 accessibilityLabel += space;
4721 __pAccessibilityElement->SetLabel(accessibilityLabel);
4726 _TableViewItem::OnAccessibilityFocusMovedNext(const _AccessibilityContainer& control, const _AccessibilityElement& element)
4732 _TableViewItem::OnAccessibilityFocusMovedPrevious(const _AccessibilityContainer& control, const _AccessibilityElement& element)
4738 _TableViewItem::OnAccessibilityReadElement(const _AccessibilityContainer& control, const _AccessibilityElement& element)
4744 _TableViewItem::OnAccessibilityReadingElement(const _AccessibilityContainer& control, const _AccessibilityElement& element)
4746 SetAccessibilityElementLabel();
4747 SetAccessibilityElementTrait();
4748 SetAccessibilityElementValue();
4753 _TableViewItem::OnAccessibilityFocusIn(const _AccessibilityContainer& control, const _AccessibilityElement& element)
4759 _TableViewItem::OnAccessibilityFocusOut(const _AccessibilityContainer& control, const _AccessibilityElement& element)
4765 _TableViewItem::OnAccessibilityActionPerformed(const _AccessibilityContainer& control, const _AccessibilityElement& element)
4767 switch (__annexStyle)
4769 case TABLE_VIEW_ANNEX_STYLE_NORMAL:
4772 case TABLE_VIEW_ANNEX_STYLE_MARK:
4776 GET_STRING_CONFIG(IDS_TPLATFORM_BODY_TICK_T_TTS,string);
4777 _AccessibilityManager::GetInstance()->ReadContent(string);
4782 GET_STRING_CONFIG(IDS_TPLATFORM_BODY_UNTICK_T_TTS,string);
4783 _AccessibilityManager::GetInstance()->ReadContent(string);
4786 case TABLE_VIEW_ANNEX_STYLE_ONOFF_SLIDING:
4790 GET_STRING_CONFIG(IDS_TPLATFORM_BODY_ON,string);
4791 _AccessibilityManager::GetInstance()->ReadContent(string);
4796 GET_STRING_CONFIG(IDS_TPLATFORM_BODY_OFF,string);
4797 _AccessibilityManager::GetInstance()->ReadContent(string);
4801 case TABLE_VIEW_ANNEX_STYLE_ONOFF_SLIDING_WITH_DIVIDER:
4802 if (&element == __pAccessibilityOnOffElement && IsEnabled())
4808 GET_STRING_CONFIG(IDS_TPLATFORM_BODY_OFF,string);
4809 _AccessibilityManager::GetInstance()->ReadContent(string);
4815 GET_STRING_CONFIG(IDS_TPLATFORM_BODY_ON,string);
4816 _AccessibilityManager::GetInstance()->ReadContent(string);
4821 case TABLE_VIEW_ANNEX_STYLE_DETAILED:
4824 case TABLE_VIEW_ANNEX_STYLE_RADIO:
4828 GET_STRING_CONFIG(IDS_TPLATFORM_OPT_SELECT,string);
4829 _AccessibilityManager::GetInstance()->ReadContent(string);
4834 GET_STRING_CONFIG(IDS_TPLATFORM_BODY_NOT_SELECTED_T_TTS,string);
4835 _AccessibilityManager::GetInstance()->ReadContent(string);
4846 _TableViewItem::OnAccessibilityValueIncreased(const _AccessibilityContainer& control, const _AccessibilityElement& element)
4852 _TableViewItem::OnAccessibilityValueDecreased(const _AccessibilityContainer& control, const _AccessibilityElement& element)
4858 _TableViewItem::OnKeyPressed(const _Control& source, const _KeyInfo& keyInfo)
4860 __isTouchCancelOnPressRelease = false;
4862 if (!IsFocusModeStateEnabled())
4867 _TableView* pParent = dynamic_cast<_TableView*>(GetParent());
4868 _KeyCode keyCode = keyInfo.GetKeyCode();
4869 IListT<_Control*>* pFocusList = GetFocusListN();
4870 SysTryReturn(NID_UI_CTRL, pFocusList != null, true, GetLastResult(), "[%s] propagating.", GetErrorMessage(GetLastResult()));
4872 _Control* pChildControl = null;
4873 _Control* pFocusedControl = null;
4874 _Window* pTop = source.GetRootWindow();
4878 pFocusedControl = pTop->GetCurrentFocusControl();
4881 int count = pFocusList->GetCount();
4883 if (pFocusedControl == null)
4893 for (int i=count-1; i>=0; i--)
4895 pFocusList->GetAt(i, pChildControl);
4896 if (pChildControl == null)
4901 if (pChildControl->IsFocused())
4905 pChildControl = null;
4909 for (int j=i-1; j>=0; j--)
4911 pFocusList->GetAt(j, pChildControl);
4912 if (pChildControl == null)
4917 if (pChildControl->IsFocusable() && pChildControl->GetEnableState()
4918 && pChildControl->GetVisibleState())
4924 pChildControl = null;
4931 if (pChildControl && pChildControl->GetEnableState()
4932 && pChildControl->GetVisibleState() && pChildControl->IsFocusable())
4934 if (pParent != null)
4936 pParent->SetAnnexFocused(true);
4938 pChildControl->SetFocused(true);
4939 pChildControl->DrawFocus();
4943 _Control* pParentControl = pFocusedControl->GetParent();
4944 _TableViewItem* pItem = dynamic_cast<_TableViewItem*>(pParentControl);
4946 if (pItem != null && pItem->GetEnableState() && !pItem->IsFocused()
4947 && pItem->GetVisibleState() && pItem->IsFocusable())
4949 if (pParent != null)
4951 pParent->SetAnnexFocused(false);
4953 pItem->SetFocused(true);
4963 if (pChildControl == null)
4965 for (int i=0; i<count; i++)
4967 pFocusList->GetAt(i, pChildControl);
4968 if (pChildControl == null)
4973 if (pChildControl->IsFocusable() && pChildControl->GetEnableState()
4974 && pChildControl->GetVisibleState())
4980 pChildControl = null;
4987 for (int i=0; i<count; i++)
4989 pFocusList->GetAt(i, pChildControl);
4990 if (pChildControl == null)
4995 if (pChildControl->IsFocused())
4999 pChildControl = null;
5003 for (int j=i+1; j<count; j++)
5005 pFocusList->GetAt(j, pChildControl);
5006 if (pChildControl == null)
5011 if (pChildControl->IsFocusable() && pChildControl->GetEnableState()
5012 && pChildControl->GetVisibleState())
5018 pChildControl = null;
5026 if (pChildControl && pChildControl->GetEnableState() && pChildControl->GetVisibleState()
5027 && pChildControl->IsFocusable())
5029 if (pParent != null)
5031 pParent->SetAnnexFocused(true);
5033 pChildControl->SetFocused(true);
5034 pChildControl->DrawFocus();
5039 if (&source == this)
5041 __pressedControl = TABLE_VIEW_ITEM_PRESSED_ITEM;
5043 else if (&source == GetLabelCore(__pItemAnnex))
5045 __pressedControl = TABLE_VIEW_ITEM_PRESSED_ANNEX;
5047 else if (IsIndividualSelectionEnabled(source))
5049 __pressedControl = TABLE_VIEW_ITEM_PRESSED_INDIVIDUAL;
5053 __pressedControl = TABLE_VIEW_ITEM_PRESSED_NONE;
5055 __itemSelected = true;
5056 FireItemTouchPressed();
5062 __annexOnOffHandlerMoved = false;
5063 __itemTouchMoved = false;
5065 __itemSelected = false;
5066 __drawingStatus = TABLE_VIEW_ITEM_DRAWING_STATUS_NORMAL;
5068 if (__annexStyle == TABLE_VIEW_ANNEX_STYLE_DETAILED)
5070 __isSelectedDetailButton = false;
5073 SetItemChanged(true);
5083 _TableViewItem::OnKeyReleased(const _Control& source, const _KeyInfo& keyInfo)
5085 if (!IsFocusModeStateEnabled())
5090 _KeyCode keyCode = keyInfo.GetKeyCode();
5092 if (keyCode == _KEY_ENTER)
5094 _TableView* pParent = dynamic_cast<_TableView*>(GetParent());
5095 SysTryReturn(NID_UI_CTRL, pParent != null, true, GetLastResult(), "[%s] propagating.", GetErrorMessage(GetLastResult()));
5097 pParent->StopExpandCollapseAnimation();
5098 if (&source == this)
5100 __releasedControl = TABLE_VIEW_ITEM_PRESSED_ITEM;
5102 else if (&source == GetLabelCore(__pItemAnnex))
5104 __releasedControl = TABLE_VIEW_ITEM_PRESSED_ANNEX;
5106 else if (IsIndividualSelectionEnabled(source))
5108 __releasedControl = TABLE_VIEW_ITEM_PRESSED_INDIVIDUAL;
5112 __releasedControl = TABLE_VIEW_ITEM_PRESSED_NONE;
5114 FireItemTouchReleased();
5117 else if (keyCode == _KEY_LEFT || keyCode == _KEY_RIGHT)
5126 _TableViewItem::OnFocusModeStateChanged(void)
5128 __releasedControl = TABLE_VIEW_ITEM_PRESSED_NONE;
5134 _TableViewItem::ResetItemState(void)
5136 __itemSelected = false;
5137 __drawingStatus = TABLE_VIEW_ITEM_DRAWING_STATUS_NORMAL;
5139 if (__annexStyle == TABLE_VIEW_ANNEX_STYLE_DETAILED)
5141 __isSelectedDetailButton = false;
5144 SetItemChanged(true);
5149 _TableViewItem::GetPreviousFocusChildControl(const _Control& source)
5151 _Control* pParentControl = null;
5152 float sourcePosition = 0.0f;
5154 _Control* pSource = const_cast<_Control*>(&source);
5155 _TableViewItem* pItem = dynamic_cast<_TableViewItem*>(pSource);
5158 pParentControl = pSource;
5159 sourcePosition = pParentControl->GetBoundsF().width;
5163 pParentControl = source.GetParent();
5164 sourcePosition = source.GetBoundsF().x;
5167 if (pParentControl == null)
5172 int childControlCount = pParentControl->GetChildCount();
5173 float position = 0.0f;
5174 _Control* destination = null;
5176 for (int i=0; i<childControlCount; i++)
5178 _Control* pChildControl = pParentControl->GetChild(i);
5179 if (pChildControl != null && pChildControl->IsFocusable())
5181 float childPosition = pChildControl->GetBoundsF().x;
5182 if (childPosition < sourcePosition)
5184 if (childPosition > position)
5186 position = childPosition;
5187 destination = pChildControl;
5189 else if (_FloatCompare(position, 0.0f))
5191 position = childPosition;
5192 destination = pChildControl;
5201 _TableViewItem::GetNextFocusChildControl(const _Control& source)
5203 _Control* pParentControl = null;
5204 float sourcePosition = 0.0f;
5206 _Control* pSource = const_cast<_Control*>(&source);
5207 _TableViewItem* pItem = dynamic_cast<_TableViewItem*>(pSource);
5210 pParentControl = pSource;
5211 sourcePosition = 0.0f;
5215 pParentControl = source.GetParent();
5216 sourcePosition = source.GetBoundsF().x;
5219 if (pParentControl == null)
5224 int childControlCount = pParentControl->GetChildCount();
5225 float position = 0.0f;
5226 _Control* destination = null;
5228 for (int i=0; i<childControlCount; i++)
5230 _Control* pChildControl = pParentControl->GetChild(i);
5231 if (pChildControl != null && pChildControl->IsFocusable())
5233 float childPosition = pChildControl->GetBoundsF().x;
5234 if (childPosition > sourcePosition)
5236 if (childPosition < position)
5238 position = childPosition;
5239 destination = pChildControl;
5241 else if (_FloatCompare(position, 0.0f))
5243 position = childPosition;
5244 destination = pChildControl;
5253 _TableViewItem::IsChildControlFocusManage(void) const
5259 _TableViewItem::SetSimpleLastItemEnabled(bool enable)
5261 __isSimpleLastItem = enable;
5265 _TableViewItem::SetSectionItem(bool isSectionItem)
5267 __isSectionItem = isSectionItem;
5271 _TableViewItem::SetTouchPressOnScroll(bool isTouch)
5273 __isTouchPressOnScroll = isTouch;
5277 _TableViewItem::IsTouchPressOnScroll(void) const
5279 return __isTouchPressOnScroll;
5283 _TableViewItem::OnVisibleStateChanged(void)
5292 _TableViewItem::OnAncestorEnableStateChanged(const _Control& control)
5301 _TableViewItem::OnAncestorVisibleStateChanged(const _Control& control)
5310 _TableViewItem::OnFocusableStateChanged(bool focusableState)
5312 if (IsFocused() && !focusableState)
5319 _TableViewItem::SetPublicLabelUpdate(bool resetPublicLabelUpdate)
5321 if (__pAccessibilityElement)
5323 __pAccessibilityElement->SetPublicLabelUpdate(resetPublicLabelUpdate);
5328 _TableViewItem::GetChildAccessibilityLabelContent(const _Control& source)
5330 String accessibilityLabel = L"";
5331 String space = L" ";
5333 if (IsIndividualSelectionEnabled(source))
5335 return accessibilityLabel;
5338 if (!source.IsVisible() || !source.GetEnableState())
5340 return accessibilityLabel;
5343 _Control* pSource = const_cast<_Control*>(&source);
5347 _AccessibilityContainer* pContainer = pSource->GetAccessibilityContainer();
5348 LinkedListT<_AccessibilityElement*> accessibilityElements;
5349 _AccessibilityElement* pElement = null;
5353 pContainer->GetElements(accessibilityElements);
5354 int elementCount = accessibilityElements.GetCount();
5356 for (int i = 0; i < elementCount; i++)
5358 if (accessibilityElements.GetAt(i, pElement) == E_SUCCESS)
5360 accessibilityLabel += pElement->GetLabel();
5361 accessibilityLabel += space;
5367 //check for children
5368 int childControlCount = source.GetChildCount();
5370 for (int i = 0; i < childControlCount; i++)
5372 _Control* pChildControl = source.GetChild(i);
5374 if (pChildControl == null)
5379 accessibilityLabel += GetChildAccessibilityLabelContent(*pChildControl);
5382 return accessibilityLabel;
5386 _TableViewItem::DeactivateChildAccessibilityContainer(const _Control& source)
5388 _Control* pControl = const_cast<_Control*>(&source);
5392 _AccessibilityContainer* pContainer = pControl->GetAccessibilityContainer();
5396 if (__individualSelectionControls.Contains(source))
5398 pContainer->Activate(true);
5402 pContainer->Activate(false);
5407 //check for children
5408 int childControlCount = source.GetChildCount();
5410 for (int i = 0; i < childControlCount; i++)
5412 _Control* pChildControl = source.GetChild(i);
5414 if (pChildControl == null)
5419 DeactivateChildAccessibilityContainer(*pChildControl);
5423 }}} // Tizen::Ui::Controls