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 FUiCtrlGroupedListView.h
20 * @brief This is the header file for the %GroupedListView class.
22 * This header file contains the declarations of the %GroupedListView class and its helper classes.
25 #ifndef _FUI_CTRL_GROUPED_LIST_VIEW_H_
26 #define _FUI_CTRL_GROUPED_LIST_VIEW_H_
28 #include <FBaseObject.h>
29 #include <FBaseTypes.h>
30 #include <FGrpFloatRectangle.h>
31 #include <FGrpRectangle.h>
32 #include <FUiControl.h>
33 #include <FUiContainer.h>
34 #include <FUiCtrlGroupedListViewTypes.h>
35 #include <FUiCtrlIFastScrollListener.h>
36 #include <FUiCtrlIGroupedListViewItemEventListener.h>
37 #include <FUiCtrlIGroupedListViewItemProvider.h>
38 #include <FUiCtrlIGroupedListViewItemProviderF.h>
39 #include <FUiCtrlIScrollEventListener.h>
40 #include <FUiCtrlIScrollEventListenerF.h>
41 #include <FUiCtrlListViewTypes.h>
42 #include <FUiCtrlScrollPanelTypes.h>
43 #include <FUiIUiLinkEventListener.h>
45 namespace Tizen { namespace Ui { namespace Controls
48 class _GroupedListViewImpl;
51 * @class GroupedListView
52 * @brief This class defines the common behavior of a %GroupedListView control.
56 * The %GroupedListView class displays a list of grouped items in a list. The items in a GroupedList control consist of groups and
57 * items. A group represents the grouped items and is placed at the first level. Each group consists of simple or custom items.
58 * Therefore, items are uniquely identified with two indexes: group index and item index.
60 * For more information on the class features, see <a href="../org.tizen.native.appprogramming/html/guide/ui/implementing_listviews.htm">ListViews</a>.
62 * The following example demonstrates how to use the %GroupedListView class.
66 //Sample code for GroupedListViewSample.h
70 class CustomGroupedListElement;
72 class GroupedListViewSample
73 : public Tizen::Ui::Controls::Form
74 , public Tizen::Ui::Controls::IGroupedListViewItemEventListener
75 , public Tizen::Ui::Controls::IGroupedListViewItemProvider
78 GroupedListViewSample(void)
79 : __pGroupedListView(null)
80 , __pCustomGroupedListElement(null){}
82 bool Initialize(void);
83 virtual result OnInitializing(void);
84 virtual result OnTerminating(void);
86 // IGroupedListViewItemEventListener
87 virtual void OnGroupedListViewContextItemStateChanged(Tizen::Ui::Controls::GroupedListView &listView, int groupIndex, int itemIndex, int elementId, Tizen::Ui::Controls::ListContextItemStatus state);
88 virtual void OnGroupedListViewItemStateChanged(Tizen::Ui::Controls::GroupedListView &listView, int groupIndex, int itemIndex, int elementId, Tizen::Ui::Controls::ListItemStatus state);
89 virtual void OnGroupedListViewItemSwept(Tizen::Ui::Controls::GroupedListView &listView, int groupIndex, int itemIndex, Tizen::Ui::Controls::SweepDirection direction);
91 // IGroupedListViewItemProvider
92 virtual int GetGroupCount(void);
93 virtual int GetItemCount(int groupIndex);
94 virtual Tizen::Ui::Controls::ListItemBase* CreateItem(int groupIndex, int itemIndex, int itemWidth);
95 virtual Tizen::Ui::Controls::GroupItem* CreateGroupItem(int groupIndex, int itemWidth);
96 virtual bool DeleteItem(int groupIndex, int itemIndex, Tizen::Ui::Controls::ListItemBase* pItem, int itemWidth);
97 virtual bool DeleteGroupItem(int groupIndex, Tizen::Ui::Controls::GroupItem* pItem, int itemWidth);
100 static const int ID_FORMAT_STRING = 100;
101 static const int ID_FORMAT_BITMAP = 101;
102 static const int ID_FORMAT_CUSTOM = 102;
103 static const int ID_CONTEXT_ITEM_1 = 103;
104 static const int ID_CONTEXT_ITEM_2 = 104;
106 Tizen::Graphics::Bitmap* __pHome;
107 Tizen::Graphics::Bitmap* __pMsg;
108 Tizen::Graphics::Bitmap* __pAlarm;
109 Tizen::Graphics::Bitmap* __pCall;
111 Tizen::Ui::Controls::GroupedListView* __pGroupedListView;
112 Tizen::Ui::Controls::ListContextItem* __pItemContext;
113 CustomGroupedListElement* __pCustomGroupedListElement;
118 //Sample code for GroupedListViewSample.cpp
120 #include <FGraphics.h>
122 #include "GroupedListViewSample.h"
124 using namespace Tizen::App;
125 using namespace Tizen::Base;
126 using namespace Tizen::Graphics;
127 using namespace Tizen::Ui::Controls;
129 class CustomGroupedListElement
130 : public ICustomElement
134 OnDraw(Canvas& canvas, const Rectangle& rect, ListItemDrawingStatus itemStatus)
136 Tizen::Graphics::Font font;
137 font.Construct(FONT_STYLE_PLAIN, 15);
138 canvas.SetFont(font);
139 canvas.SetLineWidth(3);
140 canvas.SetForegroundColor(Color::GetColor(COLOR_ID_GREEN));
142 if (canvas.DrawRectangle(rect) != E_SUCCESS)
147 if (canvas.DrawText(Point(rect.x+10, rect.y+15), L"Custom") != E_SUCCESS)
157 GroupedListViewSample::Initialize(void)
159 Construct(FORM_STYLE_NORMAL);
164 GroupedListViewSample::OnInitializing(void)
166 result r = E_SUCCESS;
168 // Creates an instance of IconListView
169 __pGroupedListView = new GroupedListView();
170 __pGroupedListView->Construct(Rectangle(0, 0, GetClientAreaBounds().width, GetClientAreaBounds().height), GROUPED_LIST_VIEW_STYLE_INDEXED, true, true);
171 __pGroupedListView->SetItemProvider(*this);
172 __pGroupedListView->AddGroupedListViewItemEventListener(*this);
174 // Adds the icon list view to the form
175 AddControl(*__pGroupedListView);
177 // Creates an instance of ListContextItem
178 __pItemContext = new ListContextItem();
179 __pItemContext->Construct();
180 __pItemContext->AddElement(ID_CONTEXT_ITEM_1, "Test1");
181 __pItemContext->AddElement(ID_CONTEXT_ITEM_2, "Test2");
183 // Gets instances of Bitmap
184 AppResource* pAppResource = Application::GetInstance()->GetAppResource();
185 __pHome = pAppResource->GetBitmapN(L"tizen.png");
186 __pMsg = pAppResource->GetBitmapN(L"tizen.png");
187 __pAlarm = pAppResource->GetBitmapN(L"tizen.png");
188 __pCall = pAppResource->GetBitmapN(L"tizen.png");
190 // Creates an instance of CustomGroupedListElement
191 __pCustomGroupedListElement = new CustomGroupedListElement();
197 GroupedListViewSample::OnTerminating(void)
199 result r = E_SUCCESS;
201 // Deallocates bitmaps
207 // Deallocates the item context
208 delete __pItemContext;
214 GroupedListViewSample::OnGroupedListViewItemStateChanged(GroupedListView &listView, int groupIndex, int itemIndex, int elementId, ListItemStatus state)
218 case ID_FORMAT_STRING:
223 case ID_FORMAT_BITMAP:
234 GroupedListViewSample::OnGroupedListViewContextItemStateChanged(GroupedListView &listView, int groupIndex, int itemIndex, int elementId, ListContextItemStatus state)
238 case ID_CONTEXT_ITEM_1:
243 case ID_CONTEXT_ITEM_2:
253 // IGroupedListViewItemEventListener
255 GroupedListViewSample::OnGroupedListViewItemSwept(GroupedListView &listView, int groupIndex, int itemIndex, SweepDirection direction)
261 GroupedListViewSample::GetGroupCount(void)
267 GroupedListViewSample::GetItemCount(int groupIndex)
294 // IGroupedListViewItemProvider
296 GroupedListViewSample::CreateGroupItem(int groupIndex, int itemWidth)
298 String text("Group ");
299 text.Append(groupIndex+1);
301 GroupItem* pItem = new GroupItem();
302 pItem->Construct(Dimension(itemWidth, 40));
303 pItem->SetElement(text, null);
309 GroupedListViewSample::CreateItem(int groupIndex, int itemIndex, int itemWidth)
311 // Creates an instance of CustomItem
312 CustomItem* pItem = new CustomItem();
313 ListAnnexStyle style = LIST_ANNEX_STYLE_NORMAL;
314 pItem->Construct(Dimension(itemWidth, 100), style);
316 switch (itemIndex % 4)
320 style = LIST_ANNEX_STYLE_NORMAL;
321 pItem->AddElement(Rectangle(10, 20, 60, 60), ID_FORMAT_BITMAP, *__pHome, null, null);
322 pItem->AddElement(Rectangle(150, 25, 150, 50), ID_FORMAT_STRING, L"Home", true);
327 style = LIST_ANNEX_STYLE_MARK;
328 pItem->AddElement(Rectangle(10, 20, 60, 60), ID_FORMAT_BITMAP, *__pMsg, null, null);
329 pItem->AddElement(Rectangle(150, 25, 150, 50), ID_FORMAT_STRING, L"Msg", true);
334 style = LIST_ANNEX_STYLE_ONOFF_SLIDING;
335 pItem->AddElement(Rectangle(10, 20, 60, 60), ID_FORMAT_BITMAP, *__pAlarm, null, null);
336 pItem->AddElement(Rectangle(150, 25, 150, 50), ID_FORMAT_STRING, L"Alarm", true);
341 style = LIST_ANNEX_STYLE_DETAILED;
342 pItem->AddElement(Rectangle(10, 20, 60, 60), ID_FORMAT_BITMAP, *__pCall, null, null);
343 pItem->AddElement(Rectangle(150, 25, 150, 50), ID_FORMAT_STRING, L"Call", true);
349 pItem->AddElement(Rectangle(360, 10, 180, 80), ID_FORMAT_CUSTOM, *(static_cast<ICustomElement *>(__pCustomGroupedListElement)));
350 pItem->SetContextItem(__pItemContext);
356 GroupedListViewSample::DeleteItem(int groupIndex, int itemIndex, ListItemBase* pItem, int itemWidth)
364 GroupedListViewSample::DeleteGroupItem(int groupIndex, GroupItem* pItem, int itemWidth)
375 class _OSP_EXPORT_ GroupedListView
376 : public Tizen::Ui::Control
380 * The object is not fully constructed after this constructor is
381 * called. For full construction, the Construct() method must be
382 * called right after calling this constructor.
386 GroupedListView(void);
389 * This destructor overrides Tizen::Base::Object::~Object().
393 virtual ~GroupedListView(void);
397 * Initializes this instance of %GroupedListView with the specified parameters.
399 * @brief <i> [Deprecated] </i>
400 * @deprecated This method is deprecated.
403 * @return An error code
404 * @param[in] rect An instance of the Graphics::Rectangle class
405 * This instance represents the x and y coordinates of the top-left corner of the created
406 * %GroupedListView control along with the width and height.
407 * @param[in] style The style of the %GroupedListView control
408 * @param[in] itemDivider Set to @c true to display an item divider, @n
410 * @param[in] fastScroll Set to @c true to use the fast scroll, @n
412 * @exception E_SUCCESS The method is successful.
413 * @exception E_INVALID_ARG A specified input parameter is invalid. @n
414 * Either the @c rect.width or @c rect.height parameter has a negative value.
415 * @exception E_SYSTEM A system error has occurred.
418 result Construct(const Tizen::Graphics::Rectangle& rect, GroupedListViewStyle style, bool itemDivider = true, bool fastScroll = false);
421 * Initializes this instance of %GroupedListView with the specified parameters.
425 * @return An error code
426 * @param[in] rect An instance of the Graphics::Rectangle class
427 * This instance represents the x and y coordinates of the top-left corner of the created
428 * %GroupedListView control along with the width and height.
429 * @param[in] style The style of the %GroupedListView control
430 * @param[in] itemDivider Set to @c true to display an item divider, @n
432 * @param[in] scrollStyle Set to scroll style
433 * @exception E_SUCCESS The method is successful.
434 * @exception E_INVALID_ARG A specified input parameter is invalid. @n
435 * Either the @c rect.width or @c rect.height parameter has a negative value.
436 * @exception E_SYSTEM A system error has occurred.
438 result Construct(const Tizen::Graphics::Rectangle& rect, GroupedListViewStyle style, bool itemDivider, ListScrollStyle scrollStyle);
441 * Initializes this instance of %GroupedListView with the specified parameters.
445 * @return An error code
446 * @param[in] rect An instance of the Graphics::Rectangle class
447 * This instance represents the x and y coordinates of the top-left corner of the created
448 * %GroupedListView control along with the width and height.
449 * @param[in] style The style of the %GroupedListView control
450 * @param[in] itemDivider Set to @c true to display an item divider, @n
452 * @param[in] scrollStyle Set to scroll style
453 * @exception E_SUCCESS The method is successful.
454 * @exception E_INVALID_ARG A specified input parameter is invalid. @n
455 * Either the @c rect.width or @c rect.height parameter has a negative value.
456 * @exception E_SYSTEM A system error has occurred.
458 result Construct(const Tizen::Graphics::FloatRectangle& rect, GroupedListViewStyle style, bool itemDivider, ListScrollStyle scrollStyle);
461 * Sets the item provider that creates and deletes items from the list.
465 * @return An error code
466 * @param[in] provider The item provider to create and delete items
467 * @exception E_SUCCESS The method is successful.
468 * @exception E_SYSTEM A system error has occurred.
469 * @remarks If an item provider is not set for the list, the list does not work. @n
470 * A provider should be allocated on a heap memory.
472 result SetItemProvider(IGroupedListViewItemProvider& provider);
475 * Sets the item provider that creates and deletes items from the list.
479 * @return An error code
480 * @param[in] provider The item provider to create and delete items
481 * @exception E_SUCCESS The method is successful.
482 * @exception E_SYSTEM A system error has occurred.
483 * @remarks If an item provider is not set for the list, the list does not work. @n
484 * A provider should be allocated on a heap memory.
486 result SetItemProvider(IGroupedListViewItemProviderF& provider);
489 * Adds an IGroupedListViewItemEventListener instance that listens to the state changes of the list view items. @n
490 * The added listener can listen to events on the specified event dispatcher's context when they are fired.
494 * @param[in] listener The event listener to be added
496 void AddGroupedListViewItemEventListener(IGroupedListViewItemEventListener& listener);
499 * Removes an IGroupedListViewItemEventListener instance that listens to the state changes of the list view items. @n
500 * The removed listener cannot listen to events when they are fired.
504 * @param[in] listener The event listener to be removed
506 void RemoveGroupedListViewItemEventListener(IGroupedListViewItemEventListener& listener);
509 * Adds an IFastScrollListener instance that listens to the state changes of a fast scroll. @n
510 * The added listener can listen to events on the specified event dispatcher's context when they are fired.
514 * @param[in] listener The event listener to be added
516 void AddFastScrollListener(IFastScrollListener& listener);
519 * Removes an IFastScrollListener instance that listens to the state changes of a fast scroll. @n
520 * The removed listener cannot listen to events when they are fired.
524 * @param[in] listener The event listener to be removed
526 void RemoveFastScrollListener(IFastScrollListener& listener);
529 * Adds an IScrollEventListener instance that listens to the state changes of a scroll event. @n
530 * The added listener can listen to events on the specified event dispatcher's context when they are fired.
534 * @param[in] listener The event listener to be added
535 * @see IScrollEventListener::OnScrollEndReached()
536 * @see RemoveScrollEventListener()
538 void AddScrollEventListener(IScrollEventListener& listener);
541 * Adds an IScrollEventListener instance that listens to the state changes of a scroll event. @n
542 * The added listener can listen to events on the specified event dispatcher's context when they are fired.
546 * @param[in] listener The event listener to be added
547 * @see IScrollEventListener::OnScrollEndReached()
548 * @see RemoveScrollEventListener()
550 void AddScrollEventListener(IScrollEventListenerF& listener);
553 * Removes an IScrollEventListener instance that listens to the state changes of a scroll event. @n
554 * The removed listener cannot listen to events when they are fired.
558 * @param[in] listener The event listener to be removed
559 * @see IScrollEventListener::OnScrollEndReached()
560 * @see AddScrollEventListener()
562 void RemoveScrollEventListener(IScrollEventListener& listener);
565 * Removes an IScrollEventListener instance that listens to the state changes of a scroll event. @n
566 * The removed listener cannot listen to events when they are fired.
570 * @param[in] listener The event listener to be removed
571 * @see IScrollEventListener::OnScrollEndReached()
572 * @see AddScrollEventListener()
574 void RemoveScrollEventListener(IScrollEventListenerF& listener);
577 * Adds a link event listener.
581 * @param[in] listener The event listener to be added
582 * @remarks The added listener is notified when a link is selected by the user.
584 * @see RemoveUiLinkEventListener()
586 void AddUiLinkEventListener(Tizen::Ui::IUiLinkEventListener& listener);
589 * Removes the specified link event listener.
590 * The removed listener cannot listen to events when they are fired.
594 * @param[in] listener The event listener to be removed
595 * @see AddUiLinkEventListener()
597 void RemoveUiLinkEventListener(Tizen::Ui::IUiLinkEventListener& listener);
600 * Enables or disables the sweep event.
604 * @return An error code
605 * @param[in] enable Set to @c true to enable the item sweep, @n
607 * @exception E_SUCCESS The method is successful.
608 * @exception E_SYSTEM A system error has occurred.
610 result SetSweepEnabled(bool enable);
613 * Sets the index list of the fast scroll.
617 * @return An error code
618 * @param[in] text The text of the index
619 * @param[in] useSearchIcon Set to @c true to display the magnifying icon, @n
621 * @exception E_SUCCESS The method is successful.
622 * @exception E_INVALID_ARG A specified input parameter is invalid.
623 * @exception E_INVALID_STATE This instance is in an invalid state.
624 * @exception E_SYSTEM A system error has occurred.
626 result SetFastScrollIndex(const Tizen::Base::String& text, bool useSearchIcon);
629 * Gets the group and item indexes of the top item.
633 * @return An error code
634 * @param[out] groupIndex The group index
635 * @param[out] itemIndex The item index
636 * @exception E_SUCCESS The method is successful.
637 * @exception E_SYSTEM A system error has occurred.
639 result GetTopDrawnItemIndex(int& groupIndex, int& itemIndex) const;
642 * Gets the group and item indexes of the bottom item.
646 * @return An error code
647 * @param[out] groupIndex The group index
648 * @param[out] itemIndex The item index
649 * @exception E_SUCCESS The method is successful.
650 * @exception E_SYSTEM A system error has occurred.
652 result GetBottomDrawnItemIndex(int& groupIndex, int& itemIndex) const;
656 * Scrolls to the item at the specified index. @n
657 * The specified item is drawn at the top of the %GroupedListView control.
661 * @return An error code
662 * @param[in] groupIndex The group index
663 * @param[in] itemIndex The item index
664 * @exception E_SUCCESS The method is successful.
665 * @exception E_OUT_OF_RANGE A specified input parameter is invalid.
666 * @exception E_SYSTEM A system error has occurred.
667 * @remarks This method should be called only after list items are created. If this method needs to be called early in the lifecycle of the ListView, then UpdateList() method should be called explicitly (e.g. during Tizen::Ui::Control::OnInitializing()).
669 result ScrollToItem(int groupIndex, int itemIndex);
672 * Scrolls to the item at the specified index. @n
673 * The specified item is drawn at the position specified by the item alignment.
677 * @return An error code
678 * @param[in] groupIndex The group index
679 * @param[in] itemIndex The item index
680 * @param[in] itemAlignment The item alignment
681 * @exception E_SUCCESS The method is successful.
682 * @exception E_OUT_OF_RANGE A specified input parameter is invalid.
683 * @exception E_SYSTEM A system error has occurred.
684 * @remarks This method should be called only after list items are created. If this method needs to be called early in the lifecycle of the ListView, then UpdateList() method should be called explicitly (e.g. during Tizen::Ui::Control::OnInitializing()).
686 result ScrollToItem(int groupIndex, int itemIndex, ListScrollItemAlignment itemAlignment);
689 * Checks or unchecks the item at the specified index.
693 * @return An error code
694 * @param[in] groupIndex The group index of the item to check
695 * @param[in] itemIndex The index of the item to check
696 * @param[in] check Set to @c true to select the item, @n
698 * @exception E_SUCCESS The method is successful.
699 * @exception E_OUT_OF_RANGE A specified input parameter is invalid.
700 * @exception E_INVALID_OPERATION The item is disabled.
701 * @exception E_SYSTEM A system error has occurred.
702 * @remarks This method works only when the annex style of the item allows selection.
703 * @remarks This method should be called only after list items are created. If this method needs to be called early in the lifecycle of the ListView, then UpdateList() method should be called explicitly (e.g. during Tizen::Ui::Control::OnInitializing()).
705 result SetItemChecked(int groupIndex, int itemIndex, bool check);
708 * Checks whether the item at the specified index is selected.
712 * @return @c true if the item is selected, @n
714 * @param[in] groupIndex The group index
715 * @param[in] itemIndex The item index
716 * @remarks This method returns @c false, if the annex style of the item does not allow selection.
717 * @remarks This method should be called only after list items are created. If this method needs to be called early in the lifecycle of the ListView, then UpdateList() method should be called explicitly (e.g. during Tizen::Ui::Control::OnInitializing()).
719 bool IsItemChecked(int groupIndex, int itemIndex) const;
722 * Enables or disables the item at the specified index.
726 * @return An error code
727 * @param[in] groupIndex The group index
728 * @param[in] itemIndex The item index
729 * @param[in] enable Set to @c true to enable the specified item, @n
731 * @exception E_SUCCESS The method is successful.
732 * @exception E_OUT_OF_RANGE A specified input parameter is invalid.
733 * @exception E_SYSTEM A system error has occurred.
734 * @remarks This method can only be used when the annex style of the list allows selection.
735 * @remarks This method should be called only after list items are created. If this method needs to be called early in the lifecycle of the ListView, then UpdateList() method should be called explicitly (e.g. during Tizen::Ui::Control::OnInitializing()).
737 result SetItemEnabled(int groupIndex, int itemIndex, bool enable);
740 * Checks whether the item at the specified index is enabled or disabled.
744 * @return @c true if the item is enabled, @n
746 * @param[in] groupIndex The group index
747 * @param[in] itemIndex The item index
748 * @remarks This method should be called only after list items are created. If this method needs to be called early in the lifecycle of the ListView, then UpdateList() method should be called explicitly (e.g. during Tizen::Ui::Control::OnInitializing()).
750 bool IsItemEnabled(int groupIndex, int itemIndex) const;
753 * Counts the total number of groups.
757 * @return The total number of groups
759 int GetGroupCount(void) const;
762 * Counts all the items of the specified group.
766 * @return The total number of items in the specified group
767 * @param[in] groupIndex The group index
768 * @remarks This method should be called only after list items are created. If this method needs to be called early in the lifecycle of the ListView, then UpdateList() method should be called explicitly (e.g. during Tizen::Ui::Control::OnInitializing()).
770 int GetItemCountAt(int groupIndex) const;
773 * Shows the description text of the specified item.
777 * @return An error code
778 * @param[in] groupIndex The group index of the item
779 * @param[in] itemIndex The index of the item
780 * @exception E_SUCCESS The method is successful.
781 * @exception E_OUT_OF_RANGE A specified input parameter is invalid.
782 * @exception E_SYSTEM A system error has occurred.
783 * @remarks If no description text is set for the item at the specified index, it is not displayed.
784 * @remarks This method should be called only after list items are created. If this method needs to be called early in the lifecycle of the ListView, then UpdateList() method should be called explicitly (e.g. during Tizen::Ui::Control::OnInitializing()).
787 result ShowItemDescriptionText(int groupIndex, int itemIndex);
790 * Hides the description text of the specified item.
794 * @return An error code
795 * @param[in] groupIndex The group index of the item
796 * @param[in] itemIndex The index of the item
797 * @exception E_SUCCESS The method is successful.
798 * @exception E_OUT_OF_RANGE A specified input parameter is invalid.
799 * @exception E_SYSTEM A system error has occurred.
800 * @remarks This method should be called only after list items are created. If this method needs to be called early in the lifecycle of the ListView, then UpdateList() method should be called explicitly (e.g. during Tizen::Ui::Control::OnInitializing()).
802 result HideItemDescriptionText(int groupIndex, int itemIndex);
805 * Updates the specified item. @n
806 * For instance, LIST_REFRESH_TYPE_ITEM_ADD is used when a new item needs to be added and LIST_REFRESH_TYPE_ITEM_REMOVE is used when an item is deleted from the
807 * list. Moreover, LIST_REFRESH_TYPE_ITEM_MODIFY is used when the content of an existing item has changed and it needs to be updated. @n
808 * Note that calling this method with LIST_REFRESH_TYPE_ITEM_MODIFY invokes item provider's DeleteItem() and CreateItem() for the given index in sequence.
812 * @return An error code
813 * @param[in] groupIndex The group index
814 * @param[in] itemIndex The item index
815 * @param[in] type The item to be added, removed, or modified
816 * @exception E_SUCCESS The method is successful.
817 * @exception E_OUT_OF_RANGE A specified input parameter is invalid.
818 * @exception E_INVALID_OPERATION The current state of the instance prohibits the execution of the specified operation.
819 * @exception E_SYSTEM A system error has occurred.
820 * @remarks If the specified itemIndex is -1, then the method is applied to the group item with the given index. @n
821 * Note that if LIST_REFRESH_TYPE_ITEM_REMOVE option is used to a group item, all the items in the group (including the group item itself) are
822 * removed from the list.
823 * @remarks This method internally calls Invalidate(), so you do not need to call them to update the screen.
825 result RefreshList(int groupIndex, int itemIndex, ListRefreshType type);
828 * Refreshes the specified item's element.
832 * @return An error code
833 * @param[in] groupIndex The group index
834 * @param[in] itemIndex The item index
835 * @param[in] elementId The item element ID
836 * @exception E_SUCCESS The method is successful.
837 * @exception E_OUT_OF_RANGE A specified input parameter is invalid.
838 * @exception E_SYSTEM A system error has occurred.
839 * @remarks This method internally calls Invalidate(), so you do not need to call them to update the screen.
841 result RefreshList(int groupIndex, int itemIndex, int elementId);
844 * Updates all the items of a list.
848 * @return An error code
849 * @exception E_SUCCESS The method is successful.
850 * @exception E_SYSTEM A system error has occurred.
851 * @remarks This method clears all the items in the list and invokes the methods of the item provider again to update the list.
853 result UpdateList(void);
856 * Gets the index of the item at the specified position.
860 * @return An error code
861 * @param[in] x The X position of the item
862 * @param[in] y The Y position of the item
863 * @param[out] groupIndex The index of the group that the item belongs to
864 * @param[out] itemIndex The index of the item
865 * @exception E_SUCCESS The method is successful.
866 * @exception E_SYSTEM A system error has occurred, or @n
867 * there is no item at the specified position.
868 * @remarks This method should be called only after list items are created. If this method needs to be called early in the lifecycle of the ListView, then UpdateList() method should be called explicitly (e.g. during Tizen::Ui::Control::OnInitializing()).
870 result GetItemIndexFromPosition(int x, int y, int& groupIndex, int& itemIndex) const;
873 * Gets the index of the item at the specified position.
877 * @return An error code
878 * @param[in] x The X position of the item
879 * @param[in] y The Y position of the item
880 * @param[out] groupIndex The index of the group that the item belongs to
881 * @param[out] itemIndex The index of the item
882 * @exception E_SUCCESS The method is successful.
883 * @exception E_SYSTEM A system error has occurred, or @n
884 * there is no item at the specified position.
885 * @remarks This method should be called only after list items are created. If this method needs to be called early in the lifecycle of the ListView, then UpdateList() method should be called explicitly (e.g. during Tizen::Ui::Control::OnInitializing()).
887 result GetItemIndexFromPosition(float x, float y, int& groupIndex, int& itemIndex) const;
890 * Gets the index of the item at the specified position.
894 * @return An error code
895 * @param[in] position The position of the item
896 * @param[out] groupIndex The index of the group that the item belongs to
897 * @param[out] itemIndex The index of the item
898 * @exception E_SUCCESS The method is successful.
899 * @exception E_SYSTEM A system error has occurred, or @n
900 * there is no item at the specified position.
901 * @remarks This method should be called only after list items are created. If this method needs to be called early in the lifecycle of the ListView, then UpdateList() method should be called explicitly (e.g. during Tizen::Ui::Control::OnInitializing()).
903 result GetItemIndexFromPosition(const Tizen::Graphics::Point& position, int& groupIndex, int& itemIndex) const;
906 * Gets the index of the item at the specified position.
910 * @return An error code
911 * @param[in] position The position of the item
912 * @param[out] groupIndex The index of the group that the item belongs to
913 * @param[out] itemIndex The index of the item
914 * @exception E_SUCCESS The method is successful.
915 * @exception E_SYSTEM A system error has occurred, or @n
916 * there is no item at the specified position.
917 * @remarks This method should be called only after list items are created. If this method needs to be called early in the lifecycle of the ListView, then UpdateList() method should be called explicitly (e.g. during Tizen::Ui::Control::OnInitializing()).
919 result GetItemIndexFromPosition(const Tizen::Graphics::FloatPoint& position, int& groupIndex, int& itemIndex) const;
922 * Gets the index of the item and ID of the element at the specified position.
926 * @return An error code
927 * @param[in] x The X position of the item
928 * @param[in] y The Y position of the item
929 * @param[out] groupIndex The index of the group that the item belongs to
930 * @param[out] itemIndex The index of the item
931 * @param[out] elementId The ID of the element
932 * @exception E_SUCCESS The method is successful.
933 * @exception E_SYSTEM A system error has occurred, or
934 * there is no item at the specified position.
935 * @remarks @c groupIndex and @c itemIndex are -1 when there is no list item at the specified position.
936 * @remarks @c elementId is -1 when there is no element at the specified position
937 * @remarks This method should be called only after list items are created. If this method needs to be called early in the lifecycle of the ListView, then UpdateList() method should be called explicitly (e.g. during Tizen::Ui::Control::OnInitializing()).
939 result GetItemIndexFromPosition(int x, int y, int& groupIndex, int& itemIndex, int& elementId) const;
942 * Gets the index of the item and ID of the element at the specified position.
946 * @return An error code
947 * @param[in] x The X position of the item
948 * @param[in] y The Y position of the item
949 * @param[out] groupIndex The index of the group that the item belongs to
950 * @param[out] itemIndex The index of the item
951 * @param[out] elementId The ID of the element
952 * @exception E_SUCCESS The method is successful.
953 * @exception E_SYSTEM A system error has occurred, or
954 * there is no item at the specified position.
955 * @remarks @c groupIndex and @c itemIndex are -1 when there is no list item at the specified position.
956 * @remarks @c elementId is -1 when there is no element at the specified position
957 * @remarks This method should be called only after list items are created. If this method needs to be called early in the lifecycle of the ListView, then UpdateList() method should be called explicitly (e.g. during Tizen::Ui::Control::OnInitializing()).
959 result GetItemIndexFromPosition(float x, float y, int& groupIndex, int& itemIndex, int& elementId) const;
962 * Gets the index of the item and ID of the element at the specified position.
966 * @return An error code
967 * @param[in] position The position of the point
968 * @param[out] groupIndex The index of the group that the item belongs to
969 * @param[out] itemIndex The index of the item
970 * @param[out] elementId The ID of the element
971 * @exception E_SUCCESS The method is successful.
972 * @exception E_SYSTEM A system error has occurred, or
973 * there is no item at the specified position.
974 * @remarks @c groupIndex and @c itemIndex are -1 when there is no list item at the specified position.
975 * @remarks @c elementId is -1 when there is no element at the specified position
976 * @remarks This method should be called only after list items are created. If this method needs to be called early in the lifecycle of the ListView, then UpdateList() method should be called explicitly (e.g. during Tizen::Ui::Control::OnInitializing()).
978 result GetItemIndexFromPosition(const Tizen::Graphics::Point& position, int& groupIndex, int& itemIndex, int& elementId) const;
981 * Gets the index of the item and ID of the element at the specified position.
985 * @return An error code
986 * @param[in] position The position of the point
987 * @param[out] groupIndex The index of the group that the item belongs to
988 * @param[out] itemIndex The index of the item
989 * @param[out] elementId The ID of the element
990 * @exception E_SUCCESS The method is successful.
991 * @exception E_SYSTEM A system error has occurred, or
992 * there is no item at the specified position.
993 * @remarks @c groupIndex and @c itemIndex are -1 when there is no list item at the specified position.
994 * @remarks @c elementId is -1 when there is no element at the specified position
995 * @remarks This method should be called only after list items are created. If this method needs to be called early in the lifecycle of the ListView, then UpdateList() method should be called explicitly (e.g. during Tizen::Ui::Control::OnInitializing()).
997 result GetItemIndexFromPosition(const Tizen::Graphics::FloatPoint& position, int& groupIndex, int& itemIndex, int& elementId) const;
1000 * Sets the color of a section.
1004 * @return An error code
1005 * @param[in] color The section color
1006 * @exception E_SUCCESS The method is successful.
1007 * @exception E_INVALID_OPERATION The current state of the instance prohibits the execution of the specified operation (this control cannot be displayed).
1008 * @exception E_SYSTEM A system error has occurred.
1009 * @remarks This method works only when the style of the %GroupedListView control is GROUPED_LIST_VIEW_STYLE_SECTION. @n
1010 * If the device does not support the 32-bit color space, the method sets the alpha value of the specified color to @c 255.
1012 result SetSectionColor(const Tizen::Graphics::Color& color);
1015 * Gets the color of a section.
1019 * @return The section color, @n
1020 * else RGBA(0, 0, 0, 0) if the instance is invalid
1022 Tizen::Graphics::Color GetSectionColor(void) const;
1025 * Sets the color of a division line between items.
1029 * @return An error code
1030 * @param[in] color The division line color
1031 * @exception E_SUCCESS The method is successful.
1032 * @exception E_SYSTEM A system error has occurred.
1034 result SetItemDividerColor(const Tizen::Graphics::Color& color);
1037 * Gets the color of a division line between items.
1041 * @return The color of a division line, @n
1042 * else RGBA(0, 0, 0, 0) if the instance is invalid
1044 Tizen::Graphics::Color GetItemDividerColor(void) const;
1047 * Sets the background color of this control.
1051 * @return An error code
1052 * @param[in] color The background color
1053 * @exception E_SUCCESS The method is successful.
1054 * @remarks If the device does not support the 32-bit color space, the method sets the alpha value of the specified color to @c 255. @n
1055 * The background bitmap has priority over the background color. When both the background bitmap and the background color are specified,
1056 * only the bitmap image is displayed.
1058 result SetBackgroundColor(const Tizen::Graphics::Color& color);
1061 * Gets the background color of this control.
1065 * @return The background color, @n
1066 * else RGBA(0, 0, 0, 0) if the instance is invalid
1068 Tizen::Graphics::Color GetBackgroundColor(void) const;
1071 * Sets the bitmap of this control.
1075 * @return An error code
1076 * @param[in] pBitmap The bitmap for the list
1077 * @exception E_SUCCESS The method is successful.
1078 * @exception E_SYSTEM A system error has occurred.
1080 result SetBackgroundBitmap(const Tizen::Graphics::Bitmap* pBitmap);
1083 * Sets the bitmap of the empty list.
1087 * @return An error code
1088 * @param[in] pBitmap The bitmap for the empty list
1089 * @exception E_SUCCESS The method is successful.
1090 * @exception E_SYSTEM A system error has occurred.
1092 result SetBitmapOfEmptyList(const Tizen::Graphics::Bitmap* pBitmap);
1095 * Sets the text of the empty list.
1099 * @return An error code
1100 * @param[in] text The text for the empty list
1101 * @exception E_SUCCESS The method is successful.
1102 * @exception E_SYSTEM A system error has occurred.
1104 result SetTextOfEmptyList(const Tizen::Base::String& text);
1107 * Gets the text to display when there is no item in a list.
1111 * @return The text to be displayed, @n
1112 * else an empty string when the instance is invalid
1114 Tizen::Base::String GetTextOfEmptyList(void) const;
1117 * Sets the color of the text to be displayed when there is no item in a list.
1121 * @return An error code
1122 * @param[in] color The color of the text to be displayed
1123 * @exception E_SUCCESS The method is successful.
1124 * @exception E_SYSTEM A system error has occurred.
1126 result SetTextColorOfEmptyList(const Tizen::Graphics::Color& color);
1129 * Gets the color of the text to be displayed when there is no item in a list.
1133 * @return The color of the text to be displayed, @n
1134 * else RGBA(0, 0, 0, 0) if the instance is invalid
1136 Tizen::Graphics::Color GetTextColorOfEmptyList(void) const;
1139 * Expands the group's items.
1143 * @return An error code
1144 * @param[in] groupIndex The index of the group
1145 * @exception E_SUCCESS The method is successful.
1146 * @exception E_OUT_OF_RANGE A specified input parameter is invalid.
1147 * @exception E_SYSTEM A system error has occurred.
1148 * @remarks This method should be called only after list items are created. If this method needs to be called early in the lifecycle of the ListView, then UpdateList() method should be called explicitly (e.g. during Tizen::Ui::Control::OnInitializing()).
1150 result ExpandGroup(int groupIndex);
1153 * Collapses the group's items.
1157 * @return An error code
1158 * @param[in] groupIndex The index of the group
1159 * @exception E_SUCCESS The method is successful.
1160 * @exception E_OUT_OF_RANGE A specified input parameter is invalid.
1161 * @exception E_SYSTEM A system error has occurred.
1162 * @remarks This method should be called only after list items are created. If this method needs to be called early in the lifecycle of the ListView, then UpdateList() method should be called explicitly (e.g. during Tizen::Ui::Control::OnInitializing()).
1164 result CollapseGroup(int groupIndex);
1167 * Checks whether the group is expanded.
1171 * @return @c true if the group is expanded, @n
1174 * @param[in] groupIndex The index of the group
1175 * @remarks This method should be called only after list items are created. If this method needs to be called early in the lifecycle of the ListView, then UpdateList() method should be called explicitly (e.g. during Tizen::Ui::Control::OnInitializing()).
1177 bool IsGroupExpanded(int groupIndex) const;
1180 * Expands all groups of list.
1184 * @exception E_SUCCESS The method is successful.
1185 * @exception E_INVALID_OPERATION The feature of expanding all groups is only supported when %GroupedListView% is constructed with GroupedListViewStyle::GROUPED_LIST_VIEW_STYLE_INDEXED style.
1186 * @see GroupedListView::Construct()
1188 result ExpandAllGroups(void);
1191 * Collapses all groups of list.
1195 * @exception E_SUCCESS The method is successful.
1196 * @exception E_INVALID_OPERATION The feature of collapsing all groups is only supported when %GroupedListView% is constructed with GroupedListViewStyle::GROUPED_LIST_VIEW_STYLE_INDEXED style.
1197 * @see GroupedListView::Construct()
1199 result CollapseAllGroups(void);
1202 * Begins the reordering mode.
1206 * @return An error code
1207 * @exception E_SUCCESS The method is successful.
1208 * @exception E_INVALID_OPERATION The reordering mode is only supported when %GroupedListView% is constructed with GroupedListViewStyle::GROUPED_LIST_VIEW_STYLE_INDEXED style.
1209 * @see GroupedListView::Construct()
1210 * @see IGroupedListViewItemEventListener::OnGroupedListViewItemReordered()
1212 result BeginReorderingMode(void);
1215 * Ends the reordering mode.
1219 * @return An error code
1220 * @exception E_SUCCESS The method is successful.
1221 * @exception E_INVALID_OPERATION The reordering mode is only supported when %GroupedListView% is constructed with GroupedListViewStyle::GROUPED_LIST_VIEW_STYLE_INDEXED style.
1222 * @see GroupedListView::Construct()
1223 * @see IGroupedListViewItemEventListener::OnGroupedListViewItemReordered()
1225 result EndReorderingMode(void);
1228 * Checks whether the %GroupedListView control is in reordering mode.
1232 * @return @c true if the %GroupedListView is in reordering mode,
1235 bool IsInReorderingMode(void) const;
1238 * Sets the scroll input handling mode.
1242 * @param[in] mode The scroll input handling mode
1243 * @see GetScrollInputMode()
1245 void SetScrollInputMode(ScrollInputMode mode);
1248 * Gets the scroll input handling mode.
1252 * @return The scroll input handling mode
1253 * @see SetScrollInputMode()
1255 ScrollInputMode GetScrollInputMode(void) const;
1258 * Opens the context item at the specified index.
1262 * @return An error code
1263 * @param[in] groupIndex The group index
1264 * @param[in] itemIndex The item index
1265 * @exception E_SUCCESS The method is successful.
1266 * @exception E_OUT_OF_RANGE A specified input parameter is invalid.
1267 * @exception E_INVALID_OPERATION The current state of the instance prohibits the execution of the specified operation.
1269 result OpenContextItem(int groupIndex, int itemIndex);
1272 * Closes the context item at the specified index.
1276 * @return An error code
1277 * @param[in] groupIndex The group index
1278 * @param[in] itemIndex The item index
1279 * @exception E_SUCCESS The method is successful.
1280 * @exception E_OUT_OF_RANGE A specified input parameter is invalid.
1281 * @exception E_INVALID_OPERATION The current state of the instance prohibits the execution of the specified operation.
1283 result CloseContextItem(int groupIndex, int itemIndex);
1286 * Returns whether the context item at the specified index is opened.
1290 * @return @c true if the context item is opened, else @c false
1291 * @param[in] groupIndex The group index
1292 * @param[in] itemIndex The item index
1293 * @exception E_SUCCESS The method is successful.
1294 * @exception E_OUT_OF_RANGE A specified input parameter is invalid.
1296 bool IsContextItemOpened(int groupIndex, int itemIndex) const;
1299 friend class _GroupedListViewImpl;
1303 // The implementation of this copy constructor is intentionally blank and declared as private to prohibit copying of objects.
1305 GroupedListView(const GroupedListView& rhs);
1308 // The implementation of this copy assignment operator is intentionally blank and declared as private to prohibit copying of objects.
1310 GroupedListView& operator =(const GroupedListView& rhs);
1312 }; // GroupedListView
1314 }}} // Tizen::Ui::Controls
1316 #endif // _FUI_CTRL_GROUPED_LIST_VIEW_H_