In this example, we illustrate how to use text objects in various manners.

We place, in the canvas, a text object along with a border image to delimit its geometry. After we instantiate the text object, we set lots of properties on it to the initial ones from a preset list, which has the following declaration\+:  
\begin{DoxyCodeInclude}
   \textcolor{comment}{/* init values one is going to cycle through while running this}
\textcolor{comment}{    * example */}
   \textcolor{keyword}{struct }text\_preset\_data init\_data =
   \{
      .font = \{\textcolor{stringliteral}{"DejaVu"}, \textcolor{stringliteral}{"Courier"}, \textcolor{stringliteral}{"Utopia"}\},
      .text = \{BLACK, WHITE, GREY, RED, GREEN, BLUE\},
      .shadow = \{WHITE, BLUE, GREEN, RED\},
      .outline = \{WHITE, RED, GREEN, BLUE\},
      .glow = \{WHITE, BLUE, GREEN, RED\},
      .glow2 = \{WHITE, RED, BLUE, GREEN\}
   \};

\end{DoxyCodeInclude}


Then, we set the text string itself, on it, with evas\+\_\+object\+\_\+text\+\_\+text\+\_\+set(). We set an explicit size of 30 points for our font, as you could see, what we check back with the getter evas\+\_\+object\+\_\+text\+\_\+font\+\_\+get().

Look at how it translates to code\+:  
\begin{DoxyCodeInclude}
   d.text = \mbox{\hyperlink{group__Evas__Object__Text_ga72224822cf1772ef16b1554f0a6205d5}{evas\_object\_text\_add}}(d.evas);
   evas\_object\_text\_style\_set(d.text, EVAS\_TEXT\_STYLE\_PLAIN);

   \textcolor{comment}{/* let the pre-set things be enforced */}
   \mbox{\hyperlink{group__Evas__Object__Group__Basic_gae34bdcfd7f5100151f6ea8ef4a392949}{evas\_object\_color\_set}}(
     d.text, d.t\_data.text\_ptr->r, d.t\_data.text\_ptr->g,
     d.t\_data.text\_ptr->b, d.t\_data.text\_ptr->a);

   evas\_object\_text\_glow\_color\_set(
     d.text, d.t\_data.glow\_ptr->r, d.t\_data.glow\_ptr->g,
     d.t\_data.glow\_ptr->b, d.t\_data.glow\_ptr->a);

   evas\_object\_text\_glow2\_color\_set(
     d.text, d.t\_data.glow2\_ptr->r, d.t\_data.glow2\_ptr->g,
     d.t\_data.glow2\_ptr->b, d.t\_data.glow2\_ptr->a);

   evas\_object\_text\_outline\_color\_set(
     d.text, d.t\_data.outline\_ptr->r, d.t\_data.outline\_ptr->g,
     d.t\_data.outline\_ptr->b, d.t\_data.outline\_ptr->a);

   evas\_object\_text\_shadow\_color\_set(
     d.text, d.t\_data.shadow\_ptr->r, d.t\_data.shadow\_ptr->g,
     d.t\_data.shadow\_ptr->b, d.t\_data.shadow\_ptr->a);

   evas\_object\_text\_font\_set(d.text, *d.t\_data.font\_ptr, 30);
   evas\_object\_text\_text\_set(d.text, \textcolor{stringliteral}{"sample text"});

   evas\_object\_resize(d.text, (3 * WIDTH) / 4, HEIGHT / 4);
   evas\_object\_move(d.text, WIDTH / 8, (3 * HEIGHT) / 8);
   \mbox{\hyperlink{group__Evas__Object__Group__Basic_ga9cbc13661584e49fb9d9cdab514a1eeb}{evas\_object\_show}}(d.text);

   evas\_object\_text\_font\_get(d.text, &font, &size);
   printf(\textcolor{stringliteral}{"Adding text object with font %s, size %d\(\backslash\)n"}, font, size);

   \textcolor{comment}{/* this is a border around the text object above, here just to}
\textcolor{comment}{    * emphasize its geometry */}
   d.border = evas\_object\_image\_filled\_add(d.evas);
   evas\_object\_image\_file\_set(d.border, border\_img\_path, NULL);
   evas\_object\_image\_border\_set(d.border, 3, 3, 3, 3);
   evas\_object\_image\_border\_center\_fill\_set(d.border, EVAS\_BORDER\_FILL\_NONE);

   evas\_object\_resize(d.border, ((3 * WIDTH) / 4) + 3, (HEIGHT / 4) + 3);
   evas\_object\_move(d.border, (WIDTH / 8) - 3, ((3 * HEIGHT) / 8) - 3);
   \mbox{\hyperlink{group__Evas__Object__Group__Basic_ga9cbc13661584e49fb9d9cdab514a1eeb}{evas\_object\_show}}(d.border);

   printf(\textcolor{stringliteral}{"%s"}, commands);
   \mbox{\hyperlink{group__Ecore__Main__Loop__Group_gaf103b9f668bb3e4fed12e52c6180132d}{ecore\_main\_loop\_begin}}();

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

