

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}
\textcolor{comment}{//Compile with:}
\textcolor{comment}{//gcc -o notify\_example\_01 notify\_example\_01.c -g `pkg-config --cflags --libs elementary`}

\textcolor{preprocessor}{#include <Elementary.h>}

\textcolor{keyword}{static} \textcolor{keywordtype}{void} \_hide(\textcolor{keywordtype}{void} *data, Evas\_Object *obj, \textcolor{keywordtype}{void} *event\_info);

EAPI\_MAIN \textcolor{keywordtype}{int}
elm\_main(\textcolor{keywordtype}{int} argc, \textcolor{keywordtype}{char} **argv)
\{
   Evas\_Object *win, *bx, *notify, *content;

   win = elm_win_util_standard_add(\textcolor{stringliteral}{"notify"}, \textcolor{stringliteral}{"Notify"});
   elm\_win\_autodel\_set(win, EINA\_TRUE);
   elm_policy_set(ELM\_POLICY\_QUIT, ELM\_POLICY\_QUIT\_LAST\_WINDOW\_CLOSED);

   bx = elm_box_add(win);
   elm\_box\_horizontal\_set(bx, EINA\_FALSE);
   evas\_object\_size\_hint\_weight\_set(bx, EVAS\_HINT\_EXPAND, EVAS\_HINT\_EXPAND);
   elm\_win\_resize\_object\_add(win, bx);
   evas\_object\_show(bx);

\end{DoxyCodeInclude}


We now create a label to use as the content of our first notify\+: 
\begin{DoxyCodeInclude}

   content = elm_label_add(win);
   elm\_object\_text\_set(content, \textcolor{stringliteral}{"default"});
   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}

   notify = elm_notify_add(win);
   elm\_notify\_allow\_events\_set(notify, EINA\_FALSE);
   elm\_notify\_timeout\_set(notify, 5);
   elm\_object\_content\_set(notify, content);
   evas\_object\_size\_hint\_weight\_set(notify, EVAS\_HINT\_EXPAND, EVAS\_HINT\_EXPAND);
   evas\_object\_show(notify);
   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}
   evas\_object\_smart\_callback\_add(notify, \textcolor{stringliteral}{"block,clicked"}, \_hide, NULL);

\end{DoxyCodeInclude}


Our callback will look like this\+: 
\begin{DoxyCodeInclude}
\textcolor{keyword}{static} \textcolor{keywordtype}{void}
\_hide(\textcolor{keywordtype}{void} *data, Evas\_Object *obj, \textcolor{keywordtype}{void} *event\_info)
\{
   evas\_object\_hide(obj);
\}

\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}
   content = elm_label_add(win);
   elm\_object\_text\_set(content, \textcolor{stringliteral}{"bottom"});
   evas\_object\_show(content);

   notify = elm_notify_add(win);
   elm\_notify\_align\_set(notify, 0.5, 1.0);
   elm\_object\_content\_set(notify, content);
   evas\_object\_size\_hint\_weight\_set(notify, EVAS\_HINT\_EXPAND, EVAS\_HINT\_EXPAND);
   evas\_object\_show(notify);
   elm\_box\_pack\_end(bx, notify);

\end{DoxyCodeInclude}


For our third notify the only change is the orient which is now center\+: 
\begin{DoxyCodeInclude}

   content = elm_label_add(win);
   elm\_object\_text\_set(content, \textcolor{stringliteral}{"center"});
   evas\_object\_show(content);

   notify = elm_notify_add(win);
   elm\_notify\_align\_set(notify, 0.5, 0.5);
   elm\_object\_content\_set(notify, content);
   evas\_object\_size\_hint\_weight\_set(notify, EVAS\_HINT\_EXPAND, EVAS\_HINT\_EXPAND);
   evas\_object\_show(notify);
   elm\_box\_pack\_end(bx, notify);

\end{DoxyCodeInclude}


Now we tell the main loop to run\+: 
\begin{DoxyCodeInclude}

   evas\_object\_resize(win, 100, 200);
   evas\_object\_show(win);

   elm_run();

   \textcolor{keywordflow}{return} 0;
\}
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}
 