

In this example, we illustrate how to create and handle Evas smart objects.

A smart object is one that provides custom functions to handle clipping, hiding, moving, resizing, color setting and more on {\bfseries child} elements, automatically, for the smart object's user. They could be as simple as a group of objects that move together (see \hyperlink{group__Evas__Smart__Object__Clipped}{Clipped Smart Object}) or implementations of whole complex U\+I widgets, providing some intelligence (thus the name) and extension to simple Evas objects.

Here, we create one as an example. What it does is to control (at maximum) 2 child objects, with regard to their geometries and colors. There can be a \char`\"{}left\char`\"{} child and a \char`\"{}right\char`\"{} one. The former will always occupy the top left quadrant of the smart object's area, while the latter will occupy the bottom right. The smart object will also contain an {\bfseries internal} decorative border object, which will also be controlled by it, naturally.

Here is where we add it to the canvas\+: 
\begin{DoxyCodeInclude}
   d.smt = evas\_smart\_example\_add(d.evas);
   evas\_object\_move(d.smt, WIDTH / 4, HEIGHT / 4);
   evas\_object\_resize(d.smt, WIDTH / 2, HEIGHT / 2);
   \hyperlink{group__Evas__Object__Group__Basic_ga9cbc13661584e49fb9d9cdab514a1eeb}{evas\_object\_show}(d.smt);

\end{DoxyCodeInclude}


The magic starts to happen in the {\ttfamily evas\+\_\+smart\+\_\+example\+\_\+add()} function, which is one in the example smart object's defined {\bfseries interface}. These should be the functions you would export to the users of your smart object. We made three for this one\+:
\begin{DoxyItemize}
\item {\ttfamily evas\+\_\+smart\+\_\+example\+\_\+add()}\+: add a new instance of the example smart object to a canvas
\item {\ttfamily evas\+\_\+smart\+\_\+example\+\_\+remove()}\+: remove a given child of the smart object from it
\item {\ttfamily evas\+\_\+smart\+\_\+example\+\_\+set\+\_\+left()}\+: set the left child of the smart object
\item {\ttfamily evas\+\_\+smart\+\_\+example\+\_\+set\+\_\+right()}\+: set the right child of the smart object
\end{DoxyItemize}

The object's creation takes place as\+:  
\begin{DoxyCodeInclude}
\textcolor{comment}{/* add a new example smart object to a canvas */}
\hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object} *
evas\_smart\_example\_add(\hyperlink{group__Evas__Canvas_ga5ff87cc4ce6bc43e3b640a6d37f73043}{Evas} *evas)
\{
   \textcolor{keywordflow}{return} \hyperlink{group__Evas__Smart__Object__Group_gad80de73a33446f902d4b39141a8d0a05}{evas\_object\_smart\_add}(evas, \_evas\_smart\_example\_smart\_class\_new());
\}

\end{DoxyCodeInclude}


Smart objects are defined by {\bfseries smart classes}, which are structs defining their interfaces, or {\bfseries smart functions} (see \hyperlink{group__Evas__Smart__Group_gaea15f67e901bf5380cdb67dc1bb43391}{Evas\+\_\+\+Smart\+\_\+\+Class}, the base class for any smart object). As you see, one has to use the \hyperlink{group__Evas__Smart__Object__Group_gad80de73a33446f902d4b39141a8d0a05}{evas\+\_\+object\+\_\+smart\+\_\+add()} function to instantiate smart objects. Its second parameter is what matters -- an \hyperlink{Evas__Common_8h_a7cdfd1afece1cad64c413eb9a778ddbb}{Evas\+\_\+\+Smart} struct, which contains all the smart class definitions (smart functions, smart callbacks, and the like). Note, however, that {\ttfamily \+\_\+evas\+\_\+smart\+\_\+example\+\_\+smart\+\_\+class\+\_\+new()} seems not to be defined in our example's code. That's because it came from a very handy {\bfseries helper macro}\+:  
\begin{DoxyCodeInclude}
\hyperlink{group__Evas__Smart__Group_ga58dc94af6f064b39b2bf0155908fbe52}{EVAS\_SMART\_SUBCLASS\_NEW}(\_evas\_smart\_example\_type, \_evas\_smart\_example,
                        \hyperlink{struct__Evas__Smart__Class}{Evas\_Smart\_Class}, \hyperlink{struct__Evas__Smart__Class}{Evas\_Smart\_Class},
                        \hyperlink{group__Evas__Smart__Object__Clipped_gabbb2c85a3978e44404528a94be381dcd}{evas\_object\_smart\_clipped\_class\_get}, 
      \_smart\_callbacks);

\end{DoxyCodeInclude}
 What it does is to {\bfseries subclass} a given existing smart class, thus specializing it. This is very common and useful in Evas. There is a built-\/in smart object, the \char`\"{}clipped smart object\char`\"{}, which implements a behavior mostly desired by many other smart object implementors\+: it will clip its children to its area and move them along with it, on evas\+\_\+object\+\_\+move() calls. Then, our example smart object will get that behavior for free.

The first argument to the macro,  
\begin{DoxyCodeInclude}
\textcolor{preprocessor}{#define \_evas\_smart\_example\_type "Evas\_Smart\_Example"}

\end{DoxyCodeInclude}
 will define the new smart class' name. The second tells the macro what is the {\bfseries prefix} of the function it will be declaring with a {\ttfamily \+\_\+smart\+\_\+set\+\_\+user()} suffix. On this function, we may override/extend any desired method from our parent smart class\+:  
\begin{DoxyCodeInclude}
\textcolor{comment}{/* setting our smart interface */}
\textcolor{keyword}{static} \textcolor{keywordtype}{void}
\_evas\_smart\_example\_smart\_set\_user(\hyperlink{struct__Evas__Smart__Class}{Evas\_Smart\_Class} *sc)
\{
   \textcolor{comment}{/* specializing these two */}
   sc->\hyperlink{struct__Evas__Smart__Class_a53149c9c3c1eb86af742a2d89790d2c7}{add} = \_evas\_smart\_example\_smart\_add;
   sc->\hyperlink{struct__Evas__Smart__Class_a8a493473cd97a4e9284f5a33f0afe823}{del} = \_evas\_smart\_example\_smart\_del;

   \textcolor{comment}{/* clipped smart object has no hook on resizes or calculations */}
   sc->\hyperlink{struct__Evas__Smart__Class_a6b7ea5214710d6a1a8981e57469ac1aa}{resize} = \_evas\_smart\_example\_smart\_resize;
   sc->\hyperlink{struct__Evas__Smart__Class_af48b73a524d5fe75604ee104bca4e79a}{calculate} = \_evas\_smart\_example\_smart\_calculate;
\}

\end{DoxyCodeInclude}


The first function pointer's code will take place at an example smart object's {\bfseries creation} time\+:  
\begin{DoxyCodeInclude}
\textcolor{comment}{/* create and setup a new example smart object's internals */}
\textcolor{keyword}{static} \textcolor{keywordtype}{void}
\_evas\_smart\_example\_smart\_add(\hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object} *o)
\{
   \hyperlink{group__Evas__Smart__Group_ga4aa4b72aafa0391144fb0171aeff2ccd}{EVAS\_SMART\_DATA\_ALLOC}(o, Evas\_Smart\_Example\_Data);

   \textcolor{comment}{/* call parent\_sc->add() before member\_adding the children, otherwise the}
\textcolor{comment}{    * smart object's clipper won't be created yet, and the children won't be}
\textcolor{comment}{    * clipped to it */}
   \_evas\_smart\_example\_parent\_sc->add(o);

   \textcolor{comment}{/* this is a border around the smart object's area, delimiting it */}
   priv->border = \hyperlink{group__Evas__Object__Image_ga0e8cb83d31d02bf583c75925b7cd14d7}{evas\_object\_image\_filled\_add}(evas\_object\_evas\_get(o));
   \hyperlink{group__Evas__Object__Image_gac27fd0ceabe5f56607b7a86d71577df1}{evas\_object\_image\_file\_set}(priv->border, border\_img\_path, NULL);
   evas\_object\_image\_border\_set(priv->border, 3, 3, 3, 3);
   evas\_object\_image\_border\_center\_fill\_set(
     priv->border, \hyperlink{Evas__Common_8h_a4a05f0fd82f51c6b330e349457cdc7e2a2ad856ac6aab5e2659c3a584a37aec70}{EVAS\_BORDER\_FILL\_NONE});
   \hyperlink{group__Evas__Object__Group__Basic_ga9cbc13661584e49fb9d9cdab514a1eeb}{evas\_object\_show}(priv->border);
   \hyperlink{group__Evas__Smart__Object__Group_ga6845c17effe796430cb4fc5f2cfccef0}{evas\_object\_smart\_member\_add}(priv->border, o);
\}

