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 active @c EINA_TRUE to enable auto hiding, @c EINA_FALSE to disable
71 * @see elm_index_active_get()
75 EAPI void elm_index_active_set(Evas_Object *obj, Eina_Bool active);
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 enabled, @c EINA_FALSE otherwise
83 * @see elm_index_active_set() for more details
87 EAPI Eina_Bool elm_index_active_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 * Returns the last selected item, for a given index widget.
116 * @param obj The index object.
117 * @return The last item @b selected on @p obj (or @c NULL, on errors).
121 EAPI Elm_Object_Item *elm_index_item_selected_get(const Evas_Object *obj, int level);
124 * Append a new item on a given index widget.
126 * @param obj The index object.
127 * @param letter Letter under which the item should be indexed
128 * @param item The item data to set for the index's item
130 * Despite the most common usage of the @p letter argument is for
131 * single char strings, one could use arbitrary strings as index
134 * @c item will be the pointer returned back on @c "changed", @c
135 * "delay,changed" and @c "selected" smart events.
139 //XXX: Should be changed like Elm_Object_Item *elm_index_item_append(Evas_Object *obj, const char* letter, const void *data);
140 EAPI void elm_index_item_append(Evas_Object *obj, const char *letter, const void *item);
143 * Prepend a new item on a given index widget.
145 * @param obj The index object.
146 * @param letter Letter under which the item should be indexed
147 * @param item The item data to set for the index's item
149 * Despite the most common usage of the @p letter argument is for
150 * single char strings, one could use arbitrary strings as index
153 * @c item will be the pointer returned back on @c "changed", @c
154 * "delay,changed" and @c "selected" smart events.
158 //XXX: Should be changed like Elm_Object_Item *elm_index_item_prepend(Evas_Object *obj, const char* letter, const void *data);
159 EAPI void elm_index_item_prepend(Evas_Object *obj, const char *letter, const void *item);
162 * Append a new item, on a given index widget, <b>after the item
163 * having @p relative as data</b>.
165 * @param obj The index object.
166 * @param letter Letter under which the item should be indexed
167 * @param item The item data to set for the index's item
168 * @param relative The index item to be the predecessor of this new one
170 * Despite the most common usage of the @p letter argument is for
171 * single char strings, one could use arbitrary strings as index
174 * @c item will be the pointer returned back on @c "changed", @c
175 * "delay,changed" and @c "selected" smart events.
177 * @note If @p relative is @c NULL this function will behave as
178 * elm_index_item_append().
182 //XXX: Should be changed like Elm_Object_Item *elm_index_item_insert_after(Evas_Object *obj, const Elm_Object_Item *after, const char* letter, const void *data);
183 EAPI void elm_index_item_append_relative(Evas_Object *obj, const char *letter, const void *item, const Elm_Object_Item *relative);
186 * Prepend a new item, on a given index widget, <b>after the item
187 * having @p relative as data</b>.
189 * @param obj The index object.
190 * @param letter Letter under which the item should be indexed
191 * @param item The item data to set for the index's item
192 * @param relative The index item to be the successor of this new one
194 * Despite the most common usage of the @p letter argument is for
195 * single char strings, one could use arbitrary strings as index
198 * @c item will be the pointer returned back on @c "changed", @c
199 * "delay,changed" and @c "selected" smart events.
201 * @note If @p relative is @c NULL this function will behave as
202 * elm_index_item_prepend().
206 //XXX: Should be changed like Elm_Object_Item *elm_index_item_insert_before(Evas_Object *obj, const Elm_Object_Item *before, const char* letter, const void *data);
207 EAPI void elm_index_item_prepend_relative(Evas_Object *obj, const char *letter, const void *item, const Elm_Object_Item *relative);
210 * Insert a new item into the given index widget, using @p cmp_func
211 * function to sort items (by item handles).
213 * @param obj The index object.
214 * @param letter Letter under which the item should be indexed
215 * @param item The item data to set for the index's item
216 * @param cmp_func The comparing function to be used to sort index
217 * items <b>by #index item handles</b>
218 * @param cmp_data_func A @b fallback function to be called for the
219 * sorting of index items <b>by item data</b>). It will be used
220 * when @p cmp_func returns @c 0 (equality), which means an index
221 * item with provided item data already exists. To decide which
222 * data item should be pointed to by the index item in question, @p
223 * cmp_data_func will be used. If @p cmp_data_func returns a
224 * non-negative value, the previous index item data will be
225 * replaced by the given @p item pointer. If the previous data need
226 * to be freed, it should be done by the @p cmp_data_func function,
227 * because all references to it will be lost. If this function is
228 * not provided (@c NULL is given), index items will be @b
229 * duplicated, if @p cmp_func returns @c 0.
231 * Despite the most common usage of the @p letter argument is for
232 * single char strings, one could use arbitrary strings as index
235 * @c item will be the pointer returned back on @c "changed", @c
236 * "delay,changed" and @c "selected" smart events.
240 //XXX: Should be changed like Elm_Object_Item *elm_index_item_sorted_insert(Evas_Object *obj, const char* letter, const void *data, Eina_Compare_Cb cmp_func, Eina_Compare_Cb cmp_data_func);
241 EAPI void elm_index_item_sorted_insert(Evas_Object *obj, const char *letter, const void *item, Eina_Compare_Cb cmp_func, Eina_Compare_Cb cmp_data_func);
244 * Find a given index widget's item, <b>using item data</b>.
246 * @param obj The index object
247 * @param item The item data pointed to by the desired index item
248 * @return The index item handle, if found, or @c NULL otherwise
252 //XXX: After changing above APIs, this should be deprecated.
253 EAPI Elm_Object_Item *elm_index_item_find(Evas_Object *obj, const void *item);
256 * Removes @b all items from a given index widget.
258 * @param obj The index object.
260 * If deletion callbacks are set, via elm_object_item_del_cb_set(),
261 * that callback function will be called for each item in @p obj.
265 EAPI void elm_index_item_clear(Evas_Object *obj);
268 * Go to a given items level on a index widget
270 * @param obj The index object
271 * @param level The index level (one of @c 0 or @c 1)
275 //XXX: how about elm_index_level_go ??
276 EAPI void elm_index_item_go(Evas_Object *obj, int level);
279 * Get the letter (string) set on a given index widget item.
281 * @param it The index item handle
282 * @return The letter string set on @p it
286 EAPI const char *elm_index_item_letter_get(const Elm_Object_Item *item);