Tizen 2.1 base
[framework/osp/uifw.git] / inc / FUiCtrlITableViewItemProvider.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 FUiCtrlITableViewItemProvider.h
20  * @brief This is the header file for the %ITableViewItemProvider interface.
21  *
22  * This header file contains the declarations of the %ITableViewItemProvider 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
28 #ifndef _FUI_CTRL_ITABLE_VIEW_ITEM_PROVIDER_H_
29 #define _FUI_CTRL_ITABLE_VIEW_ITEM_PROVIDER_H_
30
31 namespace Tizen { namespace Ui { namespace Controls
32 {
33 class TableViewItem;
34
35 /**
36  * @interface ITableViewItemProvider
37  * @brief  This interface implements the listener for events on TableView.
38  *
39  * @since 2.0
40  *
41  * The %ITableViewItemProvider interface implements an item provider which generates items for TableView. %TableView calls the item provider
42  * to request an item which is about to be displayed on a screen. Applications which use %TableView must implement the item provider.
43  * The class is registered with a %TableView, using the TableView's SetSimpleStyleItemProvider() method.
44  */
45 class _OSP_EXPORT_ ITableViewItemProvider
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 ~ITableViewItemProvider(void) {}
54
55         /**
56          * Gets the total number of items in the specified group.
57          *
58          * @since 2.0
59          *
60          * @return  The total number of items
61          * @remarks This method must be implemented so that it returns the total number of items for the specified group in the TableView control.
62          */
63         virtual int GetItemCount(void) = 0;
64
65         /**
66          * Creates the specified item.
67          *
68          * @since 2.0
69          *
70          * @return An item of the TableView
71          * @param[in] itemIndex  The item index
72          * @param[in] itemWidth The width of the item
73          * @remarks  An application that uses the TableView control must implement this method.
74          *           This method is expected to return an item that is allocated on a heap memory.
75          *           The returned item can be a %TableViewItem or a class derived from TableViewItem.
76          *           Note that when the item is not required, the %TableView control calls ITableViewItemProvider::DeleteItem(), allowing the application to deallocate the item.
77          * @see           DeleteItem()
78          */
79         virtual TableViewItem* CreateItem(int itemIndex, int itemWidth) = 0;
80
81         /**
82          * Deletes the specified item.
83          *
84          * @since 2.0
85          *
86          * @return @c true if the item is deallocated by this method, @n
87          *         else @c false
88          * @param[in] itemIndex The item index
89          * @param[in] pItem The pointer to TableViewItem that is to be deleted
90          * @remarks  An application that uses the TableView control must implement this method.
91          *           Using this method, an application can deallocate the item.
92          *           If the application deallocates the item, this method must return @c true. This notifies the %TableView not to release the
93          *           item. Otherwise, the item is deallocated by the %TableView.
94          * @see     CreateItem()
95          */
96         virtual bool DeleteItem(int itemIndex, TableViewItem* pItem) = 0;
97
98         /**
99          * Updates the specified item.
100          *
101          * @since 2.0
102          *
103          * @param[in] itemIndex  The item index
104          * @param[in] pItem The pointer to TableViewItem that is to be updated
105          * @remarks  An application that uses the TableView control must implement this method.
106          *           This method is called when the modification of an item is requested.
107          *           The application can change @c pItem in this method, but should not keep @c pItem for later use.
108          */
109         virtual void UpdateItem(int itemIndex, TableViewItem* pItem) = 0;
110
111         /**
112          * Gets the default height of an item.
113          *
114          * @since 2.0
115          *
116          * @return  The default height of an item
117          * @remarks This method must be implemented so that it returns the default height of items in the TableView control.
118          */
119         virtual int GetDefaultItemHeight(void) = 0;
120
121 protected:
122         //
123         // This method is for internal use only. Using this method can cause behavioral, security-related,
124         // and consistency-related issues in the application.
125         //
126         // The following method is reserved, and its name can be changed at any time without prior notice.
127         //
128         // @since 2.0
129         //
130         virtual void ITableViewItemProvider_Reserved1(void) {}
131
132         //
133         // This method is for internal use only. Using this method can cause behavioral, security-related,
134         // and consistency-related issues in the application.
135         //
136         // The following method is reserved, and its name can be changed at any time without prior notice.
137         //
138         // @since 2.0
139         //
140         virtual void ITableViewItemProvider_Reserved2(void) {}
141
142         //
143         // This method is for internal use only. Using this method can cause behavioral, security-related,
144         // and consistency-related issues in the application.
145         //
146         // The following method is reserved, and its name can be changed at any time without prior notice.
147         //
148         // @since 2.0
149         //
150         virtual void ITableViewItemProvider_Reserved3(void) {}
151 }; // ITableViewItemProvider
152
153 }}} // Tizen::Ui::Controls
154
155 #endif // _FUI_CTRL_ITABLE_VIEW_ITEM_PROVIDER_H_