Merge "Fix Ime Rotation" into tizen_2.1
[platform/framework/native/uifw.git] / inc / FUiCtrlIListViewItemProvider.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        FUiCtrlIListViewItemProvider.h
20  * @brief       This is the header file for the %IListViewItemProvider interface.
21  *
22  * This header file contains the declarations of the %IListViewItemProvider interface. @n
23  * If the event is generated, a method of this interface is called. @n
24  * So, if applications do jobs related to item events, use the methods of this interface.
25  *
26  */
27 #ifndef _FUI_CTRL_ILIST_VIEW_ITEM_PROVIDER_H_
28 #define _FUI_CTRL_ILIST_VIEW_ITEM_PROVIDER_H_
29
30 #include <FUiCtrlListItemBase.h>
31
32 namespace Tizen {namespace Ui { namespace Controls
33 {
34
35 /**
36  * @interface   IListViewItemProvider
37  * @brief               This interface implements the listener for events on %ListView.
38  *
39  * @since               2.0
40  *
41  * The %IListViewItemProvider interface is the interface for handling ListView items.
42  * The class that handles list items implements this interface, and the instance created using the ListView's Construct() method.
43  *
44  * For more information on the class features, see <a href="../org.tizen.native.appprogramming/html/guide/ui/implementing_listviews.htm">ListViews</a>.
45  */
46 class _OSP_EXPORT_ IListViewItemProvider
47 {
48 // Operation
49 public:
50         /**
51          * This polymorphic destructor should be overridden if required.
52          * This way, the destructors of the derived classes are called
53          * when the destructor of this interface is called.
54          *
55          * @since       2.0
56          */
57         virtual ~IListViewItemProvider(void) {}
58
59         /**
60          * Called when the ListView is about to be drawn and returns the number of total items.
61          *
62          * @since       2.0
63          *
64          * @return  The count of all items of the list
65          * @remarks  This method must be implemented so that it returns the number of total items in the list.
66          *
67          */
68         virtual int GetItemCount(void) = 0;
69
70         /**
71          * Called when items need to be loaded.
72          *
73          * @since       2.0
74          *
75          * @return  An item of the ListView
76          * @param[in] index        The index of the item
77          * @param[in] itemWidth    The width of the item
78          * @remarks  The applications that use ListView must implement this method. @n
79          *                              This method is expected to return an item which is allocated in a heap memory. @n
80          *                              The returned item can be a SimpleItem or CustomItem. @n
81          *                              Note that when the item becomes unnecessary, the ListView calls IListViewItemProvider::DeleteItem() and the application is in charge of
82          *                              deallocating the item.
83          * @see     DeleteItem()
84          */
85         virtual Tizen::Ui::Controls::ListItemBase* CreateItem(int index, int itemWidth) = 0;
86
87         /**
88          * Called when an item becomes no longer used by the %ListView.
89          *
90          * @since       2.0
91          *
92          * @return  @c true, if the item is deallocated by this method, @n
93          *          else @c false
94          * @param[in] index        The index of the item
95          * @param[in] pItem        The pointer to the item to delete
96          * @param[in] itemWidth    The width of the item
97          * @remarks  Applications which use ListView must implement this method. @n
98          *                      In this method, the applications have the chance of deallocating the item. @n
99          *                      If the application deallocates the item, this method returns @c true, notifying the %ListView not to free the item. @n
100          *                      Otherwise, the item will be deallocated by %ListView.
101          * @see     CreateItem()
102          */
103         virtual bool DeleteItem(int index, Tizen::Ui::Controls::ListItemBase* pItem, int itemWidth) = 0;
104
105 protected:
106         //
107         // Following methods are reserved and may change its name at any time without prior notice.
108         //
109         virtual void IListViewItemProvider_Reserved1(void) {}
110         virtual void IListViewItemProvider_Reserved2(void) {}
111         virtual void IListViewItemProvider_Reserved3(void) {}
112 }; // IListViewItemProvider
113
114 }}} // Tizen::Ui::Controls
115
116 #endif // _FUI_CTRL_ILIST_VIEW_ITEM_PROVIDER_H_