2 // Open Service Platform
3 // Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
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
9 // http://floralicense.org/license/
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.
19 * @file FUiCtrlIListViewItemProvider.h
20 * @brief This is the header file for the %IListViewItemProvider interface.
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.
27 #ifndef _FUI_CTRL_ILIST_VIEW_ITEM_PROVIDER_H_
28 #define _FUI_CTRL_ILIST_VIEW_ITEM_PROVIDER_H_
30 #include <FUiCtrlListItemBase.h>
32 namespace Tizen {namespace Ui { namespace Controls
36 * @interface IListViewItemProvider
37 * @brief This interface implements the listener for events on %ListView.
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.
44 * For more information on the class features, see <a href="../org.tizen.native.appprogramming/html/guide/ui/implementing_listviews.htm">ListViews</a>.
46 class _OSP_EXPORT_ IListViewItemProvider
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.
57 virtual ~IListViewItemProvider(void) {}
60 * Called when the ListView is about to be drawn and returns the number of total items.
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.
68 virtual int GetItemCount(void) = 0;
71 * Called when items need to be loaded.
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.
85 virtual Tizen::Ui::Controls::ListItemBase* CreateItem(int index, int itemWidth) = 0;
88 * Called when an item becomes no longer used by the %ListView.
92 * @return @c true, if the item is deallocated by this method, @n
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.
103 virtual bool DeleteItem(int index, Tizen::Ui::Controls::ListItemBase* pItem, int itemWidth) = 0;
107 // Following methods are reserved and may change its name at any time without prior notice.
109 virtual void IListViewItemProvider_Reserved1(void) {}
110 virtual void IListViewItemProvider_Reserved2(void) {}
111 virtual void IListViewItemProvider_Reserved3(void) {}
112 }; // IListViewItemProvider
114 }}} // Tizen::Ui::Controls
116 #endif // _FUI_CTRL_ILIST_VIEW_ITEM_PROVIDER_H_