\hypertarget{ecore_evas_basics_example_8c-example}{\section{ecore\+\_\+evas\+\_\+basics\+\_\+example.\+c}
}

\begin{DoxyCodeInclude}

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

\textcolor{keyword}{static} \hyperlink{group__Eina__Types__Group_ga3fe0caf72e93b1bab1ca8ee3ccf3f226}{Eina\_Bool}
\_stdin\_cb(\textcolor{keywordtype}{void} *data \hyperlink{group__Eina__Types__Group_ga82d751be730f849719ca292f9558be87}{EINA\_UNUSED}, \hyperlink{group__Ecore__FD__Handler__Group_ga225121ed2123da4b52b76aa08d78c220}{Ecore\_Fd\_Handler} *handler EINA\_UNUSED)
\{
   \hyperlink{struct__Eina__List}{Eina\_List} *l;
   Ecore\_Evas *ee;
   \textcolor{keywordtype}{char} c;

   \textcolor{keywordtype}{int} ret = scanf(\textcolor{stringliteral}{"%c"}, &c);
   \textcolor{keywordflow}{if} (ret < 1) \textcolor{keywordflow}{return} \hyperlink{group__Ecore__Main__Loop__Group_ga1ee9db07f9a46a8b20fb83e1c6dbed09}{ECORE\_CALLBACK\_RENEW};

   \textcolor{keywordflow}{if} (c == \textcolor{charliteral}{'h'})
     \hyperlink{group__Eina__List__Group_gad02f746a08ee0b12b7ed66d4bc0d71d8}{EINA\_LIST\_FOREACH}(\hyperlink{group__Ecore__Evas__Group_gae941cd1dca7354ef68e3137e76db6688}{ecore\_evas\_ecore\_evas\_list\_get}(), l, 
      ee)
       \hyperlink{group__Ecore__Evas__Group_ga0c4c806d5873a4528334e398d28940d4}{ecore\_evas\_hide}(ee);
   \textcolor{keywordflow}{else} \textcolor{keywordflow}{if} (c == \textcolor{charliteral}{'s'})
     \hyperlink{group__Eina__List__Group_gad02f746a08ee0b12b7ed66d4bc0d71d8}{EINA\_LIST\_FOREACH}(\hyperlink{group__Ecore__Evas__Group_gae941cd1dca7354ef68e3137e76db6688}{ecore\_evas\_ecore\_evas\_list\_get}(), l, 
      ee)
       \hyperlink{group__Ecore__Evas__Group_ga4953047ff97d4f1b0d75a7d513d4f317}{ecore\_evas\_show}(ee);

   \textcolor{keywordflow}{return} \hyperlink{group__Ecore__Main__Loop__Group_ga1ee9db07f9a46a8b20fb83e1c6dbed09}{ECORE\_CALLBACK\_RENEW};
\}

\textcolor{keyword}{static} \textcolor{keywordtype}{void}
\_on\_delete(Ecore\_Evas *ee)
\{
   free(\hyperlink{group__Ecore__Evas__Group_gae00d4a4feb8aec5de03e464fe21a1d30}{ecore\_evas\_data\_get}(ee, \textcolor{stringliteral}{"key"}));
   \hyperlink{group__Ecore__Main__Loop__Group_ga95cf8e97dff0716433c2c5474d606a98}{ecore\_main\_loop\_quit}();
\}

\textcolor{keywordtype}{int}
main(\textcolor{keywordtype}{void})
\{
   Ecore\_Evas *ee;
   \hyperlink{group__Evas__Canvas_ga5ff87cc4ce6bc43e3b640a6d37f73043}{Evas} *canvas;
   \hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object} *bg;
   \hyperlink{struct__Eina__List}{Eina\_List} *engines, *l;
   \textcolor{keywordtype}{char} *data;

   \textcolor{keywordflow}{if} (\hyperlink{group__Ecore__Evas__Group_ga32ddbb6457033ad435a177eb0c4fe235}{ecore\_evas\_init}() <= 0)
     \textcolor{keywordflow}{return} 1;

   engines = \hyperlink{group__Ecore__Evas__Group_gab05620912f2d3ca276281efa774104d5}{ecore\_evas\_engines\_get}();
   printf(\textcolor{stringliteral}{"Available engines:\(\backslash\)n"});
   \hyperlink{group__Eina__List__Group_gad02f746a08ee0b12b7ed66d4bc0d71d8}{EINA\_LIST\_FOREACH}(engines, l, data)
     printf("%s\(\backslash\)n", data);
   \hyperlink{group__Ecore__Evas__Group_ga85538b892d449f5c7a056ca4d49e72a7}{ecore\_evas\_engines\_free}(engines);

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

   data = malloc(sizeof(\textcolor{keywordtype}{char}) * 6);
   sprintf(data, "%s", "hello");
   \hyperlink{group__Ecore__Evas__Group_gaa86c5abd200a02711aced53d27b9ddb2}{ecore\_evas\_data\_set}(ee, "key", data);
   \hyperlink{group__Ecore__Evas__Group_ga3d478e975e2101b9b821ef24baf3dd9e}{ecore\_evas\_callback\_delete\_request\_set}(ee, \_on\_delete);

   printf("Using %s engine!\(\backslash\)n", \hyperlink{group__Ecore__Evas__Group_ga13b5c10c8b6615f74c9092d6dc66cc97}{ecore\_evas\_engine\_name\_get}(ee));

   canvas = \hyperlink{group__Ecore__Evas__Group_ga75a7cc694b6069e78df47dab0b0f2d20}{ecore\_evas\_get}(ee);
   if (\hyperlink{group__Ecore__Evas__Group_ga81e49472d5b55809952bf9676daf6a82}{ecore\_evas\_ecore\_evas\_get}(canvas) == ee)
     printf("Everything is sane!\(\backslash\)n");

   bg = \hyperlink{group__Evas__Object__Rectangle_ga4d80fc32ad1cac28428cebd65d746751}{evas\_object\_rectangle\_add}(canvas);
   \hyperlink{group__Evas__Object__Group__Basic_gae34bdcfd7f5100151f6ea8ef4a392949}{evas\_object\_color\_set}(bg, 0, 0, 255, 255);
   evas\_object\_resize(bg, 200, 200);
   \hyperlink{group__Evas__Object__Group__Basic_ga9cbc13661584e49fb9d9cdab514a1eeb}{evas\_object\_show}(bg);
   \hyperlink{group__Ecore__Evas__Group_gac35627a5c3a766ee42762dbcc9eb733d}{ecore\_evas\_object\_associate}(ee, bg, ECORE\_EVAS\_OBJECT\_ASSOCIATE\_BASE);

   \hyperlink{group__Ecore__FD__Handler__Group_ga832e68eb7f15912abeadef816bb5d2f5}{ecore\_main\_fd\_handler\_add}(STDIN\_FILENO, ECORE\_FD\_READ, \_stdin\_cb, NULL, NULL, 
      NULL);

   \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}();

   return 0;
\}

\end{DoxyCodeInclude}
 