\hypertarget{evas-smart-interface_8c-example}{\section{evas-\/smart-\/interface.\+c}
}

\begin{DoxyCodeInclude}

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

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

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

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

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

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

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

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

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

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

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

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

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

\textcolor{preprocessor}{#define \_evas\_smart\_example\_type "Evas\_Smart\_Example"}

\textcolor{keyword}{static} \textcolor{keyword}{const} \textcolor{keywordtype}{char} iface1\_data[] = \textcolor{stringliteral}{"iface1\_data"};
\textcolor{keyword}{static} \textcolor{keyword}{const} \textcolor{keywordtype}{char} IFACE1\_NAME[] = \textcolor{stringliteral}{"iface1"};

\textcolor{keyword}{static} \hyperlink{group__Eina__Types__Group_ga3fe0caf72e93b1bab1ca8ee3ccf3f226}{Eina\_Bool} \_iface1\_add(\hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object} *);
\textcolor{keyword}{static} \textcolor{keywordtype}{void}      \_iface1\_del(\hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object} *);
\textcolor{keyword}{static} \textcolor{keywordtype}{void}      \_iface1\_custom\_fn(\hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object} *);

\textcolor{keyword}{typedef} \textcolor{keyword}{struct }\_Evas\_Smart\_Example\_Interface Evas\_Smart\_Example\_Interface;
\textcolor{keyword}{struct }\_Evas\_Smart\_Example\_Interface
\{
   \hyperlink{struct__Evas__Smart__Interface}{Evas\_Smart\_Interface} base;
   void                 (*example\_func)(\hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object} *obj);
\};

\textcolor{keyword}{static} Evas\_Smart\_Example\_Interface iface1;

\textcolor{keyword}{static} \hyperlink{group__Eina__Types__Group_ga3fe0caf72e93b1bab1ca8ee3ccf3f226}{Eina\_Bool}
\_iface1\_add(\hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object} *obj EINA\_UNUSED)
\{
   printf(\textcolor{stringliteral}{"iface1's add()!\(\backslash\)n"});

   \textcolor{keywordflow}{return} \hyperlink{group__Eina__Types__Group_ga05c12dacc8b4058994df842b41be85fc}{EINA\_TRUE};
\}

\textcolor{keyword}{static} \textcolor{keywordtype}{void}
\_iface1\_del(\hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object} *obj)
\{
   printf(\textcolor{stringliteral}{"iface1's del()! Data is %s\(\backslash\)n"},
          (\textcolor{keywordtype}{char} *)\hyperlink{group__Evas__Smart__Object__Group_gaed3359faaae2d7cffd3e24441591da04}{evas\_object\_smart\_interface\_data\_get}
            (obj, (\hyperlink{struct__Evas__Smart__Interface}{Evas\_Smart\_Interface} *)&iface1));
\}

\textcolor{keyword}{static} \textcolor{keywordtype}{void}
\_iface1\_custom\_fn(\hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object} *obj EINA\_UNUSED)
\{
   printf(\textcolor{stringliteral}{"iface1's custom\_fn()!\(\backslash\)n"});
\}

\textcolor{keyword}{static} \textcolor{keyword}{const} \hyperlink{struct__Evas__Smart__Interface}{Evas\_Smart\_Interface} *\_smart\_interfaces[] =
\{
   (\hyperlink{struct__Evas__Smart__Interface}{Evas\_Smart\_Interface} *)&iface1, NULL
\};

\textcolor{preprocessor}{#define EVT\_CHILDREN\_NUMBER\_CHANGED "children,changed"}

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

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

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

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

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

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

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

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

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

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

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

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

   priv->children[idx] = NULL;

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

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

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

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

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

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

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

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

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

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

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

   \textcolor{keywordflow}{if} (priv->children[0]) \hyperlink{group__Evas__Object__Group__Basic_ga9cbc13661584e49fb9d9cdab514a1eeb}{evas\_object\_show}(priv->children[0]);
   \textcolor{keywordflow}{if} (priv->children[1]) \hyperlink{group__Evas__Object__Group__Basic_ga9cbc13661584e49fb9d9cdab514a1eeb}{evas\_object\_show}(priv->children[1]);
   \hyperlink{group__Evas__Object__Group__Basic_ga9cbc13661584e49fb9d9cdab514a1eeb}{evas\_object\_show}(priv->border);

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

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

   \textcolor{keywordflow}{if} (priv->children[0]) \hyperlink{group__Evas__Object__Group__Basic_gacc307a0d7bfc9df151fd9ec75808c587}{evas\_object\_hide}(priv->children[0]);
   \textcolor{keywordflow}{if} (priv->children[1]) \hyperlink{group__Evas__Object__Group__Basic_gacc307a0d7bfc9df151fd9ec75808c587}{evas\_object\_hide}(priv->children[1]);
   \hyperlink{group__Evas__Object__Group__Basic_gacc307a0d7bfc9df151fd9ec75808c587}{evas\_object\_hide}(priv->border);

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

\textcolor{keyword}{static} \textcolor{keywordtype}{void}
\_on\_keydown(\textcolor{keywordtype}{void} *data EINA\_UNUSED,
            \hyperlink{group__Evas__Canvas_ga5ff87cc4ce6bc43e3b640a6d37f73043}{Evas} *evas EINA\_UNUSED,
            \hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object} *o EINA\_UNUSED,
            \textcolor{keywordtype}{void} *einfo)
