New edje example
authordavemds <davemds>
Thu, 11 Nov 2010 01:20:36 +0000 (01:20 +0000)
committerdavemds <davemds@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Thu, 11 Nov 2010 01:20:36 +0000 (01:20 +0000)
This example show how to toggle the state of a part using the 'filter'
param in edje programs.

git-svn-id: http://svn.enlightenment.org/svn/e/trunk/edje@54448 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33

doc/edje.dox.in
doc/examples/toggle_using_filter.edc [new file with mode: 0644]

index dd6c665..fecec26 100644 (file)
@@ -497,5 +497,8 @@ Super-concise video player example using Edje/Emotion/Elementary.
 This example show the usage of lua scripting to create and animate some
 objects in the canvas.
 
+@example toggle_using_filter.edc
+This example show how to toggle the state of a part using the 'filter'
+param in edje programs
 
 */
diff --git a/doc/examples/toggle_using_filter.edc b/doc/examples/toggle_using_filter.edc
new file mode 100644 (file)
index 0000000..9971fc0
--- /dev/null
@@ -0,0 +1,66 @@
+collections {
+   group { name: "main";
+      parts {
+         /* white background */
+         part { name: "bg";
+            type: RECT;
+            description { state: "default" 0.0;
+               color: 255 255 255 255;
+            }
+         }
+         /* title label */
+         part { name: "title";
+            type: TEXT;
+            description { state: "default" 0.0;
+               color: 0 0 0 255;
+               text {
+                  text: "Toggle using filter";
+                  font: "Sans";
+                  size: 12;
+                  align: 0.5 0.0;
+               }
+            }
+         }
+         /* the rectangle, will toggle color on click */
+         part { name: "rect";
+            type: RECT;
+            mouse_events: 1;
+            description { state: "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: "blue" 0.0;
+               inherit: "default" 0.0;
+               color: 0 0 255 255;
+            }
+         }
+      }
+      programs {
+         /* on mouse click set the blue state, if we are in the default state */
+         program {
+            signal: "mouse,down,1";
+            source: "rect";
+            filter: "rect" "default";
+            action: STATE_SET "blue" 0.0;
+            transition: SINUSOIDAL 0.4;
+            target: "rect";
+         }
+         /* or back to the default state if we are in the blue state */
+         program {
+            signal: "mouse,down,1";
+            source: "rect";
+            filter: "rect" "blue";
+            action: STATE_SET "default" 0.0;
+            transition: SINUSOIDAL 0.4;
+            target: "rect";
+         }
+      }
+   }
+}