2 * @defgroup Diskselector Diskselector
5 * @image html img/widget/diskselector/preview-00.png
6 * @image latex img/widget/diskselector/preview-00.eps
8 * A diskselector is a kind of list widget. It scrolls horizontally,
9 * and can contain label and icon objects. Three items are displayed
10 * with the selected one in the middle.
12 * It can act like a circular list with round mode and labels can be
13 * reduced for a defined length for side items.
15 * Smart callbacks one can listen to:
16 * - "selected" - when item is selected, i.e. scroller stops.
18 * Available styles for it:
21 * Default contents parts of the diskseletor items that you can use for are:
22 * @li "icon" - An icon in the diskselector item
24 * Default text parts of the diskselector items that you can use for are:
25 * @li "default" - Label of the diskselector item
28 * @li @ref diskselector_example_01
29 * @li @ref diskselector_example_02
33 * @addtogroup Diskselector
38 * Add a new diskselector widget to the given parent Elementary
41 * @param parent The parent object.
42 * @return a new diskselector widget handle or @c NULL, on errors.
44 * This function inserts a new diskselector widget on the canvas.
46 * @ingroup Diskselector
48 EAPI Evas_Object *elm_diskselector_add(Evas_Object *parent);
51 * Enable or disable round mode.
53 * @param obj The diskselector object.
54 * @param round @c EINA_TRUE to enable round mode or @c EINA_FALSE to
57 * Disabled by default. If round mode is enabled the items list will
58 * work like a circle list, so when the user reaches the last item,
59 * the first one will popup.
61 * @see elm_diskselector_round_get()
63 * @ingroup Diskselector
65 EAPI void elm_diskselector_round_set(Evas_Object *obj, Eina_Bool round);
68 * Get a value whether round mode is enabled or not.
70 * @see elm_diskselector_round_set() for details.
72 * @param obj The diskselector object.
73 * @return @c EINA_TRUE means round mode is enabled. @c EINA_FALSE indicates
74 * it's disabled. If @p obj is @c NULL, @c EINA_FALSE is returned.
76 * @ingroup Diskselector
78 EAPI Eina_Bool elm_diskselector_round_get(const Evas_Object *obj);
81 * Get the side labels max length.
83 * @see elm_diskselector_side_label_length_set() for details.
85 * @param obj The diskselector object.
86 * @return The max length defined for side labels, or 0 if not a valid
89 * @ingroup Diskselector
91 EAPI int elm_diskselector_side_label_length_get(const Evas_Object *obj);
94 * Set the side labels max length.
96 * @param obj The diskselector object.
97 * @param len The max length defined for side labels.
99 * Length is the number of characters of items' label that will be
100 * visible when it's set on side positions. It will just crop
101 * the string after defined size. E.g.:
103 * An item with label "January" would be displayed on side position as
104 * "Jan" if max length is set to 3, or "Janu", if this property
107 * When it's selected, the entire label will be displayed, except for
108 * width restrictions. In this case label will be cropped and "..."
109 * will be concatenated.
111 * Default side label max length is 3.
113 * This property will be applyed over all items, included before or
114 * later this function call.
116 * @ingroup Diskselector
118 EAPI void elm_diskselector_side_label_length_set(Evas_Object *obj, int len);
121 * Set the number of items to be displayed.
123 * @param obj The diskselector object.
124 * @param num The number of items the diskselector will display.
126 * Default value is 3, and also it's the minimun. If @p num is less
127 * than 3, it will be set to 3.
129 * Also, it can be set on theme, using data item @c display_item_num
130 * on group "elm/diskselector/item/X", where X is style set.
133 * group { name: "elm/diskselector/item/X";
135 * item: "display_item_num" "5";
138 * @ingroup Diskselector
140 EAPI void elm_diskselector_display_item_num_set(Evas_Object *obj, int num);
143 * Get the number of items in the diskselector object.
145 * @param obj The diskselector object.
147 * @ingroup Diskselector
149 EAPI int elm_diskselector_display_item_num_get(const Evas_Object *obj);
152 * Set bouncing behaviour when the scrolled content reaches an edge.
154 * Tell the internal scroller object whether it should bounce or not
155 * when it reaches the respective edges for each axis.
157 * @param obj The diskselector object.
158 * @param h_bounce Whether to bounce or not in the horizontal axis.
159 * @param v_bounce Whether to bounce or not in the vertical axis.
161 * @see elm_scroller_bounce_set()
163 * @ingroup Diskselector
165 EAPI void elm_diskselector_bounce_set(Evas_Object *obj, Eina_Bool h_bounce, Eina_Bool v_bounce);
168 * Get the bouncing behaviour of the internal scroller.
170 * Get whether the internal scroller should bounce when the edge of each
171 * axis is reached scrolling.
173 * @param obj The diskselector object.
174 * @param h_bounce Pointer where to store the bounce state of the horizontal
176 * @param v_bounce Pointer where to store the bounce state of the vertical
179 * @see elm_scroller_bounce_get()
180 * @see elm_diskselector_bounce_set()
182 * @ingroup Diskselector
184 EAPI void elm_diskselector_bounce_get(const Evas_Object *obj, Eina_Bool *h_bounce, Eina_Bool *v_bounce);
187 * Get the scrollbar policy.
189 * @see elm_diskselector_scroller_policy_get() for details.
191 * @param obj The diskselector object.
192 * @param policy_h Pointer where to store horizontal scrollbar policy.
193 * @param policy_v Pointer where to store vertical scrollbar policy.
195 * @ingroup Diskselector
197 EAPI void elm_diskselector_scroller_policy_get(const Evas_Object *obj, Elm_Scroller_Policy *policy_h, Elm_Scroller_Policy *policy_v);
200 * Set the scrollbar policy.
202 * @param obj The diskselector object.
203 * @param policy_h Horizontal scrollbar policy.
204 * @param policy_v Vertical scrollbar policy.
206 * This sets the scrollbar visibility policy for the given scroller.
207 * #ELM_SCROLLER_POLICY_AUTO means the scrollbar is made visible if it
208 * is needed, and otherwise kept hidden. #ELM_SCROLLER_POLICY_ON turns
209 * it on all the time, and #ELM_SCROLLER_POLICY_OFF always keeps it off.
210 * This applies respectively for the horizontal and vertical scrollbars.
212 * The both are disabled by default, i.e., are set to
213 * #ELM_SCROLLER_POLICY_OFF.
215 * @ingroup Diskselector
217 EAPI void elm_diskselector_scroller_policy_set(Evas_Object *obj, Elm_Scroller_Policy policy_h, Elm_Scroller_Policy policy_v);
220 * Remove all diskselector's items.
222 * @param obj The diskselector object.
224 * @see elm_diskselector_item_del()
225 * @see elm_diskselector_item_append()
227 * @ingroup Diskselector
229 EAPI void elm_diskselector_clear(Evas_Object *obj);
232 * Get a list of all the diskselector items.
234 * @param obj The diskselector object.
235 * @return An @c Eina_List of diskselector items, #Elm_Object_Item,
236 * or @c NULL on failure.
238 * @see elm_diskselector_item_append()
239 * @see elm_diskselector_item_del()
240 * @see elm_diskselector_clear()
242 * @ingroup Diskselector
244 EAPI const Eina_List *elm_diskselector_items_get(const Evas_Object *obj);
247 * Appends a new item to the diskselector object.
249 * @param obj The diskselector object.
250 * @param label The label of the diskselector item.
251 * @param icon The icon object to use at left side of the item. An
252 * icon can be any Evas object, but usually it is an icon created
253 * with elm_icon_add().
254 * @param func The function to call when the item is selected.
255 * @param data The data to associate with the item for related callbacks.
257 * @return The created item or @c NULL upon failure.
259 * A new item will be created and appended to the diskselector, i.e., will
260 * be set as last item. Also, if there is no selected item, it will
261 * be selected. This will always happens for the first appended item.
263 * If no icon is set, label will be centered on item position, otherwise
264 * the icon will be placed at left of the label, that will be shifted
267 * Items created with this method can be deleted with
268 * elm_diskselector_item_del().
270 * Associated @p data can be properly freed when item is deleted if a
271 * callback function is set with elm_diskselector_item_del_cb_set().
273 * If a function is passed as argument, it will be called everytime this item
274 * is selected, i.e., the user stops the diskselector with this
275 * item on center position. If such function isn't needed, just passing
276 * @c NULL as @p func is enough. The same should be done for @p data.
278 * Simple example (with no function callback or data associated):
280 * disk = elm_diskselector_add(win);
281 * ic = elm_icon_add(win);
282 * elm_icon_file_set(ic, "path/to/image", NULL);
283 * elm_icon_scale_set(ic, EINA_TRUE, EINA_TRUE);
284 * elm_diskselector_item_append(disk, "label", ic, NULL, NULL);
287 * @see elm_diskselector_item_del()
288 * @see elm_diskselector_item_del_cb_set()
289 * @see elm_diskselector_clear()
290 * @see elm_icon_add()
292 * @ingroup Diskselector
294 EAPI Elm_Object_Item *elm_diskselector_item_append(Evas_Object *obj, const char *label, Evas_Object *icon, Evas_Smart_Cb func, const void *data);
298 * Delete them item from the diskselector.
300 * @param it The item of diskselector to be deleted.
302 * If deleting all diskselector items is required, elm_diskselector_clear()
303 * should be used instead of getting items list and deleting each one.
305 * @see elm_diskselector_clear()
306 * @see elm_diskselector_item_append()
307 * @see elm_diskselector_item_del_cb_set()
309 * @ingroup Diskselector
311 EAPI void elm_diskselector_item_del(Elm_Object_Item *it);
314 * Set the function called when a diskselector item is freed.
316 * @param it The item to set the callback on
317 * @param func The function called
319 * If there is a @p func, then it will be called prior item's memory release.
320 * That will be called with the following arguments:
322 * @li item's Evas object;
325 * This way, a data associated to a diskselector item could be properly
328 * @ingroup Diskselector
330 EAPI void elm_diskselector_item_del_cb_set(Elm_Object_Item *it, Evas_Smart_Cb func);
333 * Get the selected item.
335 * @param obj The diskselector object.
336 * @return The selected diskselector item.
338 * The selected item can be unselected with function
339 * elm_diskselector_item_selected_set(), and the first item of
340 * diskselector will be selected.
342 * The selected item always will be centered on diskselector, with
343 * full label displayed, i.e., max lenght set to side labels won't
344 * apply on the selected item. More details on
345 * elm_diskselector_side_label_length_set().
347 * @ingroup Diskselector
349 EAPI Elm_Object_Item *elm_diskselector_selected_item_get(const Evas_Object *obj);
352 * Set the selected state of an item.
354 * @param it The diskselector item
355 * @param selected The selected state
357 * This sets the selected state of the given item @p it.
358 * @c EINA_TRUE for selected, @c EINA_FALSE for not selected.
360 * If a new item is selected the previosly selected will be unselected.
361 * Previoulsy selected item can be get with function
362 * elm_diskselector_selected_item_get().
364 * If the item @p it is unselected, the first item of diskselector will
367 * Selected items will be visible on center position of diskselector.
368 * So if it was on another position before selected, or was invisible,
369 * diskselector will animate items until the selected item reaches center
372 * @see elm_diskselector_item_selected_get()
373 * @see elm_diskselector_selected_item_get()
375 * @ingroup Diskselector
377 EAPI void elm_diskselector_item_selected_set(Elm_Object_Item *it, Eina_Bool selected);
380 * Get whether the @p item is selected or not.
382 * @param it The diskselector item.
383 * @return @c EINA_TRUE means item is selected. @c EINA_FALSE indicates
384 * it's not. If @p obj is @c NULL, @c EINA_FALSE is returned.
386 * @see elm_diskselector_selected_item_set() for details.
387 * @see elm_diskselector_item_selected_get()
389 * @ingroup Diskselector
391 EAPI Eina_Bool elm_diskselector_item_selected_get(const Elm_Object_Item *it);
394 * Get the first item of the diskselector.
396 * @param obj The diskselector object.
397 * @return The first item, or @c NULL if none.
399 * The list of items follows append order. So it will return the first
400 * item appended to the widget that wasn't deleted.
402 * @see elm_diskselector_item_append()
403 * @see elm_diskselector_items_get()
405 * @ingroup Diskselector
407 EAPI Elm_Object_Item *elm_diskselector_first_item_get(const Evas_Object *obj);
410 * Get the last item of the diskselector.
412 * @param obj The diskselector object.
413 * @return The last item, or @c NULL if none.
415 * The list of items follows append order. So it will return last first
416 * item appended to the widget that wasn't deleted.
418 * @see elm_diskselector_item_append()
419 * @see elm_diskselector_items_get()
421 * @ingroup Diskselector
423 EAPI Elm_Object_Item *elm_diskselector_last_item_get(const Evas_Object *obj);
426 * Get the item before @p item in diskselector.
428 * @param it The diskselector item.
429 * @return The item before @p item, or @c NULL if none or on failure.
431 * The list of items follows append order. So it will return item appended
432 * just before @p item and that wasn't deleted.
434 * If it is the first item, @c NULL will be returned.
435 * First item can be get by elm_diskselector_first_item_get().
437 * @see elm_diskselector_item_append()
438 * @see elm_diskselector_items_get()
440 * @ingroup Diskselector
442 EAPI Elm_Object_Item *elm_diskselector_item_prev_get(const Elm_Object_Item *it);
445 * Get the item after @p item in diskselector.
447 * @param it The diskselector item.
448 * @return The item after @p item, or @c NULL if none or on failure.
450 * The list of items follows append order. So it will return item appended
451 * just after @p item and that wasn't deleted.
453 * If it is the last item, @c NULL will be returned.
454 * Last item can be get by elm_diskselector_last_item_get().
456 * @see elm_diskselector_item_append()
457 * @see elm_diskselector_items_get()
459 * @ingroup Diskselector
461 EAPI Elm_Object_Item *elm_diskselector_item_next_get(const Elm_Object_Item *it);
464 * Set the text to be shown in the diskselector item.
466 * @param it Target item
467 * @param text The text to set in the content
469 * Setup the text as tooltip to object. The item can have only one tooltip,
470 * so any previous tooltip data is removed.
472 * @see elm_object_tooltip_text_set() for more details.
474 * @ingroup Diskselector
476 EAPI void elm_diskselector_item_tooltip_text_set(Elm_Object_Item *it, const char *text);
479 * Set the content to be shown in the tooltip item.
481 * Setup the tooltip to item. The item can have only one tooltip,
482 * so any previous tooltip data is removed. @p func(with @p data) will
483 * be called every time that need show the tooltip and it should
484 * return a valid Evas_Object. This object is then managed fully by
485 * tooltip system and is deleted when the tooltip is gone.
487 * @param it the diskselector item being attached a tooltip.
488 * @param func the function used to create the tooltip contents.
489 * @param data what to provide to @a func as callback data/context.
490 * @param del_cb called when data is not needed anymore, either when
491 * another callback replaces @p func, the tooltip is unset with
492 * elm_diskselector_item_tooltip_unset() or the owner @a item
493 * dies. This callback receives as the first parameter the
494 * given @a data, and @c event_info is the item.
496 * @see elm_object_tooltip_content_cb_set() for more details.
498 * @ingroup Diskselector
500 EAPI void elm_diskselector_item_tooltip_content_cb_set(Elm_Object_Item *it, Elm_Tooltip_Item_Content_Cb func, const void *data, Evas_Smart_Cb del_cb);
503 * Unset tooltip from item.
505 * @param it diskselector item to remove previously set tooltip.
507 * Remove tooltip from item. The callback provided as del_cb to
508 * elm_diskselector_item_tooltip_content_cb_set() will be called to notify
509 * it is not used anymore.
511 * @see elm_object_tooltip_unset() for more details.
512 * @see elm_diskselector_item_tooltip_content_cb_set()
514 * @ingroup Diskselector
516 EAPI void elm_diskselector_item_tooltip_unset(Elm_Object_Item *it);
519 * Sets a different style for this item tooltip.
521 * @note before you set a style you should define a tooltip with
522 * elm_diskselector_item_tooltip_content_cb_set() or
523 * elm_diskselector_item_tooltip_text_set()
525 * @param it diskselector item with tooltip already set.
526 * @param style the theme style to use (default, transparent, ...)
528 * @see elm_object_tooltip_style_set() for more details.
530 * @ingroup Diskselector
532 EAPI void elm_diskselector_item_tooltip_style_set(Elm_Object_Item *it, const char *style);
535 * Get the style for this item tooltip.
537 * @param it diskselector item with tooltip already set.
538 * @return style the theme style in use, defaults to "default". If the
539 * object does not have a tooltip set, then NULL is returned.
541 * @see elm_object_tooltip_style_get() for more details.
542 * @see elm_diskselector_item_tooltip_style_set()
544 * @ingroup Diskselector
546 EAPI const char *elm_diskselector_item_tooltip_style_get(const Elm_Object_Item *it);
549 * Set the cursor to be shown when mouse is over the diskselector item
551 * @param it Target item
552 * @param cursor the cursor name to be used.
554 * @see elm_object_cursor_set() for more details.
556 * @ingroup Diskselector
558 EAPI void elm_diskselector_item_cursor_set(Elm_Object_Item *it, const char *cursor);
561 * Get the cursor to be shown when mouse is over the diskselector item
563 * @param it diskselector item with cursor already set.
564 * @return the cursor name.
566 * @see elm_object_cursor_get() for more details.
567 * @see elm_diskselector_cursor_set()
569 * @ingroup Diskselector
571 EAPI const char *elm_diskselector_item_cursor_get(const Elm_Object_Item *it);
574 * Unset the cursor to be shown when mouse is over the diskselector item
576 * @param it Target item
578 * @see elm_object_cursor_unset() for more details.
579 * @see elm_diskselector_cursor_set()
581 * @ingroup Diskselector
583 EAPI void elm_diskselector_item_cursor_unset(Elm_Object_Item *it);
586 * Sets a different style for this item cursor.
588 * @note before you set a style you should define a cursor with
589 * elm_diskselector_item_cursor_set()
591 * @param it diskselector item with cursor already set.
592 * @param style the theme style to use (default, transparent, ...)
594 * @see elm_object_cursor_style_set() for more details.
596 * @ingroup Diskselector
598 EAPI void elm_diskselector_item_cursor_style_set(Elm_Object_Item *it, const char *style);
601 * Get the style for this item cursor.
603 * @param it diskselector item with cursor already set.
604 * @return style the theme style in use, defaults to "default". If the
605 * object does not have a cursor set, then @c NULL is returned.
607 * @see elm_object_cursor_style_get() for more details.
608 * @see elm_diskselector_item_cursor_style_set()
610 * @ingroup Diskselector
612 EAPI const char *elm_diskselector_item_cursor_style_get(const Elm_Object_Item *it);
616 * Set if the cursor set should be searched on the theme or should use
617 * the provided by the engine, only.
619 * @note before you set if should look on theme you should define a cursor
620 * with elm_diskselector_item_cursor_set().
621 * By default it will only look for cursors provided by the engine.
623 * @param it widget item with cursor already set.
624 * @param engine_only boolean to define if cursors set with
625 * elm_diskselector_item_cursor_set() should be searched only
626 * between cursors provided by the engine or searched on widget's
629 * @see elm_object_cursor_engine_only_set() for more details.
631 * @ingroup Diskselector
633 EAPI void elm_diskselector_item_cursor_engine_only_set(Elm_Object_Item *it, Eina_Bool engine_only);
636 * Get the cursor engine only usage for this item cursor.
638 * @param it widget item with cursor already set.
639 * @return engine_only boolean to define it cursors should be looked only
640 * between the provided by the engine or searched on widget's theme as well.
641 * If the item does not have a cursor set, then @c EINA_FALSE is returned.
643 * @see elm_object_cursor_engine_only_get() for more details.
644 * @see elm_diskselector_item_cursor_engine_only_set()
646 * @ingroup Diskselector
648 EAPI Eina_Bool elm_diskselector_item_cursor_engine_only_get(const Elm_Object_Item *it);