

This example shows how to manipulate and change Color classes. In this example we will create two surfaces to show what happens when you change the color class at the process and object level.

It\textquotesingle{}s a very simple example, there are two surfaces created from the same E\+DC, but just in one of them we will set a specific color class, although both will be affected by color class set at the process level as you will see.

It\textquotesingle{}s important you know that all colors has the format R G B A. Just to be easier to understand this example, we will create a small set of colors that will be used along of the example. This piece of code is shown below\+: 
\begin{DoxyCodeInclude}{0}
\DoxyCodeLine{\textcolor{keyword}{static} color colors\_init\_data[] =}
\DoxyCodeLine{  \{\{255, 0, 0, 255\},            \textcolor{comment}{/* red */}}
\DoxyCodeLine{   \{0, 255, 0, 255\},            \textcolor{comment}{/* green */}}
\DoxyCodeLine{   \{0, 0, 255, 255\},            \textcolor{comment}{/* blue */}}
\DoxyCodeLine{   \{0, 0, 0, 255\},              \textcolor{comment}{/* black */}}
\DoxyCodeLine{   \{255, 255, 255, 255\},        \textcolor{comment}{/* white */}}
\DoxyCodeLine{   \{128, 128, 128, 255\},        \textcolor{comment}{/* gray */}}
\DoxyCodeLine{   \{255, 255, 0, 255\},          \textcolor{comment}{/* yellow */}}
\DoxyCodeLine{   \{255, 0, 255, 255\}           \textcolor{comment}{/* pink */}}
\DoxyCodeLine{  \};}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{keyword}{static} \textcolor{keywordtype}{char} *color\_names[] =}
\DoxyCodeLine{  \{\textcolor{stringliteral}{"red"}, \textcolor{stringliteral}{"green"}, \textcolor{stringliteral}{"blue"}, \textcolor{stringliteral}{"black"}, \textcolor{stringliteral}{"white"},}
\DoxyCodeLine{   \textcolor{stringliteral}{"gray"}, \textcolor{stringliteral}{"yellow"}, \textcolor{stringliteral}{"pink"}\};}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{keyword}{static} \mbox{\hyperlink{group__Eina__Types__Group_ga3fe0caf72e93b1bab1ca8ee3ccf3f226}{Eina\_Bool}}}
\DoxyCodeLine{\_get\_color\_from\_name(\textcolor{keyword}{const} \textcolor{keywordtype}{char} *n, color *c)}
\DoxyCodeLine{\{}
\DoxyCodeLine{   \textcolor{keywordtype}{int} i;}
\DoxyCodeLine{   \textcolor{keywordflow}{for} (i = 0; i < 8; i++)}
\DoxyCodeLine{     \textcolor{keywordflow}{if} (!strcmp(n, color\_names[i]))}
\DoxyCodeLine{       \{}
\DoxyCodeLine{          (*c)[0] = (colors\_init\_data[i])[0];}
\DoxyCodeLine{          (*c)[1] = (colors\_init\_data[i])[1];}
\DoxyCodeLine{          (*c)[2] = (colors\_init\_data[i])[2];}
\DoxyCodeLine{          (*c)[3] = (colors\_init\_data[i])[3];}
\DoxyCodeLine{          \textcolor{keywordflow}{return} \mbox{\hyperlink{group__Eina__Types__Group_ga05c12dacc8b4058994df842b41be85fc}{EINA\_TRUE}};}
\DoxyCodeLine{       \}}
\DoxyCodeLine{}
\DoxyCodeLine{   \textcolor{keywordflow}{return} \mbox{\hyperlink{group__Eina__Types__Group_ga1feb115f8e9913e806e090d9bd5a7301}{EINA\_FALSE}};}
\DoxyCodeLine{\}}

\end{DoxyCodeInclude}


Focusing on the relevant parts of the code we go right to the part where we set the new color class. For that we will use the functions edje\+\_\+color\+\_\+class\+\_\+set ( which will affect all edjes) and edje\+\_\+object\+\_\+color\+\_\+class\+\_\+set (which affects just the specific object). 
\begin{DoxyCodeInclude}{0}
\DoxyCodeLine{   \mbox{\hyperlink{group__Edje__Object__Color__Class_ga684435de625bdbb996e405e3eaaa54ad}{edje\_color\_class\_set}}(argv[1],                     \textcolor{comment}{/* class name   */}}
\DoxyCodeLine{                        c1[0], c1[1], c1[2], c1[3],  \textcolor{comment}{/* Object color */}}
\DoxyCodeLine{                        c2[0], c2[1], c2[2], c2[3],  \textcolor{comment}{/* Text outline */}}
\DoxyCodeLine{                        c3[0], c3[1], c3[2], c3[3]); \textcolor{comment}{/* Text shadow  */}}
\DoxyCodeLine{}
\DoxyCodeLine{   \textcolor{comment}{/* Setting an arbitrary value just to see the difference between */}}
\DoxyCodeLine{   \textcolor{comment}{/* process level and object level */}}
\DoxyCodeLine{   edje\_object\_color\_class\_set(edje\_obj2, argv[1], \textcolor{comment}{/* class name   */}}
\DoxyCodeLine{                               128, 180, 77, 255,  \textcolor{comment}{/* Object color */}}
\DoxyCodeLine{                               200, 22, 86, 255,   \textcolor{comment}{/* Text outline */}}
\DoxyCodeLine{                               39, 90, 187, 255);  \textcolor{comment}{/* Text shadow  */}}

\end{DoxyCodeInclude}
 \begin{DoxyNote}{Note}

