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 "FUiCtrl_FastScrollEvent.h"
42 #include "FUiCtrl_FastScrollEventArg.h"
43 #include "FUiCtrl_GroupedListViewImpl.h"
44 #include "FUiCtrl_GroupedListViewItemProviderAdaptor.h"
45 #include "FUiCtrl_Label.h"
46 #include "FUiCtrl_ListItemEvent.h"
47 #include "FUiCtrl_ListItemEventArg.h"
48 #include "FUiCtrl_ListViewItem.h"
49 #include "FUiCtrl_PublicLinkEvent.h"
50 #include "FUiCtrl_ScrollEvent.h"
51 #include "FUiCtrl_ScrollEventArg.h"
53 using namespace Tizen::Base;
54 using namespace Tizen::Base::Collection;
55 using namespace Tizen::Base::Runtime;
56 using namespace Tizen::Base::Utility;
57 using namespace Tizen::Graphics;
58 using namespace Tizen::Graphics::_Text;
60 namespace Tizen { namespace Ui { namespace Controls
63 class _GroupedListViewImpl::_GroupedListViewPropagatedTouchEventListener
64 : public Tizen::Ui::_IPropagatedTouchEventListener
65 , public Tizen::Ui::_ITouchLongPressGestureEventListener
69 _GroupedListViewPropagatedTouchEventListener(_GroupedListViewImpl& impl)
71 , __core(impl.GetCore())
72 , __public(impl.GetPublic())
73 , __oldPreviousPressedTime(0)
74 , __previousPressedTime(0)
75 , __currentPressedTime(0)
76 , __previousPressedPoint(0.0f, 0.0f)
77 , __currentPressedPoint(0.0f, 0.0f)
78 , __pLongPressedGesture(null)
80 __pTouchManager = _TouchManager::GetInstance();
81 SysTryReturnVoidResult(NID_UI_CTRL, (__pTouchManager != null), E_SYSTEM, "[E_SYSTEM] System error occurred.");
83 // Add _TouchLongPressGestureDetector
84 __pLongPressedGesture = new (std::nothrow) _TouchLongPressGestureDetector();
85 SysTryReturnVoidResult(NID_UI_CTRL, (__pLongPressedGesture != null), E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient.");
87 __core.AddGestureDetector(*__pLongPressedGesture);
88 result r = __pLongPressedGesture->AddGestureListener(*this);
89 SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] propagating.", GetErrorMessage(r));
92 virtual ~_GroupedListViewPropagatedTouchEventListener(void)
94 if (__pLongPressedGesture != null)
96 __pLongPressedGesture->RemoveGestureListener(*this);
97 __core.RemoveGestureDetector(*__pLongPressedGesture);
99 delete __pLongPressedGesture;
100 __pLongPressedGesture = null;
104 virtual bool OnTouchPressed(const _Control& source, const _TouchInfo& touchInfo)
106 return __impl.CallOnTouchPressed(source, touchInfo);
109 virtual bool OnTouchReleased(const _Control& source, const _TouchInfo& touchInfo)
111 return __impl.CallOnTouchReleased(source, touchInfo);
114 virtual bool OnTouchMoved(const _Control& source, const _TouchInfo& touchInfo)
116 return __impl.CallOnTouchMoved(source, touchInfo);
119 virtual bool OnTouchCanceled(const _Control& source, const _TouchInfo& touchInfo)
121 return __impl.CallOnTouchCanceled(source, touchInfo);
124 virtual _UiTouchEventDelivery OnPreviewTouchPressed(const _Control& source, const _TouchInfo& touchInfo)
126 _UiTouchEventDelivery isFiltered = _UI_TOUCH_EVENT_DELIVERY_NO;
127 IPropagatedTouchEventListener* pListener = __impl.GetPublicPropagatedTouchEventListener();
129 if (pListener != null)
131 Control& control = __impl.GetPublic();
133 TouchEventInfo publicTouchInfo;
135 _TouchEventArg* pEventArg = GetTouchEventArgN(touchInfo);
136 SysTryReturn(NID_UI, pEventArg, _UI_TOUCH_EVENT_DELIVERY_YES, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory shortage.");
138 publicTouchInfo.Construct(*pEventArg);
146 if (pListener->OnTouchPressed(control, publicTouchInfo) == true)
148 return _UI_TOUCH_EVENT_DELIVERY_NO;
152 // public TouchEventListener
153 if (ProcessTouchEventListener(touchInfo) == true)
155 return _UI_TOUCH_EVENT_DELIVERY_NO;
158 if (__core.Equals(source))
160 return _UI_TOUCH_EVENT_DELIVERY_NO;
163 isFiltered = __impl.OnPreviewTouchPressed(__impl, touchInfo);
164 if (isFiltered == _UI_TOUCH_EVENT_DELIVERY_NO)
166 return _UI_TOUCH_EVENT_DELIVERY_NO;
169 isFiltered = __core.OnPreviewTouchPressed(source, touchInfo);
174 virtual _UiTouchEventDelivery OnPreviewTouchReleased(const _Control& source, const _TouchInfo& touchInfo)
176 _UiTouchEventDelivery isFiltered = _UI_TOUCH_EVENT_DELIVERY_NO;
177 IPropagatedTouchEventListener* pListener = __impl.GetPublicPropagatedTouchEventListener();
179 if (pListener != null)
181 Control& control = __impl.GetPublic();
183 TouchEventInfo publicTouchInfo;
185 _TouchEventArg* pEventArg = GetTouchEventArgN(touchInfo);
186 SysTryReturn(NID_UI, pEventArg, _UI_TOUCH_EVENT_DELIVERY_YES, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory shortage.");
188 publicTouchInfo.Construct(*pEventArg);
196 if (pListener->OnTouchReleased(control, publicTouchInfo) == true)
198 return _UI_TOUCH_EVENT_DELIVERY_NO;
202 // public TouchEventListener
203 if (ProcessTouchEventListener(touchInfo) == true)
205 return _UI_TOUCH_EVENT_DELIVERY_NO;
208 if (__core.Equals(source))
210 return _UI_TOUCH_EVENT_DELIVERY_NO;
213 isFiltered = __impl.OnPreviewTouchReleased(__impl, touchInfo);
214 if (isFiltered == _UI_TOUCH_EVENT_DELIVERY_NO)
216 return _UI_TOUCH_EVENT_DELIVERY_NO;
219 isFiltered = __core.OnPreviewTouchReleased(source, touchInfo);
224 virtual _UiTouchEventDelivery OnPreviewTouchMoved(const _Control& source, const _TouchInfo& touchInfo)
226 _UiTouchEventDelivery isFiltered = _UI_TOUCH_EVENT_DELIVERY_NO;
227 IPropagatedTouchEventListener* pListener = __impl.GetPublicPropagatedTouchEventListener();
229 if (pListener != null)
231 Control& control = __impl.GetPublic();
233 TouchEventInfo publicTouchInfo;
235 _TouchEventArg* pEventArg = GetTouchEventArgN(touchInfo);
236 SysTryReturn(NID_UI, pEventArg, _UI_TOUCH_EVENT_DELIVERY_YES, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory shortage.");
238 publicTouchInfo.Construct(*pEventArg);
246 if (pListener->OnTouchMoved(control, publicTouchInfo) == true)
248 return _UI_TOUCH_EVENT_DELIVERY_NO;
252 // public TouchEventListener
253 if (ProcessTouchEventListener(touchInfo) == true)
255 return _UI_TOUCH_EVENT_DELIVERY_NO;
258 if (__core.Equals(source))
260 return _UI_TOUCH_EVENT_DELIVERY_NO;
263 isFiltered = __impl.OnPreviewTouchMoved(__impl, touchInfo);
264 if (isFiltered == _UI_TOUCH_EVENT_DELIVERY_NO)
266 return _UI_TOUCH_EVENT_DELIVERY_NO;
269 isFiltered = __core.OnPreviewTouchMoved(source, touchInfo);
274 virtual _UiTouchEventDelivery OnPreviewTouchCanceled(const _Control& source, const _TouchInfo& touchInfo)
276 IPropagatedTouchEventListener* pListener = __impl.GetPublicPropagatedTouchEventListener();
278 if (pListener != null)
280 Control& control = __impl.GetPublic();
282 TouchEventInfo publicTouchInfo;
284 _TouchEventArg* pEventArg = GetTouchEventArgN(touchInfo);
285 SysTryReturn(NID_UI, pEventArg, _UI_TOUCH_EVENT_DELIVERY_YES, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory shortage.");
287 publicTouchInfo.Construct(*pEventArg);
295 if (pListener->OnTouchCanceled(control, publicTouchInfo) == true)
297 return _UI_TOUCH_EVENT_DELIVERY_NO;
301 // public TouchEventListener
302 if (ProcessTouchEventListener(touchInfo) == true)
304 return _UI_TOUCH_EVENT_DELIVERY_NO;
307 return _UI_TOUCH_EVENT_DELIVERY_YES;
310 virtual void OnTouchPressHandled(const _Control& source)
312 __impl.OnTouchPressHandled(source);
315 virtual void OnTouchReleaseHandled(const _Control& source)
317 __impl.OnTouchReleaseHandled(source);
320 virtual void OnTouchMoveHandled(const _Control& source)
322 __impl.OnTouchMoveHandled(source);
325 virtual void OnTouchCancelHandled(const _Control& source)
327 __impl.OnTouchCancelHandled(source);
330 bool OnLongPressGestureDetected(_TouchLongPressGestureDetector& gesture)
332 bool filtered = ProcessTouchEventListener();
336 __impl.FireListViewItemLongPressedEvent();
342 bool OnLongPressGestureCanceled(_TouchLongPressGestureDetector& gesture)
349 bool ProcessTouchEventListener(const _TouchInfo& touchInfo)
351 bool filtered = false;
353 if (touchInfo.GetTouchStatus() == _TOUCH_PRESSED)
355 filtered = ProcessTouchDoublePressed(touchInfo);
360 ProcessTouchEvent(touchInfo);
363 filtered = __impl.IsInputEventConsumed();
367 __impl.ResetInputEventConsumed();
373 bool ProcessTouchEventListener(void)
375 // for TouchLongPressed
376 _TouchInfo touchInfo(0, _TOUCH_LONG_PRESSED, __currentPressedPoint, false, 0);
378 return ProcessTouchEventListener(touchInfo);
381 void ProcessTouchEvent(const _TouchInfo& touchInfo)
383 TouchEventInfo publicTouchInfo;
385 _TouchEventArg* pEventArg = GetTouchEventArgN(touchInfo);
386 SysTryReturnVoidResult(NID_UI, pEventArg, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient.");
388 publicTouchInfo.Construct(*pEventArg);
390 _Control* pDraggedControl = __pTouchManager->GetTouchControlSource();
392 IEnumeratorT<IEventListener*>* pEnumerator = __impl.GetTouchEventListener()->GetEnumeratorN();
395 while (pEnumerator->MoveNext() == E_SUCCESS)
397 IEventListener* pListener = null;
398 pEnumerator->GetCurrent(pListener);
400 ITouchEventListener* pTouchEventListener = dynamic_cast <ITouchEventListener*>(pListener);
401 if (pTouchEventListener != null)
403 FirePublicListener(*pTouchEventListener, publicTouchInfo);
405 if (touchInfo.GetTouchStatus() == _TOUCH_RELEASED)
407 if (pDraggedControl == null) //if exist dragged control, don't send focus event
409 FireFocusListener(*pTouchEventListener, publicTouchInfo);
412 else if (touchInfo.GetTouchStatus() == _TOUCH_MOVED)
414 FireFocusListener(*pTouchEventListener, publicTouchInfo);
425 bool ProcessTouchDoublePressed(const _TouchInfo& touchinfo)
427 if (__pTouchManager->GetPointCount() == 1)
429 __oldPreviousPressedTime = __previousPressedTime;
430 __previousPressedTime = __currentPressedTime;
431 __currentPressedTime = touchinfo.GetTimeStamp();
432 __previousPressedPoint.x = __currentPressedPoint.x;
433 __previousPressedPoint.y = __currentPressedPoint.y;
434 __currentPressedPoint.x = touchinfo.GetCurrentPosition().x;
435 __currentPressedPoint.y = touchinfo.GetCurrentPosition().y;
437 if (Math::Abs(__previousPressedTime - __currentPressedTime) < DOUBLE_PRESS_TIME)
439 if (Math::Abs(__previousPressedTime - __oldPreviousPressedTime) > DOUBLE_PRESS_TIME)
441 if ((Math::Abs(__previousPressedPoint.x - __currentPressedPoint.x) < DOUBLE_PRESS_MOVE_ALLOWANCE)
442 && (Math::Abs(__previousPressedPoint.y - __currentPressedPoint.y) < DOUBLE_PRESS_MOVE_ALLOWANCE))
444 _TouchInfo touchInfo(0, _TOUCH_DOUBLE_PRESSED, __currentPressedPoint, false, 0);
445 ProcessTouchEvent(touchInfo);
456 void FirePublicListener(ITouchEventListener& listener, const TouchEventInfo& touchEventInfo)
458 switch (touchEventInfo.GetTouchStatus())
461 listener.OnTouchPressed(__public, touchEventInfo.GetCurrentPosition(), touchEventInfo);
463 case TOUCH_LONG_PRESSED:
464 listener.OnTouchLongPressed(__public, touchEventInfo.GetCurrentPosition(), touchEventInfo);
467 listener.OnTouchReleased(__public, touchEventInfo.GetCurrentPosition(), touchEventInfo);
470 listener.OnTouchMoved(__public, touchEventInfo.GetCurrentPosition(), touchEventInfo);
472 case TOUCH_DOUBLE_PRESSED:
473 listener.OnTouchDoublePressed(__public, touchEventInfo.GetCurrentPosition(), touchEventInfo);
476 listener.OnTouchFocusIn(__public, touchEventInfo.GetCurrentPosition(), touchEventInfo);
478 case TOUCH_FOCUS_OUT:
479 listener.OnTouchFocusOut(__public, touchEventInfo.GetCurrentPosition(), touchEventInfo);
482 listener.OnTouchCanceled(__public, touchEventInfo.GetCurrentPosition(), touchEventInfo);
489 void FireFocusListener(ITouchEventListener& listener, const TouchEventInfo& touchEventInfo)
491 _ControlManager* pControlManager = _ControlManager::GetInstance();
492 SysTryReturnVoidResult(NID_UI, pControlManager, E_SYSTEM, "[E_SYSTEM] System error occurred.");
494 Point screenPoint(__pTouchManager->GetScreenPoint(touchEventInfo.GetPointId()).x,
495 __pTouchManager->GetScreenPoint(touchEventInfo.GetPointId()).y);
497 _Control* pTouchedControl = pControlManager->GetTopmostTouchedControl(screenPoint);
498 SysTryReturnVoidResult(NID_UI, pTouchedControl, E_INVALID_CONDITION, "[E_INVALID_CONDITION] pTouchedControl is null.");
500 if (__pTouchManager->GetFocusedControlSource() != pTouchedControl)
502 if (&(__core) != pTouchedControl)
504 if (__pTouchManager->GetFocusedControlSource() == &(__core))
506 listener.OnTouchFocusOut(__public, touchEventInfo.GetCurrentPosition(), touchEventInfo);
511 listener.OnTouchFocusIn(__public, touchEventInfo.GetCurrentPosition(), touchEventInfo);
514 __pTouchManager->SetFocusedControlSource(*pTouchedControl);
518 _TouchEventArg* GetTouchEventArgN(const _TouchInfo& touchInfo)
520 FloatPoint startPoint;
522 _TouchEventArg* pEventArg = new (std::nothrow) _TouchEventArg(__public, touchInfo.GetTouchStatus());
523 SysTryReturn(NID_UI, pEventArg, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient.");
525 startPoint.SetPosition(__pTouchManager->GetStartPoint(touchInfo.GetPointId()).x - __core.GetAbsoluteBoundsF().x,
526 __pTouchManager->GetStartPoint(touchInfo.GetPointId()).y - __core.GetAbsoluteBoundsF().y);
528 pEventArg->SetTouchPosition(touchInfo.GetPointId(), startPoint.x, startPoint.y,
529 touchInfo.GetCurrentPosition().x, touchInfo.GetCurrentPosition().y);
531 // need to flick distance setting
537 static const int DOUBLE_PRESS_TIME = 500;
538 static const int DOUBLE_PRESS_MOVE_ALLOWANCE = 10;
540 _GroupedListViewImpl& __impl;
543 _TouchManager* __pTouchManager;
545 unsigned int __oldPreviousPressedTime;
546 unsigned int __previousPressedTime;
547 unsigned int __currentPressedTime;
548 Tizen::Graphics::FloatPoint __previousPressedPoint;
549 Tizen::Graphics::FloatPoint __currentPressedPoint;
550 _TouchLongPressGestureDetector* __pLongPressedGesture;
553 _GroupedListViewImpl*
554 _GroupedListViewImpl::GetInstance(GroupedListView& groupedListView)
556 return static_cast <_GroupedListViewImpl*>(groupedListView._pControlImpl);
559 const _GroupedListViewImpl*
560 _GroupedListViewImpl::GetInstance(const GroupedListView& groupedListView)
562 return static_cast <const _GroupedListViewImpl*>(groupedListView._pControlImpl);
565 _GroupedListViewImpl::_GroupedListViewImpl(GroupedListView* pGroupedList, _TableView* pCore)
566 : _ControlImpl(pGroupedList, pCore)
567 , __pListItemEvent(null)
569 , __pScrollEvent(null)
570 , __pFastScrollEvent(null)
571 , __pEmptyBitmap(null)
573 , __pAccessibilityElement(null)
574 , __redrawListView(true)
575 , __isOrientationChanged(false)
576 , __needReloadItems(false)
577 , __pPropagatedTouchEventListener(null)
579 GET_COLOR_CONFIG(TABLEVIEW::EMPTY_CONTENTS_TEXT_NORMAL, __emptyTextColor);
582 _GroupedListViewImpl::~_GroupedListViewImpl()
584 delete __pListItemEvent;
585 __pListItemEvent = null;
590 delete __pScrollEvent;
591 __pScrollEvent = null;
593 delete __pFastScrollEvent;
594 __pFastScrollEvent = null;
596 if (__pEmptyBitmap != null)
598 GetCore().DetachChild(*__pEmptyBitmap);
600 delete __pEmptyBitmap;
601 __pEmptyBitmap = null;
604 if (__pEmptyText != null)
606 GetCore().DetachChild(*__pEmptyText);
612 _AccessibilityContainer* pContainer = GetCore().GetAccessibilityContainer();
614 if ((__pAccessibilityElement != null) && (pContainer != null))
616 pContainer->RemoveElement(__pAccessibilityElement);
619 delete __pPropagatedTouchEventListener;
620 __pPropagatedTouchEventListener = null;
624 _GroupedListViewImpl::GetPublicClassName(void) const
626 return "Tizen::Ui::Controls::GroupedListView";
629 const GroupedListView&
630 _GroupedListViewImpl::GetPublic(void) const
632 return static_cast <const GroupedListView&>(_ControlImpl::GetPublic());
636 _GroupedListViewImpl::GetPublic(void)
638 return static_cast <GroupedListView&>(_ControlImpl::GetPublic());
642 _GroupedListViewImpl::GetCore(void) const
644 return static_cast <const _TableView&>(_ControlImpl::GetCore());
648 _GroupedListViewImpl::GetCore(void)
650 return static_cast <_TableView&>(_ControlImpl::GetCore());
653 _GroupedListViewImpl*
654 _GroupedListViewImpl::CreateGroupedListViewImplN(GroupedListView* pControl, GroupedListViewStyle style, bool itemDivider, ListScrollStyle scrollStyle)
656 result r = E_SUCCESS;
657 TableViewScrollBarStyle scrollBarStyle;
661 case SCROLL_STYLE_FADE_OUT:
662 scrollBarStyle = TABLE_VIEW_SCROLL_BAR_STYLE_FADE_OUT;
665 case SCROLL_STYLE_FIXED:
666 scrollBarStyle = TABLE_VIEW_SCROLL_BAR_STYLE_FIXED;
669 case SCROLL_STYLE_FAST_SCROLL:
670 scrollBarStyle = TABLE_VIEW_SCROLL_BAR_STYLE_FAST_SCROLL;
673 case SCROLL_STYLE_JUMP_TO_TOP:
674 scrollBarStyle = TABLE_VIEW_SCROLL_BAR_STYLE_JUMP_TO_TOP;
677 case SCROLL_STYLE_THUMB:
678 scrollBarStyle = TABLE_VIEW_SCROLL_BAR_STYLE_THUMB;
681 case SCROLL_STYLE_FAST_SCROLL_FIXED:
682 scrollBarStyle = TABLE_VIEW_SCROLL_BAR_STYLE_FAST_SCROLL_FIXED;
686 scrollBarStyle = TABLE_VIEW_SCROLL_BAR_STYLE_NONE;
690 TableViewStyle tableViewStyle = ((style == GROUPED_LIST_VIEW_STYLE_SECTION) ? TABLE_VIEW_STYLE_SECTION : TABLE_VIEW_STYLE_GROUPED);
692 _TableView* pCore = _TableView::CreateTableViewN(tableViewStyle, itemDivider, scrollBarStyle);
693 SysTryReturn(NID_UI_CTRL, (pCore != null), null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient.");
695 _GroupedListViewImpl* pImpl = new (std::nothrow) _GroupedListViewImpl(pControl, pCore);
697 r = CheckConstruction(pCore, pImpl);
698 SysTryReturn(NID_UI_CTRL, (r == E_SUCCESS), null, r, "[%s] Propagating.", GetErrorMessage(GetLastResult()));
700 pImpl->__pPropagatedTouchEventListener = new (std::nothrow) _GroupedListViewPropagatedTouchEventListener(*pImpl);
702 if (pImpl->__pPropagatedTouchEventListener != null)
704 pCore->SetPropagatedTouchEventListener(pImpl->__pPropagatedTouchEventListener);
711 _GroupedListViewImpl::SetItemProvider(IGroupedListViewItemProvider& provider)
713 result r = E_SUCCESS;
715 _GroupedListViewItemProviderAdaptor* pProviderAdaptor =
716 static_cast <_GroupedListViewItemProviderAdaptor*>(GetCore().GetItemProviderAdaptor());
718 if (pProviderAdaptor != null)
720 IGroupedListViewItemProvider* pProvider = pProviderAdaptor->GetItemProvider();
721 if (&provider == pProvider)
727 float itemWidth = GetBoundsF().width;
729 if (GetCore().GetTableViewStyle() == TABLE_VIEW_STYLE_SECTION)
732 GET_SHAPE_CONFIG(TABLEVIEW::GROUPITEM_LEFT_MARGIN, _CONTROL_ORIENTATION_PORTRAIT, margin);
734 itemWidth -= (margin * 2.0f);
737 if (pProviderAdaptor == null)
739 pProviderAdaptor = new (std::nothrow) _GroupedListViewItemProviderAdaptor(provider);
740 SysTryReturn(NID_UI_CTRL, (pProviderAdaptor != null), E_OUT_OF_MEMORY, E_OUT_OF_MEMORY,
741 "[E_OUT_OF_MEMORY] The memory is insufficient.");
743 pProviderAdaptor->SetListViewItemEventListener(*this);
745 r = pProviderAdaptor->SetListWidth(itemWidth);
746 GetCore().SetItemProviderAdaptor(pProviderAdaptor);
750 pProviderAdaptor->SetItemProvider(provider);
751 r = pProviderAdaptor->SetListWidth(itemWidth);
756 __redrawListView = true;
758 SetLastResultReturn(r);
762 _GroupedListViewImpl::SetItemProvider(IGroupedListViewItemProviderF& provider)
764 result r = E_SUCCESS;
766 _GroupedListViewItemProviderAdaptor* pProviderAdaptor =
767 static_cast <_GroupedListViewItemProviderAdaptor*>(GetCore().GetItemProviderAdaptor());
769 if (pProviderAdaptor != null)
771 IGroupedListViewItemProviderF* pProvider = pProviderAdaptor->GetItemProviderF();
772 if (&provider == pProvider)
778 float itemWidth = GetBoundsF().width;
780 if (GetCore().GetTableViewStyle() == TABLE_VIEW_STYLE_SECTION)
783 GET_SHAPE_CONFIG(TABLEVIEW::GROUPITEM_LEFT_MARGIN, _CONTROL_ORIENTATION_PORTRAIT, margin);
785 itemWidth -= (margin * 2.0f);
788 if (pProviderAdaptor == null)
790 pProviderAdaptor = new (std::nothrow) _GroupedListViewItemProviderAdaptor(provider);
791 SysTryReturn(NID_UI_CTRL, (pProviderAdaptor != null), E_OUT_OF_MEMORY, E_OUT_OF_MEMORY,
792 "[E_OUT_OF_MEMORY] The memory is insufficient.");
794 pProviderAdaptor->SetListViewItemEventListener(*this);
796 r = pProviderAdaptor->SetListWidth(itemWidth);
797 GetCore().SetItemProviderAdaptor(pProviderAdaptor);
801 pProviderAdaptor->SetItemProvider(provider);
802 r = pProviderAdaptor->SetListWidth(itemWidth);
807 __redrawListView = true;
809 SetLastResultReturn(r);
815 _GroupedListViewImpl::AddGroupedListViewItemEventListener(IGroupedListViewItemEventListener& listener)
817 result r = E_SUCCESS;
819 if (__pListItemEvent == null)
821 __pListItemEvent = new (std::nothrow) _ListItemEvent();
822 SysTryReturnVoidResult(NID_UI_CTRL, (__pListItemEvent != null), E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient.");
824 r = __pListItemEvent->Construct(GetPublic(), CLASSNAME_GROUPEDLISTVIEW);
825 SysTryReturnVoidResult(NID_UI_CTRL, (r == E_SUCCESS), E_SYSTEM, "[E_SYSTEM] Unable to construct Item Event.");
828 __pListItemEvent->AddListener(listener);
830 r = GetCore().AddGroupedTableViewItemEventListener(*this);
836 _GroupedListViewImpl::RemoveGroupedListViewItemEventListener(IGroupedListViewItemEventListener& listener)
838 result r = E_SUCCESS;
840 if (__pListItemEvent != null)
842 r = __pListItemEvent->RemoveListener(listener);
849 _GroupedListViewImpl::AddFastScrollListener(IFastScrollListener& listener)
851 result r = E_SUCCESS;
853 if (__pFastScrollEvent == null)
855 __pFastScrollEvent = new (std::nothrow) _FastScrollEvent();
856 SysTryReturnVoidResult(NID_UI_CTRL, (__pFastScrollEvent != null), E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient.");
858 r = __pFastScrollEvent->Construct(GetPublic());
859 SysTryReturnVoidResult(NID_UI_CTRL, (r == E_SUCCESS), E_SYSTEM, "[E_SYSTEM] Unable to construct FastScroll Event.");
862 __pFastScrollEvent->AddListener(listener);
864 r = GetCore().AddFastScrollListener(*this);
870 _GroupedListViewImpl::RemoveFastScrollListener(IFastScrollListener& listener)
872 result r = E_SUCCESS;
874 if (__pFastScrollEvent != null)
876 r = __pFastScrollEvent->RemoveListener(listener);
883 _GroupedListViewImpl::AddScrollEventListener(IScrollEventListener& listener)
885 result r = E_SUCCESS;
887 if (__pScrollEvent == null)
889 __pScrollEvent = new (std::nothrow) _ScrollEvent();
890 SysTryReturnVoidResult(NID_UI_CTRL, (__pScrollEvent != null), E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient.");
892 r = __pScrollEvent->Construct(GetPublic());
893 SysTryReturnVoidResult(NID_UI_CTRL, (r == E_SUCCESS), E_SYSTEM, "[E_SYSTEM] Unable to construct Scroll Event.");
896 __pScrollEvent->AddListener(listener);
898 GetCore().AddScrollEventListener(*this);
904 _GroupedListViewImpl::AddScrollEventListener(IScrollEventListenerF& listener)
906 result r = E_SUCCESS;
908 if (__pScrollEvent == null)
910 __pScrollEvent = new (std::nothrow) _ScrollEvent();
911 SysTryReturnVoidResult(NID_UI_CTRL, (__pScrollEvent != null), E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient.");
913 r = __pScrollEvent->Construct(GetPublic());
914 SysTryReturnVoidResult(NID_UI_CTRL, (r == E_SUCCESS), E_SYSTEM, "[E_SYSTEM] Unable to construct Scroll Event.");
917 __pScrollEvent->AddListener(listener);
919 GetCore().AddScrollEventListener(*this);
925 _GroupedListViewImpl::RemoveScrollEventListener(IScrollEventListener& listener)
927 result r = E_SUCCESS;
929 if (__pScrollEvent != null)
931 r = __pScrollEvent->RemoveListener(listener);
938 _GroupedListViewImpl::RemoveScrollEventListener(IScrollEventListenerF& listener)
940 result r = E_SUCCESS;
942 if (__pScrollEvent != null)
944 r = __pScrollEvent->RemoveListener(listener);
951 _GroupedListViewImpl::AddUiLinkEventListener(const IUiLinkEventListener& listener)
953 result r = E_SUCCESS;
955 if (__pLinkEvent == null)
957 __pLinkEvent = _PublicLinkEvent::CreateInstanceN(GetPublic());
958 SysTryReturnVoidResult(NID_UI, (__pLinkEvent != null), E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient.");
961 r = __pLinkEvent->AddListener(listener);
967 _GroupedListViewImpl::RemoveUiLinkEventListener(const IUiLinkEventListener& listener)
969 result r = E_SUCCESS;
971 if (__pLinkEvent != null)
973 r = __pLinkEvent->RemoveListener(listener);
980 _GroupedListViewImpl::SetSweepEnabled(bool enable)
982 GetCore().SetSweepEnabled(enable);
984 SetLastResultReturn(E_SUCCESS);
988 _GroupedListViewImpl::SetFastScrollIndex(const String& text, bool useSearchIcon)
990 result r = GetCore().SetFastScrollIndex(text, useSearchIcon);
991 SysTryReturn(NID_UI_CTRL, (r == E_SUCCESS) || (r == E_SYSTEM), E_INVALID_STATE, E_INVALID_STATE,
992 "[E_INVALID_STATE] This instance is in an invalid state.");
994 SetLastResultReturn(r);
998 _GroupedListViewImpl::GetTopDrawnItemIndex(int& groupIndex, int& itemIndex) const
1000 return GetCore().GetTopDrawnItemIndex(groupIndex, itemIndex);
1004 _GroupedListViewImpl::GetBottomDrawnItemIndex(int& groupIndex, int& itemIndex) const
1006 return GetCore().GetBottomDrawnItemIndex(groupIndex, itemIndex);
1010 _GroupedListViewImpl::ScrollToItem(int groupIndex, int itemIndex, ListScrollItemAlignment itemAlignment)
1012 result r = E_SUCCESS;
1014 if (itemAlignment == LIST_SCROLL_ITEM_ALIGNMENT_TOP)
1016 r = GetCore().SetTopDrawnItemIndex(groupIndex, itemIndex);
1018 else if (itemAlignment == LIST_SCROLL_ITEM_ALIGNMENT_BOTTOM)
1020 r = GetCore().SetBottomDrawnItemIndex(groupIndex, itemIndex);
1024 SysTryReturn(NID_UI_CTRL, false, E_OUT_OF_RANGE, E_OUT_OF_RANGE,
1025 "[E_OUT_OF_RANGE] The specified itemAlignment is out of range.");
1028 SetLastResultReturn(r);
1032 _GroupedListViewImpl::SetItemChecked(int groupIndex, int itemIndex, bool check)
1034 return GetCore().SetItemChecked(groupIndex, itemIndex, check);
1038 _GroupedListViewImpl::IsItemChecked(int groupIndex, int itemIndex) const
1040 return GetCore().IsItemChecked(groupIndex, itemIndex);
1044 _GroupedListViewImpl::SetItemEnabled(int groupIndex, int itemIndex, bool enable)
1046 return GetCore().SetItemEnabled(groupIndex, itemIndex, enable);
1050 _GroupedListViewImpl::IsItemEnabled(int groupIndex, int itemIndex) const
1052 return GetCore().IsItemEnabled(groupIndex, itemIndex);
1056 _GroupedListViewImpl::GetGroupCount(void) const
1058 return GetCore().GetGroupCount();
1062 _GroupedListViewImpl::GetItemCountAt(int groupIndex) const
1064 return GetCore().GetItemCountAt(groupIndex);
1068 _GroupedListViewImpl::ShowItemDescriptionText(int groupIndex, int itemIndex)
1070 return SetItemDescriptionTextShowState(groupIndex, itemIndex, true);
1074 _GroupedListViewImpl::HideItemDescriptionText(int groupIndex, int itemIndex)
1076 return SetItemDescriptionTextShowState(groupIndex, itemIndex, false);
1080 _GroupedListViewImpl::SetItemDescriptionTextShowState(int groupIndex, int itemIndex, bool show)
1082 result r = E_SUCCESS;
1084 SysTryReturn(NID_UI_CTRL, (groupIndex >= 0) && (groupIndex < GetGroupCount()), E_OUT_OF_RANGE, E_OUT_OF_RANGE,
1085 "[E_OUT_OF_RANGE] The specified groupIndex is out of range.");
1087 SysTryReturn(NID_UI_CTRL, (itemIndex >= 0) && (itemIndex < GetItemCountAt(groupIndex)), E_OUT_OF_RANGE, E_OUT_OF_RANGE,
1088 "[E_OUT_OF_RANGE] The specified itemIndex is out of range.");
1090 _GroupedListViewItemProviderAdaptor* pProviderAdaptor =
1091 static_cast <_GroupedListViewItemProviderAdaptor*>(GetCore().GetItemProviderAdaptor());
1092 SysTryReturn(NID_UI_CTRL, (pProviderAdaptor != null), E_SYSTEM, E_SYSTEM, "[E_SYSTEM] _GroupedListItemProviderAdaptor is not set.");
1094 // Save description text show state to provider adaptor
1095 pProviderAdaptor->SetDescriptionTextShowState(groupIndex, itemIndex, show);
1097 if (GetCore().FindItem(groupIndex, itemIndex) != null)
1099 r = GetCore().RefreshTableView(groupIndex, itemIndex, TABLE_VIEW_REFRESH_TYPE_ITEM_MODIFY);
1102 SetLastResultReturn(r);
1106 _GroupedListViewImpl::RefreshList(int groupIndex, int itemIndex, ListRefreshType type)
1108 result r = E_SUCCESS;
1110 if (__needReloadItems)
1115 int groupCount = GetCore().GetGroupCount();
1116 int itemCount = GetCore().GetItemCountAt(groupIndex);
1118 if ((groupIndex < 0) || (groupIndex > groupCount) || (itemIndex < -1) || (itemIndex > itemCount) ||
1119 ((type != LIST_REFRESH_TYPE_ITEM_ADD) && (itemIndex == itemCount)))
1121 SysLogException(NID_UI_CTRL, E_OUT_OF_RANGE, "[E_OUT_OF_RANGE] The index is out of range.");
1122 return E_OUT_OF_RANGE;
1125 if (type == LIST_REFRESH_TYPE_ITEM_MODIFY)
1127 if (IsContextItemOpened(groupIndex, itemIndex))
1129 CloseContextItem(groupIndex, itemIndex);
1132 int topGroupIndex = -1;
1133 int topItemIndex = -1;
1134 int bottomGroupIndex = -1;
1135 int bottomItemIndex = -1;
1137 GetCore().GetFirstLoadedItemIndex(topGroupIndex, topItemIndex);
1138 GetCore().GetLastLoadedItemIndex(bottomGroupIndex, bottomItemIndex);
1140 if ((topGroupIndex > groupIndex) || (bottomGroupIndex < groupIndex) ||
1141 ((topGroupIndex == groupIndex) && (topItemIndex > itemIndex)) ||
1142 ((bottomGroupIndex == groupIndex) && (bottomItemIndex < itemIndex)))
1144 // not yet loaded item
1145 SetLastResultReturn(r);
1149 _ListViewItem* pListViewItem = static_cast<_ListViewItem*>(GetCore().FindItem(groupIndex, itemIndex));
1150 _ListViewItemStatus itemStatus;
1151 memset(&itemStatus, 0, sizeof(_ListViewItemStatus));
1152 bool needChangeEventTarget = false;
1154 if (pListViewItem != null && pListViewItem->IsItemSelected())
1156 needChangeEventTarget = true;
1159 if (needChangeEventTarget && (pListViewItem != null))
1161 pListViewItem->GetCurrentStatus(itemStatus);
1162 pListViewItem = null;
1166 GetCore().UnloadItem(groupIndex, itemIndex);
1168 pListViewItem = static_cast<_ListViewItem*>(GetCore().LoadItem(groupIndex, itemIndex));
1170 if (needChangeEventTarget && (pListViewItem != null))
1172 pListViewItem->SetCurrentStatus(itemStatus);
1174 _Control* pTarget = static_cast<_Control*>(pListViewItem);
1176 for (int i = 0; i < pListViewItem->GetChildCount(); i++)
1178 if (pListViewItem->GetChild(i)->GetBoundsF().Contains(itemStatus.currentTouchPosition))
1180 pTarget = pListViewItem->GetChild(i);
1184 // change touch event target
1185 pTarget->SetChangingEventTarget(true);
1186 _TouchManager::GetInstance()->SetChangedTouchableTarget(pTarget);
1192 r = GetCore().RefreshTableView(groupIndex, itemIndex, static_cast<TableViewRefreshType>(type));
1195 CheckEmptyListShowState();
1200 SetLastResultReturn(r);
1204 _GroupedListViewImpl::RefreshList(int groupIndex, int itemIndex, int elementId)
1206 if ((groupIndex < 0) || (groupIndex >= GetCore().GetGroupCount()) || (itemIndex < 0) || (itemIndex >= GetCore().GetItemCountAt(groupIndex)))
1208 return E_OUT_OF_RANGE;
1211 result r = E_SUCCESS;
1212 _ListViewItem* pListViewItem = static_cast<_ListViewItem*>(GetCore().FindItem(groupIndex, itemIndex));
1214 if (pListViewItem != null)
1216 r = (pListViewItem->RefreshElement(elementId)) ? E_SUCCESS : E_OUT_OF_RANGE;
1219 SetLastResultReturn(r);
1223 _GroupedListViewImpl::UpdateList(void)
1225 __needReloadItems = true;
1227 result r = GetCore().UpdateTableView();
1229 CheckEmptyListShowState();
1233 // API versioning for initial Show() operation
1234 if (Tizen::App::_AppInfo::GetApiVersion() == _API_VERSION_2_0 && Tizen::App::_AppInfo::IsOspCompat())
1239 __needReloadItems = false;
1241 SetLastResultReturn(r);
1245 _GroupedListViewImpl::SetItemNeedsLazyDeletion(_ListViewItem* pItem)
1247 _GroupedListViewItemProviderAdaptor* pProviderAdaptor =
1248 static_cast <_GroupedListViewItemProviderAdaptor*>(GetCore().GetItemProviderAdaptor());
1250 if (pProviderAdaptor != null)
1252 pProviderAdaptor->SetItemNeedsLazyDeletion(pItem);
1257 _GroupedListViewImpl::GetItemIndexFromPosition(const FloatPoint& position, int& groupIndex, int& itemIndex) const
1259 result r = GetCore().GetItemIndexFromPosition(position, groupIndex, itemIndex);
1261 SysTryReturn(NID_UI_CTRL, (r == E_SUCCESS), E_SYSTEM, E_SYSTEM, "[E_SYSTEM] There is no item at the specified position.");
1263 SetLastResultReturn(r);
1267 _GroupedListViewImpl::GetItemIndexFromPosition(const FloatPoint& position, int& groupIndex, int& itemIndex, int& elementId) const
1271 result r = GetCore().GetItemIndexFromPosition(position, groupIndex, itemIndex);
1272 SysTryReturn(NID_UI_CTRL, (r == E_SUCCESS), E_SYSTEM, E_SYSTEM, "[E_SYSTEM] There is no item at the specified position.");
1274 _ListViewItem* pListViewItem = static_cast<_ListViewItem*>(GetCore().FindItem(groupIndex, itemIndex));
1276 if (pListViewItem != null)
1278 FloatPoint originPosition = pListViewItem->GetPositionF();
1279 originPosition.y -= GetCore().GetScrollPosition();
1281 elementId = pListViewItem->GetElementIdFromPosition(FloatPoint(position.x - originPosition.x, position.y - originPosition.y));
1284 SetLastResultReturn(r);
1288 _GroupedListViewImpl::SetSectionColor(const Color& color)
1290 return GetCore().SetSectionColor(color);
1294 _GroupedListViewImpl::GetSectionColor(void) const
1296 return GetCore().GetSectionColor();
1300 _GroupedListViewImpl::SetItemDividerColor(const Color& color)
1302 return GetCore().SetItemDividerColor(color);
1306 _GroupedListViewImpl::GetItemDividerColor(void) const
1308 return GetCore().GetItemDividerColor();
1312 _GroupedListViewImpl::SetListBackgroundColor(const Color& color)
1314 SetBackgroundColor(color);
1318 _GroupedListViewImpl::SetBackgroundBitmap(const Bitmap* pBitmap)
1320 GetCore().SetBackgroundBitmap(const_cast<Bitmap*>(pBitmap));
1321 GetCore().SetBackgroundBitmapStretch(true);
1323 SetLastResultReturn(E_SUCCESS);
1327 _GroupedListViewImpl::SetBitmapOfEmptyList(const Bitmap* pBitmap)
1329 if (pBitmap == null)
1331 if (__pEmptyBitmap != null)
1333 GetCore().DetachChild(*__pEmptyBitmap);
1335 delete __pEmptyBitmap;
1336 __pEmptyBitmap = null;
1341 if (__pEmptyBitmap == null)
1343 __pEmptyBitmap = _Label::CreateLabelN();
1344 SysTryReturn(NID_UI_CTRL, (__pEmptyBitmap != null), E_SYSTEM, E_SYSTEM, "[%s] Propagating.", GetErrorMessage(GetLastResult()));
1346 __pEmptyBitmap->SetVisibleState(false);
1347 __pEmptyBitmap->SetMargin(0.0f, 0.0f);
1349 GetCore().AttachChild(*__pEmptyBitmap);
1352 __pEmptyBitmap->SetSize(FloatDimension(pBitmap->GetWidthF(), pBitmap->GetHeightF()));
1353 __pEmptyBitmap->SetBackgroundColor(Color(0, 0, 0, 0));
1354 __pEmptyBitmap->SetBackgroundBitmap(*pBitmap);
1357 AdjustLayoutOfEmptyList();
1359 SetLastResultReturn(E_SUCCESS);
1363 _GroupedListViewImpl::SetTextOfEmptyList(const String& text)
1367 if (__pEmptyText != null)
1369 GetCore().DetachChild(*__pEmptyText);
1371 delete __pEmptyText;
1372 __pEmptyText = null;
1377 if (__pEmptyText == null)
1379 __pEmptyText = _Label::CreateLabelN();
1380 SysTryReturn(NID_UI_CTRL, (__pEmptyText != null), E_SYSTEM, E_SYSTEM, "[%s] Propagating.", GetErrorMessage(GetLastResult()));
1382 __pEmptyText->SetVisibleState(false);
1383 __pEmptyText->SetMargin(0.0f, 0.0f);
1385 GetCore().AttachChild(*__pEmptyText);
1388 TextObject* pText = new (std::nothrow) TextObject;
1389 SysTryReturn(NID_UI_CTRL, (pText != null), E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[%s] Propagating.", GetErrorMessage(GetLastResult()));
1393 TextSimple* pSimpleText = new (std::nothrow) TextSimple(const_cast <wchar_t*>(text.GetPointer()), text.GetLength());
1394 SysTryReturn(NID_UI_CTRL, (pSimpleText != null), E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[%s] Propagating.", GetErrorMessage(GetLastResult()));
1395 pText->AppendElement(*pSimpleText);
1397 float fontSize = 0.0f;
1398 GET_SHAPE_CONFIG(LISTVIEW::EMPTY_LIST_TEXT_HEIGHT, _CONTROL_ORIENTATION_PORTRAIT, fontSize);
1401 font.Construct(GetFont(), FONT_STYLE_PLAIN, fontSize);
1402 pText->SetFont(&font, 0, pText->GetTextLength());
1404 FloatDimension listDimension = GetCore().GetSizeF();
1406 pText->SetBounds(FloatRectangle(0.0f, 0.0f, listDimension.width, 1.0f));
1409 FloatDimension labelDimension = pText->GetTextExtentF(0, pText->GetTextLength());
1410 labelDimension.height = pText->GetTotalHeightF();
1412 if (labelDimension.width > listDimension.width)
1414 pText->SetBounds(FloatRectangle(0.0f, 0.0f, listDimension.width, 1.0f));
1417 float labelHeight = pText->GetTotalHeightF();
1419 labelDimension.width = listDimension.width;
1420 labelDimension.height = ((listDimension.height < labelHeight) ? listDimension.height : labelHeight);
1425 __pEmptyText->SetSize(labelDimension);
1426 __pEmptyText->SetBackgroundColor(Color(0, 0, 0, 0));
1427 __pEmptyText->SetMargin(0.0f, 0.0f, 0.0f, 0.0f);
1428 __pEmptyText->SetTextColor(__emptyTextColor);
1429 __pEmptyText->SetTextConfig(fontSize, LABEL_TEXT_STYLE_NORMAL);
1430 __pEmptyText->SetText(text);
1433 AdjustLayoutOfEmptyList();
1435 SetLastResultReturn(E_SUCCESS);
1439 _GroupedListViewImpl::GetTextOfEmptyList(void) const
1441 return ((__pEmptyText != null) ? __pEmptyText->GetText() : String());
1445 _GroupedListViewImpl::SetTextColorOfEmptyList(const Color& color)
1447 __emptyTextColor = color;
1449 if (__pEmptyText != null)
1451 __pEmptyText->SetTextColor(color);
1454 SetLastResultReturn(E_SUCCESS);
1458 _GroupedListViewImpl::GetTextColorOfEmptyList(void) const
1460 return __emptyTextColor;
1464 _GroupedListViewImpl::ExpandGroup(int groupIndex)
1466 SysTryReturn(NID_UI_CTRL, (GetCore().GetTableViewStyle() == TABLE_VIEW_STYLE_GROUPED), E_INVALID_OPERATION, E_INVALID_OPERATION,
1467 "[E_INVALID_OPERATION] The control should be indexed style.");
1469 return GetCore().ExpandGroup(groupIndex);
1473 _GroupedListViewImpl::CollapseGroup(int groupIndex)
1475 SysTryReturn(NID_UI_CTRL, (GetCore().GetTableViewStyle() == TABLE_VIEW_STYLE_GROUPED), E_INVALID_OPERATION, E_INVALID_OPERATION,
1476 "[E_INVALID_OPERATION] The control should be indexed style.");
1478 return GetCore().CollapseGroup(groupIndex);
1482 _GroupedListViewImpl::IsGroupExpanded(int groupIndex) const
1484 return GetCore().IsGroupExpanded(groupIndex);
1488 _GroupedListViewImpl::ExpandAllGroups(void)
1490 SysTryReturn(NID_UI_CTRL, (GetCore().GetTableViewStyle() == TABLE_VIEW_STYLE_GROUPED), E_INVALID_OPERATION, E_INVALID_OPERATION,
1491 "[E_INVALID_OPERATION] The control should be indexed style.");
1493 return GetCore().ExpandAllGroup(true);
1497 _GroupedListViewImpl::CollapseAllGroups(void)
1499 SysTryReturn(NID_UI_CTRL, (GetCore().GetTableViewStyle() == TABLE_VIEW_STYLE_GROUPED), E_INVALID_OPERATION, E_INVALID_OPERATION,
1500 "[E_INVALID_OPERATION] The control should be indexed style.");
1502 return GetCore().CollapseAllGroup(true);
1506 _GroupedListViewImpl::CheckEmptyListShowState(void)
1508 bool isEmpty = (GetGroupCount() == 0);
1510 if (__pEmptyBitmap != null)
1512 __pEmptyBitmap->SetVisibleState(isEmpty);
1514 if (__pEmptyText != null)
1516 __pEmptyText->SetVisibleState(isEmpty);
1519 _AccessibilityContainer* pContainer = GetCore().GetAccessibilityContainer();
1521 if (_AccessibilityManager::IsActivated() && (pContainer != null))
1525 if (__pAccessibilityElement == null)
1527 __pAccessibilityElement = new (std::nothrow) _AccessibilityElement(true);
1529 SysTryReturnVoidResult(NID_UI_CTRL, (__pAccessibilityElement != null), E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient.");
1531 __pAccessibilityElement->SetName(L"ListView");
1533 pContainer->RemoveAllElement();
1534 pContainer->AddElement(*__pAccessibilityElement);
1537 Rectangle bounds = GetBounds();
1538 __pAccessibilityElement->SetBounds(Rectangle(0, 0, bounds.width, bounds.height));
1540 String accessibilityLable;
1542 if (__pEmptyBitmap != null)
1544 __pEmptyBitmap->GetAccessibilityContainer()->Activate(false);
1546 accessibilityLable += L"Image, ";
1548 if (__pEmptyText != null)
1550 __pEmptyText->GetAccessibilityContainer()->Activate(false);
1552 accessibilityLable += __pEmptyText->GetText();
1553 accessibilityLable += L", ";
1556 accessibilityLable += L"No items";
1558 __pAccessibilityElement->SetLabel(accessibilityLable);
1562 if (__pAccessibilityElement != null)
1564 if (pContainer->RemoveElement(*__pAccessibilityElement) != E_SUCCESS)
1566 delete __pAccessibilityElement;
1568 __pAccessibilityElement = null;
1575 _GroupedListViewImpl::AdjustLayoutOfEmptyList(void)
1577 FloatDimension listDimension = GetCore().GetSizeF();
1578 FloatDimension emptyBitmap;
1579 FloatDimension emptyText;
1580 FloatPoint bitmapPos;
1582 float totalHeight = 0.0f;
1583 float horizontalSpacing = 0.0f;
1585 if (__pEmptyBitmap != null)
1587 emptyBitmap = __pEmptyBitmap->GetSizeF();
1589 if (__pEmptyText != null)
1591 emptyText = __pEmptyText->GetSizeF();
1593 if (__pEmptyBitmap != null)
1595 GET_SHAPE_CONFIG(LISTVIEW::EMPTY_LIST_HORIZONTAL_SPACING, _CONTROL_ORIENTATION_PORTRAIT, horizontalSpacing);
1599 totalHeight = emptyBitmap.height + horizontalSpacing + emptyText.height;
1601 if ((__pEmptyBitmap != null) && (__pEmptyText != null) && (totalHeight < listDimension.height))
1603 bitmapPos.x = ((_FloatCompare(listDimension.width, emptyBitmap.width)) ? 0.0f : (listDimension.width - emptyBitmap.width) / 2.0f);
1604 bitmapPos.y = (listDimension.height - totalHeight) / 2.0f;
1606 textPos.x = ((_FloatCompare(listDimension.width, emptyText.width)) ? 0.0f : (listDimension.width - emptyText.width) / 2.0f);
1607 textPos.y = bitmapPos.y + emptyBitmap.height + horizontalSpacing;
1611 if (__pEmptyBitmap != null)
1613 bitmapPos.x = ((_FloatCompare(listDimension.width, emptyBitmap.width)) ? 0.0f : (listDimension.width - emptyBitmap.width) / 2.0f);
1614 bitmapPos.y = ((listDimension.height <= totalHeight) ? 0.0f : (listDimension.height - totalHeight) / 2.0f);
1617 if (__pEmptyText != null)
1619 textPos.x = ((_FloatCompare(listDimension.width, emptyText.width)) ? 0.0f : (listDimension.width - emptyText.width) / 2.0f);
1620 textPos.y = ((listDimension.height <= totalHeight ) ? (bitmapPos.y + emptyBitmap.height + horizontalSpacing) : (listDimension.height - totalHeight) / 2.0f);
1624 if (__pEmptyBitmap != null)
1626 __pEmptyBitmap->SetPosition(bitmapPos);
1628 if (__pEmptyText != null)
1630 __pEmptyText->SetPosition(textPos);
1633 CheckEmptyListShowState();
1638 _GroupedListViewImpl::BeginReorderingMode(void)
1640 SysTryReturn(NID_UI_CTRL, (GetCore().GetTableViewStyle() == TABLE_VIEW_STYLE_GROUPED), E_INVALID_OPERATION, E_INVALID_OPERATION,
1641 "[E_INVALID_OPERATION] Reordering mode is supported only Indexed style.");
1643 result r = GetCore().SetReorderModeEnabled(true);
1645 SetLastResultReturn(r);
1649 _GroupedListViewImpl::EndReorderingMode(void)
1651 SysTryReturn(NID_UI_CTRL, (GetCore().GetTableViewStyle() == TABLE_VIEW_STYLE_GROUPED), E_INVALID_OPERATION, E_INVALID_OPERATION,
1652 "[E_INVALID_OPERATION] Reordering mode is supported only Indexed style.");
1654 result r = GetCore().SetReorderModeEnabled(false);
1656 SetLastResultReturn(r);
1660 _GroupedListViewImpl::IsInReorderingMode(void) const
1662 return GetCore().IsReorderModeEnabled();
1666 _GroupedListViewImpl::SetScrollInputMode(ScrollInputMode mode)
1668 GetCore().SetScrollInputMode(mode);
1672 _GroupedListViewImpl::GetScrollInputMode(void) const
1674 return GetCore().GetScrollInputMode();
1678 _GroupedListViewImpl::OpenContextItem(int groupIndex, int itemIndex)
1680 return GetCore().OpenContextItem(groupIndex, itemIndex);
1684 _GroupedListViewImpl::CloseContextItem(int groupIndex, int itemIndex)
1686 return GetCore().CloseContextItem(groupIndex, itemIndex);
1690 _GroupedListViewImpl::IsContextItemOpened(int groupIndex, int itemIndex) const
1692 return GetCore().IsContextItemOpened(groupIndex, itemIndex);
1696 _GroupedListViewImpl::OnListViewContextItemStateChanged(_Control& source, int groupIndex, int itemIndex, int elementId,
1697 ListContextItemStatus status)
1699 if (__pListItemEvent != null)
1701 CloseContextItem(groupIndex, itemIndex);
1703 _ListViewItem* pListViewItem = static_cast<_ListViewItem*>(GetCore().FindItem(groupIndex, itemIndex));
1705 SetItemNeedsLazyDeletion(pListViewItem);
1707 _ListItemEventArg* pArg = new (std::nothrow) _ListItemEventArg(groupIndex, itemIndex, elementId, 0, NOTIFY_TYPE_SELCTED_CONTEXT_ITEM);
1708 __pListItemEvent->Fire(*pArg);
1710 SetItemNeedsLazyDeletion(null);
1715 _GroupedListViewImpl::OnGroupedTableViewGroupItemStateChanged(_TableView& tableView, int groupIndex, _TableViewItem* pItem,
1716 TableViewItemStatus status)
1718 FireListViewItemEvent(groupIndex, -1, pItem, status);
1722 _GroupedListViewImpl::OnGroupedTableViewItemStateChanged(_TableView& tableView, int groupIndex, int itemIndex, _TableViewItem* pItem,
1723 TableViewItemStatus status)
1725 FireListViewItemEvent(groupIndex, itemIndex, pItem, status);
1729 _GroupedListViewImpl::OnGroupedTableViewContextItemActivationStateChanged(_TableView& tableView, int groupIndex, int itemIndex,
1730 _TableViewItem* pContextItem, bool activated)
1732 _ListViewItem* pListViewItem = static_cast<_ListViewItem*>(GetCore().FindItem(groupIndex, itemIndex));
1734 if (pListViewItem != null)
1736 pListViewItem->SetContextItemActivationState(activated);
1741 _GroupedListViewImpl::OnGroupedTableViewItemReordered(_TableView& tableView, int groupIndexFrom, int itemIndexFrom,
1742 int groupIndexTo, int itemIndexTo)
1744 if (__pListItemEvent != null)
1746 _ListItemEventArg* pArg = new (std::nothrow) _ListItemEventArg(groupIndexFrom, itemIndexFrom, groupIndexTo, itemIndexTo,
1747 NOTIFY_TYPE_REORDERED_ITEM);
1748 __pListItemEvent->Fire(*pArg);
1753 _GroupedListViewImpl::OnSectionTableViewItemStateChanged(_TableView& tableView, int sectionIndex, int itemIndex, _TableViewItem* pItem,
1754 TableViewItemStatus status)
1756 FireListViewItemEvent(sectionIndex, itemIndex, pItem, status);
1760 _GroupedListViewImpl::OnSectionTableViewContextItemActivationStateChanged(_TableView& tableView, int sectionIndex, int itemIndex,
1761 _TableViewItem* pContextItem, bool activated)
1763 _ListViewItem* pListViewItem = static_cast<_ListViewItem*>(GetCore().FindItem(sectionIndex, itemIndex));
1765 if (pListViewItem != null)
1767 pListViewItem->SetContextItemActivationState(activated);
1772 _GroupedListViewImpl::OnTableViewItemSwept(_TableView& tableView, int groupIndex, int itemIndex, TableViewSweepDirection direction)
1774 if (__pListItemEvent != null)
1776 _ListViewItem* pListViewItem = static_cast<_ListViewItem*>(GetCore().FindItem(groupIndex, itemIndex));
1778 SetItemNeedsLazyDeletion(pListViewItem);
1780 _ListItemEventArg* pArg = new (std::nothrow) _ListItemEventArg(groupIndex, itemIndex, direction, 0, NOTIFY_TYPE_SWEPT_ITEM);
1781 __pListItemEvent->Fire(*pArg);
1783 SetItemNeedsLazyDeletion(null);
1788 _GroupedListViewImpl::FireListViewItemEvent(int groupIndex, int itemIndex, _TableViewItem* pItem, TableViewItemStatus status)
1790 if (__pListItemEvent != null)
1792 _ListViewItem* pListViewItem = static_cast<_ListViewItem*>(pItem);
1794 if (pListViewItem != null)
1796 SetItemNeedsLazyDeletion(pListViewItem);
1798 _ListViewItemStateChangedInfo itemInfo;
1799 pListViewItem->GetLastStateChangedInfo(itemInfo);
1801 if ((__pLinkEvent != null) && (itemInfo.pUiLinkInfo != null))
1803 IEventArg* pLinkEventArg = _PublicLinkEvent::CreateLinkEventArgN(itemInfo.pUiLinkInfo->textInfo,
1804 itemInfo.pUiLinkInfo->linkType, itemInfo.pUiLinkInfo->linkInfo);
1805 SysTryReturnVoidResult(NID_UI_CTRL, (pLinkEventArg != null), E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Unable to create _LinkEventArg.");
1806 __pLinkEvent->Fire(*pLinkEventArg);
1811 _ListItemEventArg* pArg = new (std::nothrow) _ListItemEventArg(groupIndex, itemIndex, itemInfo.elementId, 0,
1812 static_cast<NotifyType>(status));
1813 __pListItemEvent->Fire(*pArg);
1816 pListViewItem->ClearLastStateChangedInfo();
1818 SetItemNeedsLazyDeletion(null);
1824 _GroupedListViewImpl::FireListViewItemLongPressedEvent(void)
1826 if (__pListItemEvent != null)
1828 int groupIndex = -1;
1832 if ((GetItemIndexFromPosition(GetCurrentTouchPosition(), groupIndex, itemIndex, elementId) == E_SUCCESS) && (itemIndex != -1))
1834 _ListViewItem* pListViewItem = static_cast<_ListViewItem*>(GetCore().FindItem(groupIndex, itemIndex));
1836 if ((pListViewItem != null) && (!pListViewItem->IsContextItem()))
1838 SetItemNeedsLazyDeletion(pListViewItem);
1840 _ListItemEventArg* pArg = new (std::nothrow) _ListItemEventArg(groupIndex, itemIndex, elementId, 0, NOTIFY_TYPE_LONG_PRESSED_ITEM);
1841 __pListItemEvent->Fire(*pArg);
1843 SetItemNeedsLazyDeletion(null);
1850 _GroupedListViewImpl::OnScrollEndReached(_Control& source, ScrollEndEvent type)
1852 if (__pScrollEvent != null)
1854 _ScrollEventArg* pEventArg = _ScrollEventArg::GetScrollEventArgN(GetPublic(), type);
1855 result r = GetLastResult();
1856 SysTryReturnVoidResult(NID_UI_CTRL, (r == E_SUCCESS), r, "[%s] Propagating.", GetErrorMessage(r));
1858 __pScrollEvent->Fire(*pEventArg);
1863 _GroupedListViewImpl::OnScrollPositionChanged(_Control& source, float scrollPosition)
1865 if (__pScrollEvent != null)
1867 _ScrollEventArg* pEventArg = _ScrollEventArg::GetScrollEventArgN(GetPublic(), scrollPosition);
1868 result r = GetLastResult();
1869 SysTryReturnVoidResult(NID_UI_CTRL, (pEventArg != null), r, "[%s] Propagating.", GetErrorMessage(r));
1871 __pScrollEvent->Fire(*pEventArg);
1876 _GroupedListViewImpl::OnScrollStopped(_Control& source)
1878 if (__pScrollEvent != null)
1880 _ScrollEventArg* pEventArg = _ScrollEventArg::GetScrollEventArgN(GetPublic());
1881 result r = GetLastResult();
1882 SysTryReturnVoidResult(NID_UI_CTRL, (r == E_SUCCESS), r, "[%s] Propagating.", GetErrorMessage(r));
1884 __pScrollEvent->Fire(*pEventArg);
1889 _GroupedListViewImpl::OnUiFastScrollIndexSelected(_Control& source, _FastScrollIndex& index)
1891 if (__pFastScrollEvent != null)
1893 String* pIndexText = index.GetIndexText();
1894 if (pIndexText != null)
1896 _FastScrollEventArg* pEventArg = new (std::nothrow) _FastScrollEventArg(GetPublic(), *pIndexText);
1897 __pFastScrollEvent->Fire(*pEventArg);
1903 _GroupedListViewImpl::OnDraw(void)
1905 _ControlImpl::OnDraw();
1907 if (__redrawListView)
1909 CheckEmptyListShowState();
1910 __redrawListView = false;
1915 _GroupedListViewImpl::OnChangeLayout(_ControlOrientation orientation)
1917 __isOrientationChanged = true;
1919 _ControlImpl::OnChangeLayout(orientation);
1923 _GroupedListViewImpl::OnBoundsChanged(void)
1925 _ControlImpl::OnBoundsChanged();
1927 if (__pEmptyBitmap != null)
1929 SetBitmapOfEmptyList(__pEmptyBitmap->GetBackgroundBitmap());
1931 if (__pEmptyText != null)
1933 SetTextOfEmptyList(__pEmptyText->GetText());
1936 if (__isOrientationChanged)
1938 __isOrientationChanged = false;
1944 _GroupedListViewImpl::OnFontChanged(Font* pFont)
1946 String fontName = GetFont();
1947 _GroupedListViewItemProviderAdaptor* pProviderAdaptor =
1948 static_cast <_GroupedListViewItemProviderAdaptor*>(GetCore().GetItemProviderAdaptor());
1950 if (__pEmptyText != null)
1952 __pEmptyText->SetFont(fontName);
1953 SetTextOfEmptyList(__pEmptyText->GetText());
1956 if (pProviderAdaptor != null)
1958 pProviderAdaptor->SetItemFont(fontName);
1961 int firstGroup = -1;
1965 int currentItem = -1;
1966 int lastItemInGroup = -1;
1968 GetCore().GetFirstLoadedItemIndex(firstGroup, firstItem);
1969 GetCore().GetLastLoadedItemIndex(lastGroup, lastItem);
1971 for (int i = firstGroup; i <= lastGroup; i++)
1973 currentItem = ((i == firstGroup) ? firstItem : -1);
1974 lastItemInGroup = ((i == lastGroup) ? lastItem : (GetCore().GetItemCountAt(i) - 1));
1976 for (; currentItem <= lastItemInGroup; currentItem++)
1978 _ListViewItem* pListViewItem = static_cast<_ListViewItem*>(GetCore().FindItem(i, currentItem));
1980 if (pListViewItem != null)
1982 pListViewItem->SetFont(fontName);
1989 _GroupedListViewImpl::OnFontInfoRequested(unsigned long& style, int& size)
1991 float textSize = 0.0f;
1992 OnFontInfoRequested(style, textSize);
1994 size = _CoordinateSystemUtils::ConvertToInteger(textSize);
1998 _GroupedListViewImpl::OnFontInfoRequested(unsigned long& style, float& size)
2000 GET_SHAPE_CONFIG(LISTVIEW::EMPTY_LIST_TEXT_HEIGHT, _CONTROL_ORIENTATION_PORTRAIT, size);
2001 style = FONT_STYLE_PLAIN;
2005 _GroupedListViewImpl::GetCurrentTouchPosition(void)
2007 FloatPoint currentTouchPos = _TouchManager::GetInstance()->GetScreenPoint(0);
2008 FloatRectangle bounds = GetCore().GetAbsoluteBoundsF();
2010 currentTouchPos.x -= bounds.x;
2011 currentTouchPos.y -= bounds.y;
2013 return currentTouchPos;
2017 _GroupedListViewImpl::OnTouchEventListenerAdded(void)
2023 _GroupedListViewImpl::OnTouchEventListenerRemoved(void)
2028 class _GroupedListViewMaker
2029 : public _UiBuilderControlMaker
2032 _GroupedListViewMaker(_UiBuilder* uibuilder)
2033 : _UiBuilderControlMaker(uibuilder){};
2035 virtual ~_GroupedListViewMaker(){};
2037 static _UiBuilderControlMaker*
2038 GetInstance(_UiBuilder* uibuilder)
2040 _GroupedListViewMaker* pGroupedListViewMaker = new (std::nothrow) _GroupedListViewMaker(uibuilder);
2041 return pGroupedListViewMaker;
2044 virtual Tizen::Ui::Control*
2045 Make(_UiBuilderControl* pControl)
2047 result r = E_SYSTEM;
2048 _UiBuilderControlLayout* pControlProperty = null;
2049 GroupedListView* pGroupedListView = null;
2050 FloatRectangle rect;
2052 ListScrollStyle scrollStyle = SCROLL_STYLE_FADE_OUT;
2053 GroupedListViewStyle style = GROUPED_LIST_VIEW_STYLE_INDEXED;
2054 ScrollInputMode scrollInputMode = SCROLL_INPUT_MODE_ALLOW_ANY_DIRECTION;
2056 String elementString;
2057 bool itemDividerState = true;
2059 bool sweepEnabledState = false;
2062 GetProperty(pControl, &pControlProperty);
2063 if (pControlProperty == null)
2068 pGroupedListView = new (std::nothrow) GroupedListView();
2069 if (pGroupedListView == null)
2074 rect = pControlProperty->GetRectF();
2077 styleString = pControlProperty->GetStyle();
2079 if (styleString.Equals(L"GROUPED_LIST_VIEW_STYLE_SECTION", false))
2081 style = GROUPED_LIST_VIEW_STYLE_SECTION;
2085 style = GROUPED_LIST_VIEW_STYLE_INDEXED;
2089 if (pControl->GetElement(L"itemDivider", elementString))
2091 if (elementString.Equals(L"true", false))
2093 itemDividerState = true;
2097 itemDividerState = false;
2101 if (pControl->GetElement(L"listScrollStyle", elementString))
2103 if (elementString.Equals(L"SCROLL_STYLE_FIXED", false))
2105 scrollStyle = SCROLL_STYLE_FIXED;
2107 else if (elementString.Equals(L"SCROLL_STYLE_FAST_SCROLL", false))
2109 scrollStyle = SCROLL_STYLE_FAST_SCROLL;
2111 else if (elementString.Equals(L"SCROLL_STYLE_JUMP_TO_TOP", false))
2113 scrollStyle = SCROLL_STYLE_JUMP_TO_TOP;
2115 else if (elementString.Equals(L"SCROLL_STYLE_THUMB", false))
2117 scrollStyle = SCROLL_STYLE_THUMB;
2120 else if (pControl->GetElement(L"fastScroll", elementString))
2122 if (elementString.Equals(L"true", false))
2124 scrollStyle = SCROLL_STYLE_FAST_SCROLL;
2128 r = pGroupedListView->Construct(rect, style, itemDividerState, scrollStyle);
2129 SysTryCatch(NID_UI, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r));
2131 // Set BackgroundsBitmap
2132 if (pControl->GetElement("backgroundBitmapPath", elementString))
2134 Bitmap* pBackgroundBitmap = null;
2135 pBackgroundBitmap = LoadBitmapN(elementString);
2136 if (pBackgroundBitmap != null)
2138 r = pGroupedListView->SetBackgroundBitmap(pBackgroundBitmap);
2139 delete pBackgroundBitmap;
2140 pBackgroundBitmap = null;
2142 SysTryCatch(NID_UI, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r));
2147 if (pControl->GetElement(L"textOfEmptyList", elementString))
2149 r = pGroupedListView->SetTextOfEmptyList(elementString);
2150 SysTryCatch(NID_UI, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r));
2153 if (pControl->GetElement(L"colorOfEmptyListText", elementString))
2155 ConvertStringToColor(elementString, color);
2156 r = pGroupedListView->SetTextColorOfEmptyList(color);
2157 SysTryCatch(NID_UI, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r));
2160 if (pControl->GetElement(L"bitmapPathOfEmptyList", elementString))
2162 Bitmap* pBackgroundBitmap = null;
2163 pBackgroundBitmap = LoadBitmapN(elementString); //__image->DecodeN(path,BITMAP_PIXEL_FORMAT_RGB565);
2164 if (pBackgroundBitmap != null)
2166 r = pGroupedListView->SetBitmapOfEmptyList(pBackgroundBitmap);
2167 delete pBackgroundBitmap;
2168 pBackgroundBitmap = null;
2170 SysTryCatch(NID_UI, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r));
2174 if (pControl->GetElement(L"backgroundColorOpacity", elementString) || pControl->GetElement(L"BGColorOpacity", elementString))
2176 Base::Integer::Parse(elementString, opacity);
2179 if (pControl->GetElement(L"backgroundColor", elementString) || pControl->GetElement(L"BGColor", elementString))
2181 ConvertStringToColor32(elementString, opacity, color);
2182 r = pGroupedListView->SetBackgroundColor(color);
2183 SysTryCatch(NID_UI, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r));
2186 if (pControl->GetElement(L"itemDividerColor", elementString))
2188 ConvertStringToColor(elementString, color);
2189 r = pGroupedListView->SetItemDividerColor(color);
2190 SysTryCatch(NID_UI, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r));
2193 if (pControl->GetElement(L"sectionColor", elementString))
2195 ConvertStringToColor(elementString, color);
2196 r = pGroupedListView->SetSectionColor(color);
2197 SysTryCatch(NID_UI, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r));
2200 if (pControl->GetElement(L"sweepEnabled", elementString))
2203 if (elementString.Equals(L"true", false))
2205 sweepEnabledState = true;
2209 sweepEnabledState = false;
2212 r = pGroupedListView->SetSweepEnabled(sweepEnabledState);
2213 SysTryCatch(NID_UI, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r));
2216 // scroll Input Mode
2217 if (pControl->GetElement(L"scrollInputMode", elementString))
2219 if (elementString.Equals(L"SCROLL_INPUT_MODE_RESTRICT_TO_INITIAL_DIRECTION", false))
2221 scrollInputMode = SCROLL_INPUT_MODE_RESTRICT_TO_INITIAL_DIRECTION;
2224 pGroupedListView->SetScrollInputMode(scrollInputMode);
2227 return pGroupedListView;
2230 delete pGroupedListView;
2235 }; // _GroupedListViewMaker
2237 _GroupedListViewRegister::_GroupedListViewRegister()
2239 _UiBuilderControlTableManager* pUiBuilderControlTableManager = _UiBuilderControlTableManager::GetInstance();
2240 pUiBuilderControlTableManager->RegisterControl(L"GroupedListView", _GroupedListViewMaker::GetInstance);
2243 _GroupedListViewRegister::~_GroupedListViewRegister()
2245 _UiBuilderControlTableManager* pUiBuilderControlTableManager = _UiBuilderControlTableManager::GetInstance();
2246 pUiBuilderControlTableManager->UnregisterControl(L"GroupedListView");
2248 static _GroupedListViewRegister GroupedListViewRegisterToUIbuilder;
2249 }}} // Tizen::Ui::Controls