2 // Open Service Platform
3 // Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
5 // Licensed under the Flora License, Version 1.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://floralicense.org/license/
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_SlidableGroupedListImpl.cpp
20 * @brief This is the implementation file for the _SlidableGroupedListImpl class.
23 #include <FUiCtrlCustomListItem.h>
24 #include <FUiCtrlCustomListItemFormat.h>
25 #include "FUiCtrl_CustomListItemFormatImpl.h"
26 #include "FUiCtrl_CustomListItemImpl.h"
27 #include "FUiCtrl_SlidableGroupedListImpl.h"
28 #include "FUi_ResourceManager.h"
29 #include "FUiCtrl_ListListener.h"
30 #include "FUi_UiBuilder.h"
31 #include "FUiCtrl_TableViewPresenter.h"
32 #include "FUiCtrl_FastScroll.h"
33 #include "FUiCtrl_FastScrollIndex.h"
34 #include "FUi_ResourceSizeInfo.h"
36 using namespace Tizen::Graphics;
37 using namespace Tizen::Base;
38 using namespace Tizen::Base::Collection;
39 using namespace Tizen::Base::Runtime;
40 using namespace Tizen::Base::Utility;
42 namespace Tizen { namespace Ui { namespace Controls {
44 static const int ID_FORMAT_STRING = 1;
45 static const int ID_FORMAT_MARGIN = 2;
46 extern const int INVALID_INDEX;
48 _SlidableGroupedListItemProvider::_SlidableGroupedListItemProvider(_SlidableGroupedListImpl* pListImpl)
50 , __pListImpl(pListImpl)
51 , __bottomListenerIndex(0)
52 , __topListenerIndex(0)
54 if (__pListImpl != null)
56 __topListenerIndex = __pListImpl->__slidableListenersList.GetCount() - 1;
61 _SlidableGroupedListItemProvider::GetGroupCount(void)
63 if (__pListImpl == null)
68 if (__pListImpl->__slidableListenersList.GetCount() > 0)
70 if (firstTime == true)
72 _ListListener* pListenerData = null;
73 ISlidableGroupedListEventListener* pSlidableGroupedListener = null;
74 int listenerCount = 0;
76 for (listenerCount = 0; listenerCount < __pListImpl->__slidableListenersList.GetCount(); listenerCount++)
78 pListenerData = dynamic_cast<_ListListener*>(__pListImpl->__slidableListenersList.GetAt(listenerCount));
79 SysTryReturn(NID_UI_CTRL, (pListenerData != null), -1, E_SYSTEM,
80 "[E_SYSTEM] A system error has occurred. Failed to get _ListListener");
82 pSlidableGroupedListener = dynamic_cast<ISlidableGroupedListEventListener*>(pListenerData->pListener);
83 SysTryReturn(NID_UI_CTRL, (pSlidableGroupedListener != null), -1, E_SYSTEM,
84 "[E_SYSTEM] A system error has occurred. Failed to get ISlidableGroupedListEventListener");
86 pSlidableGroupedListener->OnListPropertyRequested(__pListImpl->GetPublic());
93 return __pListImpl->GetGroupCount();
97 _SlidableGroupedListItemProvider::GetItemCount(int groupIndex)
99 _SlidableGroupObject* pGroupObject = dynamic_cast<_SlidableGroupObject*>(__pListImpl->__groupsList.GetAt(groupIndex));
100 SysTryReturn(NID_UI_CTRL, pGroupObject, 0, E_SYSTEM,
101 "[E_SYSTEM] A system error has occurred. Failed to get _SlidableGroupObject at index (%d).", groupIndex);
103 return pGroupObject->__itemCount;
107 _SlidableGroupedListItemProvider::CreateGroupItem(int groupIndex, int itemWidth)
109 result r = E_SUCCESS;
111 _TableViewItemParams tableViewItemParams;
112 tableViewItemParams.pItem = __pListImpl->GetCustomListItemAt(groupIndex, -1);
113 tableViewItemParams.width = itemWidth;
114 tableViewItemParams.itemId = -1;
115 tableViewItemParams.groupIndex = groupIndex;
116 tableViewItemParams.itemIndex = -1;
117 tableViewItemParams.isDividerEnabled = false;
118 tableViewItemParams.pCheckBitmaps = null;
119 tableViewItemParams.annexStyle = __pListImpl->_annexStyle;
121 r = _CustomListItemImpl::CreateTableViewItem(tableViewItemParams);
122 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
124 return __pListImpl->GetTableViewGroupItemAt(groupIndex);
128 _SlidableGroupedListItemProvider::DeleteGroupItem(int groupIndex, TableViewGroupItem* pItem)
130 if (__pListImpl->__directDelete == false)
132 CustomListItem* pCustomListItem = __pListImpl->GetCustomListItemAt(groupIndex, -1);
133 pCustomListItem->__pCustomListItemImpl->__pTableViewGroupItemData = null;
142 _SlidableGroupedListItemProvider::IsReorderable(int groupIndexFrom, int groupIndexTo)
148 _SlidableGroupedListItemProvider::GetDefaultGroupItemHeight(void)
150 return __pListImpl->__groupItemHeight;
154 _SlidableGroupedListItemProvider::GetDefaultItemHeight(void)
156 CustomListItem* pCustomListItem = __pListImpl->GetCustomListItemAt(0, 0);
158 if (!pCustomListItem)
160 return __pListImpl->_defaultItemHeight;
164 return pCustomListItem->__pCustomListItemImpl->height;
169 _SlidableGroupedListItemProvider::UpdateGroupItem(int groupIndex, TableViewGroupItem* pItem)
174 _SlidableGroupedListItemProvider::UpdateItem(int groupIndex, int itemIndex, TableViewItem* pItem)
176 _TableViewItemUpdateParams updateParams;
177 updateParams.pItem = __pListImpl->GetCustomListItemAt(groupIndex, itemIndex);
178 updateParams.isDividerEnabled = __pListImpl->_isDividerEnabled;
179 updateParams.pCheckBitmaps = __pListImpl->_pCheckBitmaps;
180 updateParams.annexStyle = __pListImpl->_annexStyle;
182 result r = E_SUCCESS;
184 r = _CustomListItemImpl::UpdateTableViewItem(updateParams);
185 SysTryReturnVoidResult(NID_UI_CTRL, (r == E_SUCCESS), E_SYSTEM, "[E_SYSTEM] A system error has occurred. Failed to refresh an item.");
187 pItem->SetEnabled(true);
191 _SlidableGroupedListItemProvider::CallLoadToTopCb(int groupIndex, int itemIndex)
193 _ListListener* pListenerData = null;
194 ISlidableGroupedListEventListener* pSlidableListener = null;
196 pListenerData = dynamic_cast<_ListListener*>(__pListImpl->__slidableListenersList.GetAt(__topListenerIndex));
197 SysTryReturn(NID_UI_CTRL, (pListenerData != null), E_SYSTEM, E_SYSTEM,
198 "[E_SYSTEM] A system error has occurred. Failed to get _ListListener at index (%d)", __topListenerIndex);
200 pSlidableListener = dynamic_cast<ISlidableGroupedListEventListener*>(pListenerData->pListener);
201 SysTryReturn(NID_UI_CTRL, (pSlidableListener != null), E_SYSTEM, E_SYSTEM,
202 "[E_SYSTEM] A system error has occurred. Failed to get ISlidableGroupedListEventListener");
204 pSlidableListener->OnLoadToTopRequested(__pListImpl->GetPublic(), groupIndex, itemIndex, 1);
206 if (--__topListenerIndex < 0)
208 __topListenerIndex = __pListImpl->__slidableListenersList.GetCount() - 1;
215 _SlidableGroupedListItemProvider::UpdateCheckStatus(_TableViewItemData* pTableViewItemData, int groupIndex, int itemIndex)
217 _SlidableGroupObject* pGroupObject = dynamic_cast<_SlidableGroupObject*>(__pListImpl->__groupsList.GetAt(groupIndex));
218 SysTryReturn(NID_UI_CTRL, pGroupObject, null, E_SYSTEM,
219 "[E_SYSTEM] A system error has occurred. Failed to get _SlidableGroupObject at index (%d).", groupIndex);
221 if (pTableViewItemData && pGroupObject->__pCheckedList)
223 Boolean* pChecked = dynamic_cast<Boolean*>(pGroupObject->__pCheckedList->GetAt(itemIndex));
224 SysTryReturn(NID_UI_CTRL, pChecked, E_SYSTEM, E_SYSTEM, "[E_SYSTEM] A system error has occurred.");
226 _CheckElementModel* pCheckElement = __pListImpl->GetCheckElementAt(groupIndex, 0);
227 SysTryReturn(NID_UI_CTRL, pCheckElement, E_SYSTEM, E_SYSTEM, "[E_SYSTEM] A system error has occurred. Failed to get check element");
229 pCheckElement->SetCheckBoxStatus((_CheckBoxBitmapType)pChecked->ToBool());
236 _SlidableGroupedListItemProvider::ModifyIndicesAfterTopLoad(void)
238 if (__pListImpl->GetCurrentLoadedCount() > __pListImpl->__itemCacheSize)
240 int subItemCount = __pListImpl->GetSubItemCountAt(__pListImpl->__bottomGroup);
242 result r = E_SUCCESS;
243 r = __pListImpl->RemoveFromItemsList(__pListImpl->__bottomGroup, subItemCount - 1);
244 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
246 __pListImpl->CallUnloadItemCb(__pListImpl->__bottomGroup, subItemCount - 1);
248 if ((subItemCount == 1) && (__pListImpl->__bottomGroup > 0))
250 __pListImpl->__bottomGroup--;
254 if (__pListImpl->GetCurrentLoadedCount() == 2)
256 for (int index = __pListImpl->__topGroup + 1; index < __pListImpl->__groupsList.GetCount(); index++)
258 _SlidableGroupObject* pTempGroup = dynamic_cast<_SlidableGroupObject*>(__pListImpl->__groupsList.GetAt(index));
259 SysTryReturn(NID_UI_CTRL, (pTempGroup != null), E_SYSTEM, E_SYSTEM,
260 "[E_SYSTEM] A system error has occurred. Failed to get SlidableGroupObject at index (%d).", index);
262 pTempGroup->__topIndex = 0;
269 _SlidableGroupedListItemProvider::LoadAtTop(int groupIndex, int itemIndex)
271 _TableViewItemData* pTableViewItemData = null;
273 _SlidableGroupObject* pGroupObject = dynamic_cast<_SlidableGroupObject*>(__pListImpl->__groupsList.GetAt(groupIndex));
274 SysTryReturn(NID_UI_CTRL, pGroupObject, null, E_SYSTEM,
275 "[E_SYSTEM] A system error has occurred. Failed to get _SlidableGroupObject at index (%d).", groupIndex);
277 __pListImpl->__topGroup = groupIndex;
279 result r = E_SUCCESS;
280 CustomListItem* pCustomListItem = null;
282 if (itemIndex >= pGroupObject->__topIndex)
284 pCustomListItem = __pListImpl->GetCustomListItemAt(groupIndex, itemIndex);
287 pGroupObject->__topIndex = itemIndex;
289 if (!pCustomListItem)
291 r = CallLoadToTopCb(groupIndex, itemIndex);
292 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, null, E_SYSTEM, "[%s] Propagating.", GetErrorMessage(r));
296 _SlidableGroupObject* pGroupObject = dynamic_cast<_SlidableGroupObject*>(__pListImpl->__groupsList.GetAt(__pListImpl->__topGroup));
297 SysTryReturn(NID_UI_CTRL, pGroupObject, null, E_SYSTEM,
298 "[E_SYSTEM] A system error has occurred. Failed to get _SlidableGroupObject at index (%d).", __pListImpl->__topGroup);
300 _TableViewItemParams tableViewItemParams;
301 tableViewItemParams.pItem = (const_cast<CustomListItem*>(pCustomListItem));
302 tableViewItemParams.width = __pListImpl->GetCore().GetBounds().width;
303 tableViewItemParams.itemIndex = pGroupObject->__topIndex;
304 tableViewItemParams.groupIndex = __pListImpl->__topGroup;
305 tableViewItemParams.isDividerEnabled = __pListImpl->_isDividerEnabled;
306 tableViewItemParams.pCheckBitmaps = __pListImpl->_pCheckBitmaps;
307 tableViewItemParams.annexStyle = __pListImpl->_annexStyle;
309 result r = _CustomListItemImpl::CreateTableViewItem(tableViewItemParams);
310 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
313 pTableViewItemData = __pListImpl->GetTableViewItemAt(groupIndex, 0);
315 SysTryReturn(NID_UI_CTRL, pTableViewItemData, null, E_SYSTEM, "[%s] Propagating.", GetErrorMessage(r));
317 r = UpdateCheckStatus(pTableViewItemData, groupIndex, pGroupObject->__topIndex);
318 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, null, E_SYSTEM, "[%s] Propagating.", GetErrorMessage(r));
320 r = ModifyIndicesAfterTopLoad();
321 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, null, E_SYSTEM, "[%s] Propagating.", GetErrorMessage(r));
323 return pTableViewItemData;
327 _SlidableGroupedListItemProvider::CallLoadToBottomCb(int groupIndex, int itemIndex)
329 _ListListener* pListenerData = null;
330 ISlidableGroupedListEventListener* pSlidableListener = null;
332 pListenerData = dynamic_cast<_ListListener*>(__pListImpl->__slidableListenersList.GetAt(__bottomListenerIndex));
333 SysTryReturn(NID_UI_CTRL, (pListenerData != null), E_SYSTEM, E_SYSTEM,
334 "[E_SYSTEM] A system error has occurred. Failed to get _ListListener at index (%d)", __bottomListenerIndex);
336 pSlidableListener = dynamic_cast<ISlidableGroupedListEventListener*>(pListenerData->pListener);
337 SysTryReturn(NID_UI_CTRL, (pSlidableListener != null), E_SYSTEM, E_SYSTEM,
338 "[E_SYSTEM] A system error has occurred. Failed to get ISlidableGroupedListEventListener");
340 pSlidableListener->OnLoadToBottomRequested(__pListImpl->GetPublic(), groupIndex, itemIndex, 1);
342 if (++__bottomListenerIndex == __pListImpl->__slidableListenersList.GetCount())
344 __bottomListenerIndex = 0;
351 _SlidableGroupedListItemProvider::ModifyIndicesAfterBottomLoad(int groupIndex, int itemIndex)
353 if (__pListImpl->GetCurrentLoadedCount() > __pListImpl->__itemCacheSize)
355 _SlidableGroupObject* pTopGroupObject = dynamic_cast<_SlidableGroupObject*>(__pListImpl->__groupsList.GetAt(__pListImpl->__topGroup));
356 SysTryReturn(NID_UI_CTRL, pTopGroupObject, E_SYSTEM, E_SYSTEM,
357 "[E_SYSTEM] A system error has occurred. Failed to get _SlidableGroupObject at index (%d).", __pListImpl->__topGroup);
359 if (__pListImpl->__topGroup != __pListImpl->__bottomGroup)
361 pTopGroupObject->__topIndex++;
364 if (__pListImpl->GetSubItemCountAt(__pListImpl->__topGroup) == 0)
366 __pListImpl->__topGroup++;
369 else if (__pListImpl->GetCurrentLoadedCount() == 1)
371 __pListImpl->__topGroup = groupIndex;
372 __pListImpl->__bottomGroup = groupIndex;
374 _SlidableGroupObject* pTopGroupObject = dynamic_cast<_SlidableGroupObject*>(__pListImpl->__groupsList.GetAt(__pListImpl->__topGroup));
375 SysTryReturn(NID_UI_CTRL, pTopGroupObject, E_SYSTEM, E_SYSTEM,
376 "[E_SYSTEM] A system error has occurred. Failed to get _SlidableGroupObject at index (%d).", __pListImpl->__topGroup);
378 pTopGroupObject->__topIndex = itemIndex;
380 for (int index = 0; index < groupIndex; index++)
382 _SlidableGroupObject* pTempGroup = dynamic_cast<_SlidableGroupObject*>(__pListImpl->__groupsList.GetAt(index));
383 SysTryReturn(NID_UI_CTRL, (pTempGroup != null), E_SYSTEM, E_SYSTEM,
384 "[E_SYSTEM] A system error has occurred. Failed to get SlidableGroupObject at index (%d).", index);
386 pTempGroup->__topIndex = pTempGroup->__itemCount - 1;
394 _SlidableGroupedListItemProvider::LoadAtBottom(int groupIndex, int itemIndex)
396 _TableViewItemData* pTableViewItemData = null;
397 result r = E_SUCCESS;
399 __pListImpl->__bottomGroup = groupIndex;
401 CustomListItem* pCustomListItem = __pListImpl->GetCustomListItemAt(groupIndex, itemIndex - __pListImpl->GetTopItemIndex(groupIndex));
403 if (!pCustomListItem)
405 r = CallLoadToBottomCb(groupIndex, itemIndex);
406 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, null, E_SYSTEM, "[%s] Propagating.", GetErrorMessage(r));
410 _TableViewItemParams tableViewItemParams;
411 tableViewItemParams.pItem = (const_cast<CustomListItem*>(pCustomListItem));
412 tableViewItemParams.width = __pListImpl->GetCore().GetBounds().width;
413 tableViewItemParams.groupIndex = __pListImpl->__bottomGroup;
414 tableViewItemParams.itemIndex = itemIndex;
415 tableViewItemParams.isDividerEnabled = __pListImpl->_isDividerEnabled;
416 tableViewItemParams.pCheckBitmaps = __pListImpl->_pCheckBitmaps;
417 tableViewItemParams.annexStyle = __pListImpl->_annexStyle;
419 result r = _CustomListItemImpl::CreateTableViewItem(tableViewItemParams);
420 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
423 int subItemCount = __pListImpl->GetSubItemCountAt(groupIndex);
425 if (subItemCount > __pListImpl->__itemCacheSize)
427 _SlidableGroupObject* pGroupObject = dynamic_cast<_SlidableGroupObject*>(__pListImpl->__groupsList.GetAt(groupIndex));
428 SysTryReturn(NID_UI_CTRL, pGroupObject, null, E_SYSTEM,
429 "[E_SYSTEM] A system error has occurred. Failed to get _SlidableGroupObject at index (%d).", groupIndex);
431 pGroupObject->__topIndex++;
434 pTableViewItemData = __pListImpl->GetTableViewItemAt(groupIndex, subItemCount - 1);
436 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, null, E_SYSTEM, "[%s] Propagating.", GetErrorMessage(r));
438 r = UpdateCheckStatus(pTableViewItemData, groupIndex, subItemCount - 1);
439 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, null, E_SYSTEM, "[%s] Propagating.", GetErrorMessage(r));
441 r = ModifyIndicesAfterBottomLoad(groupIndex, itemIndex);
442 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, null, E_SYSTEM, "[%s] Propagating.", GetErrorMessage(r));
444 return pTableViewItemData;
448 _SlidableGroupedListItemProvider::CreateItem(int groupIndex, int itemIndex, int itemWidth)
450 _SlidableGroupObject* pGroupObject = dynamic_cast<_SlidableGroupObject*>(__pListImpl->__groupsList.GetAt(groupIndex));
451 SysTryReturn(NID_UI_CTRL, pGroupObject, null, E_SYSTEM,
452 "[E_SYSTEM] A system error has occurred. Failed to get _SlidableGroupObject at index (%d).", groupIndex);
454 _TableViewItemData* pTableViewItem = null;
455 result r = E_SUCCESS;
457 if (groupIndex == __pListImpl->__topGroup)
459 pTableViewItem = __pListImpl->GetTableViewItemAt(groupIndex, itemIndex - pGroupObject->__topIndex);
463 pTableViewItem = __pListImpl->GetTableViewItemAt(groupIndex, itemIndex);
466 __pListImpl->__isCreating = true;
468 if (pTableViewItem == null)
471 if (groupIndex <= __pListImpl->__topGroup && itemIndex <= pGroupObject->__topIndex)
473 pTableViewItem = LoadAtTop(groupIndex, itemIndex);
475 else // load at bottom
477 pTableViewItem = LoadAtBottom(groupIndex, itemIndex);
480 SysTryReturn(NID_UI_CTRL, pTableViewItem, null, E_SYSTEM, "[%s] Propagating.", GetErrorMessage(r));
483 __pListImpl->__isCreating = false;
485 return pTableViewItem;
489 _SlidableGroupedListItemProvider::DeleteItem(int groupIndex, int itemIndex, TableViewItem* pItem)
491 if (__pListImpl->__directDelete == false)
493 if (((groupIndex == __pListImpl->__topGroup) && (itemIndex <= __pListImpl->GetTopItemIndex(__pListImpl->__topGroup))) || (__pListImpl->__forceScroll == true))
495 __pListImpl->RemoveFromItemsList(groupIndex, 0);
499 __pListImpl->RemoveFromItemsList(groupIndex, itemIndex);
502 __pListImpl->CallUnloadItemCb(groupIndex, itemIndex);
504 _SlidableGroupObject* pGroupObject = dynamic_cast<_SlidableGroupObject*>(__pListImpl->__groupsList.GetAt(groupIndex));
505 SysTryReturn(NID_UI_CTRL, pGroupObject, false, E_SYSTEM,
506 "[E_SYSTEM] A system error has occurred. Failed to get _SlidableGroupObject at index (%d).", groupIndex);
508 // adjust top/bottom group indices
509 if (__pListImpl->GetSubItemCountAt(groupIndex) == 0)
511 if (groupIndex <= __pListImpl->__topGroup)
513 if (__pListImpl->__topGroup < __pListImpl->__bottomGroup)
515 __pListImpl->__topGroup++;
520 if (__pListImpl->__bottomGroup > __pListImpl->__topGroup)
522 __pListImpl->__bottomGroup--;
534 _SlidableGroupObject::_SlidableGroupObject(void)
538 , __pCheckedList(null)
542 _SlidableGroupObject::~_SlidableGroupObject(void)
546 __pCheckedList->RemoveAll(true);
547 delete __pCheckedList;
548 __pCheckedList = null;
552 _SlidableGroupedListImpl*
553 _SlidableGroupedListImpl::GetInstance(SlidableGroupedList& slidableGroupedList)
555 return static_cast<_SlidableGroupedListImpl*>(slidableGroupedList._pControlImpl);
558 const _SlidableGroupedListImpl*
559 _SlidableGroupedListImpl::GetInstance(const SlidableGroupedList& slidableGroupedList)
561 return static_cast<const _SlidableGroupedListImpl*>(slidableGroupedList._pControlImpl);
564 _SlidableGroupedListImpl::_SlidableGroupedListImpl(Control* pList, _TableView* pCore)
565 : _ListBaseImpl(pList, pCore)
566 , __pFastScrollListener(null)
570 , __pItemProvider(null)
571 , __directDelete(false)
572 , __forceScroll(false)
573 , __isCreating(false)
574 , __groupItemTextFont(0)
575 , __groupItemHeight(0)
577 , __pItemFormat(null)
581 _SlidableGroupedListImpl::~_SlidableGroupedListImpl(void)
583 if (__pItemProvider && __pItemProvider->firstTime == true)
585 for (int groupIndex = 0; groupIndex < __groupsList.GetCount(); groupIndex++)
587 RemoveFromSubItemsList(groupIndex);
591 RemoveAllFromItemsList();
593 __groupsList.RemoveAll(true);
594 __slidableListenersList.RemoveAll(true);
595 __itemListenersList.RemoveAll(true);
597 delete __pItemProvider;
599 delete __pItemFormat;
602 _SlidableGroupedListImpl*
603 _SlidableGroupedListImpl::CreateSlidableGroupedListImplN(SlidableGroupedList* pControl, bool itemDivider, bool fastScroll)
605 TableViewScrollBarStyle scrollStyle = TABLE_VIEW_SCROLL_BAR_STYLE_NONE;
607 if (fastScroll == true)
609 scrollStyle = TABLE_VIEW_SCROLL_BAR_STYLE_FAST_SCROLL;
613 scrollStyle = TABLE_VIEW_SCROLL_BAR_STYLE_FADE_OUT;
616 _TableView* pTableView = _TableView::CreateTableViewN(TABLE_VIEW_STYLE_GROUPED, itemDivider, scrollStyle);
617 result r = GetLastResult();
618 SysTryReturn(NID_UI_CTRL, pTableView, null, r, "[%s] Propagating.", GetErrorMessage(r));
620 _SlidableGroupedListImpl* pImpl = new (std::nothrow) _SlidableGroupedListImpl(pControl, pTableView);
621 SysTryCatch(NID_UI_CTRL, pImpl, , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
631 _SlidableGroupedListImpl::AddSlidableGroupedListEventListener(ISlidableGroupedListEventListener& listener)
633 _ListListener* pSlidableListener = new (std::nothrow) _ListListener();
634 SysTryReturnVoidResult(NID_UI_CTRL, pSlidableListener, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
636 pSlidableListener->pListener = &listener;
637 __slidableListenersList.Add(*pSlidableListener);
641 _SlidableGroupedListImpl::RemoveSlidableGroupedListEventListener(ISlidableGroupedListEventListener& listener)
643 _ListListener* pListenerData = null;
645 IEventListener* pEventListener = dynamic_cast<IEventListener*>(&listener);
646 SysTryReturnVoidResult(NID_UI_CTRL, (pEventListener != null), E_SYSTEM,
647 "[E_SYSTEM] A system error has occurred. Failed to get IEventListener.");
649 ISlidableGroupedListEventListener* pSlidableListener = null;
651 for (int listenerCount = 0; listenerCount < __slidableListenersList.GetCount(); listenerCount++)
653 pListenerData = dynamic_cast<_ListListener*>(__slidableListenersList.GetAt(listenerCount));
654 SysTryReturnVoidResult(NID_UI_CTRL, (pListenerData != null), E_SYSTEM,
655 "[E_SYSTEM] A system error has occurred. Failed to get _ListListener at index (%d).", listenerCount);
657 pSlidableListener = dynamic_cast<ISlidableGroupedListEventListener*>(pListenerData->pListener);
658 SysTryReturnVoidResult(NID_UI_CTRL, (pSlidableListener != null), E_SYSTEM,
659 "[E_SYSTEM] A system error has occurred. Failed to get ISlidableGroupedListEventListener.");
661 if (pSlidableListener == pEventListener)
663 __slidableListenersList.RemoveAt(listenerCount, true);
672 _SlidableGroupedListImpl::AddFastScrollEventListener(IFastScrollEventListener& listener)
674 __pFastScrollListener = &listener;
676 GetCore().AddFastScrollListener(*this);
680 _SlidableGroupedListImpl::AddGroup(const String& text, const Bitmap* pBackgroundBitmap, int itemCount, int groupHeight, int groupId)
682 return InsertGroupAt(GetGroupCount(), text, pBackgroundBitmap, itemCount, groupHeight, groupId);
686 _SlidableGroupedListImpl::AddGroupedItemEventListener(IGroupedItemEventListener& listener)
688 _ListListener* pListenersList = new (std::nothrow) _ListListener();
689 SysTryReturnVoidResult(NID_UI_CTRL, pListenersList, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
691 pListenersList->pListener = &listener;
693 __itemListenersList.Add(*pListenersList);
697 _SlidableGroupedListImpl::AddItem(int groupIndex, const CustomListItem& item, int itemId)
699 SysTryReturnResult(NID_UI_CTRL, (groupIndex >= 0 && groupIndex < __groupsList.GetCount()),
700 E_INVALID_ARG, "Invalid argument is used. groupIndex (%d)", groupIndex);
702 _SlidableGroupObject* pGroupObject = dynamic_cast<_SlidableGroupObject*>(__groupsList.GetAt(groupIndex));
703 SysTryReturnResult(NID_UI_CTRL, (pGroupObject != null), E_SYSTEM,
704 "A system error has occurred. Failed to get _SlidableGroupObject at index (%d).", groupIndex);
706 return InsertItemAt(groupIndex, GetTopItemIndex(groupIndex) + GetSubItemCountAt(groupIndex), item, itemId);
710 _SlidableGroupedListImpl::GetBottomDrawnItemIndex(int& groupIndex, int& itemIndex) const
712 return GetCore().GetBottomDrawnItemIndex(groupIndex, itemIndex);
716 _SlidableGroupedListImpl::GetFirstCheckedItemIndex(int& groupIndex, int& itemIndex) const
718 SysTryReturnResult(NID_UI_CTRL, (_annexStyle != TABLE_VIEW_ANNEX_STYLE_NORMAL), E_SYSTEM,
719 "A system error has occurred. The list style is CUSTOM_LIST_STYLE_NORMAL.");
721 _SlidableGroupObject* pGroupObject = null;
722 Boolean* pChecked = null;
724 for (int groupCount = 0; groupCount < GetGroupCount(); groupCount++)
726 pGroupObject = dynamic_cast<_SlidableGroupObject*>(const_cast<Object*>(__groupsList.GetAt(groupCount)));
727 SysTryReturnResult(NID_UI_CTRL, (pGroupObject != null), E_SYSTEM,
728 "A system error has occurred. Failed to get _SlidableGroupObject at index (%d).", groupCount);
730 for (int checkCount = 0; checkCount < pGroupObject->__pCheckedList->GetCount(); checkCount++)
732 pChecked = dynamic_cast<Boolean*>(const_cast<Object*>(pGroupObject->__pCheckedList->GetAt(checkCount)));
733 SysTryReturnResult(NID_UI_CTRL, (pChecked != null), E_SYSTEM, "A system error has occurred.");
735 if (pChecked->ToBool())
737 groupIndex = groupCount;
738 itemIndex = checkCount;
748 _SlidableGroupedListImpl::GetGroupIdAt(int groupIndex) const
750 SysTryReturn(NID_UI_CTRL, (groupIndex >= 0 && groupIndex < __groupsList.GetCount()),
751 INVALID_INDEX, E_INVALID_ARG, "[E_INVALID_ARG] Invalid argument is used. groupIndex (%d)", groupIndex);
753 const CustomListItem* pCustomListItem = GetCustomListItemAt(groupIndex, -1);
754 SysTryReturn(NID_UI_CTRL, pCustomListItem, 0, E_SYSTEM,
755 "[E_SYSTEM] A system error has occurred. Failed to get CustomListItem at index (%d).", groupIndex);
757 return pCustomListItem->__pCustomListItemImpl->itemId;
761 _SlidableGroupedListImpl::GetGroupIndexFromGroupId(int groupId) const
763 for (int groupCount = 0; groupCount < __groupsList.GetCount(); groupCount++)
765 const CustomListItem* pCustomItem = GetCustomListItemAt(groupCount, -1);
766 SysTryReturn(NID_UI_CTRL, pCustomItem, INVALID_INDEX, E_SYSTEM,
767 "[E_SYSTEM] A system error has occurred. Failed to get CustomListItem at index (%d).", groupCount);
769 if (pCustomItem->__pCustomListItemImpl->itemId == groupId)
775 return INVALID_INDEX;
779 _SlidableGroupedListImpl::GetFirstLoadedItemIndex(int& groupIndex, int& itemIndex) const
781 _SlidableGroupObject* pGroupObject = dynamic_cast<_SlidableGroupObject*>(const_cast<Object*>(__groupsList.GetAt(__topGroup)));
782 SysTryReturnResult(NID_UI_CTRL, pGroupObject, E_SYSTEM,
783 "A system error has occurred. Failed to get _SlidableGroupObject at index (%d).", __topGroup);
785 groupIndex = __topGroup;
786 itemIndex = pGroupObject->__topIndex;
792 _SlidableGroupedListImpl::GetLastLoadedItemIndex(int& groupIndex, int& itemIndex) const
794 _SlidableGroupObject* pGroupObject = dynamic_cast<_SlidableGroupObject*>(const_cast<Object*>(__groupsList.GetAt(__bottomGroup)));
795 SysTryReturnResult(NID_UI_CTRL, pGroupObject, E_SYSTEM,
796 "A system error has occurred. Failed to get _SlidableGroupObject at index (%d).", __bottomGroup);
798 itemIndex = GetSubItemCountAt(__bottomGroup) - 1 + pGroupObject->__topIndex;
799 groupIndex = __bottomGroup;
805 _SlidableGroupedListImpl::SetFastScrollMainIndex(const String& text)
807 SysTryReturn(NID_UI_CTRL, (text.GetLength() > 0), E_SYSTEM, E_INVALID_ARG, "[E_INVALID_ARG] Invalid argument is used. Text is empty.");
809 SysTryReturn(NID_UI_CTRL, (GetCore().GetScrollStyle() == TABLE_VIEW_SCROLL_BAR_STYLE_FAST_SCROLL), E_SYSTEM, E_SYSTEM, "[E_SYSTEM] A system error has occurred. Scroll bar not enabled");
811 result r = GetCore().SetFastScrollIndex(text, false);
812 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, E_SYSTEM, r, "[%s] Propagating.", GetErrorMessage(r));
814 __mainScrollIndex = text;
821 _SlidableGroupedListImpl::SetFastScrollSubIndex(const String& text, FastScrollIndexDigit indexDigit)
823 SysTryReturn(NID_UI_CTRL, (text.GetLength() > 0), E_SYSTEM, E_INVALID_ARG, "[E_INVALID_ARG] Invalid argument is used. Text is empty.");
825 SysTryReturn(NID_UI_CTRL, (indexDigit == SCROLL_INDEX_DIGIT_NUM_1), E_SYSTEM, E_INVALID_ARG,
826 "[E_INVALID_ARG] Invalid argument is used. indexDigit is not SCROLL_INDEX_DIGIT_NUM_1.");
828 _FastScroll* pFastScroll = GetCore().GetFastScrollBar();
829 SysTryReturn(NID_UI_CTRL, pFastScroll, E_SYSTEM, E_SYSTEM, "[E_SYSTEM] A system error has occurred. Failed to get FastScroll Object.");
831 SysTryReturn(NID_UI_CTRL, (__mainScrollIndex.GetLength() > 0), E_SYSTEM, E_SYSTEM,
832 "[E_SYSTEM] A system error has occurred. Main index of the fast scroll is not set.");
834 _FastScrollIndex* pRootIndex = pFastScroll->GetIndex();
835 SysTryReturn(NID_UI_CTRL, pRootIndex, E_SYSTEM, E_SYSTEM, "[E_SYSTEM] A system error has occurred. Failed to get rootIndex.");
837 int subIndexDigit = 1;
839 StringTokenizer strTok(text, delim);
843 while (strTok.HasMoreTokens())
845 strTok.GetNextToken(token);
846 _FastScrollIndex* pSecondaryIndex = pRootIndex->GetChildIndex(i++);
847 if (pSecondaryIndex != null)
849 pSecondaryIndex->AddChildTextIndexArray(0, token.GetPointer(), subIndexDigit, token.GetLength());
853 pFastScroll->UpdateIndex();
859 _SlidableGroupedListImpl::GetItemIndexFromPosition(const Point& position, int& groupIndex, int& itemIndex) const
861 return GetCore().GetItemIndexFromPosition(position, groupIndex, itemIndex);
865 _SlidableGroupedListImpl::GetItemIndexFromPosition(int x, int y, int& groupIndex, int& itemIndex) const
867 return GetCore().GetItemIndexFromPosition(Point(x, y), groupIndex, itemIndex);
871 _SlidableGroupedListImpl::CreateGroupItemN(const String& text, const Bitmap* pBackgroundBitmap, int groupId)
873 CustomListItem* pCustomListItem = new (std::nothrow) CustomListItem();
874 SysTryReturn(NID_UI_CTRL, pCustomListItem != null, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
876 pCustomListItem->Construct(__groupItemHeight);
877 pCustomListItem->SetItemFormat(*__pItemFormat);
878 pCustomListItem->SetElement(ID_FORMAT_STRING, text);
879 pCustomListItem->SetElement(ID_FORMAT_MARGIN, "");
881 if (pBackgroundBitmap != null)
883 pCustomListItem->SetNormalItemBackgroundBitmap(*pBackgroundBitmap);
886 pCustomListItem->__pCustomListItemImpl->itemId = groupId;
888 return pCustomListItem;
892 _SlidableGroupedListImpl::CreateGroupObject(int groupIndex, int itemCount, int groupHeight)
894 _SlidableGroupObject* pGroupObject = new (std::nothrow) _SlidableGroupObject();
895 SysTryReturn(NID_UI_CTRL, pGroupObject != null, E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
897 __groupsList.InsertAt(*pGroupObject, groupIndex);
899 if (_annexStyle == TABLE_VIEW_ANNEX_STYLE_MARK || _annexStyle == TABLE_VIEW_ANNEX_STYLE_ONOFF_SLIDING || _annexStyle == TABLE_VIEW_ANNEX_STYLE_RADIO)
901 pGroupObject->__pCheckedList = new (std::nothrow) ArrayList();
902 SysTryReturn(NID_UI_CTRL, pGroupObject->__pCheckedList, E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed");
904 pGroupObject->__pCheckedList->Construct(itemCount);
906 Boolean* pChecked = null;
908 for (int count = 0; count < itemCount; count++)
910 pChecked = new (std::nothrow) Boolean(false);
911 SysTryReturn(NID_UI_CTRL, pChecked, E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed");
912 pGroupObject->__pCheckedList->Add(*pChecked);
916 pGroupObject->__groupHeight = groupHeight;
917 pGroupObject->__itemCount = itemCount;
923 _SlidableGroupedListImpl::InsertGroupAt(int groupIndex, const String& text, const Bitmap* pBackgroundBitmap, int itemCount, int groupHeight, int groupId)
925 result r = E_SUCCESS;
927 SysTryReturn(NID_UI_CTRL, (groupIndex >= 0 && groupIndex <= __groupsList.GetCount()),
928 E_INVALID_ARG, E_INVALID_ARG, "[E_INVALID_ARG] Invalid argument is used. groupIndex (%d)", groupIndex);
930 r = CreateGroupObject(groupIndex, itemCount, groupHeight);
931 SysTryReturn(NID_UI_CTRL, (r == E_SUCCESS), r, r, "[%s] Propagating.", GetErrorMessage(r));
933 CustomListItem* pCustomListItem = CreateGroupItemN(text, pBackgroundBitmap, groupId);
934 SysTryReturn(NID_UI_CTRL, (r == E_SUCCESS), r, r, "[%s] Propagating.", GetErrorMessage(r));
936 r = InsertIntoItemsList(*pCustomListItem, groupIndex, -1);
937 SysTryReturn(NID_UI_CTRL, (r == E_SUCCESS), r, r, "[%s] Propagating.", GetErrorMessage(r));
939 __loadedCount += itemCount;
941 if (__slidableListenersList.GetCount() == 0)
946 if (groupIndex <= __topGroup)
952 if (__pItemProvider == null)
954 r = CreateItemProvider();
955 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, E_SYSTEM, E_SYSTEM, "[%s] Propagating.", GetErrorMessage(r));
957 _ListBaseImpl::OnDraw();
961 r = GetCore().RefreshTableView(groupIndex, -1, TABLE_VIEW_REFRESH_TYPE_ITEM_ADD);
962 SysTryReturn(NID_UI_CTRL, (r == E_SUCCESS), E_SYSTEM, E_SYSTEM, "[E_SYSTEM] A system error has occurred. Failed to insert a group.");
969 _SlidableGroupedListImpl::GetLastCheckedItemIndex(int& groupIndex, int& itemIndex) const
971 SysTryReturn(NID_UI_CTRL, (_annexStyle != TABLE_VIEW_ANNEX_STYLE_NORMAL), E_SYSTEM, E_SYSTEM,
972 "[E_SYSTEM] A system error has occurred. The list style is CUSTOM_LIST_STYLE_NORMAL.");
974 for (int groupCount = __groupsList.GetCount() - 1; groupCount >= 0; groupCount--)
976 int subItemCount = GetSubItemCountAt(groupCount);
978 for (int itemCount = subItemCount - 1; itemCount >= 0; itemCount--)
980 if (IsItemChecked(groupCount, itemCount))
982 itemIndex = itemCount;
983 groupIndex = groupCount;
992 const CustomListItem*
993 _SlidableGroupedListImpl::GetLoadedItemAt(int groupIndex, int index) const
995 SysTryReturn(NID_UI_CTRL, (groupIndex >= __topGroup && groupIndex <= __bottomGroup), null, E_INVALID_ARG,
996 "[E_INVALID_ARG] Invalid argument is used. groupIndex (%d) is not loaded or invalid.", groupIndex);
998 _SlidableGroupObject* pGroupObject = dynamic_cast<_SlidableGroupObject*>(const_cast<Object*>(__groupsList.GetAt(groupIndex)));
999 SysTryReturn(NID_UI_CTRL, pGroupObject, null, E_SYSTEM,
1000 "[E_SYSTEM] A system error has occurred. Failed to get _SlidableGroupObject at index (%d).", groupIndex);
1002 SysTryReturn(NID_UI_CTRL, (index >= 0 && index < GetSubItemCountAt(groupIndex)),
1003 null, E_INVALID_ARG, "[E_INVALID_ARG] invalid index(%d)", index);
1005 const CustomListItem* pSubListItem = GetCustomListItemAt(groupIndex, index);
1006 SysTryReturn(NID_UI_CTRL, pSubListItem, null, E_SYSTEM,
1007 "[E_SYSTEM] A system error has occurred. Failed to get CustomListItem at index (%d).", index);
1009 return pSubListItem;
1013 _SlidableGroupedListImpl::GetLoadedItemIdAt(int groupIndex, int index) const
1015 const CustomListItem* pCustomListItem = GetLoadedItemAt(groupIndex, index - GetTopItemIndex(groupIndex));
1016 SysTryReturn(NID_UI_CTRL, pCustomListItem, INVALID_INDEX, E_INVALID_ARG, "[E_INVALID_ARG] Invalid argument is used. ");
1018 return pCustomListItem->__pCustomListItemImpl->itemId;
1022 _SlidableGroupedListImpl::GetNextCheckedItemIndexAfter(int& groupIndex, int& index) const
1024 SysTryReturn(NID_UI_CTRL, (_annexStyle != TABLE_VIEW_ANNEX_STYLE_NORMAL), E_SYSTEM, E_SYSTEM,
1025 "[E_SYSTEM] A system error has occurred. The list style is CUSTOM_LIST_STYLE_NORMAL.");
1027 SysTryReturn(NID_UI_CTRL, (groupIndex >= 0 && groupIndex < __groupsList.GetCount()), E_SYSTEM, E_INVALID_ARG,
1028 "[E_INVALID_ARG] Invalid argument is used. groupIndex (%d).", groupIndex);
1030 int subItemCount = GetSubItemCountAt(groupIndex);
1032 SysTryReturn(NID_UI_CTRL, (index >= 0 && index < subItemCount),
1033 E_SYSTEM, E_SYSTEM, "[E_INVALID_ARG] Invalid argument is used. index (%d).", index);
1037 for (int groupCount = groupIndex; groupCount < __groupsList.GetCount(); groupCount++)
1039 if (groupCount == groupIndex)
1041 itemStart = index + 1;
1048 subItemCount = GetSubItemCountAt(groupIndex);
1049 for (int checkCount = itemStart; checkCount < subItemCount; checkCount++)
1051 if (IsItemChecked(groupCount, checkCount))
1053 groupIndex = groupCount;
1066 _SlidableGroupedListImpl::GetTextColorOfEmptyList(void) const
1068 return GetCore().GetTextColorOfEmptyTableView();
1072 _SlidableGroupedListImpl::GetTopDrawnItemIndex(int& groupIndex, int& itemIndex) const
1074 return GetCore().GetTopDrawnItemIndex(groupIndex, itemIndex);
1078 _SlidableGroupedListImpl::IsItemChecked(int groupIndex, int index) const
1080 SysTryReturn(NID_UI_CTRL, (_annexStyle != TABLE_VIEW_ANNEX_STYLE_NORMAL), false, E_SYSTEM,
1081 "[E_SYSTEM] A system error has occurred. The list style is CUSTOM_LIST_STYLE_NORMAL.");
1083 SysTryReturn(NID_UI_CTRL, (groupIndex >= 0 && groupIndex < __groupsList.GetCount()),
1084 false, E_INVALID_ARG, "[E_INVALID_ARG] Invalid argument is used. groupIndex (%d).", groupIndex);
1086 _SlidableGroupObject* pGroupObject = dynamic_cast<_SlidableGroupObject*>(const_cast<Object*>(__groupsList.GetAt(groupIndex)));
1087 SysTryReturn(NID_UI_CTRL, pGroupObject, false, E_SYSTEM,
1088 "[E_SYSTEM] A system error has occurred. Failed to get _SlidableGroupObject at index (%d).", groupIndex);
1090 SysTryReturn(NID_UI_CTRL, (index >= 0 && index < GetSubItemCountAt(groupIndex)),
1091 false, E_INVALID_ARG, "[E_INVALID_ARG] Invalid argument is used. index (%d).", index);
1093 Boolean* pChecked = dynamic_cast<Boolean*>(const_cast<Object*>(pGroupObject->__pCheckedList->GetAt(index)));
1094 SysTryReturn(NID_UI_CTRL, pChecked, false, E_SYSTEM, "[E_SYSTEM] A system error has occurred.");
1096 return pChecked->ToBool();
1100 _SlidableGroupedListImpl::IsItemLoaded(int groupIndex, int itemIndex) const
1102 if (groupIndex < __topGroup || groupIndex > __bottomGroup)
1107 else if (groupIndex == __topGroup)
1109 _SlidableGroupObject* pGroupObject = dynamic_cast<_SlidableGroupObject*>(const_cast<Object*>(__groupsList.GetAt(groupIndex)));
1110 SysTryReturn(NID_UI_CTRL, pGroupObject, E_SYSTEM, E_SYSTEM,
1111 "[E_SYSTEM] A system error has occurred. Failed to get _SlidableGroupObject at index (%d).", groupIndex);
1113 if (itemIndex >= pGroupObject->__topIndex && itemIndex <= pGroupObject->__itemCount)
1120 else if (groupIndex == __bottomGroup)
1122 _SlidableGroupObject* pGroupObject = dynamic_cast<_SlidableGroupObject*>(const_cast<Object*>(__groupsList.GetAt(groupIndex)));
1123 SysTryReturn(NID_UI_CTRL, pGroupObject, E_SYSTEM, E_SYSTEM,
1124 "[E_SYSTEM] A system error has occurred. Failed to get _SlidableGroupObject at index (%d).", groupIndex);
1126 if (itemIndex >= 0 && itemIndex < pGroupObject->__itemCount)
1138 _SlidableGroupedListImpl::RemoveAllGroups(void)
1140 for (int groupCount = __groupsList.GetCount() - 1; groupCount >= 0; groupCount--)
1142 RemoveGroupAt(groupCount);
1149 _SlidableGroupedListImpl::InsertItemAt(int groupIndex, int index, const CustomListItem& item, int itemId)
1151 result r = E_SUCCESS;
1153 SysTryReturn(NID_UI_CTRL, (groupIndex >= 0 && groupIndex < __groupsList.GetCount()),
1154 E_INVALID_ARG, E_INVALID_ARG, "[E_INVALID_ARG] Invalid argument is used. groupIndex (%d).", groupIndex);
1156 SysTryReturn(NID_UI_CTRL, (index >= 0 && index <= GetSubItemCountAt(groupIndex)), E_INVALID_ARG, E_INVALID_ARG,
1157 "[E_INVALID_ARG] Invalid argument is used. index (%d).", index);
1159 item.__pCustomListItemImpl->itemId = itemId;
1161 r = InsertIntoItemsList(item, groupIndex, index);
1162 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, E_SYSTEM, E_SYSTEM, "[%s] Propagating.", GetErrorMessage(r));
1164 _SlidableGroupObject* pGroupObject = dynamic_cast<_SlidableGroupObject*>(const_cast<Object*>(__groupsList.GetAt(groupIndex)));
1165 SysTryReturn(NID_UI_CTRL, pGroupObject, E_SYSTEM, E_SYSTEM,
1166 "[E_SYSTEM] A system error has occurred. Failed to get _SlidableGroupObject at index (%d).", groupIndex);
1168 pGroupObject->__itemCount++;
1170 if (pGroupObject->__pCheckedList)
1172 Boolean* pChecked = new (std::nothrow) Boolean(false);
1173 SysTryCatch(NID_UI_CTRL, pChecked, , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
1175 pGroupObject->__pCheckedList->InsertAt(*pChecked, index);
1178 if (GetCore().GetFirstDrawnFlag() == false)
1180 r = GetCore().RefreshTableView(groupIndex, index, TABLE_VIEW_REFRESH_TYPE_ITEM_ADD);
1181 SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , E_SYSTEM,
1182 "[E_SYSTEM] A system error has occurred. Failed to perform InsertItemAt groupIndex (%d), index (%d).", groupIndex, index);
1188 if (pGroupObject->__pCheckedList)
1190 pGroupObject->__pCheckedList->RemoveAt(index, true);
1192 RemoveFromItemsList(groupIndex, index);
1198 _SlidableGroupedListImpl::GetItemCountAt(int groupIndex) const
1200 SysTryReturn(NID_UI_CTRL, (groupIndex >= 0 && groupIndex < __groupsList.GetCount()),
1201 0, E_INVALID_ARG, "[E_INVALID_ARG] Invalid argument is used. groupIndex (%d).", groupIndex);
1203 _SlidableGroupObject* pGroupObject = dynamic_cast<_SlidableGroupObject*>(const_cast<Object*>(__groupsList.GetAt(groupIndex)));
1204 SysTryReturn(NID_UI_CTRL, pGroupObject, 0, E_SYSTEM,
1205 "[E_SYSTEM] A system error has occurred. Failed to get _SlidableGroupObject at index (%d).", groupIndex);
1206 return pGroupObject->__itemCount;
1210 _SlidableGroupedListImpl::RefreshItem(int groupIndex, int index)
1212 SysTryReturn(NID_UI_CTRL, (groupIndex >= 0 && groupIndex < __groupsList.GetCount()),
1213 E_INVALID_ARG, E_INVALID_ARG, "[E_INVALID_ARG] Invalid argument is used. groupIndex (%d).", groupIndex);
1215 int topItemIndex = -1;
1216 int bottomItemIndex = -1;
1217 int groupTopIndex = -1;
1219 GetCore().GetTopDrawnItemIndex(groupTopIndex, topItemIndex);
1220 GetCore().GetBottomDrawnItemIndex(groupTopIndex, bottomItemIndex);
1222 SysTryReturn(NID_UI_CTRL, (index >= topItemIndex && index <= bottomItemIndex), E_INVALID_OPERATION, E_INVALID_OPERATION,
1223 "Index (%d) should be within drawn item range.", index);
1225 result r = E_SUCCESS;
1227 _TableViewItemUpdateParams updateParams;
1228 updateParams.pItem = GetCustomListItemAt(groupIndex, index);
1229 updateParams.isDividerEnabled = _isDividerEnabled;
1230 updateParams.pCheckBitmaps = _pCheckBitmaps;
1231 updateParams.annexStyle = _annexStyle;
1233 r = _CustomListItemImpl::UpdateTableViewItem(updateParams);
1234 SysTryReturnResult(NID_UI_CTRL, (r == E_SUCCESS), E_SYSTEM,
1235 "A system error has occurred. Failed to perform RefreshItem at groupIndex (%d), index (%d).", groupIndex, index);
1237 DrawItem(groupIndex, index);
1243 _SlidableGroupedListImpl::RefreshGroup(int groupIndex)
1245 SysTryReturn(NID_UI_CTRL, (groupIndex >= 0 && groupIndex < __groupsList.GetCount()),
1246 E_INVALID_ARG, E_INVALID_ARG, "[E_INVALID_ARG] Invalid argument is used. groupIndex (%d).", groupIndex);
1248 _SlidableGroupObject* pGroupObject = dynamic_cast<_SlidableGroupObject*>(__groupsList.GetAt(groupIndex));
1249 SysTryReturn(NID_UI_CTRL, pGroupObject, E_SYSTEM, E_SYSTEM,
1250 "[E_SYSTEM] A system error has occurred. Failed to get _SlidableGroupObject at index (%d).", groupIndex);
1252 int topIndex = GetTopItemIndex(groupIndex);
1253 int subItemCount = GetSubItemCountAt(groupIndex);
1255 for (int itemCount = topIndex; itemCount < topIndex + subItemCount; itemCount++)
1257 RefreshItem(groupIndex, itemCount);
1265 _SlidableGroupedListImpl::IsLoadedItemEnabled(int groupIndex, int index) const
1267 if (IsItemLoaded(groupIndex, index) == false)
1272 return GetCore().IsItemEnabled(groupIndex, index);
1276 _SlidableGroupedListImpl::LoadItemToBottom(const CustomListItem& item, int itemId)
1278 SysTryReturn(NID_UI_CTRL, __isCreating == true, E_SUCCESS, E_SUCCESS,
1279 "[E_SUCCESS] This operation is ignored during creation of list.");
1281 int itemIndex = GetSubItemCountAt(__bottomGroup);
1283 _TableViewItemParams tableViewItemParams;
1284 tableViewItemParams.pItem = (const_cast<CustomListItem*>(&item));
1285 tableViewItemParams.width = GetCore().GetBounds().width;
1286 tableViewItemParams.groupIndex = __bottomGroup;
1287 tableViewItemParams.itemIndex = itemIndex;
1288 tableViewItemParams.isDividerEnabled = _isDividerEnabled;
1289 tableViewItemParams.pCheckBitmaps = _pCheckBitmaps;
1290 tableViewItemParams.itemId = itemId;
1291 tableViewItemParams.annexStyle = _annexStyle;
1293 result r = _CustomListItemImpl::CreateTableViewItem(tableViewItemParams);
1294 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
1296 item.__pCustomListItemImpl->itemId = itemId;
1298 r = InsertIntoItemsList(item, __bottomGroup, itemIndex, false);
1299 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, E_SYSTEM, r, "[%s] Propagating.", GetErrorMessage(r));
1305 _SlidableGroupedListImpl::LoadItemToTop(const CustomListItem& item, int itemId)
1307 SysTryReturn(NID_UI_CTRL, __isCreating == true, E_SUCCESS, E_SUCCESS,
1308 "[E_SUCCESS] This operation is ignored during creation of list.");
1310 _SlidableGroupObject* pGroupObject = dynamic_cast<_SlidableGroupObject*>(__groupsList.GetAt(__topGroup));
1311 SysTryReturn(NID_UI_CTRL, pGroupObject, E_SYSTEM, E_SYSTEM,
1312 "[E_SYSTEM] A system error has occurred. Failed to get _SlidableGroupObject at index (%d).", __topGroup);
1314 _TableViewItemParams tableViewItemParams;
1315 tableViewItemParams.pItem = (const_cast<CustomListItem*>(&item));
1316 tableViewItemParams.width = GetCore().GetBounds().width;
1317 tableViewItemParams.itemId = itemId;
1318 tableViewItemParams.itemIndex = pGroupObject->__topIndex;
1319 tableViewItemParams.groupIndex = __topGroup;
1320 tableViewItemParams.isDividerEnabled = _isDividerEnabled;
1321 tableViewItemParams.pCheckBitmaps = _pCheckBitmaps;
1322 tableViewItemParams.annexStyle = _annexStyle;
1324 result r = _CustomListItemImpl::CreateTableViewItem(tableViewItemParams);
1325 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
1327 item.__pCustomListItemImpl->itemId = itemId;
1329 r = InsertIntoItemsList(item, __topGroup, 0, false);
1330 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, E_SYSTEM, r, "[%s] Propagating.", GetErrorMessage(r));
1336 _SlidableGroupedListImpl::GetLoadedItemIndexFromItemId(int itemId, int& groupIndex, int& itemIndex) const
1338 for (int groupCount = __topGroup; groupCount <= __bottomGroup; groupCount++)
1340 for (int itemCount = 0; itemCount < GetSubItemCountAt(groupCount); itemCount++)
1342 const CustomListItem* pItem = GetCustomListItemAt(groupCount, itemCount);
1348 if (pItem->__pCustomListItemImpl->itemId == itemId)
1350 groupIndex = groupCount;
1351 itemIndex = itemCount;
1364 _SlidableGroupedListImpl::UnloadAllItems(void)
1366 result r = E_SUCCESS;
1371 SysTryReturn(NID_UI_CTRL, __pItemProvider, E_SYSTEM, E_SYSTEM,
1372 "[E_SYSTEM] A system error has occurred. ISlidableGroupedListEventListener not set.");
1374 __directDelete = true;
1376 for (groupCount = __groupsList.GetCount() - 1; groupCount >= 0; groupCount--)
1378 itemCount = GetSubItemCountAt(groupCount);
1380 for (itemIndex = itemCount - 1; itemIndex >= 0; itemIndex--)
1382 RemoveFromItemsList(groupCount, itemIndex);
1384 r = GetCore().RefreshTableView(groupCount, itemIndex, TABLE_VIEW_REFRESH_TYPE_ITEM_REMOVE);
1387 SysLog(NID_UI_CTRL, "Group item with index %d not removed successFully.", groupCount);
1390 _SlidableGroupObject* pGroupObject = dynamic_cast<_SlidableGroupObject*>(__groupsList.GetAt(groupCount));
1391 SysTryReturn(NID_UI_CTRL, pGroupObject, E_SYSTEM, E_SYSTEM,
1392 "[E_SYSTEM] A system error has occurred. Failed to get _SlidableGroupObject at index (%d).", groupCount);
1394 if (pGroupObject->__pCheckedList != null)
1396 pGroupObject->__pCheckedList->RemoveAt(itemIndex, true);
1399 CallUnloadItemCb(groupCount, itemIndex);
1403 __directDelete = false;
1409 _SlidableGroupedListImpl::RemoveAllCheckedItemsAt(int groupIndex, int itemHeight)
1411 SysTryReturn(NID_UI_CTRL, (_annexStyle != TABLE_VIEW_ANNEX_STYLE_NORMAL), E_SYSTEM, E_SYSTEM,
1412 "[E_SYSTEM] A system error has occurred. The list style is CUSTOM_LIST_STYLE_NORMAL.");
1413 SysTryReturn(NID_UI_CTRL, (_annexStyle != TABLE_VIEW_ANNEX_STYLE_RADIO), E_SYSTEM, E_SYSTEM,
1414 "[E_SYSTEM] A system error has occurred. The list style is CUSTOM_LIST_STYLE_RADIO.");
1416 SysTryReturn(NID_UI_CTRL, __pItemProvider, E_SYSTEM, E_SYSTEM,
1417 "[E_SYSTEM] A system error has occurred. ISlidableGroupedListEventListener not set.");
1419 SysTryReturn(NID_UI_CTRL, (groupIndex >= 0 && groupIndex < __groupsList.GetCount()),
1420 E_INVALID_ARG, E_INVALID_ARG, "[E_INVALID_ARG] Invalid argument is used. groupIndex (%d).", groupIndex);
1422 _SlidableGroupObject* pGroupObject = dynamic_cast<_SlidableGroupObject*>(__groupsList.GetAt(groupIndex));
1423 SysTryReturn(NID_UI_CTRL, pGroupObject, E_SYSTEM, E_SYSTEM,
1424 "[E_SYSTEM] A system error has occurred. Failed to get _SlidableGroupObject at index (%d).", groupIndex);
1426 result r = E_SUCCESS;
1427 Boolean* pChecked = null;
1430 for (; itemIndex < pGroupObject->__itemCount; itemIndex++)
1432 pChecked = dynamic_cast<Boolean*>(const_cast<Object*>(pGroupObject->__pCheckedList->GetAt(itemIndex)));
1433 SysTryReturn(NID_UI_CTRL, pChecked, E_SYSTEM, E_SYSTEM, "[E_SYSTEM] A system error has occurred.");
1435 if (pChecked->ToBool() == true)
1437 r = RemoveItemAt(groupIndex, itemIndex, itemHeight);
1440 SysLog(NID_UI_CTRL, "Failed to remove the itme at groupIndex (%d), itemIndex (%d).", groupIndex, itemIndex);
1450 _SlidableGroupedListImpl::RemoveAllCheckedItems(int itemHeight)
1452 SysTryReturn(NID_UI_CTRL, (_annexStyle != TABLE_VIEW_ANNEX_STYLE_NORMAL), E_SYSTEM, E_SYSTEM,
1453 "[E_SYSTEM] A system error has occurred. The list style is CUSTOM_LIST_STYLE_NORMAL.");
1454 SysTryReturn(NID_UI_CTRL, (_annexStyle != TABLE_VIEW_ANNEX_STYLE_RADIO), E_SYSTEM, E_SYSTEM,
1455 "[E_SYSTEM] A system error has occurred. The list style is CUSTOM_LIST_STYLE_RADIO.");
1457 SysTryReturn(NID_UI_CTRL, __pItemProvider, E_SYSTEM, E_SYSTEM,
1458 "[E_SYSTEM] A system error has occurred. ISlidableGroupedListEventListener not set.");
1462 for (; groupCount < __groupsList.GetCount(); groupCount++)
1464 RemoveAllCheckedItemsAt(groupCount, itemHeight);
1471 _SlidableGroupedListImpl::RemoveAllItemsAt(int groupIndex)
1473 result r = E_SUCCESS;
1475 SysTryReturn(NID_UI_CTRL, (groupIndex >= 0 && groupIndex < __groupsList.GetCount()),
1476 E_INVALID_ARG, E_INVALID_ARG, "[E_INVALID_ARG] Invalid argument is used. groupIndex (%d).", groupIndex);
1478 _SlidableGroupObject* pGroupObject = dynamic_cast<_SlidableGroupObject*>(__groupsList.GetAt(groupIndex));
1479 SysTryReturn(NID_UI_CTRL, pGroupObject, E_SYSTEM, E_SYSTEM,
1480 "[E_SYSTEM] A system error has occurred. Failed to get _SlidableGroupObject at index (%d).", groupIndex);
1482 __directDelete = true;
1484 for (int itemCount = 0; itemCount < GetSubItemCountAt(groupIndex);)
1486 r = RemoveItemAt(groupIndex, 0, 0);
1489 SysLog(NID_UI_CTRL, "Group item with index %d not removed successFully.", groupIndex);
1493 __directDelete = false;
1495 if (pGroupObject->__pCheckedList != null)
1497 pGroupObject->__pCheckedList->RemoveAll(true);
1500 pGroupObject->__itemCount = 0;
1506 _SlidableGroupedListImpl::RemoveAllItems(void)
1508 SysTryReturn(NID_UI_CTRL, __pItemProvider, E_SYSTEM, E_SYSTEM,
1509 "[E_SYSTEM] A system error has occurred. ISlidableGroupedListEventListener not set.");
1513 for (groupCount = 0; groupCount < __groupsList.GetCount(); groupCount++)
1515 RemoveAllItemsAt(groupCount);
1518 __pItemProvider->firstTime = true;
1524 _SlidableGroupedListImpl::RemoveFastScrollEventListener(IFastScrollEventListener& listener)
1526 __pFastScrollListener = null;
1530 _SlidableGroupedListImpl::RemoveGroupedItemEventListener(IGroupedItemEventListener& listener)
1532 _ListListener* pListenerList = null;
1534 for (int listenerCount = 0; listenerCount < __itemListenersList.GetCount(); listenerCount++)
1536 pListenerList = dynamic_cast<_ListListener*>(__itemListenersList.GetAt(listenerCount));
1538 if ((pListenerList != null) && (pListenerList->pListener == &listener))
1540 __itemListenersList.RemoveAt(listenerCount, true);
1547 _SlidableGroupedListImpl::RemoveItemAt(int groupIndex, int index, int itemHeight)
1549 SysTryReturn(NID_UI_CTRL, (groupIndex >= 0 && groupIndex < __groupsList.GetCount()),
1550 E_INVALID_ARG, E_INVALID_ARG, "[E_INVALID_ARG] Invalid argument is used. groupIndex (%d).", groupIndex);
1552 _SlidableGroupObject* pGroupObject = dynamic_cast<_SlidableGroupObject*>(__groupsList.GetAt(groupIndex));
1553 SysTryReturn(NID_UI_CTRL, pGroupObject, E_SYSTEM, E_SYSTEM,
1554 "[E_SYSTEM] A system error has occurred. Failed to get _SlidableGroupObject at index (%d).", groupIndex);
1556 int subItemCount = GetSubItemCountAt(groupIndex);
1558 SysTryReturn(NID_UI_CTRL, (index >= 0 && index < subItemCount),
1559 E_INVALID_ARG, E_INVALID_ARG, "[E_INVALID_ARG] Invalid argument is used. index (%d).", index);
1561 if (!(index < pGroupObject->__topIndex + subItemCount))
1563 pGroupObject->__itemCount--;
1567 __directDelete = true;
1569 RemoveFromItemsList(groupIndex, index);
1571 result r = GetCore().RefreshTableView(groupIndex, index, TABLE_VIEW_REFRESH_TYPE_ITEM_REMOVE);
1574 SysLog(NID_UI_CTRL, "Group item with index %d not removed successFully.", groupIndex);
1577 if (pGroupObject->__pCheckedList != null)
1579 pGroupObject->__pCheckedList->RemoveAt(index, true);
1582 __directDelete = false;
1584 CallUnloadItemCb(groupIndex, index);
1585 pGroupObject->__itemCount--;
1591 _SlidableGroupedListImpl::RemoveGroupAt(int groupIndex)
1593 SysTryReturn(NID_UI_CTRL, (groupIndex >= 0 && groupIndex < __groupsList.GetCount()),
1594 E_INVALID_ARG, E_INVALID_ARG, "[E_INVALID_ARG] Invalid argument is used. groupIndex (%d).", groupIndex);
1596 result r = E_SUCCESS;
1598 r = RemoveFromSubItemsList(groupIndex);
1599 SysTryReturn(NID_UI_CTRL, (r == E_SUCCESS), E_SYSTEM, r, "[%s] Propagating.", GetErrorMessage(r));
1601 r = RemoveFromItemsList(groupIndex, -1);
1602 SysTryReturn(NID_UI_CTRL, (r == E_SUCCESS), E_SYSTEM, r, "[%s] Propagating.", GetErrorMessage(r));
1604 __groupsList.RemoveAt(groupIndex, true);
1606 __directDelete = true;
1608 if (GetCore().GetFirstDrawnFlag() == false)
1610 r = GetCore().RefreshTableView(groupIndex, -1, TABLE_VIEW_REFRESH_TYPE_ITEM_REMOVE);
1611 SysTryReturn(NID_UI_CTRL, (r == E_SUCCESS), E_SYSTEM, r, "[%s] Propagating.", GetErrorMessage(r));
1614 __directDelete = false;
1620 _SlidableGroupedListImpl::ScrollToBottom(void)
1622 SysTryReturnVoidResult(NID_UI_CTRL, (__slidableListenersList.GetCount() > 0), E_SYSTEM,
1623 "[E_SYSTEM] A system error has occurred. No listeners available.");
1625 __forceScroll = true;
1627 _SlidableGroupObject* pGroupObject = dynamic_cast<_SlidableGroupObject*>(__groupsList.GetAt(__groupsList.GetCount() - 1));
1628 SysTryReturnVoidResult(NID_UI_CTRL, pGroupObject, E_SYSTEM,
1629 "[E_SYSTEM] A system error has occurred. Failed to get _SlidableGroupObject at index (%d).", __groupsList.GetCount() - 1);
1631 result r = GetCore().SetBottomDrawnItemIndex(__groupsList.GetCount() - 1, pGroupObject->__itemCount - 1);
1632 SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
1634 __forceScroll = false;
1640 _SlidableGroupedListImpl::ScrollToTop(int groupIndex)
1642 SysTryReturnResult(NID_UI_CTRL, (__slidableListenersList.GetCount() > 0), E_SYSTEM,
1643 "[E_SYSTEM] A system error has occurred. No listeners available.");
1645 SysTryReturn(NID_UI_CTRL, (groupIndex >= 0 && groupIndex < __groupsList.GetCount()),
1646 E_INVALID_ARG, E_INVALID_ARG, "[E_INVALID_ARG] Invalid argument is used. groupIndex (%d).", groupIndex);
1648 result r = E_SUCCESS;
1650 __forceScroll = true;
1652 r = GetCore().SetTopDrawnItemIndex(groupIndex, -1);
1653 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
1657 __forceScroll = false;
1663 _SlidableGroupedListImpl::ScrollToTop(int groupIndex, int itemIndex)
1665 SysTryReturnResult(NID_UI_CTRL, (__slidableListenersList.GetCount() > 0), E_SYSTEM,
1666 "[E_SYSTEM] A system error has occurred. No listeners available.");
1668 SysTryReturn(NID_UI_CTRL, (groupIndex >= 0 && groupIndex < __groupsList.GetCount()),
1669 E_INVALID_ARG, E_INVALID_ARG, "[E_INVALID_ARG] Invalid argument is used. groupIndex (%d).", groupIndex);
1671 _SlidableGroupObject* pGroupObject = dynamic_cast<_SlidableGroupObject*>(__groupsList.GetAt(groupIndex));
1672 SysTryReturn(NID_UI_CTRL, pGroupObject, E_SYSTEM, E_SYSTEM,
1673 "[E_SYSTEM] A system error has occurred. Failed to get _SlidableGroupObject at index (%d).", groupIndex);
1675 SysTryReturn(NID_UI_CTRL, (itemIndex >= 0 && itemIndex < pGroupObject->__itemCount),
1676 E_INVALID_ARG, E_INVALID_ARG, "[E_INVALID_ARG] Invalid argument is used. itemIndex (%d).", itemIndex);
1678 result r = E_SUCCESS;
1680 __forceScroll = true;
1682 r = GetCore().SetTopDrawnItemIndex(groupIndex, itemIndex);
1683 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
1687 __forceScroll = false;
1693 _SlidableGroupedListImpl::ScrollToTop(void)
1695 SysTryReturnVoidResult(NID_UI_CTRL, (__slidableListenersList.GetCount() > 0), E_SYSTEM,
1696 "[E_SYSTEM] A system error has occurred. No listeners available.");
1698 __forceScroll = true;
1700 result r = GetCore().SetTopDrawnItemIndex(0, -1);
1701 SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
1705 __forceScroll = false;
1709 _SlidableGroupedListImpl::SetAllItemsChecked(int groupIndex, bool check)
1711 SysTryReturn(NID_UI_CTRL, (_annexStyle != TABLE_VIEW_ANNEX_STYLE_NORMAL), E_SYSTEM, E_SYSTEM,
1712 "[E_SYSTEM] A system error has occurred. The list style is CUSTOM_LIST_STYLE_NORMAL.");
1713 SysTryReturn(NID_UI_CTRL, (_annexStyle != TABLE_VIEW_ANNEX_STYLE_RADIO), E_SYSTEM, E_SYSTEM,
1714 "[E_SYSTEM] A system error has occurred. The list style is CUSTOM_LIST_STYLE_RADIO.");
1716 SysTryReturn(NID_UI_CTRL, (groupIndex >= 0 && groupIndex < GetGroupCount()),
1717 E_INVALID_ARG, E_INVALID_ARG, "[E_INVALID_ARG] Invalid argument is used. groupIndex (%d).", groupIndex);
1719 _SlidableGroupObject* pGroupObject = dynamic_cast<_SlidableGroupObject*>(__groupsList.GetAt(groupIndex));
1720 SysTryReturn(NID_UI_CTRL, pGroupObject, E_SYSTEM, E_SYSTEM, "[E_SYSTEM]");
1722 for (int indexItem = 0; indexItem < pGroupObject->__itemCount; indexItem++)
1724 Boolean* pChecked = new (std::nothrow) Boolean(check);
1725 SysTryReturn(NID_UI_CTRL, pChecked, E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed");
1727 pGroupObject->__pCheckedList->SetAt(*pChecked, indexItem, true);
1729 _CheckElementModel*pCheckElement = GetCheckElementAt(groupIndex, indexItem);
1730 SysTryReturnResult(NID_UI_CTRL, (pCheckElement != null), E_SYSTEM, "A system error has occurred.");
1732 pCheckElement->SetCheckBoxStatus((_CheckBoxBitmapType)check);
1735 GetCore().Invalidate(true);
1741 _SlidableGroupedListImpl::SetItemAt(int groupIndex, int itemIndex, const CustomListItem& item, int itemId)
1743 SysTryReturn(NID_UI_CTRL, (groupIndex >= 0 && groupIndex < __groupsList.GetCount()),
1744 E_INVALID_ARG, E_INVALID_ARG, "[E_INVALID_ARG] Invalid argument is used. groupIndex (%d).", groupIndex);
1746 SysTryReturn(NID_UI_CTRL, ((itemIndex >= 0) && (itemIndex < GetSubItemCountAt(groupIndex))),
1747 E_INVALID_ARG, E_INVALID_ARG, "[E_INVALID_ARG] Invalid argument is used. itemIndex (%d).", itemIndex);
1749 SysTryReturnResult(NID_UI_CTRL, (IsItemNew(item) == true), E_SYSTEM, "[E_SYSTEM] A system error has occurred. The item already exists.");
1751 _CheckElementModel* pOldCheckElement = GetCheckElementAt(groupIndex, itemIndex - GetTopItemIndex(groupIndex));
1752 _CheckElementModel* pNewCheckElement = item.__pCustomListItemImpl->GetCheckElement();
1754 if (pNewCheckElement && pOldCheckElement)
1756 pNewCheckElement->SetCheckBoxStatus(pOldCheckElement->GetCheckBoxStatus());
1759 item.__pCustomListItemImpl->__pTableViewItemData = GetTableViewItemAt(groupIndex, itemIndex);
1760 item.__pCustomListItemImpl->itemId = itemId;
1762 result r = SetInItemsList(item, groupIndex, itemIndex);
1763 SysTryReturn(NID_UI_CTRL, (r == E_SUCCESS), r, r, "[%s] Propagating.", GetErrorMessage(r));
1765 r = GetCore().RefreshTableView(groupIndex, itemIndex, TABLE_VIEW_REFRESH_TYPE_ITEM_MODIFY);
1766 SysTryReturn(NID_UI_CTRL, (r == E_SUCCESS), r, r, "[%s] Propagating.", GetErrorMessage(r));
1772 _SlidableGroupedListImpl::UpdateCheckedList(int groupIndex, int index, bool check)
1774 _SlidableGroupObject* pGroupObject = dynamic_cast<_SlidableGroupObject*>(__groupsList.GetAt(groupIndex));
1775 SysTryReturn(NID_UI_CTRL, (pGroupObject != null), E_SYSTEM, E_SYSTEM,
1776 "[E_SYSTEM] A system error has occurred. Failed to get _SlidableGroupObject at groupIndex (%d).", groupIndex);
1778 SysTryReturn(NID_UI_CTRL, (pGroupObject->__pCheckedList != null), E_SYSTEM, E_SYSTEM,
1779 "[E_SYSTEM] A system error has occurred. Failed to get checked list at groupIndex (%d).", groupIndex);
1781 Boolean* pChecked = new (std::nothrow) Boolean(check);
1782 SysTryReturn(NID_UI_CTRL, pChecked, E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
1783 pGroupObject->__pCheckedList->SetAt(*pChecked, index, true);
1789 _SlidableGroupedListImpl::SetItemCheckedRadio(int groupIndex, int index, bool check)
1793 if (_currentRadioIndex != -1)
1795 _CheckElementModel* pOldCheckElement = GetCheckElementAt(_currentRadioGroupIndex, _currentRadioIndex);
1796 SysTryReturnResult(NID_UI_CTRL, (pOldCheckElement != null), E_SYSTEM, "A system error has occurred.");
1798 pOldCheckElement->SetCheckBoxStatus(CHECK_BOX_UNCHECKED);
1800 UpdateCheckedList(_currentRadioGroupIndex, _currentRadioIndex, false);
1802 DrawItem(_currentRadioGroupIndex, _currentRadioIndex);
1805 _currentRadioGroupIndex = groupIndex;
1806 _currentRadioIndex = index;
1808 UpdateCheckedList(groupIndex, index, true);
1812 UpdateCheckedList(groupIndex, index, false);
1814 _currentRadioGroupIndex = -1;
1815 _currentRadioIndex = -1;
1818 DrawItem(groupIndex, index);
1824 _SlidableGroupedListImpl::SetItemCheckedMarkOnOff(int groupIndex, int index, bool check)
1826 _CheckElementModel* pCheckElement = GetCheckElementAt(groupIndex, index);
1827 SysTryReturnResult(NID_UI_CTRL, (pCheckElement != null), E_SYSTEM, "A system error has occurred.");
1829 pCheckElement->SetCheckBoxStatus((_CheckBoxBitmapType)check);
1831 UpdateCheckedList(groupIndex, index, check);
1833 DrawItem(groupIndex, index);
1839 _SlidableGroupedListImpl::SetItemChecked(int groupIndex, int index, bool check)
1841 SysTryReturn(NID_UI_CTRL, (_annexStyle != TABLE_VIEW_ANNEX_STYLE_NORMAL), E_SYSTEM, E_SYSTEM,
1842 "[E_SYSTEM] A system error has occurred. The list style is CUSTOM_LIST_STYLE_NORMAL.");
1844 SysTryReturn(NID_UI_CTRL, (groupIndex >= 0 && groupIndex < __groupsList.GetCount()),
1845 E_INVALID_ARG, E_INVALID_ARG, "[E_INVALID_ARG] Invalid argument is used. groupIndex (%d).", groupIndex);
1847 _SlidableGroupObject* pGroupObject = dynamic_cast<_SlidableGroupObject*>(__groupsList.GetAt(groupIndex));
1848 SysTryReturn(NID_UI_CTRL, (pGroupObject != null), E_SYSTEM, E_SYSTEM,
1849 "[E_SYSTEM] A system error has occurred. Failed to get _SlidableGroupObject at groupIndex (%d).", groupIndex);
1851 SysTryReturn(NID_UI_CTRL, (index >= 0 && index < pGroupObject->__itemCount),
1852 E_INVALID_ARG, E_INVALID_ARG, "[E_INVALID_ARG] Invalid argument is used. index (%d).", index);
1854 if (IsItemChecked(groupIndex, index) == check)
1859 SysTryReturnResult(NID_UI_CTRL, (GetCore().IsItemEnabled(groupIndex, index)), E_SYSTEM, "[E_SYSTEM] A system error has occurred. The list item is not enabled.");
1861 if (_annexStyle == TABLE_VIEW_ANNEX_STYLE_RADIO)
1863 return SetItemCheckedRadio(groupIndex, index, check);
1867 return SetItemCheckedMarkOnOff(groupIndex, index, check);
1872 _SlidableGroupedListImpl::SetLoadedItemEnabled(int groupIndex, int index, bool enable)
1874 SysTryReturn(NID_UI_CTRL, (groupIndex >= 0 && groupIndex < __groupsList.GetCount()),
1875 E_INVALID_ARG, E_INVALID_ARG, "[E_INVALID_ARG] Invalid argument is used. groupIndex (%d).", groupIndex);
1877 _SlidableGroupObject* pGroupObject = dynamic_cast<_SlidableGroupObject*>(__groupsList.GetAt(groupIndex));
1878 SysTryReturn(NID_UI_CTRL, pGroupObject, E_SYSTEM, E_SYSTEM,
1879 "[E_SYSTEM] A system error has occurred. Failed to get _SlidableGroupObject at groupIndex (%d).", groupIndex);
1881 SysTryReturn(NID_UI_CTRL, (index >= 0 && index < pGroupObject->__itemCount),
1882 E_INVALID_ARG, E_INVALID_ARG, "[E_INVALID_ARG] Invalid argument is used. index (%d).", index);
1884 return GetCore().SetItemEnabled(groupIndex, index, enable);
1888 _SlidableGroupedListImpl::SetTextColorOfEmptyList(const Color& color)
1890 GetCore().SetTextColorOfEmptyTableView(color);
1894 _SlidableGroupedListImpl::SetTextOfEmptyList(const String& text)
1896 GetCore().SetTextOfEmptyTableView(text);
1900 _SlidableGroupedListImpl::SetGroupAt(int groupIndex, const String& text, const Bitmap* pBackgroundBitmap, int groupId)
1902 result r = E_SUCCESS;
1904 SysTryReturnResult(NID_UI_CTRL, (groupIndex >= 0 && groupIndex < __groupsList.GetCount()),
1905 E_INVALID_ARG, "Invalid argument is used. groupIndex (%d).", groupIndex);
1907 _SlidableGroupObject* pOldGroup = dynamic_cast<_SlidableGroupObject*>(__groupsList.GetAt(groupIndex));
1908 SysTryReturn(NID_UI_CTRL, pOldGroup, E_SYSTEM, E_SYSTEM,
1909 "[E_SYSTEM] A system error has occurred. Failed to get _SlidableGroupObject at groupIndex (%d).", groupIndex);
1911 CustomListItem* pCustomListItem = GetCustomListItemAt(groupIndex, -1);
1912 SysTryReturn(NID_UI_CTRL, (pCustomListItem), E_SYSTEM, E_SYSTEM,
1913 "[E_SYSTEM] A system error has occurred. Failed to get CustomListItem at groupIndex (%d).", groupIndex);
1915 pCustomListItem->SetElement(ID_FORMAT_STRING, text);
1917 if (pBackgroundBitmap != null)
1919 pCustomListItem->SetNormalItemBackgroundBitmap(*pBackgroundBitmap);
1922 pCustomListItem->__pCustomListItemImpl->itemId = groupId;
1924 _TableViewItemUpdateParams updateParams;
1925 updateParams.pItem = pCustomListItem;
1926 updateParams.isDividerEnabled = _isDividerEnabled;
1927 updateParams.pCheckBitmaps = _pCheckBitmaps;
1928 updateParams.annexStyle = _annexStyle;
1930 r = _CustomListItemImpl::UpdateTableViewItem(updateParams);
1931 SysTryReturnResult(NID_UI_CTRL, (r == E_SUCCESS), E_SYSTEM, "A system error has occurred. Failed to update an item.");
1937 _SlidableGroupedListImpl::OnTableViewItemStateChanged(_TableView& tableView, int itemIndex, _TableViewItem* pItem, TableViewItemStatus status)
1943 _SlidableGroupedListImpl::OnTableViewContextItemActivationStateChanged(_TableView& tableView, int itemIndex, _TableViewItem* pContextItem, bool activated)
1949 _SlidableGroupedListImpl::OnTableViewItemReordered(_TableView& tableView, int itemIndexFrom, int itemIndexTo)
1955 _SlidableGroupedListImpl::OnGroupedTableViewGroupItemStateChanged(_TableView& tableView, int groupIndex, _TableViewItem* pItem, TableViewItemStatus status)
1961 _SlidableGroupedListImpl::OnGroupedTableViewItemStateChanged(_TableView& tableView, int groupIndex, int itemIndex, _TableViewItem* pItem, TableViewItemStatus status)
1963 CustomListItem* pCustomListItem = GetCustomListItemAt(groupIndex, itemIndex - GetTopItemIndex(groupIndex));
1964 SysTryReturnVoidResult(NID_UI_CTRL, pCustomListItem, E_SYSTEM, "[E_SYSTEM] A system error has occurred. Failed to get CustomListItem at itemIndex (%d).", itemIndex);
1966 CustomListItemStatus customListItemStatus = CUSTOM_LIST_ITEM_STATUS_NORMAL;
1967 ItemStatus itemStatus = ITEM_HIGHLIGHTED;
1971 case TABLE_VIEW_ITEM_STATUS_SELECTED:
1972 itemStatus = ITEM_SELECTED;
1973 customListItemStatus = CUSTOM_LIST_ITEM_STATUS_SELECTED;
1975 case TABLE_VIEW_ITEM_STATUS_HIGHLIGHTED:
1976 itemStatus = ITEM_HIGHLIGHTED;
1977 customListItemStatus = CUSTOM_LIST_ITEM_STATUS_FOCUSED;
1979 case TABLE_VIEW_ITEM_STATUS_CHECKED:
1980 itemStatus = ITEM_CHECKED;
1982 case TABLE_VIEW_ITEM_STATUS_UNCHECKED:
1983 itemStatus = ITEM_UNCHECKED;
1986 SetLastResult(E_INVALID_ARG);
1987 SysLog(NID_UI_CTRL, "[E_INVALID_ARG] Invalid argument is used. ListItemStatus is invalid");
1991 LinkedList* pElements = &pCustomListItem->__pCustomListItemImpl->elements;
1992 _ElementBaseModel* pElementBase = null;
1994 for (int i = 0; i < pElements->GetCount(); i++)
1996 pElementBase = dynamic_cast<_ElementBaseModel*>(pElements->GetAt(i));
1997 SysTryReturnVoidResult(NID_UI_CTRL, (pElementBase != null), E_SYSTEM, "Invalid element.");
1999 if ((_isDividerEnabled && pElementBase->_elementType != LIST_ITEM_ELEMENT_TYPE_CHECKBOX) || (!_isDividerEnabled))
2001 pElementBase->HandleElementEvent(customListItemStatus);
2005 if ((!_isDividerEnabled) && (_annexStyle != TABLE_VIEW_ANNEX_STYLE_NORMAL))
2007 bool isChecked = IsItemChecked(groupIndex, itemIndex);
2011 itemStatus = ITEM_UNCHECKED;
2015 itemStatus = ITEM_CHECKED;
2018 SetItemChecked(groupIndex, itemIndex, !isChecked);
2021 ProcessItemStateChange(groupIndex, itemIndex, itemStatus);
2028 _SlidableGroupedListImpl::OnGroupedTableViewContextItemActivationStateChanged(_TableView& tableView, int groupIndex, int itemIndex, _TableViewItem* pContextItem, bool activated)
2034 _SlidableGroupedListImpl::OnGroupedTableViewItemReordered(Tizen::Ui::Controls::_TableView& tableView, int groupIndexFrom, int itemIndexFrom, int groupIndexTo, int itemIndexTo)
2040 _SlidableGroupedListImpl::OnSectionTableViewItemStateChanged(_TableView& tableView, int sectionIndex, int itemIndex, _TableViewItem* pItem, TableViewItemStatus status)
2046 _SlidableGroupedListImpl::OnSectionTableViewContextItemActivationStateChanged(_TableView& tableView, int sectionIndex, int itemIndex, _TableViewItem* pContextItem, bool activated)
2052 _SlidableGroupedListImpl::OnTableViewItemSwept(Tizen::Ui::Controls::_TableView& tableView, int groupIndex, int itemIndex, Tizen::Ui::Controls::TableViewSweepDirection direction)
2058 _SlidableGroupedListImpl::OnDraw(void)
2060 if (__pItemProvider == null)
2062 result r = E_SUCCESS;
2064 r = CreateItemProvider();
2065 SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
2068 _ListBaseImpl::OnDraw();
2072 _SlidableGroupedListImpl::CreateItemProvider(void)
2074 if (__pItemProvider == null)
2076 __pItemProvider = new (std::nothrow) _SlidableGroupedListItemProvider(this);
2077 SysTryReturnResult(NID_UI_CTRL, __pItemProvider, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
2079 TableViewStyle style = GetCore().GetTableViewStyle();
2080 SysTryReturnResult(NID_UI_CTRL, style == TABLE_VIEW_STYLE_GROUPED, E_INVALID_OPERATION,
2081 "[E_INVALID_OPERATION] The style of TableView is not TABLE_VIEW_STYLE_GROUPED");
2083 _TableViewItemProvider* pItemProvider = _TableViewItemProvider::CreateTableViewItemProviderN(style);
2084 result r = GetLastResult();
2085 SysTryReturnResult(NID_UI_CTRL, pItemProvider != null, r, "[%s] Propagating.", GetErrorMessage(r));
2087 pItemProvider->SetGroupedStyleItemProvider(__pItemProvider);
2089 GetCore().SetItemProvider(pItemProvider);
2096 _SlidableGroupedListImpl::Initialize(void)
2098 GetCore().AddGroupedTableViewItemEventListener(*this);
2099 GET_SHAPE_CONFIG(TABLEVIEW::GROUPITEM_DEFAULT_HEIGHT, GetCore().GetOrientation(), __groupItemHeight);
2100 GET_SHAPE_CONFIG(TABLEVIEW::GROUPITEM_DEFAULT_FONT_SIZE, GetCore().GetOrientation(), __groupItemTextFont);
2102 __itemCacheSize = GetCore().GetMaxItemCachingSize();
2104 __pItemFormat = new (std::nothrow) CustomListItemFormat();
2105 SysTryReturnVoidResult(NID_UI_CTRL, __pItemFormat, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
2107 __pItemFormat->Construct();
2110 GET_SHAPE_CONFIG(TABLEVIEW::GROUPITEM_INDEX_BAR_LEFT_MARGIN, GetCore().GetOrientation(), leftMargin);
2112 __pItemFormat->AddElement(ID_FORMAT_MARGIN, Rectangle(0, 0, leftMargin, __groupItemHeight), __groupItemTextFont);
2113 __pItemFormat->AddElement(ID_FORMAT_STRING, Rectangle(leftMargin, 0, GetCore().GetBounds().width, __groupItemHeight), __groupItemTextFont);
2115 __pItemFormat->SetElementEventEnabled(ID_FORMAT_MARGIN, true);
2116 __pItemFormat->SetElementEventEnabled(ID_FORMAT_STRING, true);
2122 _SlidableGroupedListImpl::OnUiFastScrollIndexSelected(_Control& source, _FastScrollIndex& index)
2126 String* pIndexText = index.GetIndexText();
2127 if (pIndexText != null)
2129 pIndexText->GetCharAt(0, mch);
2130 result r = __mainScrollIndex.IndexOf(*pIndexText, 0, groupIndex);
2133 const Control& control = GetPublic();
2134 _FastScrollIndex* pMainIndex = index.GetParentIndex();
2135 if (pMainIndex == GetCore().GetFastScrollBar()->GetIndex())
2137 Character mainIndex(mch);
2138 __pFastScrollListener->OnMainIndexChanged(control, mainIndex);
2142 Character subIndex(mch);
2143 pIndexText = pMainIndex->GetIndexText();
2144 if (pIndexText != null)
2146 pIndexText->GetCharAt(0, mch);
2147 Character mainIndex(mch);
2148 __pFastScrollListener->OnSubIndexChanged(control, mainIndex, subIndex);
2153 SetLastResult(E_SUCCESS);
2157 _SlidableGroupedListImpl::GetPublicClassName(void) const
2159 return "SlidableGroupedList";
2162 const SlidableGroupedList&
2163 _SlidableGroupedListImpl::GetPublic(void) const
2165 return static_cast<const SlidableGroupedList&>(_ControlImpl::GetPublic());
2168 SlidableGroupedList&
2169 _SlidableGroupedListImpl::GetPublic(void)
2171 return static_cast<SlidableGroupedList&>(_ControlImpl::GetPublic());
2175 _SlidableGroupedListImpl::GetCore(void) const
2177 return static_cast<const _TableView&>(_ControlImpl::GetCore());
2181 _SlidableGroupedListImpl::GetCore(void)
2183 return static_cast<_TableView&>(_ControlImpl::GetCore());
2187 _SlidableGroupedListImpl::ProcessItemStateChange(int groupIndex, int itemIndex, int elementId, ItemStatus itemStatus)
2189 CustomListItem* pCustomListItem = GetCustomListItemAt(groupIndex, itemIndex - GetTopItemIndex(groupIndex));
2190 SysTryReturnVoidResult(NID_UI_CTRL, pCustomListItem, E_SYSTEM, "[E_SYSTEM] A system error has occurred. Failed to get CustomListItem at itemIndex (%d).", itemIndex);
2192 int itemId = pCustomListItem->__pCustomListItemImpl->itemId;
2194 _ListListener* pListenerList = null;
2195 IGroupedItemEventListener* pEventListener = null;
2197 for (int listenerCount = 0; listenerCount < __itemListenersList.GetCount(); listenerCount++)
2199 pListenerList = dynamic_cast<_ListListener*>(__itemListenersList.GetAt(listenerCount));
2200 SysTryReturnVoidResult(NID_UI_CTRL, (pListenerList != null), E_SYSTEM,
2201 "[E_SYSTEM] A system error has occurred. Failed to get _ListListener.");
2203 pEventListener = dynamic_cast<IGroupedItemEventListener*>(pListenerList->pListener);
2204 SysTryReturnVoidResult(NID_UI_CTRL, (pEventListener != null), E_SYSTEM,
2205 "[E_SYSTEM] A system error has occurred. Failed to get IGroupedItemEventListener.");
2207 pEventListener->OnItemStateChanged(GetPublic(), groupIndex, itemIndex, itemId, elementId, itemStatus);
2212 _SlidableGroupedListImpl::ProcessItemStateChange(int groupIndex, int itemIndex, ItemStatus itemStatus)
2214 CustomListItem* pCustomListItem = GetCustomListItemAt(groupIndex, itemIndex - GetTopItemIndex(groupIndex));
2215 SysTryReturnVoidResult(NID_UI_CTRL, pCustomListItem, E_SYSTEM, "[E_SYSTEM] A system error has occurred. Failed to get CustomListItem at itemIndex (%d).", itemIndex);
2217 int itemId = pCustomListItem->__pCustomListItemImpl->itemId;
2219 _ListListener* pListenerList = null;
2220 IGroupedItemEventListener* pEventListener = null;
2222 for (int listenerCount = 0; listenerCount < __itemListenersList.GetCount(); listenerCount++)
2224 pListenerList = dynamic_cast<_ListListener*>(__itemListenersList.GetAt(listenerCount));
2225 SysTryReturnVoidResult(NID_UI_CTRL, (pListenerList != null), E_SYSTEM,
2226 "[E_SYSTEM] A system error has occurred. Failed to get _ListListener.");
2228 pEventListener = dynamic_cast<IGroupedItemEventListener*>(pListenerList->pListener);
2229 SysTryReturnVoidResult(NID_UI_CTRL, (pEventListener != null), E_SYSTEM,
2230 "[E_SYSTEM] A system error has occurred. Failed to get IGroupedItemEventListener.");
2232 pEventListener->OnItemStateChanged(GetPublic(), groupIndex, itemIndex, itemId, itemStatus);
2237 _SlidableGroupedListImpl::CallUnloadItemCb(int groupIndex, int itemIndex)
2239 _ListListener* pListenerData = null;
2240 ISlidableGroupedListEventListener* pSlidableListener = null;
2242 for (int listenerCount = 0; listenerCount < __slidableListenersList.GetCount(); listenerCount++)
2244 pListenerData = dynamic_cast<_ListListener*>(__slidableListenersList.GetAt(listenerCount));
2245 SysTryReturnVoidResult(NID_UI_CTRL, (pListenerData != null), E_SYSTEM,
2246 "[E_SYSTEM] A system error has occurred. Failed to get _ListListener.");
2248 pSlidableListener = dynamic_cast<ISlidableGroupedListEventListener*>(pListenerData->pListener);
2249 SysTryReturnVoidResult(NID_UI_CTRL, (pSlidableListener != null), E_SYSTEM,
2250 "[E_SYSTEM] A system error has occurred. Failed to get IGroupedItemEventListener.");
2252 pSlidableListener->OnUnloadItemRequested(GetPublic(), groupIndex, itemIndex);
2257 _SlidableGroupedListImpl::GetCurrentLoadedCount(void)
2261 for (int groupIndex = __topGroup; groupIndex <= __bottomGroup; groupIndex++)
2263 _TableViewGroupItemData* pTableViewGroupItemData = GetTableViewGroupItemAt(groupIndex);
2265 if (pTableViewGroupItemData)
2270 count += GetSubItemCountAt(groupIndex);
2277 _SlidableGroupedListImpl::GetTopItemIndex(int groupIndex) const
2279 _SlidableGroupObject* pGroupObject = dynamic_cast<_SlidableGroupObject*>(const_cast<Object*>(__groupsList.GetAt(groupIndex)));
2280 SysTryReturn(NID_UI_CTRL, pGroupObject, INVALID_INDEX, E_SYSTEM,
2281 "[E_SYSTEM] A system error has occurred. Failed to get _SlidableGroupObject at groupIndex (%d).", groupIndex);
2283 return pGroupObject->__topIndex;
2286 class _SlidableGroupedListMaker
2287 : public _UiBuilderControlMaker
2290 _SlidableGroupedListMaker(_UiBuilder* uibuilder)
2291 : _UiBuilderControlMaker(uibuilder){};
2292 virtual ~_SlidableGroupedListMaker(){};
2293 static _UiBuilderControlMaker*
2294 GetInstance(_UiBuilder* uibuilder)
2296 _SlidableGroupedListMaker* pSlidableListMaker = new (std::nothrow) _SlidableGroupedListMaker(uibuilder);
2297 return pSlidableListMaker;
2300 virtual Tizen::Ui::Control*
2301 Make(_UiBuilderControl* pControl)
2303 result r = E_SYSTEM;
2304 _UiBuilderControlLayout* pControlProperty = null;
2305 SlidableGroupedList* pSlidableGroupedList = null;
2306 Tizen::Graphics::Rectangle rect;
2307 Tizen::Graphics::Rectangle rectMin;
2309 Tizen::Base::String elementString;
2310 CustomListStyle style = CUSTOM_LIST_STYLE_NORMAL;
2311 bool isItemDivider = true;
2314 GetProperty(pControl, &pControlProperty);
2315 if (pControlProperty == null)
2320 pSlidableGroupedList = new (std::nothrow) SlidableGroupedList();
2321 if (pSlidableGroupedList == null)
2326 rect = pControlProperty->GetRect();
2328 Tizen::Base::String styleString;
2329 styleString = pControlProperty->GetStyle();
2331 if (styleString.Equals(L"CUSTOM_LIST_STYLE_NORMAL", false))
2333 style = CUSTOM_LIST_STYLE_NORMAL;
2335 else if (styleString.Equals(L"CUSTOM_LIST_STYLE_RADIO", false))
2337 style = CUSTOM_LIST_STYLE_RADIO;
2339 else if (styleString.Equals(L"CUSTOM_LIST_STYLE_RADIO_WITH_DIVIDER", false))
2341 style = CUSTOM_LIST_STYLE_RADIO_WITH_DIVIDER;
2343 else if (styleString.Equals(L"CUSTOM_LIST_STYLE_MARK", false))
2345 style = CUSTOM_LIST_STYLE_MARK;
2347 else if (styleString.Equals(L"CUSTOM_LIST_STYLE_MARK_WITH_DIVIDER", false))
2349 style = CUSTOM_LIST_STYLE_MARK_WITH_DIVIDER;
2351 else if (styleString.Equals(L"CUSTOM_LIST_STYLE_ONOFF", false))
2353 style = CUSTOM_LIST_STYLE_ONOFF;
2355 else if (styleString.Equals(L"CUSTOM_LIST_STYLE_ONOFF_WITH_DIVIDER", false))
2357 style = CUSTOM_LIST_STYLE_ONOFF_WITH_DIVIDER;
2361 style = CUSTOM_LIST_STYLE_NORMAL;
2365 if (pControl->GetElement(L"itemDivider", elementString))
2367 if (elementString.Equals(L"true", false))
2369 isItemDivider = true;
2373 isItemDivider = false;
2377 r = pSlidableGroupedList->Construct(rect, style, isItemDivider);
2380 delete pSlidableGroupedList;
2384 if (pControl->GetElement(L"textOfEmptyList", elementString))
2386 pSlidableGroupedList->SetTextOfEmptyList(elementString);
2389 if (pControl->GetElement(L"colorOfEmptyListText", elementString))
2391 ConvertStringToColor(elementString, color);
2392 pSlidableGroupedList->SetTextColorOfEmptyList(color);
2395 GET_DIMENSION_CONFIG(LIST::GROUPEDLIST_MIN_SIZE, _CONTROL_ORIENTATION_PORTRAIT, dimMin);
2396 rectMin = (pControl->GetAttribute(0))->GetRect();
2397 (pControl->GetAttribute(0))->SetRect(rectMin.x, rectMin.y, dimMin.width, dimMin.height);
2399 GET_DIMENSION_CONFIG(LIST::GROUPEDLIST_MIN_SIZE, _CONTROL_ORIENTATION_LANDSCAPE, dimMin);
2400 rectMin = (pControl->GetAttribute(1))->GetRect();
2401 (pControl->GetAttribute(1))->SetRect(rectMin.x, rectMin.y, dimMin.width, dimMin.height);
2403 return pSlidableGroupedList;
2409 _SlidableGroupedListRegister::_SlidableGroupedListRegister()
2411 _UiBuilderControlTableManager* pUiBuilderControlTableManager = _UiBuilderControlTableManager::GetInstance();
2412 if (pUiBuilderControlTableManager)
2414 pUiBuilderControlTableManager->RegisterControl(L"SlidableGroupedList", _SlidableGroupedListMaker::GetInstance);
2417 _SlidableGroupedListRegister::~_SlidableGroupedListRegister()
2419 _UiBuilderControlTableManager* pUiBuilderControlTableManager = _UiBuilderControlTableManager::GetInstance();
2420 if (pUiBuilderControlTableManager)
2422 pUiBuilderControlTableManager->UnregisterControl(L"SlidableGroupedList");
2425 static _SlidableGroupedListRegister SlidableGroupedListRegisterToUiBuilder;
2426 }}} //Tizen::Ui::Controls