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_ListImpl.cpp
20 * @brief This is the implementation file for the _ListImpl class.
24 #include <FBaseSysLog.h>
25 #include <FUiCtrlCustomListItem.h>
26 #include "FUiCtrl_ListImpl.h"
27 #include "FUiCtrl_ListListener.h"
28 #include "FUi_ResourceSizeInfo.h"
29 #include "FUi_UiBuilder.h"
31 using namespace Tizen::Base;
32 using namespace Tizen::Graphics;
33 using namespace Tizen::Base::Collection;
35 namespace Tizen { namespace Ui { namespace Controls
38 extern const int INVALID_INDEX;
40 _NumberElement::_NumberElement(void)
45 _NumberElement::~_NumberElement(void)
49 _ListItemDataProvider::_ListItemDataProvider(_ListImpl* pListImpl)
50 : __pListImpl(pListImpl)
54 _ListItemDataProvider::~_ListItemDataProvider(void)
59 _ListItemDataProvider::GetItemCount(void)
61 SysTryReturn(NID_UI_CTRL, __pListImpl, -1, E_SYSTEM,
62 "[E_SYSTEM] A system error has occurred. List instance is null.");
63 return __pListImpl->GetItemCount();
67 _ListItemDataProvider::CreateItem(int index, int itemWidth)
69 SysTryReturn(NID_UI_CTRL, __pListImpl, null, E_SYSTEM,
70 "[E_SYSTEM] A system error has occurred. List instance is null.");
72 CustomListItem* pCustomListItem = __pListImpl->GetCustomListItemAt(-1, index);
73 SysTryReturn(NID_UI_CTRL, pCustomListItem, null, E_SYSTEM,
74 "[E_SYSTEM] A system error has occurred. Failed to get an item at index(%d).", index);
76 _CustomListItemImpl* pCustomListItemImpl = null;
77 pCustomListItemImpl = pCustomListItem->__pCustomListItemImpl;
78 SysTryReturn(NID_UI_CTRL, pCustomListItemImpl, null, E_SYSTEM,
79 "[E_SYSTEM] A system error has occurred. _CustomListItemImpl instance is null.");
81 int height = __pListImpl->__row1Height + __pListImpl->__row2Height;
82 pCustomListItemImpl->height = height;
84 _TableViewItemParams tableViewItemParams;
85 tableViewItemParams.pItem = (const_cast<CustomListItem*>(pCustomListItem));
86 tableViewItemParams.width = itemWidth;
87 tableViewItemParams.itemId = pCustomListItemImpl->itemId;
88 tableViewItemParams.itemIndex = index;
89 tableViewItemParams.groupIndex = -1;
90 tableViewItemParams.isDividerEnabled = __pListImpl->_isDividerEnabled;
91 tableViewItemParams.pCheckBitmaps = __pListImpl->_pCheckBitmaps;
92 tableViewItemParams.annexStyle = __pListImpl->_annexStyle;
94 result r = _CustomListItemImpl::CreateTableViewItem(tableViewItemParams);
95 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
97 pCustomListItemImpl->__pTableViewItemData->AddTouchEventListener(*__pListImpl);
99 return pCustomListItemImpl->__pTableViewItemData;
103 _ListItemDataProvider::DeleteItem(const int itemIndex, TableViewItem* pItem)
105 _TableViewItemData* pTableViewItemData = dynamic_cast<_TableViewItemData*>(pItem);
106 delete pTableViewItemData;
108 CustomListItem* pCustomListItem = __pListImpl->GetCustomListItemAt(-1, itemIndex);
109 pCustomListItem->__pCustomListItemImpl->__pTableViewItemData = null;
115 _ListItemDataProvider::GetDefaultItemHeight(void)
117 SysTryReturn(NID_UI_CTRL, __pListImpl, 0, E_SYSTEM,
118 "[E_SYSTEM] A system error has occurred. List instance is null.");
119 return (__pListImpl->__row1Height + __pListImpl->__row2Height);
123 _ListItemDataProvider::UpdateItem(int itemIndex, TableViewItem* pItem)
125 SysTryReturnVoidResult(NID_UI_CTRL, __pListImpl, E_SYSTEM,
126 "[E_SYSTEM] A system error has occurred. List instance is null.");
127 CustomListItem* pCustomListItem = __pListImpl->GetCustomListItemAt(-1, itemIndex);
128 SysTryReturnVoidResult(NID_UI_CTRL, pCustomListItem, E_SYSTEM,
129 "[E_SYSTEM] A system error has occurred. Failed to get an item at index(%d).", itemIndex);
131 _CustomListItemImpl* pCustomListItemImpl = null;
132 pCustomListItemImpl = pCustomListItem->__pCustomListItemImpl;
133 SysTryReturnVoidResult(NID_UI_CTRL, pCustomListItemImpl, E_SYSTEM,
134 "[E_SYSTEM] A system error has occurred. _CustomListItemImpl instance is null.");
136 int height = __pListImpl->__row1Height + __pListImpl->__row2Height;
137 pCustomListItemImpl->height = height;
139 SysTryReturnVoidResult(NID_UI_CTRL, pItem, E_SYSTEM,
140 "[E_SYSTEM] A system error has occurred. Failed to get an item at index(%d).", itemIndex);
141 Rectangle rect = pItem->GetBounds();
142 pItem->SetSize(rect.width, height);
148 _NumberElement::DrawElement(const Canvas& canvas, const Rectangle& rect, CustomListItemStatus itemStatus)
153 Canvas* pCanvas = const_cast<Canvas*>(&canvas);
154 SysTryReturnResult(NID_UI_CTRL, (pCanvas != null), E_SYSTEM,
155 "A system error has occurred. Failed to get the canvas.");
157 pCanvas->FillRectangle(Color::GetColor(COLOR_ID_MAGENTA), rect);
158 pCanvas->SetForegroundColor(Color::GetColor(COLOR_ID_WHITE));
162 font.Construct(FONT_STYLE_PLAIN, 18);
163 pCanvas->SetFont(font);
165 if (pCanvas->DrawText(Point(rect.x + 5, rect.y + 5), String(text)) != E_SUCCESS)
174 _ListImpl::GetInstance(List& list)
176 return static_cast<_ListImpl*>(list._pControlImpl);
180 _ListImpl::GetInstance(const List& list)
182 return static_cast<const _ListImpl*>(list._pControlImpl);
185 _ListImpl::_ListImpl(Control* pList, _TableView* pCore)
186 : _ListBaseImpl(pList, pCore)
191 , __text1SlideEnabled(true)
192 , __text2SlideEnabled(true)
193 , __listStyle(LIST_STYLE_NORMAL)
194 , __listItemFormat(LIST_ITEM_SINGLE_IMAGE)
195 , __pNormalBgBitmap(null)
196 , __pHighlightedBgBitmap(null)
197 , __pFocusedBgBitmap(null)
198 , __pNumberElements(null)
199 , __pItemFormat(null)
200 , __pItemProvider(null)
207 _ListImpl::~_ListImpl(void)
209 __itemListeners.RemoveAll(true);
211 if (__pNumberElements != null)
213 __pNumberElements->RemoveAll(true);
214 delete __pNumberElements;
215 __pNumberElements = null;
218 if (__pItemFormat != null)
220 delete __pItemFormat;
221 __pItemFormat = null;
226 delete __pItemProvider;
227 __pItemProvider = null;
230 RemoveAllFromItemsList();
234 _ListImpl::GetPublicClassName(void) const
236 return "Tizen::Ui::Controls::List";
240 _ListImpl::GetPublic(void) const
242 return static_cast<const List&>(_ControlImpl::GetPublic());
246 _ListImpl::GetPublic(void)
248 return static_cast<List&>(_ControlImpl::GetPublic());
252 _ListImpl::GetCore(void) const
254 return static_cast<const _TableView&>(_ControlImpl::GetCore());
258 _ListImpl::GetCore(void)
260 return static_cast<_TableView&>(_ControlImpl::GetCore());
264 _ListImpl::CreateListImplN(List* pControl, const Rectangle& bounds)
266 result r = E_SUCCESS;
268 r = GET_SIZE_INFO(List).CheckInitialSizeValid(Dimension(bounds.width, bounds.height), _CONTROL_ORIENTATION_PORTRAIT);
269 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
271 _TableView* pCore = null;
272 _ListImpl* pImpl = null;
274 pCore = _TableView::CreateTableViewN(TABLE_VIEW_STYLE_SIMPLE, true, TABLE_VIEW_SCROLL_BAR_STYLE_FIXED);
277 SysTryReturn(NID_UI_CTRL, pCore, null, r, "[%s] Propagating.", GetErrorMessage(r));
279 pImpl = new (std::nothrow) _ListImpl(pControl, pCore);
280 SysTryCatch(NID_UI_CTRL, pImpl, , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
292 _ListImpl::Initialize(ListItemFormat itemFormat, int row1Height, int row2Height, int column1Width, int column2Width)
294 result r = E_SUCCESS;
296 GET_FIXED_VALUE_CONFIG(LIST::LIST_ITEM_MAX_COUNT, GetCore().GetOrientation(), maxCount);
298 __pItemProvider = new (std::nothrow) _ListItemDataProvider(this);
299 SysTryReturnResult(NID_UI_CTRL, (__pItemProvider != null), E_OUT_OF_MEMORY, "Memory allocation failed.");
301 TableViewStyle style = GetCore().GetTableViewStyle();
302 SysTryReturn(NID_UI_CTRL, style == TABLE_VIEW_STYLE_SIMPLE, E_INVALID_OPERATION, E_INVALID_OPERATION, "[E_INVALID_OPERATION] The current style of TableView is not TABLE_VIEW_STYLE_SIMPLE");
304 _TableViewItemProvider* pItemProvider = _TableViewItemProvider::CreateTableViewItemProviderN(style);
305 SysTryReturn(NID_UI_CTRL, pItemProvider != null, E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
307 r = pItemProvider->SetSimpleStyleItemProvider(__pItemProvider);
311 delete pItemProvider;
312 SysTryReturn(NID_UI_CTRL, false, r, r, "[%s] Propagating.", GetErrorMessage(r));
315 r = GetCore().SetItemProvider(pItemProvider);
316 SysTryReturn(NID_UI_CTRL, (r == E_SUCCESS), r, r, "[%s] Propagating.", GetErrorMessage(r));
318 r = GetCore().AddTableViewItemEventListener(*this);
319 SysTryReturn(NID_UI_CTRL, (r == E_SUCCESS), r, r, "[%s] Propagating.", GetErrorMessage(r));
321 SetListItemFormat(itemFormat);
323 r = InitializeItemSizes(row1Height, row2Height, column1Width, column2Width);
324 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
326 r = InitCustomListItemFormat();
327 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
333 _ListImpl::InitializeItemSizes(int row1Height, int row2Height, int column1Width, int column2Width)
335 result r = E_SUCCESS;
337 r = SetRow1Height(row1Height);
338 SysTryReturn(NID_UI_CTRL, (r == E_SUCCESS), r, r, "[%s] Propagating.", GetErrorMessage(r));
340 r = SetRow2Height(row2Height);
341 SysTryReturn(NID_UI_CTRL, (r == E_SUCCESS), r, r, "[%s] Propagating.", GetErrorMessage(r));
343 r = SetColumn1Width(column1Width);
344 SysTryReturn(NID_UI_CTRL, (r == E_SUCCESS), r, r, "[%s] Propagating.", GetErrorMessage(r));
346 r = SetColumn2Width(column2Width);
347 SysTryReturn(NID_UI_CTRL, (r == E_SUCCESS), r, r, "[%s] Propagating.", GetErrorMessage(r));
353 _ListImpl::UpdateBounds(const Rectangle& rect)
355 result r = E_SUCCESS;
357 r = InitializeBoundsProperties(GET_SIZE_INFO(CustomList), rect, GetCore().GetOrientation());
358 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
364 _ListImpl::SetStyle(ListStyle style)
367 result r = E_SUCCESS;
371 case LIST_STYLE_NORMAL:
372 case LIST_STYLE_NUMBER:
373 _annexStyle = TABLE_VIEW_ANNEX_STYLE_NORMAL;
376 case LIST_STYLE_RADIO_WITH_DIVIDER:
377 _isDividerEnabled = true;
378 _annexStyle = TABLE_VIEW_ANNEX_STYLE_RADIO;
381 case LIST_STYLE_RADIO:
383 _annexStyle = TABLE_VIEW_ANNEX_STYLE_RADIO;
386 case LIST_STYLE_MARK_WITH_DIVIDER:
387 _isDividerEnabled = true;
388 _annexStyle = TABLE_VIEW_ANNEX_STYLE_MARK;
391 case LIST_STYLE_MARK:
393 _annexStyle = TABLE_VIEW_ANNEX_STYLE_MARK;
396 case LIST_STYLE_ONOFF_WITH_DIVIDER:
397 _isDividerEnabled = true;
398 _annexStyle = TABLE_VIEW_ANNEX_STYLE_ONOFF_SLIDING;
401 case LIST_STYLE_ONOFF:
403 _annexStyle = TABLE_VIEW_ANNEX_STYLE_ONOFF_SLIDING;
410 SysTryReturnResult(NID_UI_CTRL, (r == E_SUCCESS), r, "The current value of List style is invalid.");
412 if ((style == LIST_STYLE_NUMBER) && (__pNumberElements == null))
414 __pNumberElements = new (std::nothrow) LinkedList();
415 SysTryReturnResult(NID_UI_CTRL, __pNumberElements, E_OUT_OF_MEMORY, "Memory allocation failed.");
423 _ListImpl::SetListItemFormat(ListItemFormat itemFormat)
425 __listItemFormat = itemFormat;
430 _ListImpl::InitCustomListItemFormat(void)
432 __pItemFormat = new (std::nothrow) CustomListItemFormat();
433 SysTryReturnResult(NID_UI_CTRL, (__pItemFormat != null), E_OUT_OF_MEMORY, "Memory allocation failed.");
435 __pItemFormat->Construct();
441 GetElementRects(text1Rect, text2Rect, img1Rect, img2Rect);
444 int listStyleNumberX = 0;
445 int listStyleNumberWidth = 0;
446 int listStyleNumberHeight = 0;
447 int checkItemWidth = 0;
448 int checkItemHeight = 0;
450 GET_SHAPE_CONFIG(LIST::LIST_ITEM_TEXT_SIZELIST, GetCore().GetOrientation(), textSize);
452 GET_SHAPE_CONFIG(LIST::LIST_STYLE_NUMBER_X, GetCore().GetOrientation(), listStyleNumberX);
453 GET_SHAPE_CONFIG(LIST::LIST_STYLE_NUMBER_WIDTH, GetCore().GetOrientation(), listStyleNumberWidth);
454 GET_SHAPE_CONFIG(LIST::LIST_STYLE_NUMBER_HEIGHT, GetCore().GetOrientation(), listStyleNumberHeight);
456 GET_SHAPE_CONFIG(LIST::LIST_CHECK_ITEM_WIDTH, GetCore().GetOrientation(), checkItemWidth);
457 GET_SHAPE_CONFIG(LIST::LIST_CHECK_ITEM_HEIGHT, GetCore().GetOrientation(), checkItemHeight);
459 if (__listItemFormat != LIST_ITEM_SINGLE_IMAGE)
461 GET_COLOR_CONFIG(LIST::ELEMENT_TEXT_NORMAL, __text1Color);
463 if (__listItemFormat > LIST_ITEM_SINGLE_IMAGE_TEXT_IMAGE)
465 GET_COLOR_CONFIG(LIST::ELEMENT_TEXT_NORMAL, __text2Color);
470 __pItemFormat->AddElement(ID_FORMAT_TEXT1, text1Rect);
471 __pItemFormat->SetElementEventEnabled(ID_FORMAT_TEXT1, false);
476 __pItemFormat->AddElement(ID_FORMAT_IMAGE1, img1Rect);
477 __pItemFormat->SetElementEventEnabled(ID_FORMAT_IMAGE1, false);
482 __pItemFormat->AddElement(ID_FORMAT_TEXT2, text2Rect);
483 __pItemFormat->SetElementEventEnabled(ID_FORMAT_TEXT2, false);
488 __pItemFormat->AddElement(ID_FORMAT_IMAGE2, img2Rect);
489 __pItemFormat->SetElementEventEnabled(ID_FORMAT_IMAGE2, false);
492 if (__listStyle == LIST_STYLE_NUMBER)
494 __pItemFormat->AddElement(ID_FORMAT_NUMBER, Rectangle(listStyleNumberX, GetItemHeight()/2 - 15, listStyleNumberWidth, listStyleNumberHeight));
495 __pItemFormat->SetElementEventEnabled(ID_FORMAT_NUMBER, false);
498 if (_annexStyle != TABLE_VIEW_ANNEX_STYLE_NORMAL)
500 __pItemFormat->AddElement(ID_FORMAT_CHECK, Rectangle(GetCore().GetBounds().width - 60, GetItemHeight() / 2 - 25, checkItemWidth , checkItemHeight));
501 __pItemFormat->SetElementEventEnabled(ID_FORMAT_CHECK, true);
508 _ListImpl::GetTextSlide(ListItemText textIndex)
512 case LIST_ITEM_TEXT1:
513 return __text1SlideEnabled;
515 case LIST_ITEM_TEXT2:
516 return __text2SlideEnabled;
519 SysTryReturn(NID_UI_CTRL, false, false, E_SYSTEM,
520 "[E_SYSTEM] A system error has occurred. The ListItemText is invalid.");
525 _ListImpl::AddItemEventListener(const IItemEventListener& listener)
527 _ListListener* pListListener = new (std::nothrow) _ListListener;
528 SysTryReturn(NID_UI_CTRL, pListListener, E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
530 pListListener->pListener = const_cast<IItemEventListener*>(&listener);
531 __itemListeners.Add(*pListListener);
537 _ListImpl::RemoveItemEventListener(const IItemEventListener& listener)
539 _ListListener* pListListener = null;
541 int count = __itemListeners.GetCount();
543 for (int listenerCount = 0; listenerCount < count; listenerCount++)
545 pListListener = dynamic_cast<_ListListener*>(__itemListeners.GetAt(listenerCount));
547 if ((pListListener != null) && (pListListener->pListener == &listener))
550 __itemListeners.RemoveAt(listenerCount, true);
559 _ListImpl::AddItem(const String* pText1, const String* pText2,
560 const Bitmap* pBitmap1, const Bitmap* pBitmap2, int itemId)
562 if (__listStyle == LIST_STYLE_NUMBER)
564 SysTryReturnResult(NID_UI_CTRL, (GetItemCount() < maxCount),
565 E_MAX_EXCEEDED, "AddItem operation exceeds the maximum limit for this list style");
568 return InsertItemAt(GetItemCount(), pText1, pText2, pBitmap1, pBitmap2, itemId);
572 _ListImpl::InsertItemAt(int index, const String* pText1, const String* pText2,
573 const Bitmap* pBitmap1, const Bitmap* pBitmap2, int itemId)
575 result r = E_SUCCESS;
577 if (__listStyle == LIST_STYLE_NUMBER)
579 SysTryReturnResult(NID_UI_CTRL, (GetItemCount() < maxCount),
580 E_MAX_EXCEEDED, "InsertItemAt operation exceeds the maximum limit for this list style");
583 SysTryReturnResult(NID_UI_CTRL, (index >= 0 && index <= GetItemCount()),
584 E_OUT_OF_RANGE, "The index(%d) is out of range.", index);
586 CustomListItem *pItem = GetNewItemN(pText1, pText2, pBitmap1, pBitmap2, itemId, index);
587 SysTryReturnResult(NID_UI_CTRL, pItem, GetLastResult(),
588 "A system error has occurred. CustomListItem instance is null.");
590 r = InsertIntoItemsList(*pItem, -1, index);
591 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, E_SYSTEM, E_SYSTEM, "[%s] Failed to insert an item.", GetErrorMessage(r));
593 if (GetCore().GetFirstDrawnFlag() == false)
595 r = GetCore().RefreshTableView(0, index, TABLE_VIEW_REFRESH_TYPE_ITEM_ADD);
596 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , E_SYSTEM, "[%s] Propagating.",GetErrorMessage(r));
599 if (__listStyle == LIST_STYLE_NUMBER)
601 r = UpdateNumbers(index);
602 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , E_SYSTEM,
603 "[E_SYSTEM] A system error has occurred. Failed to update the numbers");
610 RemoveFromItemsList(-1, index);
612 if (__listStyle == LIST_STYLE_NUMBER)
614 __pNumberElements->RemoveAt(index, true);
620 _ListImpl::SetItemAt(int index, const String* pText1, const String* pText2,
621 const Bitmap* pBitmap1, const Bitmap* pBitmap2, int itemId)
623 result r = E_SUCCESS;
624 SysTryReturnResult(NID_UI_CTRL, (index >= 0 && index < GetItemCount()),
625 E_OUT_OF_RANGE, "The index(%d) is out of range.", index);
627 if (__listStyle == LIST_STYLE_NUMBER)
629 __pNumberElements->RemoveAt(index, true);
632 CustomListItem *pItem = GetNewItemN(pText1, pText2, pBitmap1, pBitmap2, itemId, index);
633 SysTryReturnResult(NID_UI_CTRL, pItem, GetLastResult(),
634 "A system error has occurred. CustomListItem instance is null.");
636 pItem->__pCustomListItemImpl->__pTableViewItemData = GetTableViewItemAt(-1, index);
638 _CheckElementModel* pCheckElement = null;
639 _CheckElementModel* pOldCheckElement = GetCheckElementAt(-1, index);
640 _CheckBoxStatus oldCheckStatus = (pOldCheckElement) ? (pOldCheckElement->GetCheckBoxStatus()) : CHECK_BOX_UNCHECKED;
642 pItem->__pCustomListItemImpl->itemId = itemId;
644 pCheckElement = GetCheckElementAt(-1, index);
648 pCheckElement->SetCheckBoxStatus(oldCheckStatus);
651 r = SetInItemsList(*pItem, -1, index);
652 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Failed to perform SetAt operation.", GetErrorMessage(r));
654 _TableViewItemUpdateParams updateParams;
655 updateParams.pItem = const_cast<CustomListItem*>(pItem);
656 updateParams.isDividerEnabled = _isDividerEnabled;
657 updateParams.pCheckBitmaps = _pCheckBitmaps;
658 updateParams.annexStyle = _annexStyle;
660 r = _CustomListItemImpl::UpdateTableViewItem(updateParams);
661 SysTryReturn(NID_UI_CTRL, (r == E_SUCCESS), false, E_SYSTEM,
662 "[E_SYSTEM] A system error has occurred. Failed to refresh an item.");
664 if (GetCore().GetFirstDrawnFlag() == false)
666 r = GetCore().RefreshTableView(0, index, TABLE_VIEW_REFRESH_TYPE_ITEM_MODIFY);
667 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, E_SYSTEM, E_SYSTEM, "[%s] Propagating.",GetErrorMessage(r));
670 r = GetCore().SetItemEnabled(0, index, true);
671 SysTryReturnResult(NID_UI_CTRL, (r == E_SUCCESS), E_SYSTEM,
672 "A system error has occurred. Failed to enable an item.");
678 _ListImpl::RemoveItemAt(int index)
680 result r = E_SUCCESS;
682 SysTryReturnResult(NID_UI_CTRL, (index >= 0 && index < GetItemCount()),
683 E_OUT_OF_RANGE, "The index(%d) is out of range.", index);
685 if (GetCore().GetFirstDrawnFlag() == false)
687 r = GetCore().RefreshTableView(groupIndex, index, TABLE_VIEW_REFRESH_TYPE_ITEM_REMOVE);
688 SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, E_SYSTEM, "Propagating.");
691 r = RemoveFromItemsList(-1, index);
692 SysTryReturnResult(NID_UI_CTRL, (r == E_SUCCESS), E_SYSTEM, "Failed to perform RemoveAt operation");
694 if (__listStyle == LIST_STYLE_NUMBER)
696 __pNumberElements->RemoveAt(index, true);
697 r = UpdateNumbers(index - 1);
698 SysTryReturn(NID_UI_CTRL, (r == E_SUCCESS), r, r, "[%s] Failed to perform UpdateNumbers", GetErrorMessage(r));
707 _ListImpl::RemoveAllItems(void)
709 result r = E_SUCCESS;
710 int count = GetItemCount();
713 result finalResult = E_SUCCESS;
715 for (itemIndex = count - 1; itemIndex >= 0; itemIndex--)
717 r = RemoveItemAt(itemIndex);
721 SysLog(NID_UI_CTRL, "[%s] Failed to remove item at index(%d)", GetErrorMessage(r), itemIndex);
729 _ListImpl::SetItemEnabled(int index, bool enable)
731 result r = E_SUCCESS;
733 SysTryReturnResult(NID_UI_CTRL, (index >= 0 && index < GetItemCount()), E_SYSTEM,
734 "A system error has occurred. The current value of index(%d) is invalid.", index);
736 _CheckElementModel* pCheckElementModel = GetCheckElementAt(-1, index);
738 if (pCheckElementModel)
742 if (pCheckElementModel->GetCheckBoxStatus() == CHECK_BOX_DISABLED)
744 pCheckElementModel->SetCheckBoxStatus(CHECK_BOX_CHECKED);
749 if (pCheckElementModel->GetCheckBoxStatus() == CHECK_BOX_CHECKED)
751 if (_annexStyle == TABLE_VIEW_ANNEX_STYLE_MARK)
753 pCheckElementModel->SetCheckBoxStatus(CHECK_BOX_DISABLED);
759 r = GetCore().SetItemEnabled(0, index, enable);
760 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, E_SYSTEM, E_SYSTEM, "[%s] Propagating.", GetErrorMessage(r));
768 _ListImpl::IsItemEnabled(int index) const
770 return GetCore().IsItemEnabled(0, index);
774 _ListImpl::SetFocusedItemBackgroundBitmap(const Bitmap& bitmap)
776 __pFocusedBgBitmap = const_cast<Bitmap*>(&bitmap);
777 SysTryReturnVoidResult(NID_UI_CTRL, __pFocusedBgBitmap, E_SYSTEM,
778 "[E_SYSTEM] A system error has occurred. Failed to get the Bitmap");
779 SetBitmap(TABLE_VIEW_ITEM_DRAWING_STATUS_PRESSED, bitmap);
785 _ListImpl::SetHighlightedItemBackgroundBitmap(const Bitmap& bitmap)
787 __pHighlightedBgBitmap = const_cast<Bitmap*>(&bitmap);
788 SysTryReturnVoidResult(NID_UI_CTRL, __pHighlightedBgBitmap, E_SYSTEM,
789 "[E_SYSTEM] A system error has occurred. Failed to get the Bitmap");
790 SetBitmap(TABLE_VIEW_ITEM_DRAWING_STATUS_HIGHLIGHTED, bitmap);
796 _ListImpl::SetNormalItemBackgroundBitmap(const Bitmap& bitmap)
798 __pNormalBgBitmap = const_cast<Bitmap*>(&bitmap);
799 SysTryReturnVoidResult(NID_UI_CTRL, __pNormalBgBitmap, E_SYSTEM,
800 "[E_SYSTEM] A system error has occurred. Failed to get the Bitmap");
801 SetBitmap(TABLE_VIEW_ITEM_DRAWING_STATUS_NORMAL, bitmap);
807 _ListImpl::SetItemTextColor(ListItemText textIndex, const Color& textColor)
811 SysTryReturnVoidResult(NID_UI_CTRL, (__listItemFormat != LIST_ITEM_SINGLE_IMAGE), E_SYSTEM,
812 "[E_SYSTEM] A system error has occurred. The current value of ListItemFormat is invalid.");
816 case LIST_ITEM_TEXT1:
817 __text1Color.SetRGB32(textColor.GetRGB32(), textColor.GetAlpha());
818 elementId = ID_FORMAT_TEXT1;
821 case LIST_ITEM_TEXT2:
822 SysTryReturnVoidResult(NID_UI_CTRL, (__listItemFormat > LIST_ITEM_SINGLE_IMAGE_TEXT_IMAGE), E_SYSTEM,
823 "[E_SYSTEM] A system error has occurred. The current value of ListItemFormat is invalid.");
824 __text2Color.SetRGB32(textColor.GetRGB32(), textColor.GetAlpha());
825 elementId = ID_FORMAT_TEXT2;
829 SysTryReturnVoidResult(NID_UI_CTRL, (false), E_SYSTEM,
830 "[E_SYSTEM] A system error has occurred. The current value of ListItemText is invalid.");
838 GetElementRects(text1Rect, text2Rect, img1Rect, img2Rect);
842 case LIST_ITEM_TEXT1:
843 __pItemFormat->AddElement(elementId, text1Rect, 38, __text1Color, __text1Color, __text1Color);
846 case LIST_ITEM_TEXT2:
847 __pItemFormat->AddElement(elementId, text2Rect, 38, __text2Color, __text2Color, __text2Color);
851 int count = GetItemCount();
852 for (int index = 0; index < count; index++)
861 _ListImpl::GetItemTextColor(ListItemText textIndex) const
863 if (textIndex == LIST_ITEM_TEXT1)
867 else if(textIndex == LIST_ITEM_TEXT2)
873 SysLog(NID_UI_CTRL, "[E_SYSTEM] A system error has occurred. The current value of ListItemText is invalid.");
880 _ListImpl::EnableTextSlide(ListItemText textIndex)
885 case LIST_ITEM_TEXT1:
886 __text1SlideEnabled = true;
887 elementId = ID_FORMAT_TEXT1;
890 case LIST_ITEM_TEXT2:
891 __text2SlideEnabled = true;
892 elementId = ID_FORMAT_TEXT2;
898 SysTryReturnVoidResult(NID_UI_CTRL, (elementId != -1), E_SYSTEM,
899 "[E_SYSTEM] A system error has occurred. The ListItemText is invalid.");
901 int maxCount = GetItemCount();
903 for (int itemCount = 0; itemCount < maxCount; itemCount++)
905 CustomListItem* pItem = GetCustomListItemAt(-1, itemCount);
906 SysTryReturnVoidResult(NID_UI_CTRL, (pItem), E_SYSTEM,
907 "[E_SYSTEM] A system error has occurred. Failed to get item at %d.", itemCount);
909 _CustomListItemImpl *pItemImpl = pItem->__pCustomListItemImpl;
910 SysTryReturnVoidResult(NID_UI_CTRL, (pItemImpl), E_SYSTEM,
911 "[E_SYSTEM] A system error has occurred. Failed to get item at %d.", itemCount);
913 pItemImpl->SetTextSliding(elementId, true);
920 _ListImpl::DisableTextSlide(void)
922 __text1SlideEnabled = false;
923 __text2SlideEnabled = false;
925 int maxCount = GetItemCount();
927 for (int itemCount = 0; itemCount < maxCount; itemCount++)
929 CustomListItem* pItem = GetCustomListItemAt(-1, itemCount);
930 SysTryReturnVoidResult(NID_UI_CTRL, (pItem), E_SYSTEM,
931 "[E_SYSTEM] A system error has occurred. Failed to get item at %d.", itemCount);
933 _CustomListItemImpl *pItemImpl = pItem->__pCustomListItemImpl;
934 SysTryReturnVoidResult(NID_UI_CTRL, (pItemImpl), E_SYSTEM,
935 "[E_SYSTEM] A system error has occurred. Failed to get item at %d.", itemCount);
937 pItemImpl->SetTextSliding(ID_FORMAT_TEXT1, false);
938 pItemImpl->SetTextSliding(ID_FORMAT_TEXT2, false);
945 _ListImpl::GetItemHeight(void) const
947 if (__listItemFormat < LIST_ITEM_DOUBLE_IMAGE_TEXT_FULLTEXT)
952 return __row1Height + __row2Height;
956 _ListImpl::GetRow1Height(void) const
962 _ListImpl::GetRow2Height(void) const
968 _ListImpl::GetColumn1Width(void) const
970 return __column1Width;
974 _ListImpl::GetColumn2Width(void) const
976 return __column2Width;
980 _ListImpl::SetRow1Height(int row1Height)
982 __row1Height = row1Height;
983 if (GetCore().GetFirstDrawnFlag() == false)
992 _ListImpl::SetRow2Height(int row2Height)
994 if (__listItemFormat < LIST_ITEM_DOUBLE_IMAGE_TEXT_FULLTEXT)
1000 __row2Height = row2Height;
1001 if (GetCore().GetFirstDrawnFlag() == false)
1003 return ReDrawList();
1011 _ListImpl::SetColumn1Width(int column1Width)
1013 __column1Width = column1Width;
1014 if (GetCore().GetFirstDrawnFlag() == false)
1016 return ReDrawList();
1023 _ListImpl::SetColumn2Width(int column2Width)
1025 __column2Width = column2Width;
1026 if (GetCore().GetFirstDrawnFlag() == false)
1028 return ReDrawList();
1036 _ListImpl::SetItemChecked(int index, bool check)
1038 SysTryReturnResult(NID_UI_CTRL, (index >= 0 && index < GetItemCount()), E_SYSTEM,
1039 "A system error has occurred. The current value of index(%d) is invalid.", index);
1041 SysTryReturnResult(NID_UI_CTRL, (__listStyle != LIST_STYLE_NORMAL), E_SYSTEM,
1042 "A system error has occurred. List style should not be LIST_STYLE_NORMAL");
1043 SysTryReturnResult(NID_UI_CTRL, (__listStyle != LIST_STYLE_NUMBER), E_SYSTEM,
1044 "A system error has occurred. List style should not be LIST_STYLE_NUMBER");
1046 if (IsItemChecked(index) == check)
1051 SysTryReturnResult(NID_UI_CTRL, (IsItemEnabled(index)), E_SYSTEM,
1052 "A system error has occurred. The List item is not enabled at index(%d).", index);
1054 _CheckElementModel* pCheckElementModel = GetCheckElementAt(-1, index);
1055 SysTryReturnResult(NID_UI_CTRL, pCheckElementModel, E_SYSTEM,
1056 "A system error has occurred. _CheckElementModel instance is null.");
1058 if (_annexStyle == TABLE_VIEW_ANNEX_STYLE_RADIO)
1062 if (_currentRadioIndex != -1)
1064 _CheckElementModel* pOldCheckElementModel = GetCheckElementAt(-1, _currentRadioIndex);
1065 SysTryReturnResult(NID_UI_CTRL, pOldCheckElementModel, E_SYSTEM,
1066 "A system error has occurred. _CheckElementModel instance is null.");
1068 pOldCheckElementModel->SetCheckBoxStatus(CHECK_BOX_UNCHECKED);
1069 DrawItem(-1, _currentRadioIndex);
1071 _currentRadioIndex = index;
1075 _currentRadioIndex = -1;
1079 pCheckElementModel->SetCheckBoxStatus((_CheckBoxBitmapType)check);
1081 DrawItem(-1, index);
1087 _ListImpl::IsItemChecked(int index) const
1089 SysTryReturn(NID_UI_CTRL, (__listStyle != LIST_STYLE_NORMAL), false, E_SYSTEM,
1090 "[E_SYSTEM] A system error has occurred. List style should not be LIST_STYLE_NORMAL.");
1091 SysTryReturn(NID_UI_CTRL, (__listStyle != LIST_STYLE_NUMBER), false, E_SYSTEM,
1092 "[E_SYSTEM] A system error has occurred. List style should not be LIST_STYLE_NUMBER.");
1094 SysTryReturn(NID_UI_CTRL, (index >= 0 && index < GetItemCount()),
1095 false, E_INVALID_ARG, "[E_INVALID_ARG] The current value of index(%d) is invalid.", index);
1097 const _CheckElementModel* pCheckElement = GetCheckElementAt(-1, index);
1098 SysTryReturn(NID_UI_CTRL, pCheckElement, false, E_SYSTEM, "[E_SYSTEM] A system error has occurred. CheckElement is not constructed properly.");
1100 return (bool)pCheckElement->GetCheckBoxStatus();
1104 _ListImpl::SetAllItemsChecked(bool check)
1106 SysTryReturnResult(NID_UI_CTRL, (__listStyle != LIST_STYLE_NORMAL), E_SYSTEM,
1107 "A system error has occurred. List style should not be LIST_STYLE_NORMAL");
1108 SysTryReturnResult(NID_UI_CTRL, (__listStyle != LIST_STYLE_NUMBER), E_SYSTEM,
1109 "A system error has occurred. List style should not be LIST_STYLE_NUMBER");
1110 SysTryReturnResult(NID_UI_CTRL, (__listStyle != LIST_STYLE_RADIO), E_SYSTEM,
1111 "A system error has occurred. List style should not be LIST_STYLE_RADIO");
1112 SysTryReturnResult(NID_UI_CTRL, (__listStyle != LIST_STYLE_RADIO_WITH_DIVIDER), E_SYSTEM,
1113 "A system error has occurred. List style should not be LIST_STYLE_RADIO_WITH_DIVIDER");
1115 _CheckElementModel* pCheckElement = null;
1117 for (int index = 0; index < GetItemCount(); index++)
1119 if (IsItemEnabled(index))
1121 pCheckElement = GetCheckElementAt(-1, index);
1122 SysTryReturnResult(NID_UI_CTRL, (pCheckElement != null), E_SYSTEM,
1123 "A system error has occurred. _CheckElementModel instance is null.");
1125 pCheckElement->SetCheckBoxStatus((_CheckBoxBitmapType)check);
1135 _ListImpl::RemoveAllCheckedItems(void)
1137 SysTryReturnResult(NID_UI_CTRL, (__listStyle != LIST_STYLE_NORMAL), E_SYSTEM,
1138 "A system error has occurred. List style should not be LIST_STYLE_NORMAL");
1139 SysTryReturnResult(NID_UI_CTRL, (__listStyle != LIST_STYLE_NUMBER), E_SYSTEM,
1140 "A system error has occurred. List style should not be LIST_STYLE_NUMBER");
1141 SysTryReturnResult(NID_UI_CTRL, (__listStyle != LIST_STYLE_RADIO), E_SYSTEM,
1142 "A system error has occurred. List style should not be LIST_STYLE_RADIO");
1143 SysTryReturnResult(NID_UI_CTRL, (__listStyle != LIST_STYLE_RADIO_WITH_DIVIDER), E_SYSTEM,
1144 "A system error has occurred. List style should not be LIST_STYLE_RADIO_WITH_DIVIDER");
1146 result r = E_SUCCESS;
1147 result finalResult = E_SUCCESS;
1149 for (int index = GetItemCount() -1; index >= 0; index--)
1151 if (IsItemChecked(index))
1153 r = RemoveItemAt(index);
1158 SysLog(NID_UI_CTRL, "[%s] Item at index(%d) is not removed successfully.", GetErrorMessage(r), index);
1167 _ListImpl::GetFirstCheckedItemIndex(void) const
1169 SysTryReturn(NID_UI_CTRL, (__listStyle != LIST_STYLE_NORMAL), INVALID_INDEX, E_SYSTEM,
1170 "[E_SYSTEM] A system error has occurred. List style should not be LIST_STYLE_NORMAL.");
1171 SysTryReturn(NID_UI_CTRL, (__listStyle != LIST_STYLE_NUMBER), INVALID_INDEX, E_SYSTEM,
1172 "[E_SYSTEM] A system error has occurred. List style should not be LIST_STYLE_NUMBER.");
1174 for (int index = 0; index < GetItemCount(); index++)
1176 if (IsItemChecked(index))
1178 SetLastResult(E_SUCCESS);
1182 SetLastResult(E_SUCCESS);
1183 return INVALID_INDEX;
1187 _ListImpl::GetLastCheckedItemIndex(void) const
1189 SysTryReturn(NID_UI_CTRL, (__listStyle != LIST_STYLE_NORMAL), INVALID_INDEX, E_SYSTEM,
1190 "[E_SYSTEM] A system error has occurred. List style should not be LIST_STYLE_NORMAL.");
1191 SysTryReturn(NID_UI_CTRL, (__listStyle != LIST_STYLE_NUMBER), INVALID_INDEX, E_SYSTEM,
1192 "[E_SYSTEM] A system error has occurred. List style should not be LIST_STYLE_NUMBER.");
1194 for (int index = GetItemCount() - 1; index >= 0; index--)
1196 if (IsItemChecked(index))
1198 SetLastResult(E_SUCCESS);
1202 SetLastResult(E_SUCCESS);
1204 return INVALID_INDEX;
1208 _ListImpl::GetNextCheckedItemIndexAfter(int index) const
1210 SysTryReturn(NID_UI_CTRL, (__listStyle != LIST_STYLE_NORMAL), INVALID_INDEX, E_SYSTEM,
1211 "[E_SYSTEM] A system error has occurred. List style should not be LIST_STYLE_NORMAL.");
1212 SysTryReturn(NID_UI_CTRL, (__listStyle != LIST_STYLE_NUMBER), INVALID_INDEX, E_SYSTEM,
1213 "[E_SYSTEM] A system error has occurred. List style should not be LIST_STYLE_NUMBER.");
1215 SysTryReturn(NID_UI_CTRL, (index >= 0 && index < GetItemCount()), INVALID_INDEX, E_SYSTEM,
1216 "[E_SYSTEM] A system error has occurred. The current value of index(%d) is invalid.") ;
1218 for (int itemCount = index + 1; itemCount < GetItemCount(); itemCount++)
1220 if (IsItemChecked(itemCount))
1222 SetLastResult(E_SUCCESS);
1226 SetLastResult(E_SUCCESS);
1228 return INVALID_INDEX;
1232 _ListImpl::GetItemIndexFromItemId(int itemId) const
1234 for (int index = 0; index < GetItemCount(); index++)
1236 const CustomListItem* pCustomListItem = GetCustomListItemAt(-1, index);
1237 SysTryReturn(NID_UI_CTRL, pCustomListItem, INVALID_INDEX, E_SYSTEM,
1238 "[E_SYSTEM] A system error has occurred. Failed to get an item at index(%d).", index);
1240 if (pCustomListItem->__pCustomListItemImpl->itemId == itemId)
1242 SetLastResult(E_SUCCESS);
1247 SetLastResult(E_SUCCESS);
1249 return INVALID_INDEX;
1253 _ListImpl::GetItemIdAt(int index) const
1255 SysTryReturn(NID_UI_CTRL, (index >= 0 && index < GetItemCount()),
1256 -1, E_INVALID_ARG, "[E_INVALID_ARG] The current value of index(%d) is invalid.", index);
1258 const CustomListItem* pCustomListItem = GetCustomListItemAt(-1, index);
1259 SysTryReturn(NID_UI_CTRL, pCustomListItem, -1, E_SYSTEM, "[E_SYSTEM] A system error has occurred. Failed to get an item at index(%d).", index);
1261 SysTryReturn(NID_UI_CTRL, pCustomListItem->__pCustomListItemImpl, -1, E_SYSTEM, "[E_SYSTEM] A system error has occurred. Failed to get an item at index(%d).", index);
1263 SetLastResult(E_SUCCESS);
1264 return pCustomListItem->__pCustomListItemImpl->itemId;
1268 _ListImpl::ScrollToBottom(void)
1270 result r = E_SUCCESS;
1272 GetCore().SetBottomDrawnItemIndex(0, GetItemCount() - 1);
1273 SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
1275 SetLastResult(E_SUCCESS);
1282 _ListImpl::ScrollToTop(void)
1284 result r = E_SUCCESS;
1285 r = GetCore().SetTopDrawnItemIndex(0,0);
1286 SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
1288 SetLastResult(E_SUCCESS);
1295 _ListImpl::ScrollToTop(int index)
1297 SysTryReturnResult(NID_UI_CTRL, (index >= 0 && index < GetItemCount()), E_INVALID_ARG, "The current value of index(%d) is invalid.", index);
1299 result r = GetCore().SetTopDrawnItemIndex(0, index);
1300 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, E_SYSTEM, E_SYSTEM, "[%s] Propagating.", GetErrorMessage(r));
1308 _ListImpl::RefreshItem(int index)
1310 SysTryReturnResult(NID_UI_CTRL, (index >= 0 && index < GetItemCount()), E_INVALID_ARG, "The current value of index(%d) is invalid.", index);
1312 int topItemIndex = -1;
1313 int bottomItemIndex = -1;
1314 int groupIndex = -1;
1316 GetCore().GetTopDrawnItemIndex(groupIndex, topItemIndex);
1317 GetCore().GetBottomDrawnItemIndex(groupIndex, bottomItemIndex);
1319 SysTryReturnResult(NID_UI_CTRL, (index >= topItemIndex && index <= bottomItemIndex), E_INVALID_OPERATION,
1320 "Index(%d) should be within drawn item range.", index);
1322 result r = E_SUCCESS;
1324 _TableViewItemUpdateParams updateParams;
1325 updateParams.pItem = GetCustomListItemAt(-1, index);
1326 updateParams.isDividerEnabled = _isDividerEnabled;
1327 updateParams.pCheckBitmaps = _pCheckBitmaps;
1328 updateParams.annexStyle = _annexStyle;
1330 r = _CustomListItemImpl::UpdateTableViewItem(updateParams);
1331 SysTryReturnResult(NID_UI_CTRL, (r == E_SUCCESS), E_SYSTEM,
1332 "A system error has occurred. Failed to refresh an item.");
1334 DrawItem(-1, index);
1340 _ListImpl::GetNewItemN(const String* pText1, const String* pText2, const Bitmap* pBitmap1, const Bitmap* pBitmap2, int itemId, int index)
1342 SysTryReturn(NID_UI_CTRL, __pItemFormat, null, E_SYSTEM,
1343 "[E_SYSTEM] A system error has occurred. Item Format must not be null.");
1344 Dimension listSize = GetCore().GetSize();
1345 Rectangle text1Rect;
1346 Rectangle text2Rect;
1350 GetElementRects(text1Rect, text2Rect, img1Rect, img2Rect);
1352 CustomListItem* pItem = new (std::nothrow) CustomListItem();
1353 SysTryReturn(NID_UI_CTRL, pItem, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
1355 pItem->Construct(GetItemHeight());
1356 pItem->SetItemFormat(*__pItemFormat);
1357 pItem->__pCustomListItemImpl->itemId = itemId;
1359 if ((pText1 != null) && (text1Rect.x > 0))
1361 pItem->SetElement(ID_FORMAT_TEXT1, *pText1);
1362 pItem->__pCustomListItemImpl->SetTextSliding(ID_FORMAT_TEXT1, __text1SlideEnabled);
1365 if ((pBitmap1 != null) && (img1Rect.x > 0))
1367 pItem->SetElement(ID_FORMAT_IMAGE1, *pBitmap1, pBitmap1);
1370 if ((pText2 != null) && (text2Rect.x > 0))
1372 pItem->SetElement(ID_FORMAT_TEXT2, *pText2);
1373 pItem->__pCustomListItemImpl->SetTextSliding(ID_FORMAT_TEXT2, __text2SlideEnabled);
1376 if ((pBitmap2 != null) && (img2Rect.x > 0))
1378 pItem->SetElement(ID_FORMAT_IMAGE2, *pBitmap2, pBitmap2);
1381 _NumberElement *pNumberElement = null;
1383 if (__listStyle == LIST_STYLE_NUMBER)
1385 pNumberElement = new (std::nothrow) _NumberElement();
1386 SysTryReturn(NID_UI_CTRL, pNumberElement, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
1387 pNumberElement->index = index + 1;
1388 __pNumberElements->InsertAt(*pNumberElement, index);
1389 pItem->SetElement(ID_FORMAT_NUMBER, *(dynamic_cast<ICustomListElement*>(pNumberElement)));
1392 if (_annexStyle != TABLE_VIEW_ANNEX_STYLE_NORMAL)
1394 pItem->SetCheckBox(ID_FORMAT_CHECK);
1401 _ListImpl::GetItemMargins(int& leftMargin, int& numberStyleMargin, int& dividerMargin, int& lowerMargin, int& upperMargin)
1403 if (__listStyle == LIST_STYLE_NUMBER)
1405 GET_SHAPE_CONFIG(LIST::LIST_ITEM_NUMBER_STYLE_MARGIN, GetCore().GetOrientation(), numberStyleMargin);
1408 if (_isDividerEnabled == true || divider == true)
1410 GET_SHAPE_CONFIG(LIST::LIST_ITEM_DIVIDER_MARGIN, GetCore().GetOrientation(), dividerMargin);
1413 GET_SHAPE_CONFIG(LIST::LIST_ITEM_LEFT_MARGIN, GetCore().GetOrientation(), leftMargin);
1414 GET_SHAPE_CONFIG(LIST::LIST_ITEM_LOWER_MARGIN, GetCore().GetOrientation(), lowerMargin);
1415 GET_SHAPE_CONFIG(LIST::LIST_ITEM_UPPER_MARGIN, GetCore().GetOrientation(), upperMargin);
1419 _ListImpl::GetElementRects(Rectangle& text1Rect, Rectangle& text2Rect, Rectangle& img1Rect, Rectangle& img2Rect)
1421 Dimension listSize = GetCore().GetSize();
1424 int numberStyleMargin = 0;
1425 int dividerMargin = 0;
1426 int lowerMargin = 0;
1427 int upperMargin = 0;
1429 GetItemMargins(leftMargin, numberStyleMargin, dividerMargin, lowerMargin, upperMargin);
1431 switch (__listItemFormat)
1433 case LIST_ITEM_SINGLE_IMAGE:
1435 img1Rect.x = leftMargin + numberStyleMargin;
1436 img1Rect.y = upperMargin;
1437 img1Rect.width = __column1Width - dividerMargin;
1438 img1Rect.height = __row1Height - lowerMargin;
1442 case LIST_ITEM_SINGLE_TEXT:
1444 text1Rect.x = leftMargin + numberStyleMargin;
1445 text1Rect.y = upperMargin;
1446 text1Rect.width = __column1Width - dividerMargin - text1Rect.x;
1447 text1Rect.height = __row1Height - lowerMargin;
1451 case LIST_ITEM_SINGLE_IMAGE_TEXT:
1453 img1Rect.x = leftMargin + numberStyleMargin;
1454 img1Rect.y = upperMargin;
1455 img1Rect.width = __column1Width;
1456 img1Rect.height = __row1Height - lowerMargin;
1458 text1Rect.x = __column1Width + leftMargin + numberStyleMargin;
1459 text1Rect.y = upperMargin;
1460 text1Rect.width = (__column1Width + __column2Width + dividerMargin <= listSize.width) ? (__column2Width) : (__column2Width - dividerMargin);
1461 text1Rect.height = __row1Height - lowerMargin;
1465 case LIST_ITEM_SINGLE_TEXT_IMAGE:
1467 img1Rect.x = __column1Width + leftMargin + numberStyleMargin;
1468 img1Rect.y = upperMargin;
1469 img1Rect.width = __column1Width;
1470 img1Rect.height = __row1Height - lowerMargin;
1472 text1Rect.x = leftMargin + numberStyleMargin;
1473 text1Rect.y = upperMargin;
1474 text1Rect.width = (__column1Width + __column2Width + dividerMargin <= listSize.width) ? (__column2Width) : (__column2Width - dividerMargin);
1475 text1Rect.height = __row1Height - lowerMargin;
1479 case LIST_ITEM_SINGLE_IMAGE_TEXT_IMAGE:
1481 img1Rect.x = leftMargin + numberStyleMargin;
1482 img1Rect.y = upperMargin;
1483 img1Rect.width = __column1Width;
1484 img1Rect.height = __row1Height - lowerMargin;
1486 text1Rect.x = __column1Width + leftMargin + numberStyleMargin;
1487 text1Rect.y = upperMargin;
1488 text1Rect.width = __column2Width;
1489 text1Rect.height = __row1Height - lowerMargin;
1491 img2Rect.x = text1Rect.x + __column2Width;
1492 img2Rect.y = upperMargin;
1493 img2Rect.width = (__column1Width + __column2Width + dividerMargin <= listSize.width) ? (__column2Width) : (__column2Width - dividerMargin);
1494 img2Rect.height = __row1Height - lowerMargin;
1498 case LIST_ITEM_DOUBLE_IMAGE_TEXT_FULLTEXT:
1500 img1Rect.x = leftMargin + numberStyleMargin;
1501 img1Rect.y = upperMargin;
1502 img1Rect.width = __column1Width;
1503 img1Rect.height = __row1Height - lowerMargin;
1505 text1Rect.x = __column1Width + leftMargin + numberStyleMargin;
1506 text1Rect.y = upperMargin;
1507 text1Rect.width = (__column1Width + __column2Width + dividerMargin <= listSize.width) ? (__column2Width) : (__column2Width - dividerMargin);
1508 text1Rect.height = __row1Height - lowerMargin;
1510 text2Rect.x = leftMargin + numberStyleMargin;
1511 text2Rect.y = __row1Height;
1512 text2Rect.width = __column1Width;
1513 text2Rect.height = __row2Height - lowerMargin;
1517 case LIST_ITEM_DOUBLE_FULLTEXT_IMAGE_TEXT:
1519 img1Rect.x = leftMargin + numberStyleMargin;
1520 img1Rect.y = __row1Height;
1521 img1Rect.width = __column1Width;
1522 img1Rect.height = __row2Height;
1524 text1Rect.x = __column1Width + leftMargin + numberStyleMargin;
1525 text1Rect.y = __row1Height;
1526 text1Rect.width = (__column1Width + __column2Width + dividerMargin <= listSize.width) ? (__column2Width) : (__column2Width - dividerMargin);
1527 text1Rect.height = __row2Height;
1529 text2Rect.x = leftMargin + numberStyleMargin;
1530 text2Rect.y = upperMargin;
1531 text2Rect.width = __column1Width;
1532 text2Rect.height = __row1Height - lowerMargin;
1536 case LIST_ITEM_DOUBLE_TEXT_IMAGE_FULLTEXT:
1538 img1Rect.x = __column1Width + leftMargin + numberStyleMargin;
1539 img1Rect.y = upperMargin;
1540 img1Rect.width = (__column1Width + __column2Width + dividerMargin <= listSize.width) ? (__column2Width) : (__column2Width - dividerMargin);
1541 img1Rect.height = __row1Height - lowerMargin;
1543 text1Rect.x = leftMargin + numberStyleMargin;
1544 text1Rect.y = upperMargin;
1545 text1Rect.width = __column1Width;
1546 text1Rect.height = __row1Height - lowerMargin;
1548 text2Rect.x = leftMargin + numberStyleMargin;
1549 text2Rect.y = __row1Height;
1550 text2Rect.width = __column1Width;
1551 text2Rect.height = __row2Height;
1555 case LIST_ITEM_DOUBLE_FULLTEXT_TEXT_IMAGE:
1557 img1Rect.x = __column1Width + leftMargin + numberStyleMargin;
1558 img1Rect.y = __row1Height;
1559 img1Rect.width = (__column1Width + __column2Width + dividerMargin <= listSize.width) ? (__column2Width) : (__column2Width - dividerMargin);
1560 img1Rect.height = __row2Height;
1562 text1Rect.x = leftMargin + numberStyleMargin;
1563 text1Rect.y = __row1Height;
1564 text1Rect.width = __column1Width;
1565 text1Rect.height = __row2Height;
1567 text2Rect.x = leftMargin + numberStyleMargin;
1568 text2Rect.y = upperMargin;
1569 text2Rect.width = __column1Width;
1570 text2Rect.height = __row1Height - lowerMargin;
1574 case LIST_ITEM_DOUBLE_IMAGE_TEXT_TEXT:
1576 img1Rect.x = leftMargin + numberStyleMargin;
1577 img1Rect.y = upperMargin;
1578 img1Rect.width = __column1Width;
1579 img1Rect.height = __row1Height + __row2Height - lowerMargin;
1581 text1Rect.x = __column1Width + leftMargin + numberStyleMargin;
1582 text1Rect.y = upperMargin;
1583 text1Rect.width = (__column1Width + __column2Width + dividerMargin <= listSize.width) ? (__column2Width) : (__column2Width - dividerMargin);
1584 text1Rect.height = __row1Height - lowerMargin;
1586 text2Rect.x = __column1Width + leftMargin + numberStyleMargin;
1587 text2Rect.y = __row1Height;
1588 text2Rect.width = (__column1Width + __column2Width + dividerMargin <= listSize.width) ? (__column2Width) : (__column2Width - dividerMargin);
1589 text2Rect.height = __row2Height;
1593 case LIST_ITEM_DOUBLE_TEXT_TEXT_IMAGE:
1595 img1Rect.x = __column1Width + leftMargin + numberStyleMargin;
1596 img1Rect.y = upperMargin;
1597 img1Rect.width = (__column1Width + __column2Width + dividerMargin <= listSize.width) ? (__column2Width) : (__column2Width - dividerMargin);
1598 img1Rect.height = __row1Height + __row2Height - lowerMargin;
1600 text1Rect.x = leftMargin + numberStyleMargin;
1601 text1Rect.y = upperMargin;
1602 text1Rect.width = __column1Width;
1603 text1Rect.height = __row2Height - lowerMargin;
1605 text2Rect.x = leftMargin + numberStyleMargin;
1606 text2Rect.y = __row1Height;
1607 text2Rect.width = __column1Width;
1608 text2Rect.height = __row1Height;
1615 _ListImpl::ReDrawList(void)
1617 Rectangle text1Rect;
1618 Rectangle text2Rect;
1621 int groupIndex = -1;
1624 GetTopDrawnItemIndex(groupIndex, currIndex);
1626 GetElementRects(text1Rect, text2Rect, img1Rect, img2Rect);
1629 int listStyleNumberX = 0;
1630 int listStyleNumberWidth = 0;
1631 int listStyleNumberHeight = 0;
1632 int checkItemWidth = 0;
1633 int checkItemHeight = 0;
1635 GET_SHAPE_CONFIG(LIST::LIST_ITEM_TEXT_SIZE, GetCore().GetOrientation(), textSize);
1637 GET_SHAPE_CONFIG(LIST::LIST_STYLE_NUMBER_X, GetCore().GetOrientation(), listStyleNumberX);
1638 GET_SHAPE_CONFIG(LIST::LIST_STYLE_NUMBER_WIDTH, GetCore().GetOrientation(), listStyleNumberWidth);
1639 GET_SHAPE_CONFIG(LIST::LIST_STYLE_NUMBER_HEIGHT, GetCore().GetOrientation(), listStyleNumberHeight);
1641 GET_SHAPE_CONFIG(LIST::LIST_CHECK_ITEM_WIDTH, GetCore().GetOrientation(), checkItemWidth);
1642 GET_SHAPE_CONFIG(LIST::LIST_CHECK_ITEM_HEIGHT, GetCore().GetOrientation(), checkItemHeight);
1644 if (text1Rect.x > 0)
1646 __pItemFormat->AddElement(ID_FORMAT_TEXT1, text1Rect);
1647 __pItemFormat->SetElementEventEnabled(ID_FORMAT_TEXT1, false);
1652 __pItemFormat->AddElement(ID_FORMAT_IMAGE1, img1Rect);
1653 __pItemFormat->SetElementEventEnabled(ID_FORMAT_IMAGE1, false);
1656 if (text2Rect.x > 0)
1658 __pItemFormat->AddElement(ID_FORMAT_TEXT2, text2Rect);
1659 __pItemFormat->SetElementEventEnabled(ID_FORMAT_TEXT2, false);
1664 __pItemFormat->AddElement(ID_FORMAT_IMAGE2, img2Rect);
1665 __pItemFormat->SetElementEventEnabled(ID_FORMAT_IMAGE2, false);
1668 if (__listStyle == LIST_STYLE_NUMBER)
1670 __pItemFormat->AddElement(ID_FORMAT_NUMBER, Rectangle(listStyleNumberX, GetItemHeight()/2 - 15, listStyleNumberWidth, listStyleNumberHeight));
1671 __pItemFormat->SetElementEventEnabled(ID_FORMAT_NUMBER, false);
1674 if (_annexStyle != TABLE_VIEW_ANNEX_STYLE_NORMAL)
1676 __pItemFormat->AddElement(ID_FORMAT_CHECK, Rectangle(GetCore().GetBounds().width - 60, GetItemHeight()/2 - 25 , checkItemWidth , checkItemHeight));
1677 __pItemFormat->SetElementEventEnabled(ID_FORMAT_CHECK, true);
1680 int count = GetItemCount();
1681 result r = E_SUCCESS;
1683 for (int index = 0; index < count; index++)
1687 r = GetCore().RefreshTableView(0, index, TABLE_VIEW_REFRESH_TYPE_ITEM_MODIFY);
1688 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, E_SYSTEM, E_SYSTEM, "[%s] Propagating.",GetErrorMessage(r));
1691 ScrollToTop(currIndex);
1692 SetLastResult(E_SUCCESS);
1698 _ListImpl::SetBitmap(TableViewItemDrawingStatus itemStatus, const Bitmap& bitmap)
1700 _TableViewItemData* pItem = null;
1702 int groupIndex = -1;
1704 int bottomIndex = -1;
1706 GetTopDrawnItemIndex(groupIndex, topIndex);
1707 GetBottomDrawnItemIndex(groupIndex, bottomIndex);
1709 int count = GetItemCount();
1710 for (int itemIndex = 0; itemIndex < count; itemIndex++)
1712 pItem = GetTableViewItemAt(-1, itemIndex);
1713 SysTryReturnVoidResult(NID_UI_CTRL, pItem, E_SYSTEM,
1714 "[E_SYSTEM] A system error has occurred. _TableViewItemData instance is null.");
1716 pItem->SetBackgroundBitmap(&bitmap, itemStatus);
1717 if (itemIndex >= topIndex && itemIndex <= bottomIndex)
1719 pItem->Invalidate(true);
1725 _ListImpl::UpdateNumbers(int index)
1727 SysTryReturnResult(NID_UI_CTRL, __listStyle == LIST_STYLE_NUMBER, E_SYSTEM,
1728 "A system error has occurred. The current value of list style is invalid.");
1730 SysTryReturnResult(NID_UI_CTRL, __pNumberElements != null, E_SYSTEM,
1731 "A system error has occured. Failed to update numbers");
1733 _NumberElement* pNumberElement = null;
1734 int count = __pNumberElements->GetCount();
1736 for (int itemIndex = index + 1; itemIndex < count; itemIndex++)
1738 pNumberElement = dynamic_cast<_NumberElement*>(__pNumberElements->GetAt(itemIndex));
1739 SysTryReturnResult(NID_UI_CTRL, pNumberElement, E_SYSTEM,
1740 "A system error has occurred. Failed to get _NumberElement instance at index(%d).", index);
1741 pNumberElement->index = itemIndex + 1;
1743 CustomListItem* pCustomListItem = GetCustomListItemAt(-1, itemIndex);
1744 SysTryReturnResult(NID_UI_CTRL, pCustomListItem, E_SYSTEM,
1745 "A system error has occurred. Failed to get an item at index(%d).", itemIndex);
1747 pCustomListItem->SetElement(ID_FORMAT_NUMBER, *(dynamic_cast<ICustomListElement*>(pNumberElement)));
1754 _ListImpl::Refresh(int index)
1756 result r = E_SUCCESS;
1758 _TableViewItemUpdateParams updateParams;
1759 updateParams.pItem = GetCustomListItemAt(-1, index);
1760 updateParams.isDividerEnabled = _isDividerEnabled;
1761 updateParams.pCheckBitmaps = _pCheckBitmaps;
1762 updateParams.annexStyle = _annexStyle;
1764 r = _CustomListItemImpl::UpdateTableViewItem(updateParams);
1765 SysTryReturnResult(NID_UI_CTRL, (r == E_SUCCESS), E_SYSTEM,
1766 "A system error has occurred. Failed to refresh an item.");
1768 DrawItem(-1, index);
1774 _ListImpl::IsItemChecked(int groupIndex, int subIndex) const
1776 return IsItemChecked(subIndex);
1780 _ListImpl::SetItemChecked(int groupIndex, int itemIndex, bool check)
1782 return SetItemChecked(itemIndex, check);
1786 _ListImpl::OnTableViewItemStateChanged(Tizen::Ui::Controls::_TableView& tableView, int itemIndex, Tizen::Ui::Controls::_TableViewItem* pItem, Tizen::Ui::Controls::TableViewItemStatus status)
1788 ItemStatus itemStatus = ITEM_HIGHLIGHTED;
1792 case TABLE_VIEW_ITEM_STATUS_SELECTED:
1793 itemStatus = ITEM_SELECTED;
1795 case TABLE_VIEW_ITEM_STATUS_HIGHLIGHTED:
1796 itemStatus = ITEM_HIGHLIGHTED;
1798 case TABLE_VIEW_ITEM_STATUS_CHECKED:
1799 itemStatus = ITEM_CHECKED;
1801 case TABLE_VIEW_ITEM_STATUS_UNCHECKED:
1802 itemStatus = ITEM_UNCHECKED;
1805 SetLastResult(E_SYSTEM);
1809 if ((!_isDividerEnabled) && (_annexStyle != TABLE_VIEW_ANNEX_STYLE_NORMAL))
1811 bool isChecked = IsItemChecked(itemIndex);
1815 itemStatus = ITEM_UNCHECKED;
1819 itemStatus = ITEM_CHECKED;
1822 SetItemChecked(itemIndex, !isChecked);
1825 ProcessItemStateChange(-1, itemIndex, itemStatus);
1831 _ListImpl::OnTableViewItemReordered(Tizen::Ui::Controls::_TableView& tableView, int itemIndexFrom, int itemIndexTo)
1837 _ListImpl::OnTableViewContextItemActivationStateChanged(Tizen::Ui::Controls::_TableView& tableView, int itemIndex, Tizen::Ui::Controls::_TableViewItem* pContextItem, bool activated)
1843 _ListImpl::OnGroupedTableViewGroupItemStateChanged(Tizen::Ui::Controls::_TableView& tableView, int groupIndex, Tizen::Ui::Controls::_TableViewItem* pItem, Tizen::Ui::Controls::TableViewItemStatus status)
1849 _ListImpl::OnGroupedTableViewItemStateChanged(Tizen::Ui::Controls::_TableView& tableView, int groupIndex, int itemIndex, Tizen::Ui::Controls::_TableViewItem* pItem, Tizen::Ui::Controls::TableViewItemStatus status)
1855 _ListImpl::OnGroupedTableViewContextItemActivationStateChanged(Tizen::Ui::Controls::_TableView& tableView, int groupIndex, int itemIndex, Tizen::Ui::Controls::_TableViewItem* pContextItem, bool activated)
1861 _ListImpl::OnGroupedTableViewItemReordered(Tizen::Ui::Controls::_TableView& tableView, int groupIndexFrom, int itemIndexFrom, int groupIndexTo, int itemIndexTo)
1866 _ListImpl::OnSectionTableViewItemStateChanged(Tizen::Ui::Controls::_TableView& tableView, int sectionIndex, int itemIndex, Tizen::Ui::Controls::_TableViewItem* pItem, Tizen::Ui::Controls::TableViewItemStatus status)
1872 _ListImpl::OnTableViewItemSwept(Tizen::Ui::Controls::_TableView& tableView, int groupIndex, int itemIndex, Tizen::Ui::Controls::TableViewSweepDirection direction)
1878 _ListImpl::OnSectionTableViewContextItemActivationStateChanged(Tizen::Ui::Controls::_TableView& tableView, int sectionIndex, int itemIndex, Tizen::Ui::Controls::_TableViewItem* pContextItem, bool activated)
1884 _ListImpl::ProcessItemStateChange(int groupIndex, int itemIndex, ItemStatus itemStatus)
1886 int itemId = GetItemIdAt(itemIndex);
1888 _ListListener* pListenerList = null;
1889 IItemEventListener* pEventListener = null;
1891 int count = __itemListeners.GetCount();
1892 for (int listenerCount = 0; listenerCount < count; listenerCount++)
1894 pListenerList = dynamic_cast<_ListListener*>(__itemListeners.GetAt(listenerCount));
1895 SysTryReturnVoidResult(NID_UI_CTRL, (pListenerList != null), E_SYSTEM,
1896 "[E_SYSTEM] A system error has occurred. Failed to get Listener.");
1898 pEventListener = dynamic_cast<IItemEventListener*>(pListenerList->pListener);
1899 SysTryReturnVoidResult(NID_UI_CTRL, (pEventListener != null), E_SYSTEM,
1900 "[E_SYSTEM] A system error has occurred. Failed to get Listener.");
1902 pEventListener->OnItemStateChanged(GetPublic(), itemIndex, itemId, itemStatus);
1904 SetLastResult(E_SUCCESS);
1910 _ListImpl::ProcessItemStateChange(int groupIndex, int itemIndex, int elementId, ItemStatus itemStatus)
1912 int itemId = GetItemIdAt(itemIndex);
1914 _ListListener* pListenerList = null;
1915 IItemEventListener* pEventListener = null;
1917 int count = __itemListeners.GetCount();
1918 for (int listenerCount = 0; listenerCount < count; listenerCount++)
1920 pListenerList = dynamic_cast<_ListListener*>(__itemListeners.GetAt(listenerCount));
1921 SysTryReturnVoidResult(NID_UI_CTRL, (pListenerList != null), E_SYSTEM,
1922 "[E_SYSTEM] A system error has occurred. Failed to get Listener.");
1924 pEventListener = dynamic_cast<IItemEventListener*>(pListenerList->pListener);
1925 SysTryReturnVoidResult(NID_UI_CTRL, (pEventListener != null), E_SYSTEM,
1926 "[E_SYSTEM] A system error has occurred. Failed to get Listener.");
1928 pEventListener->OnItemStateChanged(GetPublic(), itemIndex, itemId, itemStatus);
1930 SetLastResult(E_SUCCESS);
1938 : public _UiBuilderControlMaker
1941 _ListMaker(_UiBuilder* uibuilder)
1942 : _UiBuilderControlMaker(uibuilder){};
1943 virtual ~_ListMaker(){};
1944 static _UiBuilderControlMaker*
1945 GetInstance(_UiBuilder* uibuilder)
1947 _ListMaker* pListMaker = new (std::nothrow) _ListMaker(uibuilder);
1952 Make(_UiBuilderControl* pControl)
1954 result r = E_SYSTEM;
1955 _UiBuilderControlLayout* pControlProperty = null;
1960 Tizen::Base::String elementString;
1961 int tempRow1Height = 0;
1962 int tempRow2Height = 0;
1963 int tempColumn1Width = 0;
1964 int tempColumn2Width = 0;
1966 ListStyle style = LIST_STYLE_NORMAL;
1967 ListItemFormat format = LIST_ITEM_SINGLE_TEXT;
1970 GetProperty(pControl, &pControlProperty);
1971 if (pControlProperty == null)
1976 pList = new (std::nothrow) List();
1982 rect = pControlProperty->GetRect();
1984 if (pControl->GetElement(L"ListItemFormat", elementString))
1986 if (elementString.Equals(L"LIST_ITEM_SINGLE_IMAGE", false))
1988 format = LIST_ITEM_SINGLE_IMAGE;
1990 else if (elementString.Equals(L"LIST_ITEM_SINGLE_TEXT", false))
1992 format = LIST_ITEM_SINGLE_TEXT;
1994 else if (elementString.Equals(L"LIST_ITEM_SINGLE_IMAGE_TEXT", false))
1996 format = LIST_ITEM_SINGLE_IMAGE_TEXT;
1998 else if (elementString.Equals(L"LIST_ITEM_SINGLE_TEXT_IMAGE", false))
2000 format = LIST_ITEM_SINGLE_TEXT_IMAGE;
2002 else if (elementString.Equals(L"LIST_ITEM_SINGLE_IMAGE_TEXT_IMAGE", false))
2004 format = LIST_ITEM_SINGLE_IMAGE_TEXT_IMAGE;
2006 else if (elementString.Equals(L"LIST_ITEM_DOUBLE_IMAGE_TEXT_FULLTEXT", false))
2008 format = LIST_ITEM_DOUBLE_IMAGE_TEXT_FULLTEXT;
2010 else if (elementString.Equals(L"LIST_ITEM_DOUBLE_FULLTEXT_IMAGE_TEXT", false))
2012 format = LIST_ITEM_DOUBLE_FULLTEXT_IMAGE_TEXT;
2014 else if (elementString.Equals(L"LIST_ITEM_DOUBLE_TEXT_IMAGE_FULLTEXT", false))
2016 format = LIST_ITEM_DOUBLE_TEXT_IMAGE_FULLTEXT;
2018 else if (elementString.Equals(L"LIST_ITEM_DOUBLE_FULLTEXT_TEXT_IMAGE", false))
2020 format = LIST_ITEM_DOUBLE_FULLTEXT_TEXT_IMAGE;
2022 else if (elementString.Equals(L"LIST_ITEM_DOUBLE_IMAGE_TEXT_TEXT", false))
2024 format = LIST_ITEM_DOUBLE_IMAGE_TEXT_TEXT;
2026 else if (elementString.Equals(L"LIST_ITEM_DOUBLE_TEXT_TEXT_IMAGE", false))
2028 format = LIST_ITEM_DOUBLE_TEXT_TEXT_IMAGE;
2032 format = LIST_ITEM_SINGLE_TEXT;
2036 if (pControl->GetElement(L"line1Height", elementString) || pControl->GetElement(L"row1Height", elementString))
2038 Base::Integer::Parse(elementString, tempRow1Height);
2041 if ((pControl->GetElement(L"line2Height", elementString) || pControl->GetElement(L"row2Height", elementString)) && (format > 4))
2043 Base::Integer::Parse(elementString,tempRow2Height);
2050 if (pControl->GetElement(L"column1Width", elementString))
2052 Base::Integer::Parse(elementString,tempColumn1Width);
2055 if ((pControl->GetElement(L"column2Width", elementString)) && (format > 1))
2057 Base::Integer::Parse(elementString,tempColumn2Width);
2061 tempColumn2Width = 0;
2064 Tizen::Base::String styleString;
2065 styleString = pControlProperty->GetStyle();
2067 if (styleString.Equals(L"LIST_STYLE_NORMAL", false))
2069 style = LIST_STYLE_NORMAL;
2071 else if (styleString.Equals(L"LIST_STYLE_NUMBER", false))
2073 style = LIST_STYLE_NUMBER;
2075 else if (styleString.Equals(L"LIST_STYLE_RADIO", false))
2077 style = LIST_STYLE_RADIO;
2079 else if (styleString.Equals(L"LIST_STYLE_RADIO_WITH_DIVIDER", false))
2081 style = LIST_STYLE_RADIO_WITH_DIVIDER;
2083 else if (styleString.Equals(L"LIST_STYLE_MARK_WITH_DIVIDER", false))
2085 style = LIST_STYLE_MARK_WITH_DIVIDER;
2087 else if (styleString.Equals(L"LIST_STYLE_ONOFF_WITH_DIVIDER", false))
2089 style = LIST_STYLE_ONOFF_WITH_DIVIDER;
2091 else if (styleString.Equals(L"LIST_STYLE_MARK", false))
2093 style = LIST_STYLE_MARK;
2095 else if (styleString.Equals(L"LIST_STYLE_ONOFF", false))
2097 style = LIST_STYLE_ONOFF;
2101 style = LIST_STYLE_NORMAL;
2104 if (tempRow1Height < 0 || tempRow1Height > ((Tizen::Ui::Control*) GetContainer())->GetBounds().height)
2106 tempRow1Height = ((Tizen::Ui::Control*) GetContainer())->GetBounds().height >> 2;
2108 if (tempRow2Height < 0 || tempRow2Height > ((Tizen::Ui::Control*) GetContainer())->GetBounds().height)
2110 tempRow2Height = ((Tizen::Ui::Control*) GetContainer())->GetBounds().height >> 2;
2112 if (tempColumn1Width < 0 || tempColumn1Width > ((Tizen::Ui::Control*) GetContainer())->GetBounds().width)
2114 tempColumn1Width = ((Tizen::Ui::Control*) GetContainer())->GetBounds().width >> 2;
2116 if (tempColumn2Width < 0 || tempColumn2Width > ((Tizen::Ui::Control*) GetContainer())->GetBounds().width)
2118 tempColumn2Width = ((Tizen::Ui::Control*) GetContainer())->GetBounds().width >> 2;
2121 r = pList->Construct(rect, style, format, tempRow1Height, tempRow2Height, tempColumn1Width, tempColumn2Width);
2128 if (pControl->GetElement(L"textOfEmptyList", elementString))
2130 pList->SetTextOfEmptyList(elementString);
2133 if (pControl->GetElement(L"colorOfEmptyListText", elementString))
2135 ConvertStringToColor(elementString, color);
2136 pList->SetTextColorOfEmptyList(color);
2139 GET_DIMENSION_CONFIG(LIST::LIST_MIN_SIZE, _CONTROL_ORIENTATION_PORTRAIT, dimMin);
2140 rectMin = (pControl->GetAttribute(0))->GetRect();
2141 (pControl->GetAttribute(0))->SetRect(rectMin.x, rectMin.y, dimMin.width, dimMin.height);
2143 GET_DIMENSION_CONFIG(LIST::LIST_MIN_SIZE, _CONTROL_ORIENTATION_LANDSCAPE, dimMin);
2144 rectMin = (pControl->GetAttribute(1))->GetRect();
2145 (pControl->GetAttribute(1))->SetRect(rectMin.x, rectMin.y, dimMin.width, dimMin.height);
2153 _ListRegister::_ListRegister()
2155 _UiBuilderControlTableManager* pUiBuilderControlTableManager = _UiBuilderControlTableManager::GetInstance();
2156 if (pUiBuilderControlTableManager)
2158 pUiBuilderControlTableManager->RegisterControl(L"List", _ListMaker::GetInstance);
2161 _ListRegister::~_ListRegister()
2163 _UiBuilderControlTableManager* pUiBuilderControlTableManager = _UiBuilderControlTableManager::GetInstance();
2164 if (pUiBuilderControlTableManager)
2166 pUiBuilderControlTableManager->UnregisterControl(L"List");
2170 static _ListRegister ListRegisterToUiBuilder;
2171 }}} // Tizen::Ui::Controls