\end{DoxyCodeInclude}


The \hyperlink{group__Evas__Smart__Group_ga4aa4b72aafa0391144fb0171aeff2ccd}{E\+V\+A\+S\+\_\+\+S\+M\+A\+R\+T\+\_\+\+D\+A\+T\+A\+\_\+\+A\+L\+L\+O\+C} macro will take care of allocating our smart object data, which will be available on other contexts for us (mainly in our interface functions)\+:  
\begin{DoxyCodeInclude}
\textcolor{keyword}{typedef} \textcolor{keyword}{struct }\_Evas\_Smart\_Example\_Data Evas\_Smart\_Example\_Data;
\textcolor{comment}{/*}
\textcolor{comment}{ * This structure augments clipped smart object's instance data,}
\textcolor{comment}{ * providing extra members required by our example smart object's}
\textcolor{comment}{ * implementation.}
\textcolor{comment}{ */}
\textcolor{keyword}{struct }\_Evas\_Smart\_Example\_Data
\{
   \hyperlink{struct__Evas__Object__Smart__Clipped__Data}{Evas\_Object\_Smart\_Clipped\_Data} base;
   \hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object}                   *children[2], *border;
   \textcolor{keywordtype}{int}                            child\_count;
\};

\end{DoxyCodeInclude}


See that, as we're inheriting from the clipped smart object's class, we {\bfseries must} have their data struct as our first member. Other data of interest for us is a child members array and the border object's handle. The latter is what is created in the last mentioned function. Note how to tell Evas the border will be managed by our smart object from that time on\+: {\ttfamily evas\+\_\+object\+\_\+smart\+\_\+member\+\_\+add(priv-\/$>$border, o);}. The counterpart of this function is exemplified on the smart object's interface function to remove children\+: 
\begin{DoxyCodeInclude}
\textcolor{comment}{/* remove a child element, return its pointer (or NULL on errors) */}
\hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object} *
evas\_smart\_example\_remove(\hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object} *o,
                          \hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object} *child)
\{
   \textcolor{keywordtype}{long} idx;

   EVAS\_SMART\_EXAMPLE\_DATA\_GET\_OR\_RETURN\_VAL(o, priv, NULL);

   \textcolor{keywordflow}{if} (priv->children[0] != child && priv->children[1] != child)
     \{
        fprintf(stderr, \textcolor{stringliteral}{"You are trying to remove something not belonging to"}
                        \textcolor{stringliteral}{" the example smart object!\(\backslash\)n"});
        \textcolor{keywordflow}{return} NULL;
     \}

   idx = (long)(uintptr\_t)\hyperlink{group__Evas__Object__Group__Extras_gafbad43015793eda4ae50202c0ce0e652}{evas\_object\_data\_get}(child, \textcolor{stringliteral}{"index"});
   idx--;

   \_evas\_smart\_example\_remove\_do(priv, child, idx);

   \hyperlink{group__Evas__Smart__Object__Group_gaa81bbe0af70df6c90b8fc781c59237bc}{evas\_object\_smart\_callback\_call}(
     o, EVT\_CHILDREN\_NUMBER\_CHANGED, (\textcolor{keywordtype}{void} *)(uintptr\_t)priv->child\_count);
   \hyperlink{group__Evas__Smart__Object__Group_ga11d4fa46965429f3aa946147c501834a}{evas\_object\_smart\_changed}(o);

   \textcolor{keywordflow}{return} child;
\}

\textcolor{comment}{/* set to return any previous object set to the left position of the}

\end{DoxyCodeInclude}


At the end of that function we make use of an constant defined by the \hyperlink{group__Evas__Smart__Group_ga58dc94af6f064b39b2bf0155908fbe52}{E\+V\+A\+S\+\_\+\+S\+M\+A\+R\+T\+\_\+\+S\+U\+B\+C\+L\+A\+S\+S\+\_\+\+N\+E\+W}\+: {\ttfamily \+\_\+evas\+\_\+smart\+\_\+example\+\_\+parent\+\_\+sc}. It has the same prefix we passed to the macro, as you can see, and it holds a pointer to our {\bfseries parent} smart class. Then, we can call the specialized method, itself, after our code. The {\ttfamily del}, {\ttfamily hide}, {\ttfamily show} and {\ttfamily resize} specializations are straightforward, we let the reader take a look at them below to check their behavior. What's interesting is the {\ttfamily calculate} one\+:  
\begin{DoxyCodeInclude}
\textcolor{comment}{/* act on child objects' properties, before rendering */}
\textcolor{keyword}{static} \textcolor{keywordtype}{void}
\_evas\_smart\_example\_smart\_calculate(\hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object} *o)
\{
   \hyperlink{Evas__Common_8h_a2453e92182bad3b0e0d84e5aff433b07}{Evas\_Coord} x, y, w, h;

   EVAS\_SMART\_EXAMPLE\_DATA\_GET\_OR\_RETURN(o, priv);
   \hyperlink{group__Evas__Object__Group__Basic_ga6f52fab1a96dc58c85ee481d84bac871}{evas\_object\_geometry\_get}(o, &x, &y, &w, &h);

   evas\_object\_resize(priv->border, w, h);
   evas\_object\_move(priv->border, x, y);

   \textcolor{keywordflow}{if} (priv->children[0])
     \{
        evas\_object\_move(priv->children[0], x + 3, y + 3);
        evas\_object\_resize(priv->children[0], (w / 2) - 3, (h / 2) - 3);
     \}

   \textcolor{keywordflow}{if} (priv->children[1])
     \{
        evas\_object\_move(priv->children[1], x + (w / 2), y + (h / 2));
        evas\_object\_resize(priv->children[1], (w / 2) - 3, (h / 2) - 3);
     \}
\}

\textcolor{comment}{/* setting our smart interface */}

\end{DoxyCodeInclude}


This code will take place whenever the smart object itself is flagged \char`\"{}dirty\char`\"{}, i.\+e., must be recalculated for rendering (that could come from changes on its clipper, resizing, moving, etc). There, we make sure the decorative border lies on the edges of the smart object and the children, if any, lie on their respective quadrants.

After instantiating our smart object, we do some checks to exemplify some of the A\+P\+I on smart objects\+:  
\begin{DoxyCodeInclude}
   ret = \hyperlink{group__Evas__Smart__Object__Group_ga257a2651b93de714211d4205c0e70bb9}{evas\_object\_smart\_type\_check}(d.smt, \_evas\_smart\_example\_type);
   fprintf(stdout, \textcolor{stringliteral}{"Adding smart object of type \(\backslash\)"%s\(\backslash\)" to the canvas: %s.\(\backslash\)n"},
           \_evas\_smart\_example\_type, ret ? \textcolor{stringliteral}{"success"} : \textcolor{stringliteral}{"failure"});

   d.clipper = \hyperlink{group__Evas__Smart__Object__Clipped_ga1ea2217e8a4abc28a35d8273949d4444}{evas\_object\_smart\_clipped\_clipper\_get}(d.smt);
   fprintf(stdout, \textcolor{stringliteral}{"Checking if clipped smart object's clipper is a "}
                   \textcolor{stringliteral}{"\(\backslash\)"static\(\backslash\)" one: %s\(\backslash\)n"}, \hyperlink{group__Evas__Object__Group__Extras_gaeddf3ca5853b9c5826680bc7f838d05d}{evas\_object\_static\_clip\_get}(
             d.clipper) ? \textcolor{stringliteral}{"yes"} : \textcolor{stringliteral}{"no"});

\end{DoxyCodeInclude}
 The \hyperlink{group__Evas__Smart__Object__Group_ga257a2651b93de714211d4205c0e70bb9}{evas\+\_\+object\+\_\+smart\+\_\+type\+\_\+check()} one will assure we have the string naming our smart class really set to the live object. The \hyperlink{group__Evas__Smart__Object__Clipped_ga1ea2217e8a4abc28a35d8273949d4444}{evas\+\_\+object\+\_\+smart\+\_\+clipped\+\_\+clipper\+\_\+get()} exemplifies usage of \char`\"{}static clippers\char`\"{} -- clipped smart objects have their global clippers flagged static.

