2 * @defgroup Index Index
4 * @image html img/widget/index/preview-00.png
5 * @image latex img/widget/index/preview-00.eps
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).
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.
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
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
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
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
42 * Here are some examples on its usage:
43 * @li @ref index_example_01
44 * @li @ref index_example_02
53 * Add a new index widget to the given parent Elementary
56 * @param parent The parent object
57 * @return a new index widget handle or @c NULL, on errors
59 * This function inserts a new index widget on the canvas.
63 EAPI Evas_Object *elm_index_add(Evas_Object *parent);
66 * Enable or disable auto hiding feature for a given index widget.
68 * @param obj The index object
69 * @param disabled @c EINA_TRUE to disable auto hiding, @c EINA_FALSE to enable
71 * @see elm_index_autohide_disabled_get()
75 EAPI void elm_index_autohide_disabled_set(Evas_Object *obj, Eina_Bool disabled);
78 * Get whether auto hiding feature is enabled or not for a given index widget.
80 * @param obj The index object
81 * @return @c EINA_TRUE, if auto hiding is disabled, @c EINA_FALSE otherwise
83 * @see elm_index_autohide_disabled_set() for more details
87 EAPI Eina_Bool elm_index_autohide_disabled_get(const Evas_Object *obj);
90 * Set the items level for a given index widget.
92 * @param obj The index object.
93 * @param level @c 0 or @c 1, the currently implemented levels.
95 * @see elm_index_item_level_get()
99 EAPI void elm_index_item_level_set(Evas_Object *obj, int level);
102 * Get the items level set for a given index widget.
104 * @param obj The index object.
105 * @return @c 0 or @c 1, which are the levels @p obj might be at.
107 * @see elm_index_item_level_set() for more information
111 EAPI int elm_index_item_level_get(const Evas_Object *obj);
114 * Set the selected state of an item.
116 * @param it The index item
117 * @param selected The selected state
119 * This sets the selected state of the given item @p it.
120 * @c EINA_TRUE for selected, @c EINA_FALSE for not selected.
122 * If a new item is selected the previously selected will be unselected.
123 * Previously selected item can be get with function
124 * elm_index_selected_item_get().
126 * Selected items will be highlighted.
128 * @see elm_index_item_selected_get()
129 * @see elm_index_selected_item_get()
133 EAPI void elm_index_item_selected_set(Elm_Object_Item *it, Eina_Bool selected);
136 * Returns the last selected item, for a given index widget.
138 * @param obj The index object.
139 * @return The last item @b selected on @p obj (or @c NULL, on errors).
143 EAPI Elm_Object_Item *elm_index_selected_item_get(const Evas_Object *obj, int level);
146 * Append a new item on a given index widget.
148 * @param obj The index object.
149 * @param letter Letter under which the item should be indexed
150 * @param func The function to call when the item is selected.
151 * @param data The item data to set for the index's item
152 * @return A handle to the item added or @c NULL, on errors
154 * Despite the most common usage of the @p letter argument is for
155 * single char strings, one could use arbitrary strings as index
158 * @c item will be the pointer returned back on @c "changed", @c
159 * "delay,changed" and @c "selected" smart events.
163 EAPI Elm_Object_Item *elm_index_item_append(Evas_Object *obj, const char *letter, Evas_Smart_Cb func, const void *data);
166 * Prepend a new item on a given index widget.
168 * @param obj The index object.
169 * @param letter Letter under which the item should be indexed
170 * @param func The function to call when the item is selected.
171 * @param data The item data to set for the index's item
172 * @return A handle to the item added or @c NULL, on errors
174 * Despite the most common usage of the @p letter argument is for
175 * single char strings, one could use arbitrary strings as index
178 * @c item will be the pointer returned back on @c "changed", @c
179 * "delay,changed" and @c "selected" smart events.
183 EAPI Elm_Object_Item *elm_index_item_prepend(Evas_Object *obj, const char *letter, Evas_Smart_Cb func, const void *data);
186 * Insert a new item into the index object after item @p after.
188 * @param obj The index object.
189 * @param after The index item to insert after.
190 * @param letter Letter under which the item should be indexed
191 * @param func The function to call when the item is clicked.
192 * @param data The item data to set for the index's item
193 * @return A handle to the item added or @c NULL, on errors
195 * Despite the most common usage of the @p letter argument is for
196 * single char strings, one could use arbitrary strings as index
199 * @c item will be the pointer returned back on @c "changed", @c
200 * "delay,changed" and @c "selected" smart events.
202 * @note If @p relative is @c NULL this function will behave as
203 * elm_index_item_append().
207 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);
210 * Insert a new item into the index object before item @p before.
212 * @param obj The index object.
213 * @param before The index item to insert after.
214 * @param letter Letter under which the item should be indexed
215 * @param func The function to call when the item is clicked.
216 * @param data The item data to set for the index's item
217 * @return A handle to the item added or @c NULL, on errors
219 * Despite the most common usage of the @p letter argument is for
220 * single char strings, one could use arbitrary strings as index
223 * @c item will be the pointer returned back on @c "changed", @c
224 * "delay,changed" and @c "selected" smart events.
226 * @note If @p relative is @c NULL this function will behave as
227 * elm_index_item_prepend().
231 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);
234 * Insert a new item into the given index widget, using @p cmp_func
235 * function to sort items (by item handles).
237 * @param obj The index object.
238 * @param letter Letter under which the item should be indexed
239 * @param func The function to call when the item is clicked.
240 * @param data The item data to set for the index's item
241 * @param cmp_func The comparing function to be used to sort index
242 * items <b>by #index item handles</b>
243 * @param cmp_data_func A @b fallback function to be called for the
244 * sorting of index items <b>by item data</b>). It will be used
245 * when @p cmp_func returns @c 0 (equality), which means an index
246 * item with provided item data already exists. To decide which
247 * data item should be pointed to by the index item in question, @p
248 * cmp_data_func will be used. If @p cmp_data_func returns a
249 * non-negative value, the previous index item data will be
250 * replaced by the given @p item pointer. If the previous data need
251 * to be freed, it should be done by the @p cmp_data_func function,
252 * because all references to it will be lost. If this function is
253 * not provided (@c NULL is given), index items will be @b
254 * duplicated, if @p cmp_func returns @c 0.
255 * @return A handle to the item added or @c NULL, on errors
257 * Despite the most common usage of the @p letter argument is for
258 * single char strings, one could use arbitrary strings as index
261 * @c item will be the pointer returned back on @c "changed", @c
262 * "delay,changed" and @c "selected" smart events.
266 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);
269 * Find a given index widget's item, <b>using item data</b>.
271 * @param obj The index object
272 * @param data The item data pointed to by the desired index item
273 * @return The index item handle, if found, or @c NULL otherwise
277 EAPI Elm_Object_Item *elm_index_item_find(Evas_Object *obj, const void *data);
280 * Removes @b all items from a given index widget.
282 * @param obj The index object.
284 * If deletion callbacks are set, via elm_object_item_del_cb_set(),
285 * that callback function will be called for each item in @p obj.
289 EAPI void elm_index_item_clear(Evas_Object *obj);
292 * Go to a given items level on a index widget
294 * @param obj The index object
295 * @param level The index level (one of @c 0 or @c 1)
299 EAPI void elm_index_level_go(Evas_Object *obj, int level);
302 * Get the letter (string) set on a given index widget item.
304 * @param item The index item handle
305 * @return The letter string set on @p it
309 EAPI const char *elm_index_item_letter_get(const Elm_Object_Item *item);
312 * Set the indicator as to be disabled.
314 * @param obj The index object
315 * @param disabled @c EINA_TRUE to disable it, @c EINA_FALSE to enable it
317 * In Index widget, Indicator notes popup text, which shows a letter has been selecting.
319 * @see elm_index_indicator_disabled_get()
323 EAPI void elm_index_indicator_disabled_set(Evas_Object *obj, Eina_Bool disabled);
326 * Get the value of indicator's disabled status.
328 * @param obj The index object
329 * @return EINA_TRUE if the indicator is disabled.
331 * @see elm_index_indicator_disabled_set()
335 EAPI Eina_Bool elm_index_indicator_disabled_get(const Evas_Object *obj);
338 * Enable or disable horizontal mode on the index object
340 * @param obj The index object.
341 * @param horizontal @c EINA_TRUE to enable horizontal or @c EINA_FALSE to
342 * disable it, i.e., to enable vertical mode. it's an area one @ref Fingers
343 * "finger" wide on the bottom side of the index widget's container.
345 * @note Vertical mode is set by default.
347 * On horizontal mode items are displayed on index from left to right,
348 * instead of from top to bottom. Also, the index will scroll horizontally.
350 * @see elm_index_horizontal_get()
354 EAPI void elm_index_horizontal_set(Evas_Object *obj, Eina_Bool horizontal);
357 * Get a value whether horizontal mode is enabled or not.
359 * @param obj The index object.
360 * @return @c EINA_TRUE means horizontal mode selection is enabled.
361 * @c EINA_FALSE indicates it's disabled. If @p obj is @c NULL,
362 * @c EINA_FALSE is returned.
364 * @see elm_index_horizontal_set() for details.
368 EAPI Eina_Bool elm_index_horizontal_get(const Evas_Object *obj);