

Our example is remarkably simple, all it does is create an Ecore\+\_\+\+Evas and register a callback for a bunch of events. What\textquotesingle{}s interesting here is knowing when each of these callbacks will be called, however since that depends on the underlying windowing system there are no guarantees that all of the callbacks will be called for your windowing system. To know which callbacks will be called for your windowing system run the example and redirect the output to a file, and take a look at it.

\begin{DoxyNote}{Note}
Make sure you minimize, resize, give and remove focus to see more callbacks called.
\end{DoxyNote}
The example is constituted of two main parts, first is the implementation of callbacks that will be called for each event(all our callbacks do is print their own name) and the second is the main function where we register the event callbacks and run the main loop\+: 
\begin{DoxyCodeInclude}

\textcolor{preprocessor}{#include <Ecore.h>}
\textcolor{preprocessor}{#include <\hyperlink{Ecore__Evas_8h}{Ecore\_Evas.h}>}

\textcolor{keyword}{static} \textcolor{keywordtype}{void}
\_destroy(Ecore\_Evas *ee EINA\_UNUSED)
\{
   printf(\textcolor{stringliteral}{"destroy\(\backslash\)n"});
   \hyperlink{group__Ecore__Main__Loop__Group_ga95cf8e97dff0716433c2c5474d606a98}{ecore\_main\_loop\_quit}();
\}

\textcolor{keyword}{static} \textcolor{keywordtype}{void}
\_delete(Ecore\_Evas *ee EINA\_UNUSED)
\{
   printf(\textcolor{stringliteral}{"delete\(\backslash\)n"});
   \hyperlink{group__Ecore__Main__Loop__Group_ga95cf8e97dff0716433c2c5474d606a98}{ecore\_main\_loop\_quit}();
\}

\textcolor{keyword}{static} \textcolor{keywordtype}{void}
\_focus\_in(Ecore\_Evas *ee EINA\_UNUSED)
\{
   printf(\textcolor{stringliteral}{"focus\_in\(\backslash\)n"});
\}

\textcolor{keyword}{static} \textcolor{keywordtype}{void}
\_focus\_out(Ecore\_Evas *ee EINA\_UNUSED)
\{
   printf(\textcolor{stringliteral}{"focus\_out\(\backslash\)n"});
\}

\textcolor{keyword}{static} \textcolor{keywordtype}{void}
\_hide(Ecore\_Evas *ee EINA\_UNUSED)
\{
   printf(\textcolor{stringliteral}{"hide\(\backslash\)n"});
\}

\textcolor{keyword}{static} \textcolor{keywordtype}{void}
\_mouse\_in(Ecore\_Evas *ee EINA\_UNUSED)
\{
   printf(\textcolor{stringliteral}{"mouse\_in\(\backslash\)n"});
\}

\textcolor{keyword}{static} \textcolor{keywordtype}{void}
\_show(Ecore\_Evas *ee EINA\_UNUSED)
\{
   printf(\textcolor{stringliteral}{"show\(\backslash\)n"});
\}

\textcolor{keyword}{static} \textcolor{keywordtype}{void}
\_mouse\_out(Ecore\_Evas *ee EINA\_UNUSED)
\{
   printf(\textcolor{stringliteral}{"mouse\_out\(\backslash\)n"});
\}

\textcolor{keyword}{static} \textcolor{keywordtype}{void}
\_move(Ecore\_Evas *ee EINA\_UNUSED)
\{
   printf(\textcolor{stringliteral}{"move\(\backslash\)n"});
\}

\textcolor{keyword}{static} \textcolor{keywordtype}{void}
\_post\_render(Ecore\_Evas *ee EINA\_UNUSED)
\{
   printf(\textcolor{stringliteral}{"post\_render\(\backslash\)n"});
\}

\textcolor{keyword}{static} \textcolor{keywordtype}{void}
\_pre\_free(Ecore\_Evas *ee EINA\_UNUSED)
\{
   printf(\textcolor{stringliteral}{"pre\_free\(\backslash\)n"});
\}

\textcolor{keyword}{static} \textcolor{keywordtype}{void}
\_pre\_render(Ecore\_Evas *ee EINA\_UNUSED)
\{
   printf(\textcolor{stringliteral}{"pre\_render\(\backslash\)n"});
\}

\textcolor{keyword}{static} \textcolor{keywordtype}{void}
\_resize(Ecore\_Evas *ee EINA\_UNUSED)
\{
   printf(\textcolor{stringliteral}{"resize\(\backslash\)n"});
\}

\textcolor{keywordtype}{int}
main(\textcolor{keywordtype}{void})
\{
   Ecore\_Evas *ee;
   \hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object} *bg;

   \hyperlink{group__Ecore__Evas__Group_ga32ddbb6457033ad435a177eb0c4fe235}{ecore\_evas\_init}();

   ee = \hyperlink{group__Ecore__Evas__Group_gac7f2cdbcb79635c34317c1183dd04cb0}{ecore\_evas\_new}(NULL, 0, 0, 200, 100, NULL);
   \hyperlink{group__Ecore__Evas__Group_ga3b2832e0373bbafae2bb7143618535c1}{ecore\_evas\_title\_set}(ee, \textcolor{stringliteral}{"Ecore Evas Callbacks Example"});
   \hyperlink{group__Ecore__Evas__Group_ga4953047ff97d4f1b0d75a7d513d4f317}{ecore\_evas\_show}(ee);

   bg = \hyperlink{group__Evas__Object__Rectangle_ga4d80fc32ad1cac28428cebd65d746751}{evas\_object\_rectangle\_add}(\hyperlink{group__Ecore__Evas__Group_ga75a7cc694b6069e78df47dab0b0f2d20}{ecore\_evas\_get}(ee));
   \hyperlink{group__Evas__Object__Group__Basic_gae34bdcfd7f5100151f6ea8ef4a392949}{evas\_object\_color\_set}(bg, 255, 128, 0, 255);
   \hyperlink{group__Evas__Font__Group_ga21e8604c0e4a93e469bff4bd069e82b5}{evas\_object\_resize}(bg, 9999, 9999);
   \hyperlink{group__Evas__Object__Group__Basic_ga9cbc13661584e49fb9d9cdab514a1eeb}{evas\_object\_show}(bg);

   \textcolor{comment}{//callbacks}
   \hyperlink{group__Ecore__Evas__Group_ga3d478e975e2101b9b821ef24baf3dd9e}{ecore\_evas\_callback\_delete\_request\_set}(ee, \_delete);
   \hyperlink{group__Ecore__Evas__Group_ga3680b5c89157167318192157a5d24ec4}{ecore\_evas\_callback\_destroy\_set}(ee, \_destroy);
   \hyperlink{group__Ecore__Evas__Group_gaed00daa1c88d15a6eca0fe80d6dbe9d7}{ecore\_evas\_callback\_focus\_in\_set}(ee, \_focus\_in);
   \hyperlink{group__Ecore__Evas__Group_gaefc78deb952d5a344244a85ee163991a}{ecore\_evas\_callback\_focus\_out\_set}(ee, \_focus\_out);
   \hyperlink{group__Ecore__Evas__Group_gac61786e38551703d12605e0ed69f3bc4}{ecore\_evas\_callback\_hide\_set}(ee, \_hide);
   \hyperlink{group__Ecore__Evas__Group_gaef1d4db9bda946e4cd18cc2b22de0a4b}{ecore\_evas\_callback\_mouse\_in\_set}(ee, \_mouse\_in);
   \hyperlink{group__Ecore__Evas__Group_gaf7930c3ea1d3d6adf1ee9e870df36129}{ecore\_evas\_callback\_mouse\_out\_set}(ee, \_mouse\_out);
   \hyperlink{group__Ecore__Evas__Group_ga4a89157b5f10a1429d5e5a586cec036c}{ecore\_evas\_callback\_move\_set}(ee, \_move);
   \hyperlink{group__Ecore__Evas__Group_ga8f1dfb93c0af2ff6145860c250872294}{ecore\_evas\_callback\_post\_render\_set}(ee, \_post\_render);
   \hyperlink{group__Ecore__Evas__Group_ga6d95e41a3b84e262c0e80f1904bd8473}{ecore\_evas\_callback\_pre\_free\_set}(ee, \_pre\_free);
   \hyperlink{group__Ecore__Evas__Group_gac1ec97ef5561355c1d998c8bb201345d}{ecore\_evas\_callback\_pre\_render\_set}(ee, \_pre\_render);
   \hyperlink{group__Ecore__Evas__Group_gaac67f679c9027059a34519fbdea360df}{ecore\_evas\_callback\_resize\_set}(ee, \_resize);
   \hyperlink{group__Ecore__Evas__Group_ga798e4c5f7eb2c3a9867f81499ad81b16}{ecore\_evas\_callback\_show\_set}(ee, \_show);

   \hyperlink{group__Ecore__Main__Loop__Group_gaf103b9f668bb3e4fed12e52c6180132d}{ecore\_main\_loop\_begin}();

   \hyperlink{group__Ecore__Evas__Group_gad3ec61f2aa03df4d3dbfd0d311e0c8dc}{ecore\_evas\_free}(ee);
   \hyperlink{group__Ecore__Evas__Group_gab8fa311077f749190c9b622f672b2214}{ecore\_evas\_shutdown}();

   \textcolor{keywordflow}{return} 0;
\}

\end{DoxyCodeInclude}
 