Merge "Unchecked GetCharacter func when index is over string length" into tizen_2.2
[platform/framework/native/uifw.git] / inc / FUiCtrlISectionTableViewItemProvider.h
1 //
2 // Open Service Platform
3 // Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
4 //
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
8 //
9 //     http://www.apache.org/licenses/LICENSE-2.0/
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::SetItemProvider() method.
43 */
44 class _OSP_EXPORT_ ISectionTableViewItemProvider
45 {
46 public:
47         /**
48         * This polymorphic destructor should be overridden if required.@n
49         * 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 ~ISectionTableViewItemProvider(void) {}
54
55         /**
56         * Gets the total number of sections.
57         *
58         * @since 2.0
59         *
60         * @return The total number of sections
61         * @remarks  This method must be implemented so that it returns the total number of groups in the SectionTableView control.
62         */
63         virtual int GetSectionCount(void) = 0;
64
65         /**
66         * Gets the total number of items in the specified section.
67         *
68         * @since 2.0
69         *
70         * @return  The total number of items in the specified section
71         * @param[in] sectionIndex  The index of the section
72         * @remarks  This method must be implemented so that it returns the total number of items for the specified section in the %SectionTableView control.
73         */
74         virtual int GetItemCount(int sectionIndex) = 0;
75
76         /**
77         * Creates the specified item.
78         *
79         * @since 2.0
80         *
81         * @return An item of the SectionTableView
82         * @param[in] sectionIndex         The section index
83         * @param[in] itemIndex            The item index
84         * @param[in] itemWidth            The width of the item
85         * @remarks
86         *                       - An application that uses the SectionTableView control must implement this method.
87         *                       - This method is expected to return an item that is allocated on a heap memory.
88         *                       - The returned item can be a simple or custom item.
89         *                       - The returned item should not be a null pointer.
90         *                       - Note that when the item is not required, the %SectionTableView control calls ISectionTableViewItemProvider::DeleteItem() and the application
91         *                       deallocates the item.
92         * @see     DeleteItem()
93         */
94         virtual TableViewItem* CreateItem(int sectionIndex, int itemIndex, int itemWidth) = 0;
95
96         /**
97         * Deletes the specified item.
98         *
99         * @since 2.0
100         *
101         * @return @c true if the item is deallocated by this method, @n
102         *         else @c false
103         * @param[in] sectionIndex         The section index
104         * @param[in] itemIndex            The item index
105         * @param[in] pItem                The pointer to TableViewItem to delete
106         * @remarks
107         *                       - An application that uses the SectionTableView control must implement this method.
108         *                       - Using this method, an application can deallocate the item.
109         *                       - If the application deallocates the item, this method must return true. This notifies the %SectionTableView control not to release the
110         *                       item. Otherwise, the item is deallocated by the %SectionTableView control.
111         * @see     CreateItem()
112         */
113         virtual bool DeleteItem(int sectionIndex, int itemIndex, TableViewItem* pItem) = 0;
114
115         /**
116         * Updates the specified item.
117         *
118         * @since 2.0
119         *
120         * @param[in] sectionIndex         The section index
121         * @param[in] itemIndex            The item index
122         * @param[in] pItem                The pointer to TableViewItem to update
123         * @remarks
124         *                       - An application that uses the SectionTableView control must implement this method.
125         *                       - This method is called when the modification of an item is requested.
126         *                       - The application can change @c pItem in this method, but should not keep @c pItem for later use.
127         */
128         virtual void UpdateItem(int sectionIndex, int itemIndex, TableViewItem* pItem) = 0;
129
130         /**
131         * Gets the header text of a specified section.
132         *
133         * @since 2.0
134         *
135         * @return The section header text of specified section
136         * @param[in] sectionIndex  The index of the group
137         * @remarks
138         *                       - An application that uses the SectionTableView control must implement this method.
139         *                       - The header text will be aligned left
140         */
141         virtual Tizen::Base::String GetSectionHeader(int sectionIndex) = 0;
142
143         /**
144         * Returns whether the section has the section header or not.
145         *
146         * @since 2.0
147         *
148         * @return @c true if the section has an header, @n
149         *         else @c false
150         * @param[in] sectionIndex  The index of the section
151         * @remarks An application that uses the SectionTableView control must implement this method.
152         */
153         virtual bool HasSectionHeader(int sectionIndex) = 0;
154
155         /**
156         * Gets the footer text of a specified section.
157         *
158         * @since 2.0
159         *
160         * @return The footer text of specified section
161         * @param[in] sectionIndex  The index of the section
162         * @remarks
163         *                       - An application that uses the SectionTableView control must implement this method.
164         *                       - The footer text will be aligned right.
165         */
166         virtual Tizen::Base::String GetSectionFooter(int sectionIndex) = 0;
167
168         /**
169         * Returns whether the section has the footer or not.
170         *
171         * @since 2.0
172         *
173         * @return @c true, if the section has the footer @n
174         *         @c false,
175         * @param[in] sectionIndex  The index of the section
176         * @remarks An application that uses the SectionTableView control must implement this method.
177         */
178         virtual bool HasSectionFooter(int sectionIndex) = 0;
179
180         /**
181         * Gets the default height of an item.
182         *
183         * @since 2.0
184         *
185         * @return  The default height of an item
186         * @remarks This method must be implemented so that it returns the default height of items in the SectionTableView control.
187         */
188         virtual int GetDefaultItemHeight(void) = 0;
189
190 protected:
191         //
192         // This method is for internal use only. Using this method can cause behavioral, security-related,
193         // and consistency-related issues in the application.
194         //
195         // This method is reserved and may change its name at any time without prior notice.
196         //
197         // @since 2.0
198         //
199         virtual void ISectionTableViewItemProvider_Reserved1(void) {}
200
201         //
202         // This method is for internal use only. Using this method can cause behavioral, security-related,
203         // and consistency-related issues in the application.
204         //
205         // This method is reserved and may change its name at any time without prior notice.
206         //
207         // @since 2.0
208         //
209         virtual void ISectionTableViewItemProvider_Reserved2(void) {}
210
211         //
212         // This method is for internal use only. Using this method can cause behavioral, security-related,
213         // and consistency-related issues in the application.
214         //
215         // This method is reserved and may change its name at any time without prior notice.
216         //
217         // @since 2.0
218         //
219         virtual void ISectionTableViewItemProvider_Reserved3(void) {}
220 }; // ISectionTableViewItemProvider
221
222 }}} // Tizen::Ui::Controls
223
224 #endif // _FUI_CTRL_ISECTION_TABLE_VIEW_ITEM_PROVIDER_H_