

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\textquotesingle{}s user. They could be as simple as a group of objects that move together (see \mbox{\hyperlink{group__Evas__Smart__Object__Clipped}{Clipped Smart Object}}) or implementations of whole complex UI 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\textquotesingle{}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}{0}
\DoxyCodeLine{   d.smt = evas\_smart\_example\_add(d.evas);}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Group_ga335c8ee6eaeaac9710656af4f8b0db91}{evas\_object\_move}}(d.smt, WIDTH / 4, HEIGHT / 4);}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Group_gacad94595f83580c18908cb3b69b08d1a}{evas\_object\_resize}}(d.smt, WIDTH / 2, HEIGHT / 2);}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Group__Basic_ga07208fcafd4739de606bc35fff684bf5}{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\textquotesingle{}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\textquotesingle{}s creation takes place as\+:  
\begin{DoxyCodeInclude}{0}
\DoxyCodeLine{\textcolor{comment}{/* add a new example smart object to a canvas */}}
\DoxyCodeLine{\mbox{\hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object}} *}
\DoxyCodeLine{evas\_smart\_example\_add(\mbox{\hyperlink{group__Evas__Canvas_ga5ff87cc4ce6bc43e3b640a6d37f73043}{Evas}} *evas)}
\DoxyCodeLine{\{}
\DoxyCodeLine{   \textcolor{keywordflow}{return} \mbox{\hyperlink{group__Evas__Smart__Object__Group_ga6689aaee0f614404be7dc7c3d31a23e0}{evas\_object\_smart\_add}}(evas, \_evas\_smart\_example\_smart\_class\_new());}
\DoxyCodeLine{\}}

\end{DoxyCodeInclude}
 Smart objects are defined by {\bfseries{smart classes}}, which are structs defining their interfaces, or {\bfseries{smart functions}} (see \mbox{\hyperlink{group__Evas__Smart__Group_gaea15f67e901bf5380cdb67dc1bb43391}{Evas\+\_\+\+Smart\+\_\+\+Class}}, the base class for any smart object). As you see, one has to use the \mbox{\hyperlink{group__Evas__Smart__Object__Group_ga6689aaee0f614404be7dc7c3d31a23e0}{evas\+\_\+object\+\_\+smart\+\_\+add()}} function to instantiate smart objects. Its second parameter is what matters -- an \mbox{\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\textquotesingle{}s code. That\textquotesingle{}s because it came from a very handy {\bfseries{helper macro}}\+:  
\begin{DoxyCodeInclude}{0}
\DoxyCodeLine{\mbox{\hyperlink{group__Evas__Smart__Group_ga58dc94af6f064b39b2bf0155908fbe52}{EVAS\_SMART\_SUBCLASS\_NEW}}(\_evas\_smart\_example\_type, \_evas\_smart\_example,}
\DoxyCodeLine{                        \mbox{\hyperlink{struct__Evas__Smart__Class}{Evas\_Smart\_Class}}, \mbox{\hyperlink{struct__Evas__Smart__Class}{Evas\_Smart\_Class}},}
\DoxyCodeLine{                        \mbox{\hyperlink{group__Evas__Smart__Object__Clipped_ga28133d16f3a1f8e3e71d3e80bb78df96}{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 \mbox{\hyperlink{group__Evas__Object__Group_ga335c8ee6eaeaac9710656af4f8b0db91}{evas\+\_\+object\+\_\+move()}} calls. Then, our example smart object will get that behavior for free.

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

\end{DoxyCodeInclude}
will define the new smart class\textquotesingle{} 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}{0}
\DoxyCodeLine{\textcolor{comment}{/* setting our smart interface */}}
\DoxyCodeLine{\textcolor{keyword}{static} \textcolor{keywordtype}{void}}
\DoxyCodeLine{\_evas\_smart\_example\_smart\_set\_user(\mbox{\hyperlink{struct__Evas__Smart__Class}{Evas\_Smart\_Class}} *sc)}
\DoxyCodeLine{\{}
\DoxyCodeLine{   \textcolor{comment}{/* specializing these two */}}
\DoxyCodeLine{   sc-\/>\mbox{\hyperlink{struct__Evas__Smart__Class_a044206688a3b0ea9785688d2efcea4d6}{add}} = \_evas\_smart\_example\_smart\_add;}
\DoxyCodeLine{   sc-\/>\mbox{\hyperlink{struct__Evas__Smart__Class_a1dd96f1c822fefaa68025e35de0bbde7}{del}} = \_evas\_smart\_example\_smart\_del;}
\DoxyCodeLine{}
\DoxyCodeLine{   \textcolor{comment}{/* clipped smart object has no hook on resizes or calculations */}}
\DoxyCodeLine{   sc-\/>\mbox{\hyperlink{struct__Evas__Smart__Class_afb95f2f5616403d43c464a4d939bdcfa}{resize}} = \_evas\_smart\_example\_smart\_resize;}
\DoxyCodeLine{   sc-\/>\mbox{\hyperlink{struct__Evas__Smart__Class_a495fe27fb074354ccaf9ebc68165ed69}{calculate}} = \_evas\_smart\_example\_smart\_calculate;}
\DoxyCodeLine{\}}

\end{DoxyCodeInclude}
 The first function pointer\textquotesingle{}s code will take place at an example smart object\textquotesingle{}s {\bfseries{creation}} time\+:  
\begin{DoxyCodeInclude}{0}
\DoxyCodeLine{\textcolor{comment}{/* create and setup a new example smart object's internals */}}
\DoxyCodeLine{\textcolor{keyword}{static} \textcolor{keywordtype}{void}}
\DoxyCodeLine{\_evas\_smart\_example\_smart\_add(\mbox{\hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object}} *o)}
\DoxyCodeLine{\{}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Smart__Group_ga4aa4b72aafa0391144fb0171aeff2ccd}{EVAS\_SMART\_DATA\_ALLOC}}(o, Evas\_Smart\_Example\_Data);}
\DoxyCodeLine{}
\DoxyCodeLine{   \textcolor{comment}{/* call parent\_sc-\/>add() before member\_adding the children, otherwise the}}
\DoxyCodeLine{\textcolor{comment}{    * smart object's clipper won't be created yet, and the children won't be}}
\DoxyCodeLine{\textcolor{comment}{    * clipped to it */}}
\DoxyCodeLine{   \_evas\_smart\_example\_parent\_sc-\/>add(o);}
\DoxyCodeLine{}
\DoxyCodeLine{   \textcolor{comment}{/* this is a border around the smart object's area, delimiting it */}}
\DoxyCodeLine{   priv-\/>border = \mbox{\hyperlink{group__Evas__Object__Image_gafb52be265f315186a28d43af2d559ec6}{evas\_object\_image\_filled\_add}}(\mbox{\hyperlink{group__Evas__Object__Group_ga7e211219d11abced5f3089362f7476b9}{evas\_object\_evas\_get}}(o));}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Image_gac2e588476b16b04f85ca9a594c140c1d}{evas\_object\_image\_file\_set}}(priv-\/>border, border\_img\_path, NULL);}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Image_ga063e5ad38b43897311bbdecfe8dc312d}{evas\_object\_image\_border\_set}}(priv-\/>border, 3, 3, 3, 3);}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Image_ga5749943ce62e85ead67a1440960677fa}{evas\_object\_image\_border\_center\_fill\_set}}(}
\DoxyCodeLine{     priv-\/>border, \mbox{\hyperlink{group__Evas__Object__Image_gga9f789224285e646309b7dd81a2401910a2ad856ac6aab5e2659c3a584a37aec70}{EVAS\_BORDER\_FILL\_NONE}});}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Group__Basic_ga07208fcafd4739de606bc35fff684bf5}{evas\_object\_show}}(priv-\/>border);}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Smart__Object__Group_gaaba101400666797eabd678727b48f7c1}{evas\_object\_smart\_member\_add}}(priv-\/>border, o);}
\DoxyCodeLine{\}}

\end{DoxyCodeInclude}
 The \mbox{\hyperlink{group__Evas__Smart__Group_ga4aa4b72aafa0391144fb0171aeff2ccd}{EVAS\+\_\+\+SMART\+\_\+\+DATA\+\_\+\+ALLOC}} 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}{0}
\DoxyCodeLine{\textcolor{keyword}{typedef} \textcolor{keyword}{struct }\_Evas\_Smart\_Example\_Data Evas\_Smart\_Example\_Data;}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{comment}{/*}}
\DoxyCodeLine{\textcolor{comment}{ * This structure augments clipped smart object's instance data,}}
\DoxyCodeLine{\textcolor{comment}{ * providing extra members required by our example smart object's}}
\DoxyCodeLine{\textcolor{comment}{ * implementation.}}
\DoxyCodeLine{\textcolor{comment}{ */}}
\DoxyCodeLine{\textcolor{keyword}{struct }\_Evas\_Smart\_Example\_Data}
\DoxyCodeLine{\{}
\DoxyCodeLine{   \mbox{\hyperlink{struct__Evas__Object__Smart__Clipped__Data}{Evas\_Object\_Smart\_Clipped\_Data}} base;}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object}}                   *children[2], *border;}
\DoxyCodeLine{   \textcolor{keywordtype}{int}                            child\_count;}
\DoxyCodeLine{\};}

\end{DoxyCodeInclude}
 See that, as we\textquotesingle{}re inheriting from the clipped smart object\textquotesingle{}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\textquotesingle{}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-\/\texorpdfstring{$>$}{>}border, o);}. The counterpart of this function is exemplified on the smart object\textquotesingle{}s interface function to remove children\+: 