\begin{DoxyItemize}
\item argv\mbox{[}1\mbox{]} is the name of a color class used in the E\+DC.
\item The second and third colors only apply to text part.
\item The color class set for the object overrides the color previously set.
\end{DoxyItemize}
\end{DoxyNote}
After we have set the color class we will check the color classes, for that we created a function which prints all color classes and tries to get theirs values and print too.  
\begin{DoxyCodeInclude}{0}
\DoxyCodeLine{\_color\_classes\_print(\textcolor{keywordtype}{void})}
\DoxyCodeLine{\{}
\DoxyCodeLine{   \mbox{\hyperlink{struct__Eina__List}{Eina\_List}} *classes;}
\DoxyCodeLine{   \textcolor{keywordtype}{char} *class\_name;}
\DoxyCodeLine{}
\DoxyCodeLine{   printf(\textcolor{stringliteral}{"Getting the color classes\(\backslash\)n\(\backslash\)n"});}
\DoxyCodeLine{   classes = \mbox{\hyperlink{group__Edje__Object__Color__Class_gac9de6885daf1eea7d3f6e3e822a4ca65}{edje\_color\_class\_list}}();}
\DoxyCodeLine{   \mbox{\hyperlink{group__Eina__List__Group_gae27a2c686a0a11693f9b06957c9bba83}{EINA\_LIST\_FREE}}(classes, class\_name)}
\DoxyCodeLine{     \{}
\DoxyCodeLine{        \textcolor{keywordtype}{int} r1, r2, r3, g1, g2, g3, b1, b2, b3,}
\DoxyCodeLine{          a1, a2, a3;}
\DoxyCodeLine{}
\DoxyCodeLine{        printf(\textcolor{stringliteral}{"\(\backslash\)ncolor class: \%s\(\backslash\)n"}, class\_name);}
\DoxyCodeLine{        \textcolor{keywordflow}{if} (!\mbox{\hyperlink{group__Edje__Object__Color__Class_gaf4e14706bc9766011ca60862f057d56e}{edje\_color\_class\_get}}(class\_name, \&r1, \&g1, \&b1, \&a1,}
\DoxyCodeLine{                                  \&r2, \&g2, \&b2, \&a2, \&r3, \&g3, \&b3, \&a3))}
\DoxyCodeLine{          fprintf(stderr, \textcolor{stringliteral}{"Cannot get the color class\(\backslash\)n"});}
\DoxyCodeLine{        \textcolor{keywordflow}{else}}
\DoxyCodeLine{          \{}
\DoxyCodeLine{}
\DoxyCodeLine{             printf(\textcolor{stringliteral}{"Object color r: \%d g: \%d b: \%d a: \%d\(\backslash\)n"},}
\DoxyCodeLine{                     r1, g1, b1, a1);}
\DoxyCodeLine{             printf(\textcolor{stringliteral}{"Text outline color r: \%d g: \%d b: \%d a: \%d\(\backslash\)n"},}
\DoxyCodeLine{                     r2, g2, b2, a2);}
\DoxyCodeLine{             printf(\textcolor{stringliteral}{"Text shadow color r: \%d g: \%d b: \%d a: \%d\(\backslash\)n"},}
\DoxyCodeLine{                     r3, g3, b3, a3);}
\DoxyCodeLine{          \}}
\DoxyCodeLine{        free(class\_name);}
\DoxyCodeLine{     \}}
\DoxyCodeLine{\}}

\end{DoxyCodeInclude}


There are two other things that are worth mentioning, we added two callbacks for the objects, one for mouse down (that we use to delete the color class) and another for the signal emitted when a color class is deleted. 
\begin{DoxyCodeInclude}{0}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Group__Events_ga23be30ac5cdfb780f1ff82e9108ec26b}{evas\_object\_event\_callback\_add}}(edje\_obj1, \mbox{\hyperlink{Evas__Common_8h_ad64cde0da38a60e7cb7905b3ab216968a9fa52651ccf7e47cd3b7785fc4cf393f}{EVAS\_CALLBACK\_MOUSE\_DOWN}},}
\DoxyCodeLine{                                  \_on\_mouse\_down, NULL);}
\DoxyCodeLine{   edje\_object\_signal\_callback\_add(edje\_obj1, \textcolor{stringliteral}{"color\_class,del"}, \textcolor{stringliteral}{"*"},}
\DoxyCodeLine{                                   (Edje\_Signal\_Cb) \_color\_class\_callback\_delete,}
\DoxyCodeLine{                                   \textcolor{stringliteral}{"process"});}

\end{DoxyCodeInclude}


