This code places an Elementary toolbar widget on a window, to exemplify part of the widget's API.
Let's start adding a button to our window, that will have its text modified depending on which item is selected. It's used just to exemplify how to change a window content from the toolbar.
Also, we'll need a toolbar widget, obviously:
When appending an item is possible to set an icon, label, and a callback function that will receive passed data.
It's possible to disable items, so the user can't select then. We will disable the third item:
Our callbacks will just set button's label:
By default, toolbars would display items homogeneously, so item with long labels, like the third, will make all of them occupy a lot of space. To avoid that, we can disable it:
Another default behavior, is to add an menu item if we have more items that would fit on toolbar size. To simply enable scroll, without menus, it's required to change toolbar's shrink mode:
See toolbar_example_01.c, whose window should look like this picture: