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