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

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}
\textcolor{keyword}{static} Evas\_Object *inwin = NULL;
\textcolor{keyword}{static} \textcolor{keyword}{const} \textcolor{keywordtype}{char} *styles[] = \{
     \textcolor{stringliteral}{"default"},
     \textcolor{stringliteral}{"minimal"},
     \textcolor{stringliteral}{"minimal\_vertical"}
\};
\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}

\textcolor{keyword}{static} \textcolor{keywordtype}{void}
\_inwin\_hide(\textcolor{keywordtype}{void} *data, Evas\_Object *obj, \textcolor{keywordtype}{void} *event)
\{
   \textcolor{keywordflow}{if} (inwin)
     \{
        evas\_object\_hide(inwin);
        \textcolor{keywordflow}{return};
     \}
   elm\_object\_text\_set(obj, \textcolor{stringliteral}{"No inwin!"});
   elm_object_disabled_set(obj, EINA\_TRUE);
\}

\textcolor{keyword}{static} \textcolor{keywordtype}{void}
\_inwin\_destroy(\textcolor{keywordtype}{void} *data, Evas\_Object *obj, \textcolor{keywordtype}{void} *event)
\{
   \textcolor{keywordflow}{if} (inwin)
     \{
        evas\_object\_del(inwin);
        inwin = NULL;
        \textcolor{keywordflow}{return};
     \}
   elm\_object\_text\_set(obj, \textcolor{stringliteral}{"No inwin!"});
   elm_object_disabled_set(obj, EINA\_TRUE);
\}

\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}

\textcolor{keyword}{static} \textcolor{keywordtype}{void}
\_btn\_click\_cb(\textcolor{keywordtype}{void} *data, Evas\_Object *obj, \textcolor{keywordtype}{void} *event)
\{
   Evas\_Object *o, *parent;

   \textcolor{keywordflow}{if} (inwin)
     \{
        elm_win_inwin_activate(inwin);
        \textcolor{keywordflow}{return};
     \}

\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}

   parent = elm_object_top_widget_get(obj);
   inwin = elm_win_inwin_add(parent);
   elm_object_style_set(inwin, styles[current\_style]);
   evas\_object\_show(inwin);

   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}

   o = elm_box_add(parent);
   evas\_object\_size\_hint\_weight\_set(o, EVAS\_HINT\_EXPAND, EVAS\_HINT\_EXPAND);
   evas\_object\_size\_hint\_align\_set(o, EVAS\_HINT\_FILL, EVAS\_HINT\_FILL);
   elm_win_inwin_content_set(inwin, o);
   evas\_object\_show(o);

   o = elm_label_add(parent);
   elm\_object\_text\_set(o, \textcolor{stringliteral}{"Click on the first button to hide the Inwin.<ps>"}
                       \textcolor{stringliteral}{"Second to destroy it<ps>"});
   evas\_object\_show(o);

   elm_box_pack_end(elm_win_inwin_content_get(inwin), o);

   o = elm_button_add(parent);
   elm\_object\_text\_set(o, \textcolor{stringliteral}{"Hide"});
   evas\_object\_show(o);

   evas\_object\_smart\_callback\_add(o, \textcolor{stringliteral}{"clicked"}, \_inwin\_hide, NULL);

   elm_box_pack_end(elm_win_inwin_content_get(inwin), o);

   o = elm_button_add(parent);
   elm\_object\_text\_set(o, \textcolor{stringliteral}{"Destroy"});
   evas\_object\_show(o);

   evas\_object\_smart\_callback\_add(o, \textcolor{stringliteral}{"clicked"}, \_inwin\_destroy, NULL);

   elm_box_pack_end(elm_win_inwin_content_get(inwin), o);
\}

\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 \hyperlink{group__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}

\textcolor{keyword}{static} \textcolor{keywordtype}{void}
\_win\_del\_cb(\textcolor{keywordtype}{void} *data, Evas\_Object *obj, \textcolor{keywordtype}{void} *event)
\{
   \textcolor{keywordflow}{if} (inwin)
     \{
        Evas\_Object *hover, *o = elm_win_inwin_content_unset(inwin);
        evas\_object\_del(inwin);
        inwin = NULL;
        hover = elm_hover_add(obj);
        elm_hover_target_set(hover, obj);
        elm_object_part_content_set(hover, \textcolor{stringliteral}{"middle"}, o);
        evas\_object\_show(hover);
        \textcolor{keywordflow}{return};
     \}
   evas\_object\_del(obj);
\}

\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 \hyperlink{inwin_example_8c-example}{inwin\+\_\+example.c}. 