

In this example we will have 3 notifies in 3 different positions. The first will dissappear after 5 seconds or when a outside clickking occurs, the second and third will not disappear and differ from each other only in position.

We start our example with the usual stuff you\textquotesingle{}ve seen in other examples\+: 
\begin{DoxyCodeInclude}{0}
\DoxyCodeLine{\textcolor{comment}{//Compile with:}}
\DoxyCodeLine{\textcolor{comment}{//gcc -\/o notify\_example\_01 notify\_example\_01.c -\/g `pkg-\/config -\/-\/cflags -\/-\/libs elementary`}}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{preprocessor}{\#include <Elementary.h>}}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{keyword}{static} \textcolor{keywordtype}{void} \_hide(\textcolor{keywordtype}{void} *data, \mbox{\hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object}} *obj, \textcolor{keywordtype}{void} *event\_info);}
\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, *bx, *notify, *content;}
\DoxyCodeLine{}
\DoxyCodeLine{   win = \mbox{\hyperlink{group__Elm__Win_gac75d7752662fab73d6420706ce5be996}{elm\_win\_util\_standard\_add}}(\textcolor{stringliteral}{"notify"}, \textcolor{stringliteral}{"Notify"});}
\DoxyCodeLine{   \mbox{\hyperlink{group__Elm__Win_ga9a16a2f8c9fd5b6e9203ed9dcb53ea8b}{elm\_win\_autodel\_set}}(win, \mbox{\hyperlink{group__Eina__Types__Group_ga05c12dacc8b4058994df842b41be85fc}{EINA\_TRUE}});}
\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{   bx = \mbox{\hyperlink{group__Elm__Box_ga3d0998b60ada633bacfa8869a921cfd7}{elm\_box\_add}}(win);}
\DoxyCodeLine{   elm\_box\_horizontal\_set(bx, \mbox{\hyperlink{group__Eina__Types__Group_ga1feb115f8e9913e806e090d9bd5a7301}{EINA\_FALSE}});}
\DoxyCodeLine{   evas\_object\_size\_hint\_weight\_set(bx, \mbox{\hyperlink{Evas__Common_8h_aa47c85083d3dae0111c21ec49359306a}{EVAS\_HINT\_EXPAND}}, \mbox{\hyperlink{Evas__Common_8h_aa47c85083d3dae0111c21ec49359306a}{EVAS\_HINT\_EXPAND}});}
\DoxyCodeLine{   \mbox{\hyperlink{group__Elm__Win_ga505d6bd217e5ee01e82b548ec35986eb}{elm\_win\_resize\_object\_add}}(win, bx);}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Group__Basic_ga9cbc13661584e49fb9d9cdab514a1eeb}{evas\_object\_show}}(bx);}

\end{DoxyCodeInclude}


We now create a label to use as the content of our first notify\+: 
\begin{DoxyCodeInclude}{0}
\DoxyCodeLine{}
\DoxyCodeLine{   content = \mbox{\hyperlink{group__Elm__Label_ga01e161a300e3ee6f7a13a44505724e03}{elm\_label\_add}}(win);}
\DoxyCodeLine{   elm\_object\_text\_set(content, \textcolor{stringliteral}{"default"});}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Group__Basic_ga9cbc13661584e49fb9d9cdab514a1eeb}{evas\_object\_show}}(content);}

\end{DoxyCodeInclude}


Having the label we move to creating our notify, telling it to block events, setting its timeout(to autohide it)\+: 
\begin{DoxyCodeInclude}{0}
\DoxyCodeLine{}
\DoxyCodeLine{   notify = \mbox{\hyperlink{group__Elm__Notify_ga3b3eb10c622de79e55539aeb84e538a3}{elm\_notify\_add}}(win);}
\DoxyCodeLine{   elm\_notify\_allow\_events\_set(notify, \mbox{\hyperlink{group__Eina__Types__Group_ga1feb115f8e9913e806e090d9bd5a7301}{EINA\_FALSE}});}
\DoxyCodeLine{   elm\_notify\_timeout\_set(notify, 5);}
\DoxyCodeLine{   elm\_object\_content\_set(notify, content);}
\DoxyCodeLine{   evas\_object\_size\_hint\_weight\_set(notify, \mbox{\hyperlink{Evas__Common_8h_aa47c85083d3dae0111c21ec49359306a}{EVAS\_HINT\_EXPAND}}, \mbox{\hyperlink{Evas__Common_8h_aa47c85083d3dae0111c21ec49359306a}{EVAS\_HINT\_EXPAND}});}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Group__Basic_ga9cbc13661584e49fb9d9cdab514a1eeb}{evas\_object\_show}}(notify);}
\DoxyCodeLine{   elm\_box\_pack\_end(bx, notify);}

\end{DoxyCodeInclude}