Other important things we also exemplify here are {\bfseries smart callbacks} and smart callback {\bfseries introspection\+:}  
\begin{DoxyCodeInclude}
\textcolor{preprocessor}{#define EVT\_CHILDREN\_NUMBER\_CHANGED "children,changed"}

\textcolor{keyword}{static} \textcolor{keyword}{const} \hyperlink{struct__Evas__Smart__Cb__Description}{Evas\_Smart\_Cb\_Description} \_smart\_callbacks[] =
\{
   \{EVT\_CHILDREN\_NUMBER\_CHANGED, \textcolor{stringliteral}{"i"}\},
   \{NULL, NULL\}
\};

\end{DoxyCodeInclude}


Here we declare our array of smart callback descriptions, which has one element only, in this case. That callback will take place, as the name indicates, whenever the number of member objects in our smart object example instance changes. That global array variable must be the last argument to \hyperlink{group__Evas__Smart__Group_ga58dc94af6f064b39b2bf0155908fbe52}{E\+V\+A\+S\+\_\+\+S\+M\+A\+R\+T\+\_\+\+S\+U\+B\+C\+L\+A\+S\+S\+\_\+\+N\+E\+W}, so that it's registered as the {\bfseries smart class}'s callbacks description.

After we instantiate the smart object, we take a look on those descriptions and register a callback on that unique smart event\+:  
\begin{DoxyCodeInclude}
   \textcolor{keywordflow}{for} (; *descriptions; descriptions++)
     \{
        fprintf(stdout, \textcolor{stringliteral}{"We've found a smart callback on the smart object!"}
                        \textcolor{stringliteral}{"\(\backslash\)n\(\backslash\)tname: %s\(\backslash\)n\(\backslash\)ttype: %s\(\backslash\)n"}, (*descriptions)->name,
                (*descriptions)->type);

        \textcolor{keywordflow}{if} (strcmp((*descriptions)->type, \textcolor{stringliteral}{"i"})) \textcolor{keywordflow}{continue};
        \textcolor{comment}{/* we know we don't have other types of smart callbacks}
\textcolor{comment}{         * here, just playing with it */}

        \textcolor{comment}{/* for now, we know the only one callback is the one}
\textcolor{comment}{         * reporting number of member objects changed on the}
\textcolor{comment}{         * example smart object */}
        \hyperlink{group__Evas__Smart__Object__Group_ga18a8b179f94d21b2b09e19db11741061}{evas\_object\_smart\_callback\_add}(
          d.smt, (*descriptions)->name,
          \_on\_example\_smart\_object\_child\_num\_change, NULL);
     \}

   evas\_object\_focus\_set(d.bg, \hyperlink{group__Eina__Types__Group_ga05c12dacc8b4058994df842b41be85fc}{EINA\_TRUE});

\end{DoxyCodeInclude}


The code of the callback will just print how many member objects we have, which is an integer argument of the callback itself, as flagged by its description\+:  
\begin{DoxyCodeInclude}
\textcolor{comment}{/* callback on number of member objects changed */}
\_on\_example\_smart\_object\_child\_num\_change(\textcolor{keywordtype}{void} *data EINA\_UNUSED,
                                          \hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object} *obj EINA\_UNUSED,
                                          \textcolor{keywordtype}{void} *event\_info)
\{
   fprintf(stdout, \textcolor{stringliteral}{"Number of child members on our example smart"}
                   \textcolor{stringliteral}{" object changed to %llu\(\backslash\)n"}, (\textcolor{keywordtype}{unsigned} \textcolor{keywordtype}{long} \textcolor{keywordtype}{long})(uintptr\_t)event\_info);
\}

\end{DoxyCodeInclude}


One of the points at which we issue that callback is inside the {\ttfamily evas\+\_\+smart\+\_\+example\+\_\+remove()}, code that was already shown.

As in other examples, to interact with this one there's a command line interface. A help string can be asked for with the 'h' key\+:  
\begin{DoxyCodeInclude}
\textcolor{keyword}{static} \textcolor{keyword}{const} \textcolor{keywordtype}{char} *commands = \(\backslash\)
  \textcolor{stringliteral}{"commands are:\(\backslash\)n"}
  \textcolor{stringliteral}{"\(\backslash\)tl - insert child rectangle on the left\(\backslash\)n"}
  \textcolor{stringliteral}{"\(\backslash\)tr - insert child rectangle on the right\(\backslash\)n"}
  \textcolor{stringliteral}{"\(\backslash\)tw - remove and delete all members from the smart object\(\backslash\)n"}
  \textcolor{stringliteral}{"\(\backslash\)tright arrow - move smart object to the right\(\backslash\)n"}
  \textcolor{stringliteral}{"\(\backslash\)tleft arrow - move smart object to the left\(\backslash\)n"}
  \textcolor{stringliteral}{"\(\backslash\)tup arrow - move smart object up\(\backslash\)n"}
  \textcolor{stringliteral}{"\(\backslash\)tdown arrow - move smart object down\(\backslash\)n"}
  \textcolor{stringliteral}{"\(\backslash\)td - decrease smart object's size\(\backslash\)n"}
  \textcolor{stringliteral}{"\(\backslash\)ti - increase smart object's size\(\backslash\)n"}
  \textcolor{stringliteral}{"\(\backslash\)tc - change smart object's clipper color\(\backslash\)n"}
  \textcolor{stringliteral}{"\(\backslash\)t. - rotate object to the right\(\backslash\)n"}
  \textcolor{stringliteral}{"\(\backslash\)t, - rotate object to the left\(\backslash\)n"}
  \textcolor{stringliteral}{"\(\backslash\)th - print help\(\backslash\)n"}
  \textcolor{stringliteral}{"\(\backslash\)tq - quit\(\backslash\)n"}
;

\end{DoxyCodeInclude}
 Use 'l' and 'r' keys, to create new rectangles and place them on the left ({\ttfamily evas\+\_\+smart\+\_\+example\+\_\+set\+\_\+left()}) or right ({\ttfamily evas\+\_\+smart\+\_\+example\+\_\+set\+\_\+right()}) spots of our smart object, respectively. The 'w' command will remove all member objects from the smart object and delete them. The keyboard arrows will move the smart object along the canvas. See how it takes any child objects with it during its movement. The 'd' and 'i' keys will increase or decrease the smart object's size -- see how it affects the children's sizes, too. Finally, 'c' will change the color of the smart object's clipper (which is the exact internal clipper coming from a clipped smart object)\+:  
\begin{DoxyCodeInclude}
   d.clipper = \hyperlink{group__Evas__Smart__Object__Clipped_ga1ea2217e8a4abc28a35d8273949d4444}{evas\_object\_smart\_clipped\_clipper\_get}(d.smt);
   fprintf(stdout, \textcolor{stringliteral}{"Checking if clipped smart object's clipper is a "}
                   \textcolor{stringliteral}{"\(\backslash\)"static\(\backslash\)" one: %s\(\backslash\)n"}, \hyperlink{group__Evas__Object__Group__Extras_gaeddf3ca5853b9c5826680bc7f838d05d}{evas\_object\_static\_clip\_get}(
             d.clipper) ? \textcolor{stringliteral}{"yes"} : \textcolor{stringliteral}{"no"});

   \hyperlink{group__Evas__Object__Group__Basic_gae34bdcfd7f5100151f6ea8ef4a392949}{evas\_object\_color\_set}(
     d.clipper, clipper\_colors[cur\_color].r, clipper\_colors[cur\_color].g,
     clipper\_colors[cur\_color].b, clipper\_colors[cur\_color].a);

\end{DoxyCodeInclude}


