24e8a2219908896d289fce4b9a8f7a14df382d21
[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  * - "language,changed" - when the program language changes
22  *
23  * Available styles for it:
24  * - @c "default"
25  * - @c "transparent" - no background or shadow, just show the content
26  *
27  * Default text parts of the toolbar items that you can use for are:
28  * @li "default" - label of the toolbar item
29  *
30  * Supported elm_object_item common APIs.
31  * @li elm_object_item_disabled_set
32  * @li elm_object_item_text_set
33  * @li elm_object_item_part_text_set
34  * @li elm_object_item_text_get
35  * @li 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 scrollabel,
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 choosen.
59  *
60  * @see elm_toolbar_mode_shrink_set()
61  * @see elm_toolbar_mode_shrink_get()
62  *
63  * @ingroup Toolbar
64  */
65 typedef enum
66 {
67    ELM_TOOLBAR_SHRINK_NONE, /**< Set toolbar minimun 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_LAST /**< Indicates error if returned by elm_toolbar_shrink_mode_get() */
72 } Elm_Toolbar_Shrink_Mode;
73
74 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(). */
75
76 /**
77  * Add a new toolbar widget to the given parent Elementary
78  * (container) object.
79  *
80  * @param parent The parent object.
81  * @return a new toolbar widget handle or @c NULL, on errors.
82  *
83  * This function inserts a new toolbar widget on the canvas.
84  *
85  * @ingroup Toolbar
86  */
87 EAPI Evas_Object                 *elm_toolbar_add(Evas_Object *parent);
88
89 /**
90  * Set the icon size, in pixels, to be used by toolbar items.
91  *
92  * @param obj The toolbar object
93  * @param icon_size The icon size in pixels
94  *
95  * @note Default value is @c 32. It reads value from elm config.
96  *
97  * @see elm_toolbar_icon_size_get()
98  *
99  * @ingroup Toolbar
100  */
101 EAPI void                         elm_toolbar_icon_size_set(Evas_Object *obj, int icon_size);
102
103 /**
104  * Get the icon size, in pixels, to be used by toolbar items.
105  *
106  * @param obj The toolbar object.
107  * @return The icon size in pixels.
108  *
109  * @see elm_toolbar_icon_size_set() for details.
110  *
111  * @ingroup Toolbar
112  */
113 EAPI int                          elm_toolbar_icon_size_get(const Evas_Object *obj);
114
115 /**
116  * Sets icon lookup order, for toolbar items' icons.
117  *
118  * @param obj The toolbar object.
119  * @param order The icon lookup order.
120  *
121  * Icons added before calling this function will not be affected.
122  * The default lookup order is #ELM_ICON_LOOKUP_THEME_FDO.
123  *
124  * @see elm_toolbar_icon_order_lookup_get()
125  *
126  * @ingroup Toolbar
127  */
128 EAPI void                         elm_toolbar_icon_order_lookup_set(Evas_Object *obj, Elm_Icon_Lookup_Order order);
129
130 /**
131  * Gets the icon lookup order.
132  *
133  * @param obj The toolbar object.
134  * @return The icon lookup order.
135  *
136  * @see elm_toolbar_icon_order_lookup_set() for details.
137  *
138  * @ingroup Toolbar
139  */
140 EAPI Elm_Icon_Lookup_Order        elm_toolbar_icon_order_lookup_get(const Evas_Object *obj);
141
142 /**
143  * Set whether the toolbar should always have an item selected.
144  *
145  * @param obj The toolbar object.
146  * @param wrap @c EINA_TRUE to enable always-select mode or @c EINA_FALSE to
147  * disable it.
148  *
149  * This will cause the toolbar to always have an item selected, and clicking
150  * the selected item will not cause a selected event to be emitted. Enabling this mode
151  * will immediately select the first toolbar item.
152  *
153  * Always-selected is disabled by default.
154  *
155  * @see elm_toolbar_always_select_mode_get().
156  *
157  * @ingroup Toolbar
158  */
159 EAPI void                         elm_toolbar_always_select_mode_set(Evas_Object *obj, Eina_Bool always_select);
160
161 /**
162  * Get whether the toolbar should always have an item selected.
163  *
164  * @param obj The toolbar object.
165  * @return @c EINA_TRUE means an item will always be selected, @c EINA_FALSE indicates
166  * that it is possible to have no items selected. If @p obj is @c NULL, @c EINA_FALSE is returned.
167  *
168  * @see elm_toolbar_always_select_mode_set() for details.
169  *
170  * @ingroup Toolbar
171  */
172 EAPI Eina_Bool                    elm_toolbar_always_select_mode_get(const Evas_Object *obj);
173
174 /**
175  * Set whether the toolbar items' should be selected by the user or not.
176  *
177  * @param obj The toolbar object.
178  * @param wrap @c EINA_TRUE to disable selection or @c EINA_FALSE to
179  * enable it.
180  *
181  * This will turn off the ability to select items entirely and they will
182  * neither appear selected nor emit selected signals. The clicked
183  * callback function will still be called.
184  *
185  * Selection is enabled by default.
186  *
187  * @see elm_toolbar_no_select_mode_get().
188  *
189  * @ingroup Toolbar
190  */
191 EAPI void                         elm_toolbar_no_select_mode_set(Evas_Object *obj, Eina_Bool no_select);
192
193 /**
194  * Set whether the toolbar items' should be selected by the user or not.
195  *
196  * @param obj The toolbar object.
197  * @return @c EINA_TRUE means items can be selected. @c EINA_FALSE indicates
198  * they can't. If @p obj is @c NULL, @c EINA_FALSE is returned.
199  *
200  * @see elm_toolbar_no_select_mode_set() for details.
201  *
202  * @ingroup Toolbar
203  */
204 EAPI Eina_Bool                    elm_toolbar_no_select_mode_get(const Evas_Object *obj);
205
206 /**
207  * Append item to the toolbar.
208  *
209  * @param obj The toolbar object.
210  * @param icon A string with icon name or the absolute path of an image file.
211  * @param label The label of the item.
212  * @param func The function to call when the item is clicked.
213  * @param data The data to associate with the item for related callbacks.
214  * @return The created item or @c NULL upon failure.
215  *
216  * A new item will be created and appended to the toolbar, i.e., will
217  * be set as @b last item.
218  *
219  * Items created with this method can be deleted with
220  * elm_toolbar_item_del().
221  *
222  * Associated @p data can be properly freed when item is deleted if a
223  * callback function is set with elm_toolbar_item_del_cb_set().
224  *
225  * If a function is passed as argument, it will be called everytime this item
226  * is selected, i.e., the user clicks over an unselected item.
227  * If such function isn't needed, just passing
228  * @c NULL as @p func is enough. The same should be done for @p data.
229  *
230  * Toolbar will load icon image from fdo or current theme.
231  * This behavior can be set by elm_toolbar_icon_order_lookup_set() function.
232  * If an absolute path is provided it will load it direct from a file.
233  *
234  * @see elm_toolbar_item_icon_set()
235  * @see elm_toolbar_item_del()
236  * @see elm_toolbar_item_del_cb_set()
237  *
238  * @ingroup Toolbar
239  */
240 EAPI Elm_Object_Item             *elm_toolbar_item_append(Evas_Object *obj, const char *icon, const char *label, Evas_Smart_Cb func, const void *data);
241
242 /**
243  * Prepend item to the toolbar.
244  *
245  * @param obj The toolbar object.
246  * @param icon A string with icon name or the absolute path of an image file.
247  * @param label The label of the item.
248  * @param func The function to call when the item is clicked.
249  * @param data The data to associate with the item for related callbacks.
250  * @return The created item or @c NULL upon failure.
251  *
252  * A new item will be created and prepended to the toolbar, i.e., will
253  * be set as @b first item.
254  *
255  * Items created with this method can be deleted with
256  * elm_toolbar_item_del().
257  *
258  * Associated @p data can be properly freed when item is deleted if a
259  * callback function is set with elm_toolbar_item_del_cb_set().
260  *
261  * If a function is passed as argument, it will be called everytime this item
262  * is selected, i.e., the user clicks over an unselected item.
263  * If such function isn't needed, just passing
264  * @c NULL as @p func is enough. The same should be done for @p data.
265  *
266  * Toolbar will load icon image from fdo or current theme.
267  * This behavior can be set by elm_toolbar_icon_order_lookup_set() function.
268  * If an absolute path is provided it will load it direct from a file.
269  *
270  * @see elm_toolbar_item_icon_set()
271  * @see elm_toolbar_item_del()
272  * @see elm_toolbar_item_del_cb_set()
273  *
274  * @ingroup Toolbar
275  */
276 EAPI Elm_Object_Item             *elm_toolbar_item_prepend(Evas_Object *obj, const char *icon, const char *label, Evas_Smart_Cb func, const void *data);
277
278 /**
279  * Insert a new item into the toolbar object before item @p before.
280  *
281  * @param obj The toolbar object.
282  * @param before The toolbar item to insert before.
283  * @param icon A string with icon name or the absolute path of an image file.
284  * @param label The label of the item.
285  * @param func The function to call when the item is clicked.
286  * @param data The data to associate with the item for related callbacks.
287  * @return The created item or @c NULL upon failure.
288  *
289  * A new item will be created and added to the toolbar. Its position in
290  * this toolbar will be just before item @p before.
291  *
292  * Items created with this method can be deleted with
293  * elm_toolbar_item_del().
294  *
295  * Associated @p data can be properly freed when item is deleted if a
296  * callback function is set with elm_toolbar_item_del_cb_set().
297  *
298  * If a function is passed as argument, it will be called everytime this item
299  * is selected, i.e., the user clicks over an unselected item.
300  * If such function isn't needed, just passing
301  * @c NULL as @p func is enough. The same should be done for @p data.
302  *
303  * Toolbar will load icon image from fdo or current theme.
304  * This behavior can be set by elm_toolbar_icon_order_lookup_set() function.
305  * If an absolute path is provided it will load it direct from a file.
306  *
307  * @see elm_toolbar_item_icon_set()
308  * @see elm_toolbar_item_del()
309  * @see elm_toolbar_item_del_cb_set()
310  *
311  * @ingroup Toolbar
312  */
313 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);
314
315 /**
316  * Insert a new item into the toolbar object after item @p after.
317  *
318  * @param obj The toolbar object.
319  * @param after The toolbar item to insert after.
320  * @param icon A string with icon name or the absolute path of an image file.
321  * @param label The label of the item.
322  * @param func The function to call when the item is clicked.
323  * @param data The data to associate with the item for related callbacks.
324  * @return The created item or @c NULL upon failure.
325  *
326  * A new item will be created and added to the toolbar. Its position in
327  * this toolbar will be just after item @p after.
328  *
329  * Items created with this method can be deleted with
330  * elm_toolbar_item_del().
331  *
332  * Associated @p data can be properly freed when item is deleted if a
333  * callback function is set with elm_toolbar_item_del_cb_set().
334  *
335  * If a function is passed as argument, it will be called everytime this item
336  * is selected, i.e., the user clicks over an unselected item.
337  * If such function isn't needed, just passing
338  * @c NULL as @p func is enough. The same should be done for @p data.
339  *
340  * Toolbar will load icon image from fdo or current theme.
341  * This behavior can be set by elm_toolbar_icon_order_lookup_set() function.
342  * If an absolute path is provided it will load it direct from a file.
343  *
344  * @see elm_toolbar_item_icon_set()
345  * @see elm_toolbar_item_del()
346  * @see elm_toolbar_item_del_cb_set()
347  *
348  * @ingroup Toolbar
349  */
350 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);
351
352 /**
353  * Get the first item in the given toolbar widget's list of
354  * items.
355  *
356  * @param obj The toolbar object
357  * @return The first item or @c NULL, if it has no items (and on
358  * errors)
359  *
360  * @see elm_toolbar_item_append()
361  * @see elm_toolbar_last_item_get()
362  *
363  * @ingroup Toolbar
364  */
365 EAPI Elm_Object_Item             *elm_toolbar_first_item_get(const Evas_Object *obj);
366
367 /**
368  * Get the last item in the given toolbar widget's list of
369  * items.
370  *
371  * @param obj The toolbar object
372  * @return The last item or @c NULL, if it has no items (and on
373  * errors)
374  *
375  * @see elm_toolbar_item_prepend()
376  * @see elm_toolbar_first_item_get()
377  *
378  * @ingroup Toolbar
379  */
380 EAPI Elm_Object_Item             *elm_toolbar_last_item_get(const Evas_Object *obj);
381
382 /**
383  * Get the item after @p item in toolbar.
384  *
385  * @param it The toolbar item.
386  * @return The item after @p item, or @c NULL if none or on failure.
387  *
388  * @note If it is the last item, @c NULL will be returned.
389  *
390  * @see elm_toolbar_item_append()
391  *
392  * @ingroup Toolbar
393  */
394 EAPI Elm_Object_Item             *elm_toolbar_item_next_get(const Elm_Object_Item *it);
395
396 /**
397  * Get the item before @p item in toolbar.
398  *
399  * @param item The toolbar item.
400  * @return The item before @p item, or @c NULL if none or on failure.
401  *
402  * @note If it is the first item, @c NULL will be returned.
403  *
404  * @see elm_toolbar_item_prepend()
405  *
406  * @ingroup Toolbar
407  */
408 EAPI Elm_Object_Item             *elm_toolbar_item_prev_get(const Elm_Object_Item *it);
409
410 /**
411  * Set the priority of a toolbar item.
412  *
413  * @param it The toolbar item.
414  * @param priority The item priority. The default is zero.
415  *
416  * This is used only when the toolbar shrink mode is set to
417  * #ELM_TOOLBAR_SHRINK_MENU or #ELM_TOOLBAR_SHRINK_HIDE.
418  * When space is less than required, items with low priority
419  * will be removed from the toolbar and added to a dynamically-created menu,
420  * while items with higher priority will remain on the toolbar,
421  * with the same order they were added.
422  *
423  * @see elm_toolbar_item_priority_get()
424  *
425  * @ingroup Toolbar
426  */
427 EAPI void                         elm_toolbar_item_priority_set(Elm_Object_Item *it, int priority);
428
429 /**
430  * Get the priority of a toolbar item.
431  *
432  * @param it The toolbar item.
433  * @return The @p item priority, or @c 0 on failure.
434  *
435  * @see elm_toolbar_item_priority_set() for details.
436  *
437  * @ingroup Toolbar
438  */
439 EAPI int                          elm_toolbar_item_priority_get(const Elm_Object_Item *it);
440
441 /**
442  * Returns a pointer to a toolbar item by its label.
443  *
444  * @param obj The toolbar object.
445  * @param label The label of the item to find.
446  *
447  * @return The pointer to the toolbar item matching @p label or @c NULL
448  * on failure.
449  *
450  * @ingroup Toolbar
451  */
452 EAPI Elm_Object_Item             *elm_toolbar_item_find_by_label(const Evas_Object *obj, const char *label);
453
454 /*
455  * Get whether the @p item is selected or not.
456  *
457  * @param it The toolbar item.
458  * @return @c EINA_TRUE means item is selected. @c EINA_FALSE indicates
459  * it's not. If @p obj is @c NULL, @c EINA_FALSE is returned.
460  *
461  * @see elm_toolbar_selected_item_set() for details.
462  * @see elm_toolbar_item_selected_get()
463  *
464  * @ingroup Toolbar
465  */
466 EAPI Eina_Bool                    elm_toolbar_item_selected_get(const Elm_Object_Item *it);
467
468 /**
469  * Set the selected state of an item.
470  *
471  * @param it The toolbar item
472  * @param selected The selected state
473  *
474  * This sets the selected state of the given item @p it.
475  * @c EINA_TRUE for selected, @c EINA_FALSE for not selected.
476  *
477  * If a new item is selected the previosly selected will be unselected.
478  * Previoulsy selected item can be get with function
479  * elm_toolbar_selected_item_get().
480  *
481  * Selected items will be highlighted.
482  *
483  * @see elm_toolbar_item_selected_get()
484  * @see elm_toolbar_selected_item_get()
485  *
486  * @ingroup Toolbar
487  */
488 EAPI void                         elm_toolbar_item_selected_set(Elm_Object_Item *it, Eina_Bool selected);
489
490 /**
491  * Get the selected item.
492  *
493  * @param obj The toolbar object.
494  * @return The selected toolbar item.
495  *
496  * The selected item can be unselected with function
497  * elm_toolbar_item_selected_set().
498  *
499  * The selected item always will be highlighted on toolbar.
500  *
501  * @see elm_toolbar_selected_items_get()
502  *
503  * @ingroup Toolbar
504  */
505 EAPI Elm_Object_Item             *elm_toolbar_selected_item_get(const Evas_Object *obj);
506
507 /**
508  * Set the icon associated with @p item.
509  *
510  * @param obj The parent of this item.
511  * @param it The toolbar item.
512  * @param icon A string with icon name or the absolute path of an image file.
513  *
514  * Toolbar will load icon image from fdo or current theme.
515  * This behavior can be set by elm_toolbar_icon_order_lookup_set() function.
516  * If an absolute path is provided it will load it direct from a file.
517  *
518  * @see elm_toolbar_icon_order_lookup_set()
519  * @see elm_toolbar_icon_order_lookup_get()
520  *
521  * @ingroup Toolbar
522  */
523 EAPI void                         elm_toolbar_item_icon_set(Elm_Object_Item *it, const char *icon);
524
525 /**
526  * Get the string used to set the icon of @p item.
527  *
528  * @param it The toolbar item.
529  * @return The string associated with the icon object.
530  *
531  * @see elm_toolbar_item_icon_set() for details.
532  *
533  * @ingroup Toolbar
534  */
535 EAPI const char                  *elm_toolbar_item_icon_get(const Elm_Object_Item *it);
536
537 /**
538  * Get the object of @p item.
539  *
540  * @param it The toolbar item.
541  * @return The object
542  *
543  * @ingroup Toolbar
544  */
545 EAPI Evas_Object                 *elm_toolbar_item_object_get(const Elm_Object_Item *it);
546
547 /**
548  * Get the icon object of @p item.
549  *
550  * @param it The toolbar item.
551  * @return The icon object
552  *
553  * @see elm_toolbar_item_icon_set(), elm_toolbar_item_icon_file_set(),
554  * or elm_toolbar_item_icon_memfile_set() for details.
555  *
556  * @ingroup Toolbar
557  */
558 EAPI Evas_Object                 *elm_toolbar_item_icon_object_get(Elm_Object_Item *it);
559
560 /**
561  * Set the icon associated with @p item to an image in a binary buffer.
562  *
563  * @param it The toolbar item.
564  * @param img The binary data that will be used as an image
565  * @param size The size of binary data @p img
566  * @param format Optional format of @p img to pass to the image loader
567  * @param key Optional key of @p img to pass to the image loader (eg. if @p img is an edje file)
568  *
569  * @return (@c EINA_TRUE = success, @c EINA_FALSE = error)
570  *
571  * @note The icon image set by this function can be changed by
572  * elm_toolbar_item_icon_set().
573  *
574  * @ingroup Toolbar
575  */
576 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);
577
578 /**
579  * Set the icon associated with @p item to an image in a binary buffer.
580  *
581  * @param it The toolbar item.
582  * @param file The file that contains the image
583  * @param key Optional key of @p img to pass to the image loader (eg. if @p img is an edje file)
584  *
585  * @return (@c EINA_TRUE = success, @c EINA_FALSE = error)
586  *
587  * @note The icon image set by this function can be changed by
588  * elm_toolbar_item_icon_set().
589  *
590  * @ingroup Toolbar
591  */
592 EAPI Eina_Bool                    elm_toolbar_item_icon_file_set(Elm_Object_Item *it, const char *file, const char *key);
593
594 /**
595  * Delete them item from the toolbar.
596  *
597  * @param it The item of toolbar to be deleted.
598  *
599  * @see elm_toolbar_item_append()
600  * @see elm_toolbar_item_del_cb_set()
601  *
602  * @ingroup Toolbar
603  */
604 EAPI void                         elm_toolbar_item_del(Elm_Object_Item *it);
605
606 /**
607  * Set the function called when a toolbar item is freed.
608  *
609  * @param it The item to set the callback on.
610  * @param func The function called.
611  *
612  * If there is a @p func, then it will be called prior item's memory release.
613  * That will be called with the following arguments:
614  * @li item's data;
615  * @li item's Evas object;
616  * @li item itself;
617  *
618  * This way, a data associated to a toolbar item could be properly freed.
619  *
620  * @ingroup Toolbar
621  */
622 EAPI void                         elm_toolbar_item_del_cb_set(Elm_Object_Item *it, Evas_Smart_Cb func);
623
624 /**
625  * Set or unset item as a separator.
626  *
627  * @param it The toolbar item.
628  * @param setting @c EINA_TRUE to set item @p item as separator or
629  * @c EINA_FALSE to unset, i.e., item will be used as a regular item.
630  *
631  * Items aren't set as separator by default.
632  *
633  * If set as separator it will display separator theme, so won't display
634  * icons or label.
635  *
636  * @see elm_toolbar_item_separator_get()
637  *
638  * @ingroup Toolbar
639  */
640 EAPI void                         elm_toolbar_item_separator_set(Elm_Object_Item *it, Eina_Bool separator);
641
642 /**
643  * Get a value whether item is a separator or not.
644  *
645  * @param it The toolbar item.
646  * @return @c EINA_TRUE means item @p it is a separator. @c EINA_FALSE
647  * indicates it's not. If @p it is @c NULL, @c EINA_FALSE is returned.
648  *
649  * @see elm_toolbar_item_separator_set() for details.
650  *
651  * @ingroup Toolbar
652  */
653 EAPI Eina_Bool                    elm_toolbar_item_separator_get(const Elm_Object_Item *it);
654
655 /**
656  * Set the shrink state of toolbar @p obj.
657  *
658  * @param obj The toolbar object.
659  * @param shrink_mode Toolbar's items display behavior.
660  *
661  * The toolbar won't scroll if #ELM_TOOLBAR_SHRINK_NONE,
662  * but will enforce a minimun size so all the items will fit, won't scroll
663  * and won't show the items that don't fit if #ELM_TOOLBAR_SHRINK_HIDE,
664  * will scroll if #ELM_TOOLBAR_SHRINK_SCROLL, and will create a button to
665  * pop up excess elements with #ELM_TOOLBAR_SHRINK_MENU.
666  *
667  * @ingroup Toolbar
668  */
669 EAPI void                         elm_toolbar_mode_shrink_set(Evas_Object *obj, Elm_Toolbar_Shrink_Mode shrink_mode);
670
671 /**
672  * Get the shrink mode of toolbar @p obj.
673  *
674  * @param obj The toolbar object.
675  * @return Toolbar's items display behavior.
676  *
677  * @see elm_toolbar_mode_shrink_set() for details.
678  *
679  * @ingroup Toolbar
680  */
681 EAPI Elm_Toolbar_Shrink_Mode      elm_toolbar_mode_shrink_get(const Evas_Object *obj);
682
683 /**
684  * Enable/disable homogeneous mode.
685  *
686  * @param obj The toolbar object
687  * @param homogeneous Assume the items within the toolbar are of the
688  * same size (EINA_TRUE = on, EINA_FALSE = off). Default is @c EINA_FALSE.
689  *
690  * This will enable the homogeneous mode where items are of the same size.
691  * @see elm_toolbar_homogeneous_get()
692  *
693  * @ingroup Toolbar
694  */
695 EAPI void                         elm_toolbar_homogeneous_set(Evas_Object *obj, Eina_Bool homogeneous);
696
697 /**
698  * Get whether the homogeneous mode is enabled.
699  *
700  * @param obj The toolbar object.
701  * @return Assume the items within the toolbar are of the same height
702  * and width (EINA_TRUE = on, EINA_FALSE = off).
703  *
704  * @see elm_toolbar_homogeneous_set()
705  *
706  * @ingroup Toolbar
707  */
708 EAPI Eina_Bool                    elm_toolbar_homogeneous_get(const Evas_Object *obj);
709
710 /**
711  * Set the parent object of the toolbar items' menus.
712  *
713  * @param obj The toolbar object.
714  * @param parent The parent of the menu objects.
715  *
716  * Each item can be set as item menu, with elm_toolbar_item_menu_set().
717  *
718  * For more details about setting the parent for toolbar menus, see
719  * elm_menu_parent_set().
720  *
721  * @see elm_menu_parent_set() for details.
722  * @see elm_toolbar_item_menu_set() for details.
723  *
724  * @ingroup Toolbar
725  */
726 EAPI void                         elm_toolbar_menu_parent_set(Evas_Object *obj, Evas_Object *parent);
727
728 /**
729  * Get the parent object of the toolbar items' menus.
730  *
731  * @param obj The toolbar object.
732  * @return The parent of the menu objects.
733  *
734  * @see elm_toolbar_menu_parent_set() for details.
735  *
736  * @ingroup Toolbar
737  */
738 EAPI Evas_Object                 *elm_toolbar_menu_parent_get(const Evas_Object *obj);
739
740 /**
741  * Set the alignment of the items.
742  *
743  * @param obj The toolbar object.
744  * @param align The new alignment, a float between <tt> 0.0 </tt>
745  * and <tt> 1.0 </tt>.
746  *
747  * Alignment of toolbar items, from <tt> 0.0 </tt> to indicates to align
748  * left, to <tt> 1.0 </tt>, to align to right. <tt> 0.5 </tt> centralize
749  * items.
750  *
751  * Centered items by default.
752  *
753  * @see elm_toolbar_align_get()
754  *
755  * @ingroup Toolbar
756  */
757 EAPI void                         elm_toolbar_align_set(Evas_Object *obj, double align);
758
759 /**
760  * Get the alignment of the items.
761  *
762  * @param obj The toolbar object.
763  * @return toolbar items alignment, a float between <tt> 0.0 </tt> and
764  * <tt> 1.0 </tt>.
765  *
766  * @see elm_toolbar_align_set() for details.
767  *
768  * @ingroup Toolbar
769  */
770 EAPI double                       elm_toolbar_align_get(const Evas_Object *obj);
771
772 /**
773  * Set whether the toolbar item opens a menu.
774  *
775  * @param it The toolbar item.
776  * @param menu If @c EINA_TRUE, @p item will opens a menu when selected.
777  *
778  * A toolbar item can be set to be a menu, using this function.
779  *
780  * Once it is set to be a menu, it can be manipulated through the
781  * menu-like function elm_toolbar_menu_parent_set() and the other
782  * elm_menu functions, using the Evas_Object @c menu returned by
783  * elm_toolbar_item_menu_get().
784  *
785  * So, items to be displayed in this item's menu should be added with
786  * elm_menu_item_add().
787  *
788  * The following code exemplifies the most basic usage:
789  * @code
790  * tb = elm_toolbar_add(win)
791  * item = elm_toolbar_item_append(tb, "refresh", "Menu", NULL, NULL);
792  * elm_toolbar_item_menu_set(item, EINA_TRUE);
793  * elm_toolbar_menu_parent_set(tb, win);
794  * menu = elm_toolbar_item_menu_get(item);
795  * elm_menu_item_add(menu, NULL, "edit-cut", "Cut", NULL, NULL);
796  * menu_item = elm_menu_item_add(menu, NULL, "edit-copy", "Copy", NULL,
797  * NULL);
798  * @endcode
799  *
800  * @see elm_toolbar_item_menu_get()
801  *
802  * @ingroup Toolbar
803  */
804 EAPI void                         elm_toolbar_item_menu_set(Elm_Object_Item *it, Eina_Bool menu);
805
806 /**
807  * Get toolbar item's menu.
808  *
809  * @param it The toolbar item.
810  * @return Item's menu object or @c NULL on failure.
811  *
812  * If @p item wasn't set as menu item with elm_toolbar_item_menu_set(),
813  * this function will set it.
814  *
815  * @see elm_toolbar_item_menu_set() for details.
816  *
817  * @ingroup Toolbar
818  */
819 EAPI Evas_Object                 *elm_toolbar_item_menu_get(const Elm_Object_Item *it);
820
821 /**
822  * Add a new state to @p item.
823  *
824  * @param it The toolbar item.
825  * @param icon A string with icon name or the absolute path of an image file.
826  * @param label The label of the new state.
827  * @param func The function to call when the item is clicked when this
828  * state is selected.
829  * @param data The data to associate with the state.
830  * @return The toolbar item state, or @c NULL upon failure.
831  *
832  * Toolbar will load icon image from fdo or current theme.
833  * This behavior can be set by elm_toolbar_icon_order_lookup_set() function.
834  * If an absolute path is provided it will load it direct from a file.
835  *
836  * States created with this function can be removed with
837  * elm_toolbar_item_state_del().
838  *
839  * @see elm_toolbar_item_state_del()
840  * @see elm_toolbar_item_state_sel()
841  * @see elm_toolbar_item_state_get()
842  *
843  * @ingroup Toolbar
844  */
845 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);
846
847 /**
848  * Delete a previoulsy added state to @p item.
849  *
850  * @param it The toolbar item.
851  * @param state The state to be deleted.
852  * @return @c EINA_TRUE on success or @c EINA_FALSE on failure.
853  *
854  * @see elm_toolbar_item_state_add()
855  */
856 EAPI Eina_Bool                    elm_toolbar_item_state_del(Elm_Object_Item *it, Elm_Toolbar_Item_State *state);
857
858 /**
859  * Set @p state as the current state of @p it.
860  *
861  * @param it The toolbar item.
862  * @param state The state to use.
863  * @return @c EINA_TRUE on success or @c EINA_FALSE on failure.
864  *
865  * If @p state is @c NULL, it won't select any state and the default item's
866  * icon and label will be used. It's the same behaviour than
867  * elm_toolbar_item_state_unser().
868  *
869  * @see elm_toolbar_item_state_unset()
870  *
871  * @ingroup Toolbar
872  */
873 EAPI Eina_Bool                    elm_toolbar_item_state_set(Elm_Object_Item *it, Elm_Toolbar_Item_State *state);
874
875 /**
876  * Unset the state of @p it.
877  *
878  * @param it The toolbar item.
879  *
880  * The default icon and label from this item will be displayed.
881  *
882  * @see elm_toolbar_item_state_set() for more details.
883  *
884  * @ingroup Toolbar
885  */
886 EAPI void                         elm_toolbar_item_state_unset(Elm_Object_Item *it);
887
888 /**
889  * Get the current state of @p it.
890  *
891  * @param it The toolbar item.
892  * @return The selected state or @c NULL if none is selected or on failure.
893  *
894  * @see elm_toolbar_item_state_set() for details.
895  * @see elm_toolbar_item_state_unset()
896  * @see elm_toolbar_item_state_add()
897  *
898  * @ingroup Toolbar
899  */
900 EAPI Elm_Toolbar_Item_State      *elm_toolbar_item_state_get(const Elm_Object_Item *it);
901
902 /**
903  * Get the state after selected state in toolbar's @p item.
904  *
905  * @param it The toolbar item to change state.
906  * @return The state after current state, or @c NULL on failure.
907  *
908  * If last state is selected, this function will return first state.
909  *
910  * @see elm_toolbar_item_state_set()
911  * @see elm_toolbar_item_state_add()
912  *
913  * @ingroup Toolbar
914  */
915 EAPI Elm_Toolbar_Item_State      *elm_toolbar_item_state_next(Elm_Object_Item *it);
916
917 /**
918  * Get the state before selected state in toolbar's @p item.
919  *
920  * @param it The toolbar item to change state.
921  * @return The state before current state, or @c NULL on failure.
922  *
923  * If first state is selected, this function will return last state.
924  *
925  * @see elm_toolbar_item_state_set()
926  * @see elm_toolbar_item_state_add()
927  *
928  * @ingroup Toolbar
929  */
930 EAPI Elm_Toolbar_Item_State      *elm_toolbar_item_state_prev(Elm_Object_Item *it);
931
932 /**
933  * Set the text to be shown in a given toolbar item's tooltips.
934  *
935  * @param it toolbar item.
936  * @param text The text to set in the content.
937  *
938  * Setup the text as tooltip to object. The item can have only one tooltip,
939  * so any previous tooltip data - set with this function or
940  * elm_toolbar_item_tooltip_content_cb_set() - is removed.
941  *
942  * @see elm_object_tooltip_text_set() for more details.
943  *
944  * @ingroup Toolbar
945  */
946 EAPI void                         elm_toolbar_item_tooltip_text_set(Elm_Object_Item *it, const char *text);
947
948 /**
949  * Set the content to be shown in the tooltip item.
950  *
951  * Setup the tooltip to item. The item can have only one tooltip,
952  * so any previous tooltip data is removed. @p func(with @p data) will
953  * be called every time that need show the tooltip and it should
954  * return a valid Evas_Object. This object is then managed fully by
955  * tooltip system and is deleted when the tooltip is gone.
956  *
957  * @param it the toolbar item being attached a tooltip.
958  * @param func the function used to create the tooltip contents.
959  * @param data what to provide to @a func as callback data/context.
960  * @param del_cb called when data is not needed anymore, either when
961  *        another callback replaces @a func, the tooltip is unset with
962  *        elm_toolbar_item_tooltip_unset() or the owner @a item
963  *        dies. This callback receives as the first parameter the
964  *        given @a data, and @c event_info is the item.
965  *
966  * @see elm_object_tooltip_content_cb_set() for more details.
967  *
968  * @ingroup Toolbar
969  */
970 EAPI void                         elm_toolbar_item_tooltip_content_cb_set(Elm_Object_Item *it, Elm_Tooltip_Item_Content_Cb func, const void *data, Evas_Smart_Cb del_cb);
971
972 /**
973  * Unset tooltip from item.
974  *
975  * @param it toolbar item to remove previously set tooltip.
976  *
977  * Remove tooltip from item. The callback provided as del_cb to
978  * elm_toolbar_item_tooltip_content_cb_set() will be called to notify
979  * it is not used anymore.
980  *
981  * @see elm_object_tooltip_unset() for more details.
982  * @see elm_toolbar_item_tooltip_content_cb_set()
983  *
984  * @ingroup Toolbar
985  */
986 EAPI void                         elm_toolbar_item_tooltip_unset(Elm_Object_Item *it);
987
988 /**
989  * Sets a different style for this item tooltip.
990  *
991  * @note before you set a style you should define a tooltip with
992  *       elm_toolbar_item_tooltip_content_cb_set() or
993  *       elm_toolbar_item_tooltip_text_set()
994  *
995  * @param it toolbar item with tooltip already set.
996  * @param style the theme style to use (default, transparent, ...)
997  *
998  * @see elm_object_tooltip_style_set() for more details.
999  *
1000  * @ingroup Toolbar
1001  */
1002 EAPI void                         elm_toolbar_item_tooltip_style_set(Elm_Object_Item *it, const char *style);
1003
1004 /**
1005  * Get the style for this item tooltip.
1006  *
1007  * @param it toolbar item with tooltip already set.
1008  * @return style the theme style in use, defaults to "default". If the
1009  *         object does not have a tooltip set, then NULL is returned.
1010  *
1011  * @see elm_object_tooltip_style_get() for more details.
1012  * @see elm_toolbar_item_tooltip_style_set()
1013  *
1014  * @ingroup Toolbar
1015  */
1016 EAPI const char                  *elm_toolbar_item_tooltip_style_get(const Elm_Object_Item *it);
1017
1018 /**
1019  * Set the type of mouse pointer/cursor decoration to be shown,
1020  * when the mouse pointer is over the given toolbar widget item
1021  *
1022  * @param it toolbar item to customize cursor on
1023  * @param cursor the cursor type's name
1024  *
1025  * This function works analogously as elm_object_cursor_set(), but
1026  * here the cursor's changing area is restricted to the item's
1027  * area, and not the whole widget's. Note that that item cursors
1028  * have precedence over widget cursors, so that a mouse over an
1029  * item with custom cursor set will always show @b that cursor.
1030  *
1031  * If this function is called twice for an object, a previously set
1032  * cursor will be unset on the second call.
1033  *
1034  * @see elm_object_cursor_set()
1035  * @see elm_toolbar_item_cursor_get()
1036  * @see elm_toolbar_item_cursor_unset()
1037  *
1038  * @ingroup Toolbar
1039  */
1040 EAPI void                         elm_toolbar_item_cursor_set(Elm_Object_Item *it, const char *cursor);
1041
1042 /*
1043  * Get the type of mouse pointer/cursor decoration set to be shown,
1044  * when the mouse pointer is over the given toolbar widget item
1045  *
1046  * @param it toolbar item with custom cursor set
1047  * @return the cursor type's name or @c NULL, if no custom cursors
1048  * were set to @p item (and on errors)
1049  *
1050  * @see elm_object_cursor_get()
1051  * @see elm_toolbar_item_cursor_set()
1052  * @see elm_toolbar_item_cursor_unset()
1053  *
1054  * @ingroup Toolbar
1055  */
1056 EAPI const char                  *elm_toolbar_item_cursor_get(const Elm_Object_Item *it);
1057
1058 /**
1059  * Unset any custom mouse pointer/cursor decoration set to be
1060  * shown, when the mouse pointer is over the given toolbar widget
1061  * item, thus making it show the @b default cursor again.
1062  *
1063  * @param it a toolbar item
1064  *
1065  * Use this call to undo any custom settings on this item's cursor
1066  * decoration, bringing it back to defaults (no custom style set).
1067  *
1068  * @see elm_object_cursor_unset()
1069  * @see elm_toolbar_item_cursor_set()
1070  *
1071  * @ingroup Toolbar
1072  */
1073 EAPI void                         elm_toolbar_item_cursor_unset(Elm_Object_Item *it);
1074
1075 /**
1076  * Set a different @b style for a given custom cursor set for a
1077  * toolbar item.
1078  *
1079  * @param it toolbar item with custom cursor set
1080  * @param style the <b>theme style</b> to use (e.g. @c "default",
1081  * @c "transparent", etc)
1082  *
1083  * This function only makes sense when one is using custom mouse
1084  * cursor decorations <b>defined in a theme file</b>, which can have,
1085  * given a cursor name/type, <b>alternate styles</b> on it. It
1086  * works analogously as elm_object_cursor_style_set(), but here
1087  * applyed only to toolbar item objects.
1088  *
1089  * @warning Before you set a cursor style you should have definen a
1090  *       custom cursor previously on the item, with
1091  *       elm_toolbar_item_cursor_set()
1092  *
1093  * @see elm_toolbar_item_cursor_engine_only_set()
1094  * @see elm_toolbar_item_cursor_style_get()
1095  *
1096  * @ingroup Toolbar
1097  */
1098 EAPI void                         elm_toolbar_item_cursor_style_set(Elm_Object_Item *it, const char *style);
1099
1100 /**
1101  * Get the current @b style set for a given toolbar item's custom
1102  * cursor
1103  *
1104  * @param it toolbar item with custom cursor set.
1105  * @return style the cursor style in use. If the object does not
1106  *         have a cursor set, then @c NULL is returned.
1107  *
1108  * @see elm_toolbar_item_cursor_style_set() for more details
1109  *
1110  * @ingroup Toolbar
1111  */
1112 EAPI const char                  *elm_toolbar_item_cursor_style_get(const Elm_Object_Item *it);
1113
1114 /**
1115  * Set if the (custom)cursor for a given toolbar item should be
1116  * searched in its theme, also, or should only rely on the
1117  * rendering engine.
1118  *
1119  * @param it item with custom (custom) cursor already set on
1120  * @param engine_only Use @c EINA_TRUE to have cursors looked for
1121  * only on those provided by the rendering engine, @c EINA_FALSE to
1122  * have them searched on the widget's theme, as well.
1123  *
1124  * @note This call is of use only if you've set a custom cursor
1125  * for toolbar items, with elm_toolbar_item_cursor_set().
1126  *
1127  * @note By default, cursors will only be looked for between those
1128  * provided by the rendering engine.
1129  *
1130  * @ingroup Toolbar
1131  */
1132 EAPI void                         elm_toolbar_item_cursor_engine_only_set(Elm_Object_Item *it, Eina_Bool engine_only);
1133
1134 /**
1135  * Get if the (custom) cursor for a given toolbar item is being
1136  * searched in its theme, also, or is only relying on the rendering
1137  * engine.
1138  *
1139  * @param it a toolbar item
1140  * @return @c EINA_TRUE, if cursors are being looked for only on
1141  * those provided by the rendering engine, @c EINA_FALSE if they
1142  * are being searched on the widget's theme, as well.
1143  *
1144  * @see elm_toolbar_item_cursor_engine_only_set(), for more details
1145  *
1146  * @ingroup Toolbar
1147  */
1148 EAPI Eina_Bool                    elm_toolbar_item_cursor_engine_only_get(const Elm_Object_Item *it);
1149
1150 /**
1151  * Change a toolbar's orientation
1152  * @param obj The toolbar object
1153  * @param horizontal If @c EINA_TRUE, the toolbar is horizontal
1154  * By default, a toolbar will be horizontal. Use this function to create a vertical toolbar.
1155  * @ingroup Toolbar
1156  */
1157 EAPI void                         elm_toolbar_horizontal_set(Evas_Object *obj, Eina_Bool horizontal);
1158
1159 /**
1160  * Get a toolbar's orientation
1161  * @param obj The toolbar object
1162  * @return If @c EINA_TRUE, the toolbar is horizontal
1163  * By default, a toolbar will be horizontal. Use this function to determine whether a toolbar is vertical.
1164  * @ingroup Toolbar
1165  */
1166 EAPI Eina_Bool                    elm_toolbar_horizontal_get(const Evas_Object *obj);
1167
1168 /**
1169  * Get the number of items in a toolbar
1170  * @param obj The toolbar object
1171  * @return The number of items in @p obj toolbar
1172  * @ingroup Toolbar
1173  */
1174 EAPI unsigned int                 elm_toolbar_items_count(const Evas_Object *obj);
1175 /**
1176  * @}
1177  */