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.
20 * @file FUiCtrl_SlidableGroupedListImpl.cpp
21 * @brief This is the implementation file for the _SlidableGroupedListImpl class.
24 #include <FUiCtrlCustomListItem.h>
25 #include <FUiCtrlCustomListItemFormat.h>
26 #include "FUiCtrl_CustomListItemFormatImpl.h"
27 #include "FUiCtrl_CustomListItemImpl.h"
28 #include "FUiCtrl_SlidableGroupedListImpl.h"
29 #include "FUi_ResourceManager.h"
30 #include "FUiCtrl_ListListener.h"
31 #include "FUi_UiBuilder.h"
32 #include "FUiCtrl_TableViewPresenter.h"
33 #include "FUiCtrl_FastScroll.h"
34 #include "FUiCtrl_FastScrollIndex.h"
35 #include "FUi_ResourceSizeInfo.h"
36 #include "FUi_CoordinateSystemUtils.h"
38 using namespace Tizen::Graphics;
39 using namespace Tizen::Base;
40 using namespace Tizen::Base::Collection;
41 using namespace Tizen::Base::Runtime;
42 using namespace Tizen::Base::Utility;
44 namespace Tizen { namespace Ui { namespace Controls {
46 static const int ID_FORMAT_STRING = 1;
47 static const int ID_FORMAT_MARGIN = 2;
48 extern const int INVALID_INDEX;
50 _SlidableGroupedListItemProvider::_SlidableGroupedListItemProvider(_SlidableGroupedListImpl* pListImpl)
52 , __pListImpl(pListImpl)
53 , __bottomListenerIndex(0)
54 , __topListenerIndex(0)
56 if (__pListImpl != null)
58 __topListenerIndex = __pListImpl->__slidableListenersList.GetCount() - 1;
63 _SlidableGroupedListItemProvider::GetGroupCount(void)
65 if (__pListImpl == null)
70 if (__pListImpl->__slidableListenersList.GetCount() > 0)
72 if (firstTime == true)
74 _ListListener* pListenerData = null;
75 ISlidableGroupedListEventListener* pSlidableGroupedListener = null;
76 int listenerCount = 0;
78 for (listenerCount = 0; listenerCount < __pListImpl->__slidableListenersList.GetCount(); listenerCount++)
80 pListenerData = dynamic_cast<_ListListener*>(__pListImpl->__slidableListenersList.GetAt(listenerCount));
81 SysTryReturn(NID_UI_CTRL, (pListenerData != null), -1, E_SYSTEM,
82 "[E_SYSTEM] A system error has occurred. Failed to get _ListListener");
84 pSlidableGroupedListener = dynamic_cast<ISlidableGroupedListEventListener*>(pListenerData->pListener);
85 SysTryReturn(NID_UI_CTRL, (pSlidableGroupedListener != null), -1, E_SYSTEM,
86 "[E_SYSTEM] A system error has occurred. Failed to get ISlidableGroupedListEventListener");
88 pSlidableGroupedListener->OnListPropertyRequested(__pListImpl->GetPublic());
93 return __pListImpl->GetGroupCount();
100 _SlidableGroupedListItemProvider::GetItemCount(int groupIndex)
102 _SlidableGroupObject* pGroupObject = dynamic_cast<_SlidableGroupObject*>(__pListImpl->__groupsList.GetAt(groupIndex));
103 SysTryReturn(NID_UI_CTRL, pGroupObject, 0, E_SYSTEM,
104 "[E_SYSTEM] A system error has occurred. Failed to get _SlidableGroupObject at index (%d).", groupIndex);
106 return pGroupObject->__itemCount;
110 _SlidableGroupedListItemProvider::CreateGroupItem(int groupIndex, int itemWidth)
112 result r = E_SUCCESS;
114 _TableViewItemParams tableViewItemParams;
115 tableViewItemParams.pItem = __pListImpl->GetCustomListItemAt(groupIndex, -1);
116 tableViewItemParams.width = itemWidth;
117 tableViewItemParams.itemId = -1;
118 tableViewItemParams.groupIndex = groupIndex;
119 tableViewItemParams.itemIndex = -1;
120 tableViewItemParams.isDividerEnabled = false;
121 tableViewItemParams.pCheckBitmaps = null;
122 tableViewItemParams.annexStyle = __pListImpl->_annexStyle;
124 r = _CustomListItemImpl::CreateTableViewItem(tableViewItemParams);
125 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
127 if (GetItemCount(groupIndex) == 0 && groupIndex > __pListImpl->__topGroup)
129 __pListImpl->__bottomGroup++;
132 if (groupIndex < __pListImpl->__topGroup)
134 __pListImpl->__topGroup = groupIndex;
137 return __pListImpl->GetTableViewGroupItemAt(groupIndex);
141 _SlidableGroupedListItemProvider::DeleteGroupItem(int groupIndex, TableViewGroupItem* pItem)
143 if (__pListImpl->__directDelete == false)
145 CustomListItem* pCustomListItem = __pListImpl->GetCustomListItemAt(groupIndex, -1);
146 pCustomListItem->__pCustomListItemImpl->__pTableViewGroupItemData = null;
149 if (__pListImpl->GetItemCountAt(groupIndex) == 0)
151 if (groupIndex == __pListImpl->__topGroup)
153 if (__pListImpl->__topGroup < __pListImpl->__bottomGroup)
155 __pListImpl->__topGroup++;
158 else if (groupIndex < __pListImpl->__topGroup)
160 __pListImpl->__topGroup--;
162 if (__pListImpl->__bottomGroup != 0)
164 __pListImpl->__bottomGroup--;
174 _SlidableGroupedListItemProvider::IsReorderable(int groupIndexFrom, int groupIndexTo)
180 _SlidableGroupedListItemProvider::GetDefaultGroupItemHeight(void)
182 return __pListImpl->__groupItemHeight;
186 _SlidableGroupedListItemProvider::GetDefaultItemHeight(void)
188 CustomListItem* pCustomListItem = __pListImpl->GetCustomListItemAt(0, 0);
190 if (!pCustomListItem)
192 return __pListImpl->_defaultItemHeight;
196 return pCustomListItem->__pCustomListItemImpl->height;
201 _SlidableGroupedListItemProvider::UpdateGroupItem(int groupIndex, TableViewGroupItem* pItem)
206 _SlidableGroupedListItemProvider::UpdateItem(int groupIndex, int itemIndex, TableViewItem* pItem)
208 _TableViewItemUpdateParams updateParams;
209 updateParams.pItem = __pListImpl->GetCustomListItemAt(groupIndex, itemIndex);
210 updateParams.isDividerEnabled = __pListImpl->_isDividerEnabled;
211 updateParams.pCheckBitmaps = __pListImpl->_pCheckBitmaps;
212 updateParams.annexStyle = __pListImpl->_annexStyle;
214 result r = E_SUCCESS;
216 r = _CustomListItemImpl::UpdateTableViewItem(updateParams);
217 SysTryReturnVoidResult(NID_UI_CTRL, (r == E_SUCCESS), E_SYSTEM, "[E_SYSTEM] A system error has occurred. Failed to refresh an item.");
219 pItem->SetEnabled(true);
223 _SlidableGroupedListItemProvider::CallLoadToTopCb(int groupIndex, int itemIndex)
225 _ListListener* pListenerData = null;
226 ISlidableGroupedListEventListener* pSlidableListener = null;
228 pListenerData = dynamic_cast<_ListListener*>(__pListImpl->__slidableListenersList.GetAt(__topListenerIndex));
229 SysTryReturn(NID_UI_CTRL, (pListenerData != null), E_SYSTEM, E_SYSTEM,
230 "[E_SYSTEM] A system error has occurred. Failed to get _ListListener at index (%d)", __topListenerIndex);
232 pSlidableListener = dynamic_cast<ISlidableGroupedListEventListener*>(pListenerData->pListener);
233 SysTryReturn(NID_UI_CTRL, (pSlidableListener != null), E_SYSTEM, E_SYSTEM,
234 "[E_SYSTEM] A system error has occurred. Failed to get ISlidableGroupedListEventListener");
236 pSlidableListener->OnLoadToTopRequested(__pListImpl->GetPublic(), groupIndex, itemIndex, 1);
238 if (--__topListenerIndex < 0)
240 __topListenerIndex = __pListImpl->__slidableListenersList.GetCount() - 1;
247 _SlidableGroupedListItemProvider::UpdateCheckStatus(int groupIndex, int itemIndex)
249 _SlidableGroupObject* pGroupObject = dynamic_cast<_SlidableGroupObject*>(__pListImpl->__groupsList.GetAt(groupIndex));
250 SysTryReturn(NID_UI_CTRL, pGroupObject, null, E_SYSTEM,
251 "[E_SYSTEM] A system error has occurred. Failed to get _SlidableGroupObject at index (%d).", groupIndex);
253 if (__pListImpl->_annexStyle == TABLE_VIEW_ANNEX_STYLE_RADIO)
255 if (__pListImpl->_currentRadioGroupIndex == groupIndex && __pListImpl->_currentRadioIndex == itemIndex)
257 _CheckElementModel* pCheckElement = __pListImpl->GetCheckElementAt(groupIndex, itemIndex - pGroupObject->__topIndex);
261 pCheckElement->SetCheckBoxStatus(CHECK_BOX_CHECKED);
265 SysLog(NID_UI_CTRL, "Group item with index %d is not loaded.", itemIndex);
269 else if (pGroupObject->__pCheckedList)
271 Boolean* pChecked = dynamic_cast<Boolean*>(pGroupObject->__pCheckedList->GetAt(itemIndex));
272 SysTryReturn(NID_UI_CTRL, pChecked, E_SYSTEM, E_SYSTEM, "[E_SYSTEM] A system error has occurred.");
274 _CheckElementModel* pCheckElement = __pListImpl->GetCheckElementAt(groupIndex, itemIndex - pGroupObject->__topIndex);
278 pCheckElement->SetCheckBoxStatus((_CheckBoxBitmapType)pChecked->ToBool());
282 SysLog(NID_UI_CTRL, "Group item with index %d is not loaded.", itemIndex);
290 _SlidableGroupedListItemProvider::ModifyIndicesAfterTopLoad(void)
293 if (__pListImpl->GetCurrentLoadedCount() == 2)
295 for (int index = __pListImpl->__topGroup + 1; index < __pListImpl->__groupsList.GetCount(); index++)
297 _SlidableGroupObject* pTempGroup = dynamic_cast<_SlidableGroupObject*>(__pListImpl->__groupsList.GetAt(index));
298 SysTryReturn(NID_UI_CTRL, (pTempGroup != null), E_SYSTEM, E_SYSTEM,
299 "[E_SYSTEM] A system error has occurred. Failed to get SlidableGroupObject at index (%d).", index);
301 pTempGroup->__topIndex = 0;
308 _SlidableGroupedListItemProvider::LoadAtTop(int groupIndex, int itemIndex)
310 _TableViewItemData* pTableViewItemData = null;
312 _SlidableGroupObject* pGroupObject = dynamic_cast<_SlidableGroupObject*>(__pListImpl->__groupsList.GetAt(groupIndex));
313 SysTryReturn(NID_UI_CTRL, pGroupObject, null, E_SYSTEM,
314 "[E_SYSTEM] A system error has occurred. Failed to get _SlidableGroupObject at index (%d).", groupIndex);
316 result r = E_SUCCESS;
317 CustomListItem* pCustomListItem = null;
319 if (itemIndex >= pGroupObject->__topIndex)
321 pCustomListItem = __pListImpl->GetCustomListItemAt(groupIndex, itemIndex);
325 if (!pCustomListItem)
327 __pListImpl->__topGroup = groupIndex;
328 pGroupObject->__topIndex = itemIndex;
330 r = CallLoadToTopCb(groupIndex, itemIndex);
331 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, null, E_SYSTEM, "[%s] Propagating.", GetErrorMessage(r));
334 pTableViewItemData = __pListImpl->GetTableViewItemAt(groupIndex, 0);
336 SysTryReturn(NID_UI_CTRL, pTableViewItemData, null, E_SYSTEM, "[%s] Propagating.", GetErrorMessage(r));
338 r = UpdateCheckStatus(groupIndex, pGroupObject->__topIndex);
339 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, null, E_SYSTEM, "[%s] Propagating.", GetErrorMessage(r));
341 r = ModifyIndicesAfterTopLoad();
342 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, null, E_SYSTEM, "[%s] Propagating.", GetErrorMessage(r));
344 return pTableViewItemData;
348 _SlidableGroupedListItemProvider::CallLoadToBottomCb(int groupIndex, int itemIndex)
350 _ListListener* pListenerData = null;
351 ISlidableGroupedListEventListener* pSlidableListener = null;
353 pListenerData = dynamic_cast<_ListListener*>(__pListImpl->__slidableListenersList.GetAt(__bottomListenerIndex));
354 SysTryReturn(NID_UI_CTRL, (pListenerData != null), E_SYSTEM, E_SYSTEM,
355 "[E_SYSTEM] A system error has occurred. Failed to get _ListListener at index (%d)", __bottomListenerIndex);
357 pSlidableListener = dynamic_cast<ISlidableGroupedListEventListener*>(pListenerData->pListener);
358 SysTryReturn(NID_UI_CTRL, (pSlidableListener != null), E_SYSTEM, E_SYSTEM,
359 "[E_SYSTEM] A system error has occurred. Failed to get ISlidableGroupedListEventListener");
361 pSlidableListener->OnLoadToBottomRequested(__pListImpl->GetPublic(), groupIndex, itemIndex, 1);
363 if (++__bottomListenerIndex == __pListImpl->__slidableListenersList.GetCount())
365 __bottomListenerIndex = 0;
372 _SlidableGroupedListItemProvider::ModifyIndicesAfterBottomLoad(int groupIndex, int itemIndex)
374 if (__pListImpl->GetCurrentLoadedCount() > __pListImpl->__itemCacheSize)
376 _SlidableGroupObject* pTopGroupObject = dynamic_cast<_SlidableGroupObject*>(__pListImpl->__groupsList.GetAt(__pListImpl->__topGroup));
377 SysTryReturn(NID_UI_CTRL, pTopGroupObject, E_SYSTEM, E_SYSTEM,
378 "[E_SYSTEM] A system error has occurred. Failed to get _SlidableGroupObject at index (%d).", __pListImpl->__topGroup);
380 if (__pListImpl->GetSubItemCountAt(__pListImpl->__topGroup) == 0)
382 __pListImpl->__topGroup++;
385 else if (__pListImpl->GetCurrentLoadedCount() == 1)
387 __pListImpl->__topGroup = groupIndex;
388 __pListImpl->__bottomGroup = groupIndex;
390 _SlidableGroupObject* pTopGroupObject = dynamic_cast<_SlidableGroupObject*>(__pListImpl->__groupsList.GetAt(__pListImpl->__topGroup));
391 SysTryReturn(NID_UI_CTRL, pTopGroupObject, E_SYSTEM, E_SYSTEM,
392 "[E_SYSTEM] A system error has occurred. Failed to get _SlidableGroupObject at index (%d).", __pListImpl->__topGroup);
394 pTopGroupObject->__topIndex = itemIndex;
396 for (int index = 0; index < groupIndex; index++)
398 _SlidableGroupObject* pTempGroup = dynamic_cast<_SlidableGroupObject*>(__pListImpl->__groupsList.GetAt(index));
399 SysTryReturn(NID_UI_CTRL, (pTempGroup != null), E_SYSTEM, E_SYSTEM,
400 "[E_SYSTEM] A system error has occurred. Failed to get SlidableGroupObject at index (%d).", index);
402 pTempGroup->__topIndex = pTempGroup->__itemCount - 1;
410 _SlidableGroupedListItemProvider::LoadAtBottom(int groupIndex, int itemIndex)
412 _TableViewItemData* pTableViewItemData = null;
413 result r = E_SUCCESS;
415 CustomListItem* pCustomListItem = __pListImpl->GetCustomListItemAt(groupIndex, itemIndex - __pListImpl->GetTopItemIndex(groupIndex));
417 if (!pCustomListItem)
419 __pListImpl->__bottomGroup = groupIndex;
420 r = CallLoadToBottomCb(groupIndex, itemIndex);
421 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, null, E_SYSTEM, "[%s] Propagating.", GetErrorMessage(r));
423 int subItemCount = __pListImpl->GetSubItemCountAt(groupIndex);
425 pTableViewItemData = __pListImpl->GetTableViewItemAt(groupIndex, subItemCount - 1);
427 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, null, E_SYSTEM, "[%s] Propagating.", GetErrorMessage(r));
430 r = UpdateCheckStatus(groupIndex, itemIndex);
431 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, null, E_SYSTEM, "[%s] Propagating.", GetErrorMessage(r));
433 r = ModifyIndicesAfterBottomLoad(groupIndex, itemIndex);
434 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, null, E_SYSTEM, "[%s] Propagating.", GetErrorMessage(r));
436 return pTableViewItemData;
440 _SlidableGroupedListItemProvider::CreateItem(int groupIndex, int itemIndex, int itemWidth)
442 _SlidableGroupObject* pGroupObject = dynamic_cast<_SlidableGroupObject*>(__pListImpl->__groupsList.GetAt(groupIndex));
443 SysTryReturn(NID_UI_CTRL, pGroupObject, null, E_SYSTEM,
444 "[E_SYSTEM] A system error has occurred. Failed to get _SlidableGroupObject at index (%d).", groupIndex);
446 _TableViewItemData* pTableViewItem = null;
447 result r = E_SUCCESS;
449 if (groupIndex == __pListImpl->__topGroup)
451 pTableViewItem = __pListImpl->GetTableViewItemAt(groupIndex, itemIndex - pGroupObject->__topIndex);
455 pTableViewItem = __pListImpl->GetTableViewItemAt(groupIndex, itemIndex);
458 __pListImpl->__isCreating = true;
460 if (pTableViewItem == null)
463 if (groupIndex <= __pListImpl->__topGroup && itemIndex <= pGroupObject->__topIndex)
465 pTableViewItem = LoadAtTop(groupIndex, itemIndex);
467 else // load at bottom
469 pTableViewItem = LoadAtBottom(groupIndex, itemIndex);
472 SysTryReturn(NID_UI_CTRL, pTableViewItem, null, E_SYSTEM, "[%s] Propagating.", GetErrorMessage(r));
475 __pListImpl->__isCreating = false;
477 return pTableViewItem;
481 _SlidableGroupedListItemProvider::DeleteItem(int groupIndex, int itemIndex, TableViewItem* pItem)
483 if (__pListImpl->__isUnloading == true)
485 __pListImpl->RemoveFromItemsList(groupIndex, (itemIndex - __pListImpl->GetTopItemIndex(groupIndex)));
487 else if (__pListImpl->__directDelete == false)
489 if (((groupIndex == __pListImpl->__topGroup) && (itemIndex <= __pListImpl->GetTopItemIndex(__pListImpl->__topGroup))) || (__pListImpl->__forceScroll == true))
491 __pListImpl->RemoveFromItemsList(groupIndex, 0, false);
493 _SlidableGroupObject* pGroupObject = dynamic_cast<_SlidableGroupObject*>(__pListImpl->__groupsList.GetAt(groupIndex));
494 SysTryReturn(NID_UI_CTRL, pGroupObject, null, E_SYSTEM,
495 "[E_SYSTEM] A system error has occurred. Failed to get _SlidableGroupObject at index (%d).", groupIndex);
497 pGroupObject->__topIndex++;
501 __pListImpl->RemoveFromItemsList(groupIndex, (__pListImpl->GetSubItemCountAt(groupIndex) - 1), false);
504 __pListImpl->CallUnloadItemCb(groupIndex, itemIndex);
506 _SlidableGroupObject* pGroupObject = dynamic_cast<_SlidableGroupObject*>(__pListImpl->__groupsList.GetAt(groupIndex));
507 SysTryReturn(NID_UI_CTRL, pGroupObject, false, E_SYSTEM,
508 "[E_SYSTEM] A system error has occurred. Failed to get _SlidableGroupObject at index (%d).", groupIndex);
510 // adjust top/bottom group indices
511 if (__pListImpl->GetSubItemCountAt(groupIndex) == 0)
513 if (groupIndex <= __pListImpl->__topGroup)
515 if (__pListImpl->__topGroup < __pListImpl->__bottomGroup)
517 __pListImpl->__topGroup++;
522 if (__pListImpl->__bottomGroup > __pListImpl->__topGroup)
524 __pListImpl->__bottomGroup--;
529 else if (__pListImpl->__isFullUpdate == true)
531 __pListImpl->RemoveFromItemsList(groupIndex, (__pListImpl->GetSubItemCountAt(groupIndex) - 1), false);
540 _SlidableGroupObject::_SlidableGroupObject(void)
544 , __pCheckedList(null)
548 _SlidableGroupObject::~_SlidableGroupObject(void)
552 __pCheckedList->RemoveAll(true);
553 delete __pCheckedList;
554 __pCheckedList = null;
558 _SlidableGroupedListImpl*
559 _SlidableGroupedListImpl::GetInstance(SlidableGroupedList& slidableGroupedList)
561 return static_cast<_SlidableGroupedListImpl*>(slidableGroupedList._pControlImpl);
564 const _SlidableGroupedListImpl*
565 _SlidableGroupedListImpl::GetInstance(const SlidableGroupedList& slidableGroupedList)
567 return static_cast<const _SlidableGroupedListImpl*>(slidableGroupedList._pControlImpl);
570 _SlidableGroupedListImpl::_SlidableGroupedListImpl(Control* pList, _TableView* pCore)
571 : _ListBaseImpl(pList, pCore)
572 , __pFastScrollListener(null)
576 , __isFullUpdate(false)
577 , __pItemProvider(null)
578 , __isUnloading(false)
579 , __directDelete(false)
580 , __forceScroll(false)
581 , __isCreating(false)
582 , __groupItemTextFont(0)
583 , __groupItemHeight(0)
585 , __pItemFormat(null)
589 _SlidableGroupedListImpl::~_SlidableGroupedListImpl(void)
591 if (__pItemProvider && __pItemProvider->firstTime == true)
593 for (int groupIndex = 0; groupIndex < __groupsList.GetCount(); groupIndex++)
595 RemoveFromSubItemsList(groupIndex);
599 RemoveAllFromItemsList();
601 __groupsList.RemoveAll(true);
602 __slidableListenersList.RemoveAll(true);
603 __itemListenersList.RemoveAll(true);
605 delete __pItemProvider;
607 delete __pItemFormat;
610 _SlidableGroupedListImpl*
611 _SlidableGroupedListImpl::CreateSlidableGroupedListImplN(SlidableGroupedList* pControl, const Rectangle& bounds, bool itemDivider, bool fastScroll)
613 result r = E_SUCCESS;
615 r = GET_SIZE_INFO(SlidableGroupedList).CheckInitialSizeValidF(FloatDimension(bounds.width, bounds.height), _CONTROL_ORIENTATION_PORTRAIT);
616 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
618 TableViewScrollBarStyle scrollStyle = TABLE_VIEW_SCROLL_BAR_STYLE_NONE;
620 if (fastScroll == true)
622 scrollStyle = TABLE_VIEW_SCROLL_BAR_STYLE_FAST_SCROLL;
626 scrollStyle = TABLE_VIEW_SCROLL_BAR_STYLE_FADE_OUT;
629 _TableView* pTableView = _TableView::CreateTableViewN(TABLE_VIEW_STYLE_GROUPED, itemDivider, scrollStyle);
631 SysTryReturn(NID_UI_CTRL, pTableView, null, r, "[%s] Propagating.", GetErrorMessage(r));
633 _SlidableGroupedListImpl* pImpl = new (std::nothrow) _SlidableGroupedListImpl(pControl, pTableView);
634 SysTryCatch(NID_UI_CTRL, pImpl, , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
636 r = pImpl->InitializeBoundsPropertiesF(GET_SIZE_INFO(SlidableGroupedList), _CoordinateSystemUtils::ConvertToFloat(bounds), pTableView->GetOrientation());
637 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
647 _SlidableGroupedListImpl::AddSlidableGroupedListEventListener(ISlidableGroupedListEventListener& listener)
649 _ListListener* pSlidableListener = new (std::nothrow) _ListListener();
650 SysTryReturnVoidResult(NID_UI_CTRL, pSlidableListener, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
652 pSlidableListener->pListener = &listener;
653 __slidableListenersList.Add(*pSlidableListener);
657 _SlidableGroupedListImpl::RemoveSlidableGroupedListEventListener(ISlidableGroupedListEventListener& listener)
659 _ListListener* pListenerData = null;
661 IEventListener* pEventListener = dynamic_cast<IEventListener*>(&listener);
662 SysTryReturnVoidResult(NID_UI_CTRL, (pEventListener != null), E_SYSTEM,
663 "[E_SYSTEM] A system error has occurred. Failed to get IEventListener.");
665 ISlidableGroupedListEventListener* pSlidableListener = null;
667 for (int listenerCount = 0; listenerCount < __slidableListenersList.GetCount(); listenerCount++)
669 pListenerData = dynamic_cast<_ListListener*>(__slidableListenersList.GetAt(listenerCount));
670 SysTryReturnVoidResult(NID_UI_CTRL, (pListenerData != null), E_SYSTEM,
671 "[E_SYSTEM] A system error has occurred. Failed to get _ListListener at index (%d).", listenerCount);
673 pSlidableListener = dynamic_cast<ISlidableGroupedListEventListener*>(pListenerData->pListener);
674 SysTryReturnVoidResult(NID_UI_CTRL, (pSlidableListener != null), E_SYSTEM,
675 "[E_SYSTEM] A system error has occurred. Failed to get ISlidableGroupedListEventListener.");
677 if (pSlidableListener == pEventListener)
679 __slidableListenersList.RemoveAt(listenerCount, true);
688 _SlidableGroupedListImpl::AddFastScrollEventListener(IFastScrollEventListener& listener)
690 __pFastScrollListener = &listener;
692 GetCore().AddFastScrollListener(*this);
696 _SlidableGroupedListImpl::AddGroup(const String& text, const Bitmap* pBackgroundBitmap, int itemCount, int groupHeight, int groupId)
698 return InsertGroupAt(GetGroupCount(), text, pBackgroundBitmap, itemCount, groupHeight, groupId);
702 _SlidableGroupedListImpl::AddGroupedItemEventListener(IGroupedItemEventListener& listener)
704 _ListListener* pListenersList = new (std::nothrow) _ListListener();
705 SysTryReturnVoidResult(NID_UI_CTRL, pListenersList, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
707 pListenersList->pListener = &listener;
709 __itemListenersList.Add(*pListenersList);
713 _SlidableGroupedListImpl::AddItem(int groupIndex, const CustomListItem& item, int itemId)
715 SysTryReturnResult(NID_UI_CTRL, (groupIndex >= 0 && groupIndex < __groupsList.GetCount()),
716 E_INVALID_ARG, "Invalid argument is used. groupIndex (%d)", groupIndex);
718 _SlidableGroupObject* pGroupObject = dynamic_cast<_SlidableGroupObject*>(__groupsList.GetAt(groupIndex));
719 SysTryReturnResult(NID_UI_CTRL, (pGroupObject != null), E_SYSTEM,
720 "A system error has occurred. Failed to get _SlidableGroupObject at index (%d).", groupIndex);
722 return InsertItemAt(groupIndex, GetTopItemIndex(groupIndex) + GetSubItemCountAt(groupIndex), item, itemId);
726 _SlidableGroupedListImpl::GetBottomDrawnItemIndex(int& groupIndex, int& itemIndex) const
728 return GetCore().GetBottomDrawnItemIndex(groupIndex, itemIndex);
732 _SlidableGroupedListImpl::GetFirstCheckedItemIndex(int& groupIndex, int& itemIndex) const
734 SysTryReturnResult(NID_UI_CTRL, (_annexStyle != TABLE_VIEW_ANNEX_STYLE_NORMAL), E_SYSTEM,
735 "A system error has occurred. The list style is CUSTOM_LIST_STYLE_NORMAL.");
737 _SlidableGroupObject* pGroupObject = null;
738 Boolean* pChecked = null;
740 for (int groupCount = 0; groupCount < GetGroupCount(); groupCount++)
742 pGroupObject = dynamic_cast<_SlidableGroupObject*>(const_cast<Object*>(__groupsList.GetAt(groupCount)));
743 SysTryReturnResult(NID_UI_CTRL, (pGroupObject != null), E_SYSTEM,
744 "A system error has occurred. Failed to get _SlidableGroupObject at index (%d).", groupCount);
746 for (int checkCount = 0; checkCount < pGroupObject->__pCheckedList->GetCount(); checkCount++)
748 pChecked = dynamic_cast<Boolean*>(const_cast<Object*>(pGroupObject->__pCheckedList->GetAt(checkCount)));
749 SysTryReturnResult(NID_UI_CTRL, (pChecked != null), E_SYSTEM, "A system error has occurred.");
751 if (pChecked->ToBool())
753 groupIndex = groupCount;
754 itemIndex = checkCount;
764 _SlidableGroupedListImpl::GetGroupIdAt(int groupIndex) const
766 SysTryReturn(NID_UI_CTRL, (groupIndex >= 0 && groupIndex < __groupsList.GetCount()),
767 INVALID_INDEX, E_INVALID_ARG, "[E_INVALID_ARG] Invalid argument is used. groupIndex (%d)", groupIndex);
769 const CustomListItem* pCustomListItem = GetCustomListItemAt(groupIndex, -1);
770 SysTryReturn(NID_UI_CTRL, pCustomListItem, 0, E_SYSTEM,
771 "[E_SYSTEM] A system error has occurred. Failed to get CustomListItem at index (%d).", groupIndex);
773 return pCustomListItem->__pCustomListItemImpl->itemId;
777 _SlidableGroupedListImpl::GetGroupIndexFromGroupId(int groupId) const
779 for (int groupCount = 0; groupCount < __groupsList.GetCount(); groupCount++)
781 const CustomListItem* pCustomItem = GetCustomListItemAt(groupCount, -1);
782 SysTryReturn(NID_UI_CTRL, pCustomItem, INVALID_INDEX, E_SYSTEM,
783 "[E_SYSTEM] A system error has occurred. Failed to get CustomListItem at index (%d).", groupCount);
785 if (pCustomItem->__pCustomListItemImpl->itemId == groupId)
791 return INVALID_INDEX;
795 _SlidableGroupedListImpl::GetFirstLoadedItemIndex(int& groupIndex, int& itemIndex) const
797 _SlidableGroupObject* pGroupObject = dynamic_cast<_SlidableGroupObject*>(const_cast<Object*>(__groupsList.GetAt(__topGroup)));
798 SysTryReturnResult(NID_UI_CTRL, pGroupObject, E_SYSTEM,
799 "A system error has occurred. Failed to get _SlidableGroupObject at index (%d).", __topGroup);
801 groupIndex = __topGroup;
802 itemIndex = pGroupObject->__topIndex;
808 _SlidableGroupedListImpl::GetLastLoadedItemIndex(int& groupIndex, int& itemIndex) const
810 _SlidableGroupObject* pGroupObject = dynamic_cast<_SlidableGroupObject*>(const_cast<Object*>(__groupsList.GetAt(__bottomGroup)));
811 SysTryReturnResult(NID_UI_CTRL, pGroupObject, E_SYSTEM,
812 "A system error has occurred. Failed to get _SlidableGroupObject at index (%d).", __bottomGroup);
814 itemIndex = GetSubItemCountAt(__bottomGroup) - 1 + pGroupObject->__topIndex;
815 groupIndex = __bottomGroup;
821 _SlidableGroupedListImpl::SetFastScrollMainIndex(const String& text)
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, (GetCore().GetScrollStyle() == TABLE_VIEW_SCROLL_BAR_STYLE_FAST_SCROLL), E_SYSTEM, E_SYSTEM, "[E_SYSTEM] A system error has occurred. Scroll bar not enabled");
827 result r = GetCore().SetFastScrollIndex(text, false);
828 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, E_SYSTEM, r, "[%s] Propagating.", GetErrorMessage(r));
830 __mainScrollIndex = text;
836 _SlidableGroupedListImpl::GetItemIndexFromPosition(const Point& position, int& groupIndex, int& itemIndex) const
838 return GetCore().GetItemIndexFromPosition(position, groupIndex, itemIndex);
842 _SlidableGroupedListImpl::GetItemIndexFromPosition(int x, int y, int& groupIndex, int& itemIndex) const
844 return GetCore().GetItemIndexFromPosition(Point(x, y), groupIndex, itemIndex);
848 _SlidableGroupedListImpl::CreateGroupItemN(const String& text, const Bitmap* pBackgroundBitmap, int groupId)
850 CustomListItem* pCustomListItem = new (std::nothrow) CustomListItem();
851 SysTryReturn(NID_UI_CTRL, pCustomListItem != null, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
853 pCustomListItem->Construct(__groupItemHeight);
854 pCustomListItem->SetItemFormat(*__pItemFormat);
855 pCustomListItem->SetElement(ID_FORMAT_STRING, text);
856 pCustomListItem->SetElement(ID_FORMAT_MARGIN, "");
858 if (pBackgroundBitmap != null)
860 pCustomListItem->SetNormalItemBackgroundBitmap(*pBackgroundBitmap);
863 pCustomListItem->__pCustomListItemImpl->itemId = groupId;
865 return pCustomListItem;
869 _SlidableGroupedListImpl::CreateGroupObject(int groupIndex, int itemCount, int groupHeight)
871 _SlidableGroupObject* pGroupObject = new (std::nothrow) _SlidableGroupObject();
872 SysTryReturn(NID_UI_CTRL, pGroupObject != null, E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
874 __groupsList.InsertAt(*pGroupObject, groupIndex);
876 if (_annexStyle == TABLE_VIEW_ANNEX_STYLE_MARK || _annexStyle == TABLE_VIEW_ANNEX_STYLE_ONOFF_SLIDING || _annexStyle == TABLE_VIEW_ANNEX_STYLE_RADIO)
878 pGroupObject->__pCheckedList = new (std::nothrow) ArrayList();
879 SysTryReturn(NID_UI_CTRL, pGroupObject->__pCheckedList, E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed");
881 pGroupObject->__pCheckedList->Construct(itemCount);
883 Boolean* pChecked = null;
885 for (int count = 0; count < itemCount; count++)
887 pChecked = new (std::nothrow) Boolean(false);
888 SysTryReturn(NID_UI_CTRL, pChecked, E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed");
889 pGroupObject->__pCheckedList->Add(*pChecked);
893 pGroupObject->__groupHeight = groupHeight;
894 pGroupObject->__itemCount = itemCount;
900 _SlidableGroupedListImpl::InsertGroupAt(int groupIndex, const String& text, const Bitmap* pBackgroundBitmap, int itemCount, int groupHeight, int groupId)
902 result r = E_SUCCESS;
904 SysTryReturn(NID_UI_CTRL, (groupIndex >= 0 && groupIndex <= __groupsList.GetCount()),
905 E_INVALID_ARG, E_INVALID_ARG, "[E_INVALID_ARG] Invalid argument is used. groupIndex (%d)", groupIndex);
907 r = CreateGroupObject(groupIndex, itemCount, groupHeight);
908 SysTryReturn(NID_UI_CTRL, (r == E_SUCCESS), r, r, "[%s] Propagating.", GetErrorMessage(r));
910 CustomListItem* pCustomListItem = CreateGroupItemN(text, pBackgroundBitmap, groupId);
911 SysTryReturn(NID_UI_CTRL, (r == E_SUCCESS), r, r, "[%s] Propagating.", GetErrorMessage(r));
913 r = InsertIntoItemsList(*pCustomListItem, groupIndex, -1);
914 SysTryReturn(NID_UI_CTRL, (r == E_SUCCESS), r, r, "[%s] Propagating.", GetErrorMessage(r));
916 __loadedCount += itemCount;
918 if (__slidableListenersList.GetCount() == 0)
923 if (groupIndex <= __bottomGroup)
928 if (groupIndex < __topGroup)
931 _SlidableGroupObject* pGroupObject = dynamic_cast<_SlidableGroupObject*>(const_cast<Object*>(__groupsList.GetAt(groupIndex)));
932 SysTryReturn(NID_UI_CTRL, pGroupObject, null, E_SYSTEM,
933 "[E_SYSTEM] A system error has occurred. Failed to get _SlidableGroupObject at index (%d).", groupIndex);
935 pGroupObject->__topIndex = itemCount - 1;
938 if (__pItemProvider == null)
940 r = CreateItemProvider();
941 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, E_SYSTEM, E_SYSTEM, "[%s] Propagating.", GetErrorMessage(r));
943 _ListBaseImpl::OnDraw();
947 r = GetCore().RefreshTableView(groupIndex, -1, TABLE_VIEW_REFRESH_TYPE_ITEM_ADD);
948 SysTryReturn(NID_UI_CTRL, (r == E_SUCCESS), E_SYSTEM, E_SYSTEM, "[E_SYSTEM] A system error has occurred. Failed to insert a group.");
955 _SlidableGroupedListImpl::GetLastCheckedItemIndex(int& groupIndex, int& itemIndex) const
957 SysTryReturn(NID_UI_CTRL, (_annexStyle != TABLE_VIEW_ANNEX_STYLE_NORMAL), E_SYSTEM, E_SYSTEM,
958 "[E_SYSTEM] A system error has occurred. The list style is CUSTOM_LIST_STYLE_NORMAL.");
960 for (int groupCount = __groupsList.GetCount() - 1; groupCount >= 0; groupCount--)
962 int subItemCount = GetSubItemCountAt(groupCount);
964 for (int itemCount = subItemCount - 1; itemCount >= 0; itemCount--)
966 if (IsItemChecked(groupCount, itemCount))
968 itemIndex = itemCount;
969 groupIndex = groupCount;
978 const CustomListItem*
979 _SlidableGroupedListImpl::GetLoadedItemAt(int groupIndex, int index) const
981 SysTryReturn(NID_UI_CTRL, (groupIndex >= __topGroup && groupIndex <= __bottomGroup), null, E_INVALID_ARG,
982 "[E_INVALID_ARG] Invalid argument is used. groupIndex (%d) is not loaded or invalid.", groupIndex);
984 _SlidableGroupObject* pGroupObject = dynamic_cast<_SlidableGroupObject*>(const_cast<Object*>(__groupsList.GetAt(groupIndex)));
985 SysTryReturn(NID_UI_CTRL, pGroupObject, null, E_SYSTEM,
986 "[E_SYSTEM] A system error has occurred. Failed to get _SlidableGroupObject at index (%d).", groupIndex);
988 SysTryReturn(NID_UI_CTRL, (index >= 0 && index < GetSubItemCountAt(groupIndex)),
989 null, E_INVALID_ARG, "[E_INVALID_ARG] invalid index(%d)", index);
991 const CustomListItem* pSubListItem = GetCustomListItemAt(groupIndex, index);
992 SysTryReturn(NID_UI_CTRL, pSubListItem, null, E_SYSTEM,
993 "[E_SYSTEM] A system error has occurred. Failed to get CustomListItem at index (%d).", index);
999 _SlidableGroupedListImpl::GetLoadedItemIdAt(int groupIndex, int index) const
1001 const CustomListItem* pCustomListItem = GetLoadedItemAt(groupIndex, index - GetTopItemIndex(groupIndex));
1002 SysTryReturn(NID_UI_CTRL, pCustomListItem, INVALID_INDEX, E_INVALID_ARG, "[E_INVALID_ARG] Invalid argument is used. ");
1004 return pCustomListItem->__pCustomListItemImpl->itemId;
1008 _SlidableGroupedListImpl::GetNextCheckedItemIndexAfter(int& groupIndex, int& index) const
1010 SysTryReturn(NID_UI_CTRL, (_annexStyle != TABLE_VIEW_ANNEX_STYLE_NORMAL), E_SYSTEM, E_SYSTEM,
1011 "[E_SYSTEM] A system error has occurred. The list style is CUSTOM_LIST_STYLE_NORMAL.");
1013 SysTryReturn(NID_UI_CTRL, (groupIndex >= 0 && groupIndex < __groupsList.GetCount()), E_SYSTEM, E_INVALID_ARG,
1014 "[E_INVALID_ARG] Invalid argument is used. groupIndex (%d).", groupIndex);
1016 int subItemCount = GetSubItemCountAt(groupIndex);
1018 SysTryReturn(NID_UI_CTRL, (index >= 0 && index < subItemCount),
1019 E_SYSTEM, E_SYSTEM, "[E_INVALID_ARG] Invalid argument is used. index (%d).", index);
1023 for (int groupCount = groupIndex; groupCount < __groupsList.GetCount(); groupCount++)
1025 if (groupCount == groupIndex)
1027 itemStart = index + 1;
1034 subItemCount = GetSubItemCountAt(groupIndex);
1035 for (int checkCount = itemStart; checkCount < subItemCount; checkCount++)
1037 if (IsItemChecked(groupCount, checkCount))
1039 groupIndex = groupCount;
1052 _SlidableGroupedListImpl::GetTopDrawnItemIndex(int& groupIndex, int& itemIndex) const
1054 return GetCore().GetTopDrawnItemIndex(groupIndex, itemIndex);
1058 _SlidableGroupedListImpl::IsItemChecked(int groupIndex, int index) const
1060 SysTryReturn(NID_UI_CTRL, (_annexStyle != TABLE_VIEW_ANNEX_STYLE_NORMAL), false, E_SYSTEM,
1061 "[E_SYSTEM] A system error has occurred. The list style is CUSTOM_LIST_STYLE_NORMAL.");
1063 SysTryReturn(NID_UI_CTRL, (groupIndex >= 0 && groupIndex < __groupsList.GetCount()),
1064 false, E_INVALID_ARG, "[E_INVALID_ARG] Invalid argument is used. groupIndex (%d).", groupIndex);
1066 if (_annexStyle == TABLE_VIEW_ANNEX_STYLE_RADIO)
1068 if (groupIndex == _currentRadioGroupIndex && index == _currentRadioIndex)
1079 _SlidableGroupObject* pGroupObject = dynamic_cast<_SlidableGroupObject*>(const_cast<Object*>(__groupsList.GetAt(groupIndex)));
1080 SysTryReturn(NID_UI_CTRL, pGroupObject, false, E_SYSTEM,
1081 "[E_SYSTEM] A system error has occurred. Failed to get _SlidableGroupObject at index (%d).", groupIndex);
1083 Boolean* pChecked = dynamic_cast<Boolean*>(const_cast<Object*>(pGroupObject->__pCheckedList->GetAt(index)));
1084 SysTryReturn(NID_UI_CTRL, pChecked, false, E_SYSTEM, "[E_SYSTEM] A system error has occurred.");
1086 return pChecked->ToBool();
1091 _SlidableGroupedListImpl::IsItemLoaded(int groupIndex, int itemIndex) const
1093 if (groupIndex < __topGroup || groupIndex > __bottomGroup)
1098 else if (groupIndex == __topGroup)
1100 _SlidableGroupObject* pGroupObject = dynamic_cast<_SlidableGroupObject*>(const_cast<Object*>(__groupsList.GetAt(groupIndex)));
1101 SysTryReturn(NID_UI_CTRL, pGroupObject, E_SYSTEM, E_SYSTEM,
1102 "[E_SYSTEM] A system error has occurred. Failed to get _SlidableGroupObject at index (%d).", groupIndex);
1104 if (itemIndex >= pGroupObject->__topIndex && itemIndex <= pGroupObject->__itemCount)
1111 else if (groupIndex == __bottomGroup)
1113 _SlidableGroupObject* pGroupObject = dynamic_cast<_SlidableGroupObject*>(const_cast<Object*>(__groupsList.GetAt(groupIndex)));
1114 SysTryReturn(NID_UI_CTRL, pGroupObject, E_SYSTEM, E_SYSTEM,
1115 "[E_SYSTEM] A system error has occurred. Failed to get _SlidableGroupObject at index (%d).", groupIndex);
1117 if (itemIndex >= 0 && itemIndex < pGroupObject->__itemCount)
1129 _SlidableGroupedListImpl::RemoveAllGroups(void)
1131 for (int groupCount = __groupsList.GetCount() - 1; groupCount >= 0; groupCount--)
1133 RemoveGroupAt(groupCount);
1140 _SlidableGroupedListImpl::InsertItemAt(int groupIndex, int index, const CustomListItem& item, int itemId)
1142 result r = E_SUCCESS;
1144 SysTryReturn(NID_UI_CTRL, (groupIndex >= 0 && groupIndex < __groupsList.GetCount()),
1145 E_INVALID_ARG, E_INVALID_ARG, "[E_INVALID_ARG] Invalid argument is used. groupIndex (%d).", groupIndex);
1148 _TableViewItemParams tableViewItemParams;
1149 tableViewItemParams.pItem = (const_cast<CustomListItem*>(&item));
1150 tableViewItemParams.width = GetCore().GetBoundsF().width;
1151 tableViewItemParams.itemIndex = index;
1152 tableViewItemParams.groupIndex = -1;
1153 tableViewItemParams.isDividerEnabled = _isDividerEnabled;
1154 tableViewItemParams.pCheckBitmaps = _pCheckBitmaps;
1155 tableViewItemParams.annexStyle = _annexStyle;
1157 item.__pCustomListItemImpl->itemId = itemId;
1159 r = _CustomListItemImpl::CreateTableViewItem(tableViewItemParams);
1160 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, E_SYSTEM, E_SYSTEM,
1161 "[%s] A system error has occurred. Failed to create an item.", GetErrorMessage(r));
1163 int subItemCount = GetSubItemCountAt(groupIndex);
1164 if (index < (subItemCount + GetTopItemIndex(groupIndex)) && (index >= GetTopItemIndex(groupIndex)))
1166 r = InsertIntoItemsList(item, groupIndex, (index - GetTopItemIndex(groupIndex)));
1167 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, E_SYSTEM, E_SYSTEM, "[%s] Propagating.", GetErrorMessage(r));
1170 _SlidableGroupObject* pGroupObject = dynamic_cast<_SlidableGroupObject*>(const_cast<Object*>(__groupsList.GetAt(groupIndex)));
1171 SysTryReturn(NID_UI_CTRL, pGroupObject, E_SYSTEM, E_SYSTEM,
1172 "[E_SYSTEM] A system error has occurred. Failed to get _SlidableGroupObject at index (%d).", groupIndex);
1174 pGroupObject->__itemCount++;
1176 if (pGroupObject->__pCheckedList)
1178 Boolean* pChecked = new (std::nothrow) Boolean(false);
1179 SysTryCatch(NID_UI_CTRL, pChecked, , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
1181 pGroupObject->__pCheckedList->InsertAt(*pChecked, index);
1184 if (GetCore().GetFirstDrawnFlag() == false)
1186 r = GetCore().RefreshTableView(groupIndex, index, TABLE_VIEW_REFRESH_TYPE_ITEM_ADD);
1187 SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , E_SYSTEM,
1188 "[E_SYSTEM] A system error has occurred. Failed to perform InsertItemAt groupIndex (%d), index (%d).", groupIndex, index);
1194 if (pGroupObject->__pCheckedList)
1196 pGroupObject->__pCheckedList->RemoveAt(index, true);
1198 RemoveFromItemsList(groupIndex, (index - GetTopItemIndex(groupIndex)));
1204 _SlidableGroupedListImpl::GetItemCountAt(int groupIndex) const
1206 SysTryReturn(NID_UI_CTRL, (groupIndex >= 0 && groupIndex < __groupsList.GetCount()),
1207 0, E_INVALID_ARG, "[E_INVALID_ARG] Invalid argument is used. groupIndex (%d).", groupIndex);
1209 _SlidableGroupObject* pGroupObject = dynamic_cast<_SlidableGroupObject*>(const_cast<Object*>(__groupsList.GetAt(groupIndex)));
1210 SysTryReturn(NID_UI_CTRL, pGroupObject, 0, E_SYSTEM,
1211 "[E_SYSTEM] A system error has occurred. Failed to get _SlidableGroupObject at index (%d).", groupIndex);
1212 return pGroupObject->__itemCount;
1216 _SlidableGroupedListImpl::RefreshItem(int groupIndex, int index)
1218 SysTryReturn(NID_UI_CTRL, (groupIndex >= 0 && groupIndex < __groupsList.GetCount()),
1219 E_INVALID_ARG, E_INVALID_ARG, "[E_INVALID_ARG] Invalid argument is used. groupIndex (%d).", groupIndex);
1221 int topItemIndex = -1;
1222 int bottomItemIndex = -1;
1223 int groupTopIndex = -1;
1225 GetCore().GetTopDrawnItemIndex(groupTopIndex, topItemIndex);
1226 GetCore().GetBottomDrawnItemIndex(groupTopIndex, bottomItemIndex);
1228 SysTryReturn(NID_UI_CTRL, (index >= topItemIndex && index <= bottomItemIndex), E_INVALID_OPERATION, E_INVALID_OPERATION,
1229 "Index (%d) should be within drawn item range.", index);
1231 result r = E_SUCCESS;
1233 _TableViewItemUpdateParams updateParams;
1234 updateParams.pItem = GetCustomListItemAt(groupIndex, index);
1235 updateParams.isDividerEnabled = _isDividerEnabled;
1236 updateParams.pCheckBitmaps = _pCheckBitmaps;
1237 updateParams.annexStyle = _annexStyle;
1239 r = _CustomListItemImpl::UpdateTableViewItem(updateParams);
1240 SysTryReturnResult(NID_UI_CTRL, (r == E_SUCCESS), E_SYSTEM,
1241 "A system error has occurred. Failed to perform RefreshItem at groupIndex (%d), index (%d).", groupIndex, index);
1243 DrawItem(groupIndex, index);
1249 _SlidableGroupedListImpl::RefreshGroup(int groupIndex)
1251 SysTryReturn(NID_UI_CTRL, (groupIndex >= 0 && groupIndex < __groupsList.GetCount()),
1252 E_INVALID_ARG, E_INVALID_ARG, "[E_INVALID_ARG] Invalid argument is used. groupIndex (%d).", groupIndex);
1254 _SlidableGroupObject* pGroupObject = dynamic_cast<_SlidableGroupObject*>(__groupsList.GetAt(groupIndex));
1255 SysTryReturn(NID_UI_CTRL, pGroupObject, E_SYSTEM, E_SYSTEM,
1256 "[E_SYSTEM] A system error has occurred. Failed to get _SlidableGroupObject at index (%d).", groupIndex);
1258 int topIndex = GetTopItemIndex(groupIndex);
1259 int subItemCount = GetSubItemCountAt(groupIndex);
1261 for (int itemCount = topIndex; itemCount < topIndex + subItemCount; itemCount++)
1263 RefreshItem(groupIndex, itemCount);
1271 _SlidableGroupedListImpl::IsLoadedItemEnabled(int groupIndex, int index) const
1273 if (IsItemLoaded(groupIndex, index) == false)
1278 return GetCore().IsItemEnabled(groupIndex, index);
1282 _SlidableGroupedListImpl::LoadItemToBottom(const CustomListItem& item, int itemId)
1284 SysTryReturn(NID_UI_CTRL, __isCreating == true, E_SUCCESS, E_SUCCESS,
1285 "[E_SUCCESS] This operation is ignored during creation of list.");
1287 int itemIndex = GetSubItemCountAt(__bottomGroup);
1288 int topIndex = GetTopItemIndex(__bottomGroup);
1290 _TableViewItemParams tableViewItemParams;
1291 tableViewItemParams.pItem = (const_cast<CustomListItem*>(&item));
1292 tableViewItemParams.width = GetCore().GetBoundsF().width;
1293 tableViewItemParams.groupIndex = __bottomGroup;
1294 tableViewItemParams.itemIndex = (itemIndex + topIndex);
1295 tableViewItemParams.isDividerEnabled = _isDividerEnabled;
1296 tableViewItemParams.pCheckBitmaps = _pCheckBitmaps;
1297 tableViewItemParams.itemId = itemId;
1298 tableViewItemParams.annexStyle = _annexStyle;
1300 result r = _CustomListItemImpl::CreateTableViewItem(tableViewItemParams);
1301 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
1303 item.__pCustomListItemImpl->itemId = itemId;
1305 r = InsertIntoItemsList(item, __bottomGroup, itemIndex, false);
1306 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, E_SYSTEM, r, "[%s] Propagating.", GetErrorMessage(r));
1312 _SlidableGroupedListImpl::LoadItemToTop(const CustomListItem& item, int itemId)
1314 SysTryReturn(NID_UI_CTRL, __isCreating == true, E_SUCCESS, E_SUCCESS,
1315 "[E_SUCCESS] This operation is ignored during creation of list.");
1317 _SlidableGroupObject* pGroupObject = dynamic_cast<_SlidableGroupObject*>(__groupsList.GetAt(__topGroup));
1318 SysTryReturn(NID_UI_CTRL, pGroupObject, E_SYSTEM, E_SYSTEM,
1319 "[E_SYSTEM] A system error has occurred. Failed to get _SlidableGroupObject at index (%d).", __topGroup);
1321 _TableViewItemParams tableViewItemParams;
1322 tableViewItemParams.pItem = (const_cast<CustomListItem*>(&item));
1323 tableViewItemParams.width = GetCore().GetBoundsF().width;
1324 tableViewItemParams.itemId = itemId;
1325 tableViewItemParams.itemIndex = pGroupObject->__topIndex;
1326 tableViewItemParams.groupIndex = __topGroup;
1327 tableViewItemParams.isDividerEnabled = _isDividerEnabled;
1328 tableViewItemParams.pCheckBitmaps = _pCheckBitmaps;
1329 tableViewItemParams.annexStyle = _annexStyle;
1331 result r = _CustomListItemImpl::CreateTableViewItem(tableViewItemParams);
1332 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
1334 item.__pCustomListItemImpl->itemId = itemId;
1336 r = InsertIntoItemsList(item, __topGroup, 0, false);
1337 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, E_SYSTEM, r, "[%s] Propagating.", GetErrorMessage(r));
1343 _SlidableGroupedListImpl::GetLoadedItemIndexFromItemId(int itemId, int& groupIndex, int& itemIndex) const
1345 for (int groupCount = __topGroup; groupCount <= __bottomGroup; groupCount++)
1347 for (int itemCount = 0; itemCount < GetSubItemCountAt(groupCount); itemCount++)
1349 const CustomListItem* pItem = GetCustomListItemAt(groupCount, itemCount);
1355 if (pItem->__pCustomListItemImpl->itemId == itemId)
1357 groupIndex = groupCount;
1358 itemIndex = itemCount;
1371 _SlidableGroupedListImpl::UnloadAllItems(void)
1373 result r = E_SUCCESS;
1378 SysTryReturn(NID_UI_CTRL, __pItemProvider, E_SYSTEM, E_SYSTEM,
1379 "[E_SYSTEM] A system error has occurred. ISlidableGroupedListEventListener not set.");
1381 for (groupCount = __groupsList.GetCount() - 1; groupCount >= 0; groupCount--)
1383 itemCount = GetSubItemCountAt(groupCount);
1385 for (itemIndex = itemCount - 1; itemIndex >= 0; itemIndex--)
1387 __isUnloading = true;
1389 r = GetCore().RefreshTableView(groupCount, (itemIndex + GetTopItemIndex(groupCount)), TABLE_VIEW_REFRESH_TYPE_ITEM_REMOVE);
1391 __isUnloading = false;
1394 SysLog(NID_UI_CTRL, "Group item with index %d not removed successFully.", groupCount);
1397 _SlidableGroupObject* pGroupObject = dynamic_cast<_SlidableGroupObject*>(__groupsList.GetAt(groupCount));
1398 SysTryReturn(NID_UI_CTRL, pGroupObject, E_SYSTEM, E_SYSTEM,
1399 "[E_SYSTEM] A system error has occurred. Failed to get _SlidableGroupObject at index (%d).", groupCount);
1401 if (pGroupObject->__pCheckedList != null)
1403 pGroupObject->__pCheckedList->RemoveAt(itemIndex, true);
1406 CallUnloadItemCb(groupCount, itemIndex);
1414 _SlidableGroupedListImpl::RemoveAllCheckedItemsAt(int groupIndex, int itemHeight)
1416 SysTryReturn(NID_UI_CTRL, (_annexStyle != TABLE_VIEW_ANNEX_STYLE_NORMAL), E_SYSTEM, E_SYSTEM,
1417 "[E_SYSTEM] A system error has occurred. The list style is CUSTOM_LIST_STYLE_NORMAL.");
1418 SysTryReturn(NID_UI_CTRL, (_annexStyle != TABLE_VIEW_ANNEX_STYLE_RADIO), E_SYSTEM, E_SYSTEM,
1419 "[E_SYSTEM] A system error has occurred. The list style is CUSTOM_LIST_STYLE_RADIO.");
1421 SysTryReturn(NID_UI_CTRL, __pItemProvider, E_SYSTEM, E_SYSTEM,
1422 "[E_SYSTEM] A system error has occurred. ISlidableGroupedListEventListener not set.");
1424 SysTryReturn(NID_UI_CTRL, (groupIndex >= 0 && groupIndex < __groupsList.GetCount()),
1425 E_INVALID_ARG, E_INVALID_ARG, "[E_INVALID_ARG] Invalid argument is used. groupIndex (%d).", groupIndex);
1427 _SlidableGroupObject* pGroupObject = dynamic_cast<_SlidableGroupObject*>(__groupsList.GetAt(groupIndex));
1428 SysTryReturn(NID_UI_CTRL, pGroupObject, E_SYSTEM, E_SYSTEM,
1429 "[E_SYSTEM] A system error has occurred. Failed to get _SlidableGroupObject at index (%d).", groupIndex);
1431 Boolean* pChecked = null;
1434 for (itemIndex = (GetItemCountAt(groupIndex) - 1); itemIndex >= 0; itemIndex--)
1436 pChecked = dynamic_cast<Boolean*>(pGroupObject->__pCheckedList->GetAt(itemIndex));
1438 if (pChecked && pChecked->ToBool() == true)
1440 RemoveItemAt(groupIndex, itemIndex, 0);
1448 _SlidableGroupedListImpl::RemoveAllCheckedItems(int itemHeight)
1450 SysTryReturn(NID_UI_CTRL, (_annexStyle != TABLE_VIEW_ANNEX_STYLE_NORMAL), E_SYSTEM, E_SYSTEM,
1451 "[E_SYSTEM] A system error has occurred. The list style is CUSTOM_LIST_STYLE_NORMAL.");
1452 SysTryReturn(NID_UI_CTRL, (_annexStyle != TABLE_VIEW_ANNEX_STYLE_RADIO), E_SYSTEM, E_SYSTEM,
1453 "[E_SYSTEM] A system error has occurred. The list style is CUSTOM_LIST_STYLE_RADIO.");
1455 SysTryReturn(NID_UI_CTRL, __pItemProvider, E_SYSTEM, E_SYSTEM,
1456 "[E_SYSTEM] A system error has occurred. ISlidableGroupedListEventListener not set.");
1460 for (; groupCount < __groupsList.GetCount(); groupCount++)
1462 RemoveAllCheckedItemsAt(groupCount, itemHeight);
1469 _SlidableGroupedListImpl::RemoveAllItemsAt(int groupIndex)
1472 SysTryReturn(NID_UI_CTRL, (groupIndex >= 0 && groupIndex < __groupsList.GetCount()),
1473 E_INVALID_ARG, E_INVALID_ARG, "[E_INVALID_ARG] Invalid argument is used. groupIndex (%d).", groupIndex);
1477 for (itemIndex = (GetItemCountAt(groupIndex) - 1); itemIndex >= 0; itemIndex--)
1479 RemoveItemAt(groupIndex, itemIndex, 0);
1486 _SlidableGroupedListImpl::RemoveAllItems(void)
1488 SysTryReturn(NID_UI_CTRL, __pItemProvider, E_SYSTEM, E_SYSTEM,
1489 "[E_SYSTEM] A system error has occurred. ISlidableGroupedListEventListener not set.");
1493 for (groupCount = 0; groupCount < __groupsList.GetCount(); groupCount++)
1495 _SlidableGroupObject* pGroupObject = dynamic_cast<_SlidableGroupObject*>(__groupsList.GetAt(groupCount));
1496 SysTryReturn(NID_UI_CTRL, pGroupObject, 0, E_SYSTEM,
1497 "[E_SYSTEM] A system error has occurred. Failed to get _SlidableGroupObject at index (%d).", groupCount);
1499 pGroupObject->__itemCount = 0;
1500 pGroupObject->__topIndex = 0;
1504 __isFullUpdate = true;
1505 GetCore().UpdateTableView();
1506 __isFullUpdate = false;
1508 __pItemProvider->firstTime = true;
1514 _SlidableGroupedListImpl::RemoveFastScrollEventListener(IFastScrollEventListener& listener)
1516 __pFastScrollListener = null;
1520 _SlidableGroupedListImpl::RemoveGroupedItemEventListener(IGroupedItemEventListener& listener)
1522 _ListListener* pListenerList = null;
1524 for (int listenerCount = 0; listenerCount < __itemListenersList.GetCount(); listenerCount++)
1526 pListenerList = dynamic_cast<_ListListener*>(__itemListenersList.GetAt(listenerCount));
1528 if ((pListenerList != null) && (pListenerList->pListener == &listener))
1530 __itemListenersList.RemoveAt(listenerCount, true);
1537 _SlidableGroupedListImpl::RemoveItemAt(int groupIndex, int index, int itemHeight)
1539 SysTryReturn(NID_UI_CTRL, (groupIndex >= 0 && groupIndex < __groupsList.GetCount()),
1540 E_INVALID_ARG, E_INVALID_ARG, "[E_INVALID_ARG] Invalid argument is used. groupIndex (%d).", groupIndex);
1542 _SlidableGroupObject* pGroupObject = dynamic_cast<_SlidableGroupObject*>(__groupsList.GetAt(groupIndex));
1543 SysTryReturn(NID_UI_CTRL, pGroupObject, E_SYSTEM, E_SYSTEM,
1544 "[E_SYSTEM] A system error has occurred. Failed to get _SlidableGroupObject at index (%d).", groupIndex);
1546 int subItemCount = GetSubItemCountAt(groupIndex);
1548 SysTryReturn(NID_UI_CTRL, (index >= 0 && index < pGroupObject->__itemCount),
1549 E_INVALID_ARG, E_INVALID_ARG, "[E_INVALID_ARG] Invalid argument is used. index (%d).", index);
1551 __directDelete = true;
1553 if (pGroupObject->__pCheckedList != null)
1555 pGroupObject->__pCheckedList->RemoveAt(index, true);
1558 if (index < (subItemCount + pGroupObject->__topIndex) && (index >= pGroupObject->__topIndex))
1560 RemoveFromItemsList(groupIndex, (index - pGroupObject->__topIndex));
1563 result r = GetCore().RefreshTableView(groupIndex, index, TABLE_VIEW_REFRESH_TYPE_ITEM_REMOVE);
1566 SysLog(NID_UI_CTRL, "Group item with index %d not removed successFully.", groupIndex);
1569 __directDelete = false;
1571 CallUnloadItemCb(groupIndex, index);
1572 pGroupObject->__itemCount--;
1578 _SlidableGroupedListImpl::RemoveGroupAt(int groupIndex)
1580 SysTryReturn(NID_UI_CTRL, (groupIndex >= 0 && groupIndex < __groupsList.GetCount()),
1581 E_INVALID_ARG, E_INVALID_ARG, "[E_INVALID_ARG] Invalid argument is used. groupIndex (%d).", groupIndex);
1583 result r = E_SUCCESS;
1585 r = RemoveFromSubItemsList(groupIndex);
1586 SysTryReturn(NID_UI_CTRL, (r == E_SUCCESS), E_SYSTEM, r, "[%s] Propagating.", GetErrorMessage(r));
1588 r = RemoveFromItemsList(groupIndex, -1);
1589 SysTryReturn(NID_UI_CTRL, (r == E_SUCCESS), E_SYSTEM, r, "[%s] Propagating.", GetErrorMessage(r));
1591 __groupsList.RemoveAt(groupIndex, true);
1593 __directDelete = true;
1595 if (GetCore().GetFirstDrawnFlag() == false)
1597 r = GetCore().RefreshTableView(groupIndex, -1, TABLE_VIEW_REFRESH_TYPE_ITEM_REMOVE);
1598 SysTryReturn(NID_UI_CTRL, (r == E_SUCCESS), E_SYSTEM, r, "[%s] Propagating.", GetErrorMessage(r));
1601 __directDelete = false;
1607 _SlidableGroupedListImpl::ScrollToBottom(void)
1609 SysTryReturnVoidResult(NID_UI_CTRL, (__slidableListenersList.GetCount() > 0), E_SYSTEM,
1610 "[E_SYSTEM] A system error has occurred. No listeners available.");
1612 __forceScroll = true;
1614 _SlidableGroupObject* pGroupObject = dynamic_cast<_SlidableGroupObject*>(__groupsList.GetAt(__groupsList.GetCount() - 1));
1615 SysTryReturnVoidResult(NID_UI_CTRL, pGroupObject, E_SYSTEM,
1616 "[E_SYSTEM] A system error has occurred. Failed to get _SlidableGroupObject at index (%d).", __groupsList.GetCount() - 1);
1618 result r = GetCore().SetBottomDrawnItemIndex(__groupsList.GetCount() - 1, pGroupObject->__itemCount - 1);
1619 SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
1621 __forceScroll = false;
1627 _SlidableGroupedListImpl::ScrollToTop(int groupIndex)
1629 SysTryReturnResult(NID_UI_CTRL, (__slidableListenersList.GetCount() > 0), E_SYSTEM,
1630 "[E_SYSTEM] A system error has occurred. No listeners available.");
1632 SysTryReturn(NID_UI_CTRL, (groupIndex >= 0 && groupIndex < __groupsList.GetCount()),
1633 E_INVALID_ARG, E_INVALID_ARG, "[E_INVALID_ARG] Invalid argument is used. groupIndex (%d).", groupIndex);
1635 result r = E_SUCCESS;
1637 __forceScroll = true;
1639 r = GetCore().SetTopDrawnItemIndex(groupIndex, -1);
1640 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
1644 __forceScroll = false;
1650 _SlidableGroupedListImpl::ScrollToTop(int groupIndex, int itemIndex)
1652 SysTryReturnResult(NID_UI_CTRL, (__slidableListenersList.GetCount() > 0), E_SYSTEM,
1653 "[E_SYSTEM] A system error has occurred. No listeners available.");
1655 SysTryReturn(NID_UI_CTRL, (groupIndex >= 0 && groupIndex < __groupsList.GetCount()),
1656 E_INVALID_ARG, E_INVALID_ARG, "[E_INVALID_ARG] Invalid argument is used. groupIndex (%d).", groupIndex);
1658 _SlidableGroupObject* pGroupObject = dynamic_cast<_SlidableGroupObject*>(__groupsList.GetAt(groupIndex));
1659 SysTryReturn(NID_UI_CTRL, pGroupObject, E_SYSTEM, E_SYSTEM,
1660 "[E_SYSTEM] A system error has occurred. Failed to get _SlidableGroupObject at index (%d).", groupIndex);
1662 SysTryReturn(NID_UI_CTRL, (itemIndex >= 0 && itemIndex < pGroupObject->__itemCount),
1663 E_INVALID_ARG, E_INVALID_ARG, "[E_INVALID_ARG] Invalid argument is used. itemIndex (%d).", itemIndex);
1665 result r = E_SUCCESS;
1667 __forceScroll = true;
1669 r = GetCore().SetTopDrawnItemIndex(groupIndex, itemIndex);
1670 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
1674 __forceScroll = false;
1680 _SlidableGroupedListImpl::ScrollToTop(void)
1682 SysTryReturnVoidResult(NID_UI_CTRL, (__slidableListenersList.GetCount() > 0), E_SYSTEM,
1683 "[E_SYSTEM] A system error has occurred. No listeners available.");
1685 __forceScroll = true;
1687 result r = GetCore().SetTopDrawnItemIndex(0, -1);
1688 SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
1692 __forceScroll = false;
1696 _SlidableGroupedListImpl::SetAllItemsChecked(int groupIndex, bool check)
1698 SysTryReturn(NID_UI_CTRL, (_annexStyle != TABLE_VIEW_ANNEX_STYLE_NORMAL), E_SYSTEM, E_SYSTEM,
1699 "[E_SYSTEM] A system error has occurred. The list style is CUSTOM_LIST_STYLE_NORMAL.");
1700 SysTryReturn(NID_UI_CTRL, (_annexStyle != TABLE_VIEW_ANNEX_STYLE_RADIO), E_SYSTEM, E_SYSTEM,
1701 "[E_SYSTEM] A system error has occurred. The list style is CUSTOM_LIST_STYLE_RADIO.");
1703 SysTryReturn(NID_UI_CTRL, (groupIndex >= 0 && groupIndex < GetGroupCount()),
1704 E_INVALID_ARG, E_INVALID_ARG, "[E_INVALID_ARG] Invalid argument is used. groupIndex (%d).", groupIndex);
1706 _SlidableGroupObject* pGroupObject = dynamic_cast<_SlidableGroupObject*>(__groupsList.GetAt(groupIndex));
1707 SysTryReturn(NID_UI_CTRL, pGroupObject, E_SYSTEM, E_SYSTEM, "[E_SYSTEM]");
1709 for (int indexItem = 0; indexItem < pGroupObject->__itemCount; indexItem++)
1711 Boolean* pChecked = new (std::nothrow) Boolean(check);
1712 SysTryReturn(NID_UI_CTRL, pChecked, E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed");
1714 pGroupObject->__pCheckedList->SetAt(*pChecked, indexItem, true);
1716 _CheckElementModel *pCheckElement = GetCheckElementAt(groupIndex, indexItem);
1720 pCheckElement->SetCheckBoxStatus((_CheckBoxBitmapType)check);
1724 SysLog(NID_UI_CTRL, "Group item with index %d is not loaded.", indexItem);
1728 GetCore().Invalidate(true);
1734 _SlidableGroupedListImpl::SetItemAt(int groupIndex, int itemIndex, const CustomListItem& item, int itemId)
1736 SysTryReturn(NID_UI_CTRL, (groupIndex >= 0 && groupIndex < __groupsList.GetCount()),
1737 E_INVALID_ARG, E_INVALID_ARG, "[E_INVALID_ARG] Invalid argument is used. groupIndex (%d).", groupIndex);
1739 SysTryReturn(NID_UI_CTRL, ((itemIndex >= 0) && (itemIndex < GetSubItemCountAt(groupIndex))),
1740 E_INVALID_ARG, E_INVALID_ARG, "[E_INVALID_ARG] Invalid argument is used. itemIndex (%d).", itemIndex);
1742 SysTryReturnResult(NID_UI_CTRL, (IsItemNew(item) == true), E_SYSTEM, "[E_SYSTEM] A system error has occurred. The item already exists.");
1744 _CheckElementModel* pOldCheckElement = GetCheckElementAt(groupIndex, itemIndex - GetTopItemIndex(groupIndex));
1745 _CheckElementModel* pNewCheckElement = item.__pCustomListItemImpl->GetCheckElement();
1747 if (pNewCheckElement && pOldCheckElement)
1749 pNewCheckElement->SetCheckBoxStatus(pOldCheckElement->GetCheckBoxStatus());
1752 item.__pCustomListItemImpl->__pTableViewItemData = GetTableViewItemAt(groupIndex, itemIndex);
1753 item.__pCustomListItemImpl->itemId = itemId;
1755 result r = SetInItemsList(item, groupIndex, itemIndex);
1756 SysTryReturn(NID_UI_CTRL, (r == E_SUCCESS), r, r, "[%s] Propagating.", GetErrorMessage(r));
1758 r = GetCore().RefreshTableView(groupIndex, itemIndex, TABLE_VIEW_REFRESH_TYPE_ITEM_MODIFY);
1759 SysTryReturn(NID_UI_CTRL, (r == E_SUCCESS), r, r, "[%s] Propagating.", GetErrorMessage(r));
1765 _SlidableGroupedListImpl::UpdateCheckedList(int groupIndex, int index, bool check)
1767 _SlidableGroupObject* pGroupObject = dynamic_cast<_SlidableGroupObject*>(__groupsList.GetAt(groupIndex));
1768 SysTryReturn(NID_UI_CTRL, (pGroupObject != null), E_SYSTEM, E_SYSTEM,
1769 "[E_SYSTEM] A system error has occurred. Failed to get _SlidableGroupObject at groupIndex (%d).", groupIndex);
1771 SysTryReturn(NID_UI_CTRL, (pGroupObject->__pCheckedList != null), E_SYSTEM, E_SYSTEM,
1772 "[E_SYSTEM] A system error has occurred. Failed to get checked list at groupIndex (%d).", groupIndex);
1774 Boolean* pChecked = new (std::nothrow) Boolean(check);
1775 SysTryReturn(NID_UI_CTRL, pChecked, E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
1776 pGroupObject->__pCheckedList->SetAt(*pChecked, index, true);
1782 _SlidableGroupedListImpl::SetItemCheckedRadio(int groupIndex, int index, bool check)
1785 _SlidableGroupObject* pGroupObject = dynamic_cast<_SlidableGroupObject*>(const_cast<Object*>(__groupsList.GetAt(groupIndex)));
1786 SysTryReturn(NID_UI_CTRL, pGroupObject, INVALID_INDEX, E_SYSTEM,
1787 "[E_SYSTEM] A system error has occurred. Failed to get _SlidableGroupObject at groupIndex (%d).", groupIndex);
1789 _CheckElementModel* pCheckElement = GetCheckElementAt(groupIndex, (index - pGroupObject->__topIndex));
1790 SysTryReturnResult(NID_UI_CTRL, (pCheckElement != null), E_SYSTEM, "A system error has occurred. Checkbox element not created");
1794 if (_currentRadioIndex != -1)
1796 _CheckElementModel* pOldCheckElement = GetCheckElementAt(_currentRadioGroupIndex, (_currentRadioIndex - pGroupObject->__topIndex));
1798 if (pOldCheckElement)
1800 pOldCheckElement->SetCheckBoxStatus(CHECK_BOX_UNCHECKED);
1801 DrawItem(_currentRadioGroupIndex, (_currentRadioIndex - pGroupObject->__topIndex));
1805 _currentRadioGroupIndex = groupIndex;
1806 _currentRadioIndex = index;
1810 _currentRadioGroupIndex = -1;
1811 _currentRadioIndex = -1;
1813 pCheckElement->SetCheckBoxStatus((_CheckBoxBitmapType)check);
1814 DrawItem(groupIndex, index - pGroupObject->__topIndex);
1820 _SlidableGroupedListImpl::SetItemCheckedMarkOnOff(int groupIndex, int index, bool check)
1823 _SlidableGroupObject* pGroupObject = dynamic_cast<_SlidableGroupObject*>(const_cast<Object*>(__groupsList.GetAt(groupIndex)));
1824 SysTryReturn(NID_UI_CTRL, pGroupObject, INVALID_INDEX, E_SYSTEM,
1825 "[E_SYSTEM] A system error has occurred. Failed to get _SlidableGroupObject at groupIndex (%d).", groupIndex);
1827 _CheckElementModel* pCheckElement = GetCheckElementAt(groupIndex, (index - pGroupObject->__topIndex));
1828 SysTryReturnResult(NID_UI_CTRL, (pCheckElement != null), E_SYSTEM, "A system error has occurred.");
1830 pCheckElement->SetCheckBoxStatus((_CheckBoxBitmapType)check);
1832 UpdateCheckedList(groupIndex, index, check);
1834 DrawItem(groupIndex, index - pGroupObject->__topIndex);
1840 _SlidableGroupedListImpl::SetItemChecked(int groupIndex, int index, bool check)
1842 SysTryReturn(NID_UI_CTRL, (_annexStyle != TABLE_VIEW_ANNEX_STYLE_NORMAL), E_SYSTEM, E_SYSTEM,
1843 "[E_SYSTEM] A system error has occurred. The list style is CUSTOM_LIST_STYLE_NORMAL.");
1845 SysTryReturn(NID_UI_CTRL, (groupIndex >= 0 && groupIndex < __groupsList.GetCount()),
1846 E_INVALID_ARG, E_INVALID_ARG, "[E_INVALID_ARG] Invalid argument is used. groupIndex (%d).", groupIndex);
1848 _SlidableGroupObject* pGroupObject = dynamic_cast<_SlidableGroupObject*>(__groupsList.GetAt(groupIndex));
1849 SysTryReturn(NID_UI_CTRL, (pGroupObject != null), E_SYSTEM, E_SYSTEM,
1850 "[E_SYSTEM] A system error has occurred. Failed to get _SlidableGroupObject at groupIndex (%d).", groupIndex);
1852 SysTryReturn(NID_UI_CTRL, (index >= 0 && index < pGroupObject->__itemCount),
1853 E_INVALID_ARG, E_INVALID_ARG, "[E_INVALID_ARG] Invalid argument is used. index (%d).", index);
1855 if (IsItemChecked(groupIndex, index) == check)
1860 SysTryReturnResult(NID_UI_CTRL, (GetCore().IsItemEnabled(groupIndex, index)), E_SYSTEM, "[E_SYSTEM] A system error has occurred. The list item is not enabled.");
1862 if (_annexStyle == TABLE_VIEW_ANNEX_STYLE_RADIO)
1864 return SetItemCheckedRadio(groupIndex, index, check);
1868 return SetItemCheckedMarkOnOff(groupIndex, index, check);
1873 _SlidableGroupedListImpl::SetLoadedItemEnabled(int groupIndex, int index, bool enable)
1875 result r = E_SUCCESS;
1876 SysTryReturn(NID_UI_CTRL, (groupIndex >= 0 && groupIndex < __groupsList.GetCount()),
1877 E_INVALID_ARG, E_INVALID_ARG, "[E_INVALID_ARG] Invalid argument is used. groupIndex (%d).", groupIndex);
1879 _SlidableGroupObject* pGroupObject = dynamic_cast<_SlidableGroupObject*>(__groupsList.GetAt(groupIndex));
1880 SysTryReturn(NID_UI_CTRL, pGroupObject, E_SYSTEM, E_SYSTEM,
1881 "[E_SYSTEM] A system error has occurred. Failed to get _SlidableGroupObject at groupIndex (%d).", groupIndex);
1883 SysTryReturn(NID_UI_CTRL, (index >= 0 && index < pGroupObject->__itemCount),
1884 E_INVALID_ARG, E_INVALID_ARG, "[E_INVALID_ARG] Invalid argument is used. index (%d).", index);
1886 CustomListItem* pCustomListItem = GetCustomListItemAt(groupIndex, index);
1887 SysTryReturnResult(NID_UI_CTRL, pCustomListItem, E_SYSTEM, "[E_SYSTEM] A system error has occurred. Failed to get an item at %d index.", index);
1889 _CustomListItemImpl* pCustomListItemImpl = pCustomListItem->__pCustomListItemImpl;
1890 SysTryReturnResult(NID_UI_CTRL, pCustomListItemImpl, E_SYSTEM, "[E_SYSTEM] A system error has occurred. Item instance must not be null.");
1892 _TableViewItemData* pTableViewItemData = pCustomListItemImpl->__pTableViewItemData;
1893 SysTryReturnResult(NID_UI_CTRL, pTableViewItemData, E_SYSTEM, "[E_SYSTEM] A system error has occurred. Failed to get an item at %d index.", index);
1895 r = GetCore().SetItemEnabled(groupIndex, index, enable);
1896 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, E_SYSTEM, E_SYSTEM, "[%s] Failed to set an item enabled at index %d.", GetErrorMessage(r), index);
1898 pTableViewItemData->Invalidate(true);
1903 _SlidableGroupedListImpl::SetGroupAt(int groupIndex, const String& text, const Bitmap* pBackgroundBitmap, int groupId)
1905 result r = E_SUCCESS;
1907 SysTryReturnResult(NID_UI_CTRL, (groupIndex >= 0 && groupIndex < __groupsList.GetCount()),
1908 E_INVALID_ARG, "Invalid argument is used. groupIndex (%d).", groupIndex);
1910 _SlidableGroupObject* pOldGroup = dynamic_cast<_SlidableGroupObject*>(__groupsList.GetAt(groupIndex));
1911 SysTryReturn(NID_UI_CTRL, pOldGroup, E_SYSTEM, E_SYSTEM,
1912 "[E_SYSTEM] A system error has occurred. Failed to get _SlidableGroupObject at groupIndex (%d).", groupIndex);
1914 CustomListItem* pCustomListItem = GetCustomListItemAt(groupIndex, -1);
1915 SysTryReturn(NID_UI_CTRL, (pCustomListItem), E_SYSTEM, E_SYSTEM,
1916 "[E_SYSTEM] A system error has occurred. Failed to get CustomListItem at groupIndex (%d).", groupIndex);
1918 pCustomListItem->SetElement(ID_FORMAT_STRING, text);
1920 if (pBackgroundBitmap != null)
1922 pCustomListItem->SetNormalItemBackgroundBitmap(*pBackgroundBitmap);
1925 pCustomListItem->__pCustomListItemImpl->itemId = groupId;
1927 _TableViewItemUpdateParams updateParams;
1928 updateParams.pItem = pCustomListItem;
1929 updateParams.isDividerEnabled = _isDividerEnabled;
1930 updateParams.pCheckBitmaps = _pCheckBitmaps;
1931 updateParams.annexStyle = _annexStyle;
1933 r = _CustomListItemImpl::UpdateTableViewItem(updateParams);
1934 SysTryReturnResult(NID_UI_CTRL, (r == E_SUCCESS), E_SYSTEM, "A system error has occurred. Failed to update an item.");
1940 _SlidableGroupedListImpl::OnTableViewItemStateChanged(_TableView& tableView, int itemIndex, _TableViewItem* pItem, TableViewItemStatus status)
1946 _SlidableGroupedListImpl::OnTableViewContextItemActivationStateChanged(_TableView& tableView, int itemIndex, _TableViewItem* pContextItem, bool activated)
1952 _SlidableGroupedListImpl::OnTableViewItemReordered(_TableView& tableView, int itemIndexFrom, int itemIndexTo)
1958 _SlidableGroupedListImpl::OnGroupedTableViewGroupItemStateChanged(_TableView& tableView, int groupIndex, _TableViewItem* pItem, TableViewItemStatus status)
1964 _SlidableGroupedListImpl::OnGroupedTableViewItemStateChanged(_TableView& tableView, int groupIndex, int itemIndex, _TableViewItem* pItem, TableViewItemStatus status)
1966 CustomListItem* pCustomListItem = GetCustomListItemAt(groupIndex, itemIndex - GetTopItemIndex(groupIndex));
1967 SysTryReturnVoidResult(NID_UI_CTRL, pCustomListItem, E_SYSTEM, "[E_SYSTEM] A system error has occurred. Failed to get CustomListItem at itemIndex (%d).", itemIndex);
1969 CustomListItemStatus customListItemStatus = CUSTOM_LIST_ITEM_STATUS_NORMAL;
1970 ItemStatus itemStatus = ITEM_HIGHLIGHTED;
1974 case TABLE_VIEW_ITEM_STATUS_SELECTED:
1975 itemStatus = ITEM_SELECTED;
1976 customListItemStatus = CUSTOM_LIST_ITEM_STATUS_SELECTED;
1978 case TABLE_VIEW_ITEM_STATUS_HIGHLIGHTED:
1979 itemStatus = ITEM_HIGHLIGHTED;
1980 customListItemStatus = CUSTOM_LIST_ITEM_STATUS_FOCUSED;
1982 case TABLE_VIEW_ITEM_STATUS_CHECKED:
1983 itemStatus = ITEM_CHECKED;
1985 case TABLE_VIEW_ITEM_STATUS_UNCHECKED:
1986 itemStatus = ITEM_UNCHECKED;
1989 SetLastResult(E_INVALID_ARG);
1990 SysLog(NID_UI_CTRL, "[E_INVALID_ARG] Invalid argument is used. ListItemStatus is invalid");
1994 LinkedList* pElements = &pCustomListItem->__pCustomListItemImpl->elements;
1995 _ElementBaseModel* pElementBase = null;
1997 for (int i = 0; i < pElements->GetCount(); i++)
1999 pElementBase = dynamic_cast<_ElementBaseModel*>(pElements->GetAt(i));
2000 SysTryReturnVoidResult(NID_UI_CTRL, (pElementBase != null), E_SYSTEM, "Invalid element.");
2002 if ((_isDividerEnabled && pElementBase->_elementType != LIST_ITEM_ELEMENT_TYPE_CHECKBOX) || (!_isDividerEnabled))
2004 pElementBase->HandleElementEvent(customListItemStatus);
2008 if ((!_isDividerEnabled) && (_annexStyle != TABLE_VIEW_ANNEX_STYLE_NORMAL))
2010 bool isChecked = IsItemChecked(groupIndex, itemIndex);
2014 itemStatus = ITEM_UNCHECKED;
2018 itemStatus = ITEM_CHECKED;
2021 SetItemChecked(groupIndex, itemIndex, !isChecked);
2024 ProcessItemStateChange(groupIndex, itemIndex, itemStatus);
2031 _SlidableGroupedListImpl::OnGroupedTableViewContextItemActivationStateChanged(_TableView& tableView, int groupIndex, int itemIndex, _TableViewItem* pContextItem, bool activated)
2037 _SlidableGroupedListImpl::OnGroupedTableViewItemReordered(Tizen::Ui::Controls::_TableView& tableView, int groupIndexFrom, int itemIndexFrom, int groupIndexTo, int itemIndexTo)
2043 _SlidableGroupedListImpl::OnSectionTableViewItemStateChanged(_TableView& tableView, int sectionIndex, int itemIndex, _TableViewItem* pItem, TableViewItemStatus status)
2049 _SlidableGroupedListImpl::OnSectionTableViewContextItemActivationStateChanged(_TableView& tableView, int sectionIndex, int itemIndex, _TableViewItem* pContextItem, bool activated)
2055 _SlidableGroupedListImpl::OnTableViewItemSwept(Tizen::Ui::Controls::_TableView& tableView, int groupIndex, int itemIndex, Tizen::Ui::Controls::TableViewSweepDirection direction)
2061 _SlidableGroupedListImpl::OnDraw(void)
2063 if (__pItemProvider == null)
2065 result r = E_SUCCESS;
2067 r = CreateItemProvider();
2068 SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
2071 _ListBaseImpl::OnDraw();
2075 _SlidableGroupedListImpl::CreateItemProvider(void)
2077 if (__pItemProvider == null)
2079 __pItemProvider = new (std::nothrow) _SlidableGroupedListItemProvider(this);
2080 SysTryReturnResult(NID_UI_CTRL, __pItemProvider, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
2082 TableViewStyle style = GetCore().GetTableViewStyle();
2083 SysTryReturnResult(NID_UI_CTRL, style == TABLE_VIEW_STYLE_GROUPED, E_INVALID_OPERATION,
2084 "[E_INVALID_OPERATION] The style of TableView is not TABLE_VIEW_STYLE_GROUPED");
2086 _TableViewItemProvider* pItemProvider = _TableViewItemProvider::CreateTableViewItemProviderN(style);
2087 result r = GetLastResult();
2088 SysTryReturnResult(NID_UI_CTRL, pItemProvider != null, r, "[%s] Propagating.", GetErrorMessage(r));
2090 pItemProvider->SetGroupedStyleItemProvider(__pItemProvider);
2092 GetCore().SetItemProvider(pItemProvider);
2099 _SlidableGroupedListImpl::Initialize(void)
2101 GetCore().AddGroupedTableViewItemEventListener(*this);
2102 GET_SHAPE_CONFIG(TABLEVIEW::GROUPITEM_DEFAULT_HEIGHT, GetCore().GetOrientation(), __groupItemHeight);
2103 GET_SHAPE_CONFIG(TABLEVIEW::GROUPITEM_DEFAULT_FONT_SIZE, GetCore().GetOrientation(), __groupItemTextFont);
2105 __itemCacheSize = GetCore().GetMaxItemCachingSize();
2107 __pItemFormat = new (std::nothrow) CustomListItemFormat();
2108 SysTryReturnVoidResult(NID_UI_CTRL, __pItemFormat, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
2110 __pItemFormat->Construct();
2113 Color groupTextColor = Color(0);
2114 GET_SHAPE_CONFIG(TABLEVIEW::GROUPITEM_INDEX_BAR_LEFT_MARGIN, GetCore().GetOrientation(), leftMargin);
2115 GET_COLOR_CONFIG(TABLEVIEW::GROUPITEM_TEXT_NORMAL, groupTextColor);
2117 __pItemFormat->AddElement(ID_FORMAT_MARGIN, Rectangle(0, 0, leftMargin, __groupItemHeight), __groupItemTextFont);
2118 __pItemFormat->AddElement(ID_FORMAT_STRING, Rectangle(leftMargin, 0, GetCore().GetBounds().width, __groupItemHeight),
2119 __groupItemTextFont, groupTextColor, groupTextColor);
2121 __pItemFormat->SetElementEventEnabled(ID_FORMAT_MARGIN, true);
2122 __pItemFormat->SetElementEventEnabled(ID_FORMAT_STRING, true);
2128 _SlidableGroupedListImpl::OnUiFastScrollIndexSelected(_Control& source, _FastScrollIndex& index)
2132 String* pIndexText = index.GetIndexText();
2133 if (pIndexText != null)
2135 pIndexText->GetCharAt(0, mch);
2136 result r = __mainScrollIndex.IndexOf(*pIndexText, 0, groupIndex);
2139 const Control& control = GetPublic();
2140 _FastScrollIndex* pMainIndex = index.GetParentIndex();
2141 if (pMainIndex == GetCore().GetFastScrollBar()->GetIndex())
2143 Character mainIndex(mch);
2144 __pFastScrollListener->OnMainIndexChanged(control, mainIndex);
2148 SetLastResult(E_SUCCESS);
2152 _SlidableGroupedListImpl::GetPublicClassName(void) const
2154 return "SlidableGroupedList";
2157 const SlidableGroupedList&
2158 _SlidableGroupedListImpl::GetPublic(void) const
2160 return static_cast<const SlidableGroupedList&>(_ControlImpl::GetPublic());
2163 SlidableGroupedList&
2164 _SlidableGroupedListImpl::GetPublic(void)
2166 return static_cast<SlidableGroupedList&>(_ControlImpl::GetPublic());
2170 _SlidableGroupedListImpl::GetCore(void) const
2172 return static_cast<const _TableView&>(_ControlImpl::GetCore());
2176 _SlidableGroupedListImpl::GetCore(void)
2178 return static_cast<_TableView&>(_ControlImpl::GetCore());
2182 _SlidableGroupedListImpl::ProcessItemStateChange(int groupIndex, int itemIndex, int elementId, ItemStatus itemStatus)
2184 CustomListItem* pCustomListItem = GetCustomListItemAt(groupIndex, itemIndex - GetTopItemIndex(groupIndex));
2185 SysTryReturnVoidResult(NID_UI_CTRL, pCustomListItem, E_SYSTEM, "[E_SYSTEM] A system error has occurred. Failed to get CustomListItem at itemIndex (%d).", itemIndex);
2187 int itemId = pCustomListItem->__pCustomListItemImpl->itemId;
2189 _ListListener* pListenerList = null;
2190 IGroupedItemEventListener* pEventListener = null;
2192 for (int listenerCount = 0; listenerCount < __itemListenersList.GetCount(); listenerCount++)
2194 pListenerList = dynamic_cast<_ListListener*>(__itemListenersList.GetAt(listenerCount));
2195 SysTryReturnVoidResult(NID_UI_CTRL, (pListenerList != null), E_SYSTEM,
2196 "[E_SYSTEM] A system error has occurred. Failed to get _ListListener.");
2198 pEventListener = dynamic_cast<IGroupedItemEventListener*>(pListenerList->pListener);
2199 SysTryReturnVoidResult(NID_UI_CTRL, (pEventListener != null), E_SYSTEM,
2200 "[E_SYSTEM] A system error has occurred. Failed to get IGroupedItemEventListener.");
2202 pEventListener->OnItemStateChanged(GetPublic(), groupIndex, itemIndex, itemId, elementId, itemStatus);
2207 _SlidableGroupedListImpl::ProcessItemStateChange(int groupIndex, int itemIndex, ItemStatus itemStatus)
2209 CustomListItem* pCustomListItem = GetCustomListItemAt(groupIndex, itemIndex - GetTopItemIndex(groupIndex));
2210 SysTryReturnVoidResult(NID_UI_CTRL, pCustomListItem, E_SYSTEM, "[E_SYSTEM] A system error has occurred. Failed to get CustomListItem at itemIndex (%d).", itemIndex);
2212 int itemId = pCustomListItem->__pCustomListItemImpl->itemId;
2214 _ListListener* pListenerList = null;
2215 IGroupedItemEventListener* pEventListener = null;
2217 for (int listenerCount = 0; listenerCount < __itemListenersList.GetCount(); listenerCount++)
2219 pListenerList = dynamic_cast<_ListListener*>(__itemListenersList.GetAt(listenerCount));
2220 SysTryReturnVoidResult(NID_UI_CTRL, (pListenerList != null), E_SYSTEM,
2221 "[E_SYSTEM] A system error has occurred. Failed to get _ListListener.");
2223 pEventListener = dynamic_cast<IGroupedItemEventListener*>(pListenerList->pListener);
2224 SysTryReturnVoidResult(NID_UI_CTRL, (pEventListener != null), E_SYSTEM,
2225 "[E_SYSTEM] A system error has occurred. Failed to get IGroupedItemEventListener.");
2227 pEventListener->OnItemStateChanged(GetPublic(), groupIndex, itemIndex, itemId, itemStatus);
2232 _SlidableGroupedListImpl::CallUnloadItemCb(int groupIndex, int itemIndex)
2234 _ListListener* pListenerData = null;
2235 ISlidableGroupedListEventListener* pSlidableListener = null;
2237 for (int listenerCount = 0; listenerCount < __slidableListenersList.GetCount(); listenerCount++)
2239 pListenerData = dynamic_cast<_ListListener*>(__slidableListenersList.GetAt(listenerCount));
2240 SysTryReturnVoidResult(NID_UI_CTRL, (pListenerData != null), E_SYSTEM,
2241 "[E_SYSTEM] A system error has occurred. Failed to get _ListListener.");
2243 pSlidableListener = dynamic_cast<ISlidableGroupedListEventListener*>(pListenerData->pListener);
2244 SysTryReturnVoidResult(NID_UI_CTRL, (pSlidableListener != null), E_SYSTEM,
2245 "[E_SYSTEM] A system error has occurred. Failed to get IGroupedItemEventListener.");
2247 pSlidableListener->OnUnloadItemRequested(GetPublic(), groupIndex, itemIndex);
2252 _SlidableGroupedListImpl::GetCurrentLoadedCount(void)
2256 for (int groupIndex = __topGroup; groupIndex <= __bottomGroup; groupIndex++)
2258 _TableViewGroupItemData* pTableViewGroupItemData = GetTableViewGroupItemAt(groupIndex);
2260 if (pTableViewGroupItemData)
2265 count += GetSubItemCountAt(groupIndex);
2272 _SlidableGroupedListImpl::GetTopItemIndex(int groupIndex) const
2274 _SlidableGroupObject* pGroupObject = dynamic_cast<_SlidableGroupObject*>(const_cast<Object*>(__groupsList.GetAt(groupIndex)));
2275 SysTryReturn(NID_UI_CTRL, pGroupObject, INVALID_INDEX, E_SYSTEM,
2276 "[E_SYSTEM] A system error has occurred. Failed to get _SlidableGroupObject at groupIndex (%d).", groupIndex);
2278 return pGroupObject->__topIndex;
2281 class _SlidableGroupedListMaker
2282 : public _UiBuilderControlMaker
2285 _SlidableGroupedListMaker(_UiBuilder* uibuilder)
2286 : _UiBuilderControlMaker(uibuilder){};
2287 virtual ~_SlidableGroupedListMaker(){};
2288 static _UiBuilderControlMaker*
2289 GetInstance(_UiBuilder* uibuilder)
2291 _SlidableGroupedListMaker* pSlidableListMaker = new (std::nothrow) _SlidableGroupedListMaker(uibuilder);
2292 return pSlidableListMaker;
2295 virtual Tizen::Ui::Control*
2296 Make(_UiBuilderControl* pControl)
2298 result r = E_SYSTEM;
2299 _UiBuilderControlLayout* pControlProperty = null;
2300 SlidableGroupedList* pSlidableGroupedList = null;
2301 Tizen::Graphics::Rectangle rect;
2302 Tizen::Graphics::Rectangle rectMin;
2304 Tizen::Base::String elementString;
2305 CustomListStyle style = CUSTOM_LIST_STYLE_NORMAL;
2306 bool isItemDivider = true;
2309 GetProperty(pControl, &pControlProperty);
2310 if (pControlProperty == null)
2315 pSlidableGroupedList = new (std::nothrow) SlidableGroupedList();
2316 if (pSlidableGroupedList == null)
2321 rect = pControlProperty->GetRect();
2323 Tizen::Base::String styleString;
2324 styleString = pControlProperty->GetStyle();
2326 if (styleString.Equals(L"CUSTOM_LIST_STYLE_NORMAL", false))
2328 style = CUSTOM_LIST_STYLE_NORMAL;
2330 else if (styleString.Equals(L"CUSTOM_LIST_STYLE_RADIO", false))
2332 style = CUSTOM_LIST_STYLE_RADIO;
2334 else if (styleString.Equals(L"CUSTOM_LIST_STYLE_RADIO_WITH_DIVIDER", false))
2336 style = CUSTOM_LIST_STYLE_RADIO_WITH_DIVIDER;
2338 else if (styleString.Equals(L"CUSTOM_LIST_STYLE_MARK", false))
2340 style = CUSTOM_LIST_STYLE_MARK;
2342 else if (styleString.Equals(L"CUSTOM_LIST_STYLE_MARK_WITH_DIVIDER", false))
2344 style = CUSTOM_LIST_STYLE_MARK_WITH_DIVIDER;
2346 else if (styleString.Equals(L"CUSTOM_LIST_STYLE_ONOFF", false))
2348 style = CUSTOM_LIST_STYLE_ONOFF;
2350 else if (styleString.Equals(L"CUSTOM_LIST_STYLE_ONOFF_WITH_DIVIDER", false))
2352 style = CUSTOM_LIST_STYLE_ONOFF_WITH_DIVIDER;
2356 style = CUSTOM_LIST_STYLE_NORMAL;
2360 if (pControl->GetElement(L"itemDivider", elementString))
2362 if (elementString.Equals(L"true", false))
2364 isItemDivider = true;
2368 isItemDivider = false;
2372 r = pSlidableGroupedList->Construct(rect, style, isItemDivider);
2375 delete pSlidableGroupedList;
2379 if (pControl->GetElement(L"textOfEmptyList", elementString))
2381 pSlidableGroupedList->SetTextOfEmptyList(elementString);
2384 if (pControl->GetElement(L"colorOfEmptyListText", elementString))
2386 ConvertStringToColor(elementString, color);
2387 pSlidableGroupedList->SetTextColorOfEmptyList(color);
2390 GET_DIMENSION_CONFIG(LIST::GROUPEDLIST_MIN_SIZE, _CONTROL_ORIENTATION_PORTRAIT, dimMin);
2391 rectMin = (pControl->GetAttribute(0))->GetRect();
2392 (pControl->GetAttribute(0))->SetRect(rectMin.x, rectMin.y, dimMin.width, dimMin.height);
2394 GET_DIMENSION_CONFIG(LIST::GROUPEDLIST_MIN_SIZE, _CONTROL_ORIENTATION_LANDSCAPE, dimMin);
2395 rectMin = (pControl->GetAttribute(1))->GetRect();
2396 (pControl->GetAttribute(1))->SetRect(rectMin.x, rectMin.y, dimMin.width, dimMin.height);
2398 return pSlidableGroupedList;
2404 _SlidableGroupedListRegister::_SlidableGroupedListRegister()
2406 _UiBuilderControlTableManager* pUiBuilderControlTableManager = _UiBuilderControlTableManager::GetInstance();
2407 if (pUiBuilderControlTableManager)
2409 pUiBuilderControlTableManager->RegisterControl(L"SlidableGroupedList", _SlidableGroupedListMaker::GetInstance);
2412 _SlidableGroupedListRegister::~_SlidableGroupedListRegister()
2414 _UiBuilderControlTableManager* pUiBuilderControlTableManager = _UiBuilderControlTableManager::GetInstance();
2415 if (pUiBuilderControlTableManager)
2417 pUiBuilderControlTableManager->UnregisterControl(L"SlidableGroupedList");
2420 static _SlidableGroupedListRegister SlidableGroupedListRegisterToUiBuilder;
2421 }}} //Tizen::Ui::Controls