\char`\"{}\+Real life\char`\"{} examples of smart objects are Edje and Emotion objects\+: they both have independent libraries implementing their behavior. 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 <stdio.h>}
\textcolor{preprocessor}{#include <errno.h>}

\textcolor{preprocessor}{#define WIDTH  (320)}
\textcolor{preprocessor}{#define HEIGHT (240)}

\textcolor{keyword}{static} \textcolor{keyword}{const} \textcolor{keywordtype}{char} *commands = \(\backslash\)
  \textcolor{stringliteral}{"commands are:\(\backslash\)n"}
  \textcolor{stringliteral}{"\(\backslash\)tl - insert child rectangle on the left\(\backslash\)n"}
  \textcolor{stringliteral}{"\(\backslash\)tr - insert child rectangle on the right\(\backslash\)n"}
  \textcolor{stringliteral}{"\(\backslash\)tw - remove and delete all members from the smart object\(\backslash\)n"}
  \textcolor{stringliteral}{"\(\backslash\)tright arrow - move smart object to the right\(\backslash\)n"}
  \textcolor{stringliteral}{"\(\backslash\)tleft arrow - move smart object to the left\(\backslash\)n"}
  \textcolor{stringliteral}{"\(\backslash\)tup arrow - move smart object up\(\backslash\)n"}
  \textcolor{stringliteral}{"\(\backslash\)tdown arrow - move smart object down\(\backslash\)n"}
  \textcolor{stringliteral}{"\(\backslash\)td - decrease smart object's size\(\backslash\)n"}
  \textcolor{stringliteral}{"\(\backslash\)ti - increase smart object's size\(\backslash\)n"}
  \textcolor{stringliteral}{"\(\backslash\)tc - change smart object's clipper color\(\backslash\)n"}
  \textcolor{stringliteral}{"\(\backslash\)t. - rotate object to the right\(\backslash\)n"}
  \textcolor{stringliteral}{"\(\backslash\)t, - rotate object to the left\(\backslash\)n"}
  \textcolor{stringliteral}{"\(\backslash\)th - print help\(\backslash\)n"}
  \textcolor{stringliteral}{"\(\backslash\)tq - quit\(\backslash\)n"}
;

\textcolor{preprocessor}{#define WHITE \{255, 255, 255, 255\}}
\textcolor{preprocessor}{#define RED   \{255, 0, 0, 255\}}
\textcolor{preprocessor}{#define GREEN \{0, 255, 0, 255\}}
\textcolor{preprocessor}{#define BLUE  \{0, 0, 255, 255\}}

\textcolor{keyword}{struct }test\_data
\{
   Ecore\_Evas  *ee;
   \hyperlink{group__Evas__Canvas_ga5ff87cc4ce6bc43e3b640a6d37f73043}{Evas}        *evas;
   \hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object} *smt, *bg, *clipper, *rects[2];
\};

\textcolor{keyword}{struct }color\_tuple
\{
   \textcolor{keywordtype}{int} r, g, b, a;
\} clipper\_colors[4] = \{WHITE, RED, GREEN, BLUE\};
\textcolor{keywordtype}{int} cur\_color = 0;
\textcolor{keywordtype}{int} cur\_angle = 0;

\textcolor{keyword}{static} \textcolor{keyword}{const} \textcolor{keywordtype}{char} *
\_index\_to\_color(\textcolor{keywordtype}{int} i)
\{
   \textcolor{keywordflow}{switch} (i)
     \{
      \textcolor{keywordflow}{case} 0:
        \textcolor{keywordflow}{return} \textcolor{stringliteral}{"WHITE (default)"};

      \textcolor{keywordflow}{case} 1:
        \textcolor{keywordflow}{return} \textcolor{stringliteral}{"RED"};

      \textcolor{keywordflow}{case} 2:
        \textcolor{keywordflow}{return} \textcolor{stringliteral}{"GREEN"};

      \textcolor{keywordflow}{case} 3:
        \textcolor{keywordflow}{return} \textcolor{stringliteral}{"BLUE"};

      \textcolor{keywordflow}{default}:
        \textcolor{keywordflow}{return} \textcolor{stringliteral}{"other"};
     \}
\}

\textcolor{keyword}{static} \textcolor{keyword}{struct }test\_data d = \{0\};
\textcolor{keyword}{static} \textcolor{keyword}{const} \textcolor{keywordtype}{char} *border\_img\_path = PACKAGE\_EXAMPLES\_DIR \textcolor{stringliteral}{"/red.png"};

\textcolor{preprocessor}{#define \_evas\_smart\_example\_type "Evas\_Smart\_Example"}
\textcolor{preprocessor}{#define EVT\_CHILDREN\_NUMBER\_CHANGED "children,changed"}

\textcolor{keyword}{static} \textcolor{keyword}{const} \hyperlink{struct__Evas__Smart__Cb__Description}{Evas\_Smart\_Cb\_Description} \_smart\_callbacks[] =
\{
   \{EVT\_CHILDREN\_NUMBER\_CHANGED, \textcolor{stringliteral}{"i"}\},
   \{NULL, NULL\}
\};

\textcolor{keyword}{typedef} \textcolor{keyword}{struct }\_Evas\_Smart\_Example\_Data Evas\_Smart\_Example\_Data;
\textcolor{comment}{/*}
\textcolor{comment}{ * This structure augments clipped smart object's instance data,}
\textcolor{comment}{ * providing extra members required by our example smart object's}
\textcolor{comment}{ * implementation.}
\textcolor{comment}{ */}
\textcolor{keyword}{struct }\_Evas\_Smart\_Example\_Data
\{
   \hyperlink{struct__Evas__Object__Smart__Clipped__Data}{Evas\_Object\_Smart\_Clipped\_Data} base;
   \hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object}                   *children[2], *border;
   \textcolor{keywordtype}{int}                            child\_count;
\};

\textcolor{preprocessor}{#define EVAS\_SMART\_EXAMPLE\_DATA\_GET(o, ptr) \(\backslash\)}
\textcolor{preprocessor}{  Evas\_Smart\_Example\_Data * ptr = evas\_object\_smart\_data\_get(o)}

\textcolor{preprocessor}{#define EVAS\_SMART\_EXAMPLE\_DATA\_GET\_OR\_RETURN(o, ptr)        \(\backslash\)}
\textcolor{preprocessor}{  EVAS\_SMART\_EXAMPLE\_DATA\_GET(o, ptr);                       \(\backslash\)}
\textcolor{preprocessor}{  if (!ptr)                                                  \(\backslash\)}
\textcolor{preprocessor}{    \{                                                        \(\backslash\)}
\textcolor{preprocessor}{       fprintf(stderr, "No widget data for object %p (%s)!", \(\backslash\)}
\textcolor{preprocessor}{               o, evas\_object\_type\_get(o));                  \(\backslash\)}
\textcolor{preprocessor}{       fflush(stderr);                                       \(\backslash\)}
\textcolor{preprocessor}{       abort();                                              \(\backslash\)}
\textcolor{preprocessor}{       return;                                               \(\backslash\)}
\textcolor{preprocessor}{    \}}

\textcolor{preprocessor}{#define EVAS\_SMART\_EXAMPLE\_DATA\_GET\_OR\_RETURN\_VAL(o, ptr, val) \(\backslash\)}
\textcolor{preprocessor}{  EVAS\_SMART\_EXAMPLE\_DATA\_GET(o, ptr);                         \(\backslash\)}
\textcolor{preprocessor}{  if (!ptr)                                                    \(\backslash\)}
\textcolor{preprocessor}{    \{                                                          \(\backslash\)}
\textcolor{preprocessor}{       fprintf(stderr, "No widget data for object %p (%s)!",   \(\backslash\)}
\textcolor{preprocessor}{               o, evas\_object\_type\_get(o));                    \(\backslash\)}
\textcolor{preprocessor}{       fflush(stderr);                                         \(\backslash\)}
\textcolor{preprocessor}{       abort();                                                \(\backslash\)}
\textcolor{preprocessor}{       return val;                                             \(\backslash\)}
\textcolor{preprocessor}{    \}}

\hyperlink{group__Evas__Smart__Group_ga58dc94af6f064b39b2bf0155908fbe52}{EVAS\_SMART\_SUBCLASS\_NEW}(\_evas\_smart\_example\_type, \_evas\_smart\_example,
                        \hyperlink{struct__Evas__Smart__Class}{Evas\_Smart\_Class}, \hyperlink{struct__Evas__Smart__Class}{Evas\_Smart\_Class},
                        \hyperlink{group__Evas__Smart__Object__Clipped_gabbb2c85a3978e44404528a94be381dcd}{evas\_object\_smart\_clipped\_class\_get}, 
      \_smart\_callbacks);

\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{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);
   evas\_object\_resize(d.bg, w, h);
\}

\textcolor{keyword}{static} \textcolor{keywordtype}{void}
\_on\_child\_del(\textcolor{keywordtype}{void} *data,
              \hyperlink{group__Evas__Canvas_ga5ff87cc4ce6bc43e3b640a6d37f73043}{Evas} *evas EINA\_UNUSED,
              \hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object} *o,
              \textcolor{keywordtype}{void} *einfo EINA\_UNUSED)
\{
   \hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object} *example\_smart = data;
   \textcolor{keywordtype}{long} idx;

   EVAS\_SMART\_EXAMPLE\_DATA\_GET(example\_smart, priv);

   idx = (long)(uintptr\_t)\hyperlink{group__Evas__Object__Group__Extras_gafbad43015793eda4ae50202c0ce0e652}{evas\_object\_data\_get}(o, \textcolor{stringliteral}{"index"});
   idx--;

   priv->children[idx] = NULL;

   \hyperlink{group__Evas__Smart__Object__Group_ga12034359ab780a3a0e8b20b83475ed15}{evas\_object\_smart\_member\_del}(o);
   \hyperlink{group__Evas__Smart__Object__Group_ga11d4fa46965429f3aa946147c501834a}{evas\_object\_smart\_changed}(example\_smart);
\}

\textcolor{keyword}{static} \textcolor{keywordtype}{void}
\_evas\_smart\_example\_child\_callbacks\_unregister(\hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object} *obj)
\{
   \hyperlink{group__Evas__Object__Group__Extras_ga70134a7068c9bff4107a761abe0a2ad4}{evas\_object\_data\_set}(obj, \textcolor{stringliteral}{"index"}, NULL);
   \hyperlink{group__Evas__Object__Group__Events_gab271959a45d1d5348f6e78a14def44c2}{evas\_object\_event\_callback\_del}(obj, 
      \hyperlink{Evas__Common_8h_a99e208e463a20499aabe6faac8a8cb8aaab869b5d534f02f1b3e151e2406a8c24}{EVAS\_CALLBACK\_FREE}, \_on\_child\_del);
\}

\textcolor{keyword}{static} \textcolor{keywordtype}{void}
\_evas\_smart\_example\_child\_callbacks\_register(\hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object} *o,
                                             \hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object} *child,
                                             \textcolor{keywordtype}{long} idx)
\{
   \hyperlink{group__Evas__Object__Group__Events_ga23be30ac5cdfb780f1ff82e9108ec26b}{evas\_object\_event\_callback\_add}(child, 
      \hyperlink{Evas__Common_8h_a99e208e463a20499aabe6faac8a8cb8aaab869b5d534f02f1b3e151e2406a8c24}{EVAS\_CALLBACK\_FREE}, \_on\_child\_del, o);
   \hyperlink{group__Evas__Object__Group__Extras_ga70134a7068c9bff4107a761abe0a2ad4}{evas\_object\_data\_set}(child, \textcolor{stringliteral}{"index"}, (\textcolor{keywordtype}{void} *)(uintptr\_t)(++idx));
\}

\textcolor{comment}{/* create and setup a new example smart object's internals */}
\textcolor{keyword}{static} \textcolor{keywordtype}{void}
\_evas\_smart\_example\_smart\_add(\hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object} *o)
\{
   \hyperlink{group__Evas__Smart__Group_ga4aa4b72aafa0391144fb0171aeff2ccd}{EVAS\_SMART\_DATA\_ALLOC}(o, Evas\_Smart\_Example\_Data);

   \textcolor{comment}{/* call parent\_sc->add() before member\_adding the children, otherwise the}
\textcolor{comment}{    * smart object's clipper won't be created yet, and the children won't be}
\textcolor{comment}{    * clipped to it */}
   \_evas\_smart\_example\_parent\_sc->add(o);

   \textcolor{comment}{/* this is a border around the smart object's area, delimiting it */}
   priv->border = \hyperlink{group__Evas__Object__Image_ga0e8cb83d31d02bf583c75925b7cd14d7}{evas\_object\_image\_filled\_add}(evas\_object\_evas\_get(o));
   \hyperlink{group__Evas__Object__Image_gac27fd0ceabe5f56607b7a86d71577df1}{evas\_object\_image\_file\_set}(priv->border, border\_img\_path, NULL);
   evas\_object\_image\_border\_set(priv->border, 3, 3, 3, 3);
   evas\_object\_image\_border\_center\_fill\_set(
     priv->border, \hyperlink{Evas__Common_8h_a4a05f0fd82f51c6b330e349457cdc7e2a2ad856ac6aab5e2659c3a584a37aec70}{EVAS\_BORDER\_FILL\_NONE});
   \hyperlink{group__Evas__Object__Group__Basic_ga9cbc13661584e49fb9d9cdab514a1eeb}{evas\_object\_show}(priv->border);
   \hyperlink{group__Evas__Smart__Object__Group_ga6845c17effe796430cb4fc5f2cfccef0}{evas\_object\_smart\_member\_add}(priv->border, o);
\}

\textcolor{keyword}{static} \textcolor{keywordtype}{void}
\_evas\_smart\_example\_smart\_del(\hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object} *o)
\{
   EVAS\_SMART\_EXAMPLE\_DATA\_GET(o, priv);

   \textcolor{keywordflow}{if} (priv->children[0])
     \{
        \_evas\_smart\_example\_child\_callbacks\_unregister(priv->children[0]);
        priv->children[0] = NULL;
     \}

   \textcolor{keywordflow}{if} (priv->children[1])
     \{
        \_evas\_smart\_example\_child\_callbacks\_unregister(priv->children[1]);
        priv->children[1] = NULL;
     \}

   \_evas\_smart\_example\_parent\_sc->del(o);
\}

\textcolor{keyword}{static} \textcolor{keywordtype}{void}
\_evas\_smart\_example\_smart\_resize(\hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object} *o,
                                 \hyperlink{Evas__Common_8h_a2453e92182bad3b0e0d84e5aff433b07}{Evas\_Coord} w,
                                 \hyperlink{Evas__Common_8h_a2453e92182bad3b0e0d84e5aff433b07}{Evas\_Coord} h)
\{
   \hyperlink{Evas__Common_8h_a2453e92182bad3b0e0d84e5aff433b07}{Evas\_Coord} ow, oh;
   \hyperlink{group__Evas__Object__Group__Basic_ga6f52fab1a96dc58c85ee481d84bac871}{evas\_object\_geometry\_get}(o, NULL, NULL, &ow, &oh);
   \textcolor{keywordflow}{if} ((ow == w) && (oh == h)) \textcolor{keywordflow}{return};

   \textcolor{comment}{/* this will trigger recalculation */}
   \hyperlink{group__Evas__Smart__Object__Group_ga11d4fa46965429f3aa946147c501834a}{evas\_object\_smart\_changed}(o);
\}

\textcolor{comment}{/* act on child objects' properties, before rendering */}
\textcolor{keyword}{static} \textcolor{keywordtype}{void}
\_evas\_smart\_example\_smart\_calculate(\hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object} *o)
\{
   \hyperlink{Evas__Common_8h_a2453e92182bad3b0e0d84e5aff433b07}{Evas\_Coord} x, y, w, h;

   EVAS\_SMART\_EXAMPLE\_DATA\_GET\_OR\_RETURN(o, priv);
   \hyperlink{group__Evas__Object__Group__Basic_ga6f52fab1a96dc58c85ee481d84bac871}{evas\_object\_geometry\_get}(o, &x, &y, &w, &h);

   evas\_object\_resize(priv->border, w, h);
   evas\_object\_move(priv->border, x, y);

   \textcolor{keywordflow}{if} (priv->children[0])
     \{
        evas\_object\_move(priv->children[0], x + 3, y + 3);
        evas\_object\_resize(priv->children[0], (w / 2) - 3, (h / 2) - 3);
     \}

   \textcolor{keywordflow}{if} (priv->children[1])
     \{
        evas\_object\_move(priv->children[1], x + (w / 2), y + (h / 2));
        evas\_object\_resize(priv->children[1], (w / 2) - 3, (h / 2) - 3);
     \}
\}