And then we delete the color class\+:  
\begin{DoxyCodeInclude}{0}
\DoxyCodeLine{\_on\_mouse\_down(\textcolor{keywordtype}{void} *data \mbox{\hyperlink{group__Eina__Types__Group_ga82d751be730f849719ca292f9558be87}{EINA\_UNUSED}}, \mbox{\hyperlink{group__Evas__Canvas_ga5ff87cc4ce6bc43e3b640a6d37f73043}{Evas}} *e \mbox{\hyperlink{group__Eina__Types__Group_ga82d751be730f849719ca292f9558be87}{EINA\_UNUSED}}, \mbox{\hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object}} *obj, \textcolor{keywordtype}{void} *event\_info)}
\DoxyCodeLine{\{}
\DoxyCodeLine{   \mbox{\hyperlink{struct__Evas__Event__Mouse__Down}{Evas\_Event\_Mouse\_Down}} *ev = event\_info;}
\DoxyCodeLine{}
\DoxyCodeLine{   \textcolor{keywordflow}{if} (ev-\/>\mbox{\hyperlink{struct__Evas__Event__Mouse__Down_a0ab02808721d6c55fc642ecbb37d5ff9}{button}} == 1)}
\DoxyCodeLine{     \{}
\DoxyCodeLine{        \textcolor{keywordflow}{if} (obj == edje\_obj1)}
\DoxyCodeLine{          \mbox{\hyperlink{group__Edje__Object__Color__Class_ga0d30416497554e3f50c893de5c0cccad}{edje\_color\_class\_del}}(selected\_class);}
\DoxyCodeLine{        \textcolor{keywordflow}{else}}
\DoxyCodeLine{          edje\_object\_color\_class\_del(edje\_obj2, selected\_class);}
\DoxyCodeLine{     \}}

\end{DoxyCodeInclude}


Our example will look like this, if you run with the parameters \char`\"{}green\+\_\+class gray pink yellow\char`\"{}\+:

  
\begin{DoxyImageNoCaption}
  \mbox{\includegraphics[width=\textwidth]{edje-color-class-example}}
\end{DoxyImageNoCaption}
 ~\newline
   
\begin{DoxyImageNoCaption}
  \mbox{\includegraphics[width=\textwidth]{edje-color-class-example2}}
\end{DoxyImageNoCaption}


The full source code 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 EINA\_UNUSED}}
\DoxyCodeLine{\textcolor{preprocessor}{\#endif}}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{preprocessor}{\#ifndef PACKAGE\_DATA\_DIR}}
\DoxyCodeLine{\textcolor{preprocessor}{\#define PACKAGE\_DATA\_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 <\mbox{\hyperlink{Edje_8h}{Edje.h}}>}}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{preprocessor}{\#define WIDTH  (400)}}
\DoxyCodeLine{\textcolor{preprocessor}{\#define HEIGHT (400)}}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{keyword}{typedef} \textcolor{keywordtype}{int} color[4];           \textcolor{comment}{/* rgba */}}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{keyword}{static} Ecore\_Evas *ee1, *ee2;}
\DoxyCodeLine{\textcolor{keyword}{static} \mbox{\hyperlink{group__Evas__Canvas_ga5ff87cc4ce6bc43e3b640a6d37f73043}{Evas}} *evas1, *evas2;}
\DoxyCodeLine{\textcolor{keyword}{static} \mbox{\hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object}} *bg1, *edje\_obj1, *bg2, *edje\_obj2;}
\DoxyCodeLine{\textcolor{keyword}{static} \textcolor{keyword}{const} \textcolor{keywordtype}{char} *selected\_class;}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{keyword}{static} color colors\_init\_data[] =}
\DoxyCodeLine{  \{\{255, 0, 0, 255\},            \textcolor{comment}{/* red */}}
\DoxyCodeLine{   \{0, 255, 0, 255\},            \textcolor{comment}{/* green */}}
\DoxyCodeLine{   \{0, 0, 255, 255\},            \textcolor{comment}{/* blue */}}
\DoxyCodeLine{   \{0, 0, 0, 255\},              \textcolor{comment}{/* black */}}
\DoxyCodeLine{   \{255, 255, 255, 255\},        \textcolor{comment}{/* white */}}
\DoxyCodeLine{   \{128, 128, 128, 255\},        \textcolor{comment}{/* gray */}}
\DoxyCodeLine{   \{255, 255, 0, 255\},          \textcolor{comment}{/* yellow */}}
\DoxyCodeLine{   \{255, 0, 255, 255\}           \textcolor{comment}{/* pink */}}
\DoxyCodeLine{  \};}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{keyword}{static} \textcolor{keywordtype}{char} *color\_names[] =}
\DoxyCodeLine{  \{\textcolor{stringliteral}{"red"}, \textcolor{stringliteral}{"green"}, \textcolor{stringliteral}{"blue"}, \textcolor{stringliteral}{"black"}, \textcolor{stringliteral}{"white"},}
\DoxyCodeLine{   \textcolor{stringliteral}{"gray"}, \textcolor{stringliteral}{"yellow"}, \textcolor{stringliteral}{"pink"}\};}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{keyword}{static} \mbox{\hyperlink{group__Eina__Types__Group_ga3fe0caf72e93b1bab1ca8ee3ccf3f226}{Eina\_Bool}}}
\DoxyCodeLine{\_get\_color\_from\_name(\textcolor{keyword}{const} \textcolor{keywordtype}{char} *n, color *c)}
\DoxyCodeLine{\{}
\DoxyCodeLine{   \textcolor{keywordtype}{int} i;}
\DoxyCodeLine{   \textcolor{keywordflow}{for} (i = 0; i < 8; i++)}
\DoxyCodeLine{     \textcolor{keywordflow}{if} (!strcmp(n, color\_names[i]))}
\DoxyCodeLine{       \{}
\DoxyCodeLine{          (*c)[0] = (colors\_init\_data[i])[0];}
\DoxyCodeLine{          (*c)[1] = (colors\_init\_data[i])[1];}
\DoxyCodeLine{          (*c)[2] = (colors\_init\_data[i])[2];}
\DoxyCodeLine{          (*c)[3] = (colors\_init\_data[i])[3];}
\DoxyCodeLine{          \textcolor{keywordflow}{return} \mbox{\hyperlink{group__Eina__Types__Group_ga05c12dacc8b4058994df842b41be85fc}{EINA\_TRUE}};}
\DoxyCodeLine{       \}}
\DoxyCodeLine{}
\DoxyCodeLine{   \textcolor{keywordflow}{return} \mbox{\hyperlink{group__Eina__Types__Group_ga1feb115f8e9913e806e090d9bd5a7301}{EINA\_FALSE}};}
\DoxyCodeLine{\}}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{keyword}{static} \textcolor{keywordtype}{void}}
\DoxyCodeLine{\_color\_classes\_print(\textcolor{keywordtype}{void})}
\DoxyCodeLine{\{}
\DoxyCodeLine{   \mbox{\hyperlink{struct__Eina__List}{Eina\_List}} *classes;}
\DoxyCodeLine{   \textcolor{keywordtype}{char} *class\_name;}
\DoxyCodeLine{}
\DoxyCodeLine{   printf(\textcolor{stringliteral}{"Getting the color classes\(\backslash\)n\(\backslash\)n"});}
\DoxyCodeLine{   classes = \mbox{\hyperlink{group__Edje__Object__Color__Class_gac9de6885daf1eea7d3f6e3e822a4ca65}{edje\_color\_class\_list}}();}
\DoxyCodeLine{   \mbox{\hyperlink{group__Eina__List__Group_gae27a2c686a0a11693f9b06957c9bba83}{EINA\_LIST\_FREE}}(classes, class\_name)}
\DoxyCodeLine{     \{}
\DoxyCodeLine{        \textcolor{keywordtype}{int} r1, r2, r3, g1, g2, g3, b1, b2, b3,}
\DoxyCodeLine{          a1, a2, a3;}
\DoxyCodeLine{}
\DoxyCodeLine{        printf(\textcolor{stringliteral}{"\(\backslash\)ncolor class: \%s\(\backslash\)n"}, class\_name);}
\DoxyCodeLine{        \textcolor{keywordflow}{if} (!\mbox{\hyperlink{group__Edje__Object__Color__Class_gaf4e14706bc9766011ca60862f057d56e}{edje\_color\_class\_get}}(class\_name, \&r1, \&g1, \&b1, \&a1,}
\DoxyCodeLine{                                  \&r2, \&g2, \&b2, \&a2, \&r3, \&g3, \&b3, \&a3))}
\DoxyCodeLine{          fprintf(stderr, \textcolor{stringliteral}{"Cannot get the color class\(\backslash\)n"});}
\DoxyCodeLine{        \textcolor{keywordflow}{else}}
\DoxyCodeLine{          \{}
\DoxyCodeLine{}
\DoxyCodeLine{             printf(\textcolor{stringliteral}{"Object color r: \%d g: \%d b: \%d a: \%d\(\backslash\)n"},}
\DoxyCodeLine{                     r1, g1, b1, a1);}
\DoxyCodeLine{             printf(\textcolor{stringliteral}{"Text outline color r: \%d g: \%d b: \%d a: \%d\(\backslash\)n"},}
\DoxyCodeLine{                     r2, g2, b2, a2);}
\DoxyCodeLine{             printf(\textcolor{stringliteral}{"Text shadow color r: \%d g: \%d b: \%d a: \%d\(\backslash\)n"},}
\DoxyCodeLine{                     r3, g3, b3, a3);}
\DoxyCodeLine{          \}}
\DoxyCodeLine{        free(class\_name);}
\DoxyCodeLine{     \}}
\DoxyCodeLine{\}}
\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{keyword}{static} \textcolor{keywordtype}{void}}
\DoxyCodeLine{\_on\_mouse\_down(\textcolor{keywordtype}{void} *data \mbox{\hyperlink{group__Eina__Types__Group_ga82d751be730f849719ca292f9558be87}{EINA\_UNUSED}}, \mbox{\hyperlink{group__Evas__Canvas_ga5ff87cc4ce6bc43e3b640a6d37f73043}{Evas}} *e \mbox{\hyperlink{group__Eina__Types__Group_ga82d751be730f849719ca292f9558be87}{EINA\_UNUSED}}, \mbox{\hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object}} *obj, \textcolor{keywordtype}{void} *event\_info)}
\DoxyCodeLine{\{}
\DoxyCodeLine{   \mbox{\hyperlink{struct__Evas__Event__Mouse__Down}{Evas\_Event\_Mouse\_Down}} *ev = event\_info;}
\DoxyCodeLine{}
\DoxyCodeLine{   \textcolor{keywordflow}{if} (ev-\/>\mbox{\hyperlink{struct__Evas__Event__Mouse__Down_a0ab02808721d6c55fc642ecbb37d5ff9}{button}} == 1)}
\DoxyCodeLine{     \{}
\DoxyCodeLine{        \textcolor{keywordflow}{if} (obj == edje\_obj1)}
\DoxyCodeLine{          \mbox{\hyperlink{group__Edje__Object__Color__Class_ga0d30416497554e3f50c893de5c0cccad}{edje\_color\_class\_del}}(selected\_class);}
\DoxyCodeLine{        \textcolor{keywordflow}{else}}
\DoxyCodeLine{          edje\_object\_color\_class\_del(edje\_obj2, selected\_class);}
\DoxyCodeLine{     \}}
\DoxyCodeLine{\}}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{comment}{/* here just to keep our example's window size}}
\DoxyCodeLine{\textcolor{comment}{ * in synchrony. */}}
\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{}
\DoxyCodeLine{   \textcolor{keywordflow}{if} (\_ee == ee1)}
\DoxyCodeLine{     \{}
\DoxyCodeLine{        evas\_object\_resize(bg1, w, h);}
\DoxyCodeLine{        evas\_object\_resize(edje\_obj1, w, h);}
\DoxyCodeLine{     \}}
\DoxyCodeLine{   \textcolor{keywordflow}{else}}
\DoxyCodeLine{     \{}
\DoxyCodeLine{        evas\_object\_resize(bg2, w, h);}
\DoxyCodeLine{        evas\_object\_resize(edje\_obj2, w, h);}
\DoxyCodeLine{     \}}
\DoxyCodeLine{\}}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{keyword}{static} \textcolor{keywordtype}{void}}
\DoxyCodeLine{\_color\_class\_callback\_delete(\textcolor{keywordtype}{void} *data, \mbox{\hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object}} *obj \mbox{\hyperlink{group__Eina__Types__Group_ga82d751be730f849719ca292f9558be87}{EINA\_UNUSED}},}
\DoxyCodeLine{                             \textcolor{keyword}{const} \textcolor{keywordtype}{char} *emission, \textcolor{keywordtype}{void} *source \mbox{\hyperlink{group__Eina__Types__Group_ga82d751be730f849719ca292f9558be87}{EINA\_UNUSED}})}
\DoxyCodeLine{\{}
\DoxyCodeLine{   \textcolor{keywordflow}{if} (!strcmp(data, \textcolor{stringliteral}{"process"}))}
\DoxyCodeLine{     printf(\textcolor{stringliteral}{"Color class: \%s deleted on process level\(\backslash\)n"}, emission);}
\DoxyCodeLine{   \textcolor{keywordflow}{else}}
\DoxyCodeLine{     printf(\textcolor{stringliteral}{"Color class: \%s deleted on object level\(\backslash\)n"}, emission);}
\DoxyCodeLine{\}}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{keyword}{static} \textcolor{keywordtype}{int}}
\DoxyCodeLine{\_create\_windows(\textcolor{keyword}{const} \textcolor{keywordtype}{char} *edje\_file\_path)}
\DoxyCodeLine{\{}
\DoxyCodeLine{  \textcolor{comment}{/* this will give you a window with an Evas canvas under the first}}
\DoxyCodeLine{\textcolor{comment}{    * engine available */}}
\DoxyCodeLine{   ee1 = \mbox{\hyperlink{group__Ecore__Evas__Group_gac7f2cdbcb79635c34317c1183dd04cb0}{ecore\_evas\_new}}(NULL, 0, 0, WIDTH, HEIGHT, NULL);}
\DoxyCodeLine{   \textcolor{keywordflow}{if} (!ee1)}
\DoxyCodeLine{     \textcolor{keywordflow}{return} 0;}
\DoxyCodeLine{   ee2 = \mbox{\hyperlink{group__Ecore__Evas__Group_gac7f2cdbcb79635c34317c1183dd04cb0}{ecore\_evas\_new}}(NULL, 0, 0, WIDTH, HEIGHT, NULL);}
\DoxyCodeLine{   \textcolor{keywordflow}{if} (!ee2)}
\DoxyCodeLine{     \textcolor{keywordflow}{return} 0;}
\DoxyCodeLine{}
\DoxyCodeLine{   \mbox{\hyperlink{group__Ecore__Evas__Group_ga3680b5c89157167318192157a5d24ec4}{ecore\_evas\_callback\_destroy\_set}}(ee1, \_on\_destroy);}
\DoxyCodeLine{   \mbox{\hyperlink{group__Ecore__Evas__Group_gaac67f679c9027059a34519fbdea360df}{ecore\_evas\_callback\_resize\_set}}(ee1, \_canvas\_resize\_cb);}
\DoxyCodeLine{   \mbox{\hyperlink{group__Ecore__Evas__Group_ga3b2832e0373bbafae2bb7143618535c1}{ecore\_evas\_title\_set}}(ee1, \textcolor{stringliteral}{"Edje Color Class Example"});}
\DoxyCodeLine{}
\DoxyCodeLine{   \mbox{\hyperlink{group__Ecore__Evas__Group_ga3680b5c89157167318192157a5d24ec4}{ecore\_evas\_callback\_destroy\_set}}(ee2, \_on\_destroy);}
\DoxyCodeLine{   \mbox{\hyperlink{group__Ecore__Evas__Group_gaac67f679c9027059a34519fbdea360df}{ecore\_evas\_callback\_resize\_set}}(ee2, \_canvas\_resize\_cb);}
\DoxyCodeLine{   \mbox{\hyperlink{group__Ecore__Evas__Group_ga3b2832e0373bbafae2bb7143618535c1}{ecore\_evas\_title\_set}}(ee2, \textcolor{stringliteral}{"Edje Object Color Class Example"});}
\DoxyCodeLine{}
\DoxyCodeLine{   evas1 = \mbox{\hyperlink{group__Ecore__Evas__Group_ga75a7cc694b6069e78df47dab0b0f2d20}{ecore\_evas\_get}}(ee1);}
\DoxyCodeLine{   evas2 = \mbox{\hyperlink{group__Ecore__Evas__Group_ga75a7cc694b6069e78df47dab0b0f2d20}{ecore\_evas\_get}}(ee2);}
\DoxyCodeLine{}
\DoxyCodeLine{   bg1 = \mbox{\hyperlink{group__Evas__Object__Rectangle_ga4d80fc32ad1cac28428cebd65d746751}{evas\_object\_rectangle\_add}}(evas1);}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Group__Basic_gae34bdcfd7f5100151f6ea8ef4a392949}{evas\_object\_color\_set}}(bg1, 255, 255, 255, 255); \textcolor{comment}{/* white bg */}}
\DoxyCodeLine{   evas\_object\_move(bg1, 0, 0);                    \textcolor{comment}{/* at canvas' origin */}}
\DoxyCodeLine{   evas\_object\_resize(bg1, WIDTH, HEIGHT);         \textcolor{comment}{/* covers full canvas */}}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Group__Basic_ga9cbc13661584e49fb9d9cdab514a1eeb}{evas\_object\_show}}(bg1);}
\DoxyCodeLine{}
\DoxyCodeLine{   bg2 = \mbox{\hyperlink{group__Evas__Object__Rectangle_ga4d80fc32ad1cac28428cebd65d746751}{evas\_object\_rectangle\_add}}(evas2);}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Group__Basic_gae34bdcfd7f5100151f6ea8ef4a392949}{evas\_object\_color\_set}}(bg2, 255, 255, 255, 255); \textcolor{comment}{/* white bg */}}
\DoxyCodeLine{   evas\_object\_move(bg2, 0, 0);                    \textcolor{comment}{/* at canvas' origin */}}
\DoxyCodeLine{   evas\_object\_resize(bg2, WIDTH, HEIGHT);         \textcolor{comment}{/* covers full canvas */}}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Group__Basic_ga9cbc13661584e49fb9d9cdab514a1eeb}{evas\_object\_show}}(bg2);}
\DoxyCodeLine{}
\DoxyCodeLine{   edje\_obj1 = edje\_object\_add(evas1);}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Group__Events_ga23be30ac5cdfb780f1ff82e9108ec26b}{evas\_object\_event\_callback\_add}}(edje\_obj1, \mbox{\hyperlink{Evas__Common_8h_ad64cde0da38a60e7cb7905b3ab216968a9fa52651ccf7e47cd3b7785fc4cf393f}{EVAS\_CALLBACK\_MOUSE\_DOWN}},}
\DoxyCodeLine{                                  \_on\_mouse\_down, NULL);}
\DoxyCodeLine{}
\DoxyCodeLine{   edje\_object\_file\_set(edje\_obj1, edje\_file\_path, \textcolor{stringliteral}{"example\_color\_class"});}
\DoxyCodeLine{   evas\_object\_move(edje\_obj1, 0, 0); \textcolor{comment}{/* at canvas' origin */}}
\DoxyCodeLine{   evas\_object\_resize(edje\_obj1, WIDTH, HEIGHT);}
\DoxyCodeLine{   edje\_object\_part\_text\_set(edje\_obj1, \textcolor{stringliteral}{"part\_four"}, \textcolor{stringliteral}{"EDJE EXAMPLE"});}
\DoxyCodeLine{   edje\_object\_signal\_callback\_add(edje\_obj1, \textcolor{stringliteral}{"color\_class,del"}, \textcolor{stringliteral}{"*"},}
\DoxyCodeLine{                                   (Edje\_Signal\_Cb) \_color\_class\_callback\_delete,}
\DoxyCodeLine{                                   \textcolor{stringliteral}{"process"});}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Group__Basic_ga9cbc13661584e49fb9d9cdab514a1eeb}{evas\_object\_show}}(edje\_obj1);}
\DoxyCodeLine{}
\DoxyCodeLine{   edje\_obj2 = edje\_object\_add(evas2);}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Group__Events_ga23be30ac5cdfb780f1ff82e9108ec26b}{evas\_object\_event\_callback\_add}}(edje\_obj2, \mbox{\hyperlink{Evas__Common_8h_ad64cde0da38a60e7cb7905b3ab216968a9fa52651ccf7e47cd3b7785fc4cf393f}{EVAS\_CALLBACK\_MOUSE\_DOWN}},}
\DoxyCodeLine{                                  \_on\_mouse\_down, NULL);}
\DoxyCodeLine{}
\DoxyCodeLine{   edje\_object\_file\_set(edje\_obj2, edje\_file\_path, \textcolor{stringliteral}{"example\_color\_class"});}
\DoxyCodeLine{   evas\_object\_move(edje\_obj2, 0, 0); \textcolor{comment}{/* at canvas' origin */}}
\DoxyCodeLine{   evas\_object\_resize(edje\_obj2, WIDTH, HEIGHT);}
\DoxyCodeLine{   edje\_object\_part\_text\_set(edje\_obj2, \textcolor{stringliteral}{"part\_four"}, \textcolor{stringliteral}{"EDJE OBJECT EXAMPLE"});}
\DoxyCodeLine{   edje\_object\_signal\_callback\_add(edje\_obj2, \textcolor{stringliteral}{"color\_class,del"}, \textcolor{stringliteral}{"*"},}
\DoxyCodeLine{                                   (Edje\_Signal\_Cb) \_color\_class\_callback\_delete,}
\DoxyCodeLine{                                   \textcolor{stringliteral}{"object"});}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Group__Basic_ga9cbc13661584e49fb9d9cdab514a1eeb}{evas\_object\_show}}(edje\_obj2);}
\DoxyCodeLine{}
\DoxyCodeLine{   \textcolor{keywordflow}{return} 1;}
\DoxyCodeLine{\}}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{keywordtype}{int}}
\DoxyCodeLine{main(\textcolor{keywordtype}{int} argc, \textcolor{keywordtype}{char} *argv[])}
\DoxyCodeLine{\{}
\DoxyCodeLine{   \textcolor{keyword}{const} \textcolor{keywordtype}{char}  *edje\_file = PACKAGE\_DATA\_DIR\textcolor{stringliteral}{"/color-\/class.edj"};}
\DoxyCodeLine{   color        c1, c2, c3;}
\DoxyCodeLine{   \textcolor{keywordtype}{int}          i;}
\DoxyCodeLine{}
\DoxyCodeLine{   \textcolor{keywordflow}{if} (argc != 5)}
\DoxyCodeLine{     \{}
\DoxyCodeLine{        fprintf(stderr, \textcolor{stringliteral}{"You have to use: \%s color\_class\_name color1, color2,"} \(\backslash\)}
\DoxyCodeLine{                \textcolor{stringliteral}{"color3\(\backslash\)n"}, argv[0]);}
\DoxyCodeLine{        fprintf(stderr, \textcolor{stringliteral}{"Available colors:\(\backslash\)n"});}
\DoxyCodeLine{        \textcolor{keywordflow}{for} (i = 0; i < 8; i++)}
\DoxyCodeLine{          fprintf(stderr, \textcolor{stringliteral}{"\%s\(\backslash\)n"}, color\_names[i]);}
\DoxyCodeLine{}
\DoxyCodeLine{        \textcolor{keywordflow}{return} EXIT\_FAILURE;}
\DoxyCodeLine{     \}}
\DoxyCodeLine{}
\DoxyCodeLine{   selected\_class = argv[1];}
\DoxyCodeLine{   \textcolor{keywordflow}{if} (!(\_get\_color\_from\_name(argv[2], \&c1) \&\&}
\DoxyCodeLine{         \_get\_color\_from\_name(argv[3], \&c2) \&\&}
\DoxyCodeLine{         \_get\_color\_from\_name(argv[4], \&c3)))}
\DoxyCodeLine{     \{}
\DoxyCodeLine{        fprintf(stderr, \textcolor{stringliteral}{"Color not available!\(\backslash\)n"});}
\DoxyCodeLine{        \textcolor{keywordflow}{return} EXIT\_FAILURE;}
\DoxyCodeLine{     \}}
\DoxyCodeLine{}
\DoxyCodeLine{   \textcolor{keywordflow}{if} (!\mbox{\hyperlink{group__Ecore__Evas__Group_ga32ddbb6457033ad435a177eb0c4fe235}{ecore\_evas\_init}}())}
\DoxyCodeLine{     \textcolor{keywordflow}{return} EXIT\_FAILURE;}
\DoxyCodeLine{}
\DoxyCodeLine{   \textcolor{keywordflow}{if} (!\mbox{\hyperlink{group__Edje__General__Group_ga1c9c6594f38023c29fbfb2d0c8c675db}{edje\_init}}())}
\DoxyCodeLine{     \textcolor{keywordflow}{goto} shutdown\_ecore\_evas;}
\DoxyCodeLine{}
\DoxyCodeLine{   \textcolor{keywordflow}{if} (!\_create\_windows(edje\_file)) \textcolor{keywordflow}{goto} shutdown\_edje;}
\DoxyCodeLine{}
\DoxyCodeLine{   \mbox{\hyperlink{group__Edje__Object__Color__Class_ga684435de625bdbb996e405e3eaaa54ad}{edje\_color\_class\_set}}(argv[1],                     \textcolor{comment}{/* class name   */}}
\DoxyCodeLine{                        c1[0], c1[1], c1[2], c1[3],  \textcolor{comment}{/* Object color */}}
\DoxyCodeLine{                        c2[0], c2[1], c2[2], c2[3],  \textcolor{comment}{/* Text outline */}}
\DoxyCodeLine{                        c3[0], c3[1], c3[2], c3[3]); \textcolor{comment}{/* Text shadow  */}}
\DoxyCodeLine{}
\DoxyCodeLine{   \textcolor{comment}{/* Setting an arbitrary value just to see the difference between */}}
\DoxyCodeLine{   \textcolor{comment}{/* process level and object level */}}
\DoxyCodeLine{   edje\_object\_color\_class\_set(edje\_obj2, argv[1], \textcolor{comment}{/* class name   */}}
\DoxyCodeLine{                               128, 180, 77, 255,  \textcolor{comment}{/* Object color */}}
\DoxyCodeLine{                               200, 22, 86, 255,   \textcolor{comment}{/* Text outline */}}
\DoxyCodeLine{                               39, 90, 187, 255);  \textcolor{comment}{/* Text shadow  */}}
\DoxyCodeLine{}
\DoxyCodeLine{   \_color\_classes\_print();}
\DoxyCodeLine{}
\DoxyCodeLine{   \mbox{\hyperlink{group__Ecore__Evas__Group_ga4953047ff97d4f1b0d75a7d513d4f317}{ecore\_evas\_show}}(ee1);}
\DoxyCodeLine{   \mbox{\hyperlink{group__Ecore__Evas__Group_ga4953047ff97d4f1b0d75a7d513d4f317}{ecore\_evas\_show}}(ee2);}
\DoxyCodeLine{}
\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}}(ee1);}
\DoxyCodeLine{   \mbox{\hyperlink{group__Ecore__Evas__Group_gab8fa311077f749190c9b622f672b2214}{ecore\_evas\_shutdown}}();}
\DoxyCodeLine{   \mbox{\hyperlink{group__Edje__General__Group_ga01041f6702f2d81bf10c3e41899805cb}{edje\_shutdown}}();}
\DoxyCodeLine{}
\DoxyCodeLine{   \textcolor{keywordflow}{return} EXIT\_SUCCESS;}
\DoxyCodeLine{}
\DoxyCodeLine{ shutdown\_edje:}
\DoxyCodeLine{   \mbox{\hyperlink{group__Edje__General__Group_ga01041f6702f2d81bf10c3e41899805cb}{edje\_shutdown}}();}
\DoxyCodeLine{ shutdown\_ecore\_evas:}
\DoxyCodeLine{   \mbox{\hyperlink{group__Ecore__Evas__Group_gab8fa311077f749190c9b622f672b2214}{ecore\_evas\_shutdown}}();}
\DoxyCodeLine{}
\DoxyCodeLine{   \textcolor{keywordflow}{return} EXIT\_FAILURE;}
\DoxyCodeLine{\}}
\end{DoxyCodeInclude}


