

On this example we are going to have a button that when clicked will show our hover widget, this hover will have content set on it\textquotesingle{}s left, top, right and middle positions. In the middle position we are placing a button that when clicked will hide the hover. We are also going to use a non-\/default theme for our hover. We won\textquotesingle{}t explain the functioning of button for that see \mbox{\hyperlink{group__Elm__Button}{Button}}.

We start our example with a couple of callbacks that show and hide the data they\textquotesingle{}re given(which we\textquotesingle{}ll see later on is the hover widget)\+: 
\begin{DoxyCodeInclude}{0}
\DoxyCodeLine{\textcolor{keyword}{static}\ \textcolor{keywordtype}{void}}
\DoxyCodeLine{\_show\_hover(\textcolor{keywordtype}{void}\ *data,\ \mbox{\hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object}}\ *obj\ \mbox{\hyperlink{group__Eina__Types__Group_ga82d751be730f849719ca292f9558be87}{EINA\_UNUSED}},\ \textcolor{keywordtype}{void}\ *event\_info\ \mbox{\hyperlink{group__Eina__Types__Group_ga82d751be730f849719ca292f9558be87}{EINA\_UNUSED}})}
\DoxyCodeLine{\{}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Evas__Object__Group__Basic_ga07208fcafd4739de606bc35fff684bf5}{evas\_object\_show}}(data);}
\DoxyCodeLine{\}}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{keyword}{static}\ \textcolor{keywordtype}{void}}
\DoxyCodeLine{\_hide\_hover(\textcolor{keywordtype}{void}\ *data,\ \mbox{\hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object}}\ *obj\ \mbox{\hyperlink{group__Eina__Types__Group_ga82d751be730f849719ca292f9558be87}{EINA\_UNUSED}},\ \textcolor{keywordtype}{void}\ *event\_info\ \mbox{\hyperlink{group__Eina__Types__Group_ga82d751be730f849719ca292f9558be87}{EINA\_UNUSED}})}
\DoxyCodeLine{\{}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Evas__Object__Group__Basic_gae66f71e09a0dc71675f15ebff6765c64}{evas\_object\_hide}}(data);}
\DoxyCodeLine{\}}

\end{DoxyCodeInclude}
 In our main function we\textquotesingle{}ll do some initialization and then create 3 rectangles, one red, one green and one blue to use in our hover. We\textquotesingle{}ll also create the 2 buttons that will show and hide the hover\+: 