\textcolor{comment}{/* setting our smart interface */}
\textcolor{keyword}{static} \textcolor{keywordtype}{void}
\_evas\_smart\_example\_smart\_set\_user(\hyperlink{struct__Evas__Smart__Class}{Evas\_Smart\_Class} *sc)
\{
   \textcolor{comment}{/* specializing these two */}
   sc->\hyperlink{struct__Evas__Smart__Class_a53149c9c3c1eb86af742a2d89790d2c7}{add} = \_evas\_smart\_example\_smart\_add;
   sc->\hyperlink{struct__Evas__Smart__Class_a8a493473cd97a4e9284f5a33f0afe823}{del} = \_evas\_smart\_example\_smart\_del;

   \textcolor{comment}{/* clipped smart object has no hook on resizes or calculations */}
   sc->\hyperlink{struct__Evas__Smart__Class_a6b7ea5214710d6a1a8981e57469ac1aa}{resize} = \_evas\_smart\_example\_smart\_resize;
   sc->\hyperlink{struct__Evas__Smart__Class_af48b73a524d5fe75604ee104bca4e79a}{calculate} = \_evas\_smart\_example\_smart\_calculate;
\}

\textcolor{comment}{/* BEGINS example smart object's own interface */}

\textcolor{comment}{/* add a new example smart object to a canvas */}
\hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object} *
evas\_smart\_example\_add(\hyperlink{group__Evas__Canvas_ga5ff87cc4ce6bc43e3b640a6d37f73043}{Evas} *evas)
\{
   \textcolor{keywordflow}{return} \hyperlink{group__Evas__Smart__Object__Group_gad80de73a33446f902d4b39141a8d0a05}{evas\_object\_smart\_add}(evas, \_evas\_smart\_example\_smart\_class\_new());
\}

\textcolor{keyword}{static} \textcolor{keywordtype}{void}
\_evas\_smart\_example\_remove\_do(Evas\_Smart\_Example\_Data *priv,
                              \hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object} *child,
                              \textcolor{keywordtype}{int} idx)
