Fork for IVI: mesa fixing
[profile/ivi/uifw.git] / inc / FUiCtrlIGroupedListViewItemProvider.h
1 //
2 // Open Service Platform
3 // Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
4 //
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
8 //
9 //     http://floralicense.org/license/
10 //
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.
16 //
17
18
19 /**
20  * @file        FUiCtrlIGroupedListViewItemProvider.h
21  * @brief       This is the header file for the %IGroupedListViewItemProvider interface.
22  *
23  * This header file contains the declarations of the %IGroupedListViewItemProvider interface. @n
24  * If an event is generated, a method of this class is called. @n
25  * Therefore, if an application performs jobs related to the item events, it uses the methods of this class.
26  *
27  */
28 #ifndef _FUI_CTRL_IGROUPED_LIST_VIEW_ITEM_PROVIDER_H_
29 #define _FUI_CTRL_IGROUPED_LIST_VIEW_ITEM_PROVIDER_H_
30
31 #include <FUiCtrlGroupItem.h>
32 #include <FUiCtrlListItemBase.h>
33
34 namespace Tizen {namespace Ui { namespace Controls
35 {
36
37 /**
38  * @interface   IGroupedListViewItemProvider
39  * @brief               This interface implements the provider for the events generated by the GroupedListView control.
40  *
41  * @since               2.0
42  *
43  * The %IGroupedListViewItemProvider interface is the interface for handling GroupedListView items.
44  * The class that handles list items implements this interface, and the instance created using the GroupedListView's Construct()
45  * method.
46  *
47  * For more information on the class features, see <a href="../org.tizen.native.appprogramming/html/guide/ui/implementing_listviews.htm">ListViews</a>.
48  */
49 class _OSP_EXPORT_ IGroupedListViewItemProvider
50 {
51 // Operation
52 public:
53         /**
54          * This polymorphic destructor should be overridden if required.
55          * This way, the destructors of the derived classes are called
56          * when the destructor of this interface is called.
57          *
58          * @since       2.0
59          */
60         virtual ~IGroupedListViewItemProvider(void) {}
61
62         /**
63          * Gets the total number of groups.
64          *
65          * @since       2.0
66          *
67          * @return      The total number of groups
68          * @remarks  This method must be implemented so that it returns the total number of groups in the GroupedListView control.
69          */
70         virtual int GetGroupCount(void) = 0;
71
72         /**
73          * Gets the total number of items in the specified group.
74          *
75          * @since       2.0
76          *
77          * @return  The total number of items in the specified group
78          * @param[in] groupIndex                The index of the group
79          * @remarks  This method must be implemented so that it returns the total number of items for the specified group in the GroupedListView control.
80          */
81         virtual int GetItemCount(int groupIndex) = 0;
82
83         /**
84          * Creates the group item for the specified index from the item provider.
85          *
86          * @since       2.0
87          *
88          * @return  A group item of the GroupedListView control
89          * @param[in] groupIndex        The index of the group
90          * @param[in] itemWidth         The width of the item
91          * @remarks     An application that uses the GroupedListView control must implement this method. This method is expected to return a group item that is
92          *                      allocated on a heap memory. @n
93          *                      Note that when the item is not required, the GroupedListView control calls %IGroupedListViewItemProvider::DeleteGroupItem() and the
94          *                      application deallocates the item.
95          */
96         virtual Tizen::Ui::Controls::GroupItem* CreateGroupItem(int groupIndex, int itemWidth) = 0;
97
98         /**
99          * Deletes the specified group item.
100          *
101          * @since       2.0
102          *
103          * @return  @c true if the item is deallocated by this method, @n
104          *          else @c false
105          * @param[in] groupIndex        The index of the group
106          * @param[in] pItem             The pointer to GroupItem that is to be deleted
107          * @param[in] itemWidth         The width of the item
108          * @remarks  An application that uses the %GroupedListView control must implement this method. @n
109          *                      Using this method, an application can deallocate the item. @n
110          *                      If an application deallocates the item, this method must return true. This notifies the GroupedListView control not to release the
111          *                      item. Otherwise, the item is deallocated by the GroupedListView control.
112          * @see     CreateItem()
113          */
114         virtual bool DeleteGroupItem(int groupIndex, Tizen::Ui::Controls::GroupItem* pItem, int itemWidth) = 0;
115
116         /**
117          * Creates the specified item.
118          *
119          * @since       2.0
120          *
121          * @return      An item of the list
122          * @param[in] groupIndex        The index of the group
123          * @param[in] itemIndex         The index of the item
124          * @param[in] itemWidth                 The width of the item
125          * @remarks  An application that uses the GroupedListView control must implement this method. @n
126          *                      This method is expected to return an item that is allocated on a heap memory. @n
127          *                      The returned item can be a simple or custom item. @n
128          *                      Note that when the item is not required, the GroupedListView control calls %IGroupedListViewItemProvider::DeleteItem() and the application
129          *                      deallocates the item.
130          * @see     DeleteItem()
131          */
132         virtual Tizen::Ui::Controls::ListItemBase* CreateItem(int groupIndex, int itemIndex, int itemWidth) = 0;
133
134         /**
135          * Deletes the specified item.
136          *
137          * @since       2.0
138          *
139          * @return      @c true if the item is deallocated by this method, @n
140          *                      else @c false
141          * @param[in] groupIndex        The index of the group
142          * @param[in] itemIndex         The index of the item
143          * @param[in] pItem             The pointer to ListItemBase that is to be deleted
144          * @param[in] itemWidth         The width of the item
145          * @remarks  An application that uses the GroupedListView control must implement this method. @n
146          *                      Using this method, an application can deallocate the item. @n
147          *                      If the application deallocates the item, this method must return true. This notifies the %GroupedListView control not to release the
148          *                      item. Otherwise, the item is deallocated by the %GroupedListView control.
149          * @see     CreateItem()
150          */
151         virtual bool DeleteItem(int groupIndex, int itemIndex, Tizen::Ui::Controls::ListItemBase* pItem, int itemWidth) = 0;
152
153
154         /**
155          * Checks whether the item can be reordered.
156          *
157          * @since 2.0
158          *
159          * @return @c true if the item can be reordered, else @c false
160          * @param[in] groupIndexFrom The source group index of the item
161          * @param[in] groupIndexTo The target group index of the item
162          */
163         virtual bool IsReorderable(int groupIndexFrom, int groupIndexTo);
164
165 protected:
166         //
167         // Following methods are reserved and may change its name at any time without prior notice.
168         //
169         virtual void IGroupedListViewItemProvider_Reserved1(void) {}
170         virtual void IGroupedListViewItemProvider_Reserved2(void) {}
171         virtual void IGroupedListViewItemProvider_Reserved3(void) {}
172 }; // IGroupedListViewItemProvider
173
174 }}} // Tizen::Ui::Controls
175
176 #endif // _FUI_CTRL_IGROUPED_LIST_VIEW_ITEM_PROVIDER_H_