\begin{DoxyCodeInclude}{0}
\DoxyCodeLine{}
\DoxyCodeLine{EAPI\_MAIN\ \textcolor{keywordtype}{int}}
\DoxyCodeLine{elm\_main(\textcolor{keywordtype}{int}\ argc\ \mbox{\hyperlink{group__Eina__Types__Group_ga82d751be730f849719ca292f9558be87}{EINA\_UNUSED}},\ \textcolor{keywordtype}{char}\ **argv\ \mbox{\hyperlink{group__Eina__Types__Group_ga82d751be730f849719ca292f9558be87}{EINA\_UNUSED}})}
\DoxyCodeLine{\{}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object}}\ *win,\ *bt,\ *bt2,\ *rect,\ *rect2,\ *rect3,\ *hover;}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Elm__General_ga7a05f37fd3a019da5e26c5fc91fcd937}{elm\_policy\_set}}(\mbox{\hyperlink{group__Elm__General_ggaa16f3378ecdbf660fa378402e3c5a0a9a02fadb6faada04b19d0fa42c11a8d32a}{ELM\_POLICY\_QUIT}},\ \mbox{\hyperlink{group__Elm__General_gga46af37e6ac2c406321060be827117196abbe0962d88ae12afe1a173da881f56cd}{ELM\_POLICY\_QUIT\_LAST\_WINDOW\_CLOSED}});}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ win\ =\ \mbox{\hyperlink{group__Elm__Win__Group_ga23d9d1ffa0a65a1a1dd482d570db1ba0}{elm\_win\_util\_standard\_add}}(\textcolor{stringliteral}{"{}hover"{}},\ \textcolor{stringliteral}{"{}Hover"{}});}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Elm__Win__Group_ga9a16a2f8c9fd5b6e9203ed9dcb53ea8b}{elm\_win\_autodel\_set}}(win,\ \mbox{\hyperlink{group__Eina__Types__Group_ga05c12dacc8b4058994df842b41be85fc}{EINA\_TRUE}});}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ rect\ =\ \mbox{\hyperlink{group__Evas__Object__Rectangle_ga1b7a9d8e6ce240590c1734da5f3449d2}{evas\_object\_rectangle\_add}}(\mbox{\hyperlink{group__Evas__Object__Group_ga7e211219d11abced5f3089362f7476b9}{evas\_object\_evas\_get}}(win));}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Evas__Object__Group_gaf20fdb7dc524a95091d72d24cf6a05e8}{evas\_object\_size\_hint\_min\_set}}(rect,\ 25,\ 25);}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Evas__Object__Group__Basic_gab751e9d24c16e74af6f7c08ea5b930c2}{evas\_object\_color\_set}}(rect,\ 255,\ 0,\ 0,\ 255);}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Evas__Object__Group__Basic_ga07208fcafd4739de606bc35fff684bf5}{evas\_object\_show}}(rect);}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ rect2\ =\ \mbox{\hyperlink{group__Evas__Object__Rectangle_ga1b7a9d8e6ce240590c1734da5f3449d2}{evas\_object\_rectangle\_add}}(\mbox{\hyperlink{group__Evas__Object__Group_ga7e211219d11abced5f3089362f7476b9}{evas\_object\_evas\_get}}(win));}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Evas__Object__Group_gaf20fdb7dc524a95091d72d24cf6a05e8}{evas\_object\_size\_hint\_min\_set}}(rect2,\ 25,\ 25);}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Evas__Object__Group__Basic_gab751e9d24c16e74af6f7c08ea5b930c2}{evas\_object\_color\_set}}(rect2,\ 0,\ 255,\ 0,\ 255);}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Evas__Object__Group__Basic_ga07208fcafd4739de606bc35fff684bf5}{evas\_object\_show}}(rect2);}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ rect3\ =\ \mbox{\hyperlink{group__Evas__Object__Rectangle_ga1b7a9d8e6ce240590c1734da5f3449d2}{evas\_object\_rectangle\_add}}(\mbox{\hyperlink{group__Evas__Object__Group_ga7e211219d11abced5f3089362f7476b9}{evas\_object\_evas\_get}}(win));}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Evas__Object__Group_gaf20fdb7dc524a95091d72d24cf6a05e8}{evas\_object\_size\_hint\_min\_set}}(rect3,\ 25,\ 25);}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Evas__Object__Group__Basic_gab751e9d24c16e74af6f7c08ea5b930c2}{evas\_object\_color\_set}}(rect3,\ 0,\ 0,\ 255,\ 255);}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Evas__Object__Group__Basic_ga07208fcafd4739de606bc35fff684bf5}{evas\_object\_show}}(rect3);}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ bt\ =\ \mbox{\hyperlink{group__Elm__Button_gaf5caf46d74c4e122a18da323935d25e4}{elm\_button\_add}}(win);}
\DoxyCodeLine{\ \ \ elm\_object\_text\_set(bt,\ \textcolor{stringliteral}{"{}Show\ hover"{}});}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Evas__Object__Group_ga335c8ee6eaeaac9710656af4f8b0db91}{evas\_object\_move}}(bt,\ 60,\ 90);}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Evas__Object__Group_gacad94595f83580c18908cb3b69b08d1a}{evas\_object\_resize}}(bt,\ 80,\ 20);}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Evas__Object__Group__Basic_ga07208fcafd4739de606bc35fff684bf5}{evas\_object\_show}}(bt);}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ bt2\ =\ \mbox{\hyperlink{group__Elm__Button_gaf5caf46d74c4e122a18da323935d25e4}{elm\_button\_add}}(win);}
\DoxyCodeLine{\ \ \ elm\_object\_text\_set(bt2,\ \textcolor{stringliteral}{"{}Hide\ hover"{}});}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Evas__Object__Group__Basic_ga07208fcafd4739de606bc35fff684bf5}{evas\_object\_show}}(bt2);}

