Toolbar: Add the more panel feature in toolbar. When it is the ELM_TOOLBAR_SHRINK_EXP...
[framework/uifw/elementary.git] / src / lib / elm_toolbar.h
1 /**
2  * @defgroup Toolbar Toolbar
3  * @ingroup Elementary
4  *
5  * @image html img/widget/toolbar/preview-00.png
6  * @image latex img/widget/toolbar/preview-00.eps width=\textwidth
7  *
8  * @image html img/toolbar.png
9  * @image latex img/toolbar.eps width=\textwidth
10  *
11  * A toolbar is a widget that displays a list of items inside
12  * a box. It can be scrollable, show a menu with items that don't fit
13  * to toolbar size or even crop them.
14  *
15  * Only one item can be selected at a time.
16  *
17  * Items can have multiple states, or show menus when selected by the user.
18  *
19  * Smart callbacks one can listen to:
20  * - "clicked" - when the user clicks on a toolbar item and becomes selected.
21  * - "longpressed" - when the toolbar is pressed for a certain amount of time.
22  * - "language,changed" - when the program language changes.
23  *
24  * Available styles for it:
25  * - @c "default"
26  * - @c "transparent" - no background or shadow, just show the content
27  *
28  * Default text parts of the toolbar items that you can use for are:
29  * @li "default" - label of the toolbar item
30  *
31  * Supported elm_object_item common APIs.
32  * @li @ref elm_object_item_disabled_set
33  * @li @ref elm_object_item_disabled_get
34  * @li @ref elm_object_item_part_text_set
35  * @li @ref elm_object_item_part_text_get
36  *
37  * List of examples:
38  * @li @ref toolbar_example_01
39  * @li @ref toolbar_example_02
40  * @li @ref toolbar_example_03
41  */
42
43 /**
44  * @addtogroup Toolbar
45  * @{
46  */
47
48 /**
49  * @enum _Elm_Toolbar_Shrink_Mode
50  * @typedef Elm_Toolbar_Shrink_Mode
51  *
52  * Set toolbar's items display behavior, it can be scrollable,
53  * show a menu with exceeding items, or simply hide them.
54  *
55  * @note Default value is #ELM_TOOLBAR_SHRINK_MENU. It reads value
56  * from elm config.
57  *
58  * Values <b> don't </b> work as bitmask, only one can be chosen.
59  *
60  * @see elm_toolbar_shrink_mode_set()
61  * @see elm_toolbar_shrink_mode_get()
62  *
63  * @ingroup Toolbar
64  */
65 typedef enum
66 {
67    ELM_TOOLBAR_SHRINK_NONE, /**< Set toolbar minimum size to fit all the items. */
68    ELM_TOOLBAR_SHRINK_HIDE, /**< Hide exceeding items. */
69    ELM_TOOLBAR_SHRINK_SCROLL, /**< Allow accessing exceeding items through a scroller. */
70    ELM_TOOLBAR_SHRINK_MENU, /**< Inserts a button to pop up a menu with exceeding items. */
71    ELM_TOOLBAR_SHRINK_EXPAND, /**< Expand all items according the size of the toolbar. */
72    ELM_TOOLBAR_SHRINK_LAST /**< Indicates error if returned by elm_toolbar_shrink_mode_get() */
73 } Elm_Toolbar_Shrink_Mode;
74
75 typedef struct _Elm_Toolbar_Item_State Elm_Toolbar_Item_State;    /**< State of a Elm_Toolbar_Item. Can be created with elm_toolbar_item_state_add() and removed with elm_toolbar_item_state_del(). */
76
77 /**
78  * Add a new toolbar widget to the given parent Elementary
79  * (container) object.
80  *
81  * @param parent The parent object.
82  * @return a new toolbar widget handle or @c NULL, on errors.
83  *
84  * This function inserts a new toolbar widget on the canvas.
85  *
86  * @ingroup Toolbar
87  */
88 EAPI Evas_Object                 *elm_toolbar_add(Evas_Object *parent);
89
90 /**
91  * Set the icon size, in pixels, to be used by toolbar items.
92  *
93  * @param obj The toolbar object
94  * @param icon_size The icon size in pixels
95  *
96  * @note Default value is @c 32. It reads value from elm config.
97  *
98  * @see elm_toolbar_icon_size_get()
99  *
100  * @ingroup Toolbar
101  */
102 EAPI void                         elm_toolbar_icon_size_set(Evas_Object *obj, int icon_size);
103
104 /**
105  * Get the icon size, in pixels, to be used by toolbar items.
106  *
107  * @param obj The toolbar object.
108  * @return The icon size in pixels.
109  *
110  * @see elm_toolbar_icon_size_set() for details.
111  *
112  * @ingroup Toolbar
113  */
114 EAPI int                          elm_toolbar_icon_size_get(const Evas_Object *obj);
115
116 /**
117  * Sets icon lookup order, for toolbar items' icons.
118  *
119  * @param obj The toolbar object.
120  * @param order The icon lookup order.
121  *
122  * Icons added before calling this function will not be affected.
123  * The default lookup order is #ELM_ICON_LOOKUP_THEME_FDO.
124  *
125  * @see elm_toolbar_icon_order_lookup_get()
126  *
127  * @ingroup Toolbar
128  */
129 EAPI void                         elm_toolbar_icon_order_lookup_set(Evas_Object *obj, Elm_Icon_Lookup_Order order);
130
131 /**
132  * Gets the icon lookup order.
133  *
134  * @param obj The toolbar object.
135  * @return The icon lookup order.
136  *
137  * @see elm_toolbar_icon_order_lookup_set() for details.
138  *
139  * @ingroup Toolbar
140  */
141 EAPI Elm_Icon_Lookup_Order        elm_toolbar_icon_order_lookup_get(const Evas_Object *obj);
142
143 /**
144  * Append item to the toolbar.
145  *
146  * @param obj The toolbar object.
147  * @param icon A string with icon name or the absolute path of an image file.
148  * @param label The label of the item.
149  * @param func The function to call when the item is clicked.
150  * @param data The data to associate with the item for related callbacks.
151  * @return The created item or @c NULL upon failure.
152  *
153  * A new item will be created and appended to the toolbar, i.e., will
154  * be set as @b last item.
155  *
156  * Items created with this method can be deleted with
157  * elm_object_item_del().
158  *
159  * Associated @p data can be properly freed when item is deleted if a
160  * callback function is set with elm_object_item_del_cb_set().
161  *
162  * If a function is passed as argument, it will be called every time this item
163  * is selected, i.e., the user clicks over an unselected item.
164  * If such function isn't needed, just passing
165  * @c NULL as @p func is enough. The same should be done for @p data.
166  *
167  * Toolbar will load icon image from fdo or current theme.
168  * This behavior can be set by elm_toolbar_icon_order_lookup_set() function.
169  * If an absolute path is provided it will load it direct from a file.
170  *
171  * @see elm_toolbar_item_icon_set()
172  * @see elm_object_item_del()
173  *
174  * @ingroup Toolbar
175  */
176 EAPI Elm_Object_Item             *elm_toolbar_item_append(Evas_Object *obj, const char *icon, const char *label, Evas_Smart_Cb func, const void *data);
177
178 /**
179  * Prepend item to the toolbar.
180  *
181  * @param obj The toolbar object.
182  * @param icon A string with icon name or the absolute path of an image file.
183  * @param label The label of the item.
184  * @param func The function to call when the item is clicked.
185  * @param data The data to associate with the item for related callbacks.
186  * @return The created item or @c NULL upon failure.
187  *
188  * A new item will be created and prepended to the toolbar, i.e., will
189  * be set as @b first item.
190  *
191  * Items created with this method can be deleted with
192  * elm_object_item_del().
193  *
194  * Associated @p data can be properly freed when item is deleted if a
195  * callback function is set with elm_object_item_del_cb_set().
196  *
197  * If a function is passed as argument, it will be called every time this item
198  * is selected, i.e., the user clicks over an unselected item.
199  * If such function isn't needed, just passing
200  * @c NULL as @p func is enough. The same should be done for @p data.
201  *
202  * Toolbar will load icon image from fdo or current theme.
203  * This behavior can be set by elm_toolbar_icon_order_lookup_set() function.
204  * If an absolute path is provided it will load it direct from a file.
205  *
206  * @see elm_toolbar_item_icon_set()
207  * @see elm_object_item_del()
208  *
209  * @ingroup Toolbar
210  */
211 EAPI Elm_Object_Item             *elm_toolbar_item_prepend(Evas_Object *obj, const char *icon, const char *label, Evas_Smart_Cb func, const void *data);
212
213 /**
214  * Insert a new item into the toolbar object before item @p before.
215  *
216  * @param obj The toolbar object.
217  * @param before The toolbar item to insert before.
218  * @param icon A string with icon name or the absolute path of an image file.
219  * @param label The label of the item.
220  * @param func The function to call when the item is clicked.
221  * @param data The data to associate with the item for related callbacks.
222  * @return The created item or @c NULL upon failure.
223  *
224  * A new item will be created and added to the toolbar. Its position in
225  * this toolbar will be just before item @p before.
226  *
227  * Items created with this method can be deleted with
228  * elm_object_item_del().
229  *
230  * Associated @p data can be properly freed when item is deleted if a
231  * callback function is set with elm_object_item_del_cb_set().
232  *
233  * If a function is passed as argument, it will be called every time this item
234  * is selected, i.e., the user clicks over an unselected item.
235  * If such function isn't needed, just passing
236  * @c NULL as @p func is enough. The same should be done for @p data.
237  *
238  * Toolbar will load icon image from fdo or current theme.
239  * This behavior can be set by elm_toolbar_icon_order_lookup_set() function.
240  * If an absolute path is provided it will load it direct from a file.
241  *
242  * @see elm_toolbar_item_icon_set()
243  * @see elm_object_item_del()
244  *
245  * @ingroup Toolbar
246  */
247 EAPI Elm_Object_Item             *elm_toolbar_item_insert_before(Evas_Object *obj, Elm_Object_Item *before, const char *icon, const char *label, Evas_Smart_Cb func, const void *data);
248
249 /**
250  * Insert a new item into the toolbar object after item @p after.
251  *
252  * @param obj The toolbar object.
253  * @param after The toolbar item to insert after.
254  * @param icon A string with icon name or the absolute path of an image file.
255  * @param label The label of the item.
256  * @param func The function to call when the item is clicked.
257  * @param data The data to associate with the item for related callbacks.
258  * @return The created item or @c NULL upon failure.
259  *
260  * A new item will be created and added to the toolbar. Its position in
261  * this toolbar will be just after item @p after.
262  *
263  * Items created with this method can be deleted with
264  * elm_object_item_del().
265  *
266  * Associated @p data can be properly freed when item is deleted if a
267  * callback function is set with elm_object_item_del_cb_set().
268  *
269  * If a function is passed as argument, it will be called every time this item
270  * is selected, i.e., the user clicks over an unselected item.
271  * If such function isn't needed, just passing
272  * @c NULL as @p func is enough. The same should be done for @p data.
273  *
274  * Toolbar will load icon image from fdo or current theme.
275  * This behavior can be set by elm_toolbar_icon_order_lookup_set() function.
276  * If an absolute path is provided it will load it direct from a file.
277  *
278  * @see elm_toolbar_item_icon_set()
279  * @see elm_object_item_del()
280  *
281  * @ingroup Toolbar
282  */
283 EAPI Elm_Object_Item             *elm_toolbar_item_insert_after(Evas_Object *obj, Elm_Object_Item *after, const char *icon, const char *label, Evas_Smart_Cb func, const void *data);
284
285 /**
286  * Get the first item in the given toolbar widget's list of
287  * items.
288  *
289  * @param obj The toolbar object
290  * @return The first item or @c NULL, if it has no items (and on
291  * errors)
292  *
293  * @see elm_toolbar_item_append()
294  * @see elm_toolbar_last_item_get()
295  *
296  * @ingroup Toolbar
297  */
298 EAPI Elm_Object_Item             *elm_toolbar_first_item_get(const Evas_Object *obj);
299
300 /**
301  * Get the last item in the given toolbar widget's list of
302  * items.
303  *
304  * @param obj The toolbar object
305  * @return The last item or @c NULL, if it has no items (and on
306  * errors)
307  *
308  * @see elm_toolbar_item_prepend()
309  * @see elm_toolbar_first_item_get()
310  *
311  * @ingroup Toolbar
312  */
313 EAPI Elm_Object_Item             *elm_toolbar_last_item_get(const Evas_Object *obj);
314
315 /**
316  * Get the item after @p item in toolbar.
317  *
318  * @param it The toolbar item.
319  * @return The item after @p item, or @c NULL if none or on failure.
320  *
321  * @note If it is the last item, @c NULL will be returned.
322  *
323  * @see elm_toolbar_item_append()
324  *
325  * @ingroup Toolbar
326  */
327 EAPI Elm_Object_Item             *elm_toolbar_item_next_get(const Elm_Object_Item *it);
328
329 /**
330  * Get the item before @p item in toolbar.
331  *
332  * @param it The toolbar item.
333  * @return The item before @p item, or @c NULL if none or on failure.
334  *
335  * @note If it is the first item, @c NULL will be returned.
336  *
337  * @see elm_toolbar_item_prepend()
338  *
339  * @ingroup Toolbar
340  */
341 EAPI Elm_Object_Item             *elm_toolbar_item_prev_get(const Elm_Object_Item *it);
342
343 /**
344  * Set the priority of a toolbar item.
345  *
346  * @param it The toolbar item.
347  * @param priority The item priority. The default is zero.
348  *
349  * This is used only when the toolbar shrink mode is set to
350  * #ELM_TOOLBAR_SHRINK_MENU or #ELM_TOOLBAR_SHRINK_HIDE.
351  * When space is less than required, items with low priority
352  * will be removed from the toolbar and added to a dynamically-created menu,
353  * while items with higher priority will remain on the toolbar,
354  * with the same order they were added.
355  *
356  * @see elm_toolbar_item_priority_get()
357  *
358  * @ingroup Toolbar
359  */
360 EAPI void                         elm_toolbar_item_priority_set(Elm_Object_Item *it, int priority);
361
362 /**
363  * Get the priority of a toolbar item.
364  *
365  * @param it The toolbar item.
366  * @return The @p item priority, or @c 0 on failure.
367  *
368  * @see elm_toolbar_item_priority_set() for details.
369  *
370  * @ingroup Toolbar
371  */
372 EAPI int                          elm_toolbar_item_priority_get(const Elm_Object_Item *it);
373
374 /**
375  * Returns a pointer to a toolbar item by its label.
376  *
377  * @param obj The toolbar object.
378  * @param label The label of the item to find.
379  *
380  * @return The pointer to the toolbar item matching @p label or @c NULL
381  * on failure.
382  *
383  * @ingroup Toolbar
384  */
385 EAPI Elm_Object_Item             *elm_toolbar_item_find_by_label(const Evas_Object *obj, const char *label);
386
387 /*
388  * Get whether the @p item is selected or not.
389  *
390  * @param it The toolbar item.
391  * @return @c EINA_TRUE means item is selected. @c EINA_FALSE indicates
392  * it's not. If @p obj is @c NULL, @c EINA_FALSE is returned.
393  *
394  * @see elm_toolbar_selected_item_set() for details.
395  * @see elm_toolbar_item_selected_get()
396  *
397  * @ingroup Toolbar
398  */
399 EAPI Eina_Bool                    elm_toolbar_item_selected_get(const Elm_Object_Item *it);
400
401 /**
402  * Set the selected state of an item.
403  *
404  * @param it The toolbar item
405  * @param selected The selected state
406  *
407  * This sets the selected state of the given item @p it.
408  * @c EINA_TRUE for selected, @c EINA_FALSE for not selected.
409  *
410  * If a new item is selected the previously selected will be unselected.
411  * Previously selected item can be get with function
412  * elm_toolbar_selected_item_get().
413  *
414  * Selected items will be highlighted.
415  *
416  * @see elm_toolbar_item_selected_get()
417  * @see elm_toolbar_selected_item_get()
418  *
419  * @ingroup Toolbar
420  */
421 EAPI void                         elm_toolbar_item_selected_set(Elm_Object_Item *it, Eina_Bool selected);
422
423 /**
424  * Get the selected item.
425  *
426  * @param obj The toolbar object.
427  * @return The selected toolbar item.
428  *
429  * The selected item can be unselected with function
430  * elm_toolbar_item_selected_set().
431  *
432  * The selected item always will be highlighted on toolbar.
433  *
434  * @see elm_toolbar_selected_items_get()
435  *
436  * @ingroup Toolbar
437  */
438 EAPI Elm_Object_Item             *elm_toolbar_selected_item_get(const Evas_Object *obj);
439
440 /**
441  * Get the more item.
442  *
443  * @param obj The toolbar object.
444  * @return The toolbar more item.
445  *
446  * The more item can be changed with function
447  * elm_object_item_text_set() and elm_object_item_content_set.
448  *
449  * @ingroup Toolbar
450  */
451 EAPI Elm_Object_Item             *elm_toolbar_more_item_get(const Evas_Object *obj);
452
453 /**
454  * Set the icon associated with @p item.
455  *
456  * @param it The toolbar item.
457  * @param icon A string with icon name or the absolute path of an image file.
458  *
459  * Toolbar will load icon image from fdo or current theme.
460  * This behavior can be set by elm_toolbar_icon_order_lookup_set() function.
461  * If an absolute path is provided it will load it direct from a file.
462  *
463  * @see elm_toolbar_icon_order_lookup_set()
464  * @see elm_toolbar_icon_order_lookup_get()
465  *
466  * @ingroup Toolbar
467  */
468 EAPI void                         elm_toolbar_item_icon_set(Elm_Object_Item *it, const char *icon);
469
470 /**
471  * Get the string used to set the icon of @p item.
472  *
473  * @param it The toolbar item.
474  * @return The string associated with the icon object.
475  *
476  * @see elm_toolbar_item_icon_set() for details.
477  *
478  * @ingroup Toolbar
479  */
480 EAPI const char                  *elm_toolbar_item_icon_get(const Elm_Object_Item *it);
481
482 /**
483  * Get the object of @p item.
484  *
485  * @param it The toolbar item.
486  * @return The object
487  *
488  * @ingroup Toolbar
489  */
490 EAPI Evas_Object                 *elm_toolbar_item_object_get(const Elm_Object_Item *it);
491
492 /**
493  * Get the icon object of @p item.
494  *
495  * @param it The toolbar item.
496  * @return The icon object
497  *
498  * @see elm_toolbar_item_icon_set(), elm_toolbar_item_icon_file_set(),
499  * or elm_toolbar_item_icon_memfile_set() for details.
500  *
501  * @ingroup Toolbar
502  */
503 EAPI Evas_Object                 *elm_toolbar_item_icon_object_get(Elm_Object_Item *it);
504
505 /**
506  * Set the icon associated with @p item to an image in a binary buffer.
507  *
508  * @param it The toolbar item.
509  * @param img The binary data that will be used as an image
510  * @param size The size of binary data @p img
511  * @param format Optional format of @p img to pass to the image loader
512  * @param key Optional key of @p img to pass to the image loader (eg. if @p img is an edje file)
513  *
514  * @return (@c EINA_TRUE = success, @c EINA_FALSE = error)
515  *
516  * @note The icon image set by this function can be changed by
517  * elm_toolbar_item_icon_set().
518  *
519  * @ingroup Toolbar
520  */
521 EAPI Eina_Bool                    elm_toolbar_item_icon_memfile_set(Elm_Object_Item *it, const void *img, size_t size, const char *format, const char *key);
522
523 /**
524  * Set the icon associated with @p item to an image in a binary buffer.
525  *
526  * @param it The toolbar item.
527  * @param file The file that contains the image
528  * @param key Optional key of @p img to pass to the image loader (eg. if @p img is an edje file)
529  *
530  * @return (@c EINA_TRUE = success, @c EINA_FALSE = error)
531  *
532  * @note The icon image set by this function can be changed by
533  * elm_toolbar_item_icon_set().
534  *
535  * @ingroup Toolbar
536  */
537 EAPI Eina_Bool                    elm_toolbar_item_icon_file_set(Elm_Object_Item *it, const char *file, const char *key);
538
539 /**
540  * Set or unset item as a separator.
541  *
542  * @param it The toolbar item.
543  * @param separator @c EINA_TRUE to set item @p item as separator or
544  * @c EINA_FALSE to unset, i.e., item will be used as a regular item.
545  *
546  * Items aren't set as separator by default.
547  *
548  * If set as separator it will display separator theme, so won't display
549  * icons or label.
550  *
551  * @see elm_toolbar_item_separator_get()
552  *
553  * @ingroup Toolbar
554  */
555 EAPI void                         elm_toolbar_item_separator_set(Elm_Object_Item *it, Eina_Bool separator);
556
557 /**
558  * Get a value whether item is a separator or not.
559  *
560  * @param it The toolbar item.
561  * @return @c EINA_TRUE means item @p it is a separator. @c EINA_FALSE
562  * indicates it's not. If @p it is @c NULL, @c EINA_FALSE is returned.
563  *
564  * @see elm_toolbar_item_separator_set() for details.
565  *
566  * @ingroup Toolbar
567  */
568 EAPI Eina_Bool                    elm_toolbar_item_separator_get(const Elm_Object_Item *it);
569
570 /**
571  * Set the shrink state of toolbar @p obj.
572  *
573  * @param obj The toolbar object.
574  * @param shrink_mode Toolbar's items display behavior.
575  *
576  * The toolbar won't scroll if #ELM_TOOLBAR_SHRINK_NONE,
577  * but will enforce a minimum size so all the items will fit, won't scroll
578  * and won't show the items that don't fit if #ELM_TOOLBAR_SHRINK_HIDE,
579  * will scroll if #ELM_TOOLBAR_SHRINK_SCROLL, and will create a button to
580  * pop up excess elements with #ELM_TOOLBAR_SHRINK_MENU.
581  *
582  * @ingroup Toolbar
583  */
584 EAPI void                         elm_toolbar_shrink_mode_set(Evas_Object *obj, Elm_Toolbar_Shrink_Mode shrink_mode);
585
586 /**
587  * Get the shrink mode of toolbar @p obj.
588  *
589  * @param obj The toolbar object.
590  * @return Toolbar's items display behavior.
591  *
592  * @see elm_toolbar_shrink_mode_set() for details.
593  *
594  * @ingroup Toolbar
595  */
596 EAPI Elm_Toolbar_Shrink_Mode      elm_toolbar_shrink_mode_get(const Evas_Object *obj);
597
598 /**
599  * Enable/disable homogeneous mode.
600  *
601  * @param obj The toolbar object
602  * @param homogeneous Assume the items within the toolbar are of the
603  * same size (EINA_TRUE = on, EINA_FALSE = off). Default is @c EINA_FALSE.
604  *
605  * This will enable the homogeneous mode where items are of the same size.
606  * @see elm_toolbar_homogeneous_get()
607  *
608  * @ingroup Toolbar
609  */
610 EAPI void                         elm_toolbar_homogeneous_set(Evas_Object *obj, Eina_Bool homogeneous);
611
612 /**
613  * Get whether the homogeneous mode is enabled.
614  *
615  * @param obj The toolbar object.
616  * @return Assume the items within the toolbar are of the same height
617  * and width (EINA_TRUE = on, EINA_FALSE = off).
618  *
619  * @see elm_toolbar_homogeneous_set()
620  *
621  * @ingroup Toolbar
622  */
623 EAPI Eina_Bool                    elm_toolbar_homogeneous_get(const Evas_Object *obj);
624
625 /**
626  * Set the parent object of the toolbar items' menus.
627  *
628  * @param obj The toolbar object.
629  * @param parent The parent of the menu objects.
630  *
631  * Each item can be set as item menu, with elm_toolbar_item_menu_set().
632  *
633  * For more details about setting the parent for toolbar menus, see
634  * elm_menu_parent_set().
635  *
636  * @see elm_menu_parent_set() for details.
637  * @see elm_toolbar_item_menu_set() for details.
638  *
639  * @ingroup Toolbar
640  */
641 EAPI void                         elm_toolbar_menu_parent_set(Evas_Object *obj, Evas_Object *parent);
642
643 /**
644  * Get the parent object of the toolbar items' menus.
645  *
646  * @param obj The toolbar object.
647  * @return The parent of the menu objects.
648  *
649  * @see elm_toolbar_menu_parent_set() for details.
650  *
651  * @ingroup Toolbar
652  */
653 EAPI Evas_Object                 *elm_toolbar_menu_parent_get(const Evas_Object *obj);
654
655 /**
656  * Set the alignment of the items.
657  *
658  * @param obj The toolbar object.
659  * @param align The new alignment, a float between <tt> 0.0 </tt>
660  * and <tt> 1.0 </tt>.
661  *
662  * Alignment of toolbar items, from <tt> 0.0 </tt> to indicates to align
663  * left, to <tt> 1.0 </tt>, to align to right. <tt> 0.5 </tt> centralize
664  * items.
665  *
666  * Centered items by default.
667  *
668  * @see elm_toolbar_align_get()
669  *
670  * @ingroup Toolbar
671  */
672 EAPI void                         elm_toolbar_align_set(Evas_Object *obj, double align);
673
674 /**
675  * Get the alignment of the items.
676  *
677  * @param obj The toolbar object.
678  * @return toolbar items alignment, a float between <tt> 0.0 </tt> and
679  * <tt> 1.0 </tt>.
680  *
681  * @see elm_toolbar_align_set() for details.
682  *
683  * @ingroup Toolbar
684  */
685 EAPI double                       elm_toolbar_align_get(const Evas_Object *obj);
686
687 /**
688  * Set whether the toolbar item opens a menu.
689  *
690  * @param it The toolbar item.
691  * @param menu If @c EINA_TRUE, @p item will opens a menu when selected.
692  *
693  * A toolbar item can be set to be a menu, using this function.
694  *
695  * Once it is set to be a menu, it can be manipulated through the
696  * menu-like function elm_toolbar_menu_parent_set() and the other
697  * elm_menu functions, using the Evas_Object @c menu returned by
698  * elm_toolbar_item_menu_get().
699  *
700  * So, items to be displayed in this item's menu should be added with
701  * elm_menu_item_add().
702  *
703  * The following code exemplifies the most basic usage:
704  * @code
705  * tb = elm_toolbar_add(win)
706  * item = elm_toolbar_item_append(tb, "refresh", "Menu", NULL, NULL);
707  * elm_toolbar_item_menu_set(item, EINA_TRUE);
708  * elm_toolbar_menu_parent_set(tb, win);
709  * menu = elm_toolbar_item_menu_get(item);
710  * elm_menu_item_add(menu, NULL, "edit-cut", "Cut", NULL, NULL);
711  * menu_item = elm_menu_item_add(menu, NULL, "edit-copy", "Copy", NULL,
712  * NULL);
713  * @endcode
714  *
715  * @see elm_toolbar_item_menu_get()
716  *
717  * @ingroup Toolbar
718  */
719 EAPI void                         elm_toolbar_item_menu_set(Elm_Object_Item *it, Eina_Bool menu);
720
721 /**
722  * Get toolbar item's menu.
723  *
724  * @param it The toolbar item.
725  * @return Item's menu object or @c NULL on failure.
726  *
727  * If @p item wasn't set as menu item with elm_toolbar_item_menu_set(),
728  * this function will set it.
729  *
730  * @see elm_toolbar_item_menu_set() for details.
731  *
732  * @ingroup Toolbar
733  */
734 EAPI Evas_Object                 *elm_toolbar_item_menu_get(const Elm_Object_Item *it);
735
736 /**
737  * Add a new state to @p item.
738  *
739  * @param it The toolbar item.
740  * @param icon A string with icon name or the absolute path of an image file.
741  * @param label The label of the new state.
742  * @param func The function to call when the item is clicked when this
743  * state is selected.
744  * @param data The data to associate with the state.
745  * @return The toolbar item state, or @c NULL upon failure.
746  *
747  * Toolbar will load icon image from fdo or current theme.
748  * This behavior can be set by elm_toolbar_icon_order_lookup_set() function.
749  * If an absolute path is provided it will load it direct from a file.
750  *
751  * States created with this function can be removed with
752  * elm_toolbar_item_state_del().
753  *
754  * @see elm_toolbar_item_state_del()
755  * @see elm_toolbar_item_state_sel()
756  * @see elm_toolbar_item_state_get()
757  *
758  * @ingroup Toolbar
759  */
760 EAPI Elm_Toolbar_Item_State      *elm_toolbar_item_state_add(Elm_Object_Item *it, const char *icon, const char *label, Evas_Smart_Cb func, const void *data);
761
762 /**
763  * Delete a previously added state to @p item.
764  *
765  * @param it The toolbar item.
766  * @param state The state to be deleted.
767  * @return @c EINA_TRUE on success or @c EINA_FALSE on failure.
768  *
769  * @see elm_toolbar_item_state_add()
770  */
771 EAPI Eina_Bool                    elm_toolbar_item_state_del(Elm_Object_Item *it, Elm_Toolbar_Item_State *state);
772
773 /**
774  * Set @p state as the current state of @p it.
775  *
776  * @param it The toolbar item.
777  * @param state The state to use.
778  * @return @c EINA_TRUE on success or @c EINA_FALSE on failure.
779  *
780  * If @p state is @c NULL, it won't select any state and the default item's
781  * icon and label will be used. It's the same behaviour than
782  * elm_toolbar_item_state_unset().
783  *
784  * @see elm_toolbar_item_state_unset()
785  *
786  * @ingroup Toolbar
787  */
788 EAPI Eina_Bool                    elm_toolbar_item_state_set(Elm_Object_Item *it, Elm_Toolbar_Item_State *state);
789
790 /**
791  * Unset the state of @p it.
792  *
793  * @param it The toolbar item.
794  *
795  * The default icon and label from this item will be displayed.
796  *
797  * @see elm_toolbar_item_state_set() for more details.
798  *
799  * @ingroup Toolbar
800  */
801 EAPI void                         elm_toolbar_item_state_unset(Elm_Object_Item *it);
802
803 /**
804  * Get the current state of @p it.
805  *
806  * @param it The toolbar item.
807  * @return The selected state or @c NULL if none is selected or on failure.
808  *
809  * @see elm_toolbar_item_state_set() for details.
810  * @see elm_toolbar_item_state_unset()
811  * @see elm_toolbar_item_state_add()
812  *
813  * @ingroup Toolbar
814  */
815 EAPI Elm_Toolbar_Item_State      *elm_toolbar_item_state_get(const Elm_Object_Item *it);
816
817 /**
818  * Get the state after selected state in toolbar's @p item.
819  *
820  * @param it The toolbar item to change state.
821  * @return The state after current state, or @c NULL on failure.
822  *
823  * If last state is selected, this function will return first state.
824  *
825  * @see elm_toolbar_item_state_set()
826  * @see elm_toolbar_item_state_add()
827  *
828  * @ingroup Toolbar
829  */
830 EAPI Elm_Toolbar_Item_State      *elm_toolbar_item_state_next(Elm_Object_Item *it);
831
832 /**
833  * Get the state before selected state in toolbar's @p item.
834  *
835  * @param it The toolbar item to change state.
836  * @return The state before current state, or @c NULL on failure.
837  *
838  * If first state is selected, this function will return last state.
839  *
840  * @see elm_toolbar_item_state_set()
841  * @see elm_toolbar_item_state_add()
842  *
843  * @ingroup Toolbar
844  */
845 EAPI Elm_Toolbar_Item_State      *elm_toolbar_item_state_prev(Elm_Object_Item *it);
846
847 /**
848  * Change a toolbar's orientation
849  * @param obj The toolbar object
850  * @param horizontal If @c EINA_TRUE, the toolbar is horizontal
851  * By default, a toolbar will be horizontal. Use this function to create a vertical toolbar.
852  * @ingroup Toolbar
853  */
854 EAPI void                         elm_toolbar_horizontal_set(Evas_Object *obj, Eina_Bool horizontal);
855
856 /**
857  * Get a toolbar's orientation
858  * @param obj The toolbar object
859  * @return If @c EINA_TRUE, the toolbar is horizontal
860  * By default, a toolbar will be horizontal. Use this function to determine whether a toolbar is vertical.
861  * @ingroup Toolbar
862  */
863 EAPI Eina_Bool                    elm_toolbar_horizontal_get(const Evas_Object *obj);
864
865 /**
866  * Get the number of items in a toolbar
867  * @param obj The toolbar object
868  * @return The number of items in @p obj toolbar
869  * @ingroup Toolbar
870  */
871 EAPI unsigned int                 elm_toolbar_items_count(const Evas_Object *obj);
872
873 /**
874  * Set the max number of visible items in a toolbar
875  * @param obj The toolbar object
876  * @param max The max number of visible items
877  *
878  * When it is the ELM_TOOLBAR_SHRINK_EXPAND mode, the items are shown only up to max number.
879  * The other items are located in more panel. The more panel can be shown when the more item is clicked.
880  *
881  * @see elm_toolbar_items_max_get()
882  *
883  * @ingroup Toolbar
884  */
885 EAPI void                         elm_toolbar_items_max_set(Evas_Object *obj, unsigned int max);
886
887 /**
888  * Get the max number of visible items in a toolbar
889  * @param obj The toolbar object
890  * @return The max number of items in @p obj toolbar
891  *
892  * @see elm_toolbar_items_max_set()
893  *
894  * @ingroup Toolbar
895  */
896 EAPI unsigned int                 elm_toolbar_items_max_get(const Evas_Object *obj);
897
898 /**
899  * Set the toolbar select mode.
900  *
901  * @param obj The toolbar object
902  * @param mode The select mode
903  *
904  * elm_toolbar_select_mode_set() changes item select mode in the toolbar widget.
905  * - ELM_OBJECT_SELECT_MODE_DEFAULT : Items will only call their selection func and
906  *      callback when first becoming selected. Any further clicks will
907  *      do nothing, unless you set always select mode.
908  * - ELM_OBJECT_SELECT_MODE_ALWAYS :  This means that, even if selected,
909  *      every click will make the selected callbacks be called.
910  * - ELM_OBJECT_SELECT_MODE_NONE : This will turn off the ability to select items
911  *      entirely and they will neither appear selected nor call selected
912  *      callback functions.
913  *
914  * @see elm_toolbar_select_mode_get()
915  *
916  * @ingroup Toolbar
917  */
918 EAPI void
919 elm_toolbar_select_mode_set(Evas_Object *obj, Elm_Object_Select_Mode mode);
920
921 /**
922  * Get the toolbar select mode.
923  *
924  * @param obj The toolbar object
925  * @return The select mode
926  * (If getting mode is failed, it returns ELM_OBJECT_SELECT_MODE_MAX)
927  *
928  * @see elm_toolbar_select_mode_set()
929  *
930  * @ingroup Toolbar
931  */
932 EAPI Elm_Object_Select_Mode
933 elm_toolbar_select_mode_get(const Evas_Object *obj);
934
935 /**
936  * @}
937  */