This code places an Elementary toolbar widget on a window, to exemplify part of the widget's API.
Toolbar widgets has support to items with states. Each state can have it's own label, icon, and callback function.
Let's start populating a toolbar with some regular items. If you don't know how to do that, see Toolbar Example 1.
The only difference here is that we set shrink mode to ELM_TOOLBAR_SHRINK_HIDE, that won't display items that doesn't fit to the window.
Now, let's add an item with states. First, add the item just as any other.
After that states can be added to this item:
The both states and the item are using the same callback function, that will cycle between states and unselect the item. Unseleting is required because it won't call the callback if a user clicks over an item already selected:
On our example, some items are hidden because we set the window to be small. But if an item should be displayed anyway, is needed to set its priority to be higher than others. Any positive value will be enough in our case. Let's force the item with multiple states to be displayed.
See toolbar_example_02.c, whose window should look like this picture: