

In this example, we illustrate how to stack objects in a custom manner and how to deal with layers.

We have three objects of interest in it -- white background, red rectangle, green rectangle and blue rectangle. 
\begin{DoxyCodeInclude}
   d.bg = \hyperlink{group__Evas__Object__Rectangle_ga4d80fc32ad1cac28428cebd65d746751}{evas\_object\_rectangle\_add}(d.canvas);
   evas\_object\_name\_set(d.bg, \textcolor{stringliteral}{"background"});  \textcolor{comment}{/* white bg */}
   \hyperlink{group__Evas__Object__Group__Basic_gae34bdcfd7f5100151f6ea8ef4a392949}{evas\_object\_color\_set}(d.bg, 255, 255, 255, 255);
   \hyperlink{group__Evas__Font__Group_ga02da8091bbac768b8e86c7b74b2a94f9}{evas\_object\_move}(d.bg, 0, 0);
   \hyperlink{group__Evas__Font__Group_ga21e8604c0e4a93e469bff4bd069e82b5}{evas\_object\_resize}(d.bg, WIDTH, HEIGHT);
   d.rects[2] = \hyperlink{group__Evas__Object__Rectangle_ga4d80fc32ad1cac28428cebd65d746751}{evas\_object\_rectangle\_add}(d.canvas);
   evas\_object\_name\_set(d.rects[2], \textcolor{stringliteral}{"blue"});
   \hyperlink{group__Evas__Object__Group__Basic_gae34bdcfd7f5100151f6ea8ef4a392949}{evas\_object\_color\_set}(d.rects[2], 0, 0, 255, 255);

   \hyperlink{group__Evas__Font__Group_ga21e8604c0e4a93e469bff4bd069e82b5}{evas\_object\_resize}(d.rects[2], WIDTH / 2.2, WIDTH / 2.2);
   \hyperlink{group__Evas__Font__Group_ga02da8091bbac768b8e86c7b74b2a94f9}{evas\_object\_move}(d.rects[2], WIDTH / 6, WIDTH / 4.5);
   \hyperlink{group__Evas__Object__Group__Basic_ga9cbc13661584e49fb9d9cdab514a1eeb}{evas\_object\_show}(d.rects[2]);
   \hyperlink{group__Evas__Object__Group__Events_ga23be30ac5cdfb780f1ff82e9108ec26b}{evas\_object\_event\_callback\_add}(
     d.rects[2], \hyperlink{group__Evas_ggad64cde0da38a60e7cb7905b3ab216968a9fa52651ccf7e47cd3b7785fc4cf393f}{EVAS\_CALLBACK\_MOUSE\_DOWN}, \_on\_mouse\_down, NULL);

   d.rects[1] = \hyperlink{group__Evas__Object__Rectangle_ga4d80fc32ad1cac28428cebd65d746751}{evas\_object\_rectangle\_add}(d.canvas);
   evas\_object\_name\_set(d.rects[1], \textcolor{stringliteral}{"green"});
   \hyperlink{group__Evas__Object__Group__Basic_gae34bdcfd7f5100151f6ea8ef4a392949}{evas\_object\_color\_set}(d.rects[1], 0, 255, 0, 255);

   \hyperlink{group__Evas__Font__Group_ga21e8604c0e4a93e469bff4bd069e82b5}{evas\_object\_resize}(d.rects[1], WIDTH / 2.2, WIDTH / 2.2);
   \hyperlink{group__Evas__Font__Group_ga02da8091bbac768b8e86c7b74b2a94f9}{evas\_object\_move}(d.rects[1], WIDTH / 2.5, WIDTH / 7);
   \hyperlink{group__Evas__Object__Group__Basic_ga9cbc13661584e49fb9d9cdab514a1eeb}{evas\_object\_show}(d.rects[1]);
   \hyperlink{group__Evas__Object__Group__Events_ga23be30ac5cdfb780f1ff82e9108ec26b}{evas\_object\_event\_callback\_add}(
     d.rects[1], \hyperlink{group__Evas_ggad64cde0da38a60e7cb7905b3ab216968a9fa52651ccf7e47cd3b7785fc4cf393f}{EVAS\_CALLBACK\_MOUSE\_DOWN}, \_on\_mouse\_down, NULL);

   d.rects[0] = \hyperlink{group__Evas__Object__Rectangle_ga4d80fc32ad1cac28428cebd65d746751}{evas\_object\_rectangle\_add}(d.canvas);
   evas\_object\_name\_set(d.rects[0], \textcolor{stringliteral}{"red"});
   \hyperlink{group__Evas__Object__Group__Basic_gae34bdcfd7f5100151f6ea8ef4a392949}{evas\_object\_color\_set}(d.rects[0], 255, 0, 0, 255);

   \hyperlink{group__Evas__Font__Group_ga21e8604c0e4a93e469bff4bd069e82b5}{evas\_object\_resize}(d.rects[0], WIDTH / 2.2, WIDTH / 2.2);
   \hyperlink{group__Evas__Font__Group_ga02da8091bbac768b8e86c7b74b2a94f9}{evas\_object\_move}(d.rects[0], WIDTH / 3, WIDTH / 2.5);
   \hyperlink{group__Evas__Object__Group__Basic_ga9cbc13661584e49fb9d9cdab514a1eeb}{evas\_object\_show}(d.rects[0]);

