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;
1163 bool annexFocused = false;
1164 int focusedGroupedIndex = -1;
1165 int focusedItemIndex = -1;
1167 if (pListViewItem != null && pListViewItem->IsItemSelected())
1169 needChangeEventTarget = true;
1172 GetCore().GetFocusedItemIndex(focusedGroupedIndex, focusedItemIndex);
1173 if (focusedGroupedIndex == groupIndex && focusedItemIndex == itemIndex)
1175 if (GetCore().IsAnnexFocused())
1177 annexFocused = true;
1185 if (needChangeEventTarget && (pListViewItem != null))
1187 pListViewItem->GetCurrentStatus(itemStatus);
1188 pListViewItem = null;
1192 GetCore().UnloadItem(groupIndex, itemIndex);
1194 pListViewItem = static_cast<_ListViewItem*>(GetCore().LoadItem(groupIndex, itemIndex));
1196 if (needChangeEventTarget && (pListViewItem != null))
1198 pListViewItem->SetCurrentStatus(itemStatus);
1200 _Control* pTarget = static_cast<_Control*>(pListViewItem);
1202 for (int i = 0; i < pListViewItem->GetChildCount(); i++)
1204 if (pListViewItem->GetChild(i)->GetBoundsF().Contains(itemStatus.currentTouchPosition))
1206 pTarget = pListViewItem->GetChild(i);
1210 // change touch event target
1211 pTarget->SetChangingEventTarget(true);
1212 _TouchManager::GetInstance()->SetChangedTouchableTarget(pTarget);
1215 if (pListViewItem && pListViewItem->IsFocusable()
1216 && pListViewItem->GetEnableState() && pListViewItem->GetVisibleState()
1217 && pListViewItem->GetRootWindow() && pListViewItem->GetRootWindow()->IsActivated())
1221 pListViewItem->SetFocused(true);
1222 pListViewItem->DrawFocus();
1223 itemFocused = false;
1225 else if (annexFocused)
1227 pListViewItem->DrawAnnexFocus();
1228 annexFocused = false;
1235 r = GetCore().RefreshTableView(groupIndex, itemIndex, static_cast<TableViewRefreshType>(type));
1238 CheckEmptyListShowState();
1243 SetLastResultReturn(r);
1247 _GroupedListViewImpl::RefreshList(int groupIndex, int itemIndex, int elementId)
1249 if ((groupIndex < 0) || (groupIndex >= GetCore().GetGroupCount()) || (itemIndex < 0) || (itemIndex >= GetCore().GetItemCountAt(groupIndex)))
1251 return E_OUT_OF_RANGE;
1254 result r = E_SUCCESS;
1255 _ListViewItem* pListViewItem = static_cast<_ListViewItem*>(GetCore().FindItem(groupIndex, itemIndex));
1257 if (pListViewItem != null)
1259 r = (pListViewItem->RefreshElement(elementId)) ? E_SUCCESS : E_OUT_OF_RANGE;
1262 SetLastResultReturn(r);
1266 _GroupedListViewImpl::UpdateList(bool isRestoreAnnexFocusValue)
1268 __needReloadItems = true;
1270 result r = GetCore().UpdateTableView(isRestoreAnnexFocusValue);
1272 CheckEmptyListShowState();
1276 // API versioning for initial Show() operation
1277 if (Tizen::App::_AppInfo::GetApiVersion() == _API_VERSION_2_0 && Tizen::App::_AppInfo::IsOspCompat())
1282 __needReloadItems = false;
1284 SetLastResultReturn(r);
1288 _GroupedListViewImpl::SetItemNeedsLazyDeletion(_ListViewItem* pItem)
1290 _GroupedListViewItemProviderAdaptor* pProviderAdaptor =
1291 static_cast <_GroupedListViewItemProviderAdaptor*>(GetCore().GetItemProviderAdaptor());
1293 if (pProviderAdaptor != null)
1295 pProviderAdaptor->SetItemNeedsLazyDeletion(pItem);
1300 _GroupedListViewImpl::GetItemIndexFromPosition(const FloatPoint& position, int& groupIndex, int& itemIndex) const
1302 result r = GetCore().GetItemIndexFromPosition(position, groupIndex, itemIndex);
1304 SysTryReturn(NID_UI_CTRL, (r == E_SUCCESS), E_SYSTEM, E_SYSTEM, "[E_SYSTEM] There is no item at the specified position.");
1306 SetLastResultReturn(r);
1310 _GroupedListViewImpl::GetItemIndexFromPosition(const FloatPoint& position, int& groupIndex, int& itemIndex, int& elementId) const
1314 result r = GetCore().GetItemIndexFromPosition(position, groupIndex, itemIndex);
1315 SysTryReturn(NID_UI_CTRL, (r == E_SUCCESS), E_SYSTEM, E_SYSTEM, "[E_SYSTEM] There is no item at the specified position.");
1317 _ListViewItem* pListViewItem = static_cast<_ListViewItem*>(GetCore().FindItem(groupIndex, itemIndex));
1319 if (pListViewItem != null)
1321 FloatPoint originPosition = pListViewItem->GetPositionF();
1322 originPosition.y -= GetCore().GetScrollPosition();
1324 elementId = pListViewItem->GetElementIdFromPosition(FloatPoint(position.x - originPosition.x, position.y - originPosition.y));
1327 SetLastResultReturn(r);
1331 _GroupedListViewImpl::SetSectionColor(const Color& color)
1333 return GetCore().SetSectionColor(color);
1337 _GroupedListViewImpl::GetSectionColor(void) const
1339 return GetCore().GetSectionColor();
1343 _GroupedListViewImpl::SetItemDividerColor(const Color& color)
1345 return GetCore().SetItemDividerColor(color);
1349 _GroupedListViewImpl::GetItemDividerColor(void) const
1351 return GetCore().GetItemDividerColor();
1355 _GroupedListViewImpl::SetListBackgroundColor(const Color& color)
1357 SetBackgroundColor(color);
1361 _GroupedListViewImpl::SetBackgroundBitmap(const Bitmap* pBitmap)
1363 GetCore().SetBackgroundBitmap(const_cast<Bitmap*>(pBitmap));
1364 GetCore().SetBackgroundBitmapStretch(true);
1366 SetLastResultReturn(E_SUCCESS);
1370 _GroupedListViewImpl::SetBitmapOfEmptyList(const Bitmap* pBitmap)
1372 if (pBitmap == null)
1374 if (__pEmptyBitmap != null)
1376 GetCore().DetachChild(*__pEmptyBitmap);
1378 delete __pEmptyBitmap;
1379 __pEmptyBitmap = null;
1384 if (__pEmptyBitmap == null)
1386 __pEmptyBitmap = _Label::CreateLabelN();
1387 SysTryReturn(NID_UI_CTRL, (__pEmptyBitmap != null), E_SYSTEM, E_SYSTEM, "[%s] Propagating.", GetErrorMessage(GetLastResult()));
1389 __pEmptyBitmap->SetVisibleState(false);
1390 __pEmptyBitmap->SetMargin(0.0f, 0.0f);
1392 GetCore().AttachChild(*__pEmptyBitmap);
1395 __pEmptyBitmap->SetSize(FloatDimension(pBitmap->GetWidthF(), pBitmap->GetHeightF()));
1396 __pEmptyBitmap->SetBackgroundColor(Color(0, 0, 0, 0));
1397 __pEmptyBitmap->SetBackgroundBitmap(*pBitmap);
1400 AdjustLayoutOfEmptyList();
1402 SetLastResultReturn(E_SUCCESS);
1406 _GroupedListViewImpl::SetTextOfEmptyList(const String& text)
1410 if (__pEmptyText != null)
1412 GetCore().DetachChild(*__pEmptyText);
1414 delete __pEmptyText;
1415 __pEmptyText = null;
1420 if (__pEmptyText == null)
1422 __pEmptyText = _Label::CreateLabelN();
1423 SysTryReturn(NID_UI_CTRL, (__pEmptyText != null), E_SYSTEM, E_SYSTEM, "[%s] Propagating.", GetErrorMessage(GetLastResult()));
1425 __pEmptyText->SetVisibleState(false);
1426 __pEmptyText->SetMargin(0.0f, 0.0f);
1428 GetCore().AttachChild(*__pEmptyText);
1431 TextObject* pText = new (std::nothrow) TextObject;
1432 SysTryReturn(NID_UI_CTRL, (pText != null), E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[%s] Propagating.", GetErrorMessage(GetLastResult()));
1436 TextSimple* pSimpleText = new (std::nothrow) TextSimple(const_cast <wchar_t*>(text.GetPointer()), text.GetLength());
1437 SysTryReturn(NID_UI_CTRL, (pSimpleText != null), E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[%s] Propagating.", GetErrorMessage(GetLastResult()));
1438 pText->AppendElement(*pSimpleText);
1440 float fontSize = 0.0f;
1441 GET_SHAPE_CONFIG(LISTVIEW::EMPTY_LIST_TEXT_HEIGHT, _CONTROL_ORIENTATION_PORTRAIT, fontSize);
1444 font.Construct(GetFont(), FONT_STYLE_PLAIN, fontSize);
1445 pText->SetFont(&font, 0, pText->GetTextLength());
1447 FloatDimension listDimension = GetCore().GetSizeF();
1449 pText->SetBounds(FloatRectangle(0.0f, 0.0f, listDimension.width, 1.0f));
1452 FloatDimension labelDimension = pText->GetTextExtentF(0, pText->GetTextLength());
1453 labelDimension.height = pText->GetTotalHeightF();
1455 if (labelDimension.width > listDimension.width)
1457 pText->SetBounds(FloatRectangle(0.0f, 0.0f, listDimension.width, 1.0f));
1460 float labelHeight = pText->GetTotalHeightF();
1462 labelDimension.width = listDimension.width;
1463 labelDimension.height = ((listDimension.height < labelHeight) ? listDimension.height : labelHeight);
1468 __pEmptyText->SetSize(labelDimension);
1469 __pEmptyText->SetBackgroundColor(Color(0, 0, 0, 0));
1470 __pEmptyText->SetMargin(0.0f, 0.0f, 0.0f, 0.0f);
1471 __pEmptyText->SetTextColor(__emptyTextColor);
1472 __pEmptyText->SetTextConfig(fontSize, LABEL_TEXT_STYLE_NORMAL);
1473 __pEmptyText->SetText(text);
1476 AdjustLayoutOfEmptyList();
1478 SetLastResultReturn(E_SUCCESS);
1482 _GroupedListViewImpl::GetTextOfEmptyList(void) const
1484 return ((__pEmptyText != null) ? __pEmptyText->GetText() : String());
1488 _GroupedListViewImpl::SetTextColorOfEmptyList(const Color& color)
1490 __emptyTextColor = color;
1492 if (__pEmptyText != null)
1494 __pEmptyText->SetTextColor(color);
1497 SetLastResultReturn(E_SUCCESS);
1501 _GroupedListViewImpl::GetTextColorOfEmptyList(void) const
1503 return __emptyTextColor;
1507 _GroupedListViewImpl::ExpandGroup(int groupIndex)
1509 SysTryReturn(NID_UI_CTRL, (GetCore().GetTableViewStyle() == TABLE_VIEW_STYLE_GROUPED), E_INVALID_OPERATION, E_INVALID_OPERATION,
1510 "[E_INVALID_OPERATION] The control should be indexed style.");
1512 return GetCore().ExpandGroup(groupIndex);
1516 _GroupedListViewImpl::CollapseGroup(int groupIndex)
1518 SysTryReturn(NID_UI_CTRL, (GetCore().GetTableViewStyle() == TABLE_VIEW_STYLE_GROUPED), E_INVALID_OPERATION, E_INVALID_OPERATION,
1519 "[E_INVALID_OPERATION] The control should be indexed style.");
1521 return GetCore().CollapseGroup(groupIndex);
1525 _GroupedListViewImpl::IsGroupExpanded(int groupIndex) const
1527 return GetCore().IsGroupExpanded(groupIndex);
1531 _GroupedListViewImpl::ExpandAllGroups(void)
1533 SysTryReturn(NID_UI_CTRL, (GetCore().GetTableViewStyle() == TABLE_VIEW_STYLE_GROUPED), E_INVALID_OPERATION, E_INVALID_OPERATION,
1534 "[E_INVALID_OPERATION] The control should be indexed style.");
1536 return GetCore().ExpandAllGroup(true);
1540 _GroupedListViewImpl::CollapseAllGroups(void)
1542 SysTryReturn(NID_UI_CTRL, (GetCore().GetTableViewStyle() == TABLE_VIEW_STYLE_GROUPED), E_INVALID_OPERATION, E_INVALID_OPERATION,
1543 "[E_INVALID_OPERATION] The control should be indexed style.");
1545 return GetCore().CollapseAllGroup(true);
1549 _GroupedListViewImpl::CheckEmptyListShowState(void)
1551 bool isEmpty = (GetGroupCount() == 0);
1553 if (__pEmptyBitmap != null)
1555 __pEmptyBitmap->SetVisibleState(isEmpty);
1557 if (__pEmptyText != null)
1559 __pEmptyText->SetVisibleState(isEmpty);
1562 _AccessibilityContainer* pContainer = GetCore().GetAccessibilityContainer();
1564 if (_AccessibilityManager::IsActivated() && (pContainer != null))
1568 if (__pAccessibilityElement == null)
1570 __pAccessibilityElement = new (std::nothrow) _AccessibilityElement(true);
1572 SysTryReturnVoidResult(NID_UI_CTRL, (__pAccessibilityElement != null), E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
1574 __pAccessibilityElement->SetName(L"ListView");
1576 pContainer->RemoveAllElement();
1577 pContainer->AddElement(*__pAccessibilityElement);
1580 Rectangle bounds = GetBounds();
1581 __pAccessibilityElement->SetBounds(Rectangle(0, 0, bounds.width, bounds.height));
1583 String accessibilityLable;
1585 if (__pEmptyBitmap != null)
1587 __pEmptyBitmap->GetAccessibilityContainer()->Activate(false);
1589 accessibilityLable += L"Image, ";
1591 if (__pEmptyText != null)
1593 __pEmptyText->GetAccessibilityContainer()->Activate(false);
1595 accessibilityLable += __pEmptyText->GetText();
1596 accessibilityLable += L", ";
1599 accessibilityLable += L"No items";
1601 __pAccessibilityElement->SetLabel(accessibilityLable);
1605 if (__pAccessibilityElement != null)
1607 if (pContainer->RemoveElement(*__pAccessibilityElement) != E_SUCCESS)
1609 delete __pAccessibilityElement;
1611 __pAccessibilityElement = null;
1618 _GroupedListViewImpl::AdjustLayoutOfEmptyList(void)
1620 FloatDimension listDimension = GetCore().GetSizeF();
1621 FloatDimension emptyBitmap;
1622 FloatDimension emptyText;
1623 FloatPoint bitmapPos;
1625 float totalHeight = 0.0f;
1626 float horizontalSpacing = 0.0f;
1628 if (__pEmptyBitmap != null)
1630 emptyBitmap = __pEmptyBitmap->GetSizeF();
1632 if (__pEmptyText != null)
1634 emptyText = __pEmptyText->GetSizeF();
1636 if (__pEmptyBitmap != null)
1638 GET_SHAPE_CONFIG(LISTVIEW::EMPTY_LIST_HORIZONTAL_SPACING, _CONTROL_ORIENTATION_PORTRAIT, horizontalSpacing);
1642 totalHeight = emptyBitmap.height + horizontalSpacing + emptyText.height;
1644 if ((__pEmptyBitmap != null) && (__pEmptyText != null) && (totalHeight < listDimension.height))
1646 bitmapPos.x = ((_FloatCompare(listDimension.width, emptyBitmap.width)) ? 0.0f : (listDimension.width - emptyBitmap.width) / 2.0f);
1647 bitmapPos.y = (listDimension.height - totalHeight) / 2.0f;
1649 textPos.x = ((_FloatCompare(listDimension.width, emptyText.width)) ? 0.0f : (listDimension.width - emptyText.width) / 2.0f);
1650 textPos.y = bitmapPos.y + emptyBitmap.height + horizontalSpacing;
1654 if (__pEmptyBitmap != null)
1656 bitmapPos.x = ((_FloatCompare(listDimension.width, emptyBitmap.width)) ? 0.0f : (listDimension.width - emptyBitmap.width) / 2.0f);
1657 bitmapPos.y = ((listDimension.height <= totalHeight) ? 0.0f : (listDimension.height - totalHeight) / 2.0f);
1660 if (__pEmptyText != null)
1662 textPos.x = ((_FloatCompare(listDimension.width, emptyText.width)) ? 0.0f : (listDimension.width - emptyText.width) / 2.0f);
1663 textPos.y = ((listDimension.height <= totalHeight) ? (bitmapPos.y + emptyBitmap.height + horizontalSpacing) : (listDimension.height - totalHeight) / 2.0f);
1667 if (__pEmptyBitmap != null)
1669 __pEmptyBitmap->SetPosition(bitmapPos);
1671 if (__pEmptyText != null)
1673 __pEmptyText->SetPosition(textPos);
1676 CheckEmptyListShowState();
1681 _GroupedListViewImpl::BeginReorderingMode(void)
1683 SysTryReturn(NID_UI_CTRL, (GetCore().GetTableViewStyle() == TABLE_VIEW_STYLE_GROUPED), E_INVALID_OPERATION, E_INVALID_OPERATION,
1684 "[E_INVALID_OPERATION] Reordering mode is supported only Indexed style.");
1686 result r = GetCore().SetReorderModeEnabled(true);
1688 SetLastResultReturn(r);
1692 _GroupedListViewImpl::EndReorderingMode(void)
1694 SysTryReturn(NID_UI_CTRL, (GetCore().GetTableViewStyle() == TABLE_VIEW_STYLE_GROUPED), E_INVALID_OPERATION, E_INVALID_OPERATION,
1695 "[E_INVALID_OPERATION] Reordering mode is supported only Indexed style.");
1697 result r = GetCore().SetReorderModeEnabled(false);
1699 SetLastResultReturn(r);
1703 _GroupedListViewImpl::IsInReorderingMode(void) const
1705 return GetCore().IsReorderModeEnabled();
1709 _GroupedListViewImpl::SetScrollInputMode(ScrollInputMode mode)
1711 GetCore().SetScrollInputMode(mode);
1715 _GroupedListViewImpl::GetScrollInputMode(void) const
1717 return GetCore().GetScrollInputMode();
1721 _GroupedListViewImpl::OpenContextItem(int groupIndex, int itemIndex)
1723 return GetCore().OpenContextItem(groupIndex, itemIndex);
1727 _GroupedListViewImpl::CloseContextItem(int groupIndex, int itemIndex)
1729 return GetCore().CloseContextItem(groupIndex, itemIndex);
1733 _GroupedListViewImpl::IsContextItemOpened(int groupIndex, int itemIndex) const
1735 return GetCore().IsContextItemOpened(groupIndex, itemIndex);
1739 _GroupedListViewImpl::OnListViewContextItemStateChanged(_Control& source, int groupIndex, int itemIndex, int elementId,
1740 ListContextItemStatus status)
1742 if (__pListItemEvent != null)
1744 CloseContextItem(groupIndex, itemIndex);
1746 _ListViewItem* pListViewItem = static_cast<_ListViewItem*>(GetCore().FindItem(groupIndex, itemIndex));
1748 SetItemNeedsLazyDeletion(pListViewItem);
1750 _ListItemEventArg* pArg = new (std::nothrow) _ListItemEventArg(groupIndex, itemIndex, elementId, 0, NOTIFY_TYPE_SELCTED_CONTEXT_ITEM);
1751 __pListItemEvent->Fire(*pArg);
1753 SetItemNeedsLazyDeletion(null);
1758 _GroupedListViewImpl::OnGroupedTableViewGroupItemStateChanged(_TableView& tableView, int groupIndex, _TableViewItem* pItem,
1759 TableViewItemStatus status)
1761 FireListViewItemEvent(groupIndex, -1, pItem, status);
1765 _GroupedListViewImpl::OnGroupedTableViewItemStateChanged(_TableView& tableView, int groupIndex, int itemIndex, _TableViewItem* pItem,
1766 TableViewItemStatus status)
1768 FireListViewItemEvent(groupIndex, itemIndex, pItem, status);
1772 _GroupedListViewImpl::OnGroupedTableViewContextItemActivationStateChanged(_TableView& tableView, int groupIndex, int itemIndex,
1773 _TableViewItem* pContextItem, bool activated)
1775 _ListViewItem* pListViewItem = static_cast<_ListViewItem*>(GetCore().FindItem(groupIndex, itemIndex));
1777 if (pListViewItem != null)
1779 pListViewItem->SetContextItemActivationState(activated);
1784 _GroupedListViewImpl::OnGroupedTableViewItemReordered(_TableView& tableView, int groupIndexFrom, int itemIndexFrom,
1785 int groupIndexTo, int itemIndexTo)
1787 if (__pListItemEvent != null)
1789 _ListItemEventArg* pArg = new (std::nothrow) _ListItemEventArg(groupIndexFrom, itemIndexFrom, groupIndexTo, itemIndexTo,
1790 NOTIFY_TYPE_REORDERED_ITEM);
1791 __pListItemEvent->Fire(*pArg);
1796 _GroupedListViewImpl::OnSectionTableViewItemStateChanged(_TableView& tableView, int sectionIndex, int itemIndex, _TableViewItem* pItem,
1797 TableViewItemStatus status)
1799 FireListViewItemEvent(sectionIndex, itemIndex, pItem, status);
1803 _GroupedListViewImpl::OnSectionTableViewContextItemActivationStateChanged(_TableView& tableView, int sectionIndex, int itemIndex,
1804 _TableViewItem* pContextItem, bool activated)
1806 _ListViewItem* pListViewItem = static_cast<_ListViewItem*>(GetCore().FindItem(sectionIndex, itemIndex));
1808 if (pListViewItem != null)
1810 pListViewItem->SetContextItemActivationState(activated);
1815 _GroupedListViewImpl::OnTableViewItemSwept(_TableView& tableView, int groupIndex, int itemIndex, TableViewSweepDirection direction)
1817 if (__pListItemEvent != null)
1819 _ListViewItem* pListViewItem = static_cast<_ListViewItem*>(GetCore().FindItem(groupIndex, itemIndex));
1821 SetItemNeedsLazyDeletion(pListViewItem);
1823 _ListItemEventArg* pArg = new (std::nothrow) _ListItemEventArg(groupIndex, itemIndex, direction, 0, NOTIFY_TYPE_SWEPT_ITEM);
1824 __pListItemEvent->Fire(*pArg);
1826 SetItemNeedsLazyDeletion(null);
1831 _GroupedListViewImpl::FireListViewItemEvent(int groupIndex, int itemIndex, _TableViewItem* pItem, TableViewItemStatus status)
1833 if (__pListItemEvent != null)
1835 _ListViewItem* pListViewItem = static_cast<_ListViewItem*>(pItem);
1837 if (pListViewItem != null)
1839 SetItemNeedsLazyDeletion(pListViewItem);
1841 _ListViewItemStateChangedInfo itemInfo;
1842 pListViewItem->GetLastStateChangedInfo(itemInfo);
1844 if ((__pLinkEvent != null) && (itemInfo.pUiLinkInfo != null))
1846 IEventArg* pLinkEventArg = _PublicLinkEvent::CreateLinkEventArgN(itemInfo.pUiLinkInfo->textInfo,
1847 itemInfo.pUiLinkInfo->linkType, itemInfo.pUiLinkInfo->linkInfo);
1848 SysTryReturnVoidResult(NID_UI_CTRL, (pLinkEventArg != null), E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Unable to create _LinkEventArg.");
1849 __pLinkEvent->Fire(*pLinkEventArg);
1854 _ListItemEventArg* pArg = new (std::nothrow) _ListItemEventArg(groupIndex, itemIndex, itemInfo.elementId, 0,
1855 static_cast<NotifyType>(status));
1856 __pListItemEvent->Fire(*pArg);
1859 pListViewItem->ClearLastStateChangedInfo();
1861 SetItemNeedsLazyDeletion(null);
1867 _GroupedListViewImpl::FireListViewItemLongPressedEvent(void)
1869 if (__pListItemEvent != null)
1871 int groupIndex = -1;
1875 if ((GetItemIndexFromPosition(GetCurrentTouchPosition(), groupIndex, itemIndex, elementId) == E_SUCCESS) && (itemIndex != -1))
1877 _ListViewItem* pListViewItem = static_cast<_ListViewItem*>(GetCore().FindItem(groupIndex, itemIndex));
1879 if ((pListViewItem != null) && (!pListViewItem->IsContextItem()))
1881 SetItemNeedsLazyDeletion(pListViewItem);
1883 _ListItemEventArg* pArg = new (std::nothrow) _ListItemEventArg(groupIndex, itemIndex, elementId, 0, NOTIFY_TYPE_LONG_PRESSED_ITEM);
1884 __pListItemEvent->Fire(*pArg);
1886 SetItemNeedsLazyDeletion(null);
1893 _GroupedListViewImpl::OnScrollEndReached(_Control& source, ScrollEndEvent type)
1895 if (__pScrollEvent != null)
1897 _ScrollEventArg* pEventArg = _ScrollEventArg::GetScrollEventArgN(GetPublic(), type);
1898 result r = GetLastResult();
1899 SysTryReturnVoidResult(NID_UI_CTRL, (r == E_SUCCESS), r, "[%s] Propagating.", GetErrorMessage(r));
1901 __pScrollEvent->Fire(*pEventArg);
1906 _GroupedListViewImpl::OnScrollPositionChanged(_Control& source, float scrollPosition)
1908 if (__pScrollEvent != null)
1910 _ScrollEventArg* pEventArg = _ScrollEventArg::GetScrollEventArgN(GetPublic(), scrollPosition);
1911 result r = GetLastResult();
1912 SysTryReturnVoidResult(NID_UI_CTRL, (pEventArg != null), r, "[%s] Propagating.", GetErrorMessage(r));
1914 __pScrollEvent->Fire(*pEventArg);
1919 _GroupedListViewImpl::OnScrollStopped(_Control& source)
1921 if (__pScrollEvent != null)
1923 _ScrollEventArg* pEventArg = _ScrollEventArg::GetScrollEventArgN(GetPublic());
1924 result r = GetLastResult();
1925 SysTryReturnVoidResult(NID_UI_CTRL, (r == E_SUCCESS), r, "[%s] Propagating.", GetErrorMessage(r));
1927 __pScrollEvent->Fire(*pEventArg);
1932 _GroupedListViewImpl::OnUiFastScrollIndexSelected(_Control& source, _FastScrollIndex& index)
1934 if (__pFastScrollEvent != null)
1936 String* pIndexText = index.GetIndexText();
1937 if (pIndexText != null)
1939 _FastScrollEventArg* pEventArg = new (std::nothrow) _FastScrollEventArg(GetPublic(), *pIndexText);
1940 __pFastScrollEvent->Fire(*pEventArg);
1946 _GroupedListViewImpl::OnDraw(void)
1948 _ControlImpl::OnDraw();
1950 if (__redrawListView)
1952 CheckEmptyListShowState();
1953 __redrawListView = false;
1958 _GroupedListViewImpl::OnChangeLayout(_ControlOrientation orientation)
1960 __isOrientationChanged = true;
1962 if (GetCore().IsFocusModeStateEnabled() && GetCore().GetRootWindow() && GetCore().GetRootWindow()->IsActivated())
1964 GetCore().SetFocusDuringOrientationChange();
1967 _ControlImpl::OnChangeLayout(orientation);
1971 _GroupedListViewImpl::OnBoundsChanged(void)
1973 _ControlImpl::OnBoundsChanged();
1975 if (__pEmptyBitmap != null)
1977 SetBitmapOfEmptyList(__pEmptyBitmap->GetBackgroundBitmap());
1979 if (__pEmptyText != null)
1981 SetTextOfEmptyList(__pEmptyText->GetText());
1984 if (__isOrientationChanged)
1986 __isOrientationChanged = false;
1988 if (GetCore().IsTableViewFocused() && GetCore().IsFocusModeStateEnabled()
1989 && GetCore().GetRootWindow() && GetCore().GetRootWindow()->IsActivated())
2001 _GroupedListViewImpl::OnFontChanged(Font* pFont)
2003 String fontName = GetFont();
2004 _GroupedListViewItemProviderAdaptor* pProviderAdaptor =
2005 static_cast <_GroupedListViewItemProviderAdaptor*>(GetCore().GetItemProviderAdaptor());
2007 if (__pEmptyText != null)
2009 __pEmptyText->SetFont(fontName);
2010 SetTextOfEmptyList(__pEmptyText->GetText());
2013 if (pProviderAdaptor != null)
2015 pProviderAdaptor->SetItemFont(fontName);
2018 int firstGroup = -1;
2022 int currentItem = -1;
2023 int lastItemInGroup = -1;
2025 GetCore().GetFirstLoadedItemIndex(firstGroup, firstItem);
2026 GetCore().GetLastLoadedItemIndex(lastGroup, lastItem);
2028 for (int i = firstGroup; i <= lastGroup; i++)
2030 currentItem = ((i == firstGroup) ? firstItem : -1);
2031 lastItemInGroup = ((i == lastGroup) ? lastItem : (GetCore().GetItemCountAt(i) - 1));
2033 for (; currentItem <= lastItemInGroup; currentItem++)
2035 _ListViewItem* pListViewItem = static_cast<_ListViewItem*>(GetCore().FindItem(i, currentItem));
2037 if (pListViewItem != null)
2039 pListViewItem->SetFont(fontName);
2046 _GroupedListViewImpl::OnFontInfoRequested(unsigned long& style, int& size)
2048 float textSize = 0.0f;
2049 OnFontInfoRequested(style, textSize);
2051 size = _CoordinateSystemUtils::ConvertToInteger(textSize);
2055 _GroupedListViewImpl::OnFontInfoRequested(unsigned long& style, float& size)
2057 GET_SHAPE_CONFIG(LISTVIEW::EMPTY_LIST_TEXT_HEIGHT, _CONTROL_ORIENTATION_PORTRAIT, size);
2058 style = FONT_STYLE_PLAIN;
2062 _GroupedListViewImpl::GetCurrentTouchPosition(void)
2064 FloatPoint currentTouchPos = _TouchManager::GetInstance()->GetScreenPoint(0);
2065 FloatRectangle bounds = GetCore().GetAbsoluteBoundsF(true);
2067 currentTouchPos.x -= bounds.x;
2068 currentTouchPos.y -= bounds.y;
2070 return currentTouchPos;
2074 _GroupedListViewImpl::OnTouchEventListenerAdded(void)
2080 _GroupedListViewImpl::OnTouchEventListenerRemoved(void)
2085 class _GroupedListViewMaker
2086 : public _UiBuilderControlMaker
2089 _GroupedListViewMaker(_UiBuilder* uibuilder)
2090 : _UiBuilderControlMaker(uibuilder){};
2092 virtual ~_GroupedListViewMaker(){};
2094 static _UiBuilderControlMaker*
2095 GetInstance(_UiBuilder* uibuilder)
2097 _GroupedListViewMaker* pGroupedListViewMaker = new (std::nothrow) _GroupedListViewMaker(uibuilder);
2098 return pGroupedListViewMaker;
2101 virtual Tizen::Ui::Control*
2102 Make(_UiBuilderControl* pControl)
2104 result r = E_SYSTEM;
2105 _UiBuilderControlLayout* pControlProperty = null;
2106 GroupedListView* pGroupedListView = null;
2107 FloatRectangle rect;
2109 ListScrollStyle scrollStyle = SCROLL_STYLE_FADE_OUT;
2110 GroupedListViewStyle style = GROUPED_LIST_VIEW_STYLE_INDEXED;
2111 ScrollInputMode scrollInputMode = SCROLL_INPUT_MODE_ALLOW_ANY_DIRECTION;
2113 String elementString;
2114 bool itemDividerState = true;
2116 bool sweepEnabledState = false;
2119 GetProperty(pControl, &pControlProperty);
2120 if (pControlProperty == null)
2125 pGroupedListView = new (std::nothrow) GroupedListView();
2126 if (pGroupedListView == null)
2131 rect = pControlProperty->GetRectF();
2134 styleString = pControlProperty->GetStyle();
2136 if (styleString.Equals(L"GROUPED_LIST_VIEW_STYLE_SECTION", false))
2138 style = GROUPED_LIST_VIEW_STYLE_SECTION;
2142 style = GROUPED_LIST_VIEW_STYLE_INDEXED;
2146 if (pControl->GetElement(L"itemDivider", elementString))
2148 if (elementString.Equals(L"true", false))
2150 itemDividerState = true;
2154 itemDividerState = false;
2158 if (pControl->GetElement(L"listScrollStyle", elementString))
2160 if (elementString.Equals(L"SCROLL_STYLE_FIXED", false))
2162 scrollStyle = SCROLL_STYLE_FIXED;
2164 else if (elementString.Equals(L"SCROLL_STYLE_FAST_SCROLL", false))
2166 scrollStyle = SCROLL_STYLE_FAST_SCROLL;
2168 else if (elementString.Equals(L"SCROLL_STYLE_JUMP_TO_TOP", false))
2170 scrollStyle = SCROLL_STYLE_JUMP_TO_TOP;
2172 else if (elementString.Equals(L"SCROLL_STYLE_THUMB", false))
2174 scrollStyle = SCROLL_STYLE_THUMB;
2177 else if (pControl->GetElement(L"fastScroll", elementString))
2179 if (elementString.Equals(L"true", false))
2181 scrollStyle = SCROLL_STYLE_FAST_SCROLL;
2185 r = pGroupedListView->Construct(rect, style, itemDividerState, scrollStyle);
2186 SysTryCatch(NID_UI, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r));
2188 // Set BackgroundsBitmap
2189 if (pControl->GetElement("backgroundBitmapPath", elementString))
2191 Bitmap* pBackgroundBitmap = null;
2192 pBackgroundBitmap = LoadBitmapN(elementString);
2193 if (pBackgroundBitmap != null)
2195 r = pGroupedListView->SetBackgroundBitmap(pBackgroundBitmap);
2196 delete pBackgroundBitmap;
2197 pBackgroundBitmap = null;
2199 SysTryCatch(NID_UI, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r));
2204 if (pControl->GetElement(L"textOfEmptyList", elementString))
2206 r = pGroupedListView->SetTextOfEmptyList(elementString);
2207 SysTryCatch(NID_UI, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r));
2210 if (pControl->GetElement(L"colorOfEmptyListText", elementString))
2212 ConvertStringToColor(elementString, color);
2213 r = pGroupedListView->SetTextColorOfEmptyList(color);
2214 SysTryCatch(NID_UI, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r));
2217 if (pControl->GetElement(L"bitmapPathOfEmptyList", elementString))
2219 Bitmap* pBackgroundBitmap = null;
2220 pBackgroundBitmap = LoadBitmapN(elementString); //__image->DecodeN(path,BITMAP_PIXEL_FORMAT_RGB565);
2221 if (pBackgroundBitmap != null)
2223 r = pGroupedListView->SetBitmapOfEmptyList(pBackgroundBitmap);
2224 delete pBackgroundBitmap;
2225 pBackgroundBitmap = null;
2227 SysTryCatch(NID_UI, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r));
2231 if (pControl->GetElement(L"backgroundColorOpacity", elementString) || pControl->GetElement(L"BGColorOpacity", elementString))
2233 Base::Integer::Parse(elementString, opacity);
2236 if (pControl->GetElement(L"backgroundColor", elementString) || pControl->GetElement(L"BGColor", elementString))
2238 ConvertStringToColor32(elementString, opacity, color);
2239 r = pGroupedListView->SetBackgroundColor(color);
2240 SysTryCatch(NID_UI, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r));
2243 if (pControl->GetElement(L"itemDividerColor", elementString))
2245 ConvertStringToColor(elementString, color);
2246 r = pGroupedListView->SetItemDividerColor(color);
2247 SysTryCatch(NID_UI, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r));
2250 if (pControl->GetElement(L"sectionColor", elementString))
2252 ConvertStringToColor(elementString, color);
2253 r = pGroupedListView->SetSectionColor(color);
2254 SysTryCatch(NID_UI, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r));
2257 if (pControl->GetElement(L"sweepEnabled", elementString))
2260 if (elementString.Equals(L"true", false))
2262 sweepEnabledState = true;
2266 sweepEnabledState = false;
2269 r = pGroupedListView->SetSweepEnabled(sweepEnabledState);
2270 SysTryCatch(NID_UI, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r));
2273 // scroll Input Mode
2274 if (pControl->GetElement(L"scrollInputMode", elementString))
2276 if (elementString.Equals(L"SCROLL_INPUT_MODE_RESTRICT_TO_INITIAL_DIRECTION", false))
2278 scrollInputMode = SCROLL_INPUT_MODE_RESTRICT_TO_INITIAL_DIRECTION;
2281 pGroupedListView->SetScrollInputMode(scrollInputMode);
2284 return pGroupedListView;
2287 delete pGroupedListView;
2292 }; // _GroupedListViewMaker
2294 _GroupedListViewRegister::_GroupedListViewRegister()
2296 _UiBuilderControlTableManager* pUiBuilderControlTableManager = _UiBuilderControlTableManager::GetInstance();
2297 pUiBuilderControlTableManager->RegisterControl(L"GroupedListView", _GroupedListViewMaker::GetInstance);
2300 _GroupedListViewRegister::~_GroupedListViewRegister()
2302 _UiBuilderControlTableManager* pUiBuilderControlTableManager = _UiBuilderControlTableManager::GetInstance();
2303 pUiBuilderControlTableManager->UnregisterControl(L"GroupedListView");
2305 static _GroupedListViewRegister GroupedListViewRegisterToUIbuilder;
2306 }}} // Tizen::Ui::Controls