\{
   \hyperlink{struct__Evas__Event__Key__Down}{Evas\_Event\_Key\_Down} *ev = einfo;

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

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

   \textcolor{keywordflow}{if} (strcmp(ev->\hyperlink{struct__Evas__Event__Key__Down_a70473bba88a1afaee180a54150513824}{key}, \textcolor{stringliteral}{"w"}) == 0) \textcolor{comment}{/* clear out smart object (WRT}
\textcolor{comment}{                                       * members) */}
     \{
        \textcolor{keywordflow}{if} (d.rects[0])
          \{
             evas\_smart\_example\_remove(d.smt, d.rects[0]);
             \hyperlink{group__Evas__Object__Group__Basic_ga7e7a625dab7a3890532aa13b43117076}{evas\_object\_del}(d.rects[0]);
          \}
        \textcolor{keywordflow}{if} (d.rects[1])
          \{
             evas\_smart\_example\_remove(d.smt, d.rects[1]);
             \hyperlink{group__Evas__Object__Group__Basic_ga7e7a625dab7a3890532aa13b43117076}{evas\_object\_del}(d.rects[1]);
          \}

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

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

        \textcolor{keywordflow}{return};
     \}

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

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

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

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

        \textcolor{keywordflow}{return};
     \}

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

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

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

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

        \textcolor{keywordflow}{return};
     \}

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

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

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

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

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

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

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

        \textcolor{keywordflow}{return};
     \}

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

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

        w *= 1.1;
        h *= 1.1;

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

        \textcolor{keywordflow}{return};
     \}

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

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

        w *= 0.9;
        h *= 0.9;

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

        \textcolor{keywordflow}{return};
     \}

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

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

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

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

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

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

   srand(time(NULL));

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

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

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

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

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

   iface = (Evas\_Smart\_Example\_Interface *)&iface1;
   iface->base.name = IFACE1\_NAME;
   iface->base.private\_size = \textcolor{keyword}{sizeof}(iface1\_data);
   iface->base.add = \_iface1\_add;
   iface->base.del = \_iface1\_del;
   iface->example\_func = \_iface1\_custom\_fn;

   d.smt = evas\_smart\_example\_add(d.evas);

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

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

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

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

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

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

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

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

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

   iface = (Evas\_Smart\_Example\_Interface *)\hyperlink{group__Evas__Smart__Object__Group_ga726849e13d3bbc0c7ce182e3f82ce07f}{evas\_object\_smart\_interface\_get}
       (d.smt, IFACE1\_NAME);
   \textcolor{keywordflow}{if} (iface)
     \{
        \textcolor{keywordtype}{char} *data;

        fprintf(stdout, \textcolor{stringliteral}{"We've found a smart interface on the smart object!"}
                        \textcolor{stringliteral}{"\(\backslash\)n\(\backslash\)tname: %s\(\backslash\)n"}, iface->base.name);

        fprintf(stdout, \textcolor{stringliteral}{"Setting its interface data...\(\backslash\)n"});
        data = \hyperlink{group__Evas__Smart__Object__Group_gaed3359faaae2d7cffd3e24441591da04}{evas\_object\_smart\_interface\_data\_get}
            (d.smt, (\hyperlink{struct__Evas__Smart__Interface}{Evas\_Smart\_Interface} *)iface);
        memcpy(data, iface1\_data, \textcolor{keyword}{sizeof}(iface1\_data));

        fprintf(stdout, \textcolor{stringliteral}{"Calling an interface's function...\(\backslash\)n"});
        iface->example\_func(d.smt);
     \}

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

   \hyperlink{group__Ecore__Evas__Group_gad3ec61f2aa03df4d3dbfd0d311e0c8dc}{ecore\_evas\_free}(d.ee);
   \hyperlink{group__Ecore__Evas__Group_gab8fa311077f749190c9b622f672b2214}{ecore\_evas\_shutdown}();
   \textcolor{keywordflow}{return} 0;

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