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"
30 #include "FUi_CoordinateSystemUtils.h"
32 using namespace Tizen::Base;
33 using namespace Tizen::Graphics;
34 using namespace Tizen::Base::Collection;
36 namespace Tizen { namespace Ui { namespace Controls
39 extern const int INVALID_INDEX;
41 _NumberElement::_NumberElement(void)
46 _NumberElement::~_NumberElement(void)
50 _ListItemDataProvider::_ListItemDataProvider(_ListImpl* pListImpl)
51 : __pListImpl(pListImpl)
55 _ListItemDataProvider::~_ListItemDataProvider(void)
60 _ListItemDataProvider::GetItemCount(void)
62 SysTryReturn(NID_UI_CTRL, __pListImpl, -1, E_SYSTEM,
63 "[E_SYSTEM] A system error has occurred. List instance is null.");
64 return __pListImpl->GetItemCount();
68 _ListItemDataProvider::CreateItem(int index, int itemWidth)
70 SysTryReturn(NID_UI_CTRL, __pListImpl, null, E_SYSTEM,
71 "[E_SYSTEM] A system error has occurred. List instance is null.");
73 CustomListItem* pCustomListItem = __pListImpl->GetCustomListItemAt(-1, index);
74 SysTryReturn(NID_UI_CTRL, pCustomListItem, null, E_SYSTEM,
75 "[E_SYSTEM] A system error has occurred. Failed to get an item at index(%d).", index);
77 _CustomListItemImpl* pCustomListItemImpl = null;
78 pCustomListItemImpl = pCustomListItem->__pCustomListItemImpl;
79 SysTryReturn(NID_UI_CTRL, pCustomListItemImpl, null, E_SYSTEM,
80 "[E_SYSTEM] A system error has occurred. _CustomListItemImpl instance is null.");
82 int height = __pListImpl->__row1Height + __pListImpl->__row2Height;
83 pCustomListItemImpl->height = height;
85 _TableViewItemParams tableViewItemParams;
86 tableViewItemParams.pItem = (const_cast<CustomListItem*>(pCustomListItem));
87 tableViewItemParams.width = itemWidth;
88 tableViewItemParams.itemId = pCustomListItemImpl->itemId;
89 tableViewItemParams.itemIndex = index;
90 tableViewItemParams.groupIndex = -1;
91 tableViewItemParams.isDividerEnabled = __pListImpl->_isDividerEnabled;
92 tableViewItemParams.pCheckBitmaps = __pListImpl->_pCheckBitmaps;
93 tableViewItemParams.annexStyle = __pListImpl->_annexStyle;
95 result r = _CustomListItemImpl::CreateTableViewItem(tableViewItemParams);
96 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
98 pCustomListItemImpl->__pTableViewItemData->AddTouchEventListener(*__pListImpl);
100 return pCustomListItemImpl->__pTableViewItemData;
104 _ListItemDataProvider::DeleteItem(const int itemIndex, TableViewItem* pItem)
108 if (__pListImpl->__directDelete == false)
110 CustomListItem* pCustomListItem = __pListImpl->GetCustomListItemAt(-1, itemIndex);
111 pCustomListItem->__pCustomListItemImpl->__pTableViewItemData = null;
118 _ListItemDataProvider::GetDefaultItemHeight(void)
120 SysTryReturn(NID_UI_CTRL, __pListImpl, 0, E_SYSTEM,
121 "[E_SYSTEM] A system error has occurred. List instance is null.");
122 return (__pListImpl->__row1Height + __pListImpl->__row2Height);
126 _ListItemDataProvider::UpdateItem(int itemIndex, TableViewItem* pItem)
128 SysTryReturnVoidResult(NID_UI_CTRL, __pListImpl, E_SYSTEM,
129 "[E_SYSTEM] A system error has occurred. List instance is null.");
130 CustomListItem* pCustomListItem = __pListImpl->GetCustomListItemAt(-1, itemIndex);
131 SysTryReturnVoidResult(NID_UI_CTRL, pCustomListItem, E_SYSTEM,
132 "[E_SYSTEM] A system error has occurred. Failed to get an item at index(%d).", itemIndex);
134 _CustomListItemImpl* pCustomListItemImpl = null;
135 pCustomListItemImpl = pCustomListItem->__pCustomListItemImpl;
136 SysTryReturnVoidResult(NID_UI_CTRL, pCustomListItemImpl, E_SYSTEM,
137 "[E_SYSTEM] A system error has occurred. _CustomListItemImpl instance is null.");
139 int height = __pListImpl->__row1Height + __pListImpl->__row2Height;
140 pCustomListItemImpl->height = height;
142 FloatRectangle rect = pItem->GetBoundsF();
143 pItem->SetSize(FloatDimension(rect.width, height));
147 _NumberElement::DrawElement(const Canvas& canvas, const Rectangle& rect, CustomListItemStatus itemStatus)
152 Canvas* pCanvas = const_cast<Canvas*>(&canvas);
153 SysTryReturnResult(NID_UI_CTRL, (pCanvas != null), E_SYSTEM,
154 "A system error has occurred. Failed to get the canvas.");
156 pCanvas->FillRectangle(Color::GetColor(COLOR_ID_MAGENTA), _CoordinateSystemUtils::ConvertToFloat(rect));
157 pCanvas->SetForegroundColor(Color::GetColor(COLOR_ID_WHITE));
161 font.Construct(FONT_STYLE_PLAIN, 18.0f);
162 pCanvas->SetFont(font);
164 if (pCanvas->DrawText(FloatPoint(rect.x + 5.0f, rect.y + 5.0f), String(text)) != E_SUCCESS)
173 _ListImpl::GetInstance(List& list)
175 return static_cast<_ListImpl*>(list._pControlImpl);
179 _ListImpl::GetInstance(const List& list)
181 return static_cast<const _ListImpl*>(list._pControlImpl);
184 _ListImpl::_ListImpl(Control* pList, _TableView* pCore)
185 : _ListBaseImpl(pList, pCore)
190 , __text1SlideEnabled(true)
191 , __text2SlideEnabled(true)
192 , __listStyle(LIST_STYLE_NORMAL)
193 , __listItemFormat(LIST_ITEM_SINGLE_IMAGE)
194 , __pNormalBgBitmap(null)
195 , __pHighlightedBgBitmap(null)
196 , __pFocusedBgBitmap(null)
197 , __pNumberElements(null)
198 , __pItemFormat(null)
199 , __pItemProvider(null)
201 , __isCheckStyle(true)
202 , __directDelete(false)
206 _ListImpl::~_ListImpl(void)
208 __itemListeners.RemoveAll(true);
210 if (__pNumberElements != null)
212 __pNumberElements->RemoveAll(true);
213 delete __pNumberElements;
214 __pNumberElements = null;
217 if (__pItemFormat != null)
219 delete __pItemFormat;
220 __pItemFormat = null;
225 delete __pItemProvider;
226 __pItemProvider = null;
229 RemoveAllFromItemsList();
233 _ListImpl::GetPublicClassName(void) const
235 return "Tizen::Ui::Controls::List";
239 _ListImpl::GetPublic(void) const
241 return static_cast<const List&>(_ControlImpl::GetPublic());
245 _ListImpl::GetPublic(void)
247 return static_cast<List&>(_ControlImpl::GetPublic());
251 _ListImpl::GetCore(void) const
253 return static_cast<const _TableView&>(_ControlImpl::GetCore());
257 _ListImpl::GetCore(void)
259 return static_cast<_TableView&>(_ControlImpl::GetCore());
263 _ListImpl::CreateListImplN(List* pControl, const Rectangle& bounds)
265 result r = E_SUCCESS;
267 r = GET_SIZE_INFO(List).CheckInitialSizeValidF(FloatDimension(bounds.width, bounds.height), _CONTROL_ORIENTATION_PORTRAIT);
268 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
270 _TableView* pCore = null;
271 _ListImpl* pImpl = null;
273 pCore = _TableView::CreateTableViewN(TABLE_VIEW_STYLE_SIMPLE, true, TABLE_VIEW_SCROLL_BAR_STYLE_FIXED);
276 SysTryReturn(NID_UI_CTRL, pCore, null, r, "[%s] Propagating.", GetErrorMessage(r));
278 pImpl = new (std::nothrow) _ListImpl(pControl, pCore);
279 SysTryCatch(NID_UI_CTRL, pImpl, , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
291 _ListImpl::Initialize(ListItemFormat itemFormat, int row1Height, int row2Height, int column1Width, int column2Width)
293 result r = E_SUCCESS;
295 GET_FIXED_VALUE_CONFIG(LIST::LIST_ITEM_MAX_COUNT, GetCore().GetOrientation(), __maxCount);
297 __pItemProvider = new (std::nothrow) _ListItemDataProvider(this);
298 SysTryReturnResult(NID_UI_CTRL, (__pItemProvider != null), E_OUT_OF_MEMORY, "Memory allocation failed.");
300 TableViewStyle style = GetCore().GetTableViewStyle();
301 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");
303 _TableViewItemProvider* pItemProvider = _TableViewItemProvider::CreateTableViewItemProviderN(style);
304 SysTryReturn(NID_UI_CTRL, pItemProvider != null, E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
306 r = pItemProvider->SetSimpleStyleItemProvider(__pItemProvider);
310 delete pItemProvider;
311 SysTryReturn(NID_UI_CTRL, false, r, r, "[%s] Propagating.", GetErrorMessage(r));
314 r = GetCore().SetItemProvider(pItemProvider);
315 SysTryReturn(NID_UI_CTRL, (r == E_SUCCESS), r, r, "[%s] Propagating.", GetErrorMessage(r));
317 r = GetCore().AddTableViewItemEventListener(*this);
318 SysTryReturn(NID_UI_CTRL, (r == E_SUCCESS), r, r, "[%s] Propagating.", GetErrorMessage(r));
320 SetListItemFormat(itemFormat);
322 r = InitializeItemSizes(row1Height, row2Height, column1Width, column2Width);
323 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
325 r = InitCustomListItemFormat();
326 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
332 _ListImpl::InitializeItemSizes(int row1Height, int row2Height, int column1Width, int column2Width)
334 result r = E_SUCCESS;
336 r = SetRow1Height(row1Height);
337 SysTryReturn(NID_UI_CTRL, (r == E_SUCCESS), r, r, "[%s] Propagating.", GetErrorMessage(r));
339 r = SetRow2Height(row2Height);
340 SysTryReturn(NID_UI_CTRL, (r == E_SUCCESS), r, r, "[%s] Propagating.", GetErrorMessage(r));
342 r = SetColumn1Width(column1Width);
343 SysTryReturn(NID_UI_CTRL, (r == E_SUCCESS), r, r, "[%s] Propagating.", GetErrorMessage(r));
345 r = SetColumn2Width(column2Width);
346 SysTryReturn(NID_UI_CTRL, (r == E_SUCCESS), r, r, "[%s] Propagating.", GetErrorMessage(r));
352 _ListImpl::UpdateBounds(const Rectangle& rect)
354 result r = E_SUCCESS;
356 r = InitializeBoundsPropertiesF(GET_SIZE_INFO(CustomList), _CoordinateSystemUtils::ConvertToFloat(rect), GetCore().GetOrientation());
357 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
363 _ListImpl::SetStyle(ListStyle style)
366 result r = E_SUCCESS;
370 case LIST_STYLE_NORMAL:
371 case LIST_STYLE_NUMBER:
372 __isCheckStyle = false;
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:
382 _annexStyle = TABLE_VIEW_ANNEX_STYLE_RADIO;
385 case LIST_STYLE_MARK_WITH_DIVIDER:
386 _isDividerEnabled = true;
387 _annexStyle = TABLE_VIEW_ANNEX_STYLE_MARK;
390 case LIST_STYLE_MARK:
391 _annexStyle = TABLE_VIEW_ANNEX_STYLE_MARK;
394 case LIST_STYLE_ONOFF_WITH_DIVIDER:
395 _isDividerEnabled = true;
396 _annexStyle = TABLE_VIEW_ANNEX_STYLE_ONOFF_SLIDING;
399 case LIST_STYLE_ONOFF:
400 _annexStyle = TABLE_VIEW_ANNEX_STYLE_ONOFF_SLIDING;
407 SysTryReturnResult(NID_UI_CTRL, (r == E_SUCCESS), r, "The current value of List style is invalid.");
409 if ((style == LIST_STYLE_NUMBER) && (__pNumberElements == null))
411 __pNumberElements = new (std::nothrow) LinkedList();
412 SysTryReturnResult(NID_UI_CTRL, __pNumberElements, E_OUT_OF_MEMORY, "Memory allocation failed.");
420 _ListImpl::SetListItemFormat(ListItemFormat itemFormat)
422 __listItemFormat = itemFormat;
427 _ListImpl::InitCustomListItemFormat(void)
429 __pItemFormat = new (std::nothrow) CustomListItemFormat();
430 SysTryReturnResult(NID_UI_CTRL, (__pItemFormat != null), E_OUT_OF_MEMORY, "Memory allocation failed.");
432 __pItemFormat->Construct();
438 GetElementRects(text1Rect, text2Rect, img1Rect, img2Rect);
441 int listStyleNumberX = 0;
442 int listStyleNumberWidth = 0;
443 int listStyleNumberHeight = 0;
444 int checkItemWidth = 0;
445 int checkItemHeight = 0;
447 GET_SHAPE_CONFIG(LIST::LIST_ITEM_TEXT_SIZE, GetCore().GetOrientation(), textSize);
449 GET_SHAPE_CONFIG(LIST::LIST_STYLE_NUMBER_X, GetCore().GetOrientation(), listStyleNumberX);
450 GET_SHAPE_CONFIG(LIST::LIST_STYLE_NUMBER_WIDTH, GetCore().GetOrientation(), listStyleNumberWidth);
451 GET_SHAPE_CONFIG(LIST::LIST_STYLE_NUMBER_HEIGHT, GetCore().GetOrientation(), listStyleNumberHeight);
453 GET_SHAPE_CONFIG(LIST::LIST_CHECK_ITEM_WIDTH, GetCore().GetOrientation(), checkItemWidth);
454 GET_SHAPE_CONFIG(LIST::LIST_CHECK_ITEM_HEIGHT, GetCore().GetOrientation(), checkItemHeight);
456 if (__listItemFormat != LIST_ITEM_SINGLE_IMAGE)
458 GET_COLOR_CONFIG(LIST::ELEMENT_TEXT_NORMAL, __text1Color);
460 if (__listItemFormat > LIST_ITEM_SINGLE_IMAGE_TEXT_IMAGE)
462 GET_COLOR_CONFIG(LIST::ELEMENT_TEXT_NORMAL, __text2Color);
467 __pItemFormat->AddElement(ID_FORMAT_TEXT1, text1Rect);
468 __pItemFormat->SetElementEventEnabled(ID_FORMAT_TEXT1, false);
473 __pItemFormat->AddElement(ID_FORMAT_IMAGE1, img1Rect);
474 __pItemFormat->SetElementEventEnabled(ID_FORMAT_IMAGE1, false);
479 __pItemFormat->AddElement(ID_FORMAT_TEXT2, text2Rect);
480 __pItemFormat->SetElementEventEnabled(ID_FORMAT_TEXT2, false);
485 __pItemFormat->AddElement(ID_FORMAT_IMAGE2, img2Rect);
486 __pItemFormat->SetElementEventEnabled(ID_FORMAT_IMAGE2, false);
489 if (__listStyle == LIST_STYLE_NUMBER)
491 __pItemFormat->AddElement(ID_FORMAT_NUMBER, Rectangle(listStyleNumberX, GetItemHeight()/2 - 15, listStyleNumberWidth, listStyleNumberHeight));
492 __pItemFormat->SetElementEventEnabled(ID_FORMAT_NUMBER, false);
495 if (_annexStyle != TABLE_VIEW_ANNEX_STYLE_NORMAL)
497 __pItemFormat->AddElement(ID_FORMAT_CHECK, Rectangle(GetCore().GetBounds().width - 60, GetItemHeight() / 2 - 25, checkItemWidth , checkItemHeight));
498 __pItemFormat->SetElementEventEnabled(ID_FORMAT_CHECK, true);
505 _ListImpl::GetTextSlide(ListItemText textIndex)
509 case LIST_ITEM_TEXT1:
510 return __text1SlideEnabled;
512 case LIST_ITEM_TEXT2:
513 return __text2SlideEnabled;
516 SysTryReturn(NID_UI_CTRL, false, false, E_SYSTEM,
517 "[E_SYSTEM] A system error has occurred. The ListItemText is invalid.");
522 _ListImpl::AddItemEventListener(const IItemEventListener& listener)
524 _ListListener* pListListener = new (std::nothrow) _ListListener;
525 SysTryReturn(NID_UI_CTRL, pListListener, E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
527 pListListener->pListener = const_cast<IItemEventListener*>(&listener);
528 __itemListeners.Add(*pListListener);
534 _ListImpl::RemoveItemEventListener(const IItemEventListener& listener)
536 _ListListener* pListListener = null;
538 int count = __itemListeners.GetCount();
540 for (int listenerCount = 0; listenerCount < count; listenerCount++)
542 pListListener = dynamic_cast<_ListListener*>(__itemListeners.GetAt(listenerCount));
544 if ((pListListener != null) && (pListListener->pListener == &listener))
547 __itemListeners.RemoveAt(listenerCount, true);
556 _ListImpl::AddItem(const String* pText1, const String* pText2,
557 const Bitmap* pBitmap1, const Bitmap* pBitmap2, int itemId)
559 if (__listStyle == LIST_STYLE_NUMBER)
561 SysTryReturnResult(NID_UI_CTRL, (GetItemCount() < __maxCount),
562 E_MAX_EXCEEDED, "AddItem operation exceeds the maximum limit for this list style");
565 return InsertItemAt(GetItemCount(), pText1, pText2, pBitmap1, pBitmap2, itemId);
569 _ListImpl::InsertItemAt(int index, const String* pText1, const String* pText2,
570 const Bitmap* pBitmap1, const Bitmap* pBitmap2, int itemId)
572 result r = E_SUCCESS;
574 if (__listStyle == LIST_STYLE_NUMBER)
576 SysTryReturnResult(NID_UI_CTRL, (GetItemCount() < __maxCount),
577 E_MAX_EXCEEDED, "InsertItemAt operation exceeds the maximum limit for this list style");
580 SysTryReturnResult(NID_UI_CTRL, (index >= 0 && index <= GetItemCount()),
581 E_OUT_OF_RANGE, "The index(%d) is out of range.", index);
583 CustomListItem *pItem = GetNewItemN(pText1, pText2, pBitmap1, pBitmap2, itemId, index);
584 SysTryReturnResult(NID_UI_CTRL, pItem, GetLastResult(),
585 "A system error has occurred. CustomListItem instance is null.");
587 r = InsertIntoItemsList(*pItem, -1, index);
588 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, E_SYSTEM, E_SYSTEM, "[%s] Failed to insert an item.", GetErrorMessage(r));
590 if (GetCore().GetFirstDrawnFlag() == false)
592 r = GetCore().RefreshTableView(0, index, TABLE_VIEW_REFRESH_TYPE_ITEM_ADD);
593 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , E_SYSTEM, "[%s] Propagating.",GetErrorMessage(r));
596 if (__listStyle == LIST_STYLE_NUMBER)
598 r = UpdateNumbers(index);
599 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , E_SYSTEM,
600 "[E_SYSTEM] A system error has occurred. Failed to update the numbers");
607 RemoveFromItemsList(-1, index);
609 if (__listStyle == LIST_STYLE_NUMBER)
611 __pNumberElements->RemoveAt(index, true);
617 _ListImpl::SetItemAt(int index, const String* pText1, const String* pText2,
618 const Bitmap* pBitmap1, const Bitmap* pBitmap2, int itemId)
620 result r = E_SUCCESS;
621 SysTryReturnResult(NID_UI_CTRL, (index >= 0 && index < GetItemCount()),
622 E_OUT_OF_RANGE, "The index(%d) is out of range.", index);
624 if (__listStyle == LIST_STYLE_NUMBER)
626 __pNumberElements->RemoveAt(index, true);
629 CustomListItem *pItem = GetNewItemN(pText1, pText2, pBitmap1, pBitmap2, itemId, index);
630 SysTryReturnResult(NID_UI_CTRL, pItem, GetLastResult(),
631 "A system error has occurred. CustomListItem instance is null.");
633 pItem->__pCustomListItemImpl->__pTableViewItemData = GetTableViewItemAt(-1, index);
635 _CheckElementModel* pCheckElement = null;
636 _CheckElementModel* pOldCheckElement = GetCheckElementAt(-1, index);
637 _CheckBoxStatus oldCheckStatus = (pOldCheckElement) ? (pOldCheckElement->GetCheckBoxStatus()) : CHECK_BOX_UNCHECKED;
639 pItem->__pCustomListItemImpl->itemId = itemId;
641 pCheckElement = GetCheckElementAt(-1, index);
645 pCheckElement->SetCheckBoxStatus(oldCheckStatus);
648 r = SetInItemsList(*pItem, -1, index);
649 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Failed to perform SetAt operation.", GetErrorMessage(r));
651 _TableViewItemUpdateParams updateParams;
652 updateParams.pItem = const_cast<CustomListItem*>(pItem);
653 updateParams.isDividerEnabled = _isDividerEnabled;
654 updateParams.pCheckBitmaps = _pCheckBitmaps;
655 updateParams.annexStyle = _annexStyle;
657 r = _CustomListItemImpl::UpdateTableViewItem(updateParams);
658 SysTryReturn(NID_UI_CTRL, (r == E_SUCCESS), false, E_SYSTEM,
659 "[E_SYSTEM] A system error has occurred. Failed to refresh an item.");
661 if (GetCore().GetFirstDrawnFlag() == false)
663 r = GetCore().RefreshTableView(0, index, TABLE_VIEW_REFRESH_TYPE_ITEM_MODIFY);
664 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, E_SYSTEM, E_SYSTEM, "[%s] Propagating.",GetErrorMessage(r));
667 r = GetCore().SetItemEnabled(0, index, true);
668 SysTryReturnResult(NID_UI_CTRL, (r == E_SUCCESS), E_SYSTEM,
669 "A system error has occurred. Failed to enable an item.");
675 _ListImpl::RemoveItemAt(int index)
677 result r = E_SUCCESS;
679 SysTryReturnResult(NID_UI_CTRL, (index >= 0 && index < GetItemCount()),
680 E_OUT_OF_RANGE, "The index(%d) is out of range.", index);
682 r = RemoveFromItemsList(-1, index);
683 SysTryReturnResult(NID_UI_CTRL, (r == E_SUCCESS), E_SYSTEM, "Failed to perform RemoveAt operation");
685 __directDelete = true;
687 if (GetCore().GetFirstDrawnFlag() == false)
689 r = GetCore().RefreshTableView(groupIndex, index, TABLE_VIEW_REFRESH_TYPE_ITEM_REMOVE);
690 SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, E_SYSTEM, "Propagating.");
693 __directDelete = false;
695 if (__listStyle == LIST_STYLE_NUMBER)
697 __pNumberElements->RemoveAt(index, true);
698 r = UpdateNumbers(index - 1);
699 SysTryReturn(NID_UI_CTRL, (r == E_SUCCESS), r, r, "[%s] Failed to perform UpdateNumbers", GetErrorMessage(r));
708 _ListImpl::RemoveAllItems(void)
710 result r = E_SUCCESS;
711 int count = GetItemCount();
714 result finalResult = E_SUCCESS;
716 for (itemIndex = count - 1; itemIndex >= 0; itemIndex--)
718 r = RemoveItemAt(itemIndex);
722 SysLog(NID_UI_CTRL, "[%s] Failed to remove item at index(%d)", GetErrorMessage(r), itemIndex);
730 _ListImpl::SetItemEnabled(int index, bool enable)
732 result r = E_SUCCESS;
734 SysTryReturnResult(NID_UI_CTRL, (index >= 0 && index < GetItemCount()), E_SYSTEM,
735 "A system error has occurred. The current value of index(%d) is invalid.", index);
737 _CheckElementModel* pCheckElementModel = GetCheckElementAt(-1, index);
739 if (pCheckElementModel)
743 if (pCheckElementModel->GetCheckBoxStatus() == CHECK_BOX_DISABLED)
745 pCheckElementModel->SetCheckBoxStatus(CHECK_BOX_CHECKED);
750 if (pCheckElementModel->GetCheckBoxStatus() == CHECK_BOX_CHECKED)
752 if (_annexStyle == TABLE_VIEW_ANNEX_STYLE_MARK)
754 pCheckElementModel->SetCheckBoxStatus(CHECK_BOX_DISABLED);
760 r = GetCore().SetItemEnabled(0, index, enable);
761 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, E_SYSTEM, E_SYSTEM, "[%s] Propagating.", GetErrorMessage(r));
769 _ListImpl::IsItemEnabled(int index) const
771 return GetCore().IsItemEnabled(0, index);
775 _ListImpl::SetFocusedItemBackgroundBitmap(const Bitmap& bitmap)
777 __pFocusedBgBitmap = const_cast<Bitmap*>(&bitmap);
778 SysTryReturnVoidResult(NID_UI_CTRL, __pFocusedBgBitmap, E_SYSTEM,
779 "[E_SYSTEM] A system error has occurred. Failed to get the Bitmap");
780 SetBitmap(TABLE_VIEW_ITEM_DRAWING_STATUS_PRESSED, bitmap);
786 _ListImpl::SetHighlightedItemBackgroundBitmap(const Bitmap& bitmap)
788 __pHighlightedBgBitmap = const_cast<Bitmap*>(&bitmap);
789 SysTryReturnVoidResult(NID_UI_CTRL, __pHighlightedBgBitmap, E_SYSTEM,
790 "[E_SYSTEM] A system error has occurred. Failed to get the Bitmap");
791 SetBitmap(TABLE_VIEW_ITEM_DRAWING_STATUS_HIGHLIGHTED, bitmap);
797 _ListImpl::SetNormalItemBackgroundBitmap(const Bitmap& bitmap)
799 __pNormalBgBitmap = const_cast<Bitmap*>(&bitmap);
800 SysTryReturnVoidResult(NID_UI_CTRL, __pNormalBgBitmap, E_SYSTEM,
801 "[E_SYSTEM] A system error has occurred. Failed to get the Bitmap");
802 SetBitmap(TABLE_VIEW_ITEM_DRAWING_STATUS_NORMAL, bitmap);
808 _ListImpl::SetItemTextColor(ListItemText textIndex, const Color& textColor)
812 SysTryReturnVoidResult(NID_UI_CTRL, (__listItemFormat != LIST_ITEM_SINGLE_IMAGE), E_SYSTEM,
813 "[E_SYSTEM] A system error has occurred. The current value of ListItemFormat is invalid.");
817 case LIST_ITEM_TEXT1:
818 __text1Color.SetRGB32(textColor.GetRGB32(), textColor.GetAlpha());
819 elementId = ID_FORMAT_TEXT1;
822 case LIST_ITEM_TEXT2:
823 SysTryReturnVoidResult(NID_UI_CTRL, (__listItemFormat > LIST_ITEM_SINGLE_IMAGE_TEXT_IMAGE), E_SYSTEM,
824 "[E_SYSTEM] A system error has occurred. The current value of ListItemFormat is invalid.");
825 __text2Color.SetRGB32(textColor.GetRGB32(), textColor.GetAlpha());
826 elementId = ID_FORMAT_TEXT2;
830 SysTryReturnVoidResult(NID_UI_CTRL, (false), E_SYSTEM,
831 "[E_SYSTEM] A system error has occurred. The current value of ListItemText is invalid.");
839 GetElementRects(text1Rect, text2Rect, img1Rect, img2Rect);
843 case LIST_ITEM_TEXT1:
844 __pItemFormat->AddElement(elementId, text1Rect, 38, __text1Color, __text1Color, __text1Color);
847 case LIST_ITEM_TEXT2:
848 __pItemFormat->AddElement(elementId, text2Rect, 38, __text2Color, __text2Color, __text2Color);
852 int count = GetItemCount();
853 for (int index = 0; index < count; index++)
862 _ListImpl::GetItemTextColor(ListItemText textIndex) const
864 if (textIndex == LIST_ITEM_TEXT1)
868 else if(textIndex == LIST_ITEM_TEXT2)
874 SysLog(NID_UI_CTRL, "[E_SYSTEM] A system error has occurred. The current value of ListItemText is invalid.");
881 _ListImpl::EnableTextSlide(ListItemText textIndex)
886 case LIST_ITEM_TEXT1:
887 __text1SlideEnabled = true;
888 elementId = ID_FORMAT_TEXT1;
891 case LIST_ITEM_TEXT2:
892 __text2SlideEnabled = true;
893 elementId = ID_FORMAT_TEXT2;
899 SysTryReturnVoidResult(NID_UI_CTRL, (elementId != -1), E_SYSTEM,
900 "[E_SYSTEM] A system error has occurred. The ListItemText is invalid.");
902 int maxCount = GetItemCount();
904 for (int itemCount = 0; itemCount < maxCount; itemCount++)
906 CustomListItem* pItem = GetCustomListItemAt(-1, itemCount);
907 SysTryReturnVoidResult(NID_UI_CTRL, (pItem), E_SYSTEM,
908 "[E_SYSTEM] A system error has occurred. Failed to get item at %d.", itemCount);
910 _CustomListItemImpl *pItemImpl = pItem->__pCustomListItemImpl;
911 SysTryReturnVoidResult(NID_UI_CTRL, (pItemImpl), E_SYSTEM,
912 "[E_SYSTEM] A system error has occurred. Failed to get item at %d.", itemCount);
914 pItemImpl->SetTextSliding(elementId, true);
921 _ListImpl::DisableTextSlide(void)
923 __text1SlideEnabled = false;
924 __text2SlideEnabled = false;
926 int maxCount = GetItemCount();
928 for (int itemCount = 0; itemCount < maxCount; itemCount++)
930 CustomListItem* pItem = GetCustomListItemAt(-1, itemCount);
931 SysTryReturnVoidResult(NID_UI_CTRL, (pItem), E_SYSTEM,
932 "[E_SYSTEM] A system error has occurred. Failed to get item at %d.", itemCount);
934 _CustomListItemImpl *pItemImpl = pItem->__pCustomListItemImpl;
935 SysTryReturnVoidResult(NID_UI_CTRL, (pItemImpl), E_SYSTEM,
936 "[E_SYSTEM] A system error has occurred. Failed to get item at %d.", itemCount);
938 pItemImpl->SetTextSliding(ID_FORMAT_TEXT1, false);
939 pItemImpl->SetTextSliding(ID_FORMAT_TEXT2, false);
946 _ListImpl::GetItemHeight(void) const
948 if (__listItemFormat < LIST_ITEM_DOUBLE_IMAGE_TEXT_FULLTEXT)
953 return __row1Height + __row2Height;
957 _ListImpl::GetRow1Height(void) const
963 _ListImpl::GetRow2Height(void) const
969 _ListImpl::GetColumn1Width(void) const
971 return __column1Width;
975 _ListImpl::GetColumn2Width(void) const
977 return __column2Width;
981 _ListImpl::SetRow1Height(int row1Height)
983 __row1Height = row1Height;
984 if (GetCore().GetFirstDrawnFlag() == false)
993 _ListImpl::SetRow2Height(int row2Height)
995 if (__listItemFormat < LIST_ITEM_DOUBLE_IMAGE_TEXT_FULLTEXT)
1001 __row2Height = row2Height;
1002 if (GetCore().GetFirstDrawnFlag() == false)
1004 return ReDrawList();
1012 _ListImpl::SetColumn1Width(int column1Width)
1014 __column1Width = column1Width;
1015 if (GetCore().GetFirstDrawnFlag() == false)
1017 return ReDrawList();
1024 _ListImpl::SetColumn2Width(int column2Width)
1026 __column2Width = column2Width;
1027 if (GetCore().GetFirstDrawnFlag() == false)
1029 return ReDrawList();
1037 _ListImpl::SetItemChecked(int index, bool check)
1039 SysTryReturnResult(NID_UI_CTRL, (index >= 0 && index < GetItemCount()), E_SYSTEM,
1040 "A system error has occurred. The current value of index(%d) is invalid.", index);
1042 SysTryReturnResult(NID_UI_CTRL, (__listStyle != LIST_STYLE_NORMAL), E_SYSTEM,
1043 "A system error has occurred. List style should not be LIST_STYLE_NORMAL");
1044 SysTryReturnResult(NID_UI_CTRL, (__listStyle != LIST_STYLE_NUMBER), E_SYSTEM,
1045 "A system error has occurred. List style should not be LIST_STYLE_NUMBER");
1047 if (IsItemChecked(index) == check)
1052 SysTryReturnResult(NID_UI_CTRL, (IsItemEnabled(index)), E_SYSTEM,
1053 "A system error has occurred. The List item is not enabled at index(%d).", index);
1055 _CheckElementModel* pCheckElementModel = GetCheckElementAt(-1, index);
1056 SysTryReturnResult(NID_UI_CTRL, pCheckElementModel, E_SYSTEM,
1057 "A system error has occurred. _CheckElementModel instance is null.");
1059 if (_annexStyle == TABLE_VIEW_ANNEX_STYLE_RADIO)
1063 if (_currentRadioIndex != -1)
1065 _CheckElementModel* pOldCheckElementModel = GetCheckElementAt(-1, _currentRadioIndex);
1066 SysTryReturnResult(NID_UI_CTRL, pOldCheckElementModel, E_SYSTEM,
1067 "A system error has occurred. _CheckElementModel instance is null.");
1069 pOldCheckElementModel->SetCheckBoxStatus(CHECK_BOX_UNCHECKED);
1070 DrawItem(-1, _currentRadioIndex);
1072 _currentRadioIndex = index;
1076 _currentRadioIndex = -1;
1080 pCheckElementModel->SetCheckBoxStatus((_CheckBoxBitmapType)check);
1082 DrawItem(-1, index);
1088 _ListImpl::IsItemChecked(int index) const
1090 SysTryReturn(NID_UI_CTRL, (__listStyle != LIST_STYLE_NORMAL), false, E_SYSTEM,
1091 "[E_SYSTEM] A system error has occurred. List style should not be LIST_STYLE_NORMAL.");
1092 SysTryReturn(NID_UI_CTRL, (__listStyle != LIST_STYLE_NUMBER), false, E_SYSTEM,
1093 "[E_SYSTEM] A system error has occurred. List style should not be LIST_STYLE_NUMBER.");
1095 SysTryReturn(NID_UI_CTRL, (index >= 0 && index < GetItemCount()),
1096 false, E_INVALID_ARG, "[E_INVALID_ARG] The current value of index(%d) is invalid.", index);
1098 const _CheckElementModel* pCheckElement = GetCheckElementAt(-1, index);
1099 SysTryReturn(NID_UI_CTRL, pCheckElement, false, E_SYSTEM, "[E_SYSTEM] A system error has occurred. CheckElement is not constructed properly.");
1101 return (bool)pCheckElement->GetCheckBoxStatus();
1105 _ListImpl::SetAllItemsChecked(bool check)
1107 SysTryReturnResult(NID_UI_CTRL, (__listStyle != LIST_STYLE_NORMAL), E_SYSTEM,
1108 "A system error has occurred. List style should not be LIST_STYLE_NORMAL");
1109 SysTryReturnResult(NID_UI_CTRL, (__listStyle != LIST_STYLE_NUMBER), E_SYSTEM,
1110 "A system error has occurred. List style should not be LIST_STYLE_NUMBER");
1111 SysTryReturnResult(NID_UI_CTRL, (__listStyle != LIST_STYLE_RADIO), E_SYSTEM,
1112 "A system error has occurred. List style should not be LIST_STYLE_RADIO");
1113 SysTryReturnResult(NID_UI_CTRL, (__listStyle != LIST_STYLE_RADIO_WITH_DIVIDER), E_SYSTEM,
1114 "A system error has occurred. List style should not be LIST_STYLE_RADIO_WITH_DIVIDER");
1116 _CheckElementModel* pCheckElement = null;
1118 for (int index = 0; index < GetItemCount(); index++)
1120 if (IsItemEnabled(index))
1122 pCheckElement = GetCheckElementAt(-1, index);
1123 SysTryReturnResult(NID_UI_CTRL, (pCheckElement != null), E_SYSTEM,
1124 "A system error has occurred. _CheckElementModel instance is null.");
1126 pCheckElement->SetCheckBoxStatus((_CheckBoxBitmapType)check);
1136 _ListImpl::RemoveAllCheckedItems(void)
1138 SysTryReturnResult(NID_UI_CTRL, (__listStyle != LIST_STYLE_NORMAL), E_SYSTEM,
1139 "A system error has occurred. List style should not be LIST_STYLE_NORMAL");
1140 SysTryReturnResult(NID_UI_CTRL, (__listStyle != LIST_STYLE_NUMBER), E_SYSTEM,
1141 "A system error has occurred. List style should not be LIST_STYLE_NUMBER");
1142 SysTryReturnResult(NID_UI_CTRL, (__listStyle != LIST_STYLE_RADIO), E_SYSTEM,
1143 "A system error has occurred. List style should not be LIST_STYLE_RADIO");
1144 SysTryReturnResult(NID_UI_CTRL, (__listStyle != LIST_STYLE_RADIO_WITH_DIVIDER), E_SYSTEM,
1145 "A system error has occurred. List style should not be LIST_STYLE_RADIO_WITH_DIVIDER");
1147 result r = E_SUCCESS;
1148 result finalResult = E_SUCCESS;
1150 for (int index = GetItemCount() -1; index >= 0; index--)
1152 if (IsItemChecked(index))
1154 r = RemoveItemAt(index);
1159 SysLog(NID_UI_CTRL, "[%s] Item at index(%d) is not removed successfully.", GetErrorMessage(r), index);
1168 _ListImpl::GetFirstCheckedItemIndex(void) const
1170 SysTryReturn(NID_UI_CTRL, (__listStyle != LIST_STYLE_NORMAL), INVALID_INDEX, E_SYSTEM,
1171 "[E_SYSTEM] A system error has occurred. List style should not be LIST_STYLE_NORMAL.");
1172 SysTryReturn(NID_UI_CTRL, (__listStyle != LIST_STYLE_NUMBER), INVALID_INDEX, E_SYSTEM,
1173 "[E_SYSTEM] A system error has occurred. List style should not be LIST_STYLE_NUMBER.");
1175 for (int index = 0; index < GetItemCount(); index++)
1177 if (IsItemChecked(index))
1179 SetLastResult(E_SUCCESS);
1183 SetLastResult(E_SUCCESS);
1184 return INVALID_INDEX;
1188 _ListImpl::GetLastCheckedItemIndex(void) const
1190 SysTryReturn(NID_UI_CTRL, (__listStyle != LIST_STYLE_NORMAL), INVALID_INDEX, E_SYSTEM,
1191 "[E_SYSTEM] A system error has occurred. List style should not be LIST_STYLE_NORMAL.");
1192 SysTryReturn(NID_UI_CTRL, (__listStyle != LIST_STYLE_NUMBER), INVALID_INDEX, E_SYSTEM,
1193 "[E_SYSTEM] A system error has occurred. List style should not be LIST_STYLE_NUMBER.");
1195 for (int index = GetItemCount() - 1; index >= 0; index--)
1197 if (IsItemChecked(index))
1199 SetLastResult(E_SUCCESS);
1203 SetLastResult(E_SUCCESS);
1205 return INVALID_INDEX;
1209 _ListImpl::GetNextCheckedItemIndexAfter(int index) const
1211 SysTryReturn(NID_UI_CTRL, (__listStyle != LIST_STYLE_NORMAL), INVALID_INDEX, E_SYSTEM,
1212 "[E_SYSTEM] A system error has occurred. List style should not be LIST_STYLE_NORMAL.");
1213 SysTryReturn(NID_UI_CTRL, (__listStyle != LIST_STYLE_NUMBER), INVALID_INDEX, E_SYSTEM,
1214 "[E_SYSTEM] A system error has occurred. List style should not be LIST_STYLE_NUMBER.");
1216 SysTryReturn(NID_UI_CTRL, (index >= 0 && index < GetItemCount()), INVALID_INDEX, E_SYSTEM,
1217 "[E_SYSTEM] A system error has occurred. The current value of index(%d) is invalid.") ;
1219 for (int itemCount = index + 1; itemCount < GetItemCount(); itemCount++)
1221 if (IsItemChecked(itemCount))
1223 SetLastResult(E_SUCCESS);
1227 SetLastResult(E_SUCCESS);
1229 return INVALID_INDEX;
1233 _ListImpl::GetItemIndexFromItemId(int itemId) const
1235 for (int index = 0; index < GetItemCount(); index++)
1237 const CustomListItem* pCustomListItem = GetCustomListItemAt(-1, index);
1238 SysTryReturn(NID_UI_CTRL, pCustomListItem, INVALID_INDEX, E_SYSTEM,
1239 "[E_SYSTEM] A system error has occurred. Failed to get an item at index(%d).", index);
1241 if (pCustomListItem->__pCustomListItemImpl->itemId == itemId)
1243 SetLastResult(E_SUCCESS);
1248 SetLastResult(E_SUCCESS);
1250 return INVALID_INDEX;
1254 _ListImpl::GetItemIdAt(int index) const
1256 SysTryReturn(NID_UI_CTRL, (index >= 0 && index < GetItemCount()),
1257 -1, E_INVALID_ARG, "[E_INVALID_ARG] The current value of index(%d) is invalid.", index);
1259 const CustomListItem* pCustomListItem = GetCustomListItemAt(-1, index);
1260 SysTryReturn(NID_UI_CTRL, pCustomListItem, -1, E_SYSTEM, "[E_SYSTEM] A system error has occurred. Failed to get an item at index(%d).", index);
1262 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);
1264 SetLastResult(E_SUCCESS);
1265 return pCustomListItem->__pCustomListItemImpl->itemId;
1269 _ListImpl::ScrollToBottom(void)
1271 result r = E_SUCCESS;
1273 GetCore().SetBottomDrawnItemIndex(0, GetItemCount() - 1);
1274 SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
1276 SetLastResult(E_SUCCESS);
1283 _ListImpl::ScrollToTop(void)
1285 result r = E_SUCCESS;
1286 r = GetCore().SetTopDrawnItemIndex(0,0);
1287 SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
1289 SetLastResult(E_SUCCESS);
1296 _ListImpl::ScrollToTop(int index)
1298 SysTryReturnResult(NID_UI_CTRL, (index >= 0 && index < GetItemCount()), E_INVALID_ARG, "The current value of index(%d) is invalid.", index);
1300 result r = GetCore().SetTopDrawnItemIndex(0, index);
1301 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, E_SYSTEM, E_SYSTEM, "[%s] Propagating.", GetErrorMessage(r));
1309 _ListImpl::RefreshItem(int index)
1311 SysTryReturnResult(NID_UI_CTRL, (index >= 0 && index < GetItemCount()), E_INVALID_ARG, "The current value of index(%d) is invalid.", index);
1313 int topItemIndex = -1;
1314 int bottomItemIndex = -1;
1315 int groupIndex = -1;
1317 GetCore().GetTopDrawnItemIndex(groupIndex, topItemIndex);
1318 GetCore().GetBottomDrawnItemIndex(groupIndex, bottomItemIndex);
1320 SysTryReturnResult(NID_UI_CTRL, (index >= topItemIndex && index <= bottomItemIndex), E_INVALID_OPERATION,
1321 "Index(%d) should be within drawn item range.", index);
1323 result r = E_SUCCESS;
1325 _TableViewItemUpdateParams updateParams;
1326 updateParams.pItem = GetCustomListItemAt(-1, index);
1327 updateParams.isDividerEnabled = _isDividerEnabled;
1328 updateParams.pCheckBitmaps = _pCheckBitmaps;
1329 updateParams.annexStyle = _annexStyle;
1331 r = _CustomListItemImpl::UpdateTableViewItem(updateParams);
1332 SysTryReturnResult(NID_UI_CTRL, (r == E_SUCCESS), E_SYSTEM,
1333 "A system error has occurred. Failed to refresh an item.");
1335 DrawItem(-1, index);
1341 _ListImpl::GetNewItemN(const String* pText1, const String* pText2, const Bitmap* pBitmap1, const Bitmap* pBitmap2, int itemId, int index)
1343 SysTryReturn(NID_UI_CTRL, __pItemFormat, null, E_SYSTEM,
1344 "[E_SYSTEM] A system error has occurred. Item Format must not be null.");
1345 Dimension listSize = GetCore().GetSize();
1346 Rectangle text1Rect;
1347 Rectangle text2Rect;
1351 GetElementRects(text1Rect, text2Rect, img1Rect, img2Rect);
1353 CustomListItem* pItem = new (std::nothrow) CustomListItem();
1354 SysTryReturn(NID_UI_CTRL, pItem, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
1356 pItem->Construct(GetItemHeight());
1357 pItem->SetItemFormat(*__pItemFormat);
1358 pItem->__pCustomListItemImpl->itemId = itemId;
1360 if ((pText1 != null) && (text1Rect.x > 0))
1362 pItem->SetElement(ID_FORMAT_TEXT1, *pText1);
1363 pItem->__pCustomListItemImpl->SetTextSliding(ID_FORMAT_TEXT1, __text1SlideEnabled);
1366 if ((pBitmap1 != null) && (img1Rect.x > 0))
1368 pItem->SetElement(ID_FORMAT_IMAGE1, *pBitmap1, pBitmap1);
1371 if ((pText2 != null) && (text2Rect.x > 0))
1373 pItem->SetElement(ID_FORMAT_TEXT2, *pText2);
1374 pItem->__pCustomListItemImpl->SetTextSliding(ID_FORMAT_TEXT2, __text2SlideEnabled);
1377 if ((pBitmap2 != null) && (img2Rect.x > 0))
1379 pItem->SetElement(ID_FORMAT_IMAGE2, *pBitmap2, pBitmap2);
1382 _NumberElement *pNumberElement = null;
1384 if (__listStyle == LIST_STYLE_NUMBER)
1386 pNumberElement = new (std::nothrow) _NumberElement();
1387 SysTryReturn(NID_UI_CTRL, pNumberElement, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
1388 pNumberElement->index = index + 1;
1389 __pNumberElements->InsertAt(*pNumberElement, index);
1390 pItem->SetElement(ID_FORMAT_NUMBER, *(dynamic_cast<ICustomListElement*>(pNumberElement)));
1393 if (_annexStyle != TABLE_VIEW_ANNEX_STYLE_NORMAL)
1395 pItem->SetCheckBox(ID_FORMAT_CHECK);
1402 _ListImpl::GetItemMargins(int& leftMargin, int& numberStyleMargin, int& dividerMargin, int& lowerMargin, int& upperMargin)
1404 if (__listStyle == LIST_STYLE_NUMBER)
1406 GET_SHAPE_CONFIG(LIST::LIST_ITEM_NUMBER_STYLE_MARGIN, GetCore().GetOrientation(), numberStyleMargin);
1411 GET_SHAPE_CONFIG(LIST::LIST_ITEM_DIVIDER_MARGIN, GetCore().GetOrientation(), dividerMargin);
1414 GET_SHAPE_CONFIG(LIST::LIST_ITEM_LEFT_MARGIN, GetCore().GetOrientation(), leftMargin);
1415 GET_SHAPE_CONFIG(LIST::LIST_ITEM_LOWER_MARGIN, GetCore().GetOrientation(), lowerMargin);
1416 GET_SHAPE_CONFIG(LIST::LIST_ITEM_UPPER_MARGIN, GetCore().GetOrientation(), upperMargin);
1420 _ListImpl::GetElementRects(Rectangle& text1Rect, Rectangle& text2Rect, Rectangle& img1Rect, Rectangle& img2Rect)
1422 Dimension listSize = GetCore().GetSize();
1425 int numberStyleMargin = 0;
1426 int dividerMargin = 0;
1427 int lowerMargin = 0;
1428 int upperMargin = 0;
1430 GetItemMargins(leftMargin, numberStyleMargin, dividerMargin, lowerMargin, upperMargin);
1432 switch (__listItemFormat)
1434 case LIST_ITEM_SINGLE_IMAGE:
1436 img1Rect.x = leftMargin + numberStyleMargin;
1437 img1Rect.y = upperMargin;
1438 img1Rect.width = __column1Width - dividerMargin;
1439 img1Rect.height = __row1Height - lowerMargin;
1443 case LIST_ITEM_SINGLE_TEXT:
1445 text1Rect.x = leftMargin + numberStyleMargin;
1446 text1Rect.y = upperMargin;
1447 text1Rect.width = __column1Width - dividerMargin - text1Rect.x;
1448 text1Rect.height = __row1Height - lowerMargin;
1452 case LIST_ITEM_SINGLE_IMAGE_TEXT:
1454 img1Rect.x = leftMargin + numberStyleMargin;
1455 img1Rect.y = upperMargin;
1456 img1Rect.width = __column1Width;
1457 img1Rect.height = __row1Height - lowerMargin;
1459 text1Rect.x = __column1Width + leftMargin + numberStyleMargin;
1460 text1Rect.y = upperMargin;
1461 text1Rect.width = (__column1Width + __column2Width + dividerMargin <= listSize.width) ? (__column2Width) : (__column2Width - dividerMargin);
1462 text1Rect.height = __row1Height - lowerMargin;
1466 case LIST_ITEM_SINGLE_TEXT_IMAGE:
1468 img1Rect.x = __column1Width + leftMargin + numberStyleMargin;
1469 img1Rect.y = upperMargin;
1470 img1Rect.width = __column1Width;
1471 img1Rect.height = __row1Height - lowerMargin;
1473 text1Rect.x = leftMargin + numberStyleMargin;
1474 text1Rect.y = upperMargin;
1475 text1Rect.width = (__column1Width + __column2Width + dividerMargin <= listSize.width) ? (__column2Width) : (__column2Width - dividerMargin);
1476 text1Rect.height = __row1Height - lowerMargin;
1480 case LIST_ITEM_SINGLE_IMAGE_TEXT_IMAGE:
1482 img1Rect.x = leftMargin + numberStyleMargin;
1483 img1Rect.y = upperMargin;
1484 img1Rect.width = __column1Width;
1485 img1Rect.height = __row1Height - lowerMargin;
1487 text1Rect.x = __column1Width + leftMargin + numberStyleMargin;
1488 text1Rect.y = upperMargin;
1489 text1Rect.width = __column2Width;
1490 text1Rect.height = __row1Height - lowerMargin;
1492 img2Rect.x = text1Rect.x + __column2Width;
1493 img2Rect.y = upperMargin;
1494 img2Rect.width = (__column1Width + __column2Width + dividerMargin <= listSize.width) ? (__column2Width) : (__column2Width - dividerMargin);
1495 img2Rect.height = __row1Height - lowerMargin;
1499 case LIST_ITEM_DOUBLE_IMAGE_TEXT_FULLTEXT:
1501 img1Rect.x = leftMargin + numberStyleMargin;
1502 img1Rect.y = upperMargin;
1503 img1Rect.width = __column1Width;
1504 img1Rect.height = __row1Height - lowerMargin;
1506 text1Rect.x = __column1Width + leftMargin + numberStyleMargin;
1507 text1Rect.y = upperMargin;
1508 text1Rect.width = (__column1Width + __column2Width + dividerMargin <= listSize.width) ? (__column2Width) : (__column2Width - dividerMargin);
1509 text1Rect.height = __row1Height - lowerMargin;
1511 text2Rect.x = leftMargin + numberStyleMargin;
1512 text2Rect.y = __row1Height;
1513 text2Rect.width = __column1Width;
1514 text2Rect.height = __row2Height - lowerMargin;
1518 case LIST_ITEM_DOUBLE_FULLTEXT_IMAGE_TEXT:
1520 img1Rect.x = leftMargin + numberStyleMargin;
1521 img1Rect.y = __row1Height;
1522 img1Rect.width = __column1Width;
1523 img1Rect.height = __row2Height;
1525 text1Rect.x = __column1Width + leftMargin + numberStyleMargin;
1526 text1Rect.y = __row1Height;
1527 text1Rect.width = (__column1Width + __column2Width + dividerMargin <= listSize.width) ? (__column2Width) : (__column2Width - dividerMargin);
1528 text1Rect.height = __row2Height;
1530 text2Rect.x = leftMargin + numberStyleMargin;
1531 text2Rect.y = upperMargin;
1532 text2Rect.width = __column1Width;
1533 text2Rect.height = __row1Height - lowerMargin;
1537 case LIST_ITEM_DOUBLE_TEXT_IMAGE_FULLTEXT:
1539 img1Rect.x = __column1Width + leftMargin + numberStyleMargin;
1540 img1Rect.y = upperMargin;
1541 img1Rect.width = (__column1Width + __column2Width + dividerMargin <= listSize.width) ? (__column2Width) : (__column2Width - dividerMargin);
1542 img1Rect.height = __row1Height - lowerMargin;
1544 text1Rect.x = leftMargin + numberStyleMargin;
1545 text1Rect.y = upperMargin;
1546 text1Rect.width = __column1Width;
1547 text1Rect.height = __row1Height - lowerMargin;
1549 text2Rect.x = leftMargin + numberStyleMargin;
1550 text2Rect.y = __row1Height;
1551 text2Rect.width = __column1Width;
1552 text2Rect.height = __row2Height;
1556 case LIST_ITEM_DOUBLE_FULLTEXT_TEXT_IMAGE:
1558 img1Rect.x = __column1Width + leftMargin + numberStyleMargin;
1559 img1Rect.y = __row1Height;
1560 img1Rect.width = (__column1Width + __column2Width + dividerMargin <= listSize.width) ? (__column2Width) : (__column2Width - dividerMargin);
1561 img1Rect.height = __row2Height;
1563 text1Rect.x = leftMargin + numberStyleMargin;
1564 text1Rect.y = __row1Height;
1565 text1Rect.width = __column1Width;
1566 text1Rect.height = __row2Height;
1568 text2Rect.x = leftMargin + numberStyleMargin;
1569 text2Rect.y = upperMargin;
1570 text2Rect.width = __column1Width;
1571 text2Rect.height = __row1Height - lowerMargin;
1575 case LIST_ITEM_DOUBLE_IMAGE_TEXT_TEXT:
1577 img1Rect.x = leftMargin + numberStyleMargin;
1578 img1Rect.y = upperMargin;
1579 img1Rect.width = __column1Width;
1580 img1Rect.height = __row1Height + __row2Height - lowerMargin;
1582 text1Rect.x = __column1Width + leftMargin + numberStyleMargin;
1583 text1Rect.y = upperMargin;
1584 text1Rect.width = (__column1Width + __column2Width + dividerMargin <= listSize.width) ? (__column2Width) : (__column2Width - dividerMargin);
1585 text1Rect.height = __row1Height - lowerMargin;
1587 text2Rect.x = __column1Width + leftMargin + numberStyleMargin;
1588 text2Rect.y = __row1Height;
1589 text2Rect.width = (__column1Width + __column2Width + dividerMargin <= listSize.width) ? (__column2Width) : (__column2Width - dividerMargin);
1590 text2Rect.height = __row2Height;
1594 case LIST_ITEM_DOUBLE_TEXT_TEXT_IMAGE:
1596 img1Rect.x = __column1Width + leftMargin + numberStyleMargin;
1597 img1Rect.y = upperMargin;
1598 img1Rect.width = (__column1Width + __column2Width + dividerMargin <= listSize.width) ? (__column2Width) : (__column2Width - dividerMargin);
1599 img1Rect.height = __row1Height + __row2Height - lowerMargin;
1601 text1Rect.x = leftMargin + numberStyleMargin;
1602 text1Rect.y = upperMargin;
1603 text1Rect.width = __column1Width;
1604 text1Rect.height = __row2Height - lowerMargin;
1606 text2Rect.x = leftMargin + numberStyleMargin;
1607 text2Rect.y = __row1Height;
1608 text2Rect.width = __column1Width;
1609 text2Rect.height = __row1Height;
1616 _ListImpl::ReDrawList(void)
1618 Rectangle text1Rect;
1619 Rectangle text2Rect;
1622 int groupIndex = -1;
1625 GetTopDrawnItemIndex(groupIndex, currIndex);
1627 GetElementRects(text1Rect, text2Rect, img1Rect, img2Rect);
1630 int listStyleNumberX = 0;
1631 int listStyleNumberWidth = 0;
1632 int listStyleNumberHeight = 0;
1633 int checkItemWidth = 0;
1634 int checkItemHeight = 0;
1636 GET_SHAPE_CONFIG(LIST::LIST_ITEM_TEXT_SIZE, GetCore().GetOrientation(), textSize);
1638 GET_SHAPE_CONFIG(LIST::LIST_STYLE_NUMBER_X, GetCore().GetOrientation(), listStyleNumberX);
1639 GET_SHAPE_CONFIG(LIST::LIST_STYLE_NUMBER_WIDTH, GetCore().GetOrientation(), listStyleNumberWidth);
1640 GET_SHAPE_CONFIG(LIST::LIST_STYLE_NUMBER_HEIGHT, GetCore().GetOrientation(), listStyleNumberHeight);
1642 GET_SHAPE_CONFIG(LIST::LIST_CHECK_ITEM_WIDTH, GetCore().GetOrientation(), checkItemWidth);
1643 GET_SHAPE_CONFIG(LIST::LIST_CHECK_ITEM_HEIGHT, GetCore().GetOrientation(), checkItemHeight);
1645 if (text1Rect.x > 0)
1647 __pItemFormat->AddElement(ID_FORMAT_TEXT1, text1Rect);
1648 __pItemFormat->SetElementEventEnabled(ID_FORMAT_TEXT1, false);
1653 __pItemFormat->AddElement(ID_FORMAT_IMAGE1, img1Rect);
1654 __pItemFormat->SetElementEventEnabled(ID_FORMAT_IMAGE1, false);
1657 if (text2Rect.x > 0)
1659 __pItemFormat->AddElement(ID_FORMAT_TEXT2, text2Rect);
1660 __pItemFormat->SetElementEventEnabled(ID_FORMAT_TEXT2, false);
1665 __pItemFormat->AddElement(ID_FORMAT_IMAGE2, img2Rect);
1666 __pItemFormat->SetElementEventEnabled(ID_FORMAT_IMAGE2, false);
1669 if (__listStyle == LIST_STYLE_NUMBER)
1671 __pItemFormat->AddElement(ID_FORMAT_NUMBER, Rectangle(listStyleNumberX, GetItemHeight()/2 - 15, listStyleNumberWidth, listStyleNumberHeight));
1672 __pItemFormat->SetElementEventEnabled(ID_FORMAT_NUMBER, false);
1675 if (_annexStyle != TABLE_VIEW_ANNEX_STYLE_NORMAL)
1677 __pItemFormat->AddElement(ID_FORMAT_CHECK, Rectangle(GetCore().GetBounds().width - 60, GetItemHeight()/2 - 25 , checkItemWidth , checkItemHeight));
1678 __pItemFormat->SetElementEventEnabled(ID_FORMAT_CHECK, true);
1681 int count = GetItemCount();
1682 result r = E_SUCCESS;
1684 for (int index = 0; index < count; index++)
1688 r = GetCore().RefreshTableView(0, index, TABLE_VIEW_REFRESH_TYPE_ITEM_MODIFY);
1689 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, E_SYSTEM, E_SYSTEM, "[%s] Propagating.",GetErrorMessage(r));
1692 ScrollToTop(currIndex);
1693 SetLastResult(E_SUCCESS);
1699 _ListImpl::SetBitmap(TableViewItemDrawingStatus itemStatus, const Bitmap& bitmap)
1701 _TableViewItemData* pItem = null;
1703 int groupIndex = -1;
1705 int bottomIndex = -1;
1707 GetTopDrawnItemIndex(groupIndex, topIndex);
1708 GetBottomDrawnItemIndex(groupIndex, bottomIndex);
1710 int count = GetItemCount();
1711 for (int itemIndex = 0; itemIndex < count; itemIndex++)
1713 pItem = GetTableViewItemAt(-1, itemIndex);
1714 SysTryReturnVoidResult(NID_UI_CTRL, pItem, E_SYSTEM,
1715 "[E_SYSTEM] A system error has occurred. _TableViewItemData instance is null.");
1717 pItem->SetBackgroundBitmap(&bitmap, itemStatus);
1718 if (itemIndex >= topIndex && itemIndex <= bottomIndex)
1720 pItem->Invalidate(true);
1726 _ListImpl::UpdateNumbers(int index)
1728 SysTryReturnResult(NID_UI_CTRL, __listStyle == LIST_STYLE_NUMBER, E_SYSTEM,
1729 "A system error has occurred. The current value of list style is invalid.");
1731 SysTryReturnResult(NID_UI_CTRL, __pNumberElements != null, E_SYSTEM,
1732 "A system error has occured. Failed to update numbers");
1734 _NumberElement* pNumberElement = null;
1735 int count = __pNumberElements->GetCount();
1737 for (int itemIndex = index + 1; itemIndex < count; itemIndex++)
1739 pNumberElement = dynamic_cast<_NumberElement*>(__pNumberElements->GetAt(itemIndex));
1740 SysTryReturnResult(NID_UI_CTRL, pNumberElement, E_SYSTEM,
1741 "A system error has occurred. Failed to get _NumberElement instance at index(%d).", index);
1742 pNumberElement->index = itemIndex + 1;
1744 CustomListItem* pCustomListItem = GetCustomListItemAt(-1, itemIndex);
1745 SysTryReturnResult(NID_UI_CTRL, pCustomListItem, E_SYSTEM,
1746 "A system error has occurred. Failed to get an item at index(%d).", itemIndex);
1748 pCustomListItem->SetElement(ID_FORMAT_NUMBER, *(dynamic_cast<ICustomListElement*>(pNumberElement)));
1755 _ListImpl::Refresh(int index)
1757 result r = E_SUCCESS;
1759 _TableViewItemUpdateParams updateParams;
1760 updateParams.pItem = GetCustomListItemAt(-1, index);
1761 updateParams.isDividerEnabled = _isDividerEnabled;
1762 updateParams.pCheckBitmaps = _pCheckBitmaps;
1763 updateParams.annexStyle = _annexStyle;
1765 r = _CustomListItemImpl::UpdateTableViewItem(updateParams);
1766 SysTryReturnResult(NID_UI_CTRL, (r == E_SUCCESS), E_SYSTEM,
1767 "A system error has occurred. Failed to refresh an item.");
1769 DrawItem(-1, index);
1775 _ListImpl::IsItemChecked(int groupIndex, int subIndex) const
1777 return IsItemChecked(subIndex);
1781 _ListImpl::SetItemChecked(int groupIndex, int itemIndex, bool check)
1783 return SetItemChecked(itemIndex, check);
1787 _ListImpl::OnTableViewItemStateChanged(Tizen::Ui::Controls::_TableView& tableView, int itemIndex, Tizen::Ui::Controls::_TableViewItem* pItem, Tizen::Ui::Controls::TableViewItemStatus status)
1789 ItemStatus itemStatus = ITEM_HIGHLIGHTED;
1793 case TABLE_VIEW_ITEM_STATUS_SELECTED:
1794 itemStatus = ITEM_SELECTED;
1796 case TABLE_VIEW_ITEM_STATUS_HIGHLIGHTED:
1797 itemStatus = ITEM_HIGHLIGHTED;
1799 case TABLE_VIEW_ITEM_STATUS_CHECKED:
1800 itemStatus = ITEM_CHECKED;
1802 case TABLE_VIEW_ITEM_STATUS_UNCHECKED:
1803 itemStatus = ITEM_UNCHECKED;
1806 SetLastResult(E_SYSTEM);
1810 if ((!_isDividerEnabled) && (_annexStyle != TABLE_VIEW_ANNEX_STYLE_NORMAL))
1812 bool isChecked = IsItemChecked(itemIndex);
1816 itemStatus = ITEM_UNCHECKED;
1820 itemStatus = ITEM_CHECKED;
1823 SetItemChecked(itemIndex, !isChecked);
1826 ProcessItemStateChange(-1, itemIndex, itemStatus);
1832 _ListImpl::OnTableViewItemReordered(Tizen::Ui::Controls::_TableView& tableView, int itemIndexFrom, int itemIndexTo)
1838 _ListImpl::OnTableViewContextItemActivationStateChanged(Tizen::Ui::Controls::_TableView& tableView, int itemIndex, Tizen::Ui::Controls::_TableViewItem* pContextItem, bool activated)
1844 _ListImpl::OnGroupedTableViewGroupItemStateChanged(Tizen::Ui::Controls::_TableView& tableView, int groupIndex, Tizen::Ui::Controls::_TableViewItem* pItem, Tizen::Ui::Controls::TableViewItemStatus status)
1850 _ListImpl::OnGroupedTableViewItemStateChanged(Tizen::Ui::Controls::_TableView& tableView, int groupIndex, int itemIndex, Tizen::Ui::Controls::_TableViewItem* pItem, Tizen::Ui::Controls::TableViewItemStatus status)
1856 _ListImpl::OnGroupedTableViewContextItemActivationStateChanged(Tizen::Ui::Controls::_TableView& tableView, int groupIndex, int itemIndex, Tizen::Ui::Controls::_TableViewItem* pContextItem, bool activated)
1862 _ListImpl::OnGroupedTableViewItemReordered(Tizen::Ui::Controls::_TableView& tableView, int groupIndexFrom, int itemIndexFrom, int groupIndexTo, int itemIndexTo)
1867 _ListImpl::OnSectionTableViewItemStateChanged(Tizen::Ui::Controls::_TableView& tableView, int sectionIndex, int itemIndex, Tizen::Ui::Controls::_TableViewItem* pItem, Tizen::Ui::Controls::TableViewItemStatus status)
1873 _ListImpl::OnTableViewItemSwept(Tizen::Ui::Controls::_TableView& tableView, int groupIndex, int itemIndex, Tizen::Ui::Controls::TableViewSweepDirection direction)
1879 _ListImpl::OnSectionTableViewContextItemActivationStateChanged(Tizen::Ui::Controls::_TableView& tableView, int sectionIndex, int itemIndex, Tizen::Ui::Controls::_TableViewItem* pContextItem, bool activated)
1885 _ListImpl::ProcessItemStateChange(int groupIndex, int itemIndex, ItemStatus itemStatus)
1887 int itemId = GetItemIdAt(itemIndex);
1889 _ListListener* pListenerList = null;
1890 IItemEventListener* pEventListener = null;
1892 int count = __itemListeners.GetCount();
1893 for (int listenerCount = 0; listenerCount < count; listenerCount++)
1895 pListenerList = dynamic_cast<_ListListener*>(__itemListeners.GetAt(listenerCount));
1896 SysTryReturnVoidResult(NID_UI_CTRL, (pListenerList != null), E_SYSTEM,
1897 "[E_SYSTEM] A system error has occurred. Failed to get Listener.");
1899 pEventListener = dynamic_cast<IItemEventListener*>(pListenerList->pListener);
1900 SysTryReturnVoidResult(NID_UI_CTRL, (pEventListener != null), E_SYSTEM,
1901 "[E_SYSTEM] A system error has occurred. Failed to get Listener.");
1903 pEventListener->OnItemStateChanged(GetPublic(), itemIndex, itemId, itemStatus);
1905 SetLastResult(E_SUCCESS);
1911 _ListImpl::ProcessItemStateChange(int groupIndex, int itemIndex, int elementId, ItemStatus itemStatus)
1913 int itemId = GetItemIdAt(itemIndex);
1915 _ListListener* pListenerList = null;
1916 IItemEventListener* pEventListener = null;
1918 int count = __itemListeners.GetCount();
1919 for (int listenerCount = 0; listenerCount < count; listenerCount++)
1921 pListenerList = dynamic_cast<_ListListener*>(__itemListeners.GetAt(listenerCount));
1922 SysTryReturnVoidResult(NID_UI_CTRL, (pListenerList != null), E_SYSTEM,
1923 "[E_SYSTEM] A system error has occurred. Failed to get Listener.");
1925 pEventListener = dynamic_cast<IItemEventListener*>(pListenerList->pListener);
1926 SysTryReturnVoidResult(NID_UI_CTRL, (pEventListener != null), E_SYSTEM,
1927 "[E_SYSTEM] A system error has occurred. Failed to get Listener.");
1929 pEventListener->OnItemStateChanged(GetPublic(), itemIndex, itemId, itemStatus);
1931 SetLastResult(E_SUCCESS);
1939 : public _UiBuilderControlMaker
1942 _ListMaker(_UiBuilder* uibuilder)
1943 : _UiBuilderControlMaker(uibuilder){};
1944 virtual ~_ListMaker(){};
1945 static _UiBuilderControlMaker*
1946 GetInstance(_UiBuilder* uibuilder)
1948 _ListMaker* pListMaker = new (std::nothrow) _ListMaker(uibuilder);
1953 Make(_UiBuilderControl* pControl)
1955 result r = E_SYSTEM;
1956 _UiBuilderControlLayout* pControlProperty = null;
1961 Tizen::Base::String elementString;
1962 int tempRow1Height = 0;
1963 int tempRow2Height = 0;
1964 int tempColumn1Width = 0;
1965 int tempColumn2Width = 0;
1967 ListStyle style = LIST_STYLE_NORMAL;
1968 ListItemFormat format = LIST_ITEM_SINGLE_TEXT;
1971 GetProperty(pControl, &pControlProperty);
1972 if (pControlProperty == null)
1977 pList = new (std::nothrow) List();
1983 rect = pControlProperty->GetRect();
1985 if (pControl->GetElement(L"ListItemFormat", elementString))
1987 if (elementString.Equals(L"LIST_ITEM_SINGLE_IMAGE", false))
1989 format = LIST_ITEM_SINGLE_IMAGE;
1991 else if (elementString.Equals(L"LIST_ITEM_SINGLE_TEXT", false))
1993 format = LIST_ITEM_SINGLE_TEXT;
1995 else if (elementString.Equals(L"LIST_ITEM_SINGLE_IMAGE_TEXT", false))
1997 format = LIST_ITEM_SINGLE_IMAGE_TEXT;
1999 else if (elementString.Equals(L"LIST_ITEM_SINGLE_TEXT_IMAGE", false))
2001 format = LIST_ITEM_SINGLE_TEXT_IMAGE;
2003 else if (elementString.Equals(L"LIST_ITEM_SINGLE_IMAGE_TEXT_IMAGE", false))
2005 format = LIST_ITEM_SINGLE_IMAGE_TEXT_IMAGE;
2007 else if (elementString.Equals(L"LIST_ITEM_DOUBLE_IMAGE_TEXT_FULLTEXT", false))
2009 format = LIST_ITEM_DOUBLE_IMAGE_TEXT_FULLTEXT;
2011 else if (elementString.Equals(L"LIST_ITEM_DOUBLE_FULLTEXT_IMAGE_TEXT", false))
2013 format = LIST_ITEM_DOUBLE_FULLTEXT_IMAGE_TEXT;
2015 else if (elementString.Equals(L"LIST_ITEM_DOUBLE_TEXT_IMAGE_FULLTEXT", false))
2017 format = LIST_ITEM_DOUBLE_TEXT_IMAGE_FULLTEXT;
2019 else if (elementString.Equals(L"LIST_ITEM_DOUBLE_FULLTEXT_TEXT_IMAGE", false))
2021 format = LIST_ITEM_DOUBLE_FULLTEXT_TEXT_IMAGE;
2023 else if (elementString.Equals(L"LIST_ITEM_DOUBLE_IMAGE_TEXT_TEXT", false))
2025 format = LIST_ITEM_DOUBLE_IMAGE_TEXT_TEXT;
2027 else if (elementString.Equals(L"LIST_ITEM_DOUBLE_TEXT_TEXT_IMAGE", false))
2029 format = LIST_ITEM_DOUBLE_TEXT_TEXT_IMAGE;
2033 format = LIST_ITEM_SINGLE_TEXT;
2037 if (pControl->GetElement(L"line1Height", elementString) || pControl->GetElement(L"row1Height", elementString))
2039 Base::Integer::Parse(elementString, tempRow1Height);
2042 if ((pControl->GetElement(L"line2Height", elementString) || pControl->GetElement(L"row2Height", elementString)) && (format > 4))
2044 Base::Integer::Parse(elementString,tempRow2Height);
2051 if (pControl->GetElement(L"column1Width", elementString))
2053 Base::Integer::Parse(elementString,tempColumn1Width);
2056 if ((pControl->GetElement(L"column2Width", elementString)) && (format > 1))
2058 Base::Integer::Parse(elementString,tempColumn2Width);
2062 tempColumn2Width = 0;
2065 Tizen::Base::String styleString;
2066 styleString = pControlProperty->GetStyle();
2068 if (styleString.Equals(L"LIST_STYLE_NORMAL", false))
2070 style = LIST_STYLE_NORMAL;
2072 else if (styleString.Equals(L"LIST_STYLE_NUMBER", false))
2074 style = LIST_STYLE_NUMBER;
2076 else if (styleString.Equals(L"LIST_STYLE_RADIO", false))
2078 style = LIST_STYLE_RADIO;
2080 else if (styleString.Equals(L"LIST_STYLE_RADIO_WITH_DIVIDER", false))
2082 style = LIST_STYLE_RADIO_WITH_DIVIDER;
2084 else if (styleString.Equals(L"LIST_STYLE_MARK_WITH_DIVIDER", false))
2086 style = LIST_STYLE_MARK_WITH_DIVIDER;
2088 else if (styleString.Equals(L"LIST_STYLE_ONOFF_WITH_DIVIDER", false))
2090 style = LIST_STYLE_ONOFF_WITH_DIVIDER;
2092 else if (styleString.Equals(L"LIST_STYLE_MARK", false))
2094 style = LIST_STYLE_MARK;
2096 else if (styleString.Equals(L"LIST_STYLE_ONOFF", false))
2098 style = LIST_STYLE_ONOFF;
2102 style = LIST_STYLE_NORMAL;
2105 if (tempRow1Height < 0 || tempRow1Height > ((Tizen::Ui::Control*) GetContainer())->GetBounds().height)
2107 tempRow1Height = ((Tizen::Ui::Control*) GetContainer())->GetBounds().height >> 2;
2109 if (tempRow2Height < 0 || tempRow2Height > ((Tizen::Ui::Control*) GetContainer())->GetBounds().height)
2111 tempRow2Height = ((Tizen::Ui::Control*) GetContainer())->GetBounds().height >> 2;
2113 if (tempColumn1Width < 0 || tempColumn1Width > ((Tizen::Ui::Control*) GetContainer())->GetBounds().width)
2115 tempColumn1Width = ((Tizen::Ui::Control*) GetContainer())->GetBounds().width >> 2;
2117 if (tempColumn2Width < 0 || tempColumn2Width > ((Tizen::Ui::Control*) GetContainer())->GetBounds().width)
2119 tempColumn2Width = ((Tizen::Ui::Control*) GetContainer())->GetBounds().width >> 2;
2122 r = pList->Construct(rect, style, format, tempRow1Height, tempRow2Height, tempColumn1Width, tempColumn2Width);
2129 if (pControl->GetElement(L"textOfEmptyList", elementString))
2131 pList->SetTextOfEmptyList(elementString);
2134 if (pControl->GetElement(L"colorOfEmptyListText", elementString))
2136 ConvertStringToColor(elementString, color);
2137 pList->SetTextColorOfEmptyList(color);
2140 GET_DIMENSION_CONFIG(LIST::LIST_MIN_SIZE, _CONTROL_ORIENTATION_PORTRAIT, dimMin);
2141 rectMin = (pControl->GetAttribute(0))->GetRect();
2142 (pControl->GetAttribute(0))->SetRect(rectMin.x, rectMin.y, dimMin.width, dimMin.height);
2144 GET_DIMENSION_CONFIG(LIST::LIST_MIN_SIZE, _CONTROL_ORIENTATION_LANDSCAPE, dimMin);
2145 rectMin = (pControl->GetAttribute(1))->GetRect();
2146 (pControl->GetAttribute(1))->SetRect(rectMin.x, rectMin.y, dimMin.width, dimMin.height);
2154 _ListRegister::_ListRegister()
2156 _UiBuilderControlTableManager* pUiBuilderControlTableManager = _UiBuilderControlTableManager::GetInstance();
2157 if (pUiBuilderControlTableManager)
2159 pUiBuilderControlTableManager->RegisterControl(L"List", _ListMaker::GetInstance);
2162 _ListRegister::~_ListRegister()
2164 _UiBuilderControlTableManager* pUiBuilderControlTableManager = _UiBuilderControlTableManager::GetInstance();
2165 if (pUiBuilderControlTableManager)
2167 pUiBuilderControlTableManager->UnregisterControl(L"List");
2171 static _ListRegister ListRegisterToUiBuilder;
2172 }}} // Tizen::Ui::Controls