\end{DoxyCodeInclude}
  Like in other Evas examples, one interacts with it by means of key commands\+: 
\begin{DoxyCodeInclude}
\textcolor{keyword}{static} \textcolor{keyword}{const} \textcolor{keywordtype}{char} *commands = \(\backslash\)
  \textcolor{stringliteral}{"commands are:\(\backslash\)n"}
  \textcolor{stringliteral}{"\(\backslash\)tc - change the target rectangle to operate on\(\backslash\)n"}
  \textcolor{stringliteral}{"\(\backslash\)ta - stack target rectangle one level above\(\backslash\)n"}
  \textcolor{stringliteral}{"\(\backslash\)tb - stack target rectangle one level below\(\backslash\)n"}
  \textcolor{stringliteral}{"\(\backslash\)tt - stack target rectangle up to the top of its layer\(\backslash\)n"}
  \textcolor{stringliteral}{"\(\backslash\)tm - stack target rectangle down to the bottom of its layer\(\backslash\)n"}
  \textcolor{stringliteral}{"\(\backslash\)tp - toggle target rectangle's 'pass events' property\(\backslash\)n"}
  \textcolor{stringliteral}{"\(\backslash\)tr - toggle target rectangle's 'repeat events' property\(\backslash\)n"}
  \textcolor{stringliteral}{"\(\backslash\)ts - print current stacking information\(\backslash\)n"}
  \textcolor{stringliteral}{"\(\backslash\)tl - change background rectangle's layer\(\backslash\)n"}
  \textcolor{stringliteral}{"\(\backslash\)th - print help\(\backslash\)n"};

\end{DoxyCodeInclude}
 At any given point, like seem above, you\textquotesingle{}ll be operating one rectangle only. You may stacking it below an adjacent object with \char`\"{}b\char`\"{}\+: 
\begin{DoxyCodeInclude}
        \hyperlink{group__Evas__Font__Group_ga7992ced202dfd19c30e1f091d4d65962}{evas\_object\_stack\_below}(d.rects[d.cur\_rect], neighbour);

\end{DoxyCodeInclude}
  \char`\"{}a\char`\"{} will do the opposite\+: 
\begin{DoxyCodeInclude}
        \hyperlink{group__Evas__Font__Group_ga27584456485bb95792568ddc2a40f55a}{evas\_object\_stack\_above}(d.rects[d.cur\_rect], neighbour);

\end{DoxyCodeInclude}
 To bring it directly to the top/bottom, use \char`\"{}t\char`\"{}/\char`\"{}m\char`\"{}, respectively\+:  
\begin{DoxyCodeInclude}
        \hyperlink{group__Evas__Font__Group_gaca357b370a30d9b4bda0f22fba9b6c07}{evas\_object\_raise}(d.rects[d.cur\_rect]);
        \hyperlink{group__Evas__Font__Group_gabb0d855ef59a0d3ce758942dd3cdbbcd}{evas\_object\_lower}(d.rects[d.cur\_rect]);

\end{DoxyCodeInclude}
 At any time, use the \char`\"{}s\char`\"{} command to see the status of the ordering. It will show the background\textquotesingle{}s ordering too. Note that it also shows the {\bfseries layer} for this object. It starts at a {\bfseries different} layer than the others. Use \char`\"{}l\char`\"{} to change its layer (higher layer numbers mean higher layers). If the background is on the same layer as the others (0), you\textquotesingle{}ll see it interact with them on the ordering. If it\textquotesingle{}s in the layer above, no matter what you do, you\textquotesingle{}ll see nothing but the white rectangle\+: it covers the other layers. For the initial layer (-\/1), it will never mess nor occlude the others.

Let\textquotesingle{}s make some tests with those commands. The rectangle which starts selected and which will receive our commands is the {\bfseries red} one. It starts stacked above all the others, like seem above\+:

  
\begin{DoxyImageNoCaption}
  \mbox{\includegraphics[width=\textwidth,height=\textheight/2,keepaspectratio=true]{evas-stacking-example-00}}
\end{DoxyImageNoCaption}


Stack it one level below, with \textquotesingle{}b\textquotesingle{}, and you\textquotesingle{}ll get\+:

  
\begin{DoxyImageNoCaption}
  \mbox{\includegraphics[width=\textwidth,height=\textheight/2,keepaspectratio=true]{evas-stacking-example-01}}
\end{DoxyImageNoCaption}
 Note how the rectangle which laid above it, the green one, is now on top of it. Now change the rectangle to operate on to the blue one, with two consecutive \textquotesingle{}c\textquotesingle{} commands. Note that it\textquotesingle{}s the lowest one on the stack of rectangles. Issue the \textquotesingle{}a\textquotesingle{} command for it, thus re-\/stacking it one level above\+:

  
\begin{DoxyImageNoCaption}
  \mbox{\includegraphics[width=\textwidth,height=\textheight/2,keepaspectratio=true]{evas-stacking-example-02}}
