Inwin is a very simple widget to show, so this example will be a very simple one, just using all of the available A\+PI.

The program is nothing but a window with a lonely button, as shown here.

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


And pressing the button makes an inwin appear.

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


And the code is just as simple. We being with some global variables to keep track of our Inwin.  
\begin{DoxyCodeInclude}{0}
\DoxyCodeLine{\textcolor{keyword}{static} \mbox{\hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object}} *inwin = NULL;}
\DoxyCodeLine{\textcolor{keyword}{static} \textcolor{keyword}{const} \textcolor{keywordtype}{char} *styles[] = \{}
\DoxyCodeLine{     \textcolor{stringliteral}{"default"},}
\DoxyCodeLine{     \textcolor{stringliteral}{"minimal"},}
\DoxyCodeLine{     \textcolor{stringliteral}{"minimal\_vertical"}}
\DoxyCodeLine{\};}
\DoxyCodeLine{\textcolor{keyword}{static} \textcolor{keywordtype}{int} current\_style = 0;}

\end{DoxyCodeInclude}


And two callbacks used by the buttons the above screenshot showed. In these, we check if {\ttfamily inwin} exists and execute the proper action on it. If it\textquotesingle{}s not there anymore, then we were abandoned to our luck, so we disabled ourselves. 
\begin{DoxyCodeInclude}{0}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{keyword}{static} \textcolor{keywordtype}{void}}
\DoxyCodeLine{\_inwin\_hide(\textcolor{keywordtype}{void} *data \mbox{\hyperlink{group__Eina__Types__Group_ga82d751be730f849719ca292f9558be87}{EINA\_UNUSED}}, \mbox{\hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object}} *obj, \textcolor{keywordtype}{void} *event \mbox{\hyperlink{group__Eina__Types__Group_ga82d751be730f849719ca292f9558be87}{EINA\_UNUSED}})}
\DoxyCodeLine{\{}
\DoxyCodeLine{   \textcolor{keywordflow}{if} (inwin)}
\DoxyCodeLine{     \{}
\DoxyCodeLine{        \mbox{\hyperlink{group__Evas__Object__Group__Basic_gacc307a0d7bfc9df151fd9ec75808c587}{evas\_object\_hide}}(inwin);}
\DoxyCodeLine{        \textcolor{keywordflow}{return};}
\DoxyCodeLine{     \}}
\DoxyCodeLine{   elm\_object\_text\_set(obj, \textcolor{stringliteral}{"No inwin!"});}
\DoxyCodeLine{   \mbox{\hyperlink{group__Elm__General_ga6849a57df3316eabad5bec443bf87597}{elm\_object\_disabled\_set}}(obj, \mbox{\hyperlink{group__Eina__Types__Group_ga05c12dacc8b4058994df842b41be85fc}{EINA\_TRUE}});}
\DoxyCodeLine{\}}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{keyword}{static} \textcolor{keywordtype}{void}}
\DoxyCodeLine{\_inwin\_destroy(\textcolor{keywordtype}{void} *data \mbox{\hyperlink{group__Eina__Types__Group_ga82d751be730f849719ca292f9558be87}{EINA\_UNUSED}}, \mbox{\hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object}} *obj, \textcolor{keywordtype}{void} *event \mbox{\hyperlink{group__Eina__Types__Group_ga82d751be730f849719ca292f9558be87}{EINA\_UNUSED}})}
\DoxyCodeLine{\{}
\DoxyCodeLine{   \textcolor{keywordflow}{if} (inwin)}
\DoxyCodeLine{     \{}
\DoxyCodeLine{        \mbox{\hyperlink{group__Evas__Object__Group__Basic_ga7e7a625dab7a3890532aa13b43117076}{evas\_object\_del}}(inwin);}
\DoxyCodeLine{        inwin = NULL;}
\DoxyCodeLine{        \textcolor{keywordflow}{return};}
\DoxyCodeLine{     \}}
\DoxyCodeLine{   elm\_object\_text\_set(obj, \textcolor{stringliteral}{"No inwin!"});}
\DoxyCodeLine{   \mbox{\hyperlink{group__Elm__General_ga6849a57df3316eabad5bec443bf87597}{elm\_object\_disabled\_set}}(obj, \mbox{\hyperlink{group__Eina__Types__Group_ga05c12dacc8b4058994df842b41be85fc}{EINA\_TRUE}});}
\DoxyCodeLine{\}}

\end{DoxyCodeInclude}