\{
   priv->children[idx] = NULL;
   priv->child\_count--;
   \_evas\_smart\_example\_child\_callbacks\_unregister(child);
   \hyperlink{group__Evas__Smart__Object__Group_ga12034359ab780a3a0e8b20b83475ed15}{evas\_object\_smart\_member\_del}(child);
\}

\textcolor{comment}{/* remove a child element, return its pointer (or NULL on errors) */}
\hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object} *
evas\_smart\_example\_remove(\hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object} *o,
                          \hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object} *child)
\{
   \textcolor{keywordtype}{long} idx;

   EVAS\_SMART\_EXAMPLE\_DATA\_GET\_OR\_RETURN\_VAL(o, priv, NULL);

   \textcolor{keywordflow}{if} (priv->children[0] != child && priv->children[1] != child)
     \{
        fprintf(stderr, \textcolor{stringliteral}{"You are trying to remove something not belonging to"}
                        \textcolor{stringliteral}{" the example smart object!\(\backslash\)n"});
        \textcolor{keywordflow}{return} NULL;
     \}

   idx = (long)(uintptr\_t)\hyperlink{group__Evas__Object__Group__Extras_gafbad43015793eda4ae50202c0ce0e652}{evas\_object\_data\_get}(child, \textcolor{stringliteral}{"index"});
   idx--;

   \_evas\_smart\_example\_remove\_do(priv, child, idx);

   \hyperlink{group__Evas__Smart__Object__Group_gaa81bbe0af70df6c90b8fc781c59237bc}{evas\_object\_smart\_callback\_call}(
     o, EVT\_CHILDREN\_NUMBER\_CHANGED, (\textcolor{keywordtype}{void} *)(uintptr\_t)priv->child\_count);
   \hyperlink{group__Evas__Smart__Object__Group_ga11d4fa46965429f3aa946147c501834a}{evas\_object\_smart\_changed}(o);

   \textcolor{keywordflow}{return} child;
\}

\textcolor{comment}{/* set to return any previous object set to the left position of the}
\textcolor{comment}{ * smart object or NULL, if any (or on errors) */}
\hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object} *
evas\_smart\_example\_set\_left(\hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object} *o,
                            \hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object} *child)
\{
   \hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object} *ret = NULL;

   EVAS\_SMART\_EXAMPLE\_DATA\_GET\_OR\_RETURN\_VAL(o, priv, NULL);
   \textcolor{keywordflow}{if} (!child)
     \textcolor{keywordflow}{return} NULL;

   \textcolor{keywordflow}{if} (priv->children[1] == child)
     \{
        fprintf(stderr, \textcolor{stringliteral}{"You mustn't place a child on both slots of"}
                        \textcolor{stringliteral}{" the example smart object!\(\backslash\)n"});
        \textcolor{keywordflow}{return} NULL;
     \}

   \textcolor{keywordflow}{if} (priv->children[0])
     \{
        \textcolor{keywordflow}{if} (priv->children[0] != child)
          \{
             ret = priv->children[0];
             \_evas\_smart\_example\_remove\_do(priv, priv->children[0], 0);
          \}
        \textcolor{keywordflow}{else} \textcolor{keywordflow}{return} child;
     \}

   priv->children[0] = child;
   \_evas\_smart\_example\_child\_callbacks\_register(o, child, 0);
   \hyperlink{group__Evas__Smart__Object__Group_ga6845c17effe796430cb4fc5f2cfccef0}{evas\_object\_smart\_member\_add}(child, o);
   \hyperlink{group__Evas__Smart__Object__Group_ga11d4fa46965429f3aa946147c501834a}{evas\_object\_smart\_changed}(o);

   priv->child\_count++;
   \textcolor{keywordflow}{if} (!ret)
     \{
        \hyperlink{group__Evas__Smart__Object__Group_gaa81bbe0af70df6c90b8fc781c59237bc}{evas\_object\_smart\_callback\_call}(
          o, EVT\_CHILDREN\_NUMBER\_CHANGED, (\textcolor{keywordtype}{void} *)(uintptr\_t)priv->child\_count);
     \}

   \textcolor{keywordflow}{return} ret;
\}

\textcolor{comment}{/* set to return any previous object set to the right position of the}
\textcolor{comment}{ * smart object or NULL, if any (or on errors) */}
\hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object} *
evas\_smart\_example\_set\_right(\hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object} *o,
                             \hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object} *child)
\{
   \hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object} *ret = NULL;

   EVAS\_SMART\_EXAMPLE\_DATA\_GET\_OR\_RETURN\_VAL(o, priv, NULL);
   \textcolor{keywordflow}{if} (!child)
     \textcolor{keywordflow}{return} NULL;

   \textcolor{keywordflow}{if} (priv->children[0] == child)
     \{
        fprintf(stderr, \textcolor{stringliteral}{"You mustn't place a child on both slots of"}
                        \textcolor{stringliteral}{" the example smart object!\(\backslash\)n"});
        \textcolor{keywordflow}{return} NULL;
     \}

   \textcolor{keywordflow}{if} (priv->children[1])
     \{
        \textcolor{keywordflow}{if} (priv->children[1] != child)
          \{
             ret = priv->children[1];
             \_evas\_smart\_example\_remove\_do(priv, priv->children[1], 1);
          \}
        \textcolor{keywordflow}{else} \textcolor{keywordflow}{return} child;
     \}

   priv->children[1] = child;
   \_evas\_smart\_example\_child\_callbacks\_register(o, child, 1);
   \hyperlink{group__Evas__Smart__Object__Group_ga6845c17effe796430cb4fc5f2cfccef0}{evas\_object\_smart\_member\_add}(child, o);
   \hyperlink{group__Evas__Smart__Object__Group_ga11d4fa46965429f3aa946147c501834a}{evas\_object\_smart\_changed}(o);

   priv->child\_count++;
   \textcolor{keywordflow}{if} (!ret)
     \{
        \hyperlink{group__Evas__Smart__Object__Group_gaa81bbe0af70df6c90b8fc781c59237bc}{evas\_object\_smart\_callback\_call}(
          o, EVT\_CHILDREN\_NUMBER\_CHANGED, (\textcolor{keywordtype}{void} *)(uintptr\_t)priv->child\_count);
     \}

   \textcolor{keywordflow}{return} ret;
\}

\textcolor{comment}{/* END OF example smart object's own interface */}

\textcolor{keyword}{static} \textcolor{keywordtype}{void}
\_map\_update(\textcolor{keywordtype}{void})
\{
   \hyperlink{group__Evas__Object__Group__Map_gae94fcea124ae4135e8bb15a014b334dc}{Evas\_Map} *m;
   \hyperlink{Evas__Common_8h_a2453e92182bad3b0e0d84e5aff433b07}{Evas\_Coord} x, y, w, h;

   \hyperlink{group__Evas__Object__Group__Basic_ga6f52fab1a96dc58c85ee481d84bac871}{evas\_object\_geometry\_get}(d.smt, &x, &y, &w, &h);
   m = \hyperlink{group__Evas__Object__Group__Map_ga68a1a6d2dfdd5c9d88a9200eb78cca4e}{evas\_map\_new}(4);
   \hyperlink{group__Evas__Object__Group__Map_gaa21f5c7338fbb125b8e50890b3fefb91}{evas\_map\_util\_points\_populate\_from\_object}(m, d.smt);
   \hyperlink{group__Evas__Object__Group__Map_ga0db530bdf4f619b3c9c4c74c3e87ccac}{evas\_map\_util\_rotate}(m, cur\_angle, x + (w / 2), y + (h / 2));
   evas\_object\_map\_set(d.smt, m);
   evas\_object\_map\_enable\_set(d.smt, \hyperlink{group__Eina__Types__Group_ga05c12dacc8b4058994df842b41be85fc}{EINA\_TRUE});
   \hyperlink{group__Evas__Object__Group__Map_gab3e18d6086e352b121a57c130041bb24}{evas\_map\_free}(m);
\}

