\hypertarget{toggle_using_filter_8edc-example}{\section{toggle\+\_\+using\+\_\+filter.\+edc}
}
This example shows how to toggle the state of a part using the 'filter' param in edje programs


\begin{DoxyCodeInclude}
1 collections \{
2    group \{ name: "main";
3       parts \{
4          /* white background */
5          part \{ name: "bg";
6             type: RECT;
7             description \{ state: "default" 0.0;
8                color: 255 255 255 255;
9             \}
10          \}
11          /* title label */
12          part \{ name: "title";
13             type: TEXT;
14             description \{ state: "default" 0.0;
15                color: 0 0 0 255;
16                text \{
17                   text: "Toggle using filter";
18                   font: "Sans";
19                   size: 12;
20                   align: 0.5 0.0;
21                \}
22             \}
23          \}
24          /* the rectangle, will toggle color on click */
25          part \{ name: "rect";
26             type: RECT;
27             mouse\_events: 1;
28             description \{ state: "default" 0.0;
29                color: 255 0 0 150;
30                max: 150 150;
31                align: 0.5 0.5;
32                map \{
33                   on: 1;
34                   perspective\_on: 1;
35                   smooth: 1;
36                   alpha: 1;
37                \}
38             \}
39             description \{ state: "blue" 0.0;
40                inherit: "default" 0.0;
41                color: 0 0 255 255;
42             \}
43          \}
44       \}
45       programs \{
46          /* on mouse click set the blue state, if we are in the default state */
47          program \{
48             signal: "mouse,down,1";
49             source: "rect";
50             filter: "rect" "default";
51             action: STATE\_SET "blue" 0.0;
52             transition: SINUSOIDAL 0.4;
53             target: "rect";
54          \}
55          /* or back to the default state if we are in the blue state */
56          program \{
57             signal: "mouse,down,1";
58             source: "rect";
59             filter: "rect" "blue";
60             action: STATE\_SET "default" 0.0;
61             transition: SINUSOIDAL 0.4;
62             target: "rect";
63          \}
64       \}
65    \}
66 \}
\end{DoxyCodeInclude}
 