The lonely button from the beginning, when clicked, will call the following function, which begins by checking if an inwin exists, and if it\textquotesingle{}s there, we bring it back to the front and exit from our function without any further ado. 
\begin{DoxyCodeInclude}{0}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{keyword}{static} \textcolor{keywordtype}{void}}
\DoxyCodeLine{\_btn\_click\_cb(\textcolor{keywordtype}{void} *data \mbox{\hyperlink{group__Eina__Types__Group_ga82d751be730f849719ca292f9558be87}{EINA\_UNUSED}}, \mbox{\hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object}} *obj, \textcolor{keywordtype}{void} *event \mbox{\hyperlink{group__Eina__Types__Group_ga82d751be730f849719ca292f9558be87}{EINA\_UNUSED}})}
\DoxyCodeLine{\{}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object}} *o, *parent;}
\DoxyCodeLine{}
\DoxyCodeLine{   \textcolor{keywordflow}{if} (inwin)}
\DoxyCodeLine{     \{}
\DoxyCodeLine{        elm\_win\_inwin\_activate(inwin);}
\DoxyCodeLine{        \textcolor{keywordflow}{return};}
\DoxyCodeLine{     \}}

\end{DoxyCodeInclude}


But if no inwin is there to show, we need to create one. First we need the top-\/most window for the program, as no inwin can be created using other objects as parents. Then we create our popup, set the next style in the list and show it. 
\begin{DoxyCodeInclude}{0}
\DoxyCodeLine{}
\DoxyCodeLine{   parent = \mbox{\hyperlink{group__Elm__WidgetNavigation_gaecc9a5039788037aa345d5c6a3c8bff8}{elm\_object\_top\_widget\_get}}(obj);}
\DoxyCodeLine{   inwin = \mbox{\hyperlink{group__Elm__Inwin_gaf99e0cf10681793f3ae153723de0156b}{elm\_win\_inwin\_add}}(parent);}
\DoxyCodeLine{   \mbox{\hyperlink{group__Elm__Styles_ga7fc2d1f9ba723470da7a05799c49f7fe}{elm\_object\_style\_set}}(inwin, styles[current\_style]);}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Group__Basic_ga9cbc13661584e49fb9d9cdab514a1eeb}{evas\_object\_show}}(inwin);}
\DoxyCodeLine{}
\DoxyCodeLine{   current\_style = (current\_style + 1) \% 3;}

\end{DoxyCodeInclude}


As for the content of our inwin, it\textquotesingle{}s just a box with a label and some buttons inside. 
\begin{DoxyCodeInclude}{0}
\DoxyCodeLine{}
\DoxyCodeLine{   o = \mbox{\hyperlink{group__Elm__Box_ga3d0998b60ada633bacfa8869a921cfd7}{elm\_box\_add}}(parent);}
\DoxyCodeLine{   evas\_object\_size\_hint\_weight\_set(o, \mbox{\hyperlink{Evas__Common_8h_aa47c85083d3dae0111c21ec49359306a}{EVAS\_HINT\_EXPAND}}, \mbox{\hyperlink{Evas__Common_8h_aa47c85083d3dae0111c21ec49359306a}{EVAS\_HINT\_EXPAND}});}
\DoxyCodeLine{   evas\_object\_size\_hint\_align\_set(o, \mbox{\hyperlink{Evas__Common_8h_aecbac710f36d52911fc34dcdaf8e729c}{EVAS\_HINT\_FILL}}, \mbox{\hyperlink{Evas__Common_8h_aecbac710f36d52911fc34dcdaf8e729c}{EVAS\_HINT\_FILL}});}
\DoxyCodeLine{   \mbox{\hyperlink{group__Elm__Inwin_gaeb4bd299e4d9b4dc040ac29e1b1d6b1e}{elm\_win\_inwin\_content\_set}}(inwin, o);}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Group__Basic_ga9cbc13661584e49fb9d9cdab514a1eeb}{evas\_object\_show}}(o);}
\DoxyCodeLine{}
\DoxyCodeLine{   o = \mbox{\hyperlink{group__Elm__Label_ga01e161a300e3ee6f7a13a44505724e03}{elm\_label\_add}}(parent);}
\DoxyCodeLine{   elm\_object\_text\_set(o, \textcolor{stringliteral}{"Click on the first button to hide the Inwin.<ps>"}}
\DoxyCodeLine{                       \textcolor{stringliteral}{"Second to destroy it<ps>"});}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Group__Basic_ga9cbc13661584e49fb9d9cdab514a1eeb}{evas\_object\_show}}(o);}
\DoxyCodeLine{}
\DoxyCodeLine{   elm\_box\_pack\_end(\mbox{\hyperlink{group__Elm__Inwin_gadb45fb65aa0b076116e02d0e2b34346c}{elm\_win\_inwin\_content\_get}}(inwin), o);}
\DoxyCodeLine{}
\DoxyCodeLine{   o = \mbox{\hyperlink{group__Elm__Button_ga0021b9d86d822367035843ed18bc6ea9}{elm\_button\_add}}(parent);}
\DoxyCodeLine{   elm\_object\_text\_set(o, \textcolor{stringliteral}{"Hide"});}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Group__Basic_ga9cbc13661584e49fb9d9cdab514a1eeb}{evas\_object\_show}}(o);}
\DoxyCodeLine{}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Smart__Object__Group_ga18a8b179f94d21b2b09e19db11741061}{evas\_object\_smart\_callback\_add}}(o, \textcolor{stringliteral}{"clicked"}, \_inwin\_hide, NULL);}
\DoxyCodeLine{}
\DoxyCodeLine{   elm\_box\_pack\_end(\mbox{\hyperlink{group__Elm__Inwin_gadb45fb65aa0b076116e02d0e2b34346c}{elm\_win\_inwin\_content\_get}}(inwin), o);}
\DoxyCodeLine{}
\DoxyCodeLine{   o = \mbox{\hyperlink{group__Elm__Button_ga0021b9d86d822367035843ed18bc6ea9}{elm\_button\_add}}(parent);}
\DoxyCodeLine{   elm\_object\_text\_set(o, \textcolor{stringliteral}{"Destroy"});}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Group__Basic_ga9cbc13661584e49fb9d9cdab514a1eeb}{evas\_object\_show}}(o);}
\DoxyCodeLine{}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Smart__Object__Group_ga18a8b179f94d21b2b09e19db11741061}{evas\_object\_smart\_callback\_add}}(o, \textcolor{stringliteral}{"clicked"}, \_inwin\_destroy, NULL);}
\DoxyCodeLine{}
\DoxyCodeLine{   elm\_box\_pack\_end(\mbox{\hyperlink{group__Elm__Inwin_gadb45fb65aa0b076116e02d0e2b34346c}{elm\_win\_inwin\_content\_get}}(inwin), o);}
\DoxyCodeLine{\}}

