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_GroupedListViewImpl.cpp
20 * @brief This is the implementation file for
21 * _GroupedListViewImpl class.
23 * This file contains the implementation of _GroupedListViewImpl
27 #include <FBaseSysLog.h>
28 #include <FApp_AppInfo.h>
29 #include <FGrp_TextTextSimple.h>
30 #include "FUi_AccessibilityContainer.h"
31 #include "FUi_AccessibilityElement.h"
32 #include "FUi_AccessibilityManager.h"
33 #include "FUi_CoordinateSystemUtils.h"
34 #include "FUi_ITouchLongPressGestureEventListener.h"
36 #include "FUi_ResourceManager.h"
37 #include "FUi_TouchEventArg.h"
38 #include "FUi_TouchLongPressGestureDetector.h"
39 #include "FUi_TouchManager.h"
40 #include "FUi_UiBuilder.h"
41 #include "FUi_Window.h"
42 #include "FUiCtrl_FastScrollEvent.h"
43 #include "FUiCtrl_FastScrollEventArg.h"
44 #include "FUiCtrl_GroupedListViewImpl.h"
45 #include "FUiCtrl_GroupedListViewItemProviderAdaptor.h"
46 #include "FUiCtrl_Label.h"
47 #include "FUiCtrl_ListItemEvent.h"
48 #include "FUiCtrl_ListItemEventArg.h"
49 #include "FUiCtrl_ListViewItem.h"
50 #include "FUiCtrl_PublicLinkEvent.h"
51 #include "FUiCtrl_ScrollEvent.h"
52 #include "FUiCtrl_ScrollEventArg.h"
54 using namespace Tizen::Base;
55 using namespace Tizen::Base::Collection;
56 using namespace Tizen::Base::Runtime;
57 using namespace Tizen::Base::Utility;
58 using namespace Tizen::Graphics;
59 using namespace Tizen::Graphics::_Text;
61 namespace Tizen { namespace Ui { namespace Controls
64 class _GroupedListViewImpl::_GroupedListViewPropagatedTouchEventListener
65 : public Tizen::Ui::_IPropagatedTouchEventListener
66 , public Tizen::Ui::_ITouchLongPressGestureEventListener
70 _GroupedListViewPropagatedTouchEventListener(_GroupedListViewImpl& impl)
72 , __core(impl.GetCore())
73 , __public(impl.GetPublic())
74 , __oldPreviousPressedTime(0)
75 , __previousPressedTime(0)
76 , __currentPressedTime(0)
77 , __previousPressedPoint(0.0f, 0.0f)
78 , __currentPressedPoint(0.0f, 0.0f)
79 , __pLongPressedGesture(null)
81 __pTouchManager = _TouchManager::GetInstance();
82 SysTryReturnVoidResult(NID_UI_CTRL, (__pTouchManager != null), E_SYSTEM, "[E_SYSTEM] System error occurred.");
84 // Add _TouchLongPressGestureDetector
85 __pLongPressedGesture = new (std::nothrow) _TouchLongPressGestureDetector();
86 SysTryReturnVoidResult(NID_UI_CTRL, (__pLongPressedGesture != null), E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
88 __core.AddGestureDetector(*__pLongPressedGesture);
89 result r = __pLongPressedGesture->AddGestureListener(*this);
90 SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] propagating.", GetErrorMessage(r));
93 virtual ~_GroupedListViewPropagatedTouchEventListener(void)
95 if (__pLongPressedGesture != null)
97 __pLongPressedGesture->RemoveGestureListener(*this);
98 __core.RemoveGestureDetector(*__pLongPressedGesture);
100 delete __pLongPressedGesture;
101 __pLongPressedGesture = null;
105 virtual bool OnTouchPressed(const _Control& source, const _TouchInfo& touchInfo)
107 return __impl.CallOnTouchPressed(source, touchInfo);
110 virtual bool OnTouchReleased(const _Control& source, const _TouchInfo& touchInfo)
112 return __impl.CallOnTouchReleased(source, touchInfo);
115 virtual bool OnTouchMoved(const _Control& source, const _TouchInfo& touchInfo)
117 return __impl.CallOnTouchMoved(source, touchInfo);
120 virtual bool OnTouchCanceled(const _Control& source, const _TouchInfo& touchInfo)
122 return __impl.CallOnTouchCanceled(source, touchInfo);
125 virtual _UiTouchEventDelivery OnPreviewTouchPressed(const _Control& source, const _TouchInfo& touchInfo)
127 _UiTouchEventDelivery isFiltered = _UI_TOUCH_EVENT_DELIVERY_NO;
128 IPropagatedTouchEventListener* pListener = __impl.GetPublicPropagatedTouchEventListener();
130 if (pListener != null)
132 Control& control = __impl.GetPublic();
134 TouchEventInfo publicTouchInfo;
136 _TouchEventArg* pEventArg = GetTouchEventArgN(touchInfo);
137 SysTryReturn(NID_UI, pEventArg, _UI_TOUCH_EVENT_DELIVERY_YES, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory shortage.");
139 publicTouchInfo.Construct(*pEventArg);
147 if (pListener->OnTouchPressed(control, publicTouchInfo) == true)
149 return _UI_TOUCH_EVENT_DELIVERY_NO;
153 // public TouchEventListener
154 if (ProcessTouchEventListener(touchInfo) == true)
156 return _UI_TOUCH_EVENT_DELIVERY_NO;
159 if (__core.Equals(source))
161 return _UI_TOUCH_EVENT_DELIVERY_NO;
164 isFiltered = __impl.OnPreviewTouchPressed(__impl, touchInfo);
165 if (isFiltered == _UI_TOUCH_EVENT_DELIVERY_NO)
167 return _UI_TOUCH_EVENT_DELIVERY_NO;
170 isFiltered = __core.OnPreviewTouchPressed(source, touchInfo);
175 virtual _UiTouchEventDelivery OnPreviewTouchReleased(const _Control& source, const _TouchInfo& touchInfo)
177 _UiTouchEventDelivery isFiltered = _UI_TOUCH_EVENT_DELIVERY_NO;
178 IPropagatedTouchEventListener* pListener = __impl.GetPublicPropagatedTouchEventListener();
180 if (pListener != null)
182 Control& control = __impl.GetPublic();
184 TouchEventInfo publicTouchInfo;
186 _TouchEventArg* pEventArg = GetTouchEventArgN(touchInfo);
187 SysTryReturn(NID_UI, pEventArg, _UI_TOUCH_EVENT_DELIVERY_YES, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory shortage.");
189 publicTouchInfo.Construct(*pEventArg);
197 if (pListener->OnTouchReleased(control, publicTouchInfo) == true)
199 return _UI_TOUCH_EVENT_DELIVERY_NO;
203 // public TouchEventListener
204 if (ProcessTouchEventListener(touchInfo) == true)
206 return _UI_TOUCH_EVENT_DELIVERY_NO;
209 if (__core.Equals(source))
211 return _UI_TOUCH_EVENT_DELIVERY_NO;
214 isFiltered = __impl.OnPreviewTouchReleased(__impl, touchInfo);
215 if (isFiltered == _UI_TOUCH_EVENT_DELIVERY_NO)
217 return _UI_TOUCH_EVENT_DELIVERY_NO;
220 isFiltered = __core.OnPreviewTouchReleased(source, touchInfo);
225 virtual _UiTouchEventDelivery OnPreviewTouchMoved(const _Control& source, const _TouchInfo& touchInfo)
227 _UiTouchEventDelivery isFiltered = _UI_TOUCH_EVENT_DELIVERY_NO;
228 IPropagatedTouchEventListener* pListener = __impl.GetPublicPropagatedTouchEventListener();
230 if (pListener != null)
232 Control& control = __impl.GetPublic();
234 TouchEventInfo publicTouchInfo;
236 _TouchEventArg* pEventArg = GetTouchEventArgN(touchInfo);
237 SysTryReturn(NID_UI, pEventArg, _UI_TOUCH_EVENT_DELIVERY_YES, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory shortage.");
239 publicTouchInfo.Construct(*pEventArg);
247 if (pListener->OnTouchMoved(control, publicTouchInfo) == true)
249 return _UI_TOUCH_EVENT_DELIVERY_NO;
253 // public TouchEventListener
254 if (ProcessTouchEventListener(touchInfo) == true)
256 return _UI_TOUCH_EVENT_DELIVERY_NO;
259 if (__core.Equals(source))
261 return _UI_TOUCH_EVENT_DELIVERY_NO;
264 isFiltered = __impl.OnPreviewTouchMoved(__impl, touchInfo);
265 if (isFiltered == _UI_TOUCH_EVENT_DELIVERY_NO)
267 return _UI_TOUCH_EVENT_DELIVERY_NO;
270 isFiltered = __core.OnPreviewTouchMoved(source, touchInfo);
275 virtual _UiTouchEventDelivery OnPreviewTouchCanceled(const _Control& source, const _TouchInfo& touchInfo)
277 IPropagatedTouchEventListener* pListener = __impl.GetPublicPropagatedTouchEventListener();
279 if (pListener != null)
281 Control& control = __impl.GetPublic();
283 TouchEventInfo publicTouchInfo;
285 _TouchEventArg* pEventArg = GetTouchEventArgN(touchInfo);
286 SysTryReturn(NID_UI, pEventArg, _UI_TOUCH_EVENT_DELIVERY_YES, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory shortage.");
288 publicTouchInfo.Construct(*pEventArg);
296 if (pListener->OnTouchCanceled(control, publicTouchInfo) == true)
298 return _UI_TOUCH_EVENT_DELIVERY_NO;
302 // public TouchEventListener
303 if (ProcessTouchEventListener(touchInfo) == true)
305 return _UI_TOUCH_EVENT_DELIVERY_NO;
308 return _UI_TOUCH_EVENT_DELIVERY_YES;
311 virtual void OnTouchPressHandled(const _Control& source)
313 __impl.OnTouchPressHandled(source);
316 virtual void OnTouchReleaseHandled(const _Control& source)
318 __impl.OnTouchReleaseHandled(source);
321 virtual void OnTouchMoveHandled(const _Control& source)
323 __impl.OnTouchMoveHandled(source);
326 virtual void OnTouchCancelHandled(const _Control& source)
328 __impl.OnTouchCancelHandled(source);
331 bool OnLongPressGestureDetected(_TouchLongPressGestureDetector& gesture)
333 bool filtered = ProcessTouchEventListener();
337 __impl.FireListViewItemLongPressedEvent();
343 bool OnLongPressGestureCanceled(_TouchLongPressGestureDetector& gesture)
350 bool ProcessTouchEventListener(const _TouchInfo& touchInfo)
352 bool filtered = false;
354 if (touchInfo.GetTouchStatus() == _TOUCH_PRESSED)
356 filtered = ProcessTouchDoublePressed(touchInfo);
361 ProcessTouchEvent(touchInfo);
364 filtered = __impl.IsInputEventConsumed();
368 __impl.ResetInputEventConsumed();
374 bool ProcessTouchEventListener(void)
376 // for TouchLongPressed
377 _TouchInfo touchInfo(0, _TOUCH_LONG_PRESSED, __currentPressedPoint, false, 0);
379 return ProcessTouchEventListener(touchInfo);
382 void ProcessTouchEvent(const _TouchInfo& touchInfo)
384 TouchEventInfo publicTouchInfo;
386 _TouchEventArg* pEventArg = GetTouchEventArgN(touchInfo);
387 SysTryReturnVoidResult(NID_UI, pEventArg, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
389 publicTouchInfo.Construct(*pEventArg);
391 _Control* pDraggedControl = __pTouchManager->GetTouchControlSource();
393 IEnumeratorT<IEventListener*>* pEnumerator = __impl.GetTouchEventListener()->GetEnumeratorN();
396 while (pEnumerator->MoveNext() == E_SUCCESS)
398 IEventListener* pListener = null;
399 pEnumerator->GetCurrent(pListener);
401 ITouchEventListener* pTouchEventListener = dynamic_cast <ITouchEventListener*>(pListener);
402 if (pTouchEventListener != null)
404 FirePublicListener(*pTouchEventListener, publicTouchInfo);
406 if (touchInfo.GetTouchStatus() == _TOUCH_RELEASED)
408 if (pDraggedControl == null) //if exist dragged control, don't send focus event
410 FireFocusListener(*pTouchEventListener, publicTouchInfo);
413 else if (touchInfo.GetTouchStatus() == _TOUCH_MOVED)
415 FireFocusListener(*pTouchEventListener, publicTouchInfo);
426 bool ProcessTouchDoublePressed(const _TouchInfo& touchinfo)
428 if (__pTouchManager->GetPointCount() == 1)
430 __oldPreviousPressedTime = __previousPressedTime;
431 __previousPressedTime = __currentPressedTime;
432 __currentPressedTime = touchinfo.GetTimeStamp();
433 __previousPressedPoint.x = __currentPressedPoint.x;
434 __previousPressedPoint.y = __currentPressedPoint.y;
435 __currentPressedPoint.x = touchinfo.GetCurrentPosition().x;
436 __currentPressedPoint.y = touchinfo.GetCurrentPosition().y;
438 if (Math::Abs(__previousPressedTime - __currentPressedTime) < DOUBLE_PRESS_TIME)
440 if (Math::Abs(__previousPressedTime - __oldPreviousPressedTime) > DOUBLE_PRESS_TIME)
442 if ((Math::Abs(__previousPressedPoint.x - __currentPressedPoint.x) < DOUBLE_PRESS_MOVE_ALLOWANCE)
443 && (Math::Abs(__previousPressedPoint.y - __currentPressedPoint.y) < DOUBLE_PRESS_MOVE_ALLOWANCE))
445 _TouchInfo touchInfo(0, _TOUCH_DOUBLE_PRESSED, __currentPressedPoint, false, 0);
446 ProcessTouchEvent(touchInfo);
457 void FirePublicListener(ITouchEventListener& listener, const TouchEventInfo& touchEventInfo)
459 switch (touchEventInfo.GetTouchStatus())
462 listener.OnTouchPressed(__public, touchEventInfo.GetCurrentPosition(), touchEventInfo);
464 case TOUCH_LONG_PRESSED:
465 listener.OnTouchLongPressed(__public, touchEventInfo.GetCurrentPosition(), touchEventInfo);
468 listener.OnTouchReleased(__public, touchEventInfo.GetCurrentPosition(), touchEventInfo);
471 listener.OnTouchMoved(__public, touchEventInfo.GetCurrentPosition(), touchEventInfo);
473 case TOUCH_DOUBLE_PRESSED:
474 listener.OnTouchDoublePressed(__public, touchEventInfo.GetCurrentPosition(), touchEventInfo);
477 listener.OnTouchFocusIn(__public, touchEventInfo.GetCurrentPosition(), touchEventInfo);
479 case TOUCH_FOCUS_OUT:
480 listener.OnTouchFocusOut(__public, touchEventInfo.GetCurrentPosition(), touchEventInfo);
483 listener.OnTouchCanceled(__public, touchEventInfo.GetCurrentPosition(), touchEventInfo);
490 void FireFocusListener(ITouchEventListener& listener, const TouchEventInfo& touchEventInfo)
492 _ControlManager* pControlManager = _ControlManager::GetInstance();
493 SysTryReturnVoidResult(NID_UI, pControlManager, E_SYSTEM, "[E_SYSTEM] System error occurred.");
495 Point screenPoint(__pTouchManager->GetScreenPoint(touchEventInfo.GetPointId()).x,
496 __pTouchManager->GetScreenPoint(touchEventInfo.GetPointId()).y);
498 _Control* pTouchedControl = pControlManager->GetTopmostTouchedControl(screenPoint);
499 SysTryReturnVoidResult(NID_UI, pTouchedControl, E_INVALID_CONDITION, "[E_INVALID_CONDITION] pTouchedControl is null.");
501 if (__pTouchManager->GetFocusedControlSource() != pTouchedControl)
503 if (&(__core) != pTouchedControl)
505 if (__pTouchManager->GetFocusedControlSource() == &(__core))
507 listener.OnTouchFocusOut(__public, touchEventInfo.GetCurrentPosition(), touchEventInfo);
512 listener.OnTouchFocusIn(__public, touchEventInfo.GetCurrentPosition(), touchEventInfo);
515 __pTouchManager->SetFocusedControlSource(*pTouchedControl);
519 _TouchEventArg* GetTouchEventArgN(const _TouchInfo& touchInfo)
521 FloatPoint startPoint;
523 _TouchEventArg* pEventArg = new (std::nothrow) _TouchEventArg(__public, touchInfo.GetTouchStatus());
524 SysTryReturn(NID_UI, pEventArg, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
526 startPoint.SetPosition(__pTouchManager->GetStartPoint(touchInfo.GetPointId()).x - __core.GetAbsoluteBoundsF(true).x,
527 __pTouchManager->GetStartPoint(touchInfo.GetPointId()).y - __core.GetAbsoluteBoundsF(true).y);
529 pEventArg->SetTouchPosition(touchInfo.GetPointId(), startPoint.x, startPoint.y,
530 touchInfo.GetCurrentPosition().x, touchInfo.GetCurrentPosition().y);
532 // need to flick distance setting
538 static const int DOUBLE_PRESS_TIME = 500;
539 static const int DOUBLE_PRESS_MOVE_ALLOWANCE = 10;
541 _GroupedListViewImpl& __impl;
544 _TouchManager* __pTouchManager;
546 unsigned int __oldPreviousPressedTime;
547 unsigned int __previousPressedTime;
548 unsigned int __currentPressedTime;
549 Tizen::Graphics::FloatPoint __previousPressedPoint;
550 Tizen::Graphics::FloatPoint __currentPressedPoint;
551 _TouchLongPressGestureDetector* __pLongPressedGesture;
554 _GroupedListViewImpl*
555 _GroupedListViewImpl::GetInstance(GroupedListView& groupedListView)
557 return static_cast <_GroupedListViewImpl*>(groupedListView._pControlImpl);
560 const _GroupedListViewImpl*
561 _GroupedListViewImpl::GetInstance(const GroupedListView& groupedListView)
563 return static_cast <const _GroupedListViewImpl*>(groupedListView._pControlImpl);
566 _GroupedListViewImpl::_GroupedListViewImpl(GroupedListView* pGroupedList, _TableView* pCore)
567 : _ControlImpl(pGroupedList, pCore)
568 , __pListItemEvent(null)
570 , __pScrollEvent(null)
571 , __pFastScrollEvent(null)
572 , __pEmptyBitmap(null)
574 , __pAccessibilityElement(null)
575 , __redrawListView(true)
576 , __isOrientationChanged(false)
577 , __needReloadItems(false)
578 , __pPropagatedTouchEventListener(null)
580 GET_COLOR_CONFIG(TABLEVIEW::EMPTY_CONTENTS_TEXT_NORMAL, __emptyTextColor);
583 _GroupedListViewImpl::~_GroupedListViewImpl()
585 delete __pListItemEvent;
586 __pListItemEvent = null;
591 delete __pScrollEvent;
592 __pScrollEvent = null;
594 delete __pFastScrollEvent;
595 __pFastScrollEvent = null;
597 if (__pEmptyBitmap != null)
599 GetCore().DetachChild(*__pEmptyBitmap);
601 delete __pEmptyBitmap;
602 __pEmptyBitmap = null;
605 if (__pEmptyText != null)
607 GetCore().DetachChild(*__pEmptyText);
613 _AccessibilityContainer* pContainer = GetCore().GetAccessibilityContainer();
615 if ((__pAccessibilityElement != null) && (pContainer != null))
617 pContainer->RemoveElement(__pAccessibilityElement);
620 delete __pPropagatedTouchEventListener;
621 __pPropagatedTouchEventListener = null;
625 _GroupedListViewImpl::GetPublicClassName(void) const
627 return "Tizen::Ui::Controls::GroupedListView";
630 const GroupedListView&
631 _GroupedListViewImpl::GetPublic(void) const
633 return static_cast <const GroupedListView&>(_ControlImpl::GetPublic());
637 _GroupedListViewImpl::GetPublic(void)
639 return static_cast <GroupedListView&>(_ControlImpl::GetPublic());
643 _GroupedListViewImpl::GetCore(void) const
645 return static_cast <const _TableView&>(_ControlImpl::GetCore());
649 _GroupedListViewImpl::GetCore(void)
651 return static_cast <_TableView&>(_ControlImpl::GetCore());
654 _GroupedListViewImpl*
655 _GroupedListViewImpl::CreateGroupedListViewImplN(GroupedListView* pControl, GroupedListViewStyle style, bool itemDivider, ListScrollStyle scrollStyle)
657 result r = E_SUCCESS;
658 TableViewScrollBarStyle scrollBarStyle;
662 case SCROLL_STYLE_FADE_OUT:
663 scrollBarStyle = TABLE_VIEW_SCROLL_BAR_STYLE_FADE_OUT;
666 case SCROLL_STYLE_FIXED:
667 scrollBarStyle = TABLE_VIEW_SCROLL_BAR_STYLE_FIXED;
670 case SCROLL_STYLE_FAST_SCROLL:
671 scrollBarStyle = TABLE_VIEW_SCROLL_BAR_STYLE_FAST_SCROLL;
674 case SCROLL_STYLE_JUMP_TO_TOP:
675 scrollBarStyle = TABLE_VIEW_SCROLL_BAR_STYLE_JUMP_TO_TOP;
678 case SCROLL_STYLE_THUMB:
679 scrollBarStyle = TABLE_VIEW_SCROLL_BAR_STYLE_THUMB;
682 case SCROLL_STYLE_FAST_SCROLL_FIXED:
683 scrollBarStyle = TABLE_VIEW_SCROLL_BAR_STYLE_FAST_SCROLL_FIXED;
687 scrollBarStyle = TABLE_VIEW_SCROLL_BAR_STYLE_NONE;
691 TableViewStyle tableViewStyle = ((style == GROUPED_LIST_VIEW_STYLE_SECTION) ? TABLE_VIEW_STYLE_SECTION : TABLE_VIEW_STYLE_GROUPED);
693 _TableView* pCore = _TableView::CreateTableViewN(tableViewStyle, itemDivider, scrollBarStyle);
694 SysTryReturn(NID_UI_CTRL, (pCore != null), null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
696 _GroupedListViewImpl* pImpl = new (std::nothrow) _GroupedListViewImpl(pControl, pCore);
698 r = CheckConstruction(pCore, pImpl);
699 SysTryReturn(NID_UI_CTRL, (r == E_SUCCESS), null, r, "[%s] Propagating.", GetErrorMessage(GetLastResult()));
701 pImpl->__pPropagatedTouchEventListener = new (std::nothrow) _GroupedListViewPropagatedTouchEventListener(*pImpl);
703 if (pImpl->__pPropagatedTouchEventListener != null)
705 pCore->SetPropagatedTouchEventListener(pImpl->__pPropagatedTouchEventListener);
712 _GroupedListViewImpl::SetItemProvider(IGroupedListViewItemProvider& provider)
714 result r = E_SUCCESS;
716 _GroupedListViewItemProviderAdaptor* pProviderAdaptor =
717 static_cast <_GroupedListViewItemProviderAdaptor*>(GetCore().GetItemProviderAdaptor());
719 if (pProviderAdaptor != null)
721 IGroupedListViewItemProvider* pProvider = pProviderAdaptor->GetItemProvider();
722 if (&provider == pProvider)
728 float itemWidth = GetBoundsF().width;
730 if (GetCore().GetTableViewStyle() == TABLE_VIEW_STYLE_SECTION)
733 GET_SHAPE_CONFIG(TABLEVIEW::GROUPITEM_LEFT_MARGIN, _CONTROL_ORIENTATION_PORTRAIT, margin);
735 itemWidth -= (margin * 2.0f);
738 if (pProviderAdaptor == null)
740 pProviderAdaptor = new (std::nothrow) _GroupedListViewItemProviderAdaptor(provider);
741 SysTryReturn(NID_UI_CTRL, (pProviderAdaptor != null), E_OUT_OF_MEMORY, E_OUT_OF_MEMORY,
742 "[E_OUT_OF_MEMORY] Memory allocation failed.");
744 pProviderAdaptor->SetListViewItemEventListener(*this);
746 r = pProviderAdaptor->SetListWidth(itemWidth);
747 GetCore().SetItemProviderAdaptor(pProviderAdaptor);
751 pProviderAdaptor->SetItemProvider(provider);
752 r = pProviderAdaptor->SetListWidth(itemWidth);
757 __redrawListView = true;
759 SetLastResultReturn(r);
763 _GroupedListViewImpl::SetItemProvider(IGroupedListViewItemProviderF& provider)
765 result r = E_SUCCESS;
767 _GroupedListViewItemProviderAdaptor* pProviderAdaptor =
768 static_cast <_GroupedListViewItemProviderAdaptor*>(GetCore().GetItemProviderAdaptor());
770 if (pProviderAdaptor != null)
772 IGroupedListViewItemProviderF* pProvider = pProviderAdaptor->GetItemProviderF();
773 if (&provider == pProvider)
779 float itemWidth = GetBoundsF().width;
781 if (GetCore().GetTableViewStyle() == TABLE_VIEW_STYLE_SECTION)
784 GET_SHAPE_CONFIG(TABLEVIEW::GROUPITEM_LEFT_MARGIN, _CONTROL_ORIENTATION_PORTRAIT, margin);
786 itemWidth -= (margin * 2.0f);
789 if (pProviderAdaptor == null)
791 pProviderAdaptor = new (std::nothrow) _GroupedListViewItemProviderAdaptor(provider);
792 SysTryReturn(NID_UI_CTRL, (pProviderAdaptor != null), E_OUT_OF_MEMORY, E_OUT_OF_MEMORY,
793 "[E_OUT_OF_MEMORY] Memory allocation failed.");
795 pProviderAdaptor->SetListViewItemEventListener(*this);
797 r = pProviderAdaptor->SetListWidth(itemWidth);
798 GetCore().SetItemProviderAdaptor(pProviderAdaptor);
802 pProviderAdaptor->SetItemProvider(provider);
803 r = pProviderAdaptor->SetListWidth(itemWidth);
808 __redrawListView = true;
810 SetLastResultReturn(r);
816 _GroupedListViewImpl::AddGroupedListViewItemEventListener(IGroupedListViewItemEventListener& listener)
818 result r = E_SUCCESS;
820 if (__pListItemEvent == null)
822 __pListItemEvent = new (std::nothrow) _ListItemEvent();
823 SysTryReturnVoidResult(NID_UI_CTRL, (__pListItemEvent != null), E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
825 r = __pListItemEvent->Construct(GetPublic(), CLASSNAME_GROUPEDLISTVIEW);
826 SysTryReturnVoidResult(NID_UI_CTRL, (r == E_SUCCESS), E_SYSTEM, "[E_SYSTEM] Unable to construct Item Event.");
829 __pListItemEvent->AddListener(listener);
831 r = GetCore().AddGroupedTableViewItemEventListener(*this);
837 _GroupedListViewImpl::RemoveGroupedListViewItemEventListener(IGroupedListViewItemEventListener& listener)
839 result r = E_SUCCESS;
841 if (__pListItemEvent != null)
843 r = __pListItemEvent->RemoveListener(listener);
850 _GroupedListViewImpl::AddFastScrollListener(IFastScrollListener& listener)
852 result r = E_SUCCESS;
854 if (__pFastScrollEvent == null)
856 __pFastScrollEvent = new (std::nothrow) _FastScrollEvent();
857 SysTryReturnVoidResult(NID_UI_CTRL, (__pFastScrollEvent != null), E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
859 r = __pFastScrollEvent->Construct(GetPublic());
860 SysTryReturnVoidResult(NID_UI_CTRL, (r == E_SUCCESS), E_SYSTEM, "[E_SYSTEM] Unable to construct FastScroll Event.");
863 __pFastScrollEvent->AddListener(listener);
865 r = GetCore().AddFastScrollListener(*this);
871 _GroupedListViewImpl::RemoveFastScrollListener(IFastScrollListener& listener)
873 result r = E_SUCCESS;
875 if (__pFastScrollEvent != null)
877 r = __pFastScrollEvent->RemoveListener(listener);
884 _GroupedListViewImpl::AddScrollEventListener(IScrollEventListener& listener)
886 result r = E_SUCCESS;
888 if (__pScrollEvent == null)
890 __pScrollEvent = new (std::nothrow) _ScrollEvent();
891 SysTryReturnVoidResult(NID_UI_CTRL, (__pScrollEvent != null), E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
893 r = __pScrollEvent->Construct(GetPublic());
894 SysTryReturnVoidResult(NID_UI_CTRL, (r == E_SUCCESS), E_SYSTEM, "[E_SYSTEM] Unable to construct Scroll Event.");
897 __pScrollEvent->AddListener(listener);
899 GetCore().AddScrollEventListener(*this);
905 _GroupedListViewImpl::AddScrollEventListener(IScrollEventListenerF& listener)
907 result r = E_SUCCESS;
909 if (__pScrollEvent == null)
911 __pScrollEvent = new (std::nothrow) _ScrollEvent();
912 SysTryReturnVoidResult(NID_UI_CTRL, (__pScrollEvent != null), E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
914 r = __pScrollEvent->Construct(GetPublic());
915 SysTryReturnVoidResult(NID_UI_CTRL, (r == E_SUCCESS), E_SYSTEM, "[E_SYSTEM] Unable to construct Scroll Event.");
918 __pScrollEvent->AddListener(listener);
920 GetCore().AddScrollEventListener(*this);
926 _GroupedListViewImpl::RemoveScrollEventListener(IScrollEventListener& listener)
928 result r = E_SUCCESS;
930 if (__pScrollEvent != null)
932 r = __pScrollEvent->RemoveListener(listener);
939 _GroupedListViewImpl::RemoveScrollEventListener(IScrollEventListenerF& listener)
941 result r = E_SUCCESS;
943 if (__pScrollEvent != null)
945 r = __pScrollEvent->RemoveListener(listener);
952 _GroupedListViewImpl::AddUiLinkEventListener(const IUiLinkEventListener& listener)
954 result r = E_SUCCESS;
956 if (__pLinkEvent == null)
958 __pLinkEvent = _PublicLinkEvent::CreateInstanceN(GetPublic());
959 SysTryReturnVoidResult(NID_UI, (__pLinkEvent != null), E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
962 r = __pLinkEvent->AddListener(listener);
968 _GroupedListViewImpl::RemoveUiLinkEventListener(const IUiLinkEventListener& listener)
970 result r = E_SUCCESS;
972 if (__pLinkEvent != null)
974 r = __pLinkEvent->RemoveListener(listener);
981 _GroupedListViewImpl::SetSweepEnabled(bool enable)
983 GetCore().SetSweepEnabled(enable);
985 SetLastResultReturn(E_SUCCESS);
989 _GroupedListViewImpl::SetFastScrollIndex(const String& text, bool useSearchIcon)
991 result r = GetCore().SetFastScrollIndex(text, useSearchIcon);
992 SysTryReturn(NID_UI_CTRL, (r == E_SUCCESS) || (r == E_SYSTEM), E_INVALID_STATE, E_INVALID_STATE,
993 "[E_INVALID_STATE] This instance is in an invalid state.");
995 SetLastResultReturn(r);
999 _GroupedListViewImpl::GetTopDrawnItemIndex(int& groupIndex, int& itemIndex) const
1001 result r = E_SUCCESS;
1002 r = GetCore().GetTopDrawnItemIndex(groupIndex, itemIndex);
1003 SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, E_SYSTEM, "A system error has occurred. Failed to get top drawn item index.");
1009 _GroupedListViewImpl::GetBottomDrawnItemIndex(int& groupIndex, int& itemIndex) const
1011 result r = E_SUCCESS;
1012 r = GetCore().GetBottomDrawnItemIndex(groupIndex, itemIndex);
1013 SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, E_SYSTEM, "A system error has occurred. Failed to get bottom drawn item index.");
1019 _GroupedListViewImpl::ScrollToItem(int groupIndex, int itemIndex, ListScrollItemAlignment itemAlignment)
1021 result r = E_SUCCESS;
1023 if (itemAlignment == LIST_SCROLL_ITEM_ALIGNMENT_TOP)
1025 r = GetCore().SetTopDrawnItemIndex(groupIndex, itemIndex);
1027 else if (itemAlignment == LIST_SCROLL_ITEM_ALIGNMENT_BOTTOM)
1029 r = GetCore().SetBottomDrawnItemIndex(groupIndex, itemIndex);
1033 SysTryReturn(NID_UI_CTRL, false, E_OUT_OF_RANGE, E_OUT_OF_RANGE,
1034 "[E_OUT_OF_RANGE] The specified itemAlignment is out of range.");
1037 SetLastResultReturn(r);
1041 _GroupedListViewImpl::SetItemChecked(int groupIndex, int itemIndex, bool check)
1043 return GetCore().SetItemChecked(groupIndex, itemIndex, check);
1047 _GroupedListViewImpl::IsItemChecked(int groupIndex, int itemIndex) const
1049 return GetCore().IsItemChecked(groupIndex, itemIndex);
1053 _GroupedListViewImpl::SetItemEnabled(int groupIndex, int itemIndex, bool enable)
1055 return GetCore().SetItemEnabled(groupIndex, itemIndex, enable);
1059 _GroupedListViewImpl::IsItemEnabled(int groupIndex, int itemIndex) const
1061 return GetCore().IsItemEnabled(groupIndex, itemIndex);
1065 _GroupedListViewImpl::GetGroupCount(void) const
1067 return GetCore().GetGroupCount();
1071 _GroupedListViewImpl::GetItemCountAt(int groupIndex) const
1073 return GetCore().GetItemCountAt(groupIndex);
1077 _GroupedListViewImpl::ShowItemDescriptionText(int groupIndex, int itemIndex)
1079 return SetItemDescriptionTextShowState(groupIndex, itemIndex, true);
1083 _GroupedListViewImpl::HideItemDescriptionText(int groupIndex, int itemIndex)
1085 return SetItemDescriptionTextShowState(groupIndex, itemIndex, false);
1089 _GroupedListViewImpl::SetItemDescriptionTextShowState(int groupIndex, int itemIndex, bool show)
1091 result r = E_SUCCESS;
1093 SysTryReturn(NID_UI_CTRL, (groupIndex >= 0) && (groupIndex < GetGroupCount()), E_OUT_OF_RANGE, E_OUT_OF_RANGE,
1094 "[E_OUT_OF_RANGE] The specified groupIndex is out of range.");
1096 SysTryReturn(NID_UI_CTRL, (itemIndex >= 0) && (itemIndex < GetItemCountAt(groupIndex)), E_OUT_OF_RANGE, E_OUT_OF_RANGE,
1097 "[E_OUT_OF_RANGE] The specified itemIndex is out of range.");
1099 _GroupedListViewItemProviderAdaptor* pProviderAdaptor =
1100 static_cast <_GroupedListViewItemProviderAdaptor*>(GetCore().GetItemProviderAdaptor());
1101 SysTryReturn(NID_UI_CTRL, (pProviderAdaptor != null), E_SYSTEM, E_SYSTEM, "[E_SYSTEM] _GroupedListItemProviderAdaptor is not set.");
1103 // Save description text show state to provider adaptor
1104 pProviderAdaptor->SetDescriptionTextShowState(groupIndex, itemIndex, show);
1106 if (GetCore().FindItem(groupIndex, itemIndex) != null)
1108 r = GetCore().RefreshTableView(groupIndex, itemIndex, TABLE_VIEW_REFRESH_TYPE_ITEM_MODIFY);
1111 SetLastResultReturn(r);
1115 _GroupedListViewImpl::RefreshList(int groupIndex, int itemIndex, ListRefreshType type)
1117 result r = E_SUCCESS;
1119 if (__needReloadItems)
1124 int groupCount = GetCore().GetGroupCount();
1125 int itemCount = GetCore().GetItemCountAt(groupIndex);
1127 if ((groupIndex < 0) || (groupIndex > groupCount) || (itemIndex < -1) || (itemIndex > itemCount) ||
1128 ((type != LIST_REFRESH_TYPE_ITEM_ADD) && (itemIndex == itemCount)))
1130 SysLogException(NID_UI_CTRL, E_OUT_OF_RANGE, "[E_OUT_OF_RANGE] The index is out of range.");
1131 return E_OUT_OF_RANGE;
1134 if (type == LIST_REFRESH_TYPE_ITEM_MODIFY)
1136 if (IsContextItemOpened(groupIndex, itemIndex))
1138 CloseContextItem(groupIndex, itemIndex);
1141 int topGroupIndex = -1;
1142 int topItemIndex = -1;
1143 int bottomGroupIndex = -1;
1144 int bottomItemIndex = -1;
1146 GetCore().GetFirstLoadedItemIndex(topGroupIndex, topItemIndex);
1147 GetCore().GetLastLoadedItemIndex(bottomGroupIndex, bottomItemIndex);
1149 if ((topGroupIndex > groupIndex) || (bottomGroupIndex < groupIndex) ||
1150 ((topGroupIndex == groupIndex) && (topItemIndex > itemIndex)) ||
1151 ((bottomGroupIndex == groupIndex) && (bottomItemIndex < itemIndex)))
1153 // not yet loaded item
1154 SetLastResultReturn(r);
1158 _ListViewItem* pListViewItem = static_cast<_ListViewItem*>(GetCore().FindItem(groupIndex, itemIndex));
1159 _ListViewItemStatus itemStatus;
1160 memset(&itemStatus, 0, sizeof(_ListViewItemStatus));
1161 bool needChangeEventTarget = false;
1162 bool itemFocused = false;
1164 if (pListViewItem != null && pListViewItem->IsItemSelected())
1166 needChangeEventTarget = true;
1169 if (pListViewItem != null && pListViewItem->GetRootWindow() && pListViewItem->IsFocusModeStateEnabled()
1170 && pListViewItem->IsFocused() && pListViewItem->GetRootWindow()->IsActivated())
1175 if (needChangeEventTarget && (pListViewItem != null))
1177 pListViewItem->GetCurrentStatus(itemStatus);
1178 pListViewItem = null;
1182 GetCore().UnloadItem(groupIndex, itemIndex);
1184 pListViewItem = static_cast<_ListViewItem*>(GetCore().LoadItem(groupIndex, itemIndex));
1186 if (needChangeEventTarget && (pListViewItem != null))
1188 pListViewItem->SetCurrentStatus(itemStatus);
1190 _Control* pTarget = static_cast<_Control*>(pListViewItem);
1192 for (int i = 0; i < pListViewItem->GetChildCount(); i++)
1194 if (pListViewItem->GetChild(i)->GetBoundsF().Contains(itemStatus.currentTouchPosition))
1196 pTarget = pListViewItem->GetChild(i);
1200 // change touch event target
1201 pTarget->SetChangingEventTarget(true);
1202 _TouchManager::GetInstance()->SetChangedTouchableTarget(pTarget);
1205 if (itemFocused && pListViewItem && pListViewItem->IsFocusable()
1206 && pListViewItem->GetEnableState() && pListViewItem->GetVisibleState())
1208 pListViewItem->SetFocused(true);
1209 pListViewItem->DrawFocus();
1215 r = GetCore().RefreshTableView(groupIndex, itemIndex, static_cast<TableViewRefreshType>(type));
1218 CheckEmptyListShowState();
1223 SetLastResultReturn(r);
1227 _GroupedListViewImpl::RefreshList(int groupIndex, int itemIndex, int elementId)
1229 if ((groupIndex < 0) || (groupIndex >= GetCore().GetGroupCount()) || (itemIndex < 0) || (itemIndex >= GetCore().GetItemCountAt(groupIndex)))
1231 return E_OUT_OF_RANGE;
1234 result r = E_SUCCESS;
1235 _ListViewItem* pListViewItem = static_cast<_ListViewItem*>(GetCore().FindItem(groupIndex, itemIndex));
1237 if (pListViewItem != null)
1239 r = (pListViewItem->RefreshElement(elementId)) ? E_SUCCESS : E_OUT_OF_RANGE;
1242 SetLastResultReturn(r);
1246 _GroupedListViewImpl::UpdateList(bool isRestoreAnnexFocusValue)
1248 __needReloadItems = true;
1250 result r = GetCore().UpdateTableView(isRestoreAnnexFocusValue);
1252 CheckEmptyListShowState();
1256 // API versioning for initial Show() operation
1257 if (Tizen::App::_AppInfo::GetApiVersion() == _API_VERSION_2_0 && Tizen::App::_AppInfo::IsOspCompat())
1262 __needReloadItems = false;
1264 SetLastResultReturn(r);
1268 _GroupedListViewImpl::SetItemNeedsLazyDeletion(_ListViewItem* pItem)
1270 _GroupedListViewItemProviderAdaptor* pProviderAdaptor =
1271 static_cast <_GroupedListViewItemProviderAdaptor*>(GetCore().GetItemProviderAdaptor());
1273 if (pProviderAdaptor != null)
1275 pProviderAdaptor->SetItemNeedsLazyDeletion(pItem);
1280 _GroupedListViewImpl::GetItemIndexFromPosition(const FloatPoint& position, int& groupIndex, int& itemIndex) const
1282 result r = GetCore().GetItemIndexFromPosition(position, groupIndex, itemIndex);
1284 SysTryReturn(NID_UI_CTRL, (r == E_SUCCESS), E_SYSTEM, E_SYSTEM, "[E_SYSTEM] There is no item at the specified position.");
1286 SetLastResultReturn(r);
1290 _GroupedListViewImpl::GetItemIndexFromPosition(const FloatPoint& position, int& groupIndex, int& itemIndex, int& elementId) const
1294 result r = GetCore().GetItemIndexFromPosition(position, groupIndex, itemIndex);
1295 SysTryReturn(NID_UI_CTRL, (r == E_SUCCESS), E_SYSTEM, E_SYSTEM, "[E_SYSTEM] There is no item at the specified position.");
1297 _ListViewItem* pListViewItem = static_cast<_ListViewItem*>(GetCore().FindItem(groupIndex, itemIndex));
1299 if (pListViewItem != null)
1301 FloatPoint originPosition = pListViewItem->GetPositionF();
1302 originPosition.y -= GetCore().GetScrollPosition();
1304 elementId = pListViewItem->GetElementIdFromPosition(FloatPoint(position.x - originPosition.x, position.y - originPosition.y));
1307 SetLastResultReturn(r);
1311 _GroupedListViewImpl::SetSectionColor(const Color& color)
1313 return GetCore().SetSectionColor(color);
1317 _GroupedListViewImpl::GetSectionColor(void) const
1319 return GetCore().GetSectionColor();
1323 _GroupedListViewImpl::SetItemDividerColor(const Color& color)
1325 return GetCore().SetItemDividerColor(color);
1329 _GroupedListViewImpl::GetItemDividerColor(void) const
1331 return GetCore().GetItemDividerColor();
1335 _GroupedListViewImpl::SetListBackgroundColor(const Color& color)
1337 SetBackgroundColor(color);
1341 _GroupedListViewImpl::SetBackgroundBitmap(const Bitmap* pBitmap)
1343 GetCore().SetBackgroundBitmap(const_cast<Bitmap*>(pBitmap));
1344 GetCore().SetBackgroundBitmapStretch(true);
1346 SetLastResultReturn(E_SUCCESS);
1350 _GroupedListViewImpl::SetBitmapOfEmptyList(const Bitmap* pBitmap)
1352 if (pBitmap == null)
1354 if (__pEmptyBitmap != null)
1356 GetCore().DetachChild(*__pEmptyBitmap);
1358 delete __pEmptyBitmap;
1359 __pEmptyBitmap = null;
1364 if (__pEmptyBitmap == null)
1366 __pEmptyBitmap = _Label::CreateLabelN();
1367 SysTryReturn(NID_UI_CTRL, (__pEmptyBitmap != null), E_SYSTEM, E_SYSTEM, "[%s] Propagating.", GetErrorMessage(GetLastResult()));
1369 __pEmptyBitmap->SetVisibleState(false);
1370 __pEmptyBitmap->SetMargin(0.0f, 0.0f);
1372 GetCore().AttachChild(*__pEmptyBitmap);
1375 __pEmptyBitmap->SetSize(FloatDimension(pBitmap->GetWidthF(), pBitmap->GetHeightF()));
1376 __pEmptyBitmap->SetBackgroundColor(Color(0, 0, 0, 0));
1377 __pEmptyBitmap->SetBackgroundBitmap(*pBitmap);
1380 AdjustLayoutOfEmptyList();
1382 SetLastResultReturn(E_SUCCESS);
1386 _GroupedListViewImpl::SetTextOfEmptyList(const String& text)
1390 if (__pEmptyText != null)
1392 GetCore().DetachChild(*__pEmptyText);
1394 delete __pEmptyText;
1395 __pEmptyText = null;
1400 if (__pEmptyText == null)
1402 __pEmptyText = _Label::CreateLabelN();
1403 SysTryReturn(NID_UI_CTRL, (__pEmptyText != null), E_SYSTEM, E_SYSTEM, "[%s] Propagating.", GetErrorMessage(GetLastResult()));
1405 __pEmptyText->SetVisibleState(false);
1406 __pEmptyText->SetMargin(0.0f, 0.0f);
1408 GetCore().AttachChild(*__pEmptyText);
1411 TextObject* pText = new (std::nothrow) TextObject;
1412 SysTryReturn(NID_UI_CTRL, (pText != null), E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[%s] Propagating.", GetErrorMessage(GetLastResult()));
1416 TextSimple* pSimpleText = new (std::nothrow) TextSimple(const_cast <wchar_t*>(text.GetPointer()), text.GetLength());
1417 SysTryReturn(NID_UI_CTRL, (pSimpleText != null), E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[%s] Propagating.", GetErrorMessage(GetLastResult()));
1418 pText->AppendElement(*pSimpleText);
1420 float fontSize = 0.0f;
1421 GET_SHAPE_CONFIG(LISTVIEW::EMPTY_LIST_TEXT_HEIGHT, _CONTROL_ORIENTATION_PORTRAIT, fontSize);
1424 font.Construct(GetFont(), FONT_STYLE_PLAIN, fontSize);
1425 pText->SetFont(&font, 0, pText->GetTextLength());
1427 FloatDimension listDimension = GetCore().GetSizeF();
1429 pText->SetBounds(FloatRectangle(0.0f, 0.0f, listDimension.width, 1.0f));
1432 FloatDimension labelDimension = pText->GetTextExtentF(0, pText->GetTextLength());
1433 labelDimension.height = pText->GetTotalHeightF();
1435 if (labelDimension.width > listDimension.width)
1437 pText->SetBounds(FloatRectangle(0.0f, 0.0f, listDimension.width, 1.0f));
1440 float labelHeight = pText->GetTotalHeightF();
1442 labelDimension.width = listDimension.width;
1443 labelDimension.height = ((listDimension.height < labelHeight) ? listDimension.height : labelHeight);
1448 __pEmptyText->SetSize(labelDimension);
1449 __pEmptyText->SetBackgroundColor(Color(0, 0, 0, 0));
1450 __pEmptyText->SetMargin(0.0f, 0.0f, 0.0f, 0.0f);
1451 __pEmptyText->SetTextColor(__emptyTextColor);
1452 __pEmptyText->SetTextConfig(fontSize, LABEL_TEXT_STYLE_NORMAL);
1453 __pEmptyText->SetText(text);
1456 AdjustLayoutOfEmptyList();
1458 SetLastResultReturn(E_SUCCESS);
1462 _GroupedListViewImpl::GetTextOfEmptyList(void) const
1464 return ((__pEmptyText != null) ? __pEmptyText->GetText() : String());
1468 _GroupedListViewImpl::SetTextColorOfEmptyList(const Color& color)
1470 __emptyTextColor = color;
1472 if (__pEmptyText != null)
1474 __pEmptyText->SetTextColor(color);
1477 SetLastResultReturn(E_SUCCESS);
1481 _GroupedListViewImpl::GetTextColorOfEmptyList(void) const
1483 return __emptyTextColor;
1487 _GroupedListViewImpl::ExpandGroup(int groupIndex)
1489 SysTryReturn(NID_UI_CTRL, (GetCore().GetTableViewStyle() == TABLE_VIEW_STYLE_GROUPED), E_INVALID_OPERATION, E_INVALID_OPERATION,
1490 "[E_INVALID_OPERATION] The control should be indexed style.");
1492 return GetCore().ExpandGroup(groupIndex);
1496 _GroupedListViewImpl::CollapseGroup(int groupIndex)
1498 SysTryReturn(NID_UI_CTRL, (GetCore().GetTableViewStyle() == TABLE_VIEW_STYLE_GROUPED), E_INVALID_OPERATION, E_INVALID_OPERATION,
1499 "[E_INVALID_OPERATION] The control should be indexed style.");
1501 return GetCore().CollapseGroup(groupIndex);
1505 _GroupedListViewImpl::IsGroupExpanded(int groupIndex) const
1507 return GetCore().IsGroupExpanded(groupIndex);
1511 _GroupedListViewImpl::ExpandAllGroups(void)
1513 SysTryReturn(NID_UI_CTRL, (GetCore().GetTableViewStyle() == TABLE_VIEW_STYLE_GROUPED), E_INVALID_OPERATION, E_INVALID_OPERATION,
1514 "[E_INVALID_OPERATION] The control should be indexed style.");
1516 return GetCore().ExpandAllGroup(true);
1520 _GroupedListViewImpl::CollapseAllGroups(void)
1522 SysTryReturn(NID_UI_CTRL, (GetCore().GetTableViewStyle() == TABLE_VIEW_STYLE_GROUPED), E_INVALID_OPERATION, E_INVALID_OPERATION,
1523 "[E_INVALID_OPERATION] The control should be indexed style.");
1525 return GetCore().CollapseAllGroup(true);
1529 _GroupedListViewImpl::CheckEmptyListShowState(void)
1531 bool isEmpty = (GetGroupCount() == 0);
1533 if (__pEmptyBitmap != null)
1535 __pEmptyBitmap->SetVisibleState(isEmpty);
1537 if (__pEmptyText != null)
1539 __pEmptyText->SetVisibleState(isEmpty);
1542 _AccessibilityContainer* pContainer = GetCore().GetAccessibilityContainer();
1544 if (_AccessibilityManager::IsActivated() && (pContainer != null))
1548 if (__pAccessibilityElement == null)
1550 __pAccessibilityElement = new (std::nothrow) _AccessibilityElement(true);
1552 SysTryReturnVoidResult(NID_UI_CTRL, (__pAccessibilityElement != null), E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
1554 __pAccessibilityElement->SetName(L"ListView");
1556 pContainer->RemoveAllElement();
1557 pContainer->AddElement(*__pAccessibilityElement);
1560 Rectangle bounds = GetBounds();
1561 __pAccessibilityElement->SetBounds(Rectangle(0, 0, bounds.width, bounds.height));
1563 String accessibilityLable;
1565 if (__pEmptyBitmap != null)
1567 __pEmptyBitmap->GetAccessibilityContainer()->Activate(false);
1569 accessibilityLable += L"Image, ";
1571 if (__pEmptyText != null)
1573 __pEmptyText->GetAccessibilityContainer()->Activate(false);
1575 accessibilityLable += __pEmptyText->GetText();
1576 accessibilityLable += L", ";
1579 accessibilityLable += L"No items";
1581 __pAccessibilityElement->SetLabel(accessibilityLable);
1585 if (__pAccessibilityElement != null)
1587 if (pContainer->RemoveElement(*__pAccessibilityElement) != E_SUCCESS)
1589 delete __pAccessibilityElement;
1591 __pAccessibilityElement = null;
1598 _GroupedListViewImpl::AdjustLayoutOfEmptyList(void)
1600 FloatDimension listDimension = GetCore().GetSizeF();
1601 FloatDimension emptyBitmap;
1602 FloatDimension emptyText;
1603 FloatPoint bitmapPos;
1605 float totalHeight = 0.0f;
1606 float horizontalSpacing = 0.0f;
1608 if (__pEmptyBitmap != null)
1610 emptyBitmap = __pEmptyBitmap->GetSizeF();
1612 if (__pEmptyText != null)
1614 emptyText = __pEmptyText->GetSizeF();
1616 if (__pEmptyBitmap != null)
1618 GET_SHAPE_CONFIG(LISTVIEW::EMPTY_LIST_HORIZONTAL_SPACING, _CONTROL_ORIENTATION_PORTRAIT, horizontalSpacing);
1622 totalHeight = emptyBitmap.height + horizontalSpacing + emptyText.height;
1624 if ((__pEmptyBitmap != null) && (__pEmptyText != null) && (totalHeight < listDimension.height))
1626 bitmapPos.x = ((_FloatCompare(listDimension.width, emptyBitmap.width)) ? 0.0f : (listDimension.width - emptyBitmap.width) / 2.0f);
1627 bitmapPos.y = (listDimension.height - totalHeight) / 2.0f;
1629 textPos.x = ((_FloatCompare(listDimension.width, emptyText.width)) ? 0.0f : (listDimension.width - emptyText.width) / 2.0f);
1630 textPos.y = bitmapPos.y + emptyBitmap.height + horizontalSpacing;
1634 if (__pEmptyBitmap != null)
1636 bitmapPos.x = ((_FloatCompare(listDimension.width, emptyBitmap.width)) ? 0.0f : (listDimension.width - emptyBitmap.width) / 2.0f);
1637 bitmapPos.y = ((listDimension.height <= totalHeight) ? 0.0f : (listDimension.height - totalHeight) / 2.0f);
1640 if (__pEmptyText != null)
1642 textPos.x = ((_FloatCompare(listDimension.width, emptyText.width)) ? 0.0f : (listDimension.width - emptyText.width) / 2.0f);
1643 textPos.y = ((listDimension.height <= totalHeight ) ? (bitmapPos.y + emptyBitmap.height + horizontalSpacing) : (listDimension.height - totalHeight) / 2.0f);
1647 if (__pEmptyBitmap != null)
1649 __pEmptyBitmap->SetPosition(bitmapPos);
1651 if (__pEmptyText != null)
1653 __pEmptyText->SetPosition(textPos);
1656 CheckEmptyListShowState();
1661 _GroupedListViewImpl::BeginReorderingMode(void)
1663 SysTryReturn(NID_UI_CTRL, (GetCore().GetTableViewStyle() == TABLE_VIEW_STYLE_GROUPED), E_INVALID_OPERATION, E_INVALID_OPERATION,
1664 "[E_INVALID_OPERATION] Reordering mode is supported only Indexed style.");
1666 result r = GetCore().SetReorderModeEnabled(true);
1668 SetLastResultReturn(r);
1672 _GroupedListViewImpl::EndReorderingMode(void)
1674 SysTryReturn(NID_UI_CTRL, (GetCore().GetTableViewStyle() == TABLE_VIEW_STYLE_GROUPED), E_INVALID_OPERATION, E_INVALID_OPERATION,
1675 "[E_INVALID_OPERATION] Reordering mode is supported only Indexed style.");
1677 result r = GetCore().SetReorderModeEnabled(false);
1679 SetLastResultReturn(r);
1683 _GroupedListViewImpl::IsInReorderingMode(void) const
1685 return GetCore().IsReorderModeEnabled();
1689 _GroupedListViewImpl::SetScrollInputMode(ScrollInputMode mode)
1691 GetCore().SetScrollInputMode(mode);
1695 _GroupedListViewImpl::GetScrollInputMode(void) const
1697 return GetCore().GetScrollInputMode();
1701 _GroupedListViewImpl::OpenContextItem(int groupIndex, int itemIndex)
1703 return GetCore().OpenContextItem(groupIndex, itemIndex);
1707 _GroupedListViewImpl::CloseContextItem(int groupIndex, int itemIndex)
1709 return GetCore().CloseContextItem(groupIndex, itemIndex);
1713 _GroupedListViewImpl::IsContextItemOpened(int groupIndex, int itemIndex) const
1715 return GetCore().IsContextItemOpened(groupIndex, itemIndex);
1719 _GroupedListViewImpl::OnListViewContextItemStateChanged(_Control& source, int groupIndex, int itemIndex, int elementId,
1720 ListContextItemStatus status)
1722 if (__pListItemEvent != null)
1724 CloseContextItem(groupIndex, itemIndex);
1726 _ListViewItem* pListViewItem = static_cast<_ListViewItem*>(GetCore().FindItem(groupIndex, itemIndex));
1728 SetItemNeedsLazyDeletion(pListViewItem);
1730 _ListItemEventArg* pArg = new (std::nothrow) _ListItemEventArg(groupIndex, itemIndex, elementId, 0, NOTIFY_TYPE_SELCTED_CONTEXT_ITEM);
1731 __pListItemEvent->Fire(*pArg);
1733 SetItemNeedsLazyDeletion(null);
1738 _GroupedListViewImpl::OnGroupedTableViewGroupItemStateChanged(_TableView& tableView, int groupIndex, _TableViewItem* pItem,
1739 TableViewItemStatus status)
1741 FireListViewItemEvent(groupIndex, -1, pItem, status);
1745 _GroupedListViewImpl::OnGroupedTableViewItemStateChanged(_TableView& tableView, int groupIndex, int itemIndex, _TableViewItem* pItem,
1746 TableViewItemStatus status)
1748 FireListViewItemEvent(groupIndex, itemIndex, pItem, status);
1752 _GroupedListViewImpl::OnGroupedTableViewContextItemActivationStateChanged(_TableView& tableView, int groupIndex, int itemIndex,
1753 _TableViewItem* pContextItem, bool activated)
1755 _ListViewItem* pListViewItem = static_cast<_ListViewItem*>(GetCore().FindItem(groupIndex, itemIndex));
1757 if (pListViewItem != null)
1759 pListViewItem->SetContextItemActivationState(activated);
1764 _GroupedListViewImpl::OnGroupedTableViewItemReordered(_TableView& tableView, int groupIndexFrom, int itemIndexFrom,
1765 int groupIndexTo, int itemIndexTo)
1767 if (__pListItemEvent != null)
1769 _ListItemEventArg* pArg = new (std::nothrow) _ListItemEventArg(groupIndexFrom, itemIndexFrom, groupIndexTo, itemIndexTo,
1770 NOTIFY_TYPE_REORDERED_ITEM);
1771 __pListItemEvent->Fire(*pArg);
1776 _GroupedListViewImpl::OnSectionTableViewItemStateChanged(_TableView& tableView, int sectionIndex, int itemIndex, _TableViewItem* pItem,
1777 TableViewItemStatus status)
1779 FireListViewItemEvent(sectionIndex, itemIndex, pItem, status);
1783 _GroupedListViewImpl::OnSectionTableViewContextItemActivationStateChanged(_TableView& tableView, int sectionIndex, int itemIndex,
1784 _TableViewItem* pContextItem, bool activated)
1786 _ListViewItem* pListViewItem = static_cast<_ListViewItem*>(GetCore().FindItem(sectionIndex, itemIndex));
1788 if (pListViewItem != null)
1790 pListViewItem->SetContextItemActivationState(activated);
1795 _GroupedListViewImpl::OnTableViewItemSwept(_TableView& tableView, int groupIndex, int itemIndex, TableViewSweepDirection direction)
1797 if (__pListItemEvent != null)
1799 _ListViewItem* pListViewItem = static_cast<_ListViewItem*>(GetCore().FindItem(groupIndex, itemIndex));
1801 SetItemNeedsLazyDeletion(pListViewItem);
1803 _ListItemEventArg* pArg = new (std::nothrow) _ListItemEventArg(groupIndex, itemIndex, direction, 0, NOTIFY_TYPE_SWEPT_ITEM);
1804 __pListItemEvent->Fire(*pArg);
1806 SetItemNeedsLazyDeletion(null);
1811 _GroupedListViewImpl::FireListViewItemEvent(int groupIndex, int itemIndex, _TableViewItem* pItem, TableViewItemStatus status)
1813 if (__pListItemEvent != null)
1815 _ListViewItem* pListViewItem = static_cast<_ListViewItem*>(pItem);
1817 if (pListViewItem != null)
1819 SetItemNeedsLazyDeletion(pListViewItem);
1821 _ListViewItemStateChangedInfo itemInfo;
1822 pListViewItem->GetLastStateChangedInfo(itemInfo);
1824 if ((__pLinkEvent != null) && (itemInfo.pUiLinkInfo != null))
1826 IEventArg* pLinkEventArg = _PublicLinkEvent::CreateLinkEventArgN(itemInfo.pUiLinkInfo->textInfo,
1827 itemInfo.pUiLinkInfo->linkType, itemInfo.pUiLinkInfo->linkInfo);
1828 SysTryReturnVoidResult(NID_UI_CTRL, (pLinkEventArg != null), E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Unable to create _LinkEventArg.");
1829 __pLinkEvent->Fire(*pLinkEventArg);
1834 _ListItemEventArg* pArg = new (std::nothrow) _ListItemEventArg(groupIndex, itemIndex, itemInfo.elementId, 0,
1835 static_cast<NotifyType>(status));
1836 __pListItemEvent->Fire(*pArg);
1839 pListViewItem->ClearLastStateChangedInfo();
1841 SetItemNeedsLazyDeletion(null);
1847 _GroupedListViewImpl::FireListViewItemLongPressedEvent(void)
1849 if (__pListItemEvent != null)
1851 int groupIndex = -1;
1855 if ((GetItemIndexFromPosition(GetCurrentTouchPosition(), groupIndex, itemIndex, elementId) == E_SUCCESS) && (itemIndex != -1))
1857 _ListViewItem* pListViewItem = static_cast<_ListViewItem*>(GetCore().FindItem(groupIndex, itemIndex));
1859 if ((pListViewItem != null) && (!pListViewItem->IsContextItem()))
1861 SetItemNeedsLazyDeletion(pListViewItem);
1863 _ListItemEventArg* pArg = new (std::nothrow) _ListItemEventArg(groupIndex, itemIndex, elementId, 0, NOTIFY_TYPE_LONG_PRESSED_ITEM);
1864 __pListItemEvent->Fire(*pArg);
1866 SetItemNeedsLazyDeletion(null);
1873 _GroupedListViewImpl::OnScrollEndReached(_Control& source, ScrollEndEvent type)
1875 if (__pScrollEvent != null)
1877 _ScrollEventArg* pEventArg = _ScrollEventArg::GetScrollEventArgN(GetPublic(), type);
1878 result r = GetLastResult();
1879 SysTryReturnVoidResult(NID_UI_CTRL, (r == E_SUCCESS), r, "[%s] Propagating.", GetErrorMessage(r));
1881 __pScrollEvent->Fire(*pEventArg);
1886 _GroupedListViewImpl::OnScrollPositionChanged(_Control& source, float scrollPosition)
1888 if (__pScrollEvent != null)
1890 _ScrollEventArg* pEventArg = _ScrollEventArg::GetScrollEventArgN(GetPublic(), scrollPosition);
1891 result r = GetLastResult();
1892 SysTryReturnVoidResult(NID_UI_CTRL, (pEventArg != null), r, "[%s] Propagating.", GetErrorMessage(r));
1894 __pScrollEvent->Fire(*pEventArg);
1899 _GroupedListViewImpl::OnScrollStopped(_Control& source)
1901 if (__pScrollEvent != null)
1903 _ScrollEventArg* pEventArg = _ScrollEventArg::GetScrollEventArgN(GetPublic());
1904 result r = GetLastResult();
1905 SysTryReturnVoidResult(NID_UI_CTRL, (r == E_SUCCESS), r, "[%s] Propagating.", GetErrorMessage(r));
1907 __pScrollEvent->Fire(*pEventArg);
1912 _GroupedListViewImpl::OnUiFastScrollIndexSelected(_Control& source, _FastScrollIndex& index)
1914 if (__pFastScrollEvent != null)
1916 String* pIndexText = index.GetIndexText();
1917 if (pIndexText != null)
1919 _FastScrollEventArg* pEventArg = new (std::nothrow) _FastScrollEventArg(GetPublic(), *pIndexText);
1920 __pFastScrollEvent->Fire(*pEventArg);
1926 _GroupedListViewImpl::OnDraw(void)
1928 _ControlImpl::OnDraw();
1930 if (__redrawListView)
1932 CheckEmptyListShowState();
1933 __redrawListView = false;
1938 _GroupedListViewImpl::OnChangeLayout(_ControlOrientation orientation)
1940 __isOrientationChanged = true;
1942 if (GetCore().IsFocusModeStateEnabled() && GetCore().GetRootWindow() && GetCore().GetRootWindow()->IsActivated())
1944 GetCore().SetFocusDuringOrientationChange();
1947 _ControlImpl::OnChangeLayout(orientation);
1951 _GroupedListViewImpl::OnBoundsChanged(void)
1953 _ControlImpl::OnBoundsChanged();
1955 if (__pEmptyBitmap != null)
1957 SetBitmapOfEmptyList(__pEmptyBitmap->GetBackgroundBitmap());
1959 if (__pEmptyText != null)
1961 SetTextOfEmptyList(__pEmptyText->GetText());
1964 if (__isOrientationChanged)
1966 __isOrientationChanged = false;
1968 if (GetCore().IsTableViewFocused() && GetCore().IsFocusModeStateEnabled()
1969 && GetCore().GetRootWindow() && GetCore().GetRootWindow()->IsActivated())
1981 _GroupedListViewImpl::OnFontChanged(Font* pFont)
1983 String fontName = GetFont();
1984 _GroupedListViewItemProviderAdaptor* pProviderAdaptor =
1985 static_cast <_GroupedListViewItemProviderAdaptor*>(GetCore().GetItemProviderAdaptor());
1987 if (__pEmptyText != null)
1989 __pEmptyText->SetFont(fontName);
1990 SetTextOfEmptyList(__pEmptyText->GetText());
1993 if (pProviderAdaptor != null)
1995 pProviderAdaptor->SetItemFont(fontName);
1998 int firstGroup = -1;
2002 int currentItem = -1;
2003 int lastItemInGroup = -1;
2005 GetCore().GetFirstLoadedItemIndex(firstGroup, firstItem);
2006 GetCore().GetLastLoadedItemIndex(lastGroup, lastItem);
2008 for (int i = firstGroup; i <= lastGroup; i++)
2010 currentItem = ((i == firstGroup) ? firstItem : -1);
2011 lastItemInGroup = ((i == lastGroup) ? lastItem : (GetCore().GetItemCountAt(i) - 1));
2013 for (; currentItem <= lastItemInGroup; currentItem++)
2015 _ListViewItem* pListViewItem = static_cast<_ListViewItem*>(GetCore().FindItem(i, currentItem));
2017 if (pListViewItem != null)
2019 pListViewItem->SetFont(fontName);
2026 _GroupedListViewImpl::OnFontInfoRequested(unsigned long& style, int& size)
2028 float textSize = 0.0f;
2029 OnFontInfoRequested(style, textSize);
2031 size = _CoordinateSystemUtils::ConvertToInteger(textSize);
2035 _GroupedListViewImpl::OnFontInfoRequested(unsigned long& style, float& size)
2037 GET_SHAPE_CONFIG(LISTVIEW::EMPTY_LIST_TEXT_HEIGHT, _CONTROL_ORIENTATION_PORTRAIT, size);
2038 style = FONT_STYLE_PLAIN;
2042 _GroupedListViewImpl::GetCurrentTouchPosition(void)
2044 FloatPoint currentTouchPos = _TouchManager::GetInstance()->GetScreenPoint(0);
2045 FloatRectangle bounds = GetCore().GetAbsoluteBoundsF(true);
2047 currentTouchPos.x -= bounds.x;
2048 currentTouchPos.y -= bounds.y;
2050 return currentTouchPos;
2054 _GroupedListViewImpl::OnTouchEventListenerAdded(void)
2060 _GroupedListViewImpl::OnTouchEventListenerRemoved(void)
2065 class _GroupedListViewMaker
2066 : public _UiBuilderControlMaker
2069 _GroupedListViewMaker(_UiBuilder* uibuilder)
2070 : _UiBuilderControlMaker(uibuilder){};
2072 virtual ~_GroupedListViewMaker(){};
2074 static _UiBuilderControlMaker*
2075 GetInstance(_UiBuilder* uibuilder)
2077 _GroupedListViewMaker* pGroupedListViewMaker = new (std::nothrow) _GroupedListViewMaker(uibuilder);
2078 return pGroupedListViewMaker;
2081 virtual Tizen::Ui::Control*
2082 Make(_UiBuilderControl* pControl)
2084 result r = E_SYSTEM;
2085 _UiBuilderControlLayout* pControlProperty = null;
2086 GroupedListView* pGroupedListView = null;
2087 FloatRectangle rect;
2089 ListScrollStyle scrollStyle = SCROLL_STYLE_FADE_OUT;
2090 GroupedListViewStyle style = GROUPED_LIST_VIEW_STYLE_INDEXED;
2091 ScrollInputMode scrollInputMode = SCROLL_INPUT_MODE_ALLOW_ANY_DIRECTION;
2093 String elementString;
2094 bool itemDividerState = true;
2096 bool sweepEnabledState = false;
2099 GetProperty(pControl, &pControlProperty);
2100 if (pControlProperty == null)
2105 pGroupedListView = new (std::nothrow) GroupedListView();
2106 if (pGroupedListView == null)
2111 rect = pControlProperty->GetRectF();
2114 styleString = pControlProperty->GetStyle();
2116 if (styleString.Equals(L"GROUPED_LIST_VIEW_STYLE_SECTION", false))
2118 style = GROUPED_LIST_VIEW_STYLE_SECTION;
2122 style = GROUPED_LIST_VIEW_STYLE_INDEXED;
2126 if (pControl->GetElement(L"itemDivider", elementString))
2128 if (elementString.Equals(L"true", false))
2130 itemDividerState = true;
2134 itemDividerState = false;
2138 if (pControl->GetElement(L"listScrollStyle", elementString))
2140 if (elementString.Equals(L"SCROLL_STYLE_FIXED", false))
2142 scrollStyle = SCROLL_STYLE_FIXED;
2144 else if (elementString.Equals(L"SCROLL_STYLE_FAST_SCROLL", false))
2146 scrollStyle = SCROLL_STYLE_FAST_SCROLL;
2148 else if (elementString.Equals(L"SCROLL_STYLE_JUMP_TO_TOP", false))
2150 scrollStyle = SCROLL_STYLE_JUMP_TO_TOP;
2152 else if (elementString.Equals(L"SCROLL_STYLE_THUMB", false))
2154 scrollStyle = SCROLL_STYLE_THUMB;
2157 else if (pControl->GetElement(L"fastScroll", elementString))
2159 if (elementString.Equals(L"true", false))
2161 scrollStyle = SCROLL_STYLE_FAST_SCROLL;
2165 r = pGroupedListView->Construct(rect, style, itemDividerState, scrollStyle);
2166 SysTryCatch(NID_UI, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r));
2168 // Set BackgroundsBitmap
2169 if (pControl->GetElement("backgroundBitmapPath", elementString))
2171 Bitmap* pBackgroundBitmap = null;
2172 pBackgroundBitmap = LoadBitmapN(elementString);
2173 if (pBackgroundBitmap != null)
2175 r = pGroupedListView->SetBackgroundBitmap(pBackgroundBitmap);
2176 delete pBackgroundBitmap;
2177 pBackgroundBitmap = null;
2179 SysTryCatch(NID_UI, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r));
2184 if (pControl->GetElement(L"textOfEmptyList", elementString))
2186 r = pGroupedListView->SetTextOfEmptyList(elementString);
2187 SysTryCatch(NID_UI, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r));
2190 if (pControl->GetElement(L"colorOfEmptyListText", elementString))
2192 ConvertStringToColor(elementString, color);
2193 r = pGroupedListView->SetTextColorOfEmptyList(color);
2194 SysTryCatch(NID_UI, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r));
2197 if (pControl->GetElement(L"bitmapPathOfEmptyList", elementString))
2199 Bitmap* pBackgroundBitmap = null;
2200 pBackgroundBitmap = LoadBitmapN(elementString); //__image->DecodeN(path,BITMAP_PIXEL_FORMAT_RGB565);
2201 if (pBackgroundBitmap != null)
2203 r = pGroupedListView->SetBitmapOfEmptyList(pBackgroundBitmap);
2204 delete pBackgroundBitmap;
2205 pBackgroundBitmap = null;
2207 SysTryCatch(NID_UI, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r));
2211 if (pControl->GetElement(L"backgroundColorOpacity", elementString) || pControl->GetElement(L"BGColorOpacity", elementString))
2213 Base::Integer::Parse(elementString, opacity);
2216 if (pControl->GetElement(L"backgroundColor", elementString) || pControl->GetElement(L"BGColor", elementString))
2218 ConvertStringToColor32(elementString, opacity, color);
2219 r = pGroupedListView->SetBackgroundColor(color);
2220 SysTryCatch(NID_UI, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r));
2223 if (pControl->GetElement(L"itemDividerColor", elementString))
2225 ConvertStringToColor(elementString, color);
2226 r = pGroupedListView->SetItemDividerColor(color);
2227 SysTryCatch(NID_UI, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r));
2230 if (pControl->GetElement(L"sectionColor", elementString))
2232 ConvertStringToColor(elementString, color);
2233 r = pGroupedListView->SetSectionColor(color);
2234 SysTryCatch(NID_UI, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r));
2237 if (pControl->GetElement(L"sweepEnabled", elementString))
2240 if (elementString.Equals(L"true", false))
2242 sweepEnabledState = true;
2246 sweepEnabledState = false;
2249 r = pGroupedListView->SetSweepEnabled(sweepEnabledState);
2250 SysTryCatch(NID_UI, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r));
2253 // scroll Input Mode
2254 if (pControl->GetElement(L"scrollInputMode", elementString))
2256 if (elementString.Equals(L"SCROLL_INPUT_MODE_RESTRICT_TO_INITIAL_DIRECTION", false))
2258 scrollInputMode = SCROLL_INPUT_MODE_RESTRICT_TO_INITIAL_DIRECTION;
2261 pGroupedListView->SetScrollInputMode(scrollInputMode);
2264 return pGroupedListView;
2267 delete pGroupedListView;
2272 }; // _GroupedListViewMaker
2274 _GroupedListViewRegister::_GroupedListViewRegister()
2276 _UiBuilderControlTableManager* pUiBuilderControlTableManager = _UiBuilderControlTableManager::GetInstance();
2277 pUiBuilderControlTableManager->RegisterControl(L"GroupedListView", _GroupedListViewMaker::GetInstance);
2280 _GroupedListViewRegister::~_GroupedListViewRegister()
2282 _UiBuilderControlTableManager* pUiBuilderControlTableManager = _UiBuilderControlTableManager::GetInstance();
2283 pUiBuilderControlTableManager->UnregisterControl(L"GroupedListView");
2285 static _GroupedListViewRegister GroupedListViewRegisterToUIbuilder;
2286 }}} // Tizen::Ui::Controls