This code places an Elementary toolbar widget on a window, to exemplify part of the widget\textquotesingle{}s API.

Toolbar widgets has support to items with states. Each state can have it\textquotesingle{}s own label, icon, and callback function.

Let\textquotesingle{}s start populating a toolbar with some regular items. If you don\textquotesingle{}t know how to do that, see \mbox{\hyperlink{toolbar_example_01}{Toolbar Example 1}}.  
\begin{DoxyCodeInclude}{0}
\DoxyCodeLine{\ \ \ tb\ =\ \mbox{\hyperlink{group__Elm__Toolbar_ga5132198a651cc7a87bde22d5a707f9a5}{elm\_toolbar\_add}}(win);}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Elm__Toolbar_ga31deb1999afd41648100d3e816c69553}{elm\_toolbar\_shrink\_mode\_set}}(tb,\ \mbox{\hyperlink{group__Elm__Toolbar_ggaf2f77232958c97f74744538e5bb4e000aa33e0a0bc69a6c153e027a5772a07bf3}{ELM\_TOOLBAR\_SHRINK\_HIDE}});}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Evas__Object__Group_ga9379629ad8ad2860aa786d838a4a106a}{evas\_object\_size\_hint\_weight\_set}}(tb,\ 0.0,\ 0.0);}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Evas__Object__Group_gaaf1d3e26e36b316977336066b6f56632}{evas\_object\_size\_hint\_align\_set}}(tb,\ \mbox{\hyperlink{Evas__Common_8h_aecbac710f36d52911fc34dcdaf8e729c}{EVAS\_HINT\_FILL}},\ 0.0);}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Evas__Object__Group__Basic_ga07208fcafd4739de606bc35fff684bf5}{evas\_object\_show}}(tb);}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Elm__Toolbar_ga0e6a56df529b9d7e8dbc3d17613b9b22}{elm\_toolbar\_item\_append}}(tb,\ \textcolor{stringliteral}{"{}document-\/print"{}},\ \textcolor{stringliteral}{"{}Print"{}},\ NULL,\ NULL);}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Elm__Toolbar_ga0e6a56df529b9d7e8dbc3d17613b9b22}{elm\_toolbar\_item\_append}}(tb,\ \textcolor{stringliteral}{"{}folder-\/new"{}},\ \textcolor{stringliteral}{"{}Folder"{}},\ NULL,\ NULL);}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Elm__Toolbar_ga0e6a56df529b9d7e8dbc3d17613b9b22}{elm\_toolbar\_item\_append}}(tb,\ \textcolor{stringliteral}{"{}clock"{}},\ \textcolor{stringliteral}{"{}Clock"{}},\ NULL,\ NULL);}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Elm__Toolbar_ga0e6a56df529b9d7e8dbc3d17613b9b22}{elm\_toolbar\_item\_append}}(tb,\ \textcolor{stringliteral}{"{}refresh"{}},\ \textcolor{stringliteral}{"{}Update"{}},\ NULL,\ NULL);}

\end{DoxyCodeInclude}
 The only difference here is that we set shrink mode to \mbox{\hyperlink{group__Elm__Toolbar_ggaf2f77232958c97f74744538e5bb4e000aa33e0a0bc69a6c153e027a5772a07bf3}{ELM\+\_\+\+TOOLBAR\+\_\+\+SHRINK\+\_\+\+HIDE}}, that won\textquotesingle{}t display items that doesn\textquotesingle{}t fit to the window.

Now, let\textquotesingle{}s add an item with states. First, add the item just as any other. 
\begin{DoxyCodeInclude}{0}
\DoxyCodeLine{\ \ \ tb\_it\ =\ \mbox{\hyperlink{group__Elm__Toolbar_ga0e6a56df529b9d7e8dbc3d17613b9b22}{elm\_toolbar\_item\_append}}(tb,\ \textcolor{stringliteral}{"{}mail-\/send"{}},\ \textcolor{stringliteral}{"{}Send\ Mail"{}},}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \_item\_pressed,\ NULL);}

\end{DoxyCodeInclude}
 After that states can be added to this item\+: 
\begin{DoxyCodeInclude}{0}
\DoxyCodeLine{\ \ \ elm\_toolbar\_item\_state\_add(tb\_it,\ \textcolor{stringliteral}{"{}emptytrash"{}},\ \textcolor{stringliteral}{"{}Empty\ Trash"{}},}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \_item\_pressed,\ NULL);}
\DoxyCodeLine{\ \ \ elm\_toolbar\_item\_state\_add(tb\_it,\ \textcolor{stringliteral}{"{}trashcan\_full"{}},\ \textcolor{stringliteral}{"{}Full\ Trash"{}},}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \_item\_pressed,\ NULL);}

\end{DoxyCodeInclude}
 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\textquotesingle{}t call the callback if a user clicks over an item already selected\+:  
\begin{DoxyCodeInclude}{0}

\end{DoxyCodeInclude}
 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\textquotesingle{}s force the item with multiple states to be displayed. 
\begin{DoxyCodeInclude}{0}

\end{DoxyCodeInclude}
 See \mbox{\hyperlink{toolbar_example_02_8c-example}{toolbar\+\_\+example\+\_\+02.c}}, whose window should look like this picture\+:

 
\begin{DoxyImageNoCaption}
  \mbox{\includegraphics[width=\textwidth]{screenshots/toolbar_example_02}}
\end{DoxyImageNoCaption}
 