\begin{DoxyCodeInclude}{0}
\DoxyCodeLine{\textcolor{comment}{/* remove a child element, return its pointer (or NULL on errors) */}}
\DoxyCodeLine{\mbox{\hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object}} *}
\DoxyCodeLine{evas\_smart\_example\_remove(\mbox{\hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object}} *o,}
\DoxyCodeLine{                          \mbox{\hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object}} *child)}
\DoxyCodeLine{\{}
\DoxyCodeLine{   \textcolor{keywordtype}{long} idx;}
\DoxyCodeLine{}
\DoxyCodeLine{   EVAS\_SMART\_EXAMPLE\_DATA\_GET\_OR\_RETURN\_VAL(o, priv, NULL);}
\DoxyCodeLine{}
\DoxyCodeLine{   \textcolor{keywordflow}{if} (priv-\/>children[0] != child \&\& priv-\/>children[1] != child)}
\DoxyCodeLine{     \{}
\DoxyCodeLine{        fprintf(stderr, \textcolor{stringliteral}{"{}You are trying to remove something not belonging to"{}}}
\DoxyCodeLine{                        \textcolor{stringliteral}{"{} the example smart object!\(\backslash\)n"{}});}
\DoxyCodeLine{        \textcolor{keywordflow}{return} NULL;}
\DoxyCodeLine{     \}}
\DoxyCodeLine{}
\DoxyCodeLine{   idx = (long)(uintptr\_t)\mbox{\hyperlink{group__Evas__Object__Group__Extras_ga3b85d805f879e71beed360650dda697b}{evas\_object\_data\_get}}(child, \textcolor{stringliteral}{"{}index"{}});}
\DoxyCodeLine{   idx-\/-\/;}
\DoxyCodeLine{}
\DoxyCodeLine{   \_evas\_smart\_example\_remove\_do(priv, child, idx);}
\DoxyCodeLine{}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Smart__Object__Group_ga684daaa265375789a2e0f2fa15333512}{evas\_object\_smart\_callback\_call}}(}
\DoxyCodeLine{     o, EVT\_CHILDREN\_NUMBER\_CHANGED, (\textcolor{keywordtype}{void} *)(uintptr\_t)priv-\/>child\_count);}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Smart__Object__Group_ga34af89b79d133e3fe3ff4e8102658f4e}{evas\_object\_smart\_changed}}(o);}
\DoxyCodeLine{}
\DoxyCodeLine{   \textcolor{keywordflow}{return} child;}
\DoxyCodeLine{\}}
\DoxyCodeLine{}
\DoxyCodeLine{\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 \mbox{\hyperlink{group__Evas__Smart__Group_ga58dc94af6f064b39b2bf0155908fbe52}{EVAS\+\_\+\+SMART\+\_\+\+SUBCLASS\+\_\+\+NEW}}\+: {\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\textquotesingle{}s interesting is the {\ttfamily calculate} one\+:  
\begin{DoxyCodeInclude}{0}
\DoxyCodeLine{\textcolor{comment}{/* act on child objects' properties, before rendering */}}
\DoxyCodeLine{\textcolor{keyword}{static} \textcolor{keywordtype}{void}}
\DoxyCodeLine{\_evas\_smart\_example\_smart\_calculate(\mbox{\hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object}} *o)}
\DoxyCodeLine{\{}
\DoxyCodeLine{   \mbox{\hyperlink{Evas__Common_8h_a2453e92182bad3b0e0d84e5aff433b07}{Evas\_Coord}} x, y, w, h;}
\DoxyCodeLine{}
\DoxyCodeLine{   EVAS\_SMART\_EXAMPLE\_DATA\_GET\_OR\_RETURN(o, priv);}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Group__Basic_ga6e8e78e110392480dd612df86a16b630}{evas\_object\_geometry\_get}}(o, \&x, \&y, \&w, \&h);}
\DoxyCodeLine{}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Group_gacad94595f83580c18908cb3b69b08d1a}{evas\_object\_resize}}(priv-\/>border, w, h);}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Group_ga335c8ee6eaeaac9710656af4f8b0db91}{evas\_object\_move}}(priv-\/>border, x, y);}
\DoxyCodeLine{}
\DoxyCodeLine{   \textcolor{keywordflow}{if} (priv-\/>children[0])}
\DoxyCodeLine{     \{}
\DoxyCodeLine{        \mbox{\hyperlink{group__Evas__Object__Group_ga335c8ee6eaeaac9710656af4f8b0db91}{evas\_object\_move}}(priv-\/>children[0], x + 3, y + 3);}
\DoxyCodeLine{        \mbox{\hyperlink{group__Evas__Object__Group_gacad94595f83580c18908cb3b69b08d1a}{evas\_object\_resize}}(priv-\/>children[0], (w / 2) -\/ 3, (h / 2) -\/ 3);}
\DoxyCodeLine{     \}}
\DoxyCodeLine{}
\DoxyCodeLine{   \textcolor{keywordflow}{if} (priv-\/>children[1])}
\DoxyCodeLine{     \{}
\DoxyCodeLine{        \mbox{\hyperlink{group__Evas__Object__Group_ga335c8ee6eaeaac9710656af4f8b0db91}{evas\_object\_move}}(priv-\/>children[1], x + (w / 2), y + (h / 2));}
\DoxyCodeLine{        \mbox{\hyperlink{group__Evas__Object__Group_gacad94595f83580c18908cb3b69b08d1a}{evas\_object\_resize}}(priv-\/>children[1], (w / 2) -\/ 3, (h / 2) -\/ 3);}
\DoxyCodeLine{     \}}
\DoxyCodeLine{\}}
\DoxyCodeLine{}
\DoxyCodeLine{\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 API on smart objects\+:  
\begin{DoxyCodeInclude}{0}
\DoxyCodeLine{   ret = \mbox{\hyperlink{group__Evas__Smart__Object__Group_ga22801632fbc3f349b5b4f976381afc62}{evas\_object\_smart\_type\_check}}(d.smt, \_evas\_smart\_example\_type);}
\DoxyCodeLine{   printf(\textcolor{stringliteral}{"{}Adding smart object of type \(\backslash\)"{}\%s\(\backslash\)"{} to the canvas: \%s.\(\backslash\)n"{}},}
\DoxyCodeLine{          \_evas\_smart\_example\_type, ret ? \textcolor{stringliteral}{"{}success"{}} : \textcolor{stringliteral}{"{}failure"{}});}
\DoxyCodeLine{}
\DoxyCodeLine{   d.clipper = \mbox{\hyperlink{group__Evas__Smart__Object__Group_ga10342ef3dfaa95ffd70b2883f0be531d}{evas\_object\_smart\_clipped\_clipper\_get}}(d.smt);}
\DoxyCodeLine{   printf(\textcolor{stringliteral}{"{}Checking if clipped smart object's clipper is a "{}}}
\DoxyCodeLine{          \textcolor{stringliteral}{"{}\(\backslash\)"{}static\(\backslash\)"{} one: \%s\(\backslash\)n"{}},}
\DoxyCodeLine{          \mbox{\hyperlink{group__Evas__Object__Group_gaa6b17176deac52b4c52b4380a9a8778a}{evas\_object\_static\_clip\_get}}(d.clipper) ? \textcolor{stringliteral}{"{}yes"{}} : \textcolor{stringliteral}{"{}no"{}});}

\end{DoxyCodeInclude}
The \mbox{\hyperlink{group__Evas__Smart__Object__Group_ga22801632fbc3f349b5b4f976381afc62}{evas\+\_\+object\+\_\+smart\+\_\+type\+\_\+check()}} one will assure we have the string naming our smart class really set to the live object. The \mbox{\hyperlink{group__Evas__Smart__Object__Group_ga10342ef3dfaa95ffd70b2883f0be531d}{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}{0}
\DoxyCodeLine{\textcolor{preprocessor}{\#define EVT\_CHILDREN\_NUMBER\_CHANGED "{}children,changed"{}}}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{keyword}{static} \textcolor{keyword}{const} \mbox{\hyperlink{struct__Evas__Smart__Cb__Description}{Evas\_Smart\_Cb\_Description}} \_smart\_callbacks[] =}
\DoxyCodeLine{\{}
\DoxyCodeLine{   \{EVT\_CHILDREN\_NUMBER\_CHANGED, \textcolor{stringliteral}{"{}i"{}}\},}
\DoxyCodeLine{   \{NULL, NULL\}}
\DoxyCodeLine{\};}

\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 \mbox{\hyperlink{group__Evas__Smart__Group_ga58dc94af6f064b39b2bf0155908fbe52}{EVAS\+\_\+\+SMART\+\_\+\+SUBCLASS\+\_\+\+NEW}}, so that it\textquotesingle{}s registered as the {\bfseries{smart class}}\textquotesingle{}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}{0}
\DoxyCodeLine{   \textcolor{keywordflow}{for} (; *descriptions; descriptions++)}
\DoxyCodeLine{     \{}
\DoxyCodeLine{        printf(\textcolor{stringliteral}{"{}We've found a smart callback on the smart object!"{}}}
\DoxyCodeLine{               \textcolor{stringliteral}{"{}\(\backslash\)n\(\backslash\)tname: \%s\(\backslash\)n\(\backslash\)ttype: \%s\(\backslash\)n"{}}, (*descriptions)-\/>name,}
\DoxyCodeLine{               (*descriptions)-\/>type);}
\DoxyCodeLine{}
\DoxyCodeLine{        \textcolor{keywordflow}{if} (strcmp((*descriptions)-\/>type, \textcolor{stringliteral}{"{}i"{}})) \textcolor{keywordflow}{continue};}
\DoxyCodeLine{        \textcolor{comment}{/* we know we don't have other types of smart callbacks}}
\DoxyCodeLine{\textcolor{comment}{         * here, just playing with it */}}
\DoxyCodeLine{}
\DoxyCodeLine{        \textcolor{comment}{/* for now, we know the only one callback is the one}}
\DoxyCodeLine{\textcolor{comment}{         * reporting number of member objects changed on the}}
\DoxyCodeLine{\textcolor{comment}{         * example smart object */}}
\DoxyCodeLine{        \mbox{\hyperlink{group__Evas__Smart__Object__Group_gac12dd6655f488cc47ce6cf00eb7d12b2}{evas\_object\_smart\_callback\_add}}(}
\DoxyCodeLine{          d.smt, (*descriptions)-\/>name,}
\DoxyCodeLine{          \_on\_example\_smart\_object\_child\_num\_change, NULL);}
\DoxyCodeLine{     \}}
\DoxyCodeLine{}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Group_gac6d65f8896ab59780553676d0017c2ef}{evas\_object\_focus\_set}}(d.bg, \mbox{\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}{0}
\DoxyCodeLine{\textcolor{comment}{/* callback on number of member objects changed */}}
\DoxyCodeLine{\_on\_example\_smart\_object\_child\_num\_change(\textcolor{keywordtype}{void} *data \mbox{\hyperlink{group__Eina__Types__Group_ga82d751be730f849719ca292f9558be87}{EINA\_UNUSED}},}
\DoxyCodeLine{                                          \mbox{\hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object}} *obj \mbox{\hyperlink{group__Eina__Types__Group_ga82d751be730f849719ca292f9558be87}{EINA\_UNUSED}},}
\DoxyCodeLine{                                          \textcolor{keywordtype}{void} *event\_info)}
\DoxyCodeLine{\{}
\DoxyCodeLine{   printf(\textcolor{stringliteral}{"{}Number of child members on our example smart"{}}}
\DoxyCodeLine{          \textcolor{stringliteral}{"{} object changed to \%llu\(\backslash\)n"{}}, (\textcolor{keywordtype}{unsigned} \textcolor{keywordtype}{long} \textcolor{keywordtype}{long})(uintptr\_t)event\_info);}
\DoxyCodeLine{\}}

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

\end{DoxyCodeInclude}
Use \textquotesingle{}l\textquotesingle{} and \textquotesingle{}r\textquotesingle{} 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 \textquotesingle{}w\textquotesingle{} 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 \textquotesingle{}d\textquotesingle{} and \textquotesingle{}i\textquotesingle{} keys will increase or decrease the smart object\textquotesingle{}s size -- see how it affects the children\textquotesingle{}s sizes, too. Finally, \textquotesingle{}c\textquotesingle{} will change the color of the smart object\textquotesingle{}s clipper (which is the exact internal clipper coming from a clipped smart object)\+:  
\begin{DoxyCodeInclude}{0}
\DoxyCodeLine{   d.clipper = \mbox{\hyperlink{group__Evas__Smart__Object__Group_ga10342ef3dfaa95ffd70b2883f0be531d}{evas\_object\_smart\_clipped\_clipper\_get}}(d.smt);}
\DoxyCodeLine{   printf(\textcolor{stringliteral}{"{}Checking if clipped smart object's clipper is a "{}}}
\DoxyCodeLine{          \textcolor{stringliteral}{"{}\(\backslash\)"{}static\(\backslash\)"{} one: \%s\(\backslash\)n"{}},}
\DoxyCodeLine{          \mbox{\hyperlink{group__Evas__Object__Group_gaa6b17176deac52b4c52b4380a9a8778a}{evas\_object\_static\_clip\_get}}(d.clipper) ? \textcolor{stringliteral}{"{}yes"{}} : \textcolor{stringliteral}{"{}no"{}});}
\DoxyCodeLine{}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Group__Basic_gab751e9d24c16e74af6f7c08ea5b930c2}{evas\_object\_color\_set}}(}
\DoxyCodeLine{     d.clipper, clipper\_colors[cur\_color].r, clipper\_colors[cur\_color].g,}
\DoxyCodeLine{     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}{0}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{preprocessor}{\#ifdef HAVE\_CONFIG\_H}}
\DoxyCodeLine{\textcolor{preprocessor}{\#include "{}config.h"{}}}
\DoxyCodeLine{\textcolor{preprocessor}{\#else}}
\DoxyCodeLine{\textcolor{preprocessor}{\#define PACKAGE\_EXAMPLES\_DIR "{}."{}}}
\DoxyCodeLine{\textcolor{preprocessor}{\#endif}}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{preprocessor}{\#include <Ecore.h>}}
\DoxyCodeLine{\textcolor{preprocessor}{\#include <\mbox{\hyperlink{Ecore__Evas_8h}{Ecore\_Evas.h}}>}}
\DoxyCodeLine{\textcolor{preprocessor}{\#include <stdio.h>}}
\DoxyCodeLine{\textcolor{preprocessor}{\#include <errno.h>}}
\DoxyCodeLine{\textcolor{preprocessor}{\#include "{}evas-\/common.h"{}}}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{preprocessor}{\#define WIDTH  (320)}}
\DoxyCodeLine{\textcolor{preprocessor}{\#define HEIGHT (240)}}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{keyword}{static} \textcolor{keyword}{const} \textcolor{keywordtype}{char} *commands = \(\backslash\)}
\DoxyCodeLine{  \textcolor{stringliteral}{"{}commands are:\(\backslash\)n"{}}}
\DoxyCodeLine{  \textcolor{stringliteral}{"{}\(\backslash\)tl -\/ insert child rectangle on the left\(\backslash\)n"{}}}
\DoxyCodeLine{  \textcolor{stringliteral}{"{}\(\backslash\)tr -\/ insert child rectangle on the right\(\backslash\)n"{}}}
\DoxyCodeLine{  \textcolor{stringliteral}{"{}\(\backslash\)tw -\/ remove and delete all members from the smart object\(\backslash\)n"{}}}
\DoxyCodeLine{  \textcolor{stringliteral}{"{}\(\backslash\)tright arrow -\/ move smart object to the right\(\backslash\)n"{}}}
\DoxyCodeLine{  \textcolor{stringliteral}{"{}\(\backslash\)tleft arrow -\/ move smart object to the left\(\backslash\)n"{}}}
\DoxyCodeLine{  \textcolor{stringliteral}{"{}\(\backslash\)tup arrow -\/ move smart object up\(\backslash\)n"{}}}
\DoxyCodeLine{  \textcolor{stringliteral}{"{}\(\backslash\)tdown arrow -\/ move smart object down\(\backslash\)n"{}}}
\DoxyCodeLine{  \textcolor{stringliteral}{"{}\(\backslash\)td -\/ decrease smart object's size\(\backslash\)n"{}}}
\DoxyCodeLine{  \textcolor{stringliteral}{"{}\(\backslash\)ti -\/ increase smart object's size\(\backslash\)n"{}}}
\DoxyCodeLine{  \textcolor{stringliteral}{"{}\(\backslash\)tc -\/ change smart object's clipper color\(\backslash\)n"{}}}
\DoxyCodeLine{  \textcolor{stringliteral}{"{}\(\backslash\)t. -\/ rotate object to the right\(\backslash\)n"{}}}
\DoxyCodeLine{  \textcolor{stringliteral}{"{}\(\backslash\)t, -\/ rotate object to the left\(\backslash\)n"{}}}
\DoxyCodeLine{  \textcolor{stringliteral}{"{}\(\backslash\)th -\/ print help\(\backslash\)n"{}}}
\DoxyCodeLine{  \textcolor{stringliteral}{"{}\(\backslash\)tq -\/ quit\(\backslash\)n"{}}}
\DoxyCodeLine{;}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{preprocessor}{\#define WHITE \{255, 255, 255, 255\}}}
\DoxyCodeLine{\textcolor{preprocessor}{\#define RED   \{255, 0, 0, 255\}}}
\DoxyCodeLine{\textcolor{preprocessor}{\#define GREEN \{0, 255, 0, 255\}}}
\DoxyCodeLine{\textcolor{preprocessor}{\#define BLUE  \{0, 0, 255, 255\}}}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{keyword}{struct }test\_data}
\DoxyCodeLine{\{}
\DoxyCodeLine{   Ecore\_Evas  *ee;}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Canvas_ga5ff87cc4ce6bc43e3b640a6d37f73043}{Evas}}        *evas;}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object}} *smt, *bg, *clipper, *rects[2];}
\DoxyCodeLine{\};}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{keyword}{struct }color\_tuple}
\DoxyCodeLine{\{}
\DoxyCodeLine{   \textcolor{keywordtype}{int} r, g, b, a;}
\DoxyCodeLine{\} clipper\_colors[4] = \{WHITE, RED, GREEN, BLUE\};}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{keywordtype}{int} cur\_color = 0;}
\DoxyCodeLine{\textcolor{keywordtype}{int} cur\_angle = 0;}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{keyword}{static} \textcolor{keyword}{const} \textcolor{keywordtype}{char} *}
\DoxyCodeLine{\_index\_to\_color(\textcolor{keywordtype}{int} i)}
\DoxyCodeLine{\{}
\DoxyCodeLine{   \textcolor{keywordflow}{switch} (i)}
\DoxyCodeLine{     \{}
\DoxyCodeLine{      \textcolor{keywordflow}{case} 0:}
\DoxyCodeLine{        \textcolor{keywordflow}{return} \textcolor{stringliteral}{"{}WHITE (default)"{}};}
\DoxyCodeLine{}
\DoxyCodeLine{      \textcolor{keywordflow}{case} 1:}
\DoxyCodeLine{        \textcolor{keywordflow}{return} \textcolor{stringliteral}{"{}RED"{}};}
\DoxyCodeLine{}
\DoxyCodeLine{      \textcolor{keywordflow}{case} 2:}
\DoxyCodeLine{        \textcolor{keywordflow}{return} \textcolor{stringliteral}{"{}GREEN"{}};}
\DoxyCodeLine{}
\DoxyCodeLine{      \textcolor{keywordflow}{case} 3:}
\DoxyCodeLine{        \textcolor{keywordflow}{return} \textcolor{stringliteral}{"{}BLUE"{}};}
\DoxyCodeLine{}
\DoxyCodeLine{      \textcolor{keywordflow}{default}:}
\DoxyCodeLine{        \textcolor{keywordflow}{return} \textcolor{stringliteral}{"{}other"{}};}
\DoxyCodeLine{     \}}
\DoxyCodeLine{\}}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{keyword}{static} \textcolor{keyword}{struct }test\_data d = \{0\};}
\DoxyCodeLine{\textcolor{keyword}{static} \textcolor{keyword}{const} \textcolor{keywordtype}{char} *border\_img\_path = PACKAGE\_EXAMPLES\_DIR EVAS\_IMAGE\_FOLDER \textcolor{stringliteral}{"{}/red.png"{}};}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{preprocessor}{\#define \_evas\_smart\_example\_type "{}Evas\_Smart\_Example"{}}}
\DoxyCodeLine{\textcolor{preprocessor}{\#define EVT\_CHILDREN\_NUMBER\_CHANGED "{}children,changed"{}}}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{keyword}{static} \textcolor{keyword}{const} \mbox{\hyperlink{struct__Evas__Smart__Cb__Description}{Evas\_Smart\_Cb\_Description}} \_smart\_callbacks[] =}
\DoxyCodeLine{\{}
\DoxyCodeLine{   \{EVT\_CHILDREN\_NUMBER\_CHANGED, \textcolor{stringliteral}{"{}i"{}}\},}
\DoxyCodeLine{   \{NULL, NULL\}}
\DoxyCodeLine{\};}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{keyword}{typedef} \textcolor{keyword}{struct }\_Evas\_Smart\_Example\_Data Evas\_Smart\_Example\_Data;}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{comment}{/*}}
\DoxyCodeLine{\textcolor{comment}{ * This structure augments clipped smart object's instance data,}}
\DoxyCodeLine{\textcolor{comment}{ * providing extra members required by our example smart object's}}
\DoxyCodeLine{\textcolor{comment}{ * implementation.}}
\DoxyCodeLine{\textcolor{comment}{ */}}
\DoxyCodeLine{\textcolor{keyword}{struct }\_Evas\_Smart\_Example\_Data}
\DoxyCodeLine{\{}
\DoxyCodeLine{   \mbox{\hyperlink{struct__Evas__Object__Smart__Clipped__Data}{Evas\_Object\_Smart\_Clipped\_Data}} base;}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object}}                   *children[2], *border;}
\DoxyCodeLine{   \textcolor{keywordtype}{int}                            child\_count;}
\DoxyCodeLine{\};}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{preprocessor}{\#define EVAS\_SMART\_EXAMPLE\_DATA\_GET(o, ptr) \(\backslash\)}}
\DoxyCodeLine{\textcolor{preprocessor}{  Evas\_Smart\_Example\_Data * ptr = evas\_object\_smart\_data\_get(o)}}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{preprocessor}{\#define EVAS\_SMART\_EXAMPLE\_DATA\_GET\_OR\_RETURN(o, ptr)        \(\backslash\)}}
\DoxyCodeLine{\textcolor{preprocessor}{  EVAS\_SMART\_EXAMPLE\_DATA\_GET(o, ptr);                       \(\backslash\)}}
\DoxyCodeLine{\textcolor{preprocessor}{  if (!ptr)                                                  \(\backslash\)}}
\DoxyCodeLine{\textcolor{preprocessor}{    \{                                                        \(\backslash\)}}
\DoxyCodeLine{\textcolor{preprocessor}{       fprintf(stderr, "{}No widget data for object \%p (\%s)!"{}}, \(\backslash\)}
\DoxyCodeLine{               o, evas\_object\_type\_get(o));                  \(\backslash\)}
\DoxyCodeLine{       fflush(stderr);                                       \(\backslash\)}
\DoxyCodeLine{       abort();                                              \(\backslash\)}
\DoxyCodeLine{       return;                                               \(\backslash\)}
\DoxyCodeLine{    \}}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{preprocessor}{\#define EVAS\_SMART\_EXAMPLE\_DATA\_GET\_OR\_RETURN\_VAL(o, ptr, val) \(\backslash\)}}
\DoxyCodeLine{\textcolor{preprocessor}{  EVAS\_SMART\_EXAMPLE\_DATA\_GET(o, ptr);                         \(\backslash\)}}
\DoxyCodeLine{\textcolor{preprocessor}{  if (!ptr)                                                    \(\backslash\)}}
\DoxyCodeLine{\textcolor{preprocessor}{    \{                                                          \(\backslash\)}}
\DoxyCodeLine{\textcolor{preprocessor}{       fprintf(stderr, "{}No widget data for object \%p (\%s)!"{}},   \(\backslash\)}
\DoxyCodeLine{               o, evas\_object\_type\_get(o));                    \(\backslash\)}
\DoxyCodeLine{       fflush(stderr);                                         \(\backslash\)}
\DoxyCodeLine{       abort();                                                \(\backslash\)}
\DoxyCodeLine{       return val;                                             \(\backslash\)}
\DoxyCodeLine{    \}}
\DoxyCodeLine{}
\DoxyCodeLine{\mbox{\hyperlink{group__Evas__Smart__Group_ga58dc94af6f064b39b2bf0155908fbe52}{EVAS\_SMART\_SUBCLASS\_NEW}}(\_evas\_smart\_example\_type, \_evas\_smart\_example,}
\DoxyCodeLine{                        \mbox{\hyperlink{struct__Evas__Smart__Class}{Evas\_Smart\_Class}}, \mbox{\hyperlink{struct__Evas__Smart__Class}{Evas\_Smart\_Class}},}
\DoxyCodeLine{                        \mbox{\hyperlink{group__Evas__Smart__Object__Clipped_ga28133d16f3a1f8e3e71d3e80bb78df96}{evas\_object\_smart\_clipped\_class\_get}}, \_smart\_callbacks);}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{keyword}{static} \textcolor{keywordtype}{void}}
\DoxyCodeLine{\_on\_destroy(Ecore\_Evas *ee \mbox{\hyperlink{group__Eina__Types__Group_ga82d751be730f849719ca292f9558be87}{EINA\_UNUSED}})}
\DoxyCodeLine{\{}
\DoxyCodeLine{   \mbox{\hyperlink{group__Ecore__Main__Loop__Group_ga95cf8e97dff0716433c2c5474d606a98}{ecore\_main\_loop\_quit}}();}
\DoxyCodeLine{\}}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{comment}{/* Keep the example's window size in sync with the background image's size */}}
\DoxyCodeLine{\textcolor{keyword}{static} \textcolor{keywordtype}{void}}
\DoxyCodeLine{\_canvas\_resize\_cb(Ecore\_Evas *ee)}
\DoxyCodeLine{\{}
\DoxyCodeLine{   \textcolor{keywordtype}{int} w, h;}
\DoxyCodeLine{}
\DoxyCodeLine{   \mbox{\hyperlink{group__Ecore__Evas__Group_ga931aadf4603731e73e8a84e4b14f1493}{ecore\_evas\_geometry\_get}}(ee, NULL, NULL, \&w, \&h);}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Group_gacad94595f83580c18908cb3b69b08d1a}{evas\_object\_resize}}(d.bg, w, h);}
\DoxyCodeLine{\}}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{keyword}{static} \textcolor{keywordtype}{void}}
\DoxyCodeLine{\_on\_child\_del(\textcolor{keywordtype}{void} *data,}
\DoxyCodeLine{              \mbox{\hyperlink{group__Evas__Canvas_ga5ff87cc4ce6bc43e3b640a6d37f73043}{Evas}} *evas \mbox{\hyperlink{group__Eina__Types__Group_ga82d751be730f849719ca292f9558be87}{EINA\_UNUSED}},}
\DoxyCodeLine{              \mbox{\hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object}} *o,}
\DoxyCodeLine{              \textcolor{keywordtype}{void} *einfo \mbox{\hyperlink{group__Eina__Types__Group_ga82d751be730f849719ca292f9558be87}{EINA\_UNUSED}})}
\DoxyCodeLine{\{}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object}} *example\_smart = data;}
\DoxyCodeLine{   \textcolor{keywordtype}{long} idx;}
\DoxyCodeLine{}
\DoxyCodeLine{   EVAS\_SMART\_EXAMPLE\_DATA\_GET(example\_smart, priv);}
\DoxyCodeLine{}
\DoxyCodeLine{   idx = (long)(uintptr\_t)\mbox{\hyperlink{group__Evas__Object__Group__Extras_ga3b85d805f879e71beed360650dda697b}{evas\_object\_data\_get}}(o, \textcolor{stringliteral}{"{}index"{}});}
\DoxyCodeLine{   idx-\/-\/;}
\DoxyCodeLine{}
\DoxyCodeLine{   priv-\/>children[idx] = NULL;}
\DoxyCodeLine{}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Smart__Object__Group_ga78c93f6fa35318e60285b6e328616a0d}{evas\_object\_smart\_member\_del}}(o);}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Smart__Object__Group_ga34af89b79d133e3fe3ff4e8102658f4e}{evas\_object\_smart\_changed}}(example\_smart);}
\DoxyCodeLine{\}}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{keyword}{static} \textcolor{keywordtype}{void}}
\DoxyCodeLine{\_evas\_smart\_example\_child\_callbacks\_unregister(\mbox{\hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object}} *obj)}
\DoxyCodeLine{\{}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Group__Extras_ga3061f8abe8f1a1f657d622ae0409d8e3}{evas\_object\_data\_set}}(obj, \textcolor{stringliteral}{"{}index"{}}, NULL);}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Group__Events_ga4de7493592c317e184341042723c4377}{evas\_object\_event\_callback\_del}}(obj, \mbox{\hyperlink{Evas__Common_8h_ad64cde0da38a60e7cb7905b3ab216968aab869b5d534f02f1b3e151e2406a8c24}{EVAS\_CALLBACK\_FREE}}, \_on\_child\_del);}
\DoxyCodeLine{\}}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{keyword}{static} \textcolor{keywordtype}{void}}
\DoxyCodeLine{\_evas\_smart\_example\_child\_callbacks\_register(\mbox{\hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object}} *o,}
\DoxyCodeLine{                                             \mbox{\hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object}} *child,}
\DoxyCodeLine{                                             \textcolor{keywordtype}{long} idx)}
\DoxyCodeLine{\{}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Group__Events_gac71a1038dad71da36f57b70c8ad10252}{evas\_object\_event\_callback\_add}}(child, \mbox{\hyperlink{Evas__Common_8h_ad64cde0da38a60e7cb7905b3ab216968aab869b5d534f02f1b3e151e2406a8c24}{EVAS\_CALLBACK\_FREE}}, \_on\_child\_del, o);}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Group__Extras_ga3061f8abe8f1a1f657d622ae0409d8e3}{evas\_object\_data\_set}}(child, \textcolor{stringliteral}{"{}index"{}}, (\textcolor{keywordtype}{void} *)(uintptr\_t)(++idx));}
\DoxyCodeLine{\}}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{comment}{/* create and setup a new example smart object's internals */}}
\DoxyCodeLine{\textcolor{keyword}{static} \textcolor{keywordtype}{void}}
\DoxyCodeLine{\_evas\_smart\_example\_smart\_add(\mbox{\hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object}} *o)}
\DoxyCodeLine{\{}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Smart__Group_ga4aa4b72aafa0391144fb0171aeff2ccd}{EVAS\_SMART\_DATA\_ALLOC}}(o, Evas\_Smart\_Example\_Data);}
\DoxyCodeLine{}
\DoxyCodeLine{   \textcolor{comment}{/* call parent\_sc-\/>add() before member\_adding the children, otherwise the}}
\DoxyCodeLine{\textcolor{comment}{    * smart object's clipper won't be created yet, and the children won't be}}
\DoxyCodeLine{\textcolor{comment}{    * clipped to it */}}
\DoxyCodeLine{   \_evas\_smart\_example\_parent\_sc-\/>add(o);}
\DoxyCodeLine{}
\DoxyCodeLine{   \textcolor{comment}{/* this is a border around the smart object's area, delimiting it */}}
\DoxyCodeLine{   priv-\/>border = \mbox{\hyperlink{group__Evas__Object__Image_gafb52be265f315186a28d43af2d559ec6}{evas\_object\_image\_filled\_add}}(\mbox{\hyperlink{group__Evas__Object__Group_ga7e211219d11abced5f3089362f7476b9}{evas\_object\_evas\_get}}(o));}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Image_gac2e588476b16b04f85ca9a594c140c1d}{evas\_object\_image\_file\_set}}(priv-\/>border, border\_img\_path, NULL);}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Image_ga063e5ad38b43897311bbdecfe8dc312d}{evas\_object\_image\_border\_set}}(priv-\/>border, 3, 3, 3, 3);}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Image_ga5749943ce62e85ead67a1440960677fa}{evas\_object\_image\_border\_center\_fill\_set}}(}
\DoxyCodeLine{     priv-\/>border, \mbox{\hyperlink{group__Evas__Object__Image_gga9f789224285e646309b7dd81a2401910a2ad856ac6aab5e2659c3a584a37aec70}{EVAS\_BORDER\_FILL\_NONE}});}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Group__Basic_ga07208fcafd4739de606bc35fff684bf5}{evas\_object\_show}}(priv-\/>border);}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Smart__Object__Group_gaaba101400666797eabd678727b48f7c1}{evas\_object\_smart\_member\_add}}(priv-\/>border, o);}
\DoxyCodeLine{\}}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{keyword}{static} \textcolor{keywordtype}{void}}
\DoxyCodeLine{\_evas\_smart\_example\_smart\_del(\mbox{\hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object}} *o)}
\DoxyCodeLine{\{}
\DoxyCodeLine{   EVAS\_SMART\_EXAMPLE\_DATA\_GET(o, priv);}
\DoxyCodeLine{}
\DoxyCodeLine{   \textcolor{keywordflow}{if} (priv-\/>children[0])}
\DoxyCodeLine{     \{}
\DoxyCodeLine{        \_evas\_smart\_example\_child\_callbacks\_unregister(priv-\/>children[0]);}
\DoxyCodeLine{        priv-\/>children[0] = NULL;}
\DoxyCodeLine{     \}}
\DoxyCodeLine{}
\DoxyCodeLine{   \textcolor{keywordflow}{if} (priv-\/>children[1])}
\DoxyCodeLine{     \{}
\DoxyCodeLine{        \_evas\_smart\_example\_child\_callbacks\_unregister(priv-\/>children[1]);}
\DoxyCodeLine{        priv-\/>children[1] = NULL;}
\DoxyCodeLine{     \}}
\DoxyCodeLine{}
\DoxyCodeLine{   \_evas\_smart\_example\_parent\_sc-\/>del(o);}
\DoxyCodeLine{\}}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{keyword}{static} \textcolor{keywordtype}{void}}
\DoxyCodeLine{\_evas\_smart\_example\_smart\_resize(\mbox{\hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object}} *o,}
\DoxyCodeLine{                                 \mbox{\hyperlink{Evas__Common_8h_a2453e92182bad3b0e0d84e5aff433b07}{Evas\_Coord}} w,}
\DoxyCodeLine{                                 \mbox{\hyperlink{Evas__Common_8h_a2453e92182bad3b0e0d84e5aff433b07}{Evas\_Coord}} h)}
\DoxyCodeLine{\{}
\DoxyCodeLine{   \mbox{\hyperlink{Evas__Common_8h_a2453e92182bad3b0e0d84e5aff433b07}{Evas\_Coord}} ow, oh;}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Group__Basic_ga6e8e78e110392480dd612df86a16b630}{evas\_object\_geometry\_get}}(o, NULL, NULL, \&ow, \&oh);}
\DoxyCodeLine{   \textcolor{keywordflow}{if} ((ow == w) \&\& (oh == h)) \textcolor{keywordflow}{return};}
\DoxyCodeLine{}
\DoxyCodeLine{   \textcolor{comment}{/* this will trigger recalculation */}}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Smart__Object__Group_ga34af89b79d133e3fe3ff4e8102658f4e}{evas\_object\_smart\_changed}}(o);}
\DoxyCodeLine{\}}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{comment}{/* act on child objects' properties, before rendering */}}
\DoxyCodeLine{\textcolor{keyword}{static} \textcolor{keywordtype}{void}}
\DoxyCodeLine{\_evas\_smart\_example\_smart\_calculate(\mbox{\hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object}} *o)}
\DoxyCodeLine{\{}
\DoxyCodeLine{   \mbox{\hyperlink{Evas__Common_8h_a2453e92182bad3b0e0d84e5aff433b07}{Evas\_Coord}} x, y, w, h;}
\DoxyCodeLine{}
\DoxyCodeLine{   EVAS\_SMART\_EXAMPLE\_DATA\_GET\_OR\_RETURN(o, priv);}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Group__Basic_ga6e8e78e110392480dd612df86a16b630}{evas\_object\_geometry\_get}}(o, \&x, \&y, \&w, \&h);}
\DoxyCodeLine{}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Group_gacad94595f83580c18908cb3b69b08d1a}{evas\_object\_resize}}(priv-\/>border, w, h);}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Group_ga335c8ee6eaeaac9710656af4f8b0db91}{evas\_object\_move}}(priv-\/>border, x, y);}
\DoxyCodeLine{}
\DoxyCodeLine{   \textcolor{keywordflow}{if} (priv-\/>children[0])}
\DoxyCodeLine{     \{}
\DoxyCodeLine{        \mbox{\hyperlink{group__Evas__Object__Group_ga335c8ee6eaeaac9710656af4f8b0db91}{evas\_object\_move}}(priv-\/>children[0], x + 3, y + 3);}
\DoxyCodeLine{        \mbox{\hyperlink{group__Evas__Object__Group_gacad94595f83580c18908cb3b69b08d1a}{evas\_object\_resize}}(priv-\/>children[0], (w / 2) -\/ 3, (h / 2) -\/ 3);}
\DoxyCodeLine{     \}}
\DoxyCodeLine{}
\DoxyCodeLine{   \textcolor{keywordflow}{if} (priv-\/>children[1])}
\DoxyCodeLine{     \{}
\DoxyCodeLine{        \mbox{\hyperlink{group__Evas__Object__Group_ga335c8ee6eaeaac9710656af4f8b0db91}{evas\_object\_move}}(priv-\/>children[1], x + (w / 2), y + (h / 2));}
\DoxyCodeLine{        \mbox{\hyperlink{group__Evas__Object__Group_gacad94595f83580c18908cb3b69b08d1a}{evas\_object\_resize}}(priv-\/>children[1], (w / 2) -\/ 3, (h / 2) -\/ 3);}
\DoxyCodeLine{     \}}
\DoxyCodeLine{\}}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{comment}{/* setting our smart interface */}}
\DoxyCodeLine{\textcolor{keyword}{static} \textcolor{keywordtype}{void}}
\DoxyCodeLine{\_evas\_smart\_example\_smart\_set\_user(\mbox{\hyperlink{struct__Evas__Smart__Class}{Evas\_Smart\_Class}} *sc)}
\DoxyCodeLine{\{}
\DoxyCodeLine{   \textcolor{comment}{/* specializing these two */}}
\DoxyCodeLine{   sc-\/>\mbox{\hyperlink{struct__Evas__Smart__Class_a044206688a3b0ea9785688d2efcea4d6}{add}} = \_evas\_smart\_example\_smart\_add;}
\DoxyCodeLine{   sc-\/>\mbox{\hyperlink{struct__Evas__Smart__Class_a1dd96f1c822fefaa68025e35de0bbde7}{del}} = \_evas\_smart\_example\_smart\_del;}
\DoxyCodeLine{}
\DoxyCodeLine{   \textcolor{comment}{/* clipped smart object has no hook on resizes or calculations */}}
\DoxyCodeLine{   sc-\/>\mbox{\hyperlink{struct__Evas__Smart__Class_afb95f2f5616403d43c464a4d939bdcfa}{resize}} = \_evas\_smart\_example\_smart\_resize;}
\DoxyCodeLine{   sc-\/>\mbox{\hyperlink{struct__Evas__Smart__Class_a495fe27fb074354ccaf9ebc68165ed69}{calculate}} = \_evas\_smart\_example\_smart\_calculate;}
\DoxyCodeLine{\}}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{comment}{/* BEGINS example smart object's own interface */}}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{comment}{/* add a new example smart object to a canvas */}}
\DoxyCodeLine{\mbox{\hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object}} *}
\DoxyCodeLine{evas\_smart\_example\_add(\mbox{\hyperlink{group__Evas__Canvas_ga5ff87cc4ce6bc43e3b640a6d37f73043}{Evas}} *evas)}
\DoxyCodeLine{\{}
\DoxyCodeLine{   \textcolor{keywordflow}{return} \mbox{\hyperlink{group__Evas__Smart__Object__Group_ga6689aaee0f614404be7dc7c3d31a23e0}{evas\_object\_smart\_add}}(evas, \_evas\_smart\_example\_smart\_class\_new());}
\DoxyCodeLine{\}}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{keyword}{static} \textcolor{keywordtype}{void}}
\DoxyCodeLine{\_evas\_smart\_example\_remove\_do(Evas\_Smart\_Example\_Data *priv,}
\DoxyCodeLine{                              \mbox{\hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object}} *child,}
\DoxyCodeLine{                              \textcolor{keywordtype}{int} idx)}
\DoxyCodeLine{\{}
\DoxyCodeLine{   priv-\/>children[idx] = NULL;}
\DoxyCodeLine{   priv-\/>child\_count-\/-\/;}
\DoxyCodeLine{   \_evas\_smart\_example\_child\_callbacks\_unregister(child);}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Smart__Object__Group_ga78c93f6fa35318e60285b6e328616a0d}{evas\_object\_smart\_member\_del}}(child);}
\DoxyCodeLine{\}}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{comment}{/* remove a child element, return its pointer (or NULL on errors) */}}
\DoxyCodeLine{\mbox{\hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object}} *}
\DoxyCodeLine{evas\_smart\_example\_remove(\mbox{\hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object}} *o,}
\DoxyCodeLine{                          \mbox{\hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object}} *child)}
\DoxyCodeLine{\{}
\DoxyCodeLine{   \textcolor{keywordtype}{long} idx;}
\DoxyCodeLine{}
\DoxyCodeLine{   EVAS\_SMART\_EXAMPLE\_DATA\_GET\_OR\_RETURN\_VAL(o, priv, NULL);}
\DoxyCodeLine{}
\DoxyCodeLine{   \textcolor{keywordflow}{if} (priv-\/>children[0] != child \&\& priv-\/>children[1] != child)}
\DoxyCodeLine{     \{}
\DoxyCodeLine{        fprintf(stderr, \textcolor{stringliteral}{"{}You are trying to remove something not belonging to"{}}}
\DoxyCodeLine{                        \textcolor{stringliteral}{"{} the example smart object!\(\backslash\)n"{}});}
\DoxyCodeLine{        \textcolor{keywordflow}{return} NULL;}
\DoxyCodeLine{     \}}
\DoxyCodeLine{}
\DoxyCodeLine{   idx = (long)(uintptr\_t)\mbox{\hyperlink{group__Evas__Object__Group__Extras_ga3b85d805f879e71beed360650dda697b}{evas\_object\_data\_get}}(child, \textcolor{stringliteral}{"{}index"{}});}
\DoxyCodeLine{   idx-\/-\/;}
\DoxyCodeLine{}
\DoxyCodeLine{   \_evas\_smart\_example\_remove\_do(priv, child, idx);}
\DoxyCodeLine{}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Smart__Object__Group_ga684daaa265375789a2e0f2fa15333512}{evas\_object\_smart\_callback\_call}}(}
\DoxyCodeLine{     o, EVT\_CHILDREN\_NUMBER\_CHANGED, (\textcolor{keywordtype}{void} *)(uintptr\_t)priv-\/>child\_count);}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Smart__Object__Group_ga34af89b79d133e3fe3ff4e8102658f4e}{evas\_object\_smart\_changed}}(o);}
\DoxyCodeLine{}
\DoxyCodeLine{   \textcolor{keywordflow}{return} child;}
\DoxyCodeLine{\}}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{comment}{/* set to return any previous object set to the left position of the}}
\DoxyCodeLine{\textcolor{comment}{ * smart object or NULL, if any (or on errors) */}}
\DoxyCodeLine{\mbox{\hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object}} *}
\DoxyCodeLine{evas\_smart\_example\_set\_left(\mbox{\hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object}} *o,}
\DoxyCodeLine{                            \mbox{\hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object}} *child)}
\DoxyCodeLine{\{}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object}} *ret = NULL;}
\DoxyCodeLine{}
\DoxyCodeLine{   EVAS\_SMART\_EXAMPLE\_DATA\_GET\_OR\_RETURN\_VAL(o, priv, NULL);}
\DoxyCodeLine{   \textcolor{keywordflow}{if} (!child)}
\DoxyCodeLine{     \textcolor{keywordflow}{return} NULL;}
\DoxyCodeLine{}
\DoxyCodeLine{   \textcolor{keywordflow}{if} (priv-\/>children[1] == child)}
\DoxyCodeLine{     \{}
\DoxyCodeLine{        fprintf(stderr, \textcolor{stringliteral}{"{}You mustn't place a child on both slots of"{}}}
\DoxyCodeLine{                        \textcolor{stringliteral}{"{} the example smart object!\(\backslash\)n"{}});}
\DoxyCodeLine{        \textcolor{keywordflow}{return} NULL;}
\DoxyCodeLine{     \}}
\DoxyCodeLine{}
\DoxyCodeLine{   \textcolor{keywordflow}{if} (priv-\/>children[0])}
\DoxyCodeLine{     \{}
\DoxyCodeLine{        \textcolor{keywordflow}{if} (priv-\/>children[0] != child)}
\DoxyCodeLine{          \{}
\DoxyCodeLine{             ret = priv-\/>children[0];}
\DoxyCodeLine{             \_evas\_smart\_example\_remove\_do(priv, priv-\/>children[0], 0);}
\DoxyCodeLine{          \}}
\DoxyCodeLine{        \textcolor{keywordflow}{else} \textcolor{keywordflow}{return} child;}
\DoxyCodeLine{     \}}
\DoxyCodeLine{}
\DoxyCodeLine{   priv-\/>children[0] = child;}
\DoxyCodeLine{   \_evas\_smart\_example\_child\_callbacks\_register(o, child, 0);}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Smart__Object__Group_gaaba101400666797eabd678727b48f7c1}{evas\_object\_smart\_member\_add}}(child, o);}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Smart__Object__Group_ga34af89b79d133e3fe3ff4e8102658f4e}{evas\_object\_smart\_changed}}(o);}
\DoxyCodeLine{}
\DoxyCodeLine{   priv-\/>child\_count++;}
\DoxyCodeLine{   \textcolor{keywordflow}{if} (!ret)}
\DoxyCodeLine{     \{}
\DoxyCodeLine{        \mbox{\hyperlink{group__Evas__Smart__Object__Group_ga684daaa265375789a2e0f2fa15333512}{evas\_object\_smart\_callback\_call}}(}
\DoxyCodeLine{          o, EVT\_CHILDREN\_NUMBER\_CHANGED, (\textcolor{keywordtype}{void} *)(uintptr\_t)priv-\/>child\_count);}
\DoxyCodeLine{     \}}
\DoxyCodeLine{}
\DoxyCodeLine{   \textcolor{keywordflow}{return} ret;}
\DoxyCodeLine{\}}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{comment}{/* set to return any previous object set to the right position of the}}
\DoxyCodeLine{\textcolor{comment}{ * smart object or NULL, if any (or on errors) */}}
\DoxyCodeLine{\mbox{\hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object}} *}
\DoxyCodeLine{evas\_smart\_example\_set\_right(\mbox{\hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object}} *o,}
\DoxyCodeLine{                             \mbox{\hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object}} *child)}
\DoxyCodeLine{\{}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object}} *ret = NULL;}
\DoxyCodeLine{}
\DoxyCodeLine{   EVAS\_SMART\_EXAMPLE\_DATA\_GET\_OR\_RETURN\_VAL(o, priv, NULL);}
\DoxyCodeLine{   \textcolor{keywordflow}{if} (!child)}
\DoxyCodeLine{     \textcolor{keywordflow}{return} NULL;}
\DoxyCodeLine{}
\DoxyCodeLine{   \textcolor{keywordflow}{if} (priv-\/>children[0] == child)}
\DoxyCodeLine{     \{}
\DoxyCodeLine{        fprintf(stderr, \textcolor{stringliteral}{"{}You mustn't place a child on both slots of"{}}}
\DoxyCodeLine{                        \textcolor{stringliteral}{"{} the example smart object!\(\backslash\)n"{}});}
\DoxyCodeLine{        \textcolor{keywordflow}{return} NULL;}
\DoxyCodeLine{     \}}
\DoxyCodeLine{}
\DoxyCodeLine{   \textcolor{keywordflow}{if} (priv-\/>children[1])}
\DoxyCodeLine{     \{}
\DoxyCodeLine{        \textcolor{keywordflow}{if} (priv-\/>children[1] != child)}
\DoxyCodeLine{          \{}
\DoxyCodeLine{             ret = priv-\/>children[1];}
\DoxyCodeLine{             \_evas\_smart\_example\_remove\_do(priv, priv-\/>children[1], 1);}
\DoxyCodeLine{          \}}
\DoxyCodeLine{        \textcolor{keywordflow}{else} \textcolor{keywordflow}{return} child;}
\DoxyCodeLine{     \}}
\DoxyCodeLine{}
\DoxyCodeLine{   priv-\/>children[1] = child;}
\DoxyCodeLine{   \_evas\_smart\_example\_child\_callbacks\_register(o, child, 1);}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Smart__Object__Group_gaaba101400666797eabd678727b48f7c1}{evas\_object\_smart\_member\_add}}(child, o);}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Smart__Object__Group_ga34af89b79d133e3fe3ff4e8102658f4e}{evas\_object\_smart\_changed}}(o);}
\DoxyCodeLine{}
\DoxyCodeLine{   priv-\/>child\_count++;}
\DoxyCodeLine{   \textcolor{keywordflow}{if} (!ret)}
\DoxyCodeLine{     \{}
\DoxyCodeLine{        \mbox{\hyperlink{group__Evas__Smart__Object__Group_ga684daaa265375789a2e0f2fa15333512}{evas\_object\_smart\_callback\_call}}(}
\DoxyCodeLine{          o, EVT\_CHILDREN\_NUMBER\_CHANGED, (\textcolor{keywordtype}{void} *)(uintptr\_t)priv-\/>child\_count);}
\DoxyCodeLine{     \}}
\DoxyCodeLine{}
\DoxyCodeLine{   \textcolor{keywordflow}{return} ret;}
\DoxyCodeLine{\}}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{comment}{/* END OF example smart object's own interface */}}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{keyword}{static} \textcolor{keywordtype}{void}}
\DoxyCodeLine{\_map\_update(\textcolor{keywordtype}{void})}
\DoxyCodeLine{\{}
\DoxyCodeLine{   Evas\_Map *m;}
\DoxyCodeLine{   \mbox{\hyperlink{Evas__Common_8h_a2453e92182bad3b0e0d84e5aff433b07}{Evas\_Coord}} x, y, w, h;}
\DoxyCodeLine{}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Group__Basic_ga6e8e78e110392480dd612df86a16b630}{evas\_object\_geometry\_get}}(d.smt, \&x, \&y, \&w, \&h);}
\DoxyCodeLine{   m = \mbox{\hyperlink{group__Evas__Object__Group__Map_gae1a034340cc380623a82c1b84f6a5525}{evas\_map\_new}}(4);}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Group__Map_gaa7f9acff0a474fbd529f3ecbc2727a6b}{evas\_map\_util\_points\_populate\_from\_object}}(m, d.smt);}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Group__Map_ga1833b01762fdfd6be0d356aa94a3aa1c}{evas\_map\_util\_rotate}}(m, cur\_angle, x + (w / 2), y + (h / 2));}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Group_gadbb970a1e0da91183bab3af1eb276953}{evas\_object\_map\_set}}(d.smt, m);}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Group_gafca4ed9f6cb6063ff7e8d9193418129e}{evas\_object\_map\_enable\_set}}(d.smt, \mbox{\hyperlink{group__Eina__Types__Group_ga05c12dacc8b4058994df842b41be85fc}{EINA\_TRUE}});}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Group__Map_ga219c74ba8e2a4ae4525d2f331b8b5e0a}{evas\_map\_free}}(m);}
\DoxyCodeLine{\}}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{keyword}{static} \textcolor{keywordtype}{void}}
\DoxyCodeLine{\_on\_keydown(\textcolor{keywordtype}{void} *data \mbox{\hyperlink{group__Eina__Types__Group_ga82d751be730f849719ca292f9558be87}{EINA\_UNUSED}},}
\DoxyCodeLine{            \mbox{\hyperlink{group__Evas__Canvas_ga5ff87cc4ce6bc43e3b640a6d37f73043}{Evas}} *evas \mbox{\hyperlink{group__Eina__Types__Group_ga82d751be730f849719ca292f9558be87}{EINA\_UNUSED}},}
\DoxyCodeLine{            \mbox{\hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object}} *o \mbox{\hyperlink{group__Eina__Types__Group_ga82d751be730f849719ca292f9558be87}{EINA\_UNUSED}},}
\DoxyCodeLine{            \textcolor{keywordtype}{void} *einfo)}
\DoxyCodeLine{\{}
\DoxyCodeLine{   \mbox{\hyperlink{struct__Evas__Event__Key__Down}{Evas\_Event\_Key\_Down}} *ev = einfo;}
\DoxyCodeLine{}
\DoxyCodeLine{   \textcolor{keywordflow}{if} (strcmp(ev-\/>\mbox{\hyperlink{struct__Evas__Event__Key__Down_a70473bba88a1afaee180a54150513824}{key}}, \textcolor{stringliteral}{"{}q"{}}) == 0) \textcolor{comment}{/* print help */}}
\DoxyCodeLine{     \{}
\DoxyCodeLine{        \_on\_destroy(NULL);}
\DoxyCodeLine{        \textcolor{keywordflow}{return};}
\DoxyCodeLine{     \}}
\DoxyCodeLine{}
\DoxyCodeLine{   \textcolor{keywordflow}{if} (strcmp(ev-\/>\mbox{\hyperlink{struct__Evas__Event__Key__Down_a70473bba88a1afaee180a54150513824}{key}}, \textcolor{stringliteral}{"{}h"{}}) == 0) \textcolor{comment}{/* print help */}}
\DoxyCodeLine{     \{}
\DoxyCodeLine{        puts(commands);}
\DoxyCodeLine{        \textcolor{keywordflow}{return};}
\DoxyCodeLine{     \}}
\DoxyCodeLine{}
\DoxyCodeLine{   \textcolor{keywordflow}{if} (strcmp(ev-\/>\mbox{\hyperlink{struct__Evas__Event__Key__Down_a70473bba88a1afaee180a54150513824}{key}}, \textcolor{stringliteral}{"{}w"{}}) == 0) \textcolor{comment}{/* clear out smart object (WRT}}
\DoxyCodeLine{\textcolor{comment}{                                       * members) */}}
\DoxyCodeLine{     \{}
\DoxyCodeLine{        \textcolor{keywordflow}{if} (d.rects[0])}
\DoxyCodeLine{          \{}
\DoxyCodeLine{             evas\_smart\_example\_remove(d.smt, d.rects[0]);}
\DoxyCodeLine{             \mbox{\hyperlink{group__Evas__Object__Group__Basic_ga9217cf1d90690dbd1960db155d1c7476}{evas\_object\_del}}(d.rects[0]);}
\DoxyCodeLine{          \}}
\DoxyCodeLine{        \textcolor{keywordflow}{if} (d.rects[1])}
\DoxyCodeLine{          \{}
\DoxyCodeLine{             evas\_smart\_example\_remove(d.smt, d.rects[1]);}
\DoxyCodeLine{             \mbox{\hyperlink{group__Evas__Object__Group__Basic_ga9217cf1d90690dbd1960db155d1c7476}{evas\_object\_del}}(d.rects[1]);}
\DoxyCodeLine{          \}}
\DoxyCodeLine{}
\DoxyCodeLine{        memset(d.rects, 0, \textcolor{keyword}{sizeof}(d.rects));}
\DoxyCodeLine{}
\DoxyCodeLine{        printf(\textcolor{stringliteral}{"{}Deleting all members of the smart object.\(\backslash\)n"{}});}
\DoxyCodeLine{}
\DoxyCodeLine{        \textcolor{keywordflow}{return};}
\DoxyCodeLine{     \}}
\DoxyCodeLine{}
\DoxyCodeLine{   \textcolor{keywordflow}{if} (strcmp(ev-\/>\mbox{\hyperlink{struct__Evas__Event__Key__Down_a70473bba88a1afaee180a54150513824}{key}}, \textcolor{stringliteral}{"{}l"{}}) == 0) \textcolor{comment}{/* insert random colored}}
\DoxyCodeLine{\textcolor{comment}{                                       * rectangle on the left */}}
\DoxyCodeLine{     \{}
\DoxyCodeLine{        \mbox{\hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object}} *rect = \mbox{\hyperlink{group__Evas__Object__Rectangle_ga1b7a9d8e6ce240590c1734da5f3449d2}{evas\_object\_rectangle\_add}}(d.evas), *prev;}
\DoxyCodeLine{        \mbox{\hyperlink{group__Evas__Object__Group__Basic_gab751e9d24c16e74af6f7c08ea5b930c2}{evas\_object\_color\_set}}(}
\DoxyCodeLine{          rect, rand() \% 255, rand() \% 255, rand() \% 255, 255);}
\DoxyCodeLine{        \mbox{\hyperlink{group__Evas__Object__Group__Basic_ga07208fcafd4739de606bc35fff684bf5}{evas\_object\_show}}(rect);}
\DoxyCodeLine{}
\DoxyCodeLine{        prev = evas\_smart\_example\_set\_left(d.smt, rect);}
\DoxyCodeLine{        d.rects[0] = rect;}
\DoxyCodeLine{}
\DoxyCodeLine{        printf(\textcolor{stringliteral}{"{}Setting smart object's left spot with a new rectangle.\(\backslash\)n"{}});}
\DoxyCodeLine{        printf(\textcolor{stringliteral}{"{}Checking its new smart object parent: \%s\(\backslash\)n"{}},}
\DoxyCodeLine{               \mbox{\hyperlink{group__Evas__Object__Group_gab52f8ec7031f10d455222940ed400489}{evas\_object\_smart\_parent\_get}}(rect) == d.smt ? \textcolor{stringliteral}{"{}OK!"{}} :}
\DoxyCodeLine{               \textcolor{stringliteral}{"{}Failure!"{}});}
\DoxyCodeLine{        \textcolor{keywordflow}{if} (prev)}
\DoxyCodeLine{          \{}
\DoxyCodeLine{             \textcolor{keywordtype}{int} r, g, b;}
\DoxyCodeLine{}
\DoxyCodeLine{             \mbox{\hyperlink{group__Evas__Object__Group__Basic_gad204691b53639244ee1062d3f349f1d9}{evas\_object\_color\_get}}(prev, \&r, \&g, \&b, NULL);}
\DoxyCodeLine{             printf(\textcolor{stringliteral}{"{}Deleting previous left child,"{}}}
\DoxyCodeLine{                    \textcolor{stringliteral}{"{} which had colors (\%d, \%d, \%d)\(\backslash\)n"{}}, r, g, b);}
\DoxyCodeLine{             \mbox{\hyperlink{group__Evas__Object__Group__Basic_ga9217cf1d90690dbd1960db155d1c7476}{evas\_object\_del}}(prev);}
\DoxyCodeLine{          \}}
\DoxyCodeLine{}
\DoxyCodeLine{        \textcolor{keywordflow}{return};}
\DoxyCodeLine{     \}}
\DoxyCodeLine{}
\DoxyCodeLine{   \textcolor{keywordflow}{if} (strcmp(ev-\/>\mbox{\hyperlink{struct__Evas__Event__Key__Down_a70473bba88a1afaee180a54150513824}{key}}, \textcolor{stringliteral}{"{}r"{}}) == 0) \textcolor{comment}{/* insert random colored}}
\DoxyCodeLine{\textcolor{comment}{                                       * rectangle on the right */}}
\DoxyCodeLine{     \{}
\DoxyCodeLine{        \mbox{\hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object}} *rect = \mbox{\hyperlink{group__Evas__Object__Rectangle_ga1b7a9d8e6ce240590c1734da5f3449d2}{evas\_object\_rectangle\_add}}(d.evas), *prev;}
\DoxyCodeLine{        \mbox{\hyperlink{group__Evas__Object__Group__Basic_gab751e9d24c16e74af6f7c08ea5b930c2}{evas\_object\_color\_set}}(}
\DoxyCodeLine{          rect, rand() \% 255, rand() \% 255, rand() \% 255, 255);}
\DoxyCodeLine{        \mbox{\hyperlink{group__Evas__Object__Group__Basic_ga07208fcafd4739de606bc35fff684bf5}{evas\_object\_show}}(rect);}
\DoxyCodeLine{}
\DoxyCodeLine{        prev = evas\_smart\_example\_set\_right(d.smt, rect);}
\DoxyCodeLine{        d.rects[1] = rect;}
\DoxyCodeLine{}
\DoxyCodeLine{        printf(\textcolor{stringliteral}{"{}Setting smart object's right spot with a new rectangle.\(\backslash\)n"{}});}
\DoxyCodeLine{        printf(\textcolor{stringliteral}{"{}Checking its new smart object parent: \%s\(\backslash\)n"{}},}
\DoxyCodeLine{               \mbox{\hyperlink{group__Evas__Object__Group_gab52f8ec7031f10d455222940ed400489}{evas\_object\_smart\_parent\_get}}(rect) == d.smt ? \textcolor{stringliteral}{"{}OK!"{}} :}
\DoxyCodeLine{               \textcolor{stringliteral}{"{}Failure!"{}});}
\DoxyCodeLine{        \textcolor{keywordflow}{if} (prev)}
\DoxyCodeLine{          \{}
\DoxyCodeLine{             \textcolor{keywordtype}{int} r, g, b;}
\DoxyCodeLine{}
\DoxyCodeLine{             \mbox{\hyperlink{group__Evas__Object__Group__Basic_gad204691b53639244ee1062d3f349f1d9}{evas\_object\_color\_get}}(prev, \&r, \&g, \&b, NULL);}
\DoxyCodeLine{             printf(\textcolor{stringliteral}{"{}Deleting previous right child,"{}}}
\DoxyCodeLine{                    \textcolor{stringliteral}{"{} which had colors (\%d, \%d, \%d)\(\backslash\)n"{}}, r, g, b);}
\DoxyCodeLine{             \mbox{\hyperlink{group__Evas__Object__Group__Basic_ga9217cf1d90690dbd1960db155d1c7476}{evas\_object\_del}}(prev);}
\DoxyCodeLine{          \}}
\DoxyCodeLine{}
\DoxyCodeLine{        \textcolor{keywordflow}{return};}
\DoxyCodeLine{     \}}
\DoxyCodeLine{}
\DoxyCodeLine{   \textcolor{comment}{/* move smart object along the canvas */}}
\DoxyCodeLine{   \textcolor{keywordflow}{if} (strcmp(ev-\/>\mbox{\hyperlink{struct__Evas__Event__Key__Down_a70473bba88a1afaee180a54150513824}{key}}, \textcolor{stringliteral}{"{}Right"{}}) == 0 || strcmp(ev-\/>\mbox{\hyperlink{struct__Evas__Event__Key__Down_a70473bba88a1afaee180a54150513824}{key}}, \textcolor{stringliteral}{"{}Left"{}}) == 0 ||}
\DoxyCodeLine{       strcmp(ev-\/>\mbox{\hyperlink{struct__Evas__Event__Key__Down_a70473bba88a1afaee180a54150513824}{key}}, \textcolor{stringliteral}{"{}Up"{}}) == 0 || strcmp(ev-\/>\mbox{\hyperlink{struct__Evas__Event__Key__Down_a70473bba88a1afaee180a54150513824}{key}}, \textcolor{stringliteral}{"{}Down"{}}) == 0)}
\DoxyCodeLine{     \{}
\DoxyCodeLine{        \mbox{\hyperlink{Evas__Common_8h_a2453e92182bad3b0e0d84e5aff433b07}{Evas\_Coord}} x, y;}
\DoxyCodeLine{}
\DoxyCodeLine{        \mbox{\hyperlink{group__Evas__Object__Group__Basic_ga6e8e78e110392480dd612df86a16b630}{evas\_object\_geometry\_get}}(d.smt, \&x, \&y, NULL, NULL);}
\DoxyCodeLine{}
\DoxyCodeLine{        \textcolor{keywordflow}{switch} (ev-\/>\mbox{\hyperlink{struct__Evas__Event__Key__Down_a70473bba88a1afaee180a54150513824}{key}}[0])}
\DoxyCodeLine{          \{}
\DoxyCodeLine{           \textcolor{keywordflow}{case} \textcolor{charliteral}{'R'}:}
\DoxyCodeLine{             x += 20;}
\DoxyCodeLine{             \textcolor{keywordflow}{break};}
\DoxyCodeLine{}
\DoxyCodeLine{           \textcolor{keywordflow}{case} \textcolor{charliteral}{'L'}:}
\DoxyCodeLine{             x -\/= 20;}
\DoxyCodeLine{             \textcolor{keywordflow}{break};}
\DoxyCodeLine{}
\DoxyCodeLine{           \textcolor{keywordflow}{case} \textcolor{charliteral}{'U'}:}
\DoxyCodeLine{             y -\/= 20;}
\DoxyCodeLine{             \textcolor{keywordflow}{break};}
\DoxyCodeLine{}
\DoxyCodeLine{           \textcolor{keywordflow}{case} \textcolor{charliteral}{'D'}:}
\DoxyCodeLine{             y += 20;}
\DoxyCodeLine{             \textcolor{keywordflow}{break};}
\DoxyCodeLine{          \}}
\DoxyCodeLine{}
\DoxyCodeLine{        \mbox{\hyperlink{group__Evas__Object__Group_ga335c8ee6eaeaac9710656af4f8b0db91}{evas\_object\_move}}(d.smt, x, y);}
\DoxyCodeLine{        \_map\_update();}
\DoxyCodeLine{}
\DoxyCodeLine{        \textcolor{keywordflow}{return};}
\DoxyCodeLine{     \}}
\DoxyCodeLine{}
\DoxyCodeLine{   \textcolor{comment}{/* increase smart object's size */}}
\DoxyCodeLine{   \textcolor{keywordflow}{if} (strcmp(ev-\/>\mbox{\hyperlink{struct__Evas__Event__Key__Down_a70473bba88a1afaee180a54150513824}{key}}, \textcolor{stringliteral}{"{}i"{}}) == 0)}
\DoxyCodeLine{     \{}
\DoxyCodeLine{        \mbox{\hyperlink{Evas__Common_8h_a2453e92182bad3b0e0d84e5aff433b07}{Evas\_Coord}} w, h;}
\DoxyCodeLine{}
\DoxyCodeLine{        \mbox{\hyperlink{group__Evas__Object__Group__Basic_ga6e8e78e110392480dd612df86a16b630}{evas\_object\_geometry\_get}}(d.smt, NULL, NULL, \&w, \&h);}
\DoxyCodeLine{}
\DoxyCodeLine{        w *= 1.1;}
\DoxyCodeLine{        h *= 1.1;}
\DoxyCodeLine{}
\DoxyCodeLine{        \mbox{\hyperlink{group__Evas__Object__Group_gacad94595f83580c18908cb3b69b08d1a}{evas\_object\_resize}}(d.smt, w, h);}
\DoxyCodeLine{        \_map\_update();}
\DoxyCodeLine{}
\DoxyCodeLine{        \textcolor{keywordflow}{return};}
\DoxyCodeLine{     \}}
\DoxyCodeLine{}
\DoxyCodeLine{   \textcolor{comment}{/* decrease smart object's size */}}
\DoxyCodeLine{   \textcolor{keywordflow}{if} (strcmp(ev-\/>\mbox{\hyperlink{struct__Evas__Event__Key__Down_a70473bba88a1afaee180a54150513824}{key}}, \textcolor{stringliteral}{"{}d"{}}) == 0)}
\DoxyCodeLine{     \{}
\DoxyCodeLine{        \mbox{\hyperlink{Evas__Common_8h_a2453e92182bad3b0e0d84e5aff433b07}{Evas\_Coord}} w, h;}
\DoxyCodeLine{}
\DoxyCodeLine{        \mbox{\hyperlink{group__Evas__Object__Group__Basic_ga6e8e78e110392480dd612df86a16b630}{evas\_object\_geometry\_get}}(d.smt, NULL, NULL, \&w, \&h);}
\DoxyCodeLine{}
\DoxyCodeLine{        w *= 0.9;}
\DoxyCodeLine{        h *= 0.9;}
\DoxyCodeLine{}
\DoxyCodeLine{        \mbox{\hyperlink{group__Evas__Object__Group_gacad94595f83580c18908cb3b69b08d1a}{evas\_object\_resize}}(d.smt, w, h);}
\DoxyCodeLine{        \_map\_update();}
\DoxyCodeLine{}
\DoxyCodeLine{        \textcolor{keywordflow}{return};}
\DoxyCodeLine{     \}}
\DoxyCodeLine{}
\DoxyCodeLine{   \textcolor{comment}{/* change smart object's clipper color */}}
\DoxyCodeLine{   \textcolor{keywordflow}{if} (strcmp(ev-\/>\mbox{\hyperlink{struct__Evas__Event__Key__Down_a70473bba88a1afaee180a54150513824}{key}}, \textcolor{stringliteral}{"{}c"{}}) == 0)}
\DoxyCodeLine{     \{}
\DoxyCodeLine{        cur\_color = (cur\_color + 1) \% 4;}
\DoxyCodeLine{}
\DoxyCodeLine{        \mbox{\hyperlink{group__Evas__Object__Group__Basic_gab751e9d24c16e74af6f7c08ea5b930c2}{evas\_object\_color\_set}}(}
\DoxyCodeLine{          d.clipper, clipper\_colors[cur\_color].r, clipper\_colors[cur\_color].g,}
\DoxyCodeLine{          clipper\_colors[cur\_color].b, clipper\_colors[cur\_color].a);}
\DoxyCodeLine{}
\DoxyCodeLine{        fprintf(stderr, \textcolor{stringliteral}{"{}Changing clipper's color to \%s\(\backslash\)n"{}},}
\DoxyCodeLine{                \_index\_to\_color(cur\_color));}
\DoxyCodeLine{}
\DoxyCodeLine{        \textcolor{keywordflow}{return};}
\DoxyCodeLine{     \}}
\DoxyCodeLine{}
\DoxyCodeLine{   \textcolor{comment}{/* rotate object to the right */}}
\DoxyCodeLine{   \textcolor{keywordflow}{if} (strcmp(ev-\/>\mbox{\hyperlink{struct__Evas__Event__Key__Down_a70473bba88a1afaee180a54150513824}{key}}, \textcolor{stringliteral}{"{}period"{}}) == 0)}
\DoxyCodeLine{     \{}
\DoxyCodeLine{        cur\_angle = (cur\_angle + 30) \% 360;}
\DoxyCodeLine{        \_map\_update();}
\DoxyCodeLine{        \textcolor{keywordflow}{return};}
\DoxyCodeLine{     \}}
\DoxyCodeLine{}
\DoxyCodeLine{   \textcolor{keywordflow}{if} (strcmp(ev-\/>\mbox{\hyperlink{struct__Evas__Event__Key__Down_a70473bba88a1afaee180a54150513824}{key}}, \textcolor{stringliteral}{"{}comma"{}}) == 0)}
\DoxyCodeLine{     \{}
\DoxyCodeLine{        cur\_angle = (cur\_angle -\/ 30) \% 360;}
\DoxyCodeLine{        \_map\_update();}
\DoxyCodeLine{        \textcolor{keywordflow}{return};}
\DoxyCodeLine{     \}}
\DoxyCodeLine{}
\DoxyCodeLine{   fprintf(stderr, \textcolor{stringliteral}{"{}Invalid key: '\%s'\(\backslash\)n"{}}, ev-\/>\mbox{\hyperlink{struct__Evas__Event__Key__Down_a70473bba88a1afaee180a54150513824}{key}});}
\DoxyCodeLine{\}}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{keyword}{static} \textcolor{keywordtype}{void}}
\DoxyCodeLine{\textcolor{comment}{/* callback on number of member objects changed */}}
\DoxyCodeLine{\_on\_example\_smart\_object\_child\_num\_change(\textcolor{keywordtype}{void} *data \mbox{\hyperlink{group__Eina__Types__Group_ga82d751be730f849719ca292f9558be87}{EINA\_UNUSED}},}
\DoxyCodeLine{                                          \mbox{\hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object}} *obj \mbox{\hyperlink{group__Eina__Types__Group_ga82d751be730f849719ca292f9558be87}{EINA\_UNUSED}},}
\DoxyCodeLine{                                          \textcolor{keywordtype}{void} *event\_info)}
\DoxyCodeLine{\{}
\DoxyCodeLine{   printf(\textcolor{stringliteral}{"{}Number of child members on our example smart"{}}}
\DoxyCodeLine{          \textcolor{stringliteral}{"{} object changed to \%llu\(\backslash\)n"{}}, (\textcolor{keywordtype}{unsigned} \textcolor{keywordtype}{long} \textcolor{keywordtype}{long})(uintptr\_t)event\_info);}
\DoxyCodeLine{\}}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{keywordtype}{int}}
\DoxyCodeLine{main(\textcolor{keywordtype}{void})}
\DoxyCodeLine{\{}
\DoxyCodeLine{   \textcolor{keyword}{const} \mbox{\hyperlink{struct__Evas__Smart__Cb__Description}{Evas\_Smart\_Cb\_Description}} **descriptions;}
\DoxyCodeLine{   \textcolor{keywordtype}{unsigned} \textcolor{keywordtype}{int} count;}
\DoxyCodeLine{   \mbox{\hyperlink{group__Eina__Types__Group_ga3fe0caf72e93b1bab1ca8ee3ccf3f226}{Eina\_Bool}} ret;}
\DoxyCodeLine{}
\DoxyCodeLine{   \textcolor{keywordflow}{if} (!\mbox{\hyperlink{group__Ecore__Evas__Group_ga32ddbb6457033ad435a177eb0c4fe235}{ecore\_evas\_init}}())}
\DoxyCodeLine{     \textcolor{keywordflow}{return} EXIT\_FAILURE;}
\DoxyCodeLine{}
\DoxyCodeLine{   \textcolor{comment}{/* this will give you a window with an Evas canvas under the first}}
\DoxyCodeLine{\textcolor{comment}{    * engine available */}}
\DoxyCodeLine{   d.ee = \mbox{\hyperlink{group__Ecore__Evas__Group_gaaa770b6f2f1395f9eeb0e50e26c3f933}{ecore\_evas\_new}}(NULL, 10, 10, WIDTH, HEIGHT, NULL);}
\DoxyCodeLine{   \textcolor{keywordflow}{if} (!d.ee)}
\DoxyCodeLine{     \textcolor{keywordflow}{goto} error;}
\DoxyCodeLine{}
\DoxyCodeLine{   \mbox{\hyperlink{group__Ecore__Evas__Group_ga3680b5c89157167318192157a5d24ec4}{ecore\_evas\_callback\_destroy\_set}}(d.ee, \_on\_destroy);}
\DoxyCodeLine{   \mbox{\hyperlink{group__Ecore__Evas__Group_gaac67f679c9027059a34519fbdea360df}{ecore\_evas\_callback\_resize\_set}}(d.ee, \_canvas\_resize\_cb);}
\DoxyCodeLine{   \mbox{\hyperlink{group__Ecore__Evas__Group_ga4953047ff97d4f1b0d75a7d513d4f317}{ecore\_evas\_show}}(d.ee);}
\DoxyCodeLine{}
\DoxyCodeLine{   \textcolor{comment}{/* the canvas pointer, de facto */}}
\DoxyCodeLine{   d.evas = \mbox{\hyperlink{group__Ecore__Evas__Group_ga6f8d214cd55bc940d7cc62fecd8dbc06}{ecore\_evas\_get}}(d.ee);}
\DoxyCodeLine{}
\DoxyCodeLine{   d.bg = \mbox{\hyperlink{group__Evas__Object__Rectangle_ga1b7a9d8e6ce240590c1734da5f3449d2}{evas\_object\_rectangle\_add}}(d.evas);}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Group__Basic_gab751e9d24c16e74af6f7c08ea5b930c2}{evas\_object\_color\_set}}(d.bg, 255, 255, 255, 255);}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Group_ga335c8ee6eaeaac9710656af4f8b0db91}{evas\_object\_move}}(d.bg, 0, 0);}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Group_gacad94595f83580c18908cb3b69b08d1a}{evas\_object\_resize}}(d.bg, WIDTH, HEIGHT);}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Group__Basic_ga07208fcafd4739de606bc35fff684bf5}{evas\_object\_show}}(d.bg);}
\DoxyCodeLine{}
\DoxyCodeLine{   d.smt = evas\_smart\_example\_add(d.evas);}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Group_ga335c8ee6eaeaac9710656af4f8b0db91}{evas\_object\_move}}(d.smt, WIDTH / 4, HEIGHT / 4);}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Group_gacad94595f83580c18908cb3b69b08d1a}{evas\_object\_resize}}(d.smt, WIDTH / 2, HEIGHT / 2);}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Group__Basic_ga07208fcafd4739de606bc35fff684bf5}{evas\_object\_show}}(d.smt);}
\DoxyCodeLine{}
\DoxyCodeLine{   ret = \mbox{\hyperlink{group__Evas__Smart__Object__Group_ga22801632fbc3f349b5b4f976381afc62}{evas\_object\_smart\_type\_check}}(d.smt, \_evas\_smart\_example\_type);}
\DoxyCodeLine{   printf(\textcolor{stringliteral}{"{}Adding smart object of type \(\backslash\)"{}\%s\(\backslash\)"{} to the canvas: \%s.\(\backslash\)n"{}},}
\DoxyCodeLine{          \_evas\_smart\_example\_type, ret ? \textcolor{stringliteral}{"{}success"{}} : \textcolor{stringliteral}{"{}failure"{}});}
\DoxyCodeLine{}
\DoxyCodeLine{   d.clipper = \mbox{\hyperlink{group__Evas__Smart__Object__Group_ga10342ef3dfaa95ffd70b2883f0be531d}{evas\_object\_smart\_clipped\_clipper\_get}}(d.smt);}
\DoxyCodeLine{   printf(\textcolor{stringliteral}{"{}Checking if clipped smart object's clipper is a "{}}}
\DoxyCodeLine{          \textcolor{stringliteral}{"{}\(\backslash\)"{}static\(\backslash\)"{} one: \%s\(\backslash\)n"{}},}
\DoxyCodeLine{          \mbox{\hyperlink{group__Evas__Object__Group_gaa6b17176deac52b4c52b4380a9a8778a}{evas\_object\_static\_clip\_get}}(d.clipper) ? \textcolor{stringliteral}{"{}yes"{}} : \textcolor{stringliteral}{"{}no"{}});}
\DoxyCodeLine{}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Group__Basic_gab751e9d24c16e74af6f7c08ea5b930c2}{evas\_object\_color\_set}}(}
\DoxyCodeLine{     d.clipper, clipper\_colors[cur\_color].r, clipper\_colors[cur\_color].g,}
\DoxyCodeLine{     clipper\_colors[cur\_color].b, clipper\_colors[cur\_color].a);}
\DoxyCodeLine{}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Smart__Object__Group_ga6f2cc793ce222baa338d1f976ad15e67}{evas\_object\_smart\_callbacks\_descriptions\_get}}(}
\DoxyCodeLine{     d.smt, \&descriptions, \&count, NULL, NULL);}
\DoxyCodeLine{}
\DoxyCodeLine{   \textcolor{keywordflow}{for} (; *descriptions; descriptions++)}
\DoxyCodeLine{     \{}
\DoxyCodeLine{        printf(\textcolor{stringliteral}{"{}We've found a smart callback on the smart object!"{}}}
\DoxyCodeLine{               \textcolor{stringliteral}{"{}\(\backslash\)n\(\backslash\)tname: \%s\(\backslash\)n\(\backslash\)ttype: \%s\(\backslash\)n"{}}, (*descriptions)-\/>name,}
\DoxyCodeLine{               (*descriptions)-\/>type);}
\DoxyCodeLine{}
\DoxyCodeLine{        \textcolor{keywordflow}{if} (strcmp((*descriptions)-\/>type, \textcolor{stringliteral}{"{}i"{}})) \textcolor{keywordflow}{continue};}
\DoxyCodeLine{        \textcolor{comment}{/* we know we don't have other types of smart callbacks}}
\DoxyCodeLine{\textcolor{comment}{         * here, just playing with it */}}
\DoxyCodeLine{}
\DoxyCodeLine{        \textcolor{comment}{/* for now, we know the only one callback is the one}}
\DoxyCodeLine{\textcolor{comment}{         * reporting number of member objects changed on the}}
\DoxyCodeLine{\textcolor{comment}{         * example smart object */}}
\DoxyCodeLine{        \mbox{\hyperlink{group__Evas__Smart__Object__Group_gac12dd6655f488cc47ce6cf00eb7d12b2}{evas\_object\_smart\_callback\_add}}(}
\DoxyCodeLine{          d.smt, (*descriptions)-\/>name,}
\DoxyCodeLine{          \_on\_example\_smart\_object\_child\_num\_change, NULL);}
\DoxyCodeLine{     \}}
\DoxyCodeLine{}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Group_gac6d65f8896ab59780553676d0017c2ef}{evas\_object\_focus\_set}}(d.bg, \mbox{\hyperlink{group__Eina__Types__Group_ga05c12dacc8b4058994df842b41be85fc}{EINA\_TRUE}});}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Group__Events_gac71a1038dad71da36f57b70c8ad10252}{evas\_object\_event\_callback\_add}}(}
\DoxyCodeLine{     d.bg, \mbox{\hyperlink{Evas__Common_8h_ad64cde0da38a60e7cb7905b3ab216968a336b86bad4f145f84c155e4922335584}{EVAS\_CALLBACK\_KEY\_DOWN}}, \_on\_keydown, NULL);}
\DoxyCodeLine{}
\DoxyCodeLine{   puts(commands);}
\DoxyCodeLine{   \mbox{\hyperlink{group__Ecore__Main__Loop__Group_gaf103b9f668bb3e4fed12e52c6180132d}{ecore\_main\_loop\_begin}}();}
\DoxyCodeLine{}
\DoxyCodeLine{   \mbox{\hyperlink{group__Ecore__Evas__Group_gad3ec61f2aa03df4d3dbfd0d311e0c8dc}{ecore\_evas\_free}}(d.ee);}
\DoxyCodeLine{   \mbox{\hyperlink{group__Ecore__Evas__Group_gab8fa311077f749190c9b622f672b2214}{ecore\_evas\_shutdown}}();}
\DoxyCodeLine{   \textcolor{keywordflow}{return} 0;}
\DoxyCodeLine{}
\DoxyCodeLine{error:}
\DoxyCodeLine{   fprintf(stderr, \textcolor{stringliteral}{"{}error: Requires at least one Evas engine built and linked"{}}}
\DoxyCodeLine{                   \textcolor{stringliteral}{"{} to ecore-\/evas for this example to run properly.\(\backslash\)n"{}});}
\DoxyCodeLine{   \mbox{\hyperlink{group__Ecore__Evas__Group_gab8fa311077f749190c9b622f672b2214}{ecore\_evas\_shutdown}}();}
\DoxyCodeLine{   \textcolor{keywordflow}{return} -\/1;}
\DoxyCodeLine{\}}

\end{DoxyCodeInclude}
 