\end{DoxyCodeInclude}
 With all of that squared away we can now get to the heart of the matter, creating our hover widget, which is easy as pie\+: 
\begin{DoxyCodeInclude}{0}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ hover\ =\ \mbox{\hyperlink{group__Elm__Hover_gab005e27e2e9a1d57d2789c86c6c292af}{elm\_hover\_add}}(win);}

\end{DoxyCodeInclude}
 Having created our hover we now need to set the parent and target. Which if you recall from the function documentations are going to tell the hover which area it should cover and where it should be centered\+: 
\begin{DoxyCodeInclude}{0}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Elm__Hover_ga816c57f831e81de55492c0bddc3e59a9}{elm\_hover\_parent\_set}}(hover,\ win);}
\DoxyCodeLine{\ \ \ elm\_hover\_target\_set(hover,\ bt);}

\end{DoxyCodeInclude}
 Now we set the theme for our hover. We\textquotesingle{}re using the popout theme which gives our contents a white background and causes their appearance to be animated\+: 
\begin{DoxyCodeInclude}{0}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Elm__Styles_ga7fc2d1f9ba723470da7a05799c49f7fe}{elm\_object\_style\_set}}(hover,\ \textcolor{stringliteral}{"{}popout"{}});}

\end{DoxyCodeInclude}
 And finally we set the content for our positions\+: 
\begin{DoxyCodeInclude}{0}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Elm__General_ga0531ec8867c72def7c780601764ca642}{elm\_object\_part\_content\_set}}(hover,\ \textcolor{stringliteral}{"{}left"{}},\ rect);}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Elm__General_ga0531ec8867c72def7c780601764ca642}{elm\_object\_part\_content\_set}}(hover,\ \textcolor{stringliteral}{"{}top"{}},\ rect2);}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Elm__General_ga0531ec8867c72def7c780601764ca642}{elm\_object\_part\_content\_set}}(hover,\ \textcolor{stringliteral}{"{}right"{}},\ rect3);}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Elm__General_ga0531ec8867c72def7c780601764ca642}{elm\_object\_part\_content\_set}}(hover,\ \textcolor{stringliteral}{"{}middle"{}},\ bt2);}

\end{DoxyCodeInclude}
 So far so good? Great \textquotesingle{}cause that\textquotesingle{}s all there is too it, what is left now is just connecting our buttons to the callbacks we defined at the beginning of the example and run the main loop\+: 
\begin{DoxyCodeInclude}{0}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Evas__Smart__Object__Group_gac12dd6655f488cc47ce6cf00eb7d12b2}{evas\_object\_smart\_callback\_add}}(bt,\ \textcolor{stringliteral}{"{}clicked"{}},\ \_show\_hover,\ hover);}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Evas__Smart__Object__Group_gac12dd6655f488cc47ce6cf00eb7d12b2}{evas\_object\_smart\_callback\_add}}(bt2,\ \textcolor{stringliteral}{"{}clicked"{}},\ \_hide\_hover,\ hover);}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Evas__Object__Group_gacad94595f83580c18908cb3b69b08d1a}{evas\_object\_resize}}(win,\ 200,\ 200);}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Evas__Object__Group__Basic_ga07208fcafd4739de606bc35fff684bf5}{evas\_object\_show}}(win);}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Elm__General_gadf2553f83e6b0b9c7fbe054019a664a1}{elm\_run}}();}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ \textcolor{keywordflow}{return}\ 0;}
\DoxyCodeLine{\}}
\DoxyCodeLine{\mbox{\hyperlink{group__Elm__General_ga50fe52d513f7e89c9c770afd76de7ad9}{ELM\_MAIN}}()}

\end{DoxyCodeInclude}
 Our example will initially look like this\+:

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


And after you click the \char`\"{}\+Show hover\char`\"{} button it will look like this\+:

 
\begin{DoxyImageNoCaption}
  \mbox{\includegraphics[width=\textwidth]{hover_example_01_a}}
\end{DoxyImageNoCaption}
 