\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{keywordflow}{if} (strcmp(ev->\hyperlink{struct__Evas__Event__Key__Down_a70473bba88a1afaee180a54150513824}{key}, \textcolor{stringliteral}{"q"}) == 0) \textcolor{comment}{/* print help */}
     \{
        \_on\_destroy(NULL);
        \textcolor{keywordflow}{return};
     \}

   \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}{"w"}) == 0) \textcolor{comment}{/* clear out smart object (WRT}
\textcolor{comment}{                                       * members) */}
     \{
        \textcolor{keywordflow}{if} (d.rects[0])
          \{
             evas\_smart\_example\_remove(d.smt, d.rects[0]);
             \hyperlink{group__Evas__Object__Group__Basic_ga7e7a625dab7a3890532aa13b43117076}{evas\_object\_del}(d.rects[0]);
          \}
        \textcolor{keywordflow}{if} (d.rects[1])
          \{
             evas\_smart\_example\_remove(d.smt, d.rects[1]);
             \hyperlink{group__Evas__Object__Group__Basic_ga7e7a625dab7a3890532aa13b43117076}{evas\_object\_del}(d.rects[1]);
          \}

        memset(d.rects, 0, \textcolor{keyword}{sizeof}(d.rects));

        fprintf(stdout, \textcolor{stringliteral}{"Deleting all members of the smart object.\(\backslash\)n"});

        \textcolor{keywordflow}{return};
     \}

   \textcolor{keywordflow}{if} (strcmp(ev->\hyperlink{struct__Evas__Event__Key__Down_a70473bba88a1afaee180a54150513824}{key}, \textcolor{stringliteral}{"l"}) == 0) \textcolor{comment}{/* insert random colored}
\textcolor{comment}{                                       * rectangle on the left */}
     \{
        \hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object} *rect = \hyperlink{group__Evas__Object__Rectangle_ga4d80fc32ad1cac28428cebd65d746751}{evas\_object\_rectangle\_add}(d.evas), *prev;
        \hyperlink{group__Evas__Object__Group__Basic_gae34bdcfd7f5100151f6ea8ef4a392949}{evas\_object\_color\_set}(
          rect, rand() % 255, rand() % 255, rand() % 255, 255);
        \hyperlink{group__Evas__Object__Group__Basic_ga9cbc13661584e49fb9d9cdab514a1eeb}{evas\_object\_show}(rect);

        prev = evas\_smart\_example\_set\_left(d.smt, rect);
        d.rects[0] = rect;

        fprintf(stdout, \textcolor{stringliteral}{"Setting smart object's left spot with a new"}
                        \textcolor{stringliteral}{" rectangle.\(\backslash\)n"});
        fprintf(stdout, \textcolor{stringliteral}{"Checking its new smart object parent: %s\(\backslash\)n"},
                \hyperlink{group__Evas__Smart__Object__Group_ga60808a6a46abf32f9eb5ef5f62fde360}{evas\_object\_smart\_parent\_get}(rect) == d.smt ? \textcolor{stringliteral}{"OK!"} :
                \textcolor{stringliteral}{"Failure!"});
        \textcolor{keywordflow}{if} (prev)
          \{
             \textcolor{keywordtype}{int} r, g, b;

             \hyperlink{group__Evas__Object__Group__Basic_ga0854bae878bfc39f51b9c989353c973f}{evas\_object\_color\_get}(prev, &r, &g, &b, NULL);
             fprintf(stdout, \textcolor{stringliteral}{"Deleting previous left child,"}
                             \textcolor{stringliteral}{" which had colors (%d, %d, %d)\(\backslash\)n"}, r, g, b);
             \hyperlink{group__Evas__Object__Group__Basic_ga7e7a625dab7a3890532aa13b43117076}{evas\_object\_del}(prev);
          \}

        \textcolor{keywordflow}{return};
     \}

   \textcolor{keywordflow}{if} (strcmp(ev->\hyperlink{struct__Evas__Event__Key__Down_a70473bba88a1afaee180a54150513824}{key}, \textcolor{stringliteral}{"r"}) == 0) \textcolor{comment}{/* insert random colored}
\textcolor{comment}{                                       * rectangle on the right */}
     \{
        \hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object} *rect = \hyperlink{group__Evas__Object__Rectangle_ga4d80fc32ad1cac28428cebd65d746751}{evas\_object\_rectangle\_add}(d.evas), *prev;
        \hyperlink{group__Evas__Object__Group__Basic_gae34bdcfd7f5100151f6ea8ef4a392949}{evas\_object\_color\_set}(
          rect, rand() % 255, rand() % 255, rand() % 255, 255);
        \hyperlink{group__Evas__Object__Group__Basic_ga9cbc13661584e49fb9d9cdab514a1eeb}{evas\_object\_show}(rect);

        prev = evas\_smart\_example\_set\_right(d.smt, rect);
        d.rects[1] = rect;

        fprintf(stdout, \textcolor{stringliteral}{"Setting smart object's right spot with a new"}
                        \textcolor{stringliteral}{" rectangle.\(\backslash\)n"});
        fprintf(stdout, \textcolor{stringliteral}{"Checking its new smart object parent: %s\(\backslash\)n"},
                \hyperlink{group__Evas__Smart__Object__Group_ga60808a6a46abf32f9eb5ef5f62fde360}{evas\_object\_smart\_parent\_get}(rect) == d.smt ? \textcolor{stringliteral}{"OK!"} :
                \textcolor{stringliteral}{"Failure!"});
        \textcolor{keywordflow}{if} (prev)
          \{
             \textcolor{keywordtype}{int} r, g, b;

             \hyperlink{group__Evas__Object__Group__Basic_ga0854bae878bfc39f51b9c989353c973f}{evas\_object\_color\_get}(prev, &r, &g, &b, NULL);
             fprintf(stdout, \textcolor{stringliteral}{"Deleting previous right child,"}
                             \textcolor{stringliteral}{" which had colors (%d, %d, %d)\(\backslash\)n"}, r, g, b);
             \hyperlink{group__Evas__Object__Group__Basic_ga7e7a625dab7a3890532aa13b43117076}{evas\_object\_del}(prev);
          \}

        \textcolor{keywordflow}{return};
     \}

   \textcolor{comment}{/* move smart object along the canvas */}
   \textcolor{keywordflow}{if} (strcmp(ev->\hyperlink{struct__Evas__Event__Key__Down_a70473bba88a1afaee180a54150513824}{key}, \textcolor{stringliteral}{"Right"}) == 0 || strcmp(ev->\hyperlink{struct__Evas__Event__Key__Down_a70473bba88a1afaee180a54150513824}{key}, \textcolor{stringliteral}{"Left"}) == 0 ||
       strcmp(ev->\hyperlink{struct__Evas__Event__Key__Down_a70473bba88a1afaee180a54150513824}{key}, \textcolor{stringliteral}{"Up"}) == 0 || strcmp(ev->\hyperlink{struct__Evas__Event__Key__Down_a70473bba88a1afaee180a54150513824}{key}, \textcolor{stringliteral}{"Down"}) == 0)
     \{
        \hyperlink{Evas__Common_8h_a2453e92182bad3b0e0d84e5aff433b07}{Evas\_Coord} x, y;

        \hyperlink{group__Evas__Object__Group__Basic_ga6f52fab1a96dc58c85ee481d84bac871}{evas\_object\_geometry\_get}(d.smt, &x, &y, NULL, NULL);

        \textcolor{keywordflow}{switch} (ev->\hyperlink{struct__Evas__Event__Key__Down_a70473bba88a1afaee180a54150513824}{key}[0])
          \{
           \textcolor{keywordflow}{case} \textcolor{charliteral}{'R'}:
             x += 20;
             \textcolor{keywordflow}{break};

           \textcolor{keywordflow}{case} \textcolor{charliteral}{'L'}:
             x -= 20;
             \textcolor{keywordflow}{break};

           \textcolor{keywordflow}{case} \textcolor{charliteral}{'U'}:
             y -= 20;
             \textcolor{keywordflow}{break};

           \textcolor{keywordflow}{case} \textcolor{charliteral}{'D'}:
             y += 20;
             \textcolor{keywordflow}{break};
          \}

        evas\_object\_move(d.smt, x, y);
        \_map\_update();

        \textcolor{keywordflow}{return};
     \}

   \textcolor{comment}{/* increase smart object's size */}
   \textcolor{keywordflow}{if} (strcmp(ev->\hyperlink{struct__Evas__Event__Key__Down_a70473bba88a1afaee180a54150513824}{key}, \textcolor{stringliteral}{"i"}) == 0)
     \{
        \hyperlink{Evas__Common_8h_a2453e92182bad3b0e0d84e5aff433b07}{Evas\_Coord} w, h;

        \hyperlink{group__Evas__Object__Group__Basic_ga6f52fab1a96dc58c85ee481d84bac871}{evas\_object\_geometry\_get}(d.smt, NULL, NULL, &w, &h);

        w *= 1.1;
        h *= 1.1;

        evas\_object\_resize(d.smt, w, h);
        \_map\_update();

        \textcolor{keywordflow}{return};
     \}

   \textcolor{comment}{/* decrease smart object's size */}
   \textcolor{keywordflow}{if} (strcmp(ev->\hyperlink{struct__Evas__Event__Key__Down_a70473bba88a1afaee180a54150513824}{key}, \textcolor{stringliteral}{"d"}) == 0)
     \{
        \hyperlink{Evas__Common_8h_a2453e92182bad3b0e0d84e5aff433b07}{Evas\_Coord} w, h;

        \hyperlink{group__Evas__Object__Group__Basic_ga6f52fab1a96dc58c85ee481d84bac871}{evas\_object\_geometry\_get}(d.smt, NULL, NULL, &w, &h);

        w *= 0.9;
        h *= 0.9;

        evas\_object\_resize(d.smt, w, h);
        \_map\_update();

        \textcolor{keywordflow}{return};
     \}

   \textcolor{comment}{/* change smart object's clipper color */}
   \textcolor{keywordflow}{if} (strcmp(ev->\hyperlink{struct__Evas__Event__Key__Down_a70473bba88a1afaee180a54150513824}{key}, \textcolor{stringliteral}{"c"}) == 0)
     \{
        cur\_color = (cur\_color + 1) % 4;

        \hyperlink{group__Evas__Object__Group__Basic_gae34bdcfd7f5100151f6ea8ef4a392949}{evas\_object\_color\_set}(
          d.clipper, clipper\_colors[cur\_color].r, clipper\_colors[cur\_color].g,
          clipper\_colors[cur\_color].b, clipper\_colors[cur\_color].a);

        fprintf(stderr, \textcolor{stringliteral}{"Changing clipper's color to %s\(\backslash\)n"},
                \_index\_to\_color(cur\_color));

        \textcolor{keywordflow}{return};
     \}

   \textcolor{comment}{/* rotate object to the right */}
   \textcolor{keywordflow}{if} (strcmp(ev->\hyperlink{struct__Evas__Event__Key__Down_a70473bba88a1afaee180a54150513824}{key}, \textcolor{stringliteral}{"period"}) == 0)
     \{
        cur\_angle = (cur\_angle + 30) % 360;
        \_map\_update();
        \textcolor{keywordflow}{return};
     \}

   \textcolor{keywordflow}{if} (strcmp(ev->\hyperlink{struct__Evas__Event__Key__Down_a70473bba88a1afaee180a54150513824}{key}, \textcolor{stringliteral}{"comma"}) == 0)
     \{
        cur\_angle = (cur\_angle - 30) % 360;
        \_map\_update();
        \textcolor{keywordflow}{return};
     \}

   fprintf(stderr, \textcolor{stringliteral}{"Invalid key: '%s'\(\backslash\)n"}, ev->\hyperlink{struct__Evas__Event__Key__Down_a70473bba88a1afaee180a54150513824}{key});
