Toolbar widgets have support to items with menus.
This kind of item will display a menu when selected by the user.
Let's start populating a toolbar with some regular items, the same way we started Toolbar Example 2.
#define EVAS_HINT_FILL
Use with evas_object_size_hint_align_set(), evas_object_size_hint_align_get(), evas_object_size_hint_...
Definition: Evas_Common.h:298
EVAS_API void evas_object_show(Evas_Object *eo_obj)
Makes the given Evas object visible.
Definition: evas_object_main.c:1814
EVAS_API void evas_object_size_hint_weight_set(Evas_Object *obj, double x, double y)
Sets the hints for an object's weight.
Definition: evas_object_main.c:2638
EVAS_API void evas_object_size_hint_align_set(Evas_Object *obj, double x, double y)
Sets the hints for an object's alignment.
Definition: evas_object_main.c:2650
The only difference is that we'll keep the default shrink mode, that adds an item with a menu of hidden items.
So, a important thing to do is to set a parent for toolbar menus, or they will use the toolbar as parent, and its size will be restricted to that.
Not only items' menus will respect this parent, but also the own toolbar menu, used to show hidden items.
Next, let's add an item set to display a menu:
#define EINA_TRUE
boolean value TRUE (numerical value 1)
Definition: eina_types.h:539
Now, to add two options to this item, we can get the menu object and use it as a regular elm_menu. See Menu example for more about menu widget.
menu = elm_toolbar_item_menu_get(tb_it);
elm_menu_item_add(menu, NULL, "emptytrash", "Empty Trash", NULL, NULL);
elm_menu_item_add(menu, NULL, "trashcan_full", "Full Trash", NULL, NULL);
See toolbar_example_03.c, whose window should look like this picture: