Tizen 2.1 base
[framework/osp/uifw.git] / inc / FUiCtrlIGroupedTableViewItemProvider.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 * @file FUiCtrlIGroupedTableViewItemProvider.h
20 * @brief This is the header file for the %IGroupedTableViewItemProvider interface.
21 *
22 * This header file contains the declarations of the %IGroupedTableViewItemProvider interface.
23 * If the event is generated, a method of this interface is called.
24 * So, if applications do jobs related to item events, use the methods of this interface.
25 *
26 */
27 #ifndef _FUI_CTRL_IGROUPED_TABLE_VIEW_ITEM_PROVIDER_H_
28 #define _FUI_CTRL_IGROUPED_TABLE_VIEW_ITEM_PROVIDER_H_
29
30 namespace Tizen { namespace Ui { namespace Controls
31 {
32 class TableViewItem;
33 class TableViewGroupItem;
34
35 /**
36  * @interface IGroupedTableViewItemProvider
37  * @brief  This interface implements the listener for events on GroupedTableView.
38  *
39  * @since 2.0
40  *
41  * The %IGroupedTableViewItemProvider interface implements an item provider which generates items for GroupedTableView. %GroupedTableView calls the item provider
42  * to request an item which is about to be displayed on a screen. Applications which use %GroupedTableView must implement the item provider.
43  * The class is registered with a %GroupedTableView, using the GroupedTableView's SetGroupedStyleItemProvider() method.
44  */
45 class _OSP_EXPORT_ IGroupedTableViewItemProvider
46 {
47 public:
48         /**
49          * This polymorphic destructor should be overridden if required. This way, the destructors of the derived classes are called when the destructor of this interface is called.
50          *
51          * @since 2.0
52          */
53         virtual ~IGroupedTableViewItemProvider(void) {}
54
55         /**
56          * Gets the total number of groups.
57          *
58          * @since 2.0
59          *
60          * @return The total number of groups
61          * @remarks  This method must be implemented so that it returns the total number of groups in the GroupedTableView control.
62          */
63         virtual int GetGroupCount(void) = 0;
64
65         /**
66          * Gets the total number of items in the specified group.
67          *
68          * @since 2.0
69          *
70          * @return  The total number of items in the specified group
71          * @param[in] groupIndex  The index of the group
72          * @remarks  This method must be implemented so that it returns the total number of items for the specified group in the GroupedTableView control.
73          */
74         virtual int GetItemCount(int groupIndex) = 0;
75
76         /**
77          * Gets the group item for the specified index from the item provider.
78          *
79          * @since 2.0
80          *
81          * @return  A group item of the GroupedTableView control
82          * @param[in] groupIndex           The index of the group
83          * @param[in] itemWidth            The width of the item
84          * @remarks An application that uses the GroupedTableView control must implement this method. This method is expected to return a group item that is
85          *          allocated on a heap memory.
86          *          Note that when the group item is not required, the %GroupedTableView control calls IGroupedTableViewItemProvider::DeleteGroupItem() and the
87          *          application deallocates the item.
88          */
89         virtual TableViewGroupItem* CreateGroupItem(int groupIndex, int itemWidth) = 0;
90
91         /**
92          * Deletes the specified group item.
93          *
94          * @since 2.0
95          *
96          * @return  @c true if the group item is deallocated by this method,
97          *          else @c false
98          * @param[in] groupIndex        The index of the group
99          * @param[in] pItem             The pointer to TableViewGroupItem that is to be deleted
100          * @remarks  An application that uses the GroupedTableView control must implement this method.
101          *           Using this method, an application can deallocate the item.
102          *           If an application deallocates the item, this method must return @c true. This notifies the %GroupedTableView control not to release the
103          *           item. Otherwise, the item is deallocated by the %GroupedTableView control.
104          * @see     CreateGroupItem()
105          */
106         virtual bool DeleteGroupItem(int groupIndex, TableViewGroupItem* pItem) = 0;
107
108         /**
109          * Updates the specified group item.
110          *
111          * @since 2.0
112          *
113          * @param[in] groupIndex           The group index
114          * @param[in] pItem                The pointer to TableViewGroupItem that is to be updated
115          * @remarks  An application that uses the GroupedTableView control must implement this method.
116          *           This method is called when the modification of an group item is requested.
117          *           The application can change @c pItem in this method, but should not keep @c pItem for later use.
118          */
119         virtual void UpdateGroupItem(int groupIndex, TableViewGroupItem* pItem) = 0;
120
121         /**
122          * Creates the specified item.
123          *
124          * @since 2.0
125          *
126          * @return An item of the GroupedTableView
127          * @param[in] groupIndex           The group index
128          * @param[in] itemIndex            The item index
129          * @param[in] itemWidth            The width of the item
130          * @remarks  An application that uses the GroupedTableView control must implement this method.
131          *           This method is expected to return an item that is allocated on a heap memory.
132          *           The returned item can be a simple or custom item.
133          *           Note that when the item is not required, the %GroupedTableView control calls IGroupedTableViewItemProvider::DeleteItem() and the application
134          *           deallocates the item.
135          * @see     DeleteItem()
136          */
137         virtual TableViewItem* CreateItem(int groupIndex, int itemIndex, int itemWidth) = 0;
138
139         /**
140          * Deletes the specified item.
141          *
142          * @since 2.0
143          *
144          * @return @c true if the item is deallocated by this method, @n
145          *   else @c false
146          * @param[in] groupIndex           The group index
147          * @param[in] itemIndex            The item index
148          * @param[in] pItem                The pointer to TableViewItem that is to be deleted
149          * @remarks  An application that uses the GroupedTableView control must implement this method.
150          *           Using this method, an application can deallocate the item.
151          *           If the application deallocates the item, this method must return @c true. This notifies the %GroupedTableView control not to release the
152          *           item. Otherwise, the item is deallocated by the %GroupedTableView control.
153          * @see     CreateItem()
154          */
155         virtual bool DeleteItem(int groupIndex, int itemIndex, TableViewItem* pItem) = 0;
156
157         /**
158          * Updates the specified item.
159          *
160          * @since 2.0
161          *
162          * @param[in] groupIndex                     The group index
163          * @param[in] itemIndex            The item index
164          * @param[in] pItem                            The pointer to TableViewItem that is to be updated
165          * @remarks  An application that uses the GroupedTableView control must implement this method.
166          *           This method is calle when the modification of an item is requested.
167          *           The application can change @c pItem in this method, but should not keep @c pItem for later use.
168          */
169         virtual void UpdateItem(int groupIndex, int itemIndex, TableViewItem* pItem) = 0;
170
171         /**
172          * Gets the default height of an group item.
173          *
174          * @since 2.0
175          *
176          * @return  The default height of an group item
177          * @remarks This method must be implemented so that it returns the default height of group items in the GroupedTableView control.
178          */
179         virtual int GetDefaultGroupItemHeight(void) = 0;
180
181
182         /**
183          * Gets the default height of an item.
184          *
185          * @since 2.0
186          *
187          * @return  The default height of an item
188          * @remarks This method must be implemented so that it returns the default height of items in the GroupedTableView control.
189          */
190         virtual int GetDefaultItemHeight(void) = 0;
191
192 protected:
193         //
194         // This method is for internal use only. Using this method can cause behavioral, security-related,
195         // and consistency-related issues in the application.
196         //
197         // The following method is reserved, and its name can be changed at any time without prior notice.
198         //
199         // @since 2.0
200         //
201         virtual void IGroupedTableViewItemProvider_Reserved1(void) {}
202
203         //
204         // This method is for internal use only. Using this method can cause behavioral, security-related,
205         // and consistency-related issues in the application.
206         //
207         // The following method is reserved, and its name can be changed at any time without prior notice.
208         //
209         // @since 2.0
210         //
211         virtual void IGroupedTableViewItemProvider_Reserved2(void) {}
212
213         //
214         // This method is for internal use only. Using this method can cause behavioral, security-related,
215         // and consistency-related issues in the application.
216         //
217         // The following method is reserved, and its name can be changed at any time without prior notice.
218         //
219         // @since 2.0
220         //
221         virtual void IGroupedTableViewItemProvider_Reserved3(void) {}
222 }; // IGroupedTableViewItemProvider
223
224 }}} // Tizen::Ui::Controls
225
226 #endif // _FUI_CTRL_IGROUPED_TABLE_VIEW_ITEM_PROVIDER_H_