\hypertarget{ecore_evas_object_example_8c-example}{}\section{ecore\+\_\+evas\+\_\+object\+\_\+example.\+c}

\begin{DoxyCodeInclude}

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

\mbox{\hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object}} *cursor;

\textcolor{keyword}{static} \textcolor{keywordtype}{void}
\mbox{\hyperlink{group__Elm__Gesture__Layer_gac99bfa54a39fbdd3e6ef1ed06abca820}{\_mouse\_down\_cb}}(\textcolor{keywordtype}{void} *data, \mbox{\hyperlink{group__Evas__Canvas_ga5ff87cc4ce6bc43e3b640a6d37f73043}{Evas}} *evas \mbox{\hyperlink{group__Eina__Types__Group_ga82d751be730f849719ca292f9558be87}{EINA\_UNUSED}}, 
      \mbox{\hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object}} *obj \mbox{\hyperlink{group__Eina__Types__Group_ga82d751be730f849719ca292f9558be87}{EINA\_UNUSED}}, \textcolor{keywordtype}{void} *event\_info \mbox{\hyperlink{group__Eina__Types__Group_ga82d751be730f849719ca292f9558be87}{EINA\_UNUSED}})
\{
   \textcolor{keyword}{static} \mbox{\hyperlink{group__Eina__Types__Group_ga3fe0caf72e93b1bab1ca8ee3ccf3f226}{Eina\_Bool}} flag = \mbox{\hyperlink{group__Eina__Types__Group_ga1feb115f8e9913e806e090d9bd5a7301}{EINA\_FALSE}};

   \textcolor{keywordflow}{if} (!flag)
     \{
        \mbox{\hyperlink{group__Ecore__Evas__Group_ga7cfb59e7b793ca2f05e3dfb1b0d67272}{ecore\_evas\_cursor\_unset}}(data);
        \mbox{\hyperlink{group__Ecore__Evas__Group_ga529fe8c55bdb0f58c884a0e5f0dfff71}{ecore\_evas\_object\_cursor\_set}}(data, NULL, 0, 1, 1);
     \}
   \textcolor{keywordflow}{else}
     \mbox{\hyperlink{group__Ecore__Evas__Group_ga529fe8c55bdb0f58c884a0e5f0dfff71}{ecore\_evas\_object\_cursor\_set}}(data, cursor, 0, 1, 1);

   flag = !flag;
\}

\textcolor{keywordtype}{int}
main(\textcolor{keywordtype}{void})
\{
   Ecore\_Evas *ee;
   \mbox{\hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object}} *bg, *obj;
   \textcolor{keywordtype}{int} layer, x, y;

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

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

   bg = \mbox{\hyperlink{group__Evas__Object__Rectangle_ga4d80fc32ad1cac28428cebd65d746751}{evas\_object\_rectangle\_add}}(\mbox{\hyperlink{group__Ecore__Evas__Group_ga75a7cc694b6069e78df47dab0b0f2d20}{ecore\_evas\_get}}(ee));
   \mbox{\hyperlink{group__Evas__Object__Group__Basic_gae34bdcfd7f5100151f6ea8ef4a392949}{evas\_object\_color\_set}}(bg, 0, 0, 255, 255);
   evas\_object\_resize(bg, 200, 200);
   \mbox{\hyperlink{group__Evas__Object__Group__Basic_ga9cbc13661584e49fb9d9cdab514a1eeb}{evas\_object\_show}}(bg);
   \mbox{\hyperlink{group__Ecore__Evas__Group_gac35627a5c3a766ee42762dbcc9eb733d}{ecore\_evas\_object\_associate}}(ee, bg, ECORE\_EVAS\_OBJECT\_ASSOCIATE\_BASE);
   \mbox{\hyperlink{group__Evas__Object__Group__Events_ga23be30ac5cdfb780f1ff82e9108ec26b}{evas\_object\_event\_callback\_add}}(bg, 
      \mbox{\hyperlink{Evas__Common_8h_ad64cde0da38a60e7cb7905b3ab216968a9fa52651ccf7e47cd3b7785fc4cf393f}{EVAS\_CALLBACK\_MOUSE\_DOWN}}, \mbox{\hyperlink{group__Elm__Gesture__Layer_gac99bfa54a39fbdd3e6ef1ed06abca820}{\_mouse\_down\_cb}}, ee);

   \textcolor{keywordflow}{if} (bg == \mbox{\hyperlink{group__Ecore__Evas__Group_ga55426142132c95742ab728187ca1c746}{ecore\_evas\_object\_associate\_get}}(ee))
     printf(\textcolor{stringliteral}{"Association worked!\(\backslash\)n"});

   cursor = \mbox{\hyperlink{group__Evas__Object__Rectangle_ga4d80fc32ad1cac28428cebd65d746751}{evas\_object\_rectangle\_add}}(\mbox{\hyperlink{group__Ecore__Evas__Group_ga75a7cc694b6069e78df47dab0b0f2d20}{ecore\_evas\_get}}(ee));
   \mbox{\hyperlink{group__Evas__Object__Group__Basic_gae34bdcfd7f5100151f6ea8ef4a392949}{evas\_object\_color\_set}}(cursor, 0, 255, 0, 255);
   evas\_object\_resize(cursor, 5, 10);
   \mbox{\hyperlink{group__Ecore__Evas__Group_ga529fe8c55bdb0f58c884a0e5f0dfff71}{ecore\_evas\_object\_cursor\_set}}(ee, cursor, 0, 1, 1);

   \mbox{\hyperlink{group__Ecore__Evas__Group_gaaa4c87c6745f098edbf786212df745d8}{ecore\_evas\_cursor\_get}}(ee, &obj, &layer, &x, &y);
   \textcolor{keywordflow}{if} (obj == cursor && layer == 0 && x == 1 && y == 1)
     printf(\textcolor{stringliteral}{"Set cursor worked!\(\backslash\)n"});

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

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

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

\end{DoxyCodeInclude}
 