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