

In this example, we illustrate how to create and handle Evas smart {\bfseries{interfaces}}. Note that we use the same code base of the \mbox{\hyperlink{Example_Evas_Smart_Objects}{Evas object smart objects}} example, here. We just augment it with an interfaces demonstration.

A smart interface is just a functions interface a given smart object is declaring to support and or use. In Evas, interfaces are very simple\+: no interface inheritance, no interface overriding. Their purpose is to extend an object\textquotesingle{}s capabilities and behavior beyond the sub-\/classing schema.

Here, together with a custom smart object, we create and declare the object as using an Evas interface. It\textquotesingle{}ll have a custom function, too, besides the {\ttfamily add()} and del() obligatory ones. To demonstrate interface data, which is bound to object {\bfseries{instances}}, we\textquotesingle{}ll have a string as this data.

Here is where we declare our interface\+: 
\begin{DoxyCodeInclude}{0}
\DoxyCodeLine{\textcolor{keyword}{static} \textcolor{keyword}{const} \textcolor{keywordtype}{char} iface1\_data[] = \textcolor{stringliteral}{"{}iface1\_data"{}};}
\DoxyCodeLine{\textcolor{keyword}{static} \textcolor{keyword}{const} \textcolor{keywordtype}{char} IFACE1\_NAME[] = \textcolor{stringliteral}{"{}iface1"{}};}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{keyword}{static} \mbox{\hyperlink{group__Eina__Types__Group_ga3fe0caf72e93b1bab1ca8ee3ccf3f226}{Eina\_Bool}} \_iface1\_add(\mbox{\hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object}} *);}
\DoxyCodeLine{\textcolor{keyword}{static} \textcolor{keywordtype}{void}      \_iface1\_del(\mbox{\hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object}} *);}
\DoxyCodeLine{\textcolor{keyword}{static} \textcolor{keywordtype}{void}      \_iface1\_custom\_fn(\mbox{\hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object}} *);}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{keyword}{typedef} \textcolor{keyword}{struct }\_Evas\_Smart\_Example\_Interface Evas\_Smart\_Example\_Interface;}
\DoxyCodeLine{\textcolor{keyword}{struct }\_Evas\_Smart\_Example\_Interface}
\DoxyCodeLine{\{}
\DoxyCodeLine{   \mbox{\hyperlink{struct__Evas__Smart__Interface}{Evas\_Smart\_Interface}} base;}
\DoxyCodeLine{   void                 (*example\_func)(\mbox{\hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object}} *obj);}
\DoxyCodeLine{\};}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{keyword}{static} Evas\_Smart\_Example\_Interface iface1;}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{keyword}{static} \mbox{\hyperlink{group__Eina__Types__Group_ga3fe0caf72e93b1bab1ca8ee3ccf3f226}{Eina\_Bool}}}
\DoxyCodeLine{\_iface1\_add(\mbox{\hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object}} *obj \mbox{\hyperlink{group__Eina__Types__Group_ga82d751be730f849719ca292f9558be87}{EINA\_UNUSED}})}
\DoxyCodeLine{\{}
\DoxyCodeLine{   printf(\textcolor{stringliteral}{"{}iface1's add()!\(\backslash\)n"{}});}
\DoxyCodeLine{}
\DoxyCodeLine{   \textcolor{keywordflow}{return} \mbox{\hyperlink{group__Eina__Types__Group_ga05c12dacc8b4058994df842b41be85fc}{EINA\_TRUE}};}
\DoxyCodeLine{\}}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{keyword}{static} \textcolor{keywordtype}{void}}
\DoxyCodeLine{\_iface1\_del(\mbox{\hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object}} *obj)}
\DoxyCodeLine{\{}
\DoxyCodeLine{   printf(\textcolor{stringliteral}{"{}iface1's del()! Data is \%s\(\backslash\)n"{}},}
\DoxyCodeLine{          (\textcolor{keywordtype}{char} *)\mbox{\hyperlink{group__Evas__Smart__Object__Group_gaed3359faaae2d7cffd3e24441591da04}{evas\_object\_smart\_interface\_data\_get}}}
\DoxyCodeLine{          (obj, (\mbox{\hyperlink{struct__Evas__Smart__Interface}{Evas\_Smart\_Interface}} *)\&iface1));}
\DoxyCodeLine{\}}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{keyword}{static} \textcolor{keywordtype}{void}}
\DoxyCodeLine{\_iface1\_custom\_fn(\mbox{\hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object}} *obj \mbox{\hyperlink{group__Eina__Types__Group_ga82d751be730f849719ca292f9558be87}{EINA\_UNUSED}})}
\DoxyCodeLine{\{}
\DoxyCodeLine{   printf(\textcolor{stringliteral}{"{}iface1's custom\_fn()!\(\backslash\)n"{}});}
\DoxyCodeLine{\}}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{keyword}{static} \textcolor{keyword}{const} \mbox{\hyperlink{struct__Evas__Smart__Interface}{Evas\_Smart\_Interface}} *\_smart\_interfaces[] =}
\DoxyCodeLine{\{}
\DoxyCodeLine{   (\mbox{\hyperlink{struct__Evas__Smart__Interface}{Evas\_Smart\_Interface}} *)\&iface1, NULL}
\DoxyCodeLine{\};}