\}

\textcolor{keyword}{static} \textcolor{keywordtype}{void}
\textcolor{comment}{/* callback on number of member objects changed */}
\_on\_example\_smart\_object\_child\_num\_change(\textcolor{keywordtype}{void} *data EINA\_UNUSED,
                                          \hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object} *obj EINA\_UNUSED,
                                          \textcolor{keywordtype}{void} *event\_info)
\{
   fprintf(stdout, \textcolor{stringliteral}{"Number of child members on our example smart"}
                   \textcolor{stringliteral}{" object changed to %llu\(\backslash\)n"}, (\textcolor{keywordtype}{unsigned} \textcolor{keywordtype}{long} \textcolor{keywordtype}{long})(uintptr\_t)event\_info);
\}

\textcolor{keywordtype}{int}
main(\textcolor{keywordtype}{void})
\{
   \textcolor{keyword}{const} \hyperlink{struct__Evas__Smart__Cb__Description}{Evas\_Smart\_Cb\_Description} **descriptions;
   \textcolor{keywordtype}{unsigned} \textcolor{keywordtype}{int} count;
   \hyperlink{group__Eina__Types__Group_ga3fe0caf72e93b1bab1ca8ee3ccf3f226}{Eina\_Bool} ret;

   srand(time(NULL));

   \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, 10, 10, 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.evas = \hyperlink{group__Ecore__Evas__Group_ga75a7cc694b6069e78df47dab0b0f2d20}{ecore\_evas\_get}(d.ee);

   d.bg = \hyperlink{group__Evas__Object__Rectangle_ga4d80fc32ad1cac28428cebd65d746751}{evas\_object\_rectangle\_add}(d.evas);
   \hyperlink{group__Evas__Object__Group__Basic_gae34bdcfd7f5100151f6ea8ef4a392949}{evas\_object\_color\_set}(d.bg, 255, 255, 255, 255);
   evas\_object\_move(d.bg, 0, 0);
   evas\_object\_resize(d.bg, WIDTH, HEIGHT);
   \hyperlink{group__Evas__Object__Group__Basic_ga9cbc13661584e49fb9d9cdab514a1eeb}{evas\_object\_show}(d.bg);

   d.smt = evas\_smart\_example\_add(d.evas);
   evas\_object\_move(d.smt, WIDTH / 4, HEIGHT / 4);
   evas\_object\_resize(d.smt, WIDTH / 2, HEIGHT / 2);
   \hyperlink{group__Evas__Object__Group__Basic_ga9cbc13661584e49fb9d9cdab514a1eeb}{evas\_object\_show}(d.smt);

   ret = \hyperlink{group__Evas__Smart__Object__Group_ga257a2651b93de714211d4205c0e70bb9}{evas\_object\_smart\_type\_check}(d.smt, \_evas\_smart\_example\_type);
   fprintf(stdout, \textcolor{stringliteral}{"Adding smart object of type \(\backslash\)"%s\(\backslash\)" to the canvas: %s.\(\backslash\)n"},
           \_evas\_smart\_example\_type, ret ? \textcolor{stringliteral}{"success"} : \textcolor{stringliteral}{"failure"});

   d.clipper = \hyperlink{group__Evas__Smart__Object__Clipped_ga1ea2217e8a4abc28a35d8273949d4444}{evas\_object\_smart\_clipped\_clipper\_get}(d.smt);
   fprintf(stdout, \textcolor{stringliteral}{"Checking if clipped smart object's clipper is a "}
                   \textcolor{stringliteral}{"\(\backslash\)"static\(\backslash\)" one: %s\(\backslash\)n"}, \hyperlink{group__Evas__Object__Group__Extras_gaeddf3ca5853b9c5826680bc7f838d05d}{evas\_object\_static\_clip\_get}(
             d.clipper) ? \textcolor{stringliteral}{"yes"} : \textcolor{stringliteral}{"no"});

   \hyperlink{group__Evas__Object__Group__Basic_gae34bdcfd7f5100151f6ea8ef4a392949}{evas\_object\_color\_set}(
     d.clipper, clipper\_colors[cur\_color].r, clipper\_colors[cur\_color].g,
     clipper\_colors[cur\_color].b, clipper\_colors[cur\_color].a);

   \hyperlink{group__Evas__Smart__Object__Group_ga2fd47b3487660fad7aed172359b38555}{evas\_object\_smart\_callbacks\_descriptions\_get}(
     d.smt, &descriptions, &count, NULL, NULL);

   \textcolor{keywordflow}{for} (; *descriptions; descriptions++)
     \{
        fprintf(stdout, \textcolor{stringliteral}{"We've found a smart callback on the smart object!"}
                        \textcolor{stringliteral}{"\(\backslash\)n\(\backslash\)tname: %s\(\backslash\)n\(\backslash\)ttype: %s\(\backslash\)n"}, (*descriptions)->name,
                (*descriptions)->type);

        \textcolor{keywordflow}{if} (strcmp((*descriptions)->type, \textcolor{stringliteral}{"i"})) \textcolor{keywordflow}{continue};
        \textcolor{comment}{/* we know we don't have other types of smart callbacks}
\textcolor{comment}{         * here, just playing with it */}

        \textcolor{comment}{/* for now, we know the only one callback is the one}
\textcolor{comment}{         * reporting number of member objects changed on the}
\textcolor{comment}{         * example smart object */}
        \hyperlink{group__Evas__Smart__Object__Group_ga18a8b179f94d21b2b09e19db11741061}{evas\_object\_smart\_callback\_add}(
          d.smt, (*descriptions)->name,
          \_on\_example\_smart\_object\_child\_num\_change, NULL);
     \}

   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{Evas__Common_8h_a99e208e463a20499aabe6faac8a8cb8aa336b86bad4f145f84c155e4922335584}{EVAS\_CALLBACK\_KEY\_DOWN}, \_on\_keydown, NULL);

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

   \hyperlink{group__Ecore__Evas__Group_gad3ec61f2aa03df4d3dbfd0d311e0c8dc}{ecore\_evas\_free}(d.ee);
   \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"});
   \hyperlink{group__Ecore__Evas__Group_gab8fa311077f749190c9b622f672b2214}{ecore\_evas\_shutdown}();
   \textcolor{keywordflow}{return} -1;
\}
\end{DoxyCodeInclude}
 