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

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_ga0c0841ae232ebd6a9628b868d4e95b6f}{elm\_toolbar\_add}}(win);}
\DoxyCodeLine{   elm\_toolbar\_shrink\_mode\_set(tb, ELM\_TOOLBAR\_SHRINK\_HIDE);}
\DoxyCodeLine{   evas\_object\_size\_hint\_weight\_set(tb, 0.0, 0.0);}
\DoxyCodeLine{   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_ga9cbc13661584e49fb9d9cdab514a1eeb}{evas\_object\_show}}(tb);}
\DoxyCodeLine{}
\DoxyCodeLine{   elm\_toolbar\_item\_append(tb, \textcolor{stringliteral}{"document-\/print"}, \textcolor{stringliteral}{"Print"}, NULL, NULL);}
\DoxyCodeLine{   elm\_toolbar\_item\_append(tb, \textcolor{stringliteral}{"folder-\/new"}, \textcolor{stringliteral}{"Folder"}, NULL, NULL);}
\DoxyCodeLine{   elm\_toolbar\_item\_append(tb, \textcolor{stringliteral}{"clock"}, \textcolor{stringliteral}{"Clock"}, NULL, NULL);}
\DoxyCodeLine{   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 \#\+E\+L\+M\+\_\+\+T\+O\+O\+L\+B\+A\+R\+\_\+\+S\+H\+R\+I\+N\+K\+\_\+\+H\+I\+DE, 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 = 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 an 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}
 