diff options
author | David Walter Seikel | 2012-01-04 18:41:13 +1000 |
---|---|---|
committer | David Walter Seikel | 2012-01-04 18:41:13 +1000 |
commit | dd7595a3475407a7fa96a97393bae8c5220e8762 (patch) | |
tree | e341e911d7eb911a51684a7412ef7f7c7605d28e /libraries/edje/src/examples/signals-messages.edc | |
parent | Add the skeleton. (diff) | |
download | SledjHamr-dd7595a3475407a7fa96a97393bae8c5220e8762.zip SledjHamr-dd7595a3475407a7fa96a97393bae8c5220e8762.tar.gz SledjHamr-dd7595a3475407a7fa96a97393bae8c5220e8762.tar.bz2 SledjHamr-dd7595a3475407a7fa96a97393bae8c5220e8762.tar.xz |
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.
Diffstat (limited to 'libraries/edje/src/examples/signals-messages.edc')
-rw-r--r-- | libraries/edje/src/examples/signals-messages.edc | 174 |
1 files changed, 174 insertions, 0 deletions
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 @@ | |||
1 | #define MSG_COLOR 1 | ||
2 | #define MSG_TEXT 2 | ||
3 | |||
4 | collections { | ||
5 | group { | ||
6 | name: "example_group"; | ||
7 | |||
8 | parts { | ||
9 | part { | ||
10 | name: "part_right"; | ||
11 | type: RECT; | ||
12 | clip_to: "part_right_clipper"; | ||
13 | description { | ||
14 | min: 50 50; | ||
15 | max: 50 50; | ||
16 | state: "default" 0.0; | ||
17 | color: 0 0 255 255; /* blue */ | ||
18 | rel1.relative: 1.0 0.5; | ||
19 | rel1.offset: -49 0; | ||
20 | rel2.relative: 1.0 0.5; | ||
21 | } | ||
22 | } | ||
23 | |||
24 | part { | ||
25 | name: "part_left"; | ||
26 | type: RECT; | ||
27 | description { | ||
28 | color_class: "cc"; | ||
29 | min: 50 50; | ||
30 | max: 50 50; | ||
31 | state: "default" 0.0; | ||
32 | rel1.relative: 0.0 0.5; | ||
33 | rel2.relative: 0.0 0.5; | ||
34 | rel2.offset: 50 -1; | ||
35 | } | ||
36 | } | ||
37 | |||
38 | part { | ||
39 | name: "text"; | ||
40 | type: TEXT; | ||
41 | description { | ||
42 | min: 150 50; | ||
43 | max: 150 50; | ||
44 | fixed: 1 1; | ||
45 | color: 0 0 0 255; | ||
46 | state: "default" 0.0; | ||
47 | rel1.relative: 0.5 0.5; | ||
48 | rel2.relative: 0.5 0.5; | ||
49 | text { | ||
50 | font: "Sans"; | ||
51 | size: 20; | ||
52 | min: 1 1; | ||
53 | align: 0.5 0.5; | ||
54 | } | ||
55 | } | ||
56 | } | ||
57 | |||
58 | part { | ||
59 | name: "part_right_clipper"; | ||
60 | type: RECT; | ||
61 | repeat_events: 1; | ||
62 | |||
63 | description { | ||
64 | min: 50 50; | ||
65 | max: 50 50; | ||
66 | |||
67 | state: "default" 0.0; | ||
68 | rel1.relative: 1.0 0.5; | ||
69 | rel1.offset: -49 0; | ||
70 | rel2.relative: 1.0 0.5; | ||
71 | } | ||
72 | |||
73 | description { | ||
74 | state: "hidden" 0.0; | ||
75 | inherit: "default" 0.0; | ||
76 | visible: 0; | ||
77 | } | ||
78 | } | ||
79 | } | ||
80 | |||
81 | script { | ||
82 | public global_str0; | ||
83 | public global_str1; | ||
84 | public global_str2; | ||
85 | public str_idx; | ||
86 | |||
87 | public set_text_string() { | ||
88 | new tmp[1024]; | ||
89 | new idx; | ||
90 | idx = get_int(str_idx); | ||
91 | |||
92 | if (idx == 0) | ||
93 | get_str(global_str0, tmp, 1024); | ||
94 | else if (idx == 1) | ||
95 | get_str(global_str1, tmp, 1024); | ||
96 | else if (idx == 2) | ||
97 | get_str(global_str2, tmp, 1024); | ||
98 | else return; | ||
99 | |||
100 | set_text(PART:"text", tmp); | ||
101 | send_message(MSG_STRING, MSG_TEXT, tmp); | ||
102 | } | ||
103 | |||
104 | public message(Msg_Type:type, id, ...) { | ||
105 | if ((type == MSG_INT_SET) && (id == MSG_COLOR)) { | ||
106 | new r, g, b, a; | ||
107 | |||
108 | r = getarg(3); | ||
109 | g = getarg(4); | ||
110 | b = getarg(5); | ||
111 | a = getarg(6); | ||
112 | |||
113 | set_color_class("cc", r, g, b, a); | ||
114 | } | ||
115 | } | ||
116 | } | ||
117 | |||
118 | programs { | ||
119 | program { | ||
120 | name: "bootstrap"; | ||
121 | signal: "load"; | ||
122 | source: ""; | ||
123 | script { | ||
124 | set_str(global_str0, "String one"); | ||
125 | set_str(global_str1, "String two"); | ||
126 | set_str(global_str2, "String three"); | ||
127 | set_int(str_idx, 0); | ||
128 | set_text_string(); | ||
129 | } | ||
130 | } | ||
131 | |||
132 | program { /* custom signal */ | ||
133 | name: "part_right,hovered"; | ||
134 | signal: "mouse,move"; | ||
135 | source: "part_right"; | ||
136 | action: SIGNAL_EMIT "mouse,over" "part_right"; | ||
137 | } | ||
138 | |||
139 | program { /* hide right rectangle */ | ||
140 | name: "part_right,hide"; | ||
141 | signal: "part_right,hide"; | ||
142 | source: ""; | ||
143 | action: STATE_SET "hidden" 0.0; | ||
144 | target: "part_right_clipper"; | ||
145 | } | ||
146 | |||
147 | program { | ||
148 | name: "part_right,show"; | ||
149 | signal: "part_right,show"; | ||
150 | source: ""; | ||
151 | action: STATE_SET "default" 0.0; | ||
152 | target: "part_right_clipper"; | ||
153 | } | ||
154 | |||
155 | program { /* change text part's string value */ | ||
156 | name: "text,change"; | ||
157 | signal: "mouse,clicked,1"; | ||
158 | source: "part_left"; | ||
159 | script { | ||
160 | new idx; | ||
161 | idx = get_int(str_idx); | ||
162 | idx = idx + 1; | ||
163 | |||
164 | if (idx > 2) | ||
165 | set_int(str_idx, 0); | ||
166 | else | ||
167 | set_int(str_idx, idx); | ||
168 | |||
169 | set_text_string(); | ||
170 | } | ||
171 | } | ||
172 | } | ||
173 | } | ||
174 | } | ||