\mbox{\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"}

\end{DoxyCodeInclude}


Like in other Evas examples, one interacts with it by means of key commands\+:  
\begin{DoxyCodeInclude}
\textcolor{keyword}{static} \textcolor{keyword}{const} \textcolor{keywordtype}{char} *commands = \(\backslash\)
  \textcolor{stringliteral}{"commands are:\(\backslash\)n"}
  \textcolor{stringliteral}{"\(\backslash\)tt - change text's current style\(\backslash\)n"}
  \textcolor{stringliteral}{"\(\backslash\)tz - change text's font size\(\backslash\)n"}
  \textcolor{stringliteral}{"\(\backslash\)tf - change text's font family\(\backslash\)n"}
  \textcolor{stringliteral}{"\(\backslash\)tb - change text's base color\(\backslash\)n"}
  \textcolor{stringliteral}{"\(\backslash\)ts - change text's \(\backslash\)'shadow\(\backslash\)' color\(\backslash\)n"}
  \textcolor{stringliteral}{"\(\backslash\)to - change text's \(\backslash\)'outline\(\backslash\)' color\(\backslash\)n"}
  \textcolor{stringliteral}{"\(\backslash\)tw - change text's \(\backslash\)'glow\(\backslash\)' color\(\backslash\)n"}
  \textcolor{stringliteral}{"\(\backslash\)tg - change text's \(\backslash\)'glow 2\(\backslash\)' color\(\backslash\)n"}
  \textcolor{stringliteral}{"\(\backslash\)th - print help\(\backslash\)n"};

\end{DoxyCodeInclude}


Use the \textquotesingle{}t\textquotesingle{} key to exercise the evas\+\_\+object\+\_\+text\+\_\+style\+\_\+set() function on the text -- it will cycle through all styles on \#\+Evas\+\_\+\+Text\+\_\+\+Style\+\_\+\+Type (note we start on \#\+E\+V\+A\+S\+\_\+\+T\+E\+X\+T\+\_\+\+S\+T\+Y\+L\+E\+\_\+\+P\+L\+A\+IN, thus with no effects on it) and, with other keys, you\textquotesingle{}ll be able to set properties applicable to individual styles on the text object.

The \textquotesingle{}z\textquotesingle{} key will change the text\textquotesingle{}s {\bfseries size}, keeping the font family for it. Use \textquotesingle{}f\textquotesingle{} to change the font, keeping the last size set. There are three font families the example will cycle through\+:

The \textquotesingle{}b\textquotesingle{} command shows us that \mbox{\hyperlink{group__Evas__Object__Group__Basic_gae34bdcfd7f5100151f6ea8ef4a392949}{evas\+\_\+object\+\_\+color\+\_\+set()}}, on a given text object, will change the text\textquotesingle{}s {\bfseries base} color. Experiment with it, which will cycle through the colors in the {\ttfamily .text} list in {\ttfamily init\+\_\+data}.

The \textquotesingle{}s\textquotesingle{}, \textquotesingle{}o\textquotesingle{}, \textquotesingle{}w\textquotesingle{} and \textquotesingle{}g\textquotesingle{} keys will make the text object to cycle to the preset values on colors for shadow, outline, glow and \textquotesingle{}glow 2\textquotesingle{} effects, respectively. Naturally, they will only take effect on the text styles which resemble them.

The full example follows.


\begin{DoxyCodeInclude}

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

\textcolor{preprocessor}{#include <Ecore.h>}
\textcolor{preprocessor}{#include <\mbox{\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{preprocessor}{#define GREY \{190, 190, 190, 255\}}
\textcolor{preprocessor}{#define BLACK \{0, 0, 0, 255\}}
\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{preprocessor}{#define POINTER\_CYCLE(\_ptr, \_array)                             \(\backslash\)}
\textcolor{preprocessor}{  do                                                            \(\backslash\)}
\textcolor{preprocessor}{    \{                                                           \(\backslash\)}
\textcolor{preprocessor}{       if ((unsigned int)(((unsigned char *)(\_ptr)) - ((unsigned char *)(\_array))) >= \(\backslash\)}
\textcolor{preprocessor}{           sizeof(\_array))                                      \(\backslash\)}
\textcolor{preprocessor}{         \_ptr = \_array;                                         \(\backslash\)}
\textcolor{preprocessor}{    \}                                                           \(\backslash\)}
\textcolor{preprocessor}{  while(0)}

\textcolor{keyword}{static} \textcolor{keyword}{const} \textcolor{keywordtype}{char} *commands = \(\backslash\)
  \textcolor{stringliteral}{"commands are:\(\backslash\)n"}
  \textcolor{stringliteral}{"\(\backslash\)tt - change text's current style\(\backslash\)n"}
  \textcolor{stringliteral}{"\(\backslash\)tz - change text's font size\(\backslash\)n"}
  \textcolor{stringliteral}{"\(\backslash\)tf - change text's font family\(\backslash\)n"}
  \textcolor{stringliteral}{"\(\backslash\)tb - change text's base color\(\backslash\)n"}
  \textcolor{stringliteral}{"\(\backslash\)ts - change text's \(\backslash\)'shadow\(\backslash\)' color\(\backslash\)n"}
  \textcolor{stringliteral}{"\(\backslash\)to - change text's \(\backslash\)'outline\(\backslash\)' color\(\backslash\)n"}
  \textcolor{stringliteral}{"\(\backslash\)tw - change text's \(\backslash\)'glow\(\backslash\)' color\(\backslash\)n"}
  \textcolor{stringliteral}{"\(\backslash\)tg - change text's \(\backslash\)'glow 2\(\backslash\)' color\(\backslash\)n"}
  \textcolor{stringliteral}{"\(\backslash\)th - print help\(\backslash\)n"};

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

\textcolor{keyword}{struct }color\_tuple
\{
   \textcolor{keywordtype}{int} r, g, b, a;
\};

\textcolor{keyword}{struct }text\_preset\_data
\{
   \textcolor{keyword}{const} \textcolor{keywordtype}{char}        **font\_ptr;
   \textcolor{keyword}{const} \textcolor{keywordtype}{char}         *font[3];

   \textcolor{keyword}{struct }color\_tuple *text\_ptr;
   \textcolor{keyword}{struct }color\_tuple  text[6];

   \textcolor{keyword}{struct }color\_tuple *shadow\_ptr;
   \textcolor{keyword}{struct }color\_tuple  shadow[4];

   \textcolor{keyword}{struct }color\_tuple *outline\_ptr;
   \textcolor{keyword}{struct }color\_tuple  outline[4];

   \textcolor{keyword}{struct }color\_tuple *glow\_ptr;
   \textcolor{keyword}{struct }color\_tuple  glow[4];

   \textcolor{keyword}{struct }color\_tuple *glow2\_ptr;
   \textcolor{keyword}{struct }color\_tuple  glow2[4];
\};

\textcolor{keyword}{struct }test\_data
\{
   Ecore\_Evas             *ee;
   \mbox{\hyperlink{group__Evas__Canvas_ga5ff87cc4ce6bc43e3b640a6d37f73043}{Evas}}                   *\mbox{\hyperlink{namespaceevas}{evas}};
   \textcolor{keyword}{struct }text\_preset\_data t\_data;
   \mbox{\hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object}}            *text, *bg, *border;
\};

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

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

\textcolor{comment}{/* Keep the example's window size in sync with the background image's size */}
\textcolor{keyword}{static} \textcolor{keywordtype}{void}
\_canvas\_resize\_cb(Ecore\_Evas *ee)
\{
   \textcolor{keywordtype}{int} w, h;

   \mbox{\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{keyword}{const} \textcolor{keywordtype}{char} *
\_text\_style\_type\_to\_str(Evas\_Text\_Style\_Type mode)
\{
   \textcolor{keywordflow}{switch} (mode)
     \{
      \textcolor{keywordflow}{case} EVAS\_TEXT\_STYLE\_PLAIN:
        \textcolor{keywordflow}{return} \textcolor{stringliteral}{"plain"};

      \textcolor{keywordflow}{case} EVAS\_TEXT\_STYLE\_SHADOW:
        \textcolor{keywordflow}{return} \textcolor{stringliteral}{"shadow"};

      \textcolor{keywordflow}{case} EVAS\_TEXT\_STYLE\_OUTLINE:
        \textcolor{keywordflow}{return} \textcolor{stringliteral}{"outline"};

      \textcolor{keywordflow}{case} EVAS\_TEXT\_STYLE\_SOFT\_OUTLINE:
        \textcolor{keywordflow}{return} \textcolor{stringliteral}{"soft outline"};

      \textcolor{keywordflow}{case} EVAS\_TEXT\_STYLE\_GLOW:
        \textcolor{keywordflow}{return} \textcolor{stringliteral}{"glow"};

      \textcolor{keywordflow}{case} EVAS\_TEXT\_STYLE\_OUTLINE\_SHADOW:
        \textcolor{keywordflow}{return} \textcolor{stringliteral}{"outline shadow"};

      \textcolor{keywordflow}{case} EVAS\_TEXT\_STYLE\_FAR\_SHADOW:
        \textcolor{keywordflow}{return} \textcolor{stringliteral}{"far shadow"};

      \textcolor{keywordflow}{case} EVAS\_TEXT\_STYLE\_OUTLINE\_SOFT\_SHADOW:
        \textcolor{keywordflow}{return} \textcolor{stringliteral}{"outline soft shadow"};

      \textcolor{keywordflow}{case} EVAS\_TEXT\_STYLE\_SOFT\_SHADOW:
        \textcolor{keywordflow}{return} \textcolor{stringliteral}{"soft shadow"};

      \textcolor{keywordflow}{case} EVAS\_TEXT\_STYLE\_FAR\_SOFT\_SHADOW:
        \textcolor{keywordflow}{return} \textcolor{stringliteral}{"far soft shadow"};

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

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

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

   \textcolor{keywordflow}{if} (strcmp(ev->\mbox{\hyperlink{struct__Evas__Event__Key__Down_a70473bba88a1afaee180a54150513824}{key}}, \textcolor{stringliteral}{"t"}) == 0) \textcolor{comment}{/* change text's current style */}
     \{
        Evas\_Text\_Style\_Type type = evas\_object\_text\_style\_get(d.text);

        type = (type + 1) % 10;

        evas\_object\_text\_style\_set(d.text, type);

        printf(\textcolor{stringliteral}{"Changing text's style to \(\backslash\)'%s\(\backslash\)'\(\backslash\)n"},
               \_text\_style\_type\_to\_str(type));

        \textcolor{keywordflow}{return};
     \}

   \textcolor{keywordflow}{if} (strcmp(ev->\mbox{\hyperlink{struct__Evas__Event__Key__Down_a70473bba88a1afaee180a54150513824}{key}}, \textcolor{stringliteral}{"f"}) == 0) \textcolor{comment}{/* change text's font */}
     \{
         \textcolor{keywordtype}{int} sz;

        (d.t\_data.font\_ptr)++;

        evas\_object\_text\_font\_get(d.text, NULL, &sz);

        POINTER\_CYCLE(d.t\_data.font\_ptr, d.t\_data.font);

        evas\_object\_text\_font\_set(d.text, *d.t\_data.font\_ptr, sz);

        printf(\textcolor{stringliteral}{"Changing text's font to %s\(\backslash\)n"},
               *d.t\_data.font\_ptr);

        \textcolor{keywordflow}{return};
     \}

   \textcolor{keywordflow}{if} (strcmp(ev->\mbox{\hyperlink{struct__Evas__Event__Key__Down_a70473bba88a1afaee180a54150513824}{key}}, \textcolor{stringliteral}{"b"}) == 0) \textcolor{comment}{/* change text's base color */}
     \{
        (d.t\_data.text\_ptr)++;

        POINTER\_CYCLE(d.t\_data.text\_ptr, d.t\_data.text);

        \mbox{\hyperlink{group__Evas__Object__Group__Basic_gae34bdcfd7f5100151f6ea8ef4a392949}{evas\_object\_color\_set}}(
          d.text, d.t\_data.text\_ptr->r, d.t\_data.text\_ptr->g,
          d.t\_data.text\_ptr->b, d.t\_data.text\_ptr->a);

        printf(\textcolor{stringliteral}{"Changing base color for text to (%d, %d, %d, %d)\(\backslash\)n"},
               d.t\_data.text\_ptr->r, d.t\_data.text\_ptr->g,
               d.t\_data.text\_ptr->b, d.t\_data.text\_ptr->a);

        \textcolor{keywordflow}{return};
     \}

   \textcolor{keywordflow}{if} (strcmp(ev->\mbox{\hyperlink{struct__Evas__Event__Key__Down_a70473bba88a1afaee180a54150513824}{key}}, \textcolor{stringliteral}{"g"}) == 0) \textcolor{comment}{/* change text's glow 2 color */}
     \{
        (d.t\_data.glow2\_ptr)++;

        POINTER\_CYCLE(d.t\_data.glow2\_ptr, d.t\_data.glow2);

        evas\_object\_text\_glow2\_color\_set(
          d.text, d.t\_data.glow2\_ptr->r, d.t\_data.glow2\_ptr->g,
          d.t\_data.glow2\_ptr->b, d.t\_data.glow2\_ptr->a);

        printf(\textcolor{stringliteral}{"Changing glow 2 color for text to (%d, %d, %d, %d)\(\backslash\)n"},
               d.t\_data.glow2\_ptr->r, d.t\_data.glow2\_ptr->g,
               d.t\_data.glow2\_ptr->b, d.t\_data.glow2\_ptr->a);

        \textcolor{keywordflow}{return};
     \}

   \textcolor{keywordflow}{if} (strcmp(ev->\mbox{\hyperlink{struct__Evas__Event__Key__Down_a70473bba88a1afaee180a54150513824}{key}}, \textcolor{stringliteral}{"w"}) == 0) \textcolor{comment}{/* change text's glow color */}
     \{
        (d.t\_data.glow\_ptr)++;

        POINTER\_CYCLE(d.t\_data.glow\_ptr, d.t\_data.glow);

        evas\_object\_text\_glow\_color\_set(
          d.text, d.t\_data.glow\_ptr->r, d.t\_data.glow\_ptr->g,
          d.t\_data.glow\_ptr->b, d.t\_data.glow\_ptr->a);

        printf(\textcolor{stringliteral}{"Changing glow color for text to (%d, %d, %d, %d)\(\backslash\)n"},
               d.t\_data.glow\_ptr->r, d.t\_data.glow\_ptr->g,
               d.t\_data.glow\_ptr->b, d.t\_data.glow\_ptr->a);

        \textcolor{keywordflow}{return};
     \}

   \textcolor{keywordflow}{if} (strcmp(ev->\mbox{\hyperlink{struct__Evas__Event__Key__Down_a70473bba88a1afaee180a54150513824}{key}}, \textcolor{stringliteral}{"o"}) == 0) \textcolor{comment}{/* change text's outline color */}
     \{
        (d.t\_data.outline\_ptr)++;

        POINTER\_CYCLE(d.t\_data.outline\_ptr, d.t\_data.outline);

        evas\_object\_text\_outline\_color\_set(
          d.text, d.t\_data.outline\_ptr->r, d.t\_data.outline\_ptr->g,
          d.t\_data.outline\_ptr->b, d.t\_data.outline\_ptr->a);

        printf(\textcolor{stringliteral}{"Changing outline color for text to (%d, %d, %d, %d)\(\backslash\)n"},
               d.t\_data.outline\_ptr->r, d.t\_data.outline\_ptr->g,
               d.t\_data.outline\_ptr->b, d.t\_data.outline\_ptr->a);

        \textcolor{keywordflow}{return};
     \}

   \textcolor{keywordflow}{if} (strcmp(ev->\mbox{\hyperlink{struct__Evas__Event__Key__Down_a70473bba88a1afaee180a54150513824}{key}}, \textcolor{stringliteral}{"s"}) == 0) \textcolor{comment}{/* change text's shadow color */}
     \{
        (d.t\_data.shadow\_ptr)++;

        POINTER\_CYCLE(d.t\_data.shadow\_ptr, d.t\_data.shadow);

        evas\_object\_text\_shadow\_color\_set(
          d.text, d.t\_data.shadow\_ptr->r, d.t\_data.shadow\_ptr->g,
          d.t\_data.shadow\_ptr->b, d.t\_data.shadow\_ptr->a);

        printf(\textcolor{stringliteral}{"Changing shadow color for text to (%d, %d, %d, %d)\(\backslash\)n"},
               d.t\_data.shadow\_ptr->r, d.t\_data.shadow\_ptr->g,
               d.t\_data.shadow\_ptr->b, d.t\_data.shadow\_ptr->a);

        \textcolor{keywordflow}{return};
     \}

   \textcolor{keywordflow}{if} (strcmp(ev->\mbox{\hyperlink{struct__Evas__Event__Key__Down_a70473bba88a1afaee180a54150513824}{key}}, \textcolor{stringliteral}{"z"}) == 0) \textcolor{comment}{/* change text's font size */}
     \{
        \textcolor{keyword}{const} \textcolor{keywordtype}{char} *font;
        \textcolor{keywordtype}{int} size;

        evas\_object\_text\_font\_get(d.text, &font, &size);

        size = (size + 10) % 50;
        \textcolor{keywordflow}{if} (!size) size = 10;

        evas\_object\_text\_font\_set(d.text, font, size);

        printf(\textcolor{stringliteral}{"Changing text's font size to %d\(\backslash\)n"}, size);

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

\textcolor{keywordtype}{int}
main(\textcolor{keywordtype}{void})
\{
   \textcolor{keywordtype}{int} size;
   \textcolor{keyword}{const} \textcolor{keywordtype}{char} *font;

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

   \textcolor{comment}{/* init values one is going to cycle through while running this}
\textcolor{comment}{    * example */}
   \textcolor{keyword}{struct }text\_preset\_data init\_data =
   \{
      .font = \{\textcolor{stringliteral}{"DejaVu"}, \textcolor{stringliteral}{"Courier"}, \textcolor{stringliteral}{"Utopia"}\},
      .text = \{BLACK, WHITE, GREY, RED, GREEN, BLUE\},
      .shadow = \{WHITE, BLUE, GREEN, RED\},
      .outline = \{WHITE, RED, GREEN, BLUE\},
      .glow = \{WHITE, BLUE, GREEN, RED\},
      .glow2 = \{WHITE, RED, BLUE, GREEN\}
   \};

   d.t\_data = init\_data;
   d.t\_data.font\_ptr = d.t\_data.font;
   d.t\_data.text\_ptr = d.t\_data.text;
   d.t\_data.glow\_ptr = d.t\_data.glow;
   d.t\_data.glow2\_ptr = d.t\_data.glow2;
   d.t\_data.outline\_ptr = d.t\_data.outline;
   d.t\_data.shadow\_ptr = d.t\_data.shadow;

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

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

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

   d.bg = \mbox{\hyperlink{group__Evas__Object__Rectangle_ga4d80fc32ad1cac28428cebd65d746751}{evas\_object\_rectangle\_add}}(d.evas);
   \mbox{\hyperlink{group__Evas__Object__Group__Basic_gae34bdcfd7f5100151f6ea8ef4a392949}{evas\_object\_color\_set}}(d.bg, 255, 255, 255, 255); \textcolor{comment}{/* white bg */}
   evas\_object\_move(d.bg, 0, 0); \textcolor{comment}{/* at canvas' origin */}
   evas\_object\_resize(d.bg, WIDTH, HEIGHT); \textcolor{comment}{/* covers full canvas */}
   \mbox{\hyperlink{group__Evas__Object__Group__Basic_ga9cbc13661584e49fb9d9cdab514a1eeb}{evas\_object\_show}}(d.bg);

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

   d.text = \mbox{\hyperlink{group__Evas__Object__Text_ga72224822cf1772ef16b1554f0a6205d5}{evas\_object\_text\_add}}(d.evas);
   evas\_object\_text\_style\_set(d.text, EVAS\_TEXT\_STYLE\_PLAIN);

   \textcolor{comment}{/* let the pre-set things be enforced */}
   \mbox{\hyperlink{group__Evas__Object__Group__Basic_gae34bdcfd7f5100151f6ea8ef4a392949}{evas\_object\_color\_set}}(
     d.text, d.t\_data.text\_ptr->r, d.t\_data.text\_ptr->g,
     d.t\_data.text\_ptr->b, d.t\_data.text\_ptr->a);

   evas\_object\_text\_glow\_color\_set(
     d.text, d.t\_data.glow\_ptr->r, d.t\_data.glow\_ptr->g,
     d.t\_data.glow\_ptr->b, d.t\_data.glow\_ptr->a);

   evas\_object\_text\_glow2\_color\_set(
     d.text, d.t\_data.glow2\_ptr->r, d.t\_data.glow2\_ptr->g,
     d.t\_data.glow2\_ptr->b, d.t\_data.glow2\_ptr->a);

   evas\_object\_text\_outline\_color\_set(
     d.text, d.t\_data.outline\_ptr->r, d.t\_data.outline\_ptr->g,
     d.t\_data.outline\_ptr->b, d.t\_data.outline\_ptr->a);

   evas\_object\_text\_shadow\_color\_set(
     d.text, d.t\_data.shadow\_ptr->r, d.t\_data.shadow\_ptr->g,
     d.t\_data.shadow\_ptr->b, d.t\_data.shadow\_ptr->a);

   evas\_object\_text\_font\_set(d.text, *d.t\_data.font\_ptr, 30);
   evas\_object\_text\_text\_set(d.text, \textcolor{stringliteral}{"sample text"});

   evas\_object\_resize(d.text, (3 * WIDTH) / 4, HEIGHT / 4);
   evas\_object\_move(d.text, WIDTH / 8, (3 * HEIGHT) / 8);
   \mbox{\hyperlink{group__Evas__Object__Group__Basic_ga9cbc13661584e49fb9d9cdab514a1eeb}{evas\_object\_show}}(d.text);

   evas\_object\_text\_font\_get(d.text, &font, &size);
   printf(\textcolor{stringliteral}{"Adding text object with font %s, size %d\(\backslash\)n"}, font, size);

   \textcolor{comment}{/* this is a border around the text object above, here just to}
\textcolor{comment}{    * emphasize its geometry */}
   d.border = evas\_object\_image\_filled\_add(d.evas);
   evas\_object\_image\_file\_set(d.border, border\_img\_path, NULL);
   evas\_object\_image\_border\_set(d.border, 3, 3, 3, 3);
   evas\_object\_image\_border\_center\_fill\_set(d.border, EVAS\_BORDER\_FILL\_NONE);

   evas\_object\_resize(d.border, ((3 * WIDTH) / 4) + 3, (HEIGHT / 4) + 3);
   evas\_object\_move(d.border, (WIDTH / 8) - 3, ((3 * HEIGHT) / 8) - 3);
   \mbox{\hyperlink{group__Evas__Object__Group__Basic_ga9cbc13661584e49fb9d9cdab514a1eeb}{evas\_object\_show}}(d.border);

   printf(\textcolor{stringliteral}{"%s"}, commands);
   \mbox{\hyperlink{group__Ecore__Main__Loop__Group_gaf103b9f668bb3e4fed12e52c6180132d}{ecore\_main\_loop\_begin}}();

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

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