From dd7595a3475407a7fa96a97393bae8c5220e8762 Mon Sep 17 00:00:00 2001 From: David Walter Seikel Date: Wed, 4 Jan 2012 18:41:13 +1000 Subject: Add the base Enlightenment Foundation Libraries - eina, eet, evas, ecore, embryo, and edje. Note that embryo wont be used, but I'm not sure yet if you can build edje without it. --- libraries/edje/src/examples/signals-messages.edc | 174 +++++++++++++++++++++++ 1 file changed, 174 insertions(+) create mode 100644 libraries/edje/src/examples/signals-messages.edc (limited to 'libraries/edje/src/examples/signals-messages.edc') diff --git a/libraries/edje/src/examples/signals-messages.edc b/libraries/edje/src/examples/signals-messages.edc new file mode 100644 index 0000000..45d9c58 --- /dev/null +++ b/libraries/edje/src/examples/signals-messages.edc @@ -0,0 +1,174 @@ +#define MSG_COLOR 1 +#define MSG_TEXT 2 + +collections { + group { + name: "example_group"; + + parts { + part { + name: "part_right"; + type: RECT; + clip_to: "part_right_clipper"; + description { + min: 50 50; + max: 50 50; + state: "default" 0.0; + color: 0 0 255 255; /* blue */ + rel1.relative: 1.0 0.5; + rel1.offset: -49 0; + rel2.relative: 1.0 0.5; + } + } + + part { + name: "part_left"; + type: RECT; + description { + color_class: "cc"; + min: 50 50; + max: 50 50; + state: "default" 0.0; + rel1.relative: 0.0 0.5; + rel2.relative: 0.0 0.5; + rel2.offset: 50 -1; + } + } + + part { + name: "text"; + type: TEXT; + description { + min: 150 50; + max: 150 50; + fixed: 1 1; + color: 0 0 0 255; + state: "default" 0.0; + rel1.relative: 0.5 0.5; + rel2.relative: 0.5 0.5; + text { + font: "Sans"; + size: 20; + min: 1 1; + align: 0.5 0.5; + } + } + } + + part { + name: "part_right_clipper"; + type: RECT; + repeat_events: 1; + + description { + min: 50 50; + max: 50 50; + + state: "default" 0.0; + rel1.relative: 1.0 0.5; + rel1.offset: -49 0; + rel2.relative: 1.0 0.5; + } + + description { + state: "hidden" 0.0; + inherit: "default" 0.0; + visible: 0; + } + } + } + + script { + public global_str0; + public global_str1; + public global_str2; + public str_idx; + + public set_text_string() { + new tmp[1024]; + new idx; + idx = get_int(str_idx); + + if (idx == 0) + get_str(global_str0, tmp, 1024); + else if (idx == 1) + get_str(global_str1, tmp, 1024); + else if (idx == 2) + get_str(global_str2, tmp, 1024); + else return; + + set_text(PART:"text", tmp); + send_message(MSG_STRING, MSG_TEXT, tmp); + } + + public message(Msg_Type:type, id, ...) { + if ((type == MSG_INT_SET) && (id == MSG_COLOR)) { + new r, g, b, a; + + r = getarg(3); + g = getarg(4); + b = getarg(5); + a = getarg(6); + + set_color_class("cc", r, g, b, a); + } + } + } + + programs { + program { + name: "bootstrap"; + signal: "load"; + source: ""; + script { + set_str(global_str0, "String one"); + set_str(global_str1, "String two"); + set_str(global_str2, "String three"); + set_int(str_idx, 0); + set_text_string(); + } + } + + program { /* custom signal */ + name: "part_right,hovered"; + signal: "mouse,move"; + source: "part_right"; + action: SIGNAL_EMIT "mouse,over" "part_right"; + } + + program { /* hide right rectangle */ + name: "part_right,hide"; + signal: "part_right,hide"; + source: ""; + action: STATE_SET "hidden" 0.0; + target: "part_right_clipper"; + } + + program { + name: "part_right,show"; + signal: "part_right,show"; + source: ""; + action: STATE_SET "default" 0.0; + target: "part_right_clipper"; + } + + program { /* change text part's string value */ + name: "text,change"; + signal: "mouse,clicked,1"; + source: "part_left"; + script { + new idx; + idx = get_int(str_idx); + idx = idx + 1; + + if (idx > 2) + set_int(str_idx, 0); + else + set_int(str_idx, idx); + + set_text_string(); + } + } + } + } +} -- cgit v1.1