Add a new embryo example to edje, it show the usage of program_run() and toggle buttons.
authordavemds <davemds@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Thu, 7 Oct 2010 18:34:40 +0000 (18:34 +0000)
committerdavemds <davemds@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Thu, 7 Oct 2010 18:34:40 +0000 (18:34 +0000)
git-svn-id: http://svn.enlightenment.org/svn/e/trunk/edje@53149 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33

doc/examples/embryo_run_program.edc [new file with mode: 0644]

diff --git a/doc/examples/embryo_run_program.edc b/doc/examples/embryo_run_program.edc
new file mode 100644 (file)
index 0000000..4833b93
--- /dev/null
@@ -0,0 +1,66 @@
+collections {
+   group { name: "main";
+      script {
+         public toggle;
+      }
+      parts {
+         part { name: "bg";
+            type: RECT;
+            description { state: "default" 0.0;
+               color: 255 255 255 255;
+            }
+         }
+         part { name: "label";
+            type: TEXT;
+            description { state: "default" 0.0;
+               color: 0 0 0 255;
+               text {
+                  text: "Click me.";
+                  font: "Sans";
+                  size: 12;
+                  align: 0.5 0.8;
+               }
+            }
+         }
+         part { name: "rect";
+            type: RECT;
+            description { state: "default" 0.0;
+               color: 255 0 0 255;
+               max: 30 30;
+               align: 0.1 0.2;
+            }
+            description { state: "default" 1.0;
+               inherit: "default" 0.0;
+               color: 0 0 255 255;
+               align: 0.9 0.2;
+            }
+         }
+      }
+      programs {
+         program { name: "go_right";
+            action: STATE_SET "default" 1.0;
+            transition: SINUSOIDAL 1.0;
+            target: "rect";
+         }
+         program { name: "go_left";
+            action: STATE_SET "default" 0.0;
+            transition: SINUSOIDAL 1.0;
+            target: "rect";
+         }
+         program {
+            signal: "mouse,down,1";
+            source: "label";
+            script {
+               if (get_int(toggle) == 0) {
+                  run_program(PROGRAM:"go_right");
+                  set_int(toggle, 1);
+               }
+               else {
+                  run_program(PROGRAM:"go_left");
+                  set_int(toggle, 0);
+               }
+            }
+         }
+      }
+   }
+}