\end{DoxyImageNoCaption}
 You can send it to the top of its layer directly with the \textquotesingle{}t\textquotesingle{} command\+:

  
\begin{DoxyImageNoCaption}
  \mbox{\includegraphics[width=\textwidth,height=\textheight/2,keepaspectratio=true]{evas-stacking-example-03}}
\end{DoxyImageNoCaption}
 Now put it back to the bottom of that layer with \textquotesingle{}m\textquotesingle{}\+:

  
\begin{DoxyImageNoCaption}
  \mbox{\includegraphics[width=\textwidth,height=\textheight/2,keepaspectratio=true]{evas-stacking-example-04}}
\end{DoxyImageNoCaption}
 Like said above, we have two layers used at the beginning of the example\+: the default one (0) and the one immediately below it (-\/1), for the white background. Let\textquotesingle{}s change this setup by issuing the \textquotesingle{}l\textquotesingle{} command, which will change the background\textquotesingle{}s layer to 1, i.\+e., a layer {\bfseries above} the one holding the other rectangles\+:

  
\begin{DoxyImageNoCaption}
  \mbox{\includegraphics[width=\textwidth,height=\textheight/2,keepaspectratio=true]{evas-stacking-example-05}}
\end{DoxyImageNoCaption}
 See how it now covers everything else. Press \textquotesingle{}l\textquotesingle{} again, taking it now to layer 0. It\textquotesingle{}s still covering everything because it lands the layer as the highest one on the objects stack. As we have the blue rectangle as the one receiving stacking commands, hit \textquotesingle{}t\textquotesingle{} and you\textquotesingle{}ll see it again\+:

  
\begin{DoxyImageNoCaption}
  \mbox{\includegraphics[width=\textwidth,height=\textheight/2,keepaspectratio=true]{evas-stacking-example-06}}
\end{DoxyImageNoCaption}
 By bringing the background back to layer -\/1 (\textquotesingle{}l\textquotesingle{}), you\textquotesingle{}ll get\+:

  
\begin{DoxyImageNoCaption}
  \mbox{\includegraphics[width=\textwidth,height=\textheight/2,keepaspectratio=true]{evas-stacking-example-07}}
\end{DoxyImageNoCaption}


The last two commands available are \char`\"{}p\char`\"{} and \char`\"{}r\char`\"{}, which will make the target rectangle to {\bfseries pass} (ignore) and {\bfseries repeat} the mouse events occurring on it (the commands will cycle through on and off states). This is demonstrated with the following \hyperlink{group__Evas_ggad64cde0da38a60e7cb7905b3ab216968a9fa52651ccf7e47cd3b7785fc4cf393f}{E\+V\+A\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+M\+O\+U\+S\+E\+\_\+\+D\+O\+W\+N} callback, registered on each of the colored rectangles\+:  
\begin{DoxyCodeInclude}
\textcolor{keyword}{static} \textcolor{keywordtype}{void}
\_on\_mouse\_down(\textcolor{keywordtype}{void}        *data EINA\_UNUSED,
               \hyperlink{group__Evas__Canvas_ga5ff87cc4ce6bc43e3b640a6d37f73043}{Evas}        *evas EINA\_UNUSED,
               \hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object} *o,
               \textcolor{keywordtype}{void}        *einfo EINA\_UNUSED)
\{
   fprintf(stdout, \textcolor{stringliteral}{"Mouse down on rectangle %s!\(\backslash\)n"}, \_name\_get(o));
\}

\end{DoxyCodeInclude}
 Try to change these properties on the three rectangles while experimenting with mouse clicks on their intersection region.

The full example follows.


\begin{DoxyCodeInclude}

