\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}
collections \{
   group \{ name: \textcolor{stringliteral}{"main"};
      parts \{
         \textcolor{comment}{/* white background */}
         part \{ name: \textcolor{stringliteral}{"bg"};
            type: RECT;
            description \{ state: \textcolor{stringliteral}{"default"} 0.0;
               color: 255 255 255 255;
            \}
         \}
         \textcolor{comment}{/* title label */}
         part \{ name: \textcolor{stringliteral}{"title"};
            type: TEXT;
            description \{ state: \textcolor{stringliteral}{"default"} 0.0;
               color: 0 0 0 255;
               text \{
                  text: \textcolor{stringliteral}{"Toggle using filter"};
                  font: \textcolor{stringliteral}{"Sans"};
                  size: 12;
                  align: 0.5 0.0;
               \}
            \}
         \}
         \textcolor{comment}{/* the rectangle, will toggle color on click */}
         part \{ name: \textcolor{stringliteral}{"rect"};
            type: RECT;
            mouse\_events: 1;
            description \{ state: \textcolor{stringliteral}{"default"} 0.0;
               color: 255 0 0 150;
               max: 150 150;
               align: 0.5 0.5;
               map \{
                  on: 1;
                  perspective\_on: 1;
                  smooth: 1;
                  alpha: 1;
               \}
            \}
            description \{ state: \textcolor{stringliteral}{"blue"} 0.0;
               inherit: \textcolor{stringliteral}{"default"} 0.0;
               color: 0 0 255 255;
            \}
         \}
      \}
      programs \{
         \textcolor{comment}{/* on mouse click set the blue state, if we are in the default state */}
         program \{
            signal: \textcolor{stringliteral}{"mouse,down,1"};
            source: \textcolor{stringliteral}{"rect"};
            filter: \textcolor{stringliteral}{"rect"} \textcolor{stringliteral}{"default"};
            action: STATE\_SET \textcolor{stringliteral}{"blue"} 0.0;
            transition: SINUSOIDAL 0.4;
            target: \textcolor{stringliteral}{"rect"};
         \}
         \textcolor{comment}{/* or back to the default state if we are in the blue state */}
         program \{
            signal: \textcolor{stringliteral}{"mouse,down,1"};
            source: \textcolor{stringliteral}{"rect"};
            filter: \textcolor{stringliteral}{"rect"} \textcolor{stringliteral}{"blue"};
            action: STATE\_SET \textcolor{stringliteral}{"default"} 0.0;
            transition: SINUSOIDAL 0.4;
            target: \textcolor{stringliteral}{"rect"};
         \}
      \}
   \}
\}
\end{DoxyCodeInclude}
 