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
27 * Supported elm_object_item common APIs.
28 * @li elm_object_item_part_text_set
29 * @li elm_object_item_part_text_get
30 * @li elm_object_item_part_content_set
31 * @li elm_object_item_part_content_get
34 * @li @ref diskselector_example_01
35 * @li @ref diskselector_example_02
39 * @addtogroup Diskselector
44 * Add a new diskselector widget to the given parent Elementary
47 * @param parent The parent object.
48 * @return a new diskselector widget handle or @c NULL, on errors.
50 * This function inserts a new diskselector widget on the canvas.
52 * @ingroup Diskselector
54 EAPI Evas_Object *elm_diskselector_add(Evas_Object *parent);
57 * Enable or disable round mode.
59 * @param obj The diskselector object.
60 * @param round @c EINA_TRUE to enable round mode or @c EINA_FALSE to
63 * Disabled by default. If round mode is enabled the items list will
64 * work like a circle list, so when the user reaches the last item,
65 * the first one will popup.
67 * @see elm_diskselector_round_get()
69 * @ingroup Diskselector
71 EAPI void elm_diskselector_round_set(Evas_Object *obj, Eina_Bool round);
74 * Get a value whether round mode is enabled or not.
76 * @see elm_diskselector_round_set() for details.
78 * @param obj The diskselector object.
79 * @return @c EINA_TRUE means round mode is enabled. @c EINA_FALSE indicates
80 * it's disabled. If @p obj is @c NULL, @c EINA_FALSE is returned.
82 * @ingroup Diskselector
84 EAPI Eina_Bool elm_diskselector_round_get(const Evas_Object *obj);
87 * Get the side labels max length.
89 * @see elm_diskselector_side_label_length_set() for details.
91 * @param obj The diskselector object.
92 * @return The max length defined for side labels, or 0 if not a valid
95 * @ingroup Diskselector
97 EAPI int elm_diskselector_side_label_length_get(const Evas_Object *obj);
100 * Set the side labels max length.
102 * @param obj The diskselector object.
103 * @param len The max length defined for side labels.
105 * Length is the number of characters of items' label that will be
106 * visible when it's set on side positions. It will just crop
107 * the string after defined size. E.g.:
109 * An item with label "January" would be displayed on side position as
110 * "Jan" if max length is set to 3, or "Janu", if this property
113 * When it's selected, the entire label will be displayed, except for
114 * width restrictions. In this case label will be cropped and "..."
115 * will be concatenated.
117 * Default side label max length is 3.
119 * This property will be applyed over all items, included before or
120 * later this function call.
122 * @ingroup Diskselector
124 EAPI void elm_diskselector_side_label_length_set(Evas_Object *obj, int len);
127 * Set the number of items to be displayed.
129 * @param obj The diskselector object.
130 * @param num The number of items the diskselector will display.
132 * Default value is 3, and also it's the minimun. If @p num is less
133 * than 3, it will be set to 3.
135 * Also, it can be set on theme, using data item @c display_item_num
136 * on group "elm/diskselector/item/X", where X is style set.
139 * group { name: "elm/diskselector/item/X";
141 * item: "display_item_num" "5";
144 * @ingroup Diskselector
146 EAPI void elm_diskselector_display_item_num_set(Evas_Object *obj, int num);
149 * Get the number of items in the diskselector object.
151 * @param obj The diskselector object.
153 * @ingroup Diskselector
155 EAPI int elm_diskselector_display_item_num_get(const Evas_Object *obj);
158 * Set bouncing behaviour when the scrolled content reaches an edge.
160 * Tell the internal scroller object whether it should bounce or not
161 * when it reaches the respective edges for each axis.
163 * @param obj The diskselector object.
164 * @param h_bounce Whether to bounce or not in the horizontal axis.
165 * @param v_bounce Whether to bounce or not in the vertical axis.
167 * @see elm_scroller_bounce_set()
169 * @ingroup Diskselector
171 EAPI void elm_diskselector_bounce_set(Evas_Object *obj, Eina_Bool h_bounce, Eina_Bool v_bounce);
174 * Get the bouncing behaviour of the internal scroller.
176 * Get whether the internal scroller should bounce when the edge of each
177 * axis is reached scrolling.
179 * @param obj The diskselector object.
180 * @param h_bounce Pointer where to store the bounce state of the horizontal
182 * @param v_bounce Pointer where to store the bounce state of the vertical
185 * @see elm_scroller_bounce_get()
186 * @see elm_diskselector_bounce_set()
188 * @ingroup Diskselector
190 EAPI void elm_diskselector_bounce_get(const Evas_Object *obj, Eina_Bool *h_bounce, Eina_Bool *v_bounce);
193 * Get the scrollbar policy.
195 * @see elm_diskselector_scroller_policy_get() for details.
197 * @param obj The diskselector object.
198 * @param policy_h Pointer where to store horizontal scrollbar policy.
199 * @param policy_v Pointer where to store vertical scrollbar policy.
201 * @ingroup Diskselector
203 EAPI void elm_diskselector_scroller_policy_get(const Evas_Object *obj, Elm_Scroller_Policy *policy_h, Elm_Scroller_Policy *policy_v);
206 * Set the scrollbar policy.
208 * @param obj The diskselector object.
209 * @param policy_h Horizontal scrollbar policy.
210 * @param policy_v Vertical scrollbar policy.
212 * This sets the scrollbar visibility policy for the given scroller.
213 * #ELM_SCROLLER_POLICY_AUTO means the scrollbar is made visible if it
214 * is needed, and otherwise kept hidden. #ELM_SCROLLER_POLICY_ON turns
215 * it on all the time, and #ELM_SCROLLER_POLICY_OFF always keeps it off.
216 * This applies respectively for the horizontal and vertical scrollbars.
218 * The both are disabled by default, i.e., are set to
219 * #ELM_SCROLLER_POLICY_OFF.
221 * @ingroup Diskselector
223 EAPI void elm_diskselector_scroller_policy_set(Evas_Object *obj, Elm_Scroller_Policy policy_h, Elm_Scroller_Policy policy_v);
226 * Remove all diskselector's items.
228 * @param obj The diskselector object.
230 * @see elm_object_item_del()
231 * @see elm_diskselector_item_append()
233 * @ingroup Diskselector
235 EAPI void elm_diskselector_clear(Evas_Object *obj);
238 * Get a list of all the diskselector items.
240 * @param obj The diskselector object.
241 * @return An @c Eina_List of diskselector items, #Elm_Object_Item,
242 * or @c NULL on failure.
244 * @see elm_diskselector_item_append()
245 * @see elm_object_item_del()
246 * @see elm_diskselector_clear()
248 * @ingroup Diskselector
250 EAPI const Eina_List *elm_diskselector_items_get(const Evas_Object *obj);
253 * Appends a new item to the diskselector object.
255 * @param obj The diskselector object.
256 * @param label The label of the diskselector item.
257 * @param icon The icon object to use at left side of the item. An
258 * icon can be any Evas object, but usually it is an icon created
259 * with elm_icon_add().
260 * @param func The function to call when the item is selected.
261 * @param data The data to associate with the item for related callbacks.
263 * @return The created item or @c NULL upon failure.
265 * A new item will be created and appended to the diskselector, i.e., will
266 * be set as last item. Also, if there is no selected item, it will
267 * be selected. This will always happens for the first appended item.
269 * If no icon is set, label will be centered on item position, otherwise
270 * the icon will be placed at left of the label, that will be shifted
273 * Items created with this method can be deleted with
274 * elm_object_item_del().
276 * Associated @p data can be properly freed when item is deleted if a
277 * callback function is set with elm_object_item_del_cb_set().
279 * If a function is passed as argument, it will be called everytime this item
280 * is selected, i.e., the user stops the diskselector with this
281 * item on center position. If such function isn't needed, just passing
282 * @c NULL as @p func is enough. The same should be done for @p data.
284 * Simple example (with no function callback or data associated):
286 * disk = elm_diskselector_add(win);
287 * ic = elm_icon_add(win);
288 * elm_icon_file_set(ic, "path/to/image", NULL);
289 * elm_icon_scale_set(ic, EINA_TRUE, EINA_TRUE);
290 * elm_diskselector_item_append(disk, "label", ic, NULL, NULL);
293 * @see elm_object_item_del()
294 * @see elm_diskselector_clear()
295 * @see elm_icon_add()
297 * @ingroup Diskselector
299 EAPI Elm_Object_Item *elm_diskselector_item_append(Evas_Object *obj, const char *label, Evas_Object *icon, Evas_Smart_Cb func, const void *data);
302 * Get the selected item.
304 * @param obj The diskselector object.
305 * @return The selected diskselector item.
307 * The selected item can be unselected with function
308 * elm_diskselector_item_selected_set(), and the first item of
309 * diskselector will be selected.
311 * The selected item always will be centered on diskselector, with
312 * full label displayed, i.e., max lenght set to side labels won't
313 * apply on the selected item. More details on
314 * elm_diskselector_side_label_length_set().
316 * @ingroup Diskselector
318 EAPI Elm_Object_Item *elm_diskselector_selected_item_get(const Evas_Object *obj);
321 * Set the selected state of an item.
323 * @param it The diskselector item
324 * @param selected The selected state
326 * This sets the selected state of the given item @p it.
327 * @c EINA_TRUE for selected, @c EINA_FALSE for not selected.
329 * If a new item is selected the previosly selected will be unselected.
330 * Previoulsy selected item can be get with function
331 * elm_diskselector_selected_item_get().
333 * If the item @p it is unselected, the first item of diskselector will
336 * Selected items will be visible on center position of diskselector.
337 * So if it was on another position before selected, or was invisible,
338 * diskselector will animate items until the selected item reaches center
341 * @see elm_diskselector_item_selected_get()
342 * @see elm_diskselector_selected_item_get()
344 * @ingroup Diskselector
346 EAPI void elm_diskselector_item_selected_set(Elm_Object_Item *it, Eina_Bool selected);
349 * Get whether the @p item is selected or not.
351 * @param it The diskselector item.
352 * @return @c EINA_TRUE means item is selected. @c EINA_FALSE indicates
353 * it's not. If @p obj is @c NULL, @c EINA_FALSE is returned.
355 * @see elm_diskselector_selected_item_set() for details.
356 * @see elm_diskselector_item_selected_get()
358 * @ingroup Diskselector
360 EAPI Eina_Bool elm_diskselector_item_selected_get(const Elm_Object_Item *it);
363 * Get the first item of the diskselector.
365 * @param obj The diskselector object.
366 * @return The first item, or @c NULL if none.
368 * The list of items follows append order. So it will return the first
369 * item appended to the widget that wasn't deleted.
371 * @see elm_diskselector_item_append()
372 * @see elm_diskselector_items_get()
374 * @ingroup Diskselector
376 EAPI Elm_Object_Item *elm_diskselector_first_item_get(const Evas_Object *obj);
379 * Get the last item of the diskselector.
381 * @param obj The diskselector object.
382 * @return The last item, or @c NULL if none.
384 * The list of items follows append order. So it will return last first
385 * item appended to the widget that wasn't deleted.
387 * @see elm_diskselector_item_append()
388 * @see elm_diskselector_items_get()
390 * @ingroup Diskselector
392 EAPI Elm_Object_Item *elm_diskselector_last_item_get(const Evas_Object *obj);
395 * Get the item before @p item in diskselector.
397 * @param it The diskselector item.
398 * @return The item before @p item, or @c NULL if none or on failure.
400 * The list of items follows append order. So it will return item appended
401 * just before @p item and that wasn't deleted.
403 * If it is the first item, @c NULL will be returned.
404 * First item can be get by elm_diskselector_first_item_get().
406 * @see elm_diskselector_item_append()
407 * @see elm_diskselector_items_get()
409 * @ingroup Diskselector
411 EAPI Elm_Object_Item *elm_diskselector_item_prev_get(const Elm_Object_Item *it);
414 * Get the item after @p item in diskselector.
416 * @param it The diskselector item.
417 * @return The item after @p item, or @c NULL if none or on failure.
419 * The list of items follows append order. So it will return item appended
420 * just after @p item and that wasn't deleted.
422 * If it is the last item, @c NULL will be returned.
423 * Last item can be get by elm_diskselector_last_item_get().
425 * @see elm_diskselector_item_append()
426 * @see elm_diskselector_items_get()
428 * @ingroup Diskselector
430 EAPI Elm_Object_Item *elm_diskselector_item_next_get(const Elm_Object_Item *it);