The theme used in this example is\+: 
\begin{DoxyCodeInclude}{0}
\DoxyCodeLine{color\_classes \{}
\DoxyCodeLine{    color\_class \{}
\DoxyCodeLine{       name: "red\_class";}
\DoxyCodeLine{       color: 255 0 0 255;       /* red */}
\DoxyCodeLine{       color2: 255 0 0 255;      /* red */}
\DoxyCodeLine{       color3: 255 0 0 255;      /* red */}
\DoxyCodeLine{    \}}
\DoxyCodeLine{    color\_class \{}
\DoxyCodeLine{       name: "green\_class";}
\DoxyCodeLine{       color: 0 255 0 255;       /* green */}
\DoxyCodeLine{       color2: 0 255 0 255;      /* green */}
\DoxyCodeLine{       color3: 0 255 0 255;      /* green */}
\DoxyCodeLine{    \}}
\DoxyCodeLine{    color\_class \{}
\DoxyCodeLine{       name: "blue\_class";}
\DoxyCodeLine{       color: 0 0 255 255;       /* blue */}
\DoxyCodeLine{       color2: 0 0 255 255;      /* blue */}
\DoxyCodeLine{       color3: 0 0 255 255;      /* blue */}
\DoxyCodeLine{    \}}
\DoxyCodeLine{\}}
\DoxyCodeLine{}
\DoxyCodeLine{collections \{}
\DoxyCodeLine{   group \{}
\DoxyCodeLine{      name: "example\_color\_class";}
\DoxyCodeLine{      max: 500 500;}
\DoxyCodeLine{      min: 50 50;}
\DoxyCodeLine{}
\DoxyCodeLine{      parts \{}
\DoxyCodeLine{         part \{}
\DoxyCodeLine{            name: "part\_one";}
\DoxyCodeLine{            type: RECT;}
\DoxyCodeLine{            scale: 1;}
\DoxyCodeLine{            description \{}
\DoxyCodeLine{               state: "default" 0.0;}
\DoxyCodeLine{               color: 255 255 255 255;}
\DoxyCodeLine{               color\_class: "blue\_class";}
\DoxyCodeLine{               rel1.relative: 0.0 0.0;}
\DoxyCodeLine{               rel2.relative: 0.5 0.5;}
\DoxyCodeLine{            \}}
\DoxyCodeLine{         \}}
\DoxyCodeLine{}
\DoxyCodeLine{         part \{}
\DoxyCodeLine{            name: "part\_two";}
\DoxyCodeLine{            type: RECT;}
\DoxyCodeLine{            description \{}
\DoxyCodeLine{               state: "default" 0.0;}
\DoxyCodeLine{               color: 255 255 255 255;}
\DoxyCodeLine{               color\_class: "green\_class";}
\DoxyCodeLine{               rel1.relative: 0.5 0.0;}
\DoxyCodeLine{               rel2.relative: 1.0 0.5;}
\DoxyCodeLine{            \}}
\DoxyCodeLine{         \}}
\DoxyCodeLine{         part \{}
\DoxyCodeLine{            name: "part\_three";}
\DoxyCodeLine{            type: RECT;}
\DoxyCodeLine{            description \{}
\DoxyCodeLine{               state: "default" 0.0;}
\DoxyCodeLine{               color: 255 255 255 255;}
\DoxyCodeLine{               color\_class: "red\_class";}
\DoxyCodeLine{               rel1.relative: 0.0 0.5;}
\DoxyCodeLine{               rel2.relative: 1.0 1.0;}
\DoxyCodeLine{            \}}
\DoxyCodeLine{         \}}
\DoxyCodeLine{         part \{}
\DoxyCodeLine{            name: "part\_four";}
\DoxyCodeLine{            type: TEXT;}
\DoxyCodeLine{            effect: OUTLINE\_SHADOW;}
\DoxyCodeLine{            description \{}
\DoxyCodeLine{               state: "default" 0.0;}
\DoxyCodeLine{               min: 50 50;}
\DoxyCodeLine{               color: 255 255 255 255;}
\DoxyCodeLine{               color2: 255 255 255 255;}
\DoxyCodeLine{               color3: 255 255 255 255;}
\DoxyCodeLine{               color\_class: "blue\_class";}
\DoxyCodeLine{               rel1.relative: 0.0 0.5;}
\DoxyCodeLine{               rel2.relative: 1.0 1.0;}
\DoxyCodeLine{               text \{}
\DoxyCodeLine{                  text\_class: "example";}
\DoxyCodeLine{                  font: "arial";}
\DoxyCodeLine{                  size: 45;}
\DoxyCodeLine{                  min: 1 1;}
\DoxyCodeLine{                  ellipsis: -\/1;}
\DoxyCodeLine{               \}}
\DoxyCodeLine{            \}}
\DoxyCodeLine{         \}}
\DoxyCodeLine{      \}}
\DoxyCodeLine{   \}}
\DoxyCodeLine{\}}
\end{DoxyCodeInclude}


To compile use this command\+: \begin{DoxyVerb}* gcc -o edje-color-class edje-color-class.c -DPACKAGE_BIN_DIR=\"/Where/enlightenment/is/installed/bin\"
* -DPACKAGE_LIB_DIR=\"/Where/enlightenment/is/installed/lib\"
* -DPACKAGE_DATA_DIR=\"/Where/enlightenment/is/installed/share\"
* `pkg-config --cflags --libs evas ecore ecore-evas edje`
*
* edje_cc color-class.edc
* \end{DoxyVerb}
 