\textcolor{preprocessor}{#ifdef HAVE\_CONFIG\_H}
\textcolor{preprocessor}{#include "config.h"}
\textcolor{preprocessor}{#else}
\textcolor{preprocessor}{#define PACKAGE\_EXAMPLES\_DIR "."}
\textcolor{preprocessor}{#endif}

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

\textcolor{preprocessor}{#include <stdlib.h>}
\textcolor{preprocessor}{#include <stdio.h>}
\textcolor{preprocessor}{#include <string.h>}

\textcolor{preprocessor}{#define WIDTH  320}
\textcolor{preprocessor}{#define HEIGHT 320}

\textcolor{keyword}{struct }test\_data
\{
   Ecore\_Evas  *ee;
   \hyperlink{group__Evas__Canvas_ga5ff87cc4ce6bc43e3b640a6d37f73043}{Evas}        *canvas;
   \hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object} *bg;
   \hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object} *rects[3]; \textcolor{comment}{/* red, green, blue */}
   \textcolor{keywordtype}{int}          layers[3]; \textcolor{comment}{/* default, below it, above it */}
   \textcolor{keywordtype}{int}          cur\_rect, cur\_layer;
\};

\textcolor{keyword}{static} \textcolor{keyword}{struct }test\_data d = \{0\};

\textcolor{keyword}{static} \textcolor{keyword}{const} \textcolor{keywordtype}{char} *commands = \(\backslash\)
  \textcolor{stringliteral}{"commands are:\(\backslash\)n"}
  \textcolor{stringliteral}{"\(\backslash\)tc - change the target rectangle to operate on\(\backslash\)n"}
  \textcolor{stringliteral}{"\(\backslash\)ta - stack target rectangle one level above\(\backslash\)n"}
  \textcolor{stringliteral}{"\(\backslash\)tb - stack target rectangle one level below\(\backslash\)n"}
  \textcolor{stringliteral}{"\(\backslash\)tt - stack target rectangle up to the top of its layer\(\backslash\)n"}
  \textcolor{stringliteral}{"\(\backslash\)tm - stack target rectangle down to the bottom of its layer\(\backslash\)n"}
  \textcolor{stringliteral}{"\(\backslash\)tp - toggle target rectangle's 'pass events' property\(\backslash\)n"}
  \textcolor{stringliteral}{"\(\backslash\)tr - toggle target rectangle's 'repeat events' property\(\backslash\)n"}
  \textcolor{stringliteral}{"\(\backslash\)ts - print current stacking information\(\backslash\)n"}
  \textcolor{stringliteral}{"\(\backslash\)tl - change background rectangle's layer\(\backslash\)n"}
  \textcolor{stringliteral}{"\(\backslash\)th - print help\(\backslash\)n"};

\textcolor{keyword}{static} \textcolor{keyword}{const} \textcolor{keywordtype}{char} *
\_name\_get(\hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object} *o)
\{
   \textcolor{keyword}{const} \textcolor{keywordtype}{char} *s = evas\_object\_name\_get(o);
   \textcolor{keywordflow}{if} (!s) s = \textcolor{stringliteral}{"(null)"};
   \textcolor{keywordflow}{return} s;
\}

\textcolor{keyword}{static} \textcolor{keywordtype}{void}
\_on\_mouse\_down(\textcolor{keywordtype}{void}        *data EINA\_UNUSED,
               \hyperlink{group__Evas__Canvas_ga5ff87cc4ce6bc43e3b640a6d37f73043}{Evas}        *evas EINA\_UNUSED,
               \hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object} *o,
               \textcolor{keywordtype}{void}        *einfo EINA\_UNUSED)
\{
   fprintf(stdout, \textcolor{stringliteral}{"Mouse down on rectangle %s!\(\backslash\)n"}, \_name\_get(o));
\}

\textcolor{comment}{/* here just to keep our example's window size and background image's}
\textcolor{comment}{ * size in synchrony */}
\textcolor{keyword}{static} \textcolor{keywordtype}{void}
\_canvas\_resize\_cb(Ecore\_Evas *ee)
\{
   \textcolor{keywordtype}{int} w, h;

   \hyperlink{group__Ecore__Evas__Group_ga931aadf4603731e73e8a84e4b14f1493}{ecore\_evas\_geometry\_get}(ee, NULL, NULL, &w, &h);
   \hyperlink{group__Evas__Font__Group_ga21e8604c0e4a93e469bff4bd069e82b5}{evas\_object\_resize}(d.bg, w, h);
\}

\textcolor{comment}{/* use the following commands to interact with this example - 'h' is}
\textcolor{comment}{ * the key for help */}
\textcolor{keyword}{static} \textcolor{keywordtype}{void}
\_on\_keydown(\textcolor{keywordtype}{void}        *data EINA\_UNUSED,
            \hyperlink{group__Evas__Canvas_ga5ff87cc4ce6bc43e3b640a6d37f73043}{Evas}        *evas EINA\_UNUSED,
            \hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object} *o EINA\_UNUSED,
            \textcolor{keywordtype}{void}        *einfo)
\{
   \hyperlink{struct__Evas__Event__Key__Down}{Evas\_Event\_Key\_Down} *ev = einfo;
   \textcolor{keyword}{const} \textcolor{keywordtype}{char} *name = \_name\_get(d.rects[d.cur\_rect]);

   \textcolor{keywordflow}{if} (strcmp(ev->\hyperlink{struct__Evas__Event__Key__Down_a70473bba88a1afaee180a54150513824}{key}, \textcolor{stringliteral}{"h"}) == 0)  \textcolor{comment}{/* print help */}
     \{
        fprintf(stdout, commands);
        \textcolor{keywordflow}{return};
     \}

   \textcolor{keywordflow}{if} (strcmp(ev->\hyperlink{struct__Evas__Event__Key__Down_a70473bba88a1afaee180a54150513824}{key}, \textcolor{stringliteral}{"s"}) == 0)  \textcolor{comment}{/* get status of the}
\textcolor{comment}{                                        * rectangles WRT size}
\textcolor{comment}{                                        * hints */}
     \{
        \hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object} *rect;

        fprintf(stdout, \textcolor{stringliteral}{"Order of stacking, from top to bottom, is: "});

        rect = \hyperlink{group__Evas__Canvas_ga679c70a3110b85541dc7e1fdeb930ecc}{evas\_object\_top\_get}(evas);
        fprintf(stdout, \textcolor{stringliteral}{"%s"}, \_name\_get(rect));

        rect = \hyperlink{group__Evas__Font__Group_gab310745ce8838bd916626d17dd9396b8}{evas\_object\_below\_get}(rect);
        \textcolor{keywordflow}{while} (rect)
          \{
             fprintf(stdout, \textcolor{stringliteral}{", %s"}, \_name\_get(rect));
             rect = \hyperlink{group__Evas__Font__Group_gab310745ce8838bd916626d17dd9396b8}{evas\_object\_below\_get}(rect);
          \}

        fprintf(stdout, \textcolor{stringliteral}{".\(\backslash\)n"});

        fprintf(stdout, \textcolor{stringliteral}{"Current target rectangle is %s\(\backslash\)n"},
                \_name\_get(d.rects[d.cur\_rect]));

        fprintf(stdout, \textcolor{stringliteral}{"Background rectangle's layer is %d\(\backslash\)n"},
                \hyperlink{group__Evas__Font__Group_ga980ffcac11891e60249b0cd0f6fdada4}{evas\_object\_layer\_get}(d.bg));

        \textcolor{keywordflow}{return};
     \}

   \textcolor{keywordflow}{if} (strcmp(ev->\hyperlink{struct__Evas__Event__Key__Down_a70473bba88a1afaee180a54150513824}{key}, \textcolor{stringliteral}{"l"}) == 0)  \textcolor{comment}{/* change background rectangle's layer */}
     \{
        d.cur\_layer = (d.cur\_layer + 1) % 3;
        \hyperlink{group__Evas__Font__Group_gac04277bfd84a7201ba329328a18e21fd}{evas\_object\_layer\_set}(d.bg, d.layers[d.cur\_layer]);

        fprintf(stdout, \textcolor{stringliteral}{"Changing background rectangle's layer to %d\(\backslash\)n"},
                d.layers[d.cur\_layer]);
        \textcolor{keywordflow}{return};
     \}

   \textcolor{keywordflow}{if} (strcmp(ev->\hyperlink{struct__Evas__Event__Key__Down_a70473bba88a1afaee180a54150513824}{key}, \textcolor{stringliteral}{"c"}) == 0)  \textcolor{comment}{/* change rectangle to operate on */}
     \{
        d.cur\_rect = (d.cur\_rect + 1) % 3;

        fprintf(stdout, \textcolor{stringliteral}{"Changing target rectangle to the %s one\(\backslash\)n"},
                \_name\_get(d.rects[d.cur\_rect]));
        \textcolor{keywordflow}{return};
     \}

   \textcolor{keywordflow}{if} (strcmp(ev->\hyperlink{struct__Evas__Event__Key__Down_a70473bba88a1afaee180a54150513824}{key}, \textcolor{stringliteral}{"t"}) == 0)  \textcolor{comment}{/* bring target to top */}
     \{
        \hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object} *neighbour;

        \hyperlink{group__Evas__Font__Group_gaca357b370a30d9b4bda0f22fba9b6c07}{evas\_object\_raise}(d.rects[d.cur\_rect]);

        fprintf(stdout, \textcolor{stringliteral}{"%s rectangle was re-stacked to the top if its layer\(\backslash\)n"},
                name);

        neighbour = \hyperlink{group__Evas__Font__Group_gab310745ce8838bd916626d17dd9396b8}{evas\_object\_below\_get}(d.rects[d.cur\_rect]);
        fprintf(stdout, \textcolor{stringliteral}{"Below of %s rect is %s\(\backslash\)n"}, name,
                neighbour ? \_name\_get(neighbour) : \textcolor{stringliteral}{"no object"});
        \textcolor{keywordflow}{return};
     \}

   \textcolor{keywordflow}{if} (strcmp(ev->\hyperlink{struct__Evas__Event__Key__Down_a70473bba88a1afaee180a54150513824}{key}, \textcolor{stringliteral}{"m"}) == 0)  \textcolor{comment}{/* bring target to bottom */}
     \{
        \hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object} *neighbour;

        \hyperlink{group__Evas__Font__Group_gabb0d855ef59a0d3ce758942dd3cdbbcd}{evas\_object\_lower}(d.rects[d.cur\_rect]);

        fprintf(stdout,
                \textcolor{stringliteral}{"%s rectangle was re-stacked to the bottom if its layer\(\backslash\)n"},
                name);

        neighbour = \hyperlink{group__Evas__Font__Group_gab310745ce8838bd916626d17dd9396b8}{evas\_object\_below\_get}(d.rects[d.cur\_rect]);
        fprintf(stdout, \textcolor{stringliteral}{"Below of %s rect is %s\(\backslash\)n"}, name,
                neighbour ? \_name\_get(neighbour) : \textcolor{stringliteral}{"no object"});
        \textcolor{keywordflow}{return};
     \}

   \textcolor{keywordflow}{if} (strcmp(ev->\hyperlink{struct__Evas__Event__Key__Down_a70473bba88a1afaee180a54150513824}{key}, \textcolor{stringliteral}{"p"}) == 0)  \textcolor{comment}{/* toggle pass events */}
     \{
        \hyperlink{group__Eina__Types__Group_ga3fe0caf72e93b1bab1ca8ee3ccf3f226}{Eina\_Bool} pass = evas\_object\_pass\_events\_get(d.rects[d.cur\_rect]);

        evas\_object\_pass\_events\_set(d.rects[d.cur\_rect], !pass);

        fprintf(stdout, \textcolor{stringliteral}{"%s rectangle is now set to%s pass (ignore) events\(\backslash\)n"},
                name, pass ? \textcolor{stringliteral}{" NOT"} : \textcolor{stringliteral}{""});

        \textcolor{keywordflow}{return};
     \}

   \textcolor{keywordflow}{if} (strcmp(ev->\hyperlink{struct__Evas__Event__Key__Down_a70473bba88a1afaee180a54150513824}{key}, \textcolor{stringliteral}{"r"}) == 0)  \textcolor{comment}{/* toggle repeat events */}
     \{
        \hyperlink{group__Eina__Types__Group_ga3fe0caf72e93b1bab1ca8ee3ccf3f226}{Eina\_Bool} repeat = evas\_object\_repeat\_events\_get(d.rects[d.cur\_rect]);

        evas\_object\_repeat\_events\_set(d.rects[d.cur\_rect], !repeat);

        fprintf(stdout, \textcolor{stringliteral}{"%s rectangle is now set to%s repeat events\(\backslash\)n"},
                name, repeat ? \textcolor{stringliteral}{" NOT"} : \textcolor{stringliteral}{""});

        \textcolor{keywordflow}{return};
     \}

   \textcolor{keywordflow}{if} (strcmp(ev->\hyperlink{struct__Evas__Event__Key__Down_a70473bba88a1afaee180a54150513824}{key}, \textcolor{stringliteral}{"a"}) == 0)  \textcolor{comment}{/* stack target above */}
     \{
        \hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object} *neighbour = \hyperlink{group__Evas__Font__Group_gabf63d12bfc70a0e2d4242eed3975021e}{evas\_object\_above\_get}(d.rects[d.cur\_rect])
      ;

        \textcolor{keywordflow}{if} (!neighbour || (\hyperlink{group__Evas__Font__Group_ga980ffcac11891e60249b0cd0f6fdada4}{evas\_object\_layer\_get}(d.rects[d.cur\_rect]) !=
                           \hyperlink{group__Evas__Font__Group_ga980ffcac11891e60249b0cd0f6fdada4}{evas\_object\_layer\_get}(neighbour)))
          \textcolor{keywordflow}{return};

        \hyperlink{group__Evas__Font__Group_ga27584456485bb95792568ddc2a40f55a}{evas\_object\_stack\_above}(d.rects[d.cur\_rect], neighbour);

        fprintf(stdout, \textcolor{stringliteral}{"%s rectangle was re-stacked one level above\(\backslash\)n"}, name);

        neighbour = \hyperlink{group__Evas__Font__Group_gabf63d12bfc70a0e2d4242eed3975021e}{evas\_object\_above\_get}(d.rects[d.cur\_rect]);
        fprintf(stdout, \textcolor{stringliteral}{"Above of %s rect is %s\(\backslash\)n"}, name,
                neighbour ? \_name\_get(neighbour) : \textcolor{stringliteral}{"no object"});

        neighbour = \hyperlink{group__Evas__Font__Group_gab310745ce8838bd916626d17dd9396b8}{evas\_object\_below\_get}(d.rects[d.cur\_rect]);
        fprintf(stdout, \textcolor{stringliteral}{"Below of %s rect is %s\(\backslash\)n"}, name,
                neighbour ? \_name\_get(neighbour) : \textcolor{stringliteral}{"no object"});
        \textcolor{keywordflow}{return};
     \}

   \textcolor{keywordflow}{if} (strcmp(ev->\hyperlink{struct__Evas__Event__Key__Down_a70473bba88a1afaee180a54150513824}{key}, \textcolor{stringliteral}{"b"}) == 0)  \textcolor{comment}{/* stack target below */}
     \{
        \hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object} *neighbour = \hyperlink{group__Evas__Font__Group_gab310745ce8838bd916626d17dd9396b8}{evas\_object\_below\_get}(d.rects[d.cur\_rect])
      ;

        \textcolor{keywordflow}{if} (!neighbour || (\hyperlink{group__Evas__Font__Group_ga980ffcac11891e60249b0cd0f6fdada4}{evas\_object\_layer\_get}(d.rects[d.cur\_rect]) !=
                           \hyperlink{group__Evas__Font__Group_ga980ffcac11891e60249b0cd0f6fdada4}{evas\_object\_layer\_get}(neighbour)))
          \textcolor{keywordflow}{return};

        \hyperlink{group__Evas__Font__Group_ga7992ced202dfd19c30e1f091d4d65962}{evas\_object\_stack\_below}(d.rects[d.cur\_rect], neighbour);

        fprintf(stdout, \textcolor{stringliteral}{"%s rectangle was re-stacked one level below\(\backslash\)n"}, name);

        neighbour = \hyperlink{group__Evas__Font__Group_gabf63d12bfc70a0e2d4242eed3975021e}{evas\_object\_above\_get}(d.rects[d.cur\_rect]);
        fprintf(stdout, \textcolor{stringliteral}{"Above of %s rect is %s\(\backslash\)n"}, name,
                neighbour ? \_name\_get(neighbour) : \textcolor{stringliteral}{"no object"});

        neighbour = \hyperlink{group__Evas__Font__Group_gab310745ce8838bd916626d17dd9396b8}{evas\_object\_below\_get}(d.rects[d.cur\_rect]);

        fprintf(stdout, \textcolor{stringliteral}{"Below of %s rect is %s\(\backslash\)n"}, name,
                neighbour ? \_name\_get(neighbour) : \textcolor{stringliteral}{"no object"});
        \textcolor{keywordflow}{return};
     \}
\}

