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:
22 * @li @ref diskselector_example_01
23 * @li @ref diskselector_example_02
27 * @addtogroup Diskselector
32 * Add a new diskselector widget to the given parent Elementary
35 * @param parent The parent object.
36 * @return a new diskselector widget handle or @c NULL, on errors.
38 * This function inserts a new diskselector widget on the canvas.
40 * @ingroup Diskselector
42 EAPI Evas_Object *elm_diskselector_add(Evas_Object *parent) EINA_ARG_NONNULL(1);
45 * Enable or disable round mode.
47 * @param obj The diskselector object.
48 * @param round @c EINA_TRUE to enable round mode or @c EINA_FALSE to
51 * Disabled by default. If round mode is enabled the items list will
52 * work like a circle list, so when the user reaches the last item,
53 * the first one will popup.
55 * @see elm_diskselector_round_get()
57 * @ingroup Diskselector
59 EAPI void elm_diskselector_round_set(Evas_Object *obj, Eina_Bool round) EINA_ARG_NONNULL(1);
62 * Get a value whether round mode is enabled or not.
64 * @see elm_diskselector_round_set() for details.
66 * @param obj The diskselector object.
67 * @return @c EINA_TRUE means round mode is enabled. @c EINA_FALSE indicates
68 * it's disabled. If @p obj is @c NULL, @c EINA_FALSE is returned.
70 * @ingroup Diskselector
72 EAPI Eina_Bool elm_diskselector_round_get(const Evas_Object *obj) EINA_ARG_NONNULL(1);
75 * Get the side labels max length.
77 * @see elm_diskselector_side_label_length_set() for details.
79 * @param obj The diskselector object.
80 * @return The max length defined for side labels, or 0 if not a valid
83 * @ingroup Diskselector
85 EAPI int elm_diskselector_side_label_length_get(const Evas_Object *obj) EINA_ARG_NONNULL(1);
88 * Set the side labels max length.
90 * @param obj The diskselector object.
91 * @param len The max length defined for side labels.
93 * Length is the number of characters of items' label that will be
94 * visible when it's set on side positions. It will just crop
95 * the string after defined size. E.g.:
97 * An item with label "January" would be displayed on side position as
98 * "Jan" if max length is set to 3, or "Janu", if this property
101 * When it's selected, the entire label will be displayed, except for
102 * width restrictions. In this case label will be cropped and "..."
103 * will be concatenated.
105 * Default side label max length is 3.
107 * This property will be applyed over all items, included before or
108 * later this function call.
110 * @ingroup Diskselector
112 EAPI void elm_diskselector_side_label_length_set(Evas_Object *obj, int len) EINA_ARG_NONNULL(1);
115 * Set the number of items to be displayed.
117 * @param obj The diskselector object.
118 * @param num The number of items the diskselector will display.
120 * Default value is 3, and also it's the minimun. If @p num is less
121 * than 3, it will be set to 3.
123 * Also, it can be set on theme, using data item @c display_item_num
124 * on group "elm/diskselector/item/X", where X is style set.
127 * group { name: "elm/diskselector/item/X";
129 * item: "display_item_num" "5";
132 * @ingroup Diskselector
134 EAPI void elm_diskselector_display_item_num_set(Evas_Object *obj, int num) EINA_ARG_NONNULL(1);
137 * Get the number of items in the diskselector object.
139 * @param obj The diskselector object.
141 * @ingroup Diskselector
143 EAPI int elm_diskselector_display_item_num_get(const Evas_Object *obj) EINA_ARG_NONNULL(1);
146 * Set bouncing behaviour when the scrolled content reaches an edge.
148 * Tell the internal scroller object whether it should bounce or not
149 * when it reaches the respective edges for each axis.
151 * @param obj The diskselector object.
152 * @param h_bounce Whether to bounce or not in the horizontal axis.
153 * @param v_bounce Whether to bounce or not in the vertical axis.
155 * @see elm_scroller_bounce_set()
157 * @ingroup Diskselector
159 EAPI void elm_diskselector_bounce_set(Evas_Object *obj, Eina_Bool h_bounce, Eina_Bool v_bounce) EINA_ARG_NONNULL(1);
162 * Get the bouncing behaviour of the internal scroller.
164 * Get whether the internal scroller should bounce when the edge of each
165 * axis is reached scrolling.
167 * @param obj The diskselector object.
168 * @param h_bounce Pointer where to store the bounce state of the horizontal
170 * @param v_bounce Pointer where to store the bounce state of the vertical
173 * @see elm_scroller_bounce_get()
174 * @see elm_diskselector_bounce_set()
176 * @ingroup Diskselector
178 EAPI void elm_diskselector_bounce_get(const Evas_Object *obj, Eina_Bool *h_bounce, Eina_Bool *v_bounce) EINA_ARG_NONNULL(1);
181 * Get the scrollbar policy.
183 * @see elm_diskselector_scroller_policy_get() for details.
185 * @param obj The diskselector object.
186 * @param policy_h Pointer where to store horizontal scrollbar policy.
187 * @param policy_v Pointer where to store vertical scrollbar policy.
189 * @ingroup Diskselector
191 EAPI void elm_diskselector_scroller_policy_get(const Evas_Object *obj, Elm_Scroller_Policy *policy_h, Elm_Scroller_Policy *policy_v) EINA_ARG_NONNULL(1);
194 * Set the scrollbar policy.
196 * @param obj The diskselector object.
197 * @param policy_h Horizontal scrollbar policy.
198 * @param policy_v Vertical scrollbar policy.
200 * This sets the scrollbar visibility policy for the given scroller.
201 * #ELM_SCROLLER_POLICY_AUTO means the scrollbar is made visible if it
202 * is needed, and otherwise kept hidden. #ELM_SCROLLER_POLICY_ON turns
203 * it on all the time, and #ELM_SCROLLER_POLICY_OFF always keeps it off.
204 * This applies respectively for the horizontal and vertical scrollbars.
206 * The both are disabled by default, i.e., are set to
207 * #ELM_SCROLLER_POLICY_OFF.
209 * @ingroup Diskselector
211 EAPI void elm_diskselector_scroller_policy_set(Evas_Object *obj, Elm_Scroller_Policy policy_h, Elm_Scroller_Policy policy_v) EINA_ARG_NONNULL(1);
214 * Remove all diskselector's items.
216 * @param obj The diskselector object.
218 * @see elm_diskselector_item_del()
219 * @see elm_diskselector_item_append()
221 * @ingroup Diskselector
223 EAPI void elm_diskselector_clear(Evas_Object *obj) EINA_ARG_NONNULL(1);
226 * Get a list of all the diskselector items.
228 * @param obj The diskselector object.
229 * @return An @c Eina_List of diskselector items, #Elm_Object_Item,
230 * or @c NULL on failure.
232 * @see elm_diskselector_item_append()
233 * @see elm_diskselector_item_del()
234 * @see elm_diskselector_clear()
236 * @ingroup Diskselector
238 EAPI const Eina_List *elm_diskselector_items_get(const Evas_Object *obj) EINA_ARG_NONNULL(1);
241 * Appends a new item to the diskselector object.
243 * @param obj The diskselector object.
244 * @param label The label of the diskselector item.
245 * @param icon The icon object to use at left side of the item. An
246 * icon can be any Evas object, but usually it is an icon created
247 * with elm_icon_add().
248 * @param func The function to call when the item is selected.
249 * @param data The data to associate with the item for related callbacks.
251 * @return The created item or @c NULL upon failure.
253 * A new item will be created and appended to the diskselector, i.e., will
254 * be set as last item. Also, if there is no selected item, it will
255 * be selected. This will always happens for the first appended item.
257 * If no icon is set, label will be centered on item position, otherwise
258 * the icon will be placed at left of the label, that will be shifted
261 * Items created with this method can be deleted with
262 * elm_diskselector_item_del().
264 * Associated @p data can be properly freed when item is deleted if a
265 * callback function is set with elm_diskselector_item_del_cb_set().
267 * If a function is passed as argument, it will be called everytime this item
268 * is selected, i.e., the user stops the diskselector with this
269 * item on center position. If such function isn't needed, just passing
270 * @c NULL as @p func is enough. The same should be done for @p data.
272 * Simple example (with no function callback or data associated):
274 * disk = elm_diskselector_add(win);
275 * ic = elm_icon_add(win);
276 * elm_icon_file_set(ic, "path/to/image", NULL);
277 * elm_icon_scale_set(ic, EINA_TRUE, EINA_TRUE);
278 * elm_diskselector_item_append(disk, "label", ic, NULL, NULL);
281 * @see elm_diskselector_item_del()
282 * @see elm_diskselector_item_del_cb_set()
283 * @see elm_diskselector_clear()
284 * @see elm_icon_add()
286 * @ingroup Diskselector
288 EAPI Elm_Object_Item *elm_diskselector_item_append(Evas_Object *obj, const char *label, Evas_Object *icon, Evas_Smart_Cb func, const void *data) EINA_ARG_NONNULL(1);
292 * Delete them item from the diskselector.
294 * @param it The item of diskselector to be deleted.
296 * If deleting all diskselector items is required, elm_diskselector_clear()
297 * should be used instead of getting items list and deleting each one.
299 * @see elm_diskselector_clear()
300 * @see elm_diskselector_item_append()
301 * @see elm_diskselector_item_del_cb_set()
303 * @ingroup Diskselector
305 EAPI void elm_diskselector_item_del(Elm_Object_Item *it) EINA_ARG_NONNULL(1);
308 * Set the function called when a diskselector item is freed.
310 * @param it The item to set the callback on
311 * @param func The function called
313 * If there is a @p func, then it will be called prior item's memory release.
314 * That will be called with the following arguments:
316 * @li item's Evas object;
319 * This way, a data associated to a diskselector item could be properly
322 * @ingroup Diskselector
324 EAPI void elm_diskselector_item_del_cb_set(Elm_Object_Item *it, Evas_Smart_Cb func) EINA_ARG_NONNULL(1);
327 * Get the data associated to the item.
329 * @param it The diskselector item
330 * @return The data associated to @p it
332 * The return value is a pointer to data associated to @p item when it was
333 * created, with function elm_diskselector_item_append(). If no data
334 * was passed as argument, it will return @c NULL.
336 * @see elm_diskselector_item_append()
338 * @ingroup Diskselector
340 EAPI void *elm_diskselector_item_data_get(const Elm_Object_Item *it) EINA_ARG_NONNULL(1);
343 * Set the icon associated to the item.
345 * @param it The diskselector item
346 * @param icon The icon object to associate with @p it
348 * The icon object to use at left side of the item. An
349 * icon can be any Evas object, but usually it is an icon created
350 * with elm_icon_add().
352 * Once the icon object is set, a previously set one will be deleted.
353 * @warning Setting the same icon for two items will cause the icon to
354 * dissapear from the first item.
356 * If an icon was passed as argument on item creation, with function
357 * elm_diskselector_item_append(), it will be already
358 * associated to the item.
360 * @see elm_diskselector_item_append()
361 * @see elm_diskselector_item_icon_get()
363 * @ingroup Diskselector
365 EAPI void elm_diskselector_item_icon_set(Elm_Object_Item *it, Evas_Object *icon) EINA_ARG_NONNULL(1);
368 * Get the icon associated to the item.
370 * @param item The diskselector item
371 * @return The icon associated to @p it
373 * The return value is a pointer to the icon associated to @p item when it was
374 * created, with function elm_diskselector_item_append(), or later
375 * with function elm_diskselector_item_icon_set. If no icon
376 * was passed as argument, it will return @c NULL.
378 * @see elm_diskselector_item_append()
379 * @see elm_diskselector_item_icon_set()
381 * @ingroup Diskselector
383 EAPI Evas_Object *elm_diskselector_item_icon_get(const Elm_Object_Item *it) EINA_ARG_NONNULL(1);
386 * Set the label of item.
388 * @param it The item of diskselector.
389 * @param label The label of item.
391 * The label to be displayed by the item.
393 * If no icon is set, label will be centered on item position, otherwise
394 * the icon will be placed at left of the label, that will be shifted
397 * An item with label "January" would be displayed on side position as
398 * "Jan" if max length is set to 3 with function
399 * elm_diskselector_side_label_lenght_set(), or "Janu", if this property
402 * When this @p item is selected, the entire label will be displayed,
403 * except for width restrictions.
404 * In this case label will be cropped and "..." will be concatenated,
405 * but only for display purposes. It will keep the entire string, so
406 * if diskselector is resized the remaining characters will be displayed.
408 * If a label was passed as argument on item creation, with function
409 * elm_diskselector_item_append(), it will be already
410 * displayed by the item.
412 * @see elm_diskselector_side_label_lenght_set()
413 * @see elm_diskselector_item_label_get()
414 * @see elm_diskselector_item_append()
416 * @ingroup Diskselector
418 EAPI void elm_diskselector_item_label_set(Elm_Object_Item *it, const char *label) EINA_ARG_NONNULL(1);
421 * Get the label of item.
423 * @param it The item of diskselector.
424 * @return The label of item.
426 * The return value is a pointer to the label associated to @p item when it was
427 * created, with function elm_diskselector_item_append(), or later
428 * with function elm_diskselector_item_label_set. If no label
429 * was passed as argument, it will return @c NULL.
431 * @see elm_diskselector_item_label_set() for more details.
432 * @see elm_diskselector_item_append()
434 * @ingroup Diskselector
436 EAPI const char *elm_diskselector_item_label_get(const Elm_Object_Item *it) EINA_ARG_NONNULL(1);
439 * Get the selected item.
441 * @param obj The diskselector object.
442 * @return The selected diskselector item.
444 * The selected item can be unselected with function
445 * elm_diskselector_item_selected_set(), and the first item of
446 * diskselector will be selected.
448 * The selected item always will be centered on diskselector, with
449 * full label displayed, i.e., max lenght set to side labels won't
450 * apply on the selected item. More details on
451 * elm_diskselector_side_label_length_set().
453 * @ingroup Diskselector
455 EAPI Elm_Object_Item *elm_diskselector_selected_item_get(const Evas_Object *obj) EINA_ARG_NONNULL(1);
458 * Set the selected state of an item.
460 * @param it The diskselector item
461 * @param selected The selected state
463 * This sets the selected state of the given item @p it.
464 * @c EINA_TRUE for selected, @c EINA_FALSE for not selected.
466 * If a new item is selected the previosly selected will be unselected.
467 * Previoulsy selected item can be get with function
468 * elm_diskselector_selected_item_get().
470 * If the item @p it is unselected, the first item of diskselector will
473 * Selected items will be visible on center position of diskselector.
474 * So if it was on another position before selected, or was invisible,
475 * diskselector will animate items until the selected item reaches center
478 * @see elm_diskselector_item_selected_get()
479 * @see elm_diskselector_selected_item_get()
481 * @ingroup Diskselector
483 EAPI void elm_diskselector_item_selected_set(Elm_Object_Item *it, Eina_Bool selected) EINA_ARG_NONNULL(1);
486 * Get whether the @p item is selected or not.
488 * @param it The diskselector item.
489 * @return @c EINA_TRUE means item is selected. @c EINA_FALSE indicates
490 * it's not. If @p obj is @c NULL, @c EINA_FALSE is returned.
492 * @see elm_diskselector_selected_item_set() for details.
493 * @see elm_diskselector_item_selected_get()
495 * @ingroup Diskselector
497 EAPI Eina_Bool elm_diskselector_item_selected_get(const Elm_Object_Item *it) EINA_ARG_NONNULL(1);
500 * Get the first item of the diskselector.
502 * @param obj The diskselector object.
503 * @return The first item, or @c NULL if none.
505 * The list of items follows append order. So it will return the first
506 * item appended to the widget that wasn't deleted.
508 * @see elm_diskselector_item_append()
509 * @see elm_diskselector_items_get()
511 * @ingroup Diskselector
513 EAPI Elm_Object_Item *elm_diskselector_first_item_get(const Evas_Object *obj) EINA_ARG_NONNULL(1);
516 * Get the last item of the diskselector.
518 * @param obj The diskselector object.
519 * @return The last item, or @c NULL if none.
521 * The list of items follows append order. So it will return last first
522 * item appended to the widget that wasn't deleted.
524 * @see elm_diskselector_item_append()
525 * @see elm_diskselector_items_get()
527 * @ingroup Diskselector
529 EAPI Elm_Object_Item *elm_diskselector_last_item_get(const Evas_Object *obj) EINA_ARG_NONNULL(1);
532 * Get the item before @p item in diskselector.
534 * @param it The diskselector item.
535 * @return The item before @p item, or @c NULL if none or on failure.
537 * The list of items follows append order. So it will return item appended
538 * just before @p item and that wasn't deleted.
540 * If it is the first item, @c NULL will be returned.
541 * First item can be get by elm_diskselector_first_item_get().
543 * @see elm_diskselector_item_append()
544 * @see elm_diskselector_items_get()
546 * @ingroup Diskselector
548 EAPI Elm_Object_Item *elm_diskselector_item_prev_get(const Elm_Object_Item *it) EINA_ARG_NONNULL(1);
551 * Get the item after @p item in diskselector.
553 * @param it The diskselector item.
554 * @return The item after @p item, or @c NULL if none or on failure.
556 * The list of items follows append order. So it will return item appended
557 * just after @p item and that wasn't deleted.
559 * If it is the last item, @c NULL will be returned.
560 * Last item can be get by elm_diskselector_last_item_get().
562 * @see elm_diskselector_item_append()
563 * @see elm_diskselector_items_get()
565 * @ingroup Diskselector
567 EAPI Elm_Object_Item *elm_diskselector_item_next_get(const Elm_Object_Item *it) EINA_ARG_NONNULL(1);
570 * Set the text to be shown in the diskselector item.
572 * @param it Target item
573 * @param text The text to set in the content
575 * Setup the text as tooltip to object. The item can have only one tooltip,
576 * so any previous tooltip data is removed.
578 * @see elm_object_tooltip_text_set() for more details.
580 * @ingroup Diskselector
582 EAPI void elm_diskselector_item_tooltip_text_set(Elm_Object_Item *it, const char *text) EINA_ARG_NONNULL(1);
585 * Set the content to be shown in the tooltip item.
587 * Setup the tooltip to item. The item can have only one tooltip,
588 * so any previous tooltip data is removed. @p func(with @p data) will
589 * be called every time that need show the tooltip and it should
590 * return a valid Evas_Object. This object is then managed fully by
591 * tooltip system and is deleted when the tooltip is gone.
593 * @param it the diskselector item being attached a tooltip.
594 * @param func the function used to create the tooltip contents.
595 * @param data what to provide to @a func as callback data/context.
596 * @param del_cb called when data is not needed anymore, either when
597 * another callback replaces @p func, the tooltip is unset with
598 * elm_diskselector_item_tooltip_unset() or the owner @a item
599 * dies. This callback receives as the first parameter the
600 * given @a data, and @c event_info is the item.
602 * @see elm_object_tooltip_content_cb_set() for more details.
604 * @ingroup Diskselector
606 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) EINA_ARG_NONNULL(1);
609 * Unset tooltip from item.
611 * @param it diskselector item to remove previously set tooltip.
613 * Remove tooltip from item. The callback provided as del_cb to
614 * elm_diskselector_item_tooltip_content_cb_set() will be called to notify
615 * it is not used anymore.
617 * @see elm_object_tooltip_unset() for more details.
618 * @see elm_diskselector_item_tooltip_content_cb_set()
620 * @ingroup Diskselector
622 EAPI void elm_diskselector_item_tooltip_unset(Elm_Object_Item *it) EINA_ARG_NONNULL(1);
625 * Sets a different style for this item tooltip.
627 * @note before you set a style you should define a tooltip with
628 * elm_diskselector_item_tooltip_content_cb_set() or
629 * elm_diskselector_item_tooltip_text_set()
631 * @param it diskselector item with tooltip already set.
632 * @param style the theme style to use (default, transparent, ...)
634 * @see elm_object_tooltip_style_set() for more details.
636 * @ingroup Diskselector
638 EAPI void elm_diskselector_item_tooltip_style_set(Elm_Object_Item *it, const char *style) EINA_ARG_NONNULL(1);
641 * Get the style for this item tooltip.
643 * @param it diskselector item with tooltip already set.
644 * @return style the theme style in use, defaults to "default". If the
645 * object does not have a tooltip set, then NULL is returned.
647 * @see elm_object_tooltip_style_get() for more details.
648 * @see elm_diskselector_item_tooltip_style_set()
650 * @ingroup Diskselector
652 EAPI const char *elm_diskselector_item_tooltip_style_get(const Elm_Object_Item *it) EINA_ARG_NONNULL(1);
655 * Set the cursor to be shown when mouse is over the diskselector item
657 * @param it Target item
658 * @param cursor the cursor name to be used.
660 * @see elm_object_cursor_set() for more details.
662 * @ingroup Diskselector
664 EAPI void elm_diskselector_item_cursor_set(Elm_Object_Item *it, const char *cursor) EINA_ARG_NONNULL(1);
667 * Get the cursor to be shown when mouse is over the diskselector item
669 * @param it diskselector item with cursor already set.
670 * @return the cursor name.
672 * @see elm_object_cursor_get() for more details.
673 * @see elm_diskselector_cursor_set()
675 * @ingroup Diskselector
677 EAPI const char *elm_diskselector_item_cursor_get(const Elm_Object_Item *it) EINA_ARG_NONNULL(1);
680 * Unset the cursor to be shown when mouse is over the diskselector item
682 * @param it Target item
684 * @see elm_object_cursor_unset() for more details.
685 * @see elm_diskselector_cursor_set()
687 * @ingroup Diskselector
689 EAPI void elm_diskselector_item_cursor_unset(Elm_Object_Item *it) EINA_ARG_NONNULL(1);
692 * Sets a different style for this item cursor.
694 * @note before you set a style you should define a cursor with
695 * elm_diskselector_item_cursor_set()
697 * @param it diskselector item with cursor already set.
698 * @param style the theme style to use (default, transparent, ...)
700 * @see elm_object_cursor_style_set() for more details.
702 * @ingroup Diskselector
704 EAPI void elm_diskselector_item_cursor_style_set(Elm_Object_Item *it, const char *style) EINA_ARG_NONNULL(1);
707 * Get the style for this item cursor.
709 * @param it diskselector item with cursor already set.
710 * @return style the theme style in use, defaults to "default". If the
711 * object does not have a cursor set, then @c NULL is returned.
713 * @see elm_object_cursor_style_get() for more details.
714 * @see elm_diskselector_item_cursor_style_set()
716 * @ingroup Diskselector
718 EAPI const char *elm_diskselector_item_cursor_style_get(const Elm_Object_Item *it) EINA_ARG_NONNULL(1);
722 * Set if the cursor set should be searched on the theme or should use
723 * the provided by the engine, only.
725 * @note before you set if should look on theme you should define a cursor
726 * with elm_diskselector_item_cursor_set().
727 * By default it will only look for cursors provided by the engine.
729 * @param it widget item with cursor already set.
730 * @param engine_only boolean to define if cursors set with
731 * elm_diskselector_item_cursor_set() should be searched only
732 * between cursors provided by the engine or searched on widget's
735 * @see elm_object_cursor_engine_only_set() for more details.
737 * @ingroup Diskselector
739 EAPI void elm_diskselector_item_cursor_engine_only_set(Elm_Object_Item *it, Eina_Bool engine_only) EINA_ARG_NONNULL(1);
742 * Get the cursor engine only usage for this item cursor.
744 * @param it widget item with cursor already set.
745 * @return engine_only boolean to define it cursors should be looked only
746 * between the provided by the engine or searched on widget's theme as well.
747 * If the item does not have a cursor set, then @c EINA_FALSE is returned.
749 * @see elm_object_cursor_engine_only_get() for more details.
750 * @see elm_diskselector_item_cursor_engine_only_set()
752 * @ingroup Diskselector
754 EAPI Eina_Bool elm_diskselector_item_cursor_engine_only_get(const Elm_Object_Item *it) EINA_ARG_NONNULL(1);