\end{DoxyCodeInclude}
 Note that there\textquotesingle{}s error checking for interfaces creation, by means of the {\ttfamily add()} method\textquotesingle{}s return value ({\ttfamily \+\_\+iface1\+\_\+add()}, here).

Now note that here we are filling in the interface\textquotesingle{}s fields dynamically. Let\textquotesingle{}s move on to that code region\+:

 
\begin{DoxyCodeInclude}{0}
\DoxyCodeLine{   iface = (Evas\_Smart\_Example\_Interface *)\&iface1;}
\DoxyCodeLine{   iface-\/>base.name = IFACE1\_NAME;}
\DoxyCodeLine{   iface-\/>base.private\_size = \textcolor{keyword}{sizeof}(iface1\_data);}
\DoxyCodeLine{   iface-\/>base.add = \_iface1\_add;}
\DoxyCodeLine{   iface-\/>base.del = \_iface1\_del;}
\DoxyCodeLine{   iface-\/>example\_func = \_iface1\_custom\_fn;}
\DoxyCodeLine{}
\DoxyCodeLine{   d.smt = evas\_smart\_example\_add(d.evas);}

\end{DoxyCodeInclude}
 As important as setting the function pointers, is declaring the {\ttfamily private\+\_\+size} as to match exactly the size of the data blob we want to have allocated for us by Evas. This will happen automatically inside {\ttfamily evas\+\_\+smart\+\_\+example\+\_\+add()}. Later, on this code, we deal exactly with that data blob, more specifically writing on it (as it\textquotesingle{}s not done inside {\ttfamily \+\_\+iface1\+\_\+add()}, here\+:

 
\begin{DoxyCodeInclude}{0}
\DoxyCodeLine{   iface = (Evas\_Smart\_Example\_Interface *)\mbox{\hyperlink{group__Evas__Smart__Object__Group_ga726849e13d3bbc0c7ce182e3f82ce07f}{evas\_object\_smart\_interface\_get}}}
\DoxyCodeLine{       (d.smt, IFACE1\_NAME);}
\DoxyCodeLine{   \textcolor{keywordflow}{if} (iface)}
\DoxyCodeLine{     \{}
\DoxyCodeLine{        \textcolor{keywordtype}{char} *data;}
\DoxyCodeLine{}
\DoxyCodeLine{        printf(\textcolor{stringliteral}{"{}We've found a smart interface on the smart object!"{}}}
\DoxyCodeLine{               \textcolor{stringliteral}{"{}\(\backslash\)n\(\backslash\)tname: \%s\(\backslash\)n"{}}, iface-\/>base.name);}
\DoxyCodeLine{}
\DoxyCodeLine{        printf(\textcolor{stringliteral}{"{}Setting its interface data...\(\backslash\)n"{}});}
\DoxyCodeLine{        data = \mbox{\hyperlink{group__Evas__Smart__Object__Group_gaed3359faaae2d7cffd3e24441591da04}{evas\_object\_smart\_interface\_data\_get}}}
\DoxyCodeLine{            (d.smt, (\mbox{\hyperlink{struct__Evas__Smart__Interface}{Evas\_Smart\_Interface}} *)iface);}
\DoxyCodeLine{        memcpy(data, iface1\_data, \textcolor{keyword}{sizeof}(iface1\_data));}
\DoxyCodeLine{}
\DoxyCodeLine{        printf(\textcolor{stringliteral}{"{}Calling an interface's function...\(\backslash\)n"{}});}
\DoxyCodeLine{        iface-\/>example\_func(d.smt);}
\DoxyCodeLine{     \}}

\end{DoxyCodeInclude}
 Before accessing the interface data, we exercise the interface fetching call \mbox{\hyperlink{group__Evas__Smart__Object__Group_ga726849e13d3bbc0c7ce182e3f82ce07f}{evas\+\_\+object\+\_\+smart\+\_\+interface\+\_\+get()}}, with the name string we used to be interface\textquotesingle{}s name. With that handle in hands, we issue \mbox{\hyperlink{group__Evas__Smart__Object__Group_gaed3359faaae2d7cffd3e24441591da04}{evas\+\_\+object\+\_\+smart\+\_\+interface\+\_\+data\+\_\+get()}} and write the string we want as data on that memory region. That will make up for the string you get on {\ttfamily \+\_\+iface1\+\_\+del()}.

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{}
\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\)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{}
\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 \textcolor{stringliteral}{"{}/red.png"{}};}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{preprocessor}{\#define \_evas\_smart\_example\_type "{}Evas\_Smart\_Example"{}}}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{keyword}{static} \textcolor{keyword}{const} \textcolor{keywordtype}{char} iface1\_data[] = \textcolor{stringliteral}{"{}iface1\_data"{}};}
\DoxyCodeLine{\textcolor{keyword}{static} \textcolor{keyword}{const} \textcolor{keywordtype}{char} IFACE1\_NAME[] = \textcolor{stringliteral}{"{}iface1"{}};}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{keyword}{static} \mbox{\hyperlink{group__Eina__Types__Group_ga3fe0caf72e93b1bab1ca8ee3ccf3f226}{Eina\_Bool}} \_iface1\_add(\mbox{\hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object}} *);}
\DoxyCodeLine{\textcolor{keyword}{static} \textcolor{keywordtype}{void}      \_iface1\_del(\mbox{\hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object}} *);}
\DoxyCodeLine{\textcolor{keyword}{static} \textcolor{keywordtype}{void}      \_iface1\_custom\_fn(\mbox{\hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object}} *);}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{keyword}{typedef} \textcolor{keyword}{struct }\_Evas\_Smart\_Example\_Interface Evas\_Smart\_Example\_Interface;}
\DoxyCodeLine{\textcolor{keyword}{struct }\_Evas\_Smart\_Example\_Interface}
\DoxyCodeLine{\{}
\DoxyCodeLine{   \mbox{\hyperlink{struct__Evas__Smart__Interface}{Evas\_Smart\_Interface}} base;}
\DoxyCodeLine{   void                 (*example\_func)(\mbox{\hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object}} *obj);}
\DoxyCodeLine{\};}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{keyword}{static} Evas\_Smart\_Example\_Interface iface1;}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{keyword}{static} \mbox{\hyperlink{group__Eina__Types__Group_ga3fe0caf72e93b1bab1ca8ee3ccf3f226}{Eina\_Bool}}}
\DoxyCodeLine{\_iface1\_add(\mbox{\hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object}} *obj \mbox{\hyperlink{group__Eina__Types__Group_ga82d751be730f849719ca292f9558be87}{EINA\_UNUSED}})}
\DoxyCodeLine{\{}
\DoxyCodeLine{   printf(\textcolor{stringliteral}{"{}iface1's add()!\(\backslash\)n"{}});}
\DoxyCodeLine{}
\DoxyCodeLine{   \textcolor{keywordflow}{return} \mbox{\hyperlink{group__Eina__Types__Group_ga05c12dacc8b4058994df842b41be85fc}{EINA\_TRUE}};}
\DoxyCodeLine{\}}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{keyword}{static} \textcolor{keywordtype}{void}}
\DoxyCodeLine{\_iface1\_del(\mbox{\hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object}} *obj)}
\DoxyCodeLine{\{}
\DoxyCodeLine{   printf(\textcolor{stringliteral}{"{}iface1's del()! Data is \%s\(\backslash\)n"{}},}
\DoxyCodeLine{          (\textcolor{keywordtype}{char} *)\mbox{\hyperlink{group__Evas__Smart__Object__Group_gaed3359faaae2d7cffd3e24441591da04}{evas\_object\_smart\_interface\_data\_get}}}
\DoxyCodeLine{          (obj, (\mbox{\hyperlink{struct__Evas__Smart__Interface}{Evas\_Smart\_Interface}} *)\&iface1));}
\DoxyCodeLine{\}}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{keyword}{static} \textcolor{keywordtype}{void}}
\DoxyCodeLine{\_iface1\_custom\_fn(\mbox{\hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object}} *obj \mbox{\hyperlink{group__Eina__Types__Group_ga82d751be730f849719ca292f9558be87}{EINA\_UNUSED}})}
\DoxyCodeLine{\{}
\DoxyCodeLine{   printf(\textcolor{stringliteral}{"{}iface1's custom\_fn()!\(\backslash\)n"{}});}
\DoxyCodeLine{\}}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{keyword}{static} \textcolor{keyword}{const} \mbox{\hyperlink{struct__Evas__Smart__Interface}{Evas\_Smart\_Interface}} *\_smart\_interfaces[] =}
\DoxyCodeLine{\{}
\DoxyCodeLine{   (\mbox{\hyperlink{struct__Evas__Smart__Interface}{Evas\_Smart\_Interface}} *)\&iface1, NULL}
\DoxyCodeLine{\};}
\DoxyCodeLine{}
\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{\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_ga647c0365b6819db617e5e8dc33d592f6}{EVAS\_SMART\_SUBCLASS\_IFACE\_NEW}}}
\DoxyCodeLine{  (\_evas\_smart\_example\_type, \_evas\_smart\_example, \mbox{\hyperlink{struct__Evas__Smart__Class}{Evas\_Smart\_Class}},}
\DoxyCodeLine{  \mbox{\hyperlink{struct__Evas__Smart__Class}{Evas\_Smart\_Class}}, \mbox{\hyperlink{group__Evas__Smart__Object__Clipped_gabbb2c85a3978e44404528a94be381dcd}{evas\_object\_smart\_clipped\_class\_get}}, \_smart\_callbacks,}
\DoxyCodeLine{  \_smart\_interfaces);}
\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_ga21e8604c0e4a93e469bff4bd069e82b5}{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_gafbad43015793eda4ae50202c0ce0e652}{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_ga12034359ab780a3a0e8b20b83475ed15}{evas\_object\_smart\_member\_del}}(o);}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Smart__Object__Group_ga4f08aefaa29ea4bfc5b3f5c89c85dd59}{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_ga70134a7068c9bff4107a761abe0a2ad4}{evas\_object\_data\_set}}(obj, \textcolor{stringliteral}{"{}index"{}}, NULL);}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Group__Events_gab271959a45d1d5348f6e78a14def44c2}{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_ga23be30ac5cdfb780f1ff82e9108ec26b}{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_ga70134a7068c9bff4107a761abe0a2ad4}{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}{/* this is a border around the smart object's area, delimiting it */}}
\DoxyCodeLine{   priv-\/>border = \mbox{\hyperlink{group__Evas__Object__Image_ga0e8cb83d31d02bf583c75925b7cd14d7}{evas\_object\_image\_filled\_add}}(\mbox{\hyperlink{group__Evas__Object__Group_gae1058082dae7b97590c41f43405dfdbf}{evas\_object\_evas\_get}}(o));}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Image_gac27fd0ceabe5f56607b7a86d71577df1}{evas\_object\_image\_file\_set}}(priv-\/>border, border\_img\_path, NULL);}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Image_gace5efad74de9f87cd996b2a34b3ea591}{evas\_object\_image\_border\_set}}(priv-\/>border, 3, 3, 3, 3);}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Image_ga1f134668dedc8ad855c3af28fd2df8f6}{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__Smart__Object__Group_ga6845c17effe796430cb4fc5f2cfccef0}{evas\_object\_smart\_member\_add}}(priv-\/>border, o);}
\DoxyCodeLine{}
\DoxyCodeLine{   \_evas\_smart\_example\_parent\_sc-\/>add(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\_show(\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]) \mbox{\hyperlink{group__Evas__Object__Group__Basic_ga9cbc13661584e49fb9d9cdab514a1eeb}{evas\_object\_show}}(priv-\/>children[0]);}
\DoxyCodeLine{   \textcolor{keywordflow}{if} (priv-\/>children[1]) \mbox{\hyperlink{group__Evas__Object__Group__Basic_ga9cbc13661584e49fb9d9cdab514a1eeb}{evas\_object\_show}}(priv-\/>children[1]);}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Group__Basic_ga9cbc13661584e49fb9d9cdab514a1eeb}{evas\_object\_show}}(priv-\/>border);}
\DoxyCodeLine{}
\DoxyCodeLine{   \_evas\_smart\_example\_parent\_sc-\/>show(o);}
\DoxyCodeLine{\}}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{keyword}{static} \textcolor{keywordtype}{void}}
\DoxyCodeLine{\_evas\_smart\_example\_smart\_hide(\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]) \mbox{\hyperlink{group__Evas__Object__Group__Basic_gacc307a0d7bfc9df151fd9ec75808c587}{evas\_object\_hide}}(priv-\/>children[0]);}
\DoxyCodeLine{   \textcolor{keywordflow}{if} (priv-\/>children[1]) \mbox{\hyperlink{group__Evas__Object__Group__Basic_gacc307a0d7bfc9df151fd9ec75808c587}{evas\_object\_hide}}(priv-\/>children[1]);}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Group__Basic_gacc307a0d7bfc9df151fd9ec75808c587}{evas\_object\_hide}}(priv-\/>border);}
\DoxyCodeLine{}
\DoxyCodeLine{   \_evas\_smart\_example\_parent\_sc-\/>hide(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_ga6f52fab1a96dc58c85ee481d84bac871}{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_ga4f08aefaa29ea4bfc5b3f5c89c85dd59}{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_ga6f52fab1a96dc58c85ee481d84bac871}{evas\_object\_geometry\_get}}(o, \&x, \&y, \&w, \&h);}
\DoxyCodeLine{}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Group_ga21e8604c0e4a93e469bff4bd069e82b5}{evas\_object\_resize}}(priv-\/>border, w, h);}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Group_ga02da8091bbac768b8e86c7b74b2a94f9}{evas\_object\_move}}(priv-\/>border, x, y);}
\DoxyCodeLine{}
\DoxyCodeLine{   \textcolor{keywordflow}{if} (priv-\/>children[0])}
\DoxyCodeLine{     \{}
\DoxyCodeLine{        \mbox{\hyperlink{group__Evas__Object__Group_ga02da8091bbac768b8e86c7b74b2a94f9}{evas\_object\_move}}(priv-\/>children[0], x + 3, y + 3);}
\DoxyCodeLine{        \mbox{\hyperlink{group__Evas__Object__Group_ga21e8604c0e4a93e469bff4bd069e82b5}{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_ga02da8091bbac768b8e86c7b74b2a94f9}{evas\_object\_move}}(priv-\/>children[1], x + (w / 2), y + (h / 2));}
\DoxyCodeLine{        \mbox{\hyperlink{group__Evas__Object__Group_ga21e8604c0e4a93e469bff4bd069e82b5}{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{   sc-\/>\mbox{\hyperlink{struct__Evas__Smart__Class_a1aa57fda1f2e428b91e771a1d3a3a9de}{show}} = \_evas\_smart\_example\_smart\_show;}
\DoxyCodeLine{   sc-\/>\mbox{\hyperlink{struct__Evas__Smart__Class_ad48724181a7379c046e754b20ece69b8}{hide}} = \_evas\_smart\_example\_smart\_hide;}
\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_gad80de73a33446f902d4b39141a8d0a05}{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_ga12034359ab780a3a0e8b20b83475ed15}{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_gafbad43015793eda4ae50202c0ce0e652}{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_gaa81bbe0af70df6c90b8fc781c59237bc}{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_ga4f08aefaa29ea4bfc5b3f5c89c85dd59}{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_ga6845c17effe796430cb4fc5f2cfccef0}{evas\_object\_smart\_member\_add}}(child, o);}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Smart__Object__Group_ga4f08aefaa29ea4bfc5b3f5c89c85dd59}{evas\_object\_smart\_changed}}(o);}
\DoxyCodeLine{}
\DoxyCodeLine{   priv-\/>child\_count++;}
\DoxyCodeLine{   \textcolor{keywordflow}{if} (!ret)}
\DoxyCodeLine{     \{}
\DoxyCodeLine{        \mbox{\hyperlink{group__Evas__Smart__Object__Group_gaa81bbe0af70df6c90b8fc781c59237bc}{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_ga6845c17effe796430cb4fc5f2cfccef0}{evas\_object\_smart\_member\_add}}(child, o);}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Smart__Object__Group_ga4f08aefaa29ea4bfc5b3f5c89c85dd59}{evas\_object\_smart\_changed}}(o);}
\DoxyCodeLine{}
\DoxyCodeLine{   priv-\/>child\_count++;}
\DoxyCodeLine{   \textcolor{keywordflow}{if} (!ret)}
\DoxyCodeLine{     \{}
\DoxyCodeLine{        \mbox{\hyperlink{group__Evas__Smart__Object__Group_gaa81bbe0af70df6c90b8fc781c59237bc}{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{\_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{        printf(\textcolor{stringliteral}{"{}\%s\(\backslash\)n"{}}, 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_ga7e7a625dab7a3890532aa13b43117076}{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_ga7e7a625dab7a3890532aa13b43117076}{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_ga4d80fc32ad1cac28428cebd65d746751}{evas\_object\_rectangle\_add}}(d.evas), *prev;}
\DoxyCodeLine{        \mbox{\hyperlink{group__Evas__Object__Group__Basic_gae34bdcfd7f5100151f6ea8ef4a392949}{evas\_object\_color\_set}}(}
\DoxyCodeLine{          rect, rand() \% 255, rand() \% 255, rand() \% 255, 255);}
\DoxyCodeLine{        \mbox{\hyperlink{group__Evas__Object__Group__Basic_ga9cbc13661584e49fb9d9cdab514a1eeb}{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"{}}}
\DoxyCodeLine{               \textcolor{stringliteral}{"{} rectangle.\(\backslash\)n"{}});}
\DoxyCodeLine{        printf(\textcolor{stringliteral}{"{}Checking its new smart object parent: \%s\(\backslash\)n"{}},}
\DoxyCodeLine{               \mbox{\hyperlink{group__Evas__Object__Group_ga3f9aaf36b96320f3591e8699a9be5006}{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_ga0854bae878bfc39f51b9c989353c973f}{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_ga7e7a625dab7a3890532aa13b43117076}{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_ga4d80fc32ad1cac28428cebd65d746751}{evas\_object\_rectangle\_add}}(d.evas), *prev;}
\DoxyCodeLine{        \mbox{\hyperlink{group__Evas__Object__Group__Basic_gae34bdcfd7f5100151f6ea8ef4a392949}{evas\_object\_color\_set}}(}
\DoxyCodeLine{          rect, rand() \% 255, rand() \% 255, rand() \% 255, 255);}
\DoxyCodeLine{        \mbox{\hyperlink{group__Evas__Object__Group__Basic_ga9cbc13661584e49fb9d9cdab514a1eeb}{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"{}}}
\DoxyCodeLine{               \textcolor{stringliteral}{"{} rectangle.\(\backslash\)n"{}});}
\DoxyCodeLine{        printf(\textcolor{stringliteral}{"{}Checking its new smart object parent: \%s\(\backslash\)n"{}},}
\DoxyCodeLine{               \mbox{\hyperlink{group__Evas__Object__Group_ga3f9aaf36b96320f3591e8699a9be5006}{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_ga0854bae878bfc39f51b9c989353c973f}{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_ga7e7a625dab7a3890532aa13b43117076}{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_ga6f52fab1a96dc58c85ee481d84bac871}{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_ga02da8091bbac768b8e86c7b74b2a94f9}{evas\_object\_move}}(d.smt, x, y);}
\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_ga6f52fab1a96dc58c85ee481d84bac871}{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_ga21e8604c0e4a93e469bff4bd069e82b5}{evas\_object\_resize}}(d.smt, w, h);}
\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_ga6f52fab1a96dc58c85ee481d84bac871}{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_ga21e8604c0e4a93e469bff4bd069e82b5}{evas\_object\_resize}}(d.smt, w, h);}
\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_gae34bdcfd7f5100151f6ea8ef4a392949}{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{}
\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{   Evas\_Smart\_Example\_Interface *iface;}
\DoxyCodeLine{   \textcolor{keywordtype}{unsigned} \textcolor{keywordtype}{int} count;}
\DoxyCodeLine{   \mbox{\hyperlink{group__Eina__Types__Group_ga3fe0caf72e93b1bab1ca8ee3ccf3f226}{Eina\_Bool}} ret;}
\DoxyCodeLine{}
\DoxyCodeLine{   srand(time(NULL));}
\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_gac7f2cdbcb79635c34317c1183dd04cb0}{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_ga75a7cc694b6069e78df47dab0b0f2d20}{ecore\_evas\_get}}(d.ee);}
\DoxyCodeLine{}
\DoxyCodeLine{   d.bg = \mbox{\hyperlink{group__Evas__Object__Rectangle_ga4d80fc32ad1cac28428cebd65d746751}{evas\_object\_rectangle\_add}}(d.evas);}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Group__Basic_gae34bdcfd7f5100151f6ea8ef4a392949}{evas\_object\_color\_set}}(d.bg, 255, 255, 255, 255);}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Group_ga02da8091bbac768b8e86c7b74b2a94f9}{evas\_object\_move}}(d.bg, 0, 0);}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Group_ga21e8604c0e4a93e469bff4bd069e82b5}{evas\_object\_resize}}(d.bg, WIDTH, HEIGHT);}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Group__Basic_ga9cbc13661584e49fb9d9cdab514a1eeb}{evas\_object\_show}}(d.bg);}
\DoxyCodeLine{}
\DoxyCodeLine{   iface = (Evas\_Smart\_Example\_Interface *)\&iface1;}
\DoxyCodeLine{   iface-\/>base.name = IFACE1\_NAME;}
\DoxyCodeLine{   iface-\/>base.private\_size = \textcolor{keyword}{sizeof}(iface1\_data);}
\DoxyCodeLine{   iface-\/>base.add = \_iface1\_add;}
\DoxyCodeLine{   iface-\/>base.del = \_iface1\_del;}
\DoxyCodeLine{   iface-\/>example\_func = \_iface1\_custom\_fn;}
\DoxyCodeLine{}
\DoxyCodeLine{   d.smt = evas\_smart\_example\_add(d.evas);}
\DoxyCodeLine{}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Group_ga02da8091bbac768b8e86c7b74b2a94f9}{evas\_object\_move}}(d.smt, WIDTH / 4, HEIGHT / 4);}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Group_ga21e8604c0e4a93e469bff4bd069e82b5}{evas\_object\_resize}}(d.smt, WIDTH / 2, HEIGHT / 2);}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Group__Basic_ga9cbc13661584e49fb9d9cdab514a1eeb}{evas\_object\_show}}(d.smt);}
\DoxyCodeLine{}
\DoxyCodeLine{   ret = \mbox{\hyperlink{group__Evas__Smart__Object__Group_ga257a2651b93de714211d4205c0e70bb9}{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_ga1ea2217e8a4abc28a35d8273949d4444}{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_gaeddf3ca5853b9c5826680bc7f838d05d}{evas\_object\_static\_clip\_get}}(d.clipper) ? \textcolor{stringliteral}{"{}yes"{}} : \textcolor{stringliteral}{"{}no"{}});}
\DoxyCodeLine{}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Group__Basic_gae34bdcfd7f5100151f6ea8ef4a392949}{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_ga78cb1ef59bcf3e20e2b437dbf1f5aac8}{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_ga18a8b179f94d21b2b09e19db11741061}{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_ga4405e118e1fb762987af1269b6848db5}{evas\_object\_focus\_set}}(d.bg, \mbox{\hyperlink{group__Eina__Types__Group_ga05c12dacc8b4058994df842b41be85fc}{EINA\_TRUE}});}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Group__Events_ga23be30ac5cdfb780f1ff82e9108ec26b}{evas\_object\_event\_callback\_add}}(}
\DoxyCodeLine{     d.bg, \mbox{\hyperlink{Evas__Common_8h_ad64cde0da38a60e7cb7905b3ab216968a336b86bad4f145f84c155e4922335584}{EVAS\_CALLBACK\_KEY\_DOWN}}, \_on\_keydown, NULL);}
\DoxyCodeLine{}
\DoxyCodeLine{   iface = (Evas\_Smart\_Example\_Interface *)\mbox{\hyperlink{group__Evas__Smart__Object__Group_ga726849e13d3bbc0c7ce182e3f82ce07f}{evas\_object\_smart\_interface\_get}}}
\DoxyCodeLine{       (d.smt, IFACE1\_NAME);}
\DoxyCodeLine{   \textcolor{keywordflow}{if} (iface)}
\DoxyCodeLine{     \{}
\DoxyCodeLine{        \textcolor{keywordtype}{char} *data;}
\DoxyCodeLine{}
\DoxyCodeLine{        printf(\textcolor{stringliteral}{"{}We've found a smart interface on the smart object!"{}}}
\DoxyCodeLine{               \textcolor{stringliteral}{"{}\(\backslash\)n\(\backslash\)tname: \%s\(\backslash\)n"{}}, iface-\/>base.name);}
\DoxyCodeLine{}
\DoxyCodeLine{        printf(\textcolor{stringliteral}{"{}Setting its interface data...\(\backslash\)n"{}});}
\DoxyCodeLine{        data = \mbox{\hyperlink{group__Evas__Smart__Object__Group_gaed3359faaae2d7cffd3e24441591da04}{evas\_object\_smart\_interface\_data\_get}}}
\DoxyCodeLine{            (d.smt, (\mbox{\hyperlink{struct__Evas__Smart__Interface}{Evas\_Smart\_Interface}} *)iface);}
\DoxyCodeLine{        memcpy(data, iface1\_data, \textcolor{keyword}{sizeof}(iface1\_data));}
\DoxyCodeLine{}
\DoxyCodeLine{        printf(\textcolor{stringliteral}{"{}Calling an interface's function...\(\backslash\)n"{}});}
\DoxyCodeLine{        iface-\/>example\_func(d.smt);}
\DoxyCodeLine{     \}}
\DoxyCodeLine{}
\DoxyCodeLine{   printf(\textcolor{stringliteral}{"{}\%s\(\backslash\)n"{}}, 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}
 