To have the notify dissappear when a click outside its area occur we have to listen to its \char`\"{}block,clicked\char`\"{} signal\+: 
\begin{DoxyCodeInclude}{0}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Smart__Object__Group_ga18a8b179f94d21b2b09e19db11741061}{evas\_object\_smart\_callback\_add}}(notify, \textcolor{stringliteral}{"block,clicked"}, \_hide, NULL);}

\end{DoxyCodeInclude}


Our callback will look like this\+: 
\begin{DoxyCodeInclude}{0}
\DoxyCodeLine{\textcolor{keyword}{static} \textcolor{keywordtype}{void}}
\DoxyCodeLine{\_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\_info \mbox{\hyperlink{group__Eina__Types__Group_ga82d751be730f849719ca292f9558be87}{EINA\_UNUSED}})}
\DoxyCodeLine{\{}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Group__Basic_gacc307a0d7bfc9df151fd9ec75808c587}{evas\_object\_hide}}(obj);}
\DoxyCodeLine{\}}

\end{DoxyCodeInclude}
 

Next we create another label and another notify. Note, however, that this time we don\textquotesingle{}t set a timeout and don\textquotesingle{}t have it block events. What we do is set the orient so that this notify will appear in the bottom of its parent\+: 
\begin{DoxyCodeInclude}{0}
\DoxyCodeLine{   content = \mbox{\hyperlink{group__Elm__Label_ga01e161a300e3ee6f7a13a44505724e03}{elm\_label\_add}}(win);}
\DoxyCodeLine{   elm\_object\_text\_set(content, \textcolor{stringliteral}{"bottom"});}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Group__Basic_ga9cbc13661584e49fb9d9cdab514a1eeb}{evas\_object\_show}}(content);}
\DoxyCodeLine{}
\DoxyCodeLine{   notify = \mbox{\hyperlink{group__Elm__Notify_ga3b3eb10c622de79e55539aeb84e538a3}{elm\_notify\_add}}(win);}
\DoxyCodeLine{   elm\_notify\_align\_set(notify, 0.5, 1.0);}
\DoxyCodeLine{   elm\_object\_content\_set(notify, content);}
\DoxyCodeLine{   evas\_object\_size\_hint\_weight\_set(notify, \mbox{\hyperlink{Evas__Common_8h_aa47c85083d3dae0111c21ec49359306a}{EVAS\_HINT\_EXPAND}}, \mbox{\hyperlink{Evas__Common_8h_aa47c85083d3dae0111c21ec49359306a}{EVAS\_HINT\_EXPAND}});}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Group__Basic_ga9cbc13661584e49fb9d9cdab514a1eeb}{evas\_object\_show}}(notify);}
\DoxyCodeLine{   elm\_box\_pack\_end(bx, notify);}

\end{DoxyCodeInclude}


For our third notify the only change is the orient which is now center\+: 
\begin{DoxyCodeInclude}{0}
\DoxyCodeLine{}
\DoxyCodeLine{   content = \mbox{\hyperlink{group__Elm__Label_ga01e161a300e3ee6f7a13a44505724e03}{elm\_label\_add}}(win);}
\DoxyCodeLine{   elm\_object\_text\_set(content, \textcolor{stringliteral}{"center"});}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Group__Basic_ga9cbc13661584e49fb9d9cdab514a1eeb}{evas\_object\_show}}(content);}
\DoxyCodeLine{}
\DoxyCodeLine{   notify = \mbox{\hyperlink{group__Elm__Notify_ga3b3eb10c622de79e55539aeb84e538a3}{elm\_notify\_add}}(win);}
\DoxyCodeLine{   elm\_notify\_align\_set(notify, 0.5, 0.5);}
\DoxyCodeLine{   elm\_object\_content\_set(notify, content);}
\DoxyCodeLine{   evas\_object\_size\_hint\_weight\_set(notify, \mbox{\hyperlink{Evas__Common_8h_aa47c85083d3dae0111c21ec49359306a}{EVAS\_HINT\_EXPAND}}, \mbox{\hyperlink{Evas__Common_8h_aa47c85083d3dae0111c21ec49359306a}{EVAS\_HINT\_EXPAND}});}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Group__Basic_ga9cbc13661584e49fb9d9cdab514a1eeb}{evas\_object\_show}}(notify);}
\DoxyCodeLine{   elm\_box\_pack\_end(bx, notify);}

\end{DoxyCodeInclude}


Now we tell the main loop to run\+: 
\begin{DoxyCodeInclude}{0}
\DoxyCodeLine{}
\DoxyCodeLine{   evas\_object\_resize(win, 100, 200);}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Group__Basic_ga9cbc13661584e49fb9d9cdab514a1eeb}{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/notify_example_01}}
\end{DoxyImageNoCaption}


Once the first notify is hidden\+:

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