\textcolor{keyword}{static} \textcolor{keywordtype}{void}
\_on\_destroy(Ecore\_Evas *ee EINA\_UNUSED)
\{
   \hyperlink{group__Ecore__Main__Loop__Group_ga95cf8e97dff0716433c2c5474d606a98}{ecore\_main\_loop\_quit}();
\}

\textcolor{keywordtype}{int}
main(\textcolor{keywordtype}{void})
\{
   \textcolor{keywordflow}{if} (!\hyperlink{group__Ecore__Evas__Group_ga32ddbb6457033ad435a177eb0c4fe235}{ecore\_evas\_init}())
     \textcolor{keywordflow}{return} EXIT\_FAILURE;

   \textcolor{comment}{/* this will give you a window with an Evas canvas under the first}
\textcolor{comment}{    * engine available */}
   d.ee = \hyperlink{group__Ecore__Evas__Group_gac7f2cdbcb79635c34317c1183dd04cb0}{ecore\_evas\_new}(NULL, 0, 0, WIDTH, HEIGHT, NULL);
   \textcolor{keywordflow}{if} (!d.ee)
     \textcolor{keywordflow}{goto} error;

   \hyperlink{group__Ecore__Evas__Group_ga3680b5c89157167318192157a5d24ec4}{ecore\_evas\_callback\_destroy\_set}(d.ee, \_on\_destroy);
   \hyperlink{group__Ecore__Evas__Group_gaac67f679c9027059a34519fbdea360df}{ecore\_evas\_callback\_resize\_set}(d.ee, \_canvas\_resize\_cb);
   \hyperlink{group__Ecore__Evas__Group_ga4953047ff97d4f1b0d75a7d513d4f317}{ecore\_evas\_show}(d.ee);

   \textcolor{comment}{/* the canvas pointer, de facto */}
   d.canvas = \hyperlink{group__Ecore__Evas__Group_ga75a7cc694b6069e78df47dab0b0f2d20}{ecore\_evas\_get}(d.ee);

   d.bg = \hyperlink{group__Evas__Object__Rectangle_ga4d80fc32ad1cac28428cebd65d746751}{evas\_object\_rectangle\_add}(d.canvas);
   evas\_object\_name\_set(d.bg, \textcolor{stringliteral}{"background"});  \textcolor{comment}{/* white bg */}
   \hyperlink{group__Evas__Object__Group__Basic_gae34bdcfd7f5100151f6ea8ef4a392949}{evas\_object\_color\_set}(d.bg, 255, 255, 255, 255);
   \hyperlink{group__Evas__Font__Group_ga02da8091bbac768b8e86c7b74b2a94f9}{evas\_object\_move}(d.bg, 0, 0);
   \hyperlink{group__Evas__Font__Group_ga21e8604c0e4a93e469bff4bd069e82b5}{evas\_object\_resize}(d.bg, WIDTH, HEIGHT);

   d.layers[0] = \hyperlink{group__Evas__Font__Group_ga980ffcac11891e60249b0cd0f6fdada4}{evas\_object\_layer\_get}(d.bg);
   d.layers[1] = d.layers[0] - 1;
   d.layers[2] = d.layers[0] + 1;

   d.cur\_layer = 1;
   \hyperlink{group__Evas__Font__Group_gac04277bfd84a7201ba329328a18e21fd}{evas\_object\_layer\_set}(d.bg, d.layers[d.cur\_layer]);  \textcolor{comment}{/* let's start with it}
\textcolor{comment}{                                                         * below the default}
\textcolor{comment}{                                                         * layer */}

   \hyperlink{group__Evas__Object__Group__Basic_ga9cbc13661584e49fb9d9cdab514a1eeb}{evas\_object\_show}(d.bg);

   evas\_object\_focus\_set(d.bg, \hyperlink{group__Eina__Types__Group_ga05c12dacc8b4058994df842b41be85fc}{EINA\_TRUE});
   \hyperlink{group__Evas__Object__Group__Events_ga23be30ac5cdfb780f1ff82e9108ec26b}{evas\_object\_event\_callback\_add}(
     d.bg, \hyperlink{group__Evas_ggad64cde0da38a60e7cb7905b3ab216968a336b86bad4f145f84c155e4922335584}{EVAS\_CALLBACK\_KEY\_DOWN}, \_on\_keydown, NULL);

   d.rects[2] = \hyperlink{group__Evas__Object__Rectangle_ga4d80fc32ad1cac28428cebd65d746751}{evas\_object\_rectangle\_add}(d.canvas);
   evas\_object\_name\_set(d.rects[2], \textcolor{stringliteral}{"blue"});
   \hyperlink{group__Evas__Object__Group__Basic_gae34bdcfd7f5100151f6ea8ef4a392949}{evas\_object\_color\_set}(d.rects[2], 0, 0, 255, 255);

   \hyperlink{group__Evas__Font__Group_ga21e8604c0e4a93e469bff4bd069e82b5}{evas\_object\_resize}(d.rects[2], WIDTH / 2.2, WIDTH / 2.2);
   \hyperlink{group__Evas__Font__Group_ga02da8091bbac768b8e86c7b74b2a94f9}{evas\_object\_move}(d.rects[2], WIDTH / 6, WIDTH / 4.5);
   \hyperlink{group__Evas__Object__Group__Basic_ga9cbc13661584e49fb9d9cdab514a1eeb}{evas\_object\_show}(d.rects[2]);
   \hyperlink{group__Evas__Object__Group__Events_ga23be30ac5cdfb780f1ff82e9108ec26b}{evas\_object\_event\_callback\_add}(
     d.rects[2], \hyperlink{group__Evas_ggad64cde0da38a60e7cb7905b3ab216968a9fa52651ccf7e47cd3b7785fc4cf393f}{EVAS\_CALLBACK\_MOUSE\_DOWN}, \_on\_mouse\_down, NULL);

   d.rects[1] = \hyperlink{group__Evas__Object__Rectangle_ga4d80fc32ad1cac28428cebd65d746751}{evas\_object\_rectangle\_add}(d.canvas);
   evas\_object\_name\_set(d.rects[1], \textcolor{stringliteral}{"green"});
   \hyperlink{group__Evas__Object__Group__Basic_gae34bdcfd7f5100151f6ea8ef4a392949}{evas\_object\_color\_set}(d.rects[1], 0, 255, 0, 255);

   \hyperlink{group__Evas__Font__Group_ga21e8604c0e4a93e469bff4bd069e82b5}{evas\_object\_resize}(d.rects[1], WIDTH / 2.2, WIDTH / 2.2);
   \hyperlink{group__Evas__Font__Group_ga02da8091bbac768b8e86c7b74b2a94f9}{evas\_object\_move}(d.rects[1], WIDTH / 2.5, WIDTH / 7);
   \hyperlink{group__Evas__Object__Group__Basic_ga9cbc13661584e49fb9d9cdab514a1eeb}{evas\_object\_show}(d.rects[1]);
   \hyperlink{group__Evas__Object__Group__Events_ga23be30ac5cdfb780f1ff82e9108ec26b}{evas\_object\_event\_callback\_add}(
     d.rects[1], \hyperlink{group__Evas_ggad64cde0da38a60e7cb7905b3ab216968a9fa52651ccf7e47cd3b7785fc4cf393f}{EVAS\_CALLBACK\_MOUSE\_DOWN}, \_on\_mouse\_down, NULL);

   d.rects[0] = \hyperlink{group__Evas__Object__Rectangle_ga4d80fc32ad1cac28428cebd65d746751}{evas\_object\_rectangle\_add}(d.canvas);
   evas\_object\_name\_set(d.rects[0], \textcolor{stringliteral}{"red"});
   \hyperlink{group__Evas__Object__Group__Basic_gae34bdcfd7f5100151f6ea8ef4a392949}{evas\_object\_color\_set}(d.rects[0], 255, 0, 0, 255);

   \hyperlink{group__Evas__Font__Group_ga21e8604c0e4a93e469bff4bd069e82b5}{evas\_object\_resize}(d.rects[0], WIDTH / 2.2, WIDTH / 2.2);
   \hyperlink{group__Evas__Font__Group_ga02da8091bbac768b8e86c7b74b2a94f9}{evas\_object\_move}(d.rects[0], WIDTH / 3, WIDTH / 2.5);
   \hyperlink{group__Evas__Object__Group__Basic_ga9cbc13661584e49fb9d9cdab514a1eeb}{evas\_object\_show}(d.rects[0]);
   \hyperlink{group__Evas__Object__Group__Events_ga23be30ac5cdfb780f1ff82e9108ec26b}{evas\_object\_event\_callback\_add}(
     d.rects[0], \hyperlink{group__Evas_ggad64cde0da38a60e7cb7905b3ab216968a9fa52651ccf7e47cd3b7785fc4cf393f}{EVAS\_CALLBACK\_MOUSE\_DOWN}, \_on\_mouse\_down, NULL);

   fprintf(stdout, commands);
   \hyperlink{group__Ecore__Main__Loop__Group_gaf103b9f668bb3e4fed12e52c6180132d}{ecore\_main\_loop\_begin}();

   \hyperlink{group__Ecore__Evas__Group_gab8fa311077f749190c9b622f672b2214}{ecore\_evas\_shutdown}();
   \textcolor{keywordflow}{return} 0;

error:
   fprintf(stderr, \textcolor{stringliteral}{"you got to have at least one evas engine built and linked"}
                   \textcolor{stringliteral}{" up to ecore-evas for this example to run properly.\(\backslash\)n"});
   \textcolor{keywordflow}{return} -1;
\}
\end{DoxyCodeInclude}
 