Merge "Unchecked GetCharacter func when index is over string length" into tizen_2.2
[platform/framework/native/uifw.git] / inc / FUiCtrlIListViewItemEventListener.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        FUiCtrlIListViewItemEventListener.h
20  * @brief       This is the header file for the %IListViewItemEventListener interface.
21  *
22  * This header file contains the declarations of the %IListViewItemEventListener interface. @n
23  * If an item event is generated, a method of this interface is called. @n
24  * So, if an application does some jobs related to the item event, use the methods of this interface.
25  *
26  */
27 #ifndef _FUI_CTRL_ILIST_VIEW_ITEM_EVENT_LISTENER_H_
28 #define _FUI_CTRL_ILIST_VIEW_ITEM_EVENT_LISTENER_H_
29
30 #include <FBaseRtIEventListener.h>
31 #include <FUiCtrlListViewTypes.h>
32
33 namespace Tizen { namespace Ui { namespace Controls
34 {
35
36 class ListView;
37
38 /**
39  * @interface   IListViewItemEventListener
40  * @brief               This interface implements the listener for item event.
41  *
42  * @since               2.0
43  *
44  * The %IListViewItemEventListener interface is the listener interface for receiving ListView item events.
45  * The class that processes a list item event implements this interface, and the instance created with that class is registered
46  * with a UI control, using the control's AddListViewItemEventListener() method. When the list item event occurs, a method of that
47  * instance is invoked.
48  *
49  * For more information on the class features, see <a href="../org.tizen.native.appprogramming/html/guide/ui/implementing_listviews.htm">ListViews</a>.
50  */
51 class _OSP_EXPORT_ IListViewItemEventListener
52         : virtual public Tizen::Base::Runtime::IEventListener
53 {
54 // Operation
55 public:
56         /**
57          * This polymorphic destructor should be overridden if required. @n
58          * This way, the destructors of the derived classes are called
59          * when the destructor of this interface is called.
60          *
61          * @since       2.0
62          */
63         virtual ~IListViewItemEventListener(void) {}
64
65         /**
66          * Called when the state of an element in the ListViewItem in the ListView or GroupedListView is changed.
67          *
68          * @since       2.0
69          *
70          * @param[in] listView      The source of the event
71          * @param[in] index         The index of the list
72          * @param[in] elementId     The element ID
73          * @param[in] status        The status of the element
74          *
75          * @remarks
76          *                      - This method is called when an element of the ListViewItem in the ListView is checked, unchecked, or selected.
77          *                      - When the event comes from the annex or the whole item, @c elementId is always @c -1.
78          */
79         virtual void OnListViewItemStateChanged(Tizen::Ui::Controls::ListView& listView, int index, int elementId, Tizen::Ui::Controls::ListItemStatus status) = 0;
80
81         /**
82          * Called when the ListItem is swept.
83          *
84          * @since       2.0
85          *
86          * @param[in] listView      The source of the event
87          * @param[in] index         The index of the list
88          * @param[in] direction     The sweep direction
89          */
90         virtual void OnListViewItemSwept(Tizen::Ui::Controls::ListView& listView, int index, Tizen::Ui::Controls::SweepDirection direction) = 0;
91
92         /**
93          * Called when the state of an element in the %ListContextItem is changed.
94          *
95          * @since       2.0
96          *
97          * @param[in] listView          The source of the event
98          * @param[in] index                     The index of the list
99          * @param[in] elementId         The element ID
100          * @param[in] status        The status of the element
101          */
102         virtual void OnListViewContextItemStateChanged(Tizen::Ui::Controls::ListView& listView, int index, int elementId, Tizen::Ui::Controls::ListContextItemStatus status) = 0;
103
104         /**
105          * Called when the item or the element is long pressed.
106          *
107          * @since       2.0
108          *
109          * @param[in] listView          The source of the event
110          * @param[in] index                     The index of the list
111          * @param[in] elementId         The element ID
112          * @param[in,out] invokeListViewItemCallback    Indicates whether to invoke ListView item callback after this method returns
113          * @remarks
114          *                      - This method is invoked when an item or an element is long pressed.
115          *                      - When the event comes from the annex or the whole item, @c elementId is always @c -1.
116          *                      - Setting @c invokeListViewItemCallback to @c true invokes %ListView item callbacks after this method returns.
117          *                      - Set @c invokeListViewItemCallback to @c false to not invoke %ListView item callbacks. The default value of
118          *                      @c invokeListViewItemCallback is @c true.
119          *                      - Note that other %ListView item callbacks are not called even though @c invokeListViewItemCallback is @c true, in case that ListView
120          *                      loses the focus, for example, due to invoking a Popup or a ContextMenu in this method.
121          */
122         virtual void OnListViewItemLongPressed(Tizen::Ui::Controls::ListView& listView, int index, int elementId, bool& invokeListViewItemCallback);
123
124         /**
125          * Called when the item is reordered.
126          *
127          * @since 2.0
128          *
129          * @param[in] listView   The source of the event
130          * @param[in] indexFrom The start index of the item
131          * @param[in] indexTo The final index of the item
132          */
133         virtual void OnListViewItemReordered(Tizen::Ui::Controls::ListView& listView, int indexFrom, int indexTo);
134
135 protected:
136         //
137         // The following methods are reserved and may change its name at any time without prior notice.
138         //
139         virtual void IListViewItemEventListener_Reserved1(void) {}
140         virtual void IListViewItemEventListener_Reserved2(void) {}
141         virtual void IListViewItemEventListener_Reserved3(void) {}
142 }; // IListViewItemEventListener
143
144 }}} // Tizen::Ui::Controls
145
146 #endif // _FUI_CTRL_ILIST_VIEW_ITEM_EVENT_LISTENER_H_