[elementary/index] Some APIs were modified or removed + fix build
[framework/uifw/elementary.git] / src / lib / elm_index.h
1 /**
2  * @defgroup Index Index
3  *
4  * @image html img/widget/index/preview-00.png
5  * @image latex img/widget/index/preview-00.eps
6  *
7  * An index widget gives you an index for fast access to whichever
8  * group of other UI items one might have. It's a list of text
9  * items (usually letters, for alphabetically ordered access).
10  *
11  * Index widgets are by default hidden and just appear when the
12  * user clicks over it's reserved area in the canvas. In its
13  * default theme, it's an area one @ref Fingers "finger" wide on
14  * the right side of the index widget's container.
15  *
16  * When items on the index are selected, smart callbacks get
17  * called, so that its user can make other container objects to
18  * show a given area or child object depending on the index item
19  * selected. You'd probably be using an index together with @ref
20  * List "lists", @ref Genlist "generic lists" or @ref Gengrid
21  * "general grids".
22  *
23  * Smart events one  can add callbacks for are:
24  * - @c "changed" - When the selected index item changes. @c
25  *      event_info is the selected item's data pointer.
26  * - @c "delay,changed" - When the selected index item changes, but
27  *      after a small idling period. @c event_info is the selected
28  *      item's data pointer.
29  * - @c "selected" - When the user releases a mouse button and
30  *      selects an item. @c event_info is the selected item's data
31  *      pointer.
32  * - @c "level,up" - when the user moves a finger from the first
33  *      level to the second level
34  * - @c "level,down" - when the user moves a finger from the second
35  *      level to the first level
36  *
37  * The @c "delay,changed" event is so that it'll wait a small time
38  * before actually reporting those events and, moreover, just the
39  * last event happening on those time frames will actually be
40  * reported.
41  *
42  * Here are some examples on its usage:
43  * @li @ref index_example_01
44  * @li @ref index_example_02
45  */
46
47 /**
48  * @addtogroup Index
49  * @{
50  */
51
52 /**
53  * Add a new index widget to the given parent Elementary
54  * (container) object
55  *
56  * @param parent The parent object
57  * @return a new index widget handle or @c NULL, on errors
58  *
59  * This function inserts a new index widget on the canvas.
60  *
61  * @ingroup Index
62  */
63 EAPI Evas_Object          *elm_index_add(Evas_Object *parent);
64
65 /**
66  * Enable or disable auto hiding feature for a given index widget.
67  *
68  * @param obj The index object
69  * @param disabled @c EINA_TRUE to disable auto hiding, @c EINA_FALSE to enable
70  *
71  * @see elm_index_autohide_disabled_get()
72  *
73  * @ingroup Index
74  */
75 EAPI void                  elm_index_autohide_disabled_set(Evas_Object *obj, Eina_Bool disabled);
76
77 /**
78  * Get whether auto hiding feature is enabled or not for a given index widget.
79  *
80  * @param obj The index object
81  * @return @c EINA_TRUE, if auto hiding is disabled, @c EINA_FALSE otherwise
82  *
83  * @see elm_index_active_set() for more details
84  *
85  * @ingroup Index
86  */
87 EAPI Eina_Bool             elm_index_autohide_disabled_get(const Evas_Object *obj);
88
89 /**
90  * Set the items level for a given index widget.
91  *
92  * @param obj The index object.
93  * @param level @c 0 or @c 1, the currently implemented levels.
94  *
95  * @see elm_index_item_level_get()
96  *
97  * @ingroup Index
98  */
99 EAPI void                  elm_index_item_level_set(Evas_Object *obj, int level);
100
101 /**
102  * Get the items level set for a given index widget.
103  *
104  * @param obj The index object.
105  * @return @c 0 or @c 1, which are the levels @p obj might be at.
106  *
107  * @see elm_index_item_level_set() for more information
108  *
109  * @ingroup Index
110  */
111 EAPI int                   elm_index_item_level_get(const Evas_Object *obj);
112
113 /**
114  * Returns the last selected item, for a given index widget.
115  *
116  * @param obj The index object.
117  * @return The last item @b selected on @p obj (or @c NULL, on errors).
118  *
119  * @ingroup Index
120  */
121 EAPI Elm_Object_Item      *elm_index_item_selected_get(const Evas_Object *obj, int level);
122
123 /**
124  * Append a new item on a given index widget.
125  *
126  * @param obj The index object.
127  * @param letter Letter under which the item should be indexed
128  * @param func The function to call when the item is selected.
129  * @param data The item data to set for the index's item
130  * @return A handle to the item added or @c NULL, on errors 
131  *
132  * Despite the most common usage of the @p letter argument is for
133  * single char strings, one could use arbitrary strings as index
134  * entries.
135  *
136  * @c item will be the pointer returned back on @c "changed", @c
137  * "delay,changed" and @c "selected" smart events.
138  *
139  * @ingroup Index
140  */
141 EAPI Elm_Object_Item      *elm_index_item_append(Evas_Object *obj, const char *letter, Evas_Smart_Cb func, const void *data);
142
143 /**
144  * Prepend a new item on a given index widget.
145  *
146  * @param obj The index object.
147  * @param letter Letter under which the item should be indexed
148  * @param func The function to call when the item is selected.
149  * @param data The item data to set for the index's item
150  * @return A handle to the item added or @c NULL, on errors 
151  *
152  * Despite the most common usage of the @p letter argument is for
153  * single char strings, one could use arbitrary strings as index
154  * entries.
155  *
156  * @c item will be the pointer returned back on @c "changed", @c
157  * "delay,changed" and @c "selected" smart events.
158  *
159  * @ingroup Index
160  */
161 EAPI Elm_Object_Item      *elm_index_item_prepend(Evas_Object *obj, const char *letter, Evas_Smart_Cb func, const void *data);
162
163 /**
164  * Insert a new item into the index object after item @p after.
165  *
166  * @param obj The index object.
167  * @param after The index item to insert after.
168  * @param letter Letter under which the item should be indexed
169  * @param func The function to call when the item is clicked.
170  * @param data The item data to set for the index's item
171  * @return A handle to the item added or @c NULL, on errors 
172  *
173  * Despite the most common usage of the @p letter argument is for
174  * single char strings, one could use arbitrary strings as index
175  * entries.
176  *
177  * @c item will be the pointer returned back on @c "changed", @c
178  * "delay,changed" and @c "selected" smart events.
179  *
180  * @note If @p relative is @c NULL this function will behave as
181  * elm_index_item_append().
182  *
183  * @ingroup Index
184  */
185 EAPI Elm_Object_Item      *elm_index_item_insert_after(Evas_Object *obj, Elm_Object_Item *after, const char *letter, Evas_Smart_Cb func, const void *data);
186
187 /**
188  * Insert a new item into the index object before item @p before.
189  *
190  * @param obj The index object.
191  * @param before The index item to insert after.
192  * @param letter Letter under which the item should be indexed
193  * @param func The function to call when the item is clicked.
194  * @param data The item data to set for the index's item
195  * @return A handle to the item added or @c NULL, on errors 
196  *
197  * Despite the most common usage of the @p letter argument is for
198  * single char strings, one could use arbitrary strings as index
199  * entries.
200  *
201  * @c item will be the pointer returned back on @c "changed", @c
202  * "delay,changed" and @c "selected" smart events.
203  *
204  * @note If @p relative is @c NULL this function will behave as
205  * elm_index_item_prepend().
206  *
207  * @ingroup Index
208  */
209 EAPI Elm_Object_Item      *elm_index_item_insert_before(Evas_Object *obj, Elm_Object_Item *before, const char *letter, Evas_Smart_Cb func, const void *data);
210
211 /**
212  * Insert a new item into the given index widget, using @p cmp_func
213  * function to sort items (by item handles).
214  *
215  * @param obj The index object.
216  * @param letter Letter under which the item should be indexed
217  * @param func The function to call when the item is clicked.
218  * @param data The item data to set for the index's item
219  * @param cmp_func The comparing function to be used to sort index
220  * items <b>by #index item handles</b>
221  * @param cmp_data_func A @b fallback function to be called for the
222  * sorting of index items <b>by item data</b>). It will be used
223  * when @p cmp_func returns @c 0 (equality), which means an index
224  * item with provided item data already exists. To decide which
225  * data item should be pointed to by the index item in question, @p
226  * cmp_data_func will be used. If @p cmp_data_func returns a
227  * non-negative value, the previous index item data will be
228  * replaced by the given @p item pointer. If the previous data need
229  * to be freed, it should be done by the @p cmp_data_func function,
230  * because all references to it will be lost. If this function is
231  * not provided (@c NULL is given), index items will be @b
232  * duplicated, if @p cmp_func returns @c 0.
233  * @return A handle to the item added or @c NULL, on errors 
234  *
235  * Despite the most common usage of the @p letter argument is for
236  * single char strings, one could use arbitrary strings as index
237  * entries.
238  *
239  * @c item will be the pointer returned back on @c "changed", @c
240  * "delay,changed" and @c "selected" smart events.
241  *
242  * @ingroup Index
243  */
244 EAPI Elm_Object_Item      *elm_index_item_sorted_insert(Evas_Object *obj, const char *letter, Evas_Smart_Cb func, const void *data, Eina_Compare_Cb cmp_func, Eina_Compare_Cb cmp_data_func);
245
246 /**
247  * Find a given index widget's item, <b>using item data</b>.
248  *
249  * @param obj The index object
250  * @param data The item data pointed to by the desired index item
251  * @return The index item handle, if found, or @c NULL otherwise
252  *
253  * @ingroup Index
254  */
255 EAPI Elm_Object_Item      *elm_index_item_find(Evas_Object *obj, const void *data);
256
257 /**
258  * Removes @b all items from a given index widget.
259  *
260  * @param obj The index object.
261  *
262  * If deletion callbacks are set, via elm_object_item_del_cb_set(),
263  * that callback function will be called for each item in @p obj.
264  *
265  * @ingroup Index
266  */
267 EAPI void                  elm_index_item_clear(Evas_Object *obj);
268
269 /**
270  * Go to a given items level on a index widget
271  *
272  * @param obj The index object
273  * @param level The index level (one of @c 0 or @c 1)
274  *
275  * @ingroup Index
276  */
277 EAPI void                  elm_index_level_go(Evas_Object *obj, int level);
278
279 /**
280  * Get the letter (string) set on a given index widget item.
281  *
282  * @param item The index item handle
283  * @return The letter string set on @p it
284  *
285  * @ingroup Index
286  */
287 EAPI const char           *elm_index_item_letter_get(const Elm_Object_Item *item);
288
289 /**
290  * Set the indicator as to be disabled.
291  *
292  * @param obj The index object
293  * @param disabled  @c EINA_TRUE to disable it, @c EINA_FALSE to enable it
294  *
295  * In Index widget, Indicator notes popup text, which shows a letter has been selecting.
296  *
297  * @see elm_index_indicator_disabled_get()
298  *
299  * @ingroup Index
300  */
301 EAPI void                 elm_index_indicator_disabled_set(Evas_Object *obj, Eina_Bool disabled);
302
303 /**
304  * Get the value of indicator's disabled status.
305  *
306  * @param obj The index object
307  * @return EINA_TRUE if the indicator is disabled.
308  *
309  * @see elm_index_indicator_disabled_set()
310  *
311  * @ingroup Index
312  */
313 EAPI Eina_Bool            elm_index_indicator_disabled_get(const Evas_Object *obj);
314
315 /**
316  * @}
317  */