2 // Open Service Platform
3 // Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
5 // Licensed under the Apache License, Version 2.0 (the License);
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
9 // http://www.apache.org/licenses/LICENSE-2.0/
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an "AS IS" BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
19 * @file FUiCtrl_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 r = GetCore().SetItemEnabled(0, index, enable);
738 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, E_SYSTEM, E_SYSTEM, "[%s] Propagating.", GetErrorMessage(r));
746 _ListImpl::IsItemEnabled(int index) const
748 return GetCore().IsItemEnabled(0, index);
752 _ListImpl::SetFocusedItemBackgroundBitmap(const Bitmap& bitmap)
754 __pFocusedBgBitmap = const_cast<Bitmap*>(&bitmap);
755 SysTryReturnVoidResult(NID_UI_CTRL, __pFocusedBgBitmap, E_SYSTEM,
756 "[E_SYSTEM] A system error has occurred. Failed to get the Bitmap");
757 SetBitmap(TABLE_VIEW_ITEM_DRAWING_STATUS_PRESSED, bitmap);
763 _ListImpl::SetHighlightedItemBackgroundBitmap(const Bitmap& bitmap)
765 __pHighlightedBgBitmap = const_cast<Bitmap*>(&bitmap);
766 SysTryReturnVoidResult(NID_UI_CTRL, __pHighlightedBgBitmap, E_SYSTEM,
767 "[E_SYSTEM] A system error has occurred. Failed to get the Bitmap");
768 SetBitmap(TABLE_VIEW_ITEM_DRAWING_STATUS_HIGHLIGHTED, bitmap);
774 _ListImpl::SetNormalItemBackgroundBitmap(const Bitmap& bitmap)
776 __pNormalBgBitmap = const_cast<Bitmap*>(&bitmap);
777 SysTryReturnVoidResult(NID_UI_CTRL, __pNormalBgBitmap, E_SYSTEM,
778 "[E_SYSTEM] A system error has occurred. Failed to get the Bitmap");
779 SetBitmap(TABLE_VIEW_ITEM_DRAWING_STATUS_NORMAL, bitmap);
785 _ListImpl::SetItemTextColor(ListItemText textIndex, const Color& textColor)
789 SysTryReturnVoidResult(NID_UI_CTRL, (__listItemFormat != LIST_ITEM_SINGLE_IMAGE), E_SYSTEM,
790 "[E_SYSTEM] A system error has occurred. The current value of ListItemFormat is invalid.");
794 case LIST_ITEM_TEXT1:
795 __text1Color.SetRGB32(textColor.GetRGB32(), textColor.GetAlpha());
796 elementId = ID_FORMAT_TEXT1;
799 case LIST_ITEM_TEXT2:
800 SysTryReturnVoidResult(NID_UI_CTRL, (__listItemFormat > LIST_ITEM_SINGLE_IMAGE_TEXT_IMAGE), E_SYSTEM,
801 "[E_SYSTEM] A system error has occurred. The current value of ListItemFormat is invalid.");
802 __text2Color.SetRGB32(textColor.GetRGB32(), textColor.GetAlpha());
803 elementId = ID_FORMAT_TEXT2;
807 SysTryReturnVoidResult(NID_UI_CTRL, (false), E_SYSTEM,
808 "[E_SYSTEM] A system error has occurred. The current value of ListItemText is invalid.");
816 GetElementRects(text1Rect, text2Rect, img1Rect, img2Rect);
820 case LIST_ITEM_TEXT1:
821 __pItemFormat->AddElement(elementId, text1Rect, 38, __text1Color, __text1Color, __text1Color);
824 case LIST_ITEM_TEXT2:
825 __pItemFormat->AddElement(elementId, text2Rect, 38, __text2Color, __text2Color, __text2Color);
829 int count = GetItemCount();
830 for (int index = 0; index < count; index++)
839 _ListImpl::GetItemTextColor(ListItemText textIndex) const
841 if (textIndex == LIST_ITEM_TEXT1)
845 else if(textIndex == LIST_ITEM_TEXT2)
851 SysLog(NID_UI_CTRL, "[E_SYSTEM] A system error has occurred. The current value of ListItemText is invalid.");
858 _ListImpl::EnableTextSlide(ListItemText textIndex)
863 case LIST_ITEM_TEXT1:
864 __text1SlideEnabled = true;
865 elementId = ID_FORMAT_TEXT1;
868 case LIST_ITEM_TEXT2:
869 __text2SlideEnabled = true;
870 elementId = ID_FORMAT_TEXT2;
876 SysTryReturnVoidResult(NID_UI_CTRL, (elementId != -1), E_SYSTEM,
877 "[E_SYSTEM] A system error has occurred. The ListItemText is invalid.");
879 int maxCount = GetItemCount();
881 for (int itemCount = 0; itemCount < maxCount; itemCount++)
883 CustomListItem* pItem = GetCustomListItemAt(-1, itemCount);
884 SysTryReturnVoidResult(NID_UI_CTRL, (pItem), E_SYSTEM,
885 "[E_SYSTEM] A system error has occurred. Failed to get item at %d.", itemCount);
887 _CustomListItemImpl *pItemImpl = pItem->__pCustomListItemImpl;
888 SysTryReturnVoidResult(NID_UI_CTRL, (pItemImpl), E_SYSTEM,
889 "[E_SYSTEM] A system error has occurred. Failed to get item at %d.", itemCount);
891 pItemImpl->SetTextSliding(elementId, true);
898 _ListImpl::DisableTextSlide(void)
900 __text1SlideEnabled = false;
901 __text2SlideEnabled = false;
903 int maxCount = GetItemCount();
905 for (int itemCount = 0; itemCount < maxCount; itemCount++)
907 CustomListItem* pItem = GetCustomListItemAt(-1, itemCount);
908 SysTryReturnVoidResult(NID_UI_CTRL, (pItem), E_SYSTEM,
909 "[E_SYSTEM] A system error has occurred. Failed to get item at %d.", itemCount);
911 _CustomListItemImpl *pItemImpl = pItem->__pCustomListItemImpl;
912 SysTryReturnVoidResult(NID_UI_CTRL, (pItemImpl), E_SYSTEM,
913 "[E_SYSTEM] A system error has occurred. Failed to get item at %d.", itemCount);
915 pItemImpl->SetTextSliding(ID_FORMAT_TEXT1, false);
916 pItemImpl->SetTextSliding(ID_FORMAT_TEXT2, false);
923 _ListImpl::GetItemHeight(void) const
925 if (__listItemFormat < LIST_ITEM_DOUBLE_IMAGE_TEXT_FULLTEXT)
930 return __row1Height + __row2Height;
934 _ListImpl::GetRow1Height(void) const
940 _ListImpl::GetRow2Height(void) const
946 _ListImpl::GetColumn1Width(void) const
948 return __column1Width;
952 _ListImpl::GetColumn2Width(void) const
954 return __column2Width;
958 _ListImpl::SetRow1Height(int row1Height)
960 __row1Height = row1Height;
961 if (GetCore().GetFirstDrawnFlag() == false)
970 _ListImpl::SetRow2Height(int row2Height)
972 if (__listItemFormat < LIST_ITEM_DOUBLE_IMAGE_TEXT_FULLTEXT)
978 __row2Height = row2Height;
979 if (GetCore().GetFirstDrawnFlag() == false)
989 _ListImpl::SetColumn1Width(int column1Width)
991 __column1Width = column1Width;
992 if (GetCore().GetFirstDrawnFlag() == false)
1001 _ListImpl::SetColumn2Width(int column2Width)
1003 __column2Width = column2Width;
1004 if (GetCore().GetFirstDrawnFlag() == false)
1006 return ReDrawList();
1014 _ListImpl::SetItemChecked(int index, bool check)
1016 SysTryReturnResult(NID_UI_CTRL, (index >= 0 && index < GetItemCount()), E_SYSTEM,
1017 "A system error has occurred. The current value of index(%d) is invalid.", index);
1019 SysTryReturnResult(NID_UI_CTRL, (__listStyle != LIST_STYLE_NORMAL), E_SYSTEM,
1020 "A system error has occurred. List style should not be LIST_STYLE_NORMAL");
1021 SysTryReturnResult(NID_UI_CTRL, (__listStyle != LIST_STYLE_NUMBER), E_SYSTEM,
1022 "A system error has occurred. List style should not be LIST_STYLE_NUMBER");
1024 if (IsItemChecked(index) == check)
1029 SysTryReturnResult(NID_UI_CTRL, (IsItemEnabled(index)), E_SYSTEM,
1030 "A system error has occurred. The List item is not enabled at index(%d).", index);
1032 _CheckElementModel* pCheckElementModel = GetCheckElementAt(-1, index);
1033 SysTryReturnResult(NID_UI_CTRL, pCheckElementModel, E_SYSTEM,
1034 "A system error has occurred. _CheckElementModel instance is null.");
1036 if (_annexStyle == TABLE_VIEW_ANNEX_STYLE_RADIO)
1040 if (_currentRadioIndex != -1)
1042 _CheckElementModel* pOldCheckElementModel = GetCheckElementAt(-1, _currentRadioIndex);
1043 SysTryReturnResult(NID_UI_CTRL, pOldCheckElementModel, E_SYSTEM,
1044 "A system error has occurred. _CheckElementModel instance is null.");
1046 pOldCheckElementModel->SetCheckBoxStatus(CHECK_BOX_UNCHECKED);
1047 DrawItem(-1, _currentRadioIndex);
1049 _currentRadioIndex = index;
1053 _currentRadioIndex = -1;
1057 pCheckElementModel->SetCheckBoxStatus((_CheckBoxBitmapType)check);
1059 DrawItem(-1, index);
1065 _ListImpl::IsItemChecked(int index) const
1067 SysTryReturn(NID_UI_CTRL, (__listStyle != LIST_STYLE_NORMAL), false, E_SYSTEM,
1068 "[E_SYSTEM] A system error has occurred. List style should not be LIST_STYLE_NORMAL.");
1069 SysTryReturn(NID_UI_CTRL, (__listStyle != LIST_STYLE_NUMBER), false, E_SYSTEM,
1070 "[E_SYSTEM] A system error has occurred. List style should not be LIST_STYLE_NUMBER.");
1072 SysTryReturn(NID_UI_CTRL, (index >= 0 && index < GetItemCount()),
1073 false, E_INVALID_ARG, "[E_INVALID_ARG] The current value of index(%d) is invalid.", index);
1075 const _CheckElementModel* pCheckElement = GetCheckElementAt(-1, index);
1076 SysTryReturn(NID_UI_CTRL, pCheckElement, false, E_SYSTEM, "[E_SYSTEM] A system error has occurred. CheckElement is not constructed properly.");
1078 return (bool)pCheckElement->GetCheckBoxStatus();
1082 _ListImpl::SetAllItemsChecked(bool check)
1084 SysTryReturnResult(NID_UI_CTRL, (__listStyle != LIST_STYLE_NORMAL), E_SYSTEM,
1085 "A system error has occurred. List style should not be LIST_STYLE_NORMAL");
1086 SysTryReturnResult(NID_UI_CTRL, (__listStyle != LIST_STYLE_NUMBER), E_SYSTEM,
1087 "A system error has occurred. List style should not be LIST_STYLE_NUMBER");
1088 SysTryReturnResult(NID_UI_CTRL, (__listStyle != LIST_STYLE_RADIO), E_SYSTEM,
1089 "A system error has occurred. List style should not be LIST_STYLE_RADIO");
1090 SysTryReturnResult(NID_UI_CTRL, (__listStyle != LIST_STYLE_RADIO_WITH_DIVIDER), E_SYSTEM,
1091 "A system error has occurred. List style should not be LIST_STYLE_RADIO_WITH_DIVIDER");
1093 _CheckElementModel* pCheckElement = null;
1095 for (int index = 0; index < GetItemCount(); index++)
1097 if (IsItemEnabled(index))
1099 pCheckElement = GetCheckElementAt(-1, index);
1100 SysTryReturnResult(NID_UI_CTRL, (pCheckElement != null), E_SYSTEM,
1101 "A system error has occurred. _CheckElementModel instance is null.");
1103 pCheckElement->SetCheckBoxStatus((_CheckBoxBitmapType)check);
1113 _ListImpl::RemoveAllCheckedItems(void)
1115 SysTryReturnResult(NID_UI_CTRL, (__listStyle != LIST_STYLE_NORMAL), E_SYSTEM,
1116 "A system error has occurred. List style should not be LIST_STYLE_NORMAL");
1117 SysTryReturnResult(NID_UI_CTRL, (__listStyle != LIST_STYLE_NUMBER), E_SYSTEM,
1118 "A system error has occurred. List style should not be LIST_STYLE_NUMBER");
1119 SysTryReturnResult(NID_UI_CTRL, (__listStyle != LIST_STYLE_RADIO), E_SYSTEM,
1120 "A system error has occurred. List style should not be LIST_STYLE_RADIO");
1121 SysTryReturnResult(NID_UI_CTRL, (__listStyle != LIST_STYLE_RADIO_WITH_DIVIDER), E_SYSTEM,
1122 "A system error has occurred. List style should not be LIST_STYLE_RADIO_WITH_DIVIDER");
1124 result r = E_SUCCESS;
1125 result finalResult = E_SUCCESS;
1127 for (int index = GetItemCount() -1; index >= 0; index--)
1129 if (IsItemChecked(index))
1131 r = RemoveItemAt(index);
1136 SysLog(NID_UI_CTRL, "[%s] Item at index(%d) is not removed successfully.", GetErrorMessage(r), index);
1145 _ListImpl::GetFirstCheckedItemIndex(void) const
1147 SysTryReturn(NID_UI_CTRL, (__listStyle != LIST_STYLE_NORMAL), INVALID_INDEX, E_SYSTEM,
1148 "[E_SYSTEM] A system error has occurred. List style should not be LIST_STYLE_NORMAL.");
1149 SysTryReturn(NID_UI_CTRL, (__listStyle != LIST_STYLE_NUMBER), INVALID_INDEX, E_SYSTEM,
1150 "[E_SYSTEM] A system error has occurred. List style should not be LIST_STYLE_NUMBER.");
1152 for (int index = 0; index < GetItemCount(); index++)
1154 if (IsItemChecked(index))
1156 SetLastResult(E_SUCCESS);
1160 SetLastResult(E_SUCCESS);
1161 return INVALID_INDEX;
1165 _ListImpl::GetLastCheckedItemIndex(void) const
1167 SysTryReturn(NID_UI_CTRL, (__listStyle != LIST_STYLE_NORMAL), INVALID_INDEX, E_SYSTEM,
1168 "[E_SYSTEM] A system error has occurred. List style should not be LIST_STYLE_NORMAL.");
1169 SysTryReturn(NID_UI_CTRL, (__listStyle != LIST_STYLE_NUMBER), INVALID_INDEX, E_SYSTEM,
1170 "[E_SYSTEM] A system error has occurred. List style should not be LIST_STYLE_NUMBER.");
1172 for (int index = GetItemCount() - 1; index >= 0; index--)
1174 if (IsItemChecked(index))
1176 SetLastResult(E_SUCCESS);
1180 SetLastResult(E_SUCCESS);
1182 return INVALID_INDEX;
1186 _ListImpl::GetNextCheckedItemIndexAfter(int index) const
1188 SysTryReturn(NID_UI_CTRL, (__listStyle != LIST_STYLE_NORMAL), INVALID_INDEX, E_SYSTEM,
1189 "[E_SYSTEM] A system error has occurred. List style should not be LIST_STYLE_NORMAL.");
1190 SysTryReturn(NID_UI_CTRL, (__listStyle != LIST_STYLE_NUMBER), INVALID_INDEX, E_SYSTEM,
1191 "[E_SYSTEM] A system error has occurred. List style should not be LIST_STYLE_NUMBER.");
1193 SysTryReturn(NID_UI_CTRL, (index >= 0 && index < GetItemCount()), INVALID_INDEX, E_SYSTEM,
1194 "[E_SYSTEM] A system error has occurred. The current value of index(%d) is invalid.") ;
1196 for (int itemCount = index + 1; itemCount < GetItemCount(); itemCount++)
1198 if (IsItemChecked(itemCount))
1200 SetLastResult(E_SUCCESS);
1204 SetLastResult(E_SUCCESS);
1206 return INVALID_INDEX;
1210 _ListImpl::GetItemIndexFromItemId(int itemId) const
1212 for (int index = 0; index < GetItemCount(); index++)
1214 const CustomListItem* pCustomListItem = GetCustomListItemAt(-1, index);
1215 SysTryReturn(NID_UI_CTRL, pCustomListItem, INVALID_INDEX, E_SYSTEM,
1216 "[E_SYSTEM] A system error has occurred. Failed to get an item at index(%d).", index);
1218 if (pCustomListItem->__pCustomListItemImpl->itemId == itemId)
1220 SetLastResult(E_SUCCESS);
1225 SetLastResult(E_SUCCESS);
1227 return INVALID_INDEX;
1231 _ListImpl::GetItemIdAt(int index) const
1233 SysTryReturn(NID_UI_CTRL, (index >= 0 && index < GetItemCount()),
1234 -1, E_INVALID_ARG, "[E_INVALID_ARG] The current value of index(%d) is invalid.", index);
1236 const CustomListItem* pCustomListItem = GetCustomListItemAt(-1, index);
1237 SysTryReturn(NID_UI_CTRL, pCustomListItem, -1, E_SYSTEM, "[E_SYSTEM] A system error has occurred. Failed to get an item at index(%d).", index);
1239 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);
1241 SetLastResult(E_SUCCESS);
1242 return pCustomListItem->__pCustomListItemImpl->itemId;
1246 _ListImpl::ScrollToBottom(void)
1248 result r = E_SUCCESS;
1250 GetCore().SetBottomDrawnItemIndex(0, GetItemCount() - 1);
1251 SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
1253 SetLastResult(E_SUCCESS);
1260 _ListImpl::ScrollToTop(void)
1262 result r = E_SUCCESS;
1263 r = GetCore().SetTopDrawnItemIndex(0,0);
1264 SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
1266 SetLastResult(E_SUCCESS);
1273 _ListImpl::ScrollToTop(int index)
1275 SysTryReturnResult(NID_UI_CTRL, (index >= 0 && index < GetItemCount()), E_INVALID_ARG, "The current value of index(%d) is invalid.", index);
1277 result r = GetCore().SetTopDrawnItemIndex(0, index);
1278 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, E_SYSTEM, E_SYSTEM, "[%s] Propagating.", GetErrorMessage(r));
1286 _ListImpl::RefreshItem(int index)
1288 SysTryReturnResult(NID_UI_CTRL, (index >= 0 && index < GetItemCount()), E_INVALID_ARG, "The current value of index(%d) is invalid.", index);
1290 int topItemIndex = -1;
1291 int bottomItemIndex = -1;
1292 int groupIndex = -1;
1294 GetCore().GetTopDrawnItemIndex(groupIndex, topItemIndex);
1295 GetCore().GetBottomDrawnItemIndex(groupIndex, bottomItemIndex);
1297 SysTryReturnResult(NID_UI_CTRL, (index >= topItemIndex && index <= bottomItemIndex), E_INVALID_OPERATION,
1298 "Index(%d) should be within drawn item range.", index);
1300 result r = E_SUCCESS;
1302 _TableViewItemUpdateParams updateParams;
1303 updateParams.pItem = GetCustomListItemAt(-1, index);
1304 updateParams.isDividerEnabled = _isDividerEnabled;
1305 updateParams.pCheckBitmaps = _pCheckBitmaps;
1306 updateParams.annexStyle = _annexStyle;
1308 r = _CustomListItemImpl::UpdateTableViewItem(updateParams);
1309 SysTryReturnResult(NID_UI_CTRL, (r == E_SUCCESS), E_SYSTEM,
1310 "A system error has occurred. Failed to refresh an item.");
1312 DrawItem(-1, index);
1318 _ListImpl::GetNewItemN(const String* pText1, const String* pText2, const Bitmap* pBitmap1, const Bitmap* pBitmap2, int itemId, int index)
1320 SysTryReturn(NID_UI_CTRL, __pItemFormat, null, E_SYSTEM,
1321 "[E_SYSTEM] A system error has occurred. Item Format must not be null.");
1322 Dimension listSize = GetCore().GetSize();
1323 Rectangle text1Rect;
1324 Rectangle text2Rect;
1328 GetElementRects(text1Rect, text2Rect, img1Rect, img2Rect);
1330 CustomListItem* pItem = new (std::nothrow) CustomListItem();
1331 SysTryReturn(NID_UI_CTRL, pItem, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
1333 pItem->Construct(GetItemHeight());
1334 pItem->SetItemFormat(*__pItemFormat);
1335 pItem->__pCustomListItemImpl->itemId = itemId;
1337 if ((pText1 != null) && (text1Rect.x > 0))
1339 pItem->SetElement(ID_FORMAT_TEXT1, *pText1);
1340 pItem->__pCustomListItemImpl->SetTextSliding(ID_FORMAT_TEXT1, __text1SlideEnabled);
1343 if ((pBitmap1 != null) && (img1Rect.x > 0))
1345 pItem->SetElement(ID_FORMAT_IMAGE1, *pBitmap1, pBitmap1);
1348 if ((pText2 != null) && (text2Rect.x > 0))
1350 pItem->SetElement(ID_FORMAT_TEXT2, *pText2);
1351 pItem->__pCustomListItemImpl->SetTextSliding(ID_FORMAT_TEXT2, __text2SlideEnabled);
1354 if ((pBitmap2 != null) && (img2Rect.x > 0))
1356 pItem->SetElement(ID_FORMAT_IMAGE2, *pBitmap2, pBitmap2);
1359 _NumberElement *pNumberElement = null;
1361 if (__listStyle == LIST_STYLE_NUMBER)
1363 pNumberElement = new (std::nothrow) _NumberElement();
1364 SysTryReturn(NID_UI_CTRL, pNumberElement, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
1365 pNumberElement->index = index + 1;
1366 __pNumberElements->InsertAt(*pNumberElement, index);
1367 pItem->SetElement(ID_FORMAT_NUMBER, *(dynamic_cast<ICustomListElement*>(pNumberElement)));
1370 if (_annexStyle != TABLE_VIEW_ANNEX_STYLE_NORMAL)
1372 pItem->SetCheckBox(ID_FORMAT_CHECK);
1379 _ListImpl::GetItemMargins(int& leftMargin, int& numberStyleMargin, int& dividerMargin, int& lowerMargin, int& upperMargin)
1381 if (__listStyle == LIST_STYLE_NUMBER)
1383 GET_SHAPE_CONFIG(LIST::LIST_ITEM_NUMBER_STYLE_MARGIN, GetCore().GetOrientation(), numberStyleMargin);
1388 GET_SHAPE_CONFIG(LIST::LIST_ITEM_DIVIDER_MARGIN, GetCore().GetOrientation(), dividerMargin);
1391 GET_SHAPE_CONFIG(LIST::LIST_ITEM_LEFT_MARGIN, GetCore().GetOrientation(), leftMargin);
1392 GET_SHAPE_CONFIG(LIST::LIST_ITEM_LOWER_MARGIN, GetCore().GetOrientation(), lowerMargin);
1393 GET_SHAPE_CONFIG(LIST::LIST_ITEM_UPPER_MARGIN, GetCore().GetOrientation(), upperMargin);
1397 _ListImpl::GetElementRects(Rectangle& text1Rect, Rectangle& text2Rect, Rectangle& img1Rect, Rectangle& img2Rect)
1399 Dimension listSize = GetCore().GetSize();
1402 int numberStyleMargin = 0;
1403 int dividerMargin = 0;
1404 int lowerMargin = 0;
1405 int upperMargin = 0;
1407 GetItemMargins(leftMargin, numberStyleMargin, dividerMargin, lowerMargin, upperMargin);
1409 switch (__listItemFormat)
1411 case LIST_ITEM_SINGLE_IMAGE:
1413 img1Rect.x = leftMargin + numberStyleMargin;
1414 img1Rect.y = upperMargin;
1415 img1Rect.width = __column1Width - dividerMargin;
1416 img1Rect.height = __row1Height - lowerMargin;
1420 case LIST_ITEM_SINGLE_TEXT:
1422 text1Rect.x = leftMargin + numberStyleMargin;
1423 text1Rect.y = upperMargin;
1424 text1Rect.width = __column1Width - dividerMargin - text1Rect.x;
1425 text1Rect.height = __row1Height - lowerMargin;
1429 case LIST_ITEM_SINGLE_IMAGE_TEXT:
1431 img1Rect.x = leftMargin + numberStyleMargin;
1432 img1Rect.y = upperMargin;
1433 img1Rect.width = __column1Width;
1434 img1Rect.height = __row1Height - lowerMargin;
1436 text1Rect.x = __column1Width + leftMargin + numberStyleMargin;
1437 text1Rect.y = upperMargin;
1438 text1Rect.width = (__column1Width + __column2Width + dividerMargin <= listSize.width) ? (__column2Width) : (__column2Width - dividerMargin);
1439 text1Rect.height = __row1Height - lowerMargin;
1443 case LIST_ITEM_SINGLE_TEXT_IMAGE:
1445 img1Rect.x = __column1Width + leftMargin + numberStyleMargin;
1446 img1Rect.y = upperMargin;
1447 img1Rect.width = __column1Width;
1448 img1Rect.height = __row1Height - lowerMargin;
1450 text1Rect.x = leftMargin + numberStyleMargin;
1451 text1Rect.y = upperMargin;
1452 text1Rect.width = (__column1Width + __column2Width + dividerMargin <= listSize.width) ? (__column2Width) : (__column2Width - dividerMargin);
1453 text1Rect.height = __row1Height - lowerMargin;
1457 case LIST_ITEM_SINGLE_IMAGE_TEXT_IMAGE:
1459 img1Rect.x = leftMargin + numberStyleMargin;
1460 img1Rect.y = upperMargin;
1461 img1Rect.width = __column1Width;
1462 img1Rect.height = __row1Height - lowerMargin;
1464 text1Rect.x = __column1Width + leftMargin + numberStyleMargin;
1465 text1Rect.y = upperMargin;
1466 text1Rect.width = __column2Width;
1467 text1Rect.height = __row1Height - lowerMargin;
1469 img2Rect.x = text1Rect.x + __column2Width;
1470 img2Rect.y = upperMargin;
1471 img2Rect.width = (__column1Width + __column2Width + dividerMargin <= listSize.width) ? (__column2Width) : (__column2Width - dividerMargin);
1472 img2Rect.height = __row1Height - lowerMargin;
1476 case LIST_ITEM_DOUBLE_IMAGE_TEXT_FULLTEXT:
1478 img1Rect.x = leftMargin + numberStyleMargin;
1479 img1Rect.y = upperMargin;
1480 img1Rect.width = __column1Width;
1481 img1Rect.height = __row1Height - lowerMargin;
1483 text1Rect.x = __column1Width + leftMargin + numberStyleMargin;
1484 text1Rect.y = upperMargin;
1485 text1Rect.width = (__column1Width + __column2Width + dividerMargin <= listSize.width) ? (__column2Width) : (__column2Width - dividerMargin);
1486 text1Rect.height = __row1Height - lowerMargin;
1488 text2Rect.x = leftMargin + numberStyleMargin;
1489 text2Rect.y = __row1Height;
1490 text2Rect.width = __column1Width;
1491 text2Rect.height = __row2Height - lowerMargin;
1495 case LIST_ITEM_DOUBLE_FULLTEXT_IMAGE_TEXT:
1497 img1Rect.x = leftMargin + numberStyleMargin;
1498 img1Rect.y = __row1Height;
1499 img1Rect.width = __column1Width;
1500 img1Rect.height = __row2Height;
1502 text1Rect.x = __column1Width + leftMargin + numberStyleMargin;
1503 text1Rect.y = __row1Height;
1504 text1Rect.width = (__column1Width + __column2Width + dividerMargin <= listSize.width) ? (__column2Width) : (__column2Width - dividerMargin);
1505 text1Rect.height = __row2Height;
1507 text2Rect.x = leftMargin + numberStyleMargin;
1508 text2Rect.y = upperMargin;
1509 text2Rect.width = __column1Width;
1510 text2Rect.height = __row1Height - lowerMargin;
1514 case LIST_ITEM_DOUBLE_TEXT_IMAGE_FULLTEXT:
1516 img1Rect.x = __column1Width + leftMargin + numberStyleMargin;
1517 img1Rect.y = upperMargin;
1518 img1Rect.width = (__column1Width + __column2Width + dividerMargin <= listSize.width) ? (__column2Width) : (__column2Width - dividerMargin);
1519 img1Rect.height = __row1Height - lowerMargin;
1521 text1Rect.x = leftMargin + numberStyleMargin;
1522 text1Rect.y = upperMargin;
1523 text1Rect.width = __column1Width;
1524 text1Rect.height = __row1Height - lowerMargin;
1526 text2Rect.x = leftMargin + numberStyleMargin;
1527 text2Rect.y = __row1Height;
1528 text2Rect.width = __column1Width;
1529 text2Rect.height = __row2Height;
1533 case LIST_ITEM_DOUBLE_FULLTEXT_TEXT_IMAGE:
1535 img1Rect.x = __column1Width + leftMargin + numberStyleMargin;
1536 img1Rect.y = __row1Height;
1537 img1Rect.width = (__column1Width + __column2Width + dividerMargin <= listSize.width) ? (__column2Width) : (__column2Width - dividerMargin);
1538 img1Rect.height = __row2Height;
1540 text1Rect.x = leftMargin + numberStyleMargin;
1541 text1Rect.y = __row1Height;
1542 text1Rect.width = __column1Width;
1543 text1Rect.height = __row2Height;
1545 text2Rect.x = leftMargin + numberStyleMargin;
1546 text2Rect.y = upperMargin;
1547 text2Rect.width = __column1Width;
1548 text2Rect.height = __row1Height - lowerMargin;
1552 case LIST_ITEM_DOUBLE_IMAGE_TEXT_TEXT:
1554 img1Rect.x = leftMargin + numberStyleMargin;
1555 img1Rect.y = upperMargin;
1556 img1Rect.width = __column1Width;
1557 img1Rect.height = __row1Height + __row2Height - lowerMargin;
1559 text1Rect.x = __column1Width + leftMargin + numberStyleMargin;
1560 text1Rect.y = upperMargin;
1561 text1Rect.width = (__column1Width + __column2Width + dividerMargin <= listSize.width) ? (__column2Width) : (__column2Width - dividerMargin);
1562 text1Rect.height = __row1Height - lowerMargin;
1564 text2Rect.x = __column1Width + leftMargin + numberStyleMargin;
1565 text2Rect.y = __row1Height;
1566 text2Rect.width = (__column1Width + __column2Width + dividerMargin <= listSize.width) ? (__column2Width) : (__column2Width - dividerMargin);
1567 text2Rect.height = __row2Height;
1571 case LIST_ITEM_DOUBLE_TEXT_TEXT_IMAGE:
1573 img1Rect.x = __column1Width + leftMargin + numberStyleMargin;
1574 img1Rect.y = upperMargin;
1575 img1Rect.width = (__column1Width + __column2Width + dividerMargin <= listSize.width) ? (__column2Width) : (__column2Width - dividerMargin);
1576 img1Rect.height = __row1Height + __row2Height - lowerMargin;
1578 text1Rect.x = leftMargin + numberStyleMargin;
1579 text1Rect.y = upperMargin;
1580 text1Rect.width = __column1Width;
1581 text1Rect.height = __row2Height - lowerMargin;
1583 text2Rect.x = leftMargin + numberStyleMargin;
1584 text2Rect.y = __row1Height;
1585 text2Rect.width = __column1Width;
1586 text2Rect.height = __row1Height;
1593 _ListImpl::ReDrawList(void)
1595 Rectangle text1Rect;
1596 Rectangle text2Rect;
1599 int groupIndex = -1;
1602 GetTopDrawnItemIndex(groupIndex, currIndex);
1604 GetElementRects(text1Rect, text2Rect, img1Rect, img2Rect);
1607 int listStyleNumberX = 0;
1608 int listStyleNumberWidth = 0;
1609 int listStyleNumberHeight = 0;
1610 int checkItemWidth = 0;
1611 int checkItemHeight = 0;
1613 GET_SHAPE_CONFIG(LIST::LIST_ITEM_TEXT_SIZE, GetCore().GetOrientation(), textSize);
1615 GET_SHAPE_CONFIG(LIST::LIST_STYLE_NUMBER_X, GetCore().GetOrientation(), listStyleNumberX);
1616 GET_SHAPE_CONFIG(LIST::LIST_STYLE_NUMBER_WIDTH, GetCore().GetOrientation(), listStyleNumberWidth);
1617 GET_SHAPE_CONFIG(LIST::LIST_STYLE_NUMBER_HEIGHT, GetCore().GetOrientation(), listStyleNumberHeight);
1619 GET_SHAPE_CONFIG(LIST::LIST_CHECK_ITEM_WIDTH, GetCore().GetOrientation(), checkItemWidth);
1620 GET_SHAPE_CONFIG(LIST::LIST_CHECK_ITEM_HEIGHT, GetCore().GetOrientation(), checkItemHeight);
1622 if (text1Rect.x > 0)
1624 __pItemFormat->AddElement(ID_FORMAT_TEXT1, text1Rect);
1625 __pItemFormat->SetElementEventEnabled(ID_FORMAT_TEXT1, false);
1630 __pItemFormat->AddElement(ID_FORMAT_IMAGE1, img1Rect);
1631 __pItemFormat->SetElementEventEnabled(ID_FORMAT_IMAGE1, false);
1634 if (text2Rect.x > 0)
1636 __pItemFormat->AddElement(ID_FORMAT_TEXT2, text2Rect);
1637 __pItemFormat->SetElementEventEnabled(ID_FORMAT_TEXT2, false);
1642 __pItemFormat->AddElement(ID_FORMAT_IMAGE2, img2Rect);
1643 __pItemFormat->SetElementEventEnabled(ID_FORMAT_IMAGE2, false);
1646 if (__listStyle == LIST_STYLE_NUMBER)
1648 __pItemFormat->AddElement(ID_FORMAT_NUMBER, Rectangle(listStyleNumberX, GetItemHeight()/2 - 15, listStyleNumberWidth, listStyleNumberHeight));
1649 __pItemFormat->SetElementEventEnabled(ID_FORMAT_NUMBER, false);
1652 if (_annexStyle != TABLE_VIEW_ANNEX_STYLE_NORMAL)
1654 __pItemFormat->AddElement(ID_FORMAT_CHECK, Rectangle(GetCore().GetBounds().width - 60, GetItemHeight()/2 - 25 , checkItemWidth , checkItemHeight));
1655 __pItemFormat->SetElementEventEnabled(ID_FORMAT_CHECK, true);
1658 int count = GetItemCount();
1659 result r = E_SUCCESS;
1661 for (int index = 0; index < count; index++)
1665 r = GetCore().RefreshTableView(0, index, TABLE_VIEW_REFRESH_TYPE_ITEM_MODIFY);
1666 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, E_SYSTEM, E_SYSTEM, "[%s] Propagating.",GetErrorMessage(r));
1669 ScrollToTop(currIndex);
1670 SetLastResult(E_SUCCESS);
1676 _ListImpl::SetBitmap(TableViewItemDrawingStatus itemStatus, const Bitmap& bitmap)
1678 _TableViewItemData* pItem = null;
1680 int groupIndex = -1;
1682 int bottomIndex = -1;
1684 GetTopDrawnItemIndex(groupIndex, topIndex);
1685 GetBottomDrawnItemIndex(groupIndex, bottomIndex);
1687 int count = GetItemCount();
1688 for (int itemIndex = 0; itemIndex < count; itemIndex++)
1690 pItem = GetTableViewItemAt(-1, itemIndex);
1691 SysTryReturnVoidResult(NID_UI_CTRL, pItem, E_SYSTEM,
1692 "[E_SYSTEM] A system error has occurred. _TableViewItemData instance is null.");
1694 pItem->SetBackgroundBitmap(&bitmap, itemStatus);
1695 if (itemIndex >= topIndex && itemIndex <= bottomIndex)
1697 pItem->Invalidate(true);
1703 _ListImpl::UpdateNumbers(int index)
1705 SysTryReturnResult(NID_UI_CTRL, __listStyle == LIST_STYLE_NUMBER, E_SYSTEM,
1706 "A system error has occurred. The current value of list style is invalid.");
1708 SysTryReturnResult(NID_UI_CTRL, __pNumberElements != null, E_SYSTEM,
1709 "A system error has occured. Failed to update numbers");
1711 _NumberElement* pNumberElement = null;
1712 int count = __pNumberElements->GetCount();
1714 for (int itemIndex = index + 1; itemIndex < count; itemIndex++)
1716 pNumberElement = dynamic_cast<_NumberElement*>(__pNumberElements->GetAt(itemIndex));
1717 SysTryReturnResult(NID_UI_CTRL, pNumberElement, E_SYSTEM,
1718 "A system error has occurred. Failed to get _NumberElement instance at index(%d).", index);
1719 pNumberElement->index = itemIndex + 1;
1721 CustomListItem* pCustomListItem = GetCustomListItemAt(-1, itemIndex);
1722 SysTryReturnResult(NID_UI_CTRL, pCustomListItem, E_SYSTEM,
1723 "A system error has occurred. Failed to get an item at index(%d).", itemIndex);
1725 pCustomListItem->SetElement(ID_FORMAT_NUMBER, *(dynamic_cast<ICustomListElement*>(pNumberElement)));
1732 _ListImpl::Refresh(int index)
1734 result r = E_SUCCESS;
1736 _TableViewItemUpdateParams updateParams;
1737 updateParams.pItem = GetCustomListItemAt(-1, index);
1738 updateParams.isDividerEnabled = _isDividerEnabled;
1739 updateParams.pCheckBitmaps = _pCheckBitmaps;
1740 updateParams.annexStyle = _annexStyle;
1742 r = _CustomListItemImpl::UpdateTableViewItem(updateParams);
1743 SysTryReturnResult(NID_UI_CTRL, (r == E_SUCCESS), E_SYSTEM,
1744 "A system error has occurred. Failed to refresh an item.");
1746 DrawItem(-1, index);
1752 _ListImpl::IsItemChecked(int groupIndex, int subIndex) const
1754 return IsItemChecked(subIndex);
1758 _ListImpl::SetItemChecked(int groupIndex, int itemIndex, bool check)
1760 return SetItemChecked(itemIndex, check);
1764 _ListImpl::OnTableViewItemStateChanged(Tizen::Ui::Controls::_TableView& tableView, int itemIndex, Tizen::Ui::Controls::_TableViewItem* pItem, Tizen::Ui::Controls::TableViewItemStatus status)
1766 ItemStatus itemStatus = ITEM_HIGHLIGHTED;
1770 case TABLE_VIEW_ITEM_STATUS_SELECTED:
1771 itemStatus = ITEM_SELECTED;
1773 case TABLE_VIEW_ITEM_STATUS_HIGHLIGHTED:
1774 itemStatus = ITEM_HIGHLIGHTED;
1776 case TABLE_VIEW_ITEM_STATUS_CHECKED:
1777 itemStatus = ITEM_CHECKED;
1779 case TABLE_VIEW_ITEM_STATUS_UNCHECKED:
1780 itemStatus = ITEM_UNCHECKED;
1783 SetLastResult(E_SYSTEM);
1787 if ((!_isDividerEnabled) && (_annexStyle != TABLE_VIEW_ANNEX_STYLE_NORMAL))
1789 bool isChecked = IsItemChecked(itemIndex);
1793 itemStatus = ITEM_UNCHECKED;
1797 itemStatus = ITEM_CHECKED;
1800 SetItemChecked(itemIndex, !isChecked);
1803 ProcessItemStateChange(-1, itemIndex, itemStatus);
1809 _ListImpl::OnTableViewItemReordered(Tizen::Ui::Controls::_TableView& tableView, int itemIndexFrom, int itemIndexTo)
1815 _ListImpl::OnTableViewContextItemActivationStateChanged(Tizen::Ui::Controls::_TableView& tableView, int itemIndex, Tizen::Ui::Controls::_TableViewItem* pContextItem, bool activated)
1821 _ListImpl::OnGroupedTableViewGroupItemStateChanged(Tizen::Ui::Controls::_TableView& tableView, int groupIndex, Tizen::Ui::Controls::_TableViewItem* pItem, Tizen::Ui::Controls::TableViewItemStatus status)
1827 _ListImpl::OnGroupedTableViewItemStateChanged(Tizen::Ui::Controls::_TableView& tableView, int groupIndex, int itemIndex, Tizen::Ui::Controls::_TableViewItem* pItem, Tizen::Ui::Controls::TableViewItemStatus status)
1833 _ListImpl::OnGroupedTableViewContextItemActivationStateChanged(Tizen::Ui::Controls::_TableView& tableView, int groupIndex, int itemIndex, Tizen::Ui::Controls::_TableViewItem* pContextItem, bool activated)
1839 _ListImpl::OnGroupedTableViewItemReordered(Tizen::Ui::Controls::_TableView& tableView, int groupIndexFrom, int itemIndexFrom, int groupIndexTo, int itemIndexTo)
1844 _ListImpl::OnSectionTableViewItemStateChanged(Tizen::Ui::Controls::_TableView& tableView, int sectionIndex, int itemIndex, Tizen::Ui::Controls::_TableViewItem* pItem, Tizen::Ui::Controls::TableViewItemStatus status)
1850 _ListImpl::OnTableViewItemSwept(Tizen::Ui::Controls::_TableView& tableView, int groupIndex, int itemIndex, Tizen::Ui::Controls::TableViewSweepDirection direction)
1856 _ListImpl::OnSectionTableViewContextItemActivationStateChanged(Tizen::Ui::Controls::_TableView& tableView, int sectionIndex, int itemIndex, Tizen::Ui::Controls::_TableViewItem* pContextItem, bool activated)
1862 _ListImpl::ProcessItemStateChange(int groupIndex, int itemIndex, ItemStatus itemStatus)
1864 int itemId = GetItemIdAt(itemIndex);
1866 _ListListener* pListenerList = null;
1867 IItemEventListener* pEventListener = null;
1869 int count = __itemListeners.GetCount();
1870 for (int listenerCount = 0; listenerCount < count; listenerCount++)
1872 pListenerList = dynamic_cast<_ListListener*>(__itemListeners.GetAt(listenerCount));
1873 SysTryReturnVoidResult(NID_UI_CTRL, (pListenerList != null), E_SYSTEM,
1874 "[E_SYSTEM] A system error has occurred. Failed to get Listener.");
1876 pEventListener = dynamic_cast<IItemEventListener*>(pListenerList->pListener);
1877 SysTryReturnVoidResult(NID_UI_CTRL, (pEventListener != null), E_SYSTEM,
1878 "[E_SYSTEM] A system error has occurred. Failed to get Listener.");
1880 pEventListener->OnItemStateChanged(GetPublic(), itemIndex, itemId, itemStatus);
1882 SetLastResult(E_SUCCESS);
1888 _ListImpl::ProcessItemStateChange(int groupIndex, int itemIndex, int elementId, ItemStatus itemStatus)
1890 int itemId = GetItemIdAt(itemIndex);
1892 _ListListener* pListenerList = null;
1893 IItemEventListener* pEventListener = null;
1895 int count = __itemListeners.GetCount();
1896 for (int listenerCount = 0; listenerCount < count; listenerCount++)
1898 pListenerList = dynamic_cast<_ListListener*>(__itemListeners.GetAt(listenerCount));
1899 SysTryReturnVoidResult(NID_UI_CTRL, (pListenerList != null), E_SYSTEM,
1900 "[E_SYSTEM] A system error has occurred. Failed to get Listener.");
1902 pEventListener = dynamic_cast<IItemEventListener*>(pListenerList->pListener);
1903 SysTryReturnVoidResult(NID_UI_CTRL, (pEventListener != null), E_SYSTEM,
1904 "[E_SYSTEM] A system error has occurred. Failed to get Listener.");
1906 pEventListener->OnItemStateChanged(GetPublic(), itemIndex, itemId, itemStatus);
1908 SetLastResult(E_SUCCESS);
1916 : public _UiBuilderControlMaker
1919 _ListMaker(_UiBuilder* uibuilder)
1920 : _UiBuilderControlMaker(uibuilder){};
1921 virtual ~_ListMaker(){};
1922 static _UiBuilderControlMaker*
1923 GetInstance(_UiBuilder* uibuilder)
1925 _ListMaker* pListMaker = new (std::nothrow) _ListMaker(uibuilder);
1930 Make(_UiBuilderControl* pControl)
1932 result r = E_SYSTEM;
1933 _UiBuilderControlLayout* pControlProperty = null;
1938 Tizen::Base::String elementString;
1939 int tempRow1Height = 0;
1940 int tempRow2Height = 0;
1941 int tempColumn1Width = 0;
1942 int tempColumn2Width = 0;
1944 ListStyle style = LIST_STYLE_NORMAL;
1945 ListItemFormat format = LIST_ITEM_SINGLE_TEXT;
1948 GetProperty(pControl, &pControlProperty);
1949 if (pControlProperty == null)
1954 pList = new (std::nothrow) List();
1960 rect = pControlProperty->GetRect();
1962 if (pControl->GetElement(L"ListItemFormat", elementString))
1964 if (elementString.Equals(L"LIST_ITEM_SINGLE_IMAGE", false))
1966 format = LIST_ITEM_SINGLE_IMAGE;
1968 else if (elementString.Equals(L"LIST_ITEM_SINGLE_TEXT", false))
1970 format = LIST_ITEM_SINGLE_TEXT;
1972 else if (elementString.Equals(L"LIST_ITEM_SINGLE_IMAGE_TEXT", false))
1974 format = LIST_ITEM_SINGLE_IMAGE_TEXT;
1976 else if (elementString.Equals(L"LIST_ITEM_SINGLE_TEXT_IMAGE", false))
1978 format = LIST_ITEM_SINGLE_TEXT_IMAGE;
1980 else if (elementString.Equals(L"LIST_ITEM_SINGLE_IMAGE_TEXT_IMAGE", false))
1982 format = LIST_ITEM_SINGLE_IMAGE_TEXT_IMAGE;
1984 else if (elementString.Equals(L"LIST_ITEM_DOUBLE_IMAGE_TEXT_FULLTEXT", false))
1986 format = LIST_ITEM_DOUBLE_IMAGE_TEXT_FULLTEXT;
1988 else if (elementString.Equals(L"LIST_ITEM_DOUBLE_FULLTEXT_IMAGE_TEXT", false))
1990 format = LIST_ITEM_DOUBLE_FULLTEXT_IMAGE_TEXT;
1992 else if (elementString.Equals(L"LIST_ITEM_DOUBLE_TEXT_IMAGE_FULLTEXT", false))
1994 format = LIST_ITEM_DOUBLE_TEXT_IMAGE_FULLTEXT;
1996 else if (elementString.Equals(L"LIST_ITEM_DOUBLE_FULLTEXT_TEXT_IMAGE", false))
1998 format = LIST_ITEM_DOUBLE_FULLTEXT_TEXT_IMAGE;
2000 else if (elementString.Equals(L"LIST_ITEM_DOUBLE_IMAGE_TEXT_TEXT", false))
2002 format = LIST_ITEM_DOUBLE_IMAGE_TEXT_TEXT;
2004 else if (elementString.Equals(L"LIST_ITEM_DOUBLE_TEXT_TEXT_IMAGE", false))
2006 format = LIST_ITEM_DOUBLE_TEXT_TEXT_IMAGE;
2010 format = LIST_ITEM_SINGLE_TEXT;
2014 if (pControl->GetElement(L"line1Height", elementString) || pControl->GetElement(L"row1Height", elementString))
2016 Base::Integer::Parse(elementString, tempRow1Height);
2019 if ((pControl->GetElement(L"line2Height", elementString) || pControl->GetElement(L"row2Height", elementString)) && (format > 4))
2021 Base::Integer::Parse(elementString,tempRow2Height);
2028 if (pControl->GetElement(L"column1Width", elementString))
2030 Base::Integer::Parse(elementString,tempColumn1Width);
2033 if ((pControl->GetElement(L"column2Width", elementString)) && (format > 1))
2035 Base::Integer::Parse(elementString,tempColumn2Width);
2039 tempColumn2Width = 0;
2042 Tizen::Base::String styleString;
2043 styleString = pControlProperty->GetStyle();
2045 if (styleString.Equals(L"LIST_STYLE_NORMAL", false))
2047 style = LIST_STYLE_NORMAL;
2049 else if (styleString.Equals(L"LIST_STYLE_NUMBER", false))
2051 style = LIST_STYLE_NUMBER;
2053 else if (styleString.Equals(L"LIST_STYLE_RADIO", false))
2055 style = LIST_STYLE_RADIO;
2057 else if (styleString.Equals(L"LIST_STYLE_RADIO_WITH_DIVIDER", false))
2059 style = LIST_STYLE_RADIO_WITH_DIVIDER;
2061 else if (styleString.Equals(L"LIST_STYLE_MARK_WITH_DIVIDER", false))
2063 style = LIST_STYLE_MARK_WITH_DIVIDER;
2065 else if (styleString.Equals(L"LIST_STYLE_ONOFF_WITH_DIVIDER", false))
2067 style = LIST_STYLE_ONOFF_WITH_DIVIDER;
2069 else if (styleString.Equals(L"LIST_STYLE_MARK", false))
2071 style = LIST_STYLE_MARK;
2073 else if (styleString.Equals(L"LIST_STYLE_ONOFF", false))
2075 style = LIST_STYLE_ONOFF;
2079 style = LIST_STYLE_NORMAL;
2082 if (tempRow1Height < 0 || tempRow1Height > ((Tizen::Ui::Control*) GetContainer())->GetBounds().height)
2084 tempRow1Height = ((Tizen::Ui::Control*) GetContainer())->GetBounds().height >> 2;
2086 if (tempRow2Height < 0 || tempRow2Height > ((Tizen::Ui::Control*) GetContainer())->GetBounds().height)
2088 tempRow2Height = ((Tizen::Ui::Control*) GetContainer())->GetBounds().height >> 2;
2090 if (tempColumn1Width < 0 || tempColumn1Width > ((Tizen::Ui::Control*) GetContainer())->GetBounds().width)
2092 tempColumn1Width = ((Tizen::Ui::Control*) GetContainer())->GetBounds().width >> 2;
2094 if (tempColumn2Width < 0 || tempColumn2Width > ((Tizen::Ui::Control*) GetContainer())->GetBounds().width)
2096 tempColumn2Width = ((Tizen::Ui::Control*) GetContainer())->GetBounds().width >> 2;
2099 r = pList->Construct(rect, style, format, tempRow1Height, tempRow2Height, tempColumn1Width, tempColumn2Width);
2106 if (pControl->GetElement(L"textOfEmptyList", elementString))
2108 pList->SetTextOfEmptyList(elementString);
2111 if (pControl->GetElement(L"colorOfEmptyListText", elementString))
2113 ConvertStringToColor(elementString, color);
2114 pList->SetTextColorOfEmptyList(color);
2117 GET_DIMENSION_CONFIG(LIST::LIST_MIN_SIZE, _CONTROL_ORIENTATION_PORTRAIT, dimMin);
2118 rectMin = (pControl->GetAttribute(0))->GetRect();
2119 (pControl->GetAttribute(0))->SetRect(rectMin.x, rectMin.y, dimMin.width, dimMin.height);
2121 GET_DIMENSION_CONFIG(LIST::LIST_MIN_SIZE, _CONTROL_ORIENTATION_LANDSCAPE, dimMin);
2122 rectMin = (pControl->GetAttribute(1))->GetRect();
2123 (pControl->GetAttribute(1))->SetRect(rectMin.x, rectMin.y, dimMin.width, dimMin.height);
2131 _ListRegister::_ListRegister()
2133 _UiBuilderControlTableManager* pUiBuilderControlTableManager = _UiBuilderControlTableManager::GetInstance();
2134 if (pUiBuilderControlTableManager)
2136 pUiBuilderControlTableManager->RegisterControl(L"List", _ListMaker::GetInstance);
2139 _ListRegister::~_ListRegister()
2141 _UiBuilderControlTableManager* pUiBuilderControlTableManager = _UiBuilderControlTableManager::GetInstance();
2142 if (pUiBuilderControlTableManager)
2144 pUiBuilderControlTableManager->UnregisterControl(L"List");
2148 static _ListRegister ListRegisterToUiBuilder;
2149 }}} // Tizen::Ui::Controls