\end{DoxyCodeInclude}


Now, all the code above shows how every object must always be set as content for some other object, be it by setting the full content, packing it in a box or table or working as icon for some other widget. But we didn\textquotesingle{}t do anything like that for the inwin, this one is just created and shown and everything works. Other widgets can be used this way, but they would need to be placed and resized manually or nothing would be shown correctly. The inwin, however, sets itself as a children of the top-\/level window and will be resized as the parent window changes too.

Another characteristic of Inwin is that when it\textquotesingle{}s shown above everyone else, it will work kind of like a modal window, blocking any other widget from receiving events until the window is manually dismissed by pressing some button to close it or having blocking task signalling its completion so normal operations can be resumed. This is unlike the \mbox{\hyperlink{group__Elm__Hover}{Hover}} widget, that would show its content on top of the designated target, but clicking anywhere else would dismiss it automatically.

To illustrate that last point, when we close the main window and an inwin is still there, we\textquotesingle{}ll take out the content from the inwin and place it in a hover. 
\begin{DoxyCodeInclude}{0}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{keyword}{static} \textcolor{keywordtype}{void}}
\DoxyCodeLine{\_win\_del\_cb(\textcolor{keywordtype}{void} *data \mbox{\hyperlink{group__Eina__Types__Group_ga82d751be730f849719ca292f9558be87}{EINA\_UNUSED}}, \mbox{\hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object}} *obj, \textcolor{keywordtype}{void} *event \mbox{\hyperlink{group__Eina__Types__Group_ga82d751be730f849719ca292f9558be87}{EINA\_UNUSED}})}
\DoxyCodeLine{\{}
\DoxyCodeLine{   \textcolor{keywordflow}{if} (inwin)}
\DoxyCodeLine{     \{}
\DoxyCodeLine{        \mbox{\hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object}} *hover, *o = \mbox{\hyperlink{group__Elm__Inwin_ga4df7cab00fe961526b4558e26f25faeb}{elm\_win\_inwin\_content\_unset}}(inwin);}
\DoxyCodeLine{        \mbox{\hyperlink{group__Evas__Object__Group__Basic_ga7e7a625dab7a3890532aa13b43117076}{evas\_object\_del}}(inwin);}
\DoxyCodeLine{        inwin = NULL;}
\DoxyCodeLine{        hover = \mbox{\hyperlink{group__Elm__Hover_ga89c2eecb8d6e8ff12f70c2f3c74212f3}{elm\_hover\_add}}(obj);}
\DoxyCodeLine{        elm\_hover\_target\_set(hover, obj);}
\DoxyCodeLine{        \mbox{\hyperlink{group__Elm__General_ga0531ec8867c72def7c780601764ca642}{elm\_object\_part\_content\_set}}(hover, \textcolor{stringliteral}{"middle"}, o);}
\DoxyCodeLine{        \mbox{\hyperlink{group__Evas__Object__Group__Basic_ga9cbc13661584e49fb9d9cdab514a1eeb}{evas\_object\_show}}(hover);}
\DoxyCodeLine{        \textcolor{keywordflow}{return};}
\DoxyCodeLine{     \}}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Group__Basic_ga7e7a625dab7a3890532aa13b43117076}{evas\_object\_del}}(obj);}
\DoxyCodeLine{\}}

\end{DoxyCodeInclude}


And the rest of the program doesn\textquotesingle{}t have anything else related to inwin, so it won\textquotesingle{}t be shown here, but you can find it in \mbox{\hyperlink{inwin_example_8c-example}{inwin\+\_\+example.c}}. 