2 * @defgroup Index Index
5 * @image html img/widget/index/preview-00.png
6 * @image latex img/widget/index/preview-00.eps
8 * An index widget gives you an index for fast access to whichever
9 * group of other UI items one might have. It's a list of text
10 * items (usually letters, for alphabetically ordered access).
12 * Index widgets are by default hidden and just appear when the
13 * user clicks over it's reserved area in the canvas. In its
14 * default theme, it's an area one @ref Fingers "finger" wide on
15 * the right side of the index widget's container.
17 * When items on the index are selected, smart callbacks get
18 * called, so that its user can make other container objects to
19 * show a given area or child object depending on the index item
20 * selected. You'd probably be using an index together with @ref
21 * List "lists", @ref Genlist "generic lists" or @ref Gengrid
24 * This widget inherits from the @ref Layout one, so that all the
25 * functions acting on it also work for index objects.
27 * This widget emits the following signals, besides the ones sent from
29 * - @c "changed" - When the selected index item changes. @c
30 * event_info is the selected item's data pointer.
31 * - @c "delay,changed" - When the selected index item changes, but
32 * after a small idling period. @c event_info is the selected
33 * item's data pointer.
34 * - @c "selected" - When the user releases a mouse button and
35 * selects an item. @c event_info is the selected item's data
37 * - @c "level,up" - when the user moves a finger from the first
38 * level to the second level
39 * - @c "level,down" - when the user moves a finger from the second
40 * level to the first level
42 * The @c "delay,changed" event is so that it'll wait a small time
43 * before actually reporting those events and, moreover, just the
44 * last event happening on those time frames will actually be
47 * Here are some examples on its usage:
48 * @li @ref index_example_01
49 * @li @ref index_example_02
58 * Add a new index widget to the given parent Elementary
61 * @param parent The parent object
62 * @return a new index widget handle or @c NULL, on errors
64 * This function inserts a new index widget on the canvas.
68 EAPI Evas_Object *elm_index_add(Evas_Object *parent);
71 * Enable or disable auto hiding feature for a given index widget.
73 * @param obj The index object
74 * @param disabled @c EINA_TRUE to disable auto hiding, @c EINA_FALSE to enable
76 * @see elm_index_autohide_disabled_get()
80 EAPI void elm_index_autohide_disabled_set(Evas_Object *obj, Eina_Bool disabled);
83 * Get whether auto hiding feature is enabled or not for a given index widget.
85 * @param obj The index object
86 * @return @c EINA_TRUE, if auto hiding is disabled, @c EINA_FALSE otherwise
88 * @see elm_index_autohide_disabled_set() for more details
92 EAPI Eina_Bool elm_index_autohide_disabled_get(const Evas_Object *obj);
95 * Set the items level for a given index widget.
97 * @param obj The index object.
98 * @param level @c 0 or @c 1, the currently implemented levels.
100 * @see elm_index_item_level_get()
104 EAPI void elm_index_item_level_set(Evas_Object *obj, int level);
107 * Get the items level set for a given index widget.
109 * @param obj The index object.
110 * @return @c 0 or @c 1, which are the levels @p obj might be at.
112 * @see elm_index_item_level_set() for more information
116 EAPI int elm_index_item_level_get(const Evas_Object *obj);
119 * Set the selected state of an item.
121 * @param it The index item
122 * @param selected The selected state
124 * This sets the selected state of the given item @p it.
125 * @c EINA_TRUE for selected, @c EINA_FALSE for not selected.
127 * If a new item is selected the previously selected will be unselected.
128 * Previously selected item can be get with function
129 * elm_index_selected_item_get().
131 * Selected items will be highlighted.
133 * @see elm_index_selected_item_get()
137 EAPI void elm_index_item_selected_set(Elm_Object_Item *it, Eina_Bool selected);
140 * Returns the last selected item, for a given index widget.
142 * @param obj The index object.
143 * @param level @c 0 or @c 1, the currently implemented levels.
144 * @return The last item @b selected on @p obj (or @c NULL, on errors).
148 EAPI Elm_Object_Item *elm_index_selected_item_get(const Evas_Object *obj, int level);
151 * Append a new item on a given index widget.
153 * @param obj The index object.
154 * @param letter Letter under which the item should be indexed
155 * @param func The function to call when the item is selected.
156 * @param data The item data to set for the index's item
157 * @return A handle to the item added or @c NULL, on errors
159 * Despite the most common usage of the @p letter argument is for
160 * single char strings, one could use arbitrary strings as index
163 * @c item will be the pointer returned back on @c "changed", @c
164 * "delay,changed" and @c "selected" smart events.
168 EAPI Elm_Object_Item *elm_index_item_append(Evas_Object *obj, const char *letter, Evas_Smart_Cb func, const void *data);
171 * Prepend a new item on a given index widget.
173 * @param obj The index object.
174 * @param letter Letter under which the item should be indexed
175 * @param func The function to call when the item is selected.
176 * @param data The item data to set for the index's item
177 * @return A handle to the item added or @c NULL, on errors
179 * Despite the most common usage of the @p letter argument is for
180 * single char strings, one could use arbitrary strings as index
183 * @c item will be the pointer returned back on @c "changed", @c
184 * "delay,changed" and @c "selected" smart events.
188 EAPI Elm_Object_Item *elm_index_item_prepend(Evas_Object *obj, const char *letter, Evas_Smart_Cb func, const void *data);
191 * Insert a new item into the index object after item @p after.
193 * @param obj The index object.
194 * @param after The index item to insert after.
195 * @param letter Letter under which the item should be indexed
196 * @param func The function to call when the item is clicked.
197 * @param data The item data to set for the index's item
198 * @return A handle to the item added or @c NULL, on errors
200 * Despite the most common usage of the @p letter argument is for
201 * single char strings, one could use arbitrary strings as index
204 * @c item will be the pointer returned back on @c "changed", @c
205 * "delay,changed" and @c "selected" smart events.
207 * @note If @p relative is @c NULL this function will behave as
208 * elm_index_item_append().
212 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);
215 * Insert a new item into the index object before item @p before.
217 * @param obj The index object.
218 * @param before The index item to insert after.
219 * @param letter Letter under which the item should be indexed
220 * @param func The function to call when the item is clicked.
221 * @param data The item data to set for the index's item
222 * @return A handle to the item added or @c NULL, on errors
224 * Despite the most common usage of the @p letter argument is for
225 * single char strings, one could use arbitrary strings as index
228 * @c item will be the pointer returned back on @c "changed", @c
229 * "delay,changed" and @c "selected" smart events.
231 * @note If @p relative is @c NULL this function will behave as
232 * elm_index_item_prepend().
236 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);
239 * Insert a new item into the given index widget, using @p cmp_func
240 * function to sort items (by item handles).
242 * @param obj The index object.
243 * @param letter Letter under which the item should be indexed
244 * @param func The function to call when the item is clicked.
245 * @param data The item data to set for the index's item
246 * @param cmp_func The comparing function to be used to sort index
247 * items <b>by index item handles</b>
248 * @param cmp_data_func A @b fallback function to be called for the
249 * sorting of index items <b>by item data</b>). It will be used
250 * when @p cmp_func returns @c 0 (equality), which means an index
251 * item with provided item data already exists. To decide which
252 * data item should be pointed to by the index item in question, @p
253 * cmp_data_func will be used. If @p cmp_data_func returns a
254 * non-negative value, the previous index item data will be
255 * replaced by the given @p item pointer. If the previous data need
256 * to be freed, it should be done by the @p cmp_data_func function,
257 * because all references to it will be lost. If this function is
258 * not provided (@c NULL is given), index items will be @b
259 * duplicated, if @p cmp_func returns @c 0.
260 * @return A handle to the item added or @c NULL, on errors
262 * Despite the most common usage of the @p letter argument is for
263 * single char strings, one could use arbitrary strings as index
266 * @c item will be the pointer returned back on @c "changed", @c
267 * "delay,changed" and @c "selected" smart events.
271 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);
274 * Find a given index widget's item, <b>using item data</b>.
276 * @param obj The index object
277 * @param data The item data pointed to by the desired index item
278 * @return The index item handle, if found, or @c NULL otherwise
282 EAPI Elm_Object_Item *elm_index_item_find(Evas_Object *obj, const void *data);
285 * Removes @b all items from a given index widget.
287 * @param obj The index object.
289 * If deletion callbacks are set, via elm_object_item_del_cb_set(),
290 * that callback function will be called for each item in @p obj.
294 EAPI void elm_index_item_clear(Evas_Object *obj);
297 * Go to a given items level on a index widget
299 * @param obj The index object
300 * @param level The index level (one of @c 0 or @c 1)
304 EAPI void elm_index_level_go(Evas_Object *obj, int level);
307 * Get the letter (string) set on a given index widget item.
309 * @param item The index item handle
310 * @return The letter string set on @p it
314 EAPI const char *elm_index_item_letter_get(const Elm_Object_Item *item);
317 * Set the indicator as to be disabled.
319 * @param obj The index object
320 * @param disabled @c EINA_TRUE to disable it, @c EINA_FALSE to enable it
322 * In Index widget, Indicator notes popup text, which shows a letter has been selecting.
324 * @see elm_index_indicator_disabled_get()
328 EAPI void elm_index_indicator_disabled_set(Evas_Object *obj, Eina_Bool disabled);
331 * Get the value of indicator's disabled status.
333 * @param obj The index object
334 * @return EINA_TRUE if the indicator is disabled.
336 * @see elm_index_indicator_disabled_set()
340 EAPI Eina_Bool elm_index_indicator_disabled_get(const Evas_Object *obj);
343 * Enable or disable horizontal mode on the index object
345 * @param obj The index object.
346 * @param horizontal @c EINA_TRUE to enable horizontal or @c EINA_FALSE to
347 * disable it, i.e., to enable vertical mode. it's an area one @ref Fingers
348 * "finger" wide on the bottom side of the index widget's container.
350 * @note Vertical mode is set by default.
352 * On horizontal mode items are displayed on index from left to right,
353 * instead of from top to bottom. Also, the index will scroll horizontally.
355 * @see elm_index_horizontal_get()
359 EAPI void elm_index_horizontal_set(Evas_Object *obj, Eina_Bool horizontal);
362 * Get a value whether horizontal mode is enabled or not.
364 * @param obj The index object.
365 * @return @c EINA_TRUE means horizontal mode selection is enabled.
366 * @c EINA_FALSE indicates it's disabled. If @p obj is @c NULL,
367 * @c EINA_FALSE is returned.
369 * @see elm_index_horizontal_set() for details.
373 EAPI Eina_Bool elm_index_horizontal_get(const Evas_Object *obj);