efl
1collections {
2
3color_classes {
4color_class {
5name: "button_bg,1";
6color: 200 200 200 255;
7}
8color_class {
9name: "button_bg,2";
10color: 200 200 200 255;
11}
12color_class {
13name: "button_bg,3";
14color: 200 200 200 255;
15}
16color_class {
17name: "button_bg,4";
18color: 200 200 200 255;
19}
20}
21
22group {
23name: "example/main";
24min: 400 400;
25
26parts {
27part {
28name: "bg";
29type: RECT;
30mouse_events: 0;
31description {
32state: "default" 0.0;
33}
34}
35
36part {
37name: "title";
38type: TEXT;
39mouse_events: 0;
40description {
41state: "default" 0.0;
42color: 0 0 0 255;
43rel1 {
44relative: 0.0 0.0;
45offset: 0 0;
46to: "bg";
47}
48rel2 {
49relative: 1.0 0.2;
50offset: -1 -1;
51to: "bg";
52}
53text {
54text: "Dynamic Multiseat Example";
55size: 16;
56font: "sans";
57min: 1 1;
58}
59}
60}
61
62part {
63name: "buttons";
64type: RECT;
65mouse_events: 0;
66description {
67state: "default" 0.0;
68rel1.relative: 0.2 0.3;
69rel2.relative: 0.8 0.9;
70color: 255 255 255 0;
71}
72}
73
74part {
75name: "button_bg,1";
76type: RECT;
77mouse_events: 1;
78description {
79state: "default" 0.0;
80rel1 {
81to: "buttons";
82relative: 0.1 0.1;
83}
84rel2 {
85to: "buttons";
86relative: 0.45 0.45;
87}
88color_class: "button_bg,1";
89}
90}
91
92part {
93name: "button1";
94type: RECT;
95mouse_events: 0;
96description {
97state: "default" 0.0;
98rel1 {
99to: "button_bg,1";
100offset: 10 10;
101}
102rel2 {
103to: "button_bg,1";
104offset: -11 -11;
105}
106color: 200 200 200 255;
107}
108}
109
110part {
111name: "button_bg,2";
112type: RECT;
113mouse_events: 1;
114description {
115state: "default" 0.0;
116rel1 {
117to: "buttons";
118relative: 0.55 0.1;
119}
120rel2 {
121to: "buttons";
122relative: 0.9 0.45;
123}
124color_class: "button_bg,2";
125}
126}
127
128part {
129name: "button2";
130type: RECT;
131mouse_events: 0;
132description {
133state: "default" 0.0;
134rel1 {
135to: "button_bg,2";
136offset: 10 10;
137}
138rel2 {
139to: "button_bg,2";
140offset: -11 -11;
141}
142color: 200 200 200 255;
143}
144}
145
146part {
147name: "button_bg,3";
148type: RECT;
149mouse_events: 1;
150description {
151state: "default" 0.0;
152rel1 {
153to: "buttons";
154relative: 0.1 0.55;
155}
156rel2 {
157to: "buttons";
158relative: 0.45 0.9;
159}
160color_class: "button_bg,3";
161}
162}
163
164part {
165name: "button3";
166type: RECT;
167mouse_events: 0;
168description {
169state: "default" 0.0;
170rel1 {
171to: "button_bg,3";
172offset: 10 10;
173}
174rel2 {
175to: "button_bg,3";
176offset: -11 -11;
177}
178color: 200 200 200 255;
179}
180}
181
182part {
183name: "button_bg,4";
184type: RECT;
185mouse_events: 1;
186description {
187state: "default" 0.0;
188rel1 {
189to: "buttons";
190relative: 0.55 0.55;
191}
192rel2 {
193to: "buttons";
194relative: 0.9 0.9;
195}
196color_class: "button_bg,4";
197}
198}
199
200part {
201name: "button4";
202type: RECT;
203mouse_events: 0;
204description {
205state: "default" 0.0;
206rel1 {
207to: "button_bg,4";
208offset: 10 10;
209}
210rel2 {
211to: "button_bg,4";
212offset: -11 -11;
213}
214color: 200 200 200 255;
215}
216}
217}
218
219script {
220public red;
221public green;
222public blue;
223public seat_count;
224}
225
226programs {
227program {
228name: "seat,added";
229signal: "seat,added,*";
230source: "";
231script {
232new seat_name[128];
233new buf[256];
234new r, g, b;
235
236r = rand() * 255 / 65535;
237append_int(red, r);
238g = rand() * 255 / 65535;
239append_int(green, g);
240b = rand() * 255 / 65535;
241append_int(blue, b);
242
243set_int(seat_count, get_int(seat_count) + 1);
244
245strncpy(seat_name, sig[strlen("seat,added,")],
246strchr(sig[strlen("seat,added,")], ","));
247snprintf(buf, sizeof(buf),
248"seat,color,%s,r=%i,g=%i,b=%i", seat_name,
249r, g, b);
250emit(buf, "theme");
251}
252}
253
254program {
255name: "button,in";
256signal: "seat,*,mouse,in";
257source: "button_bg,*";
258script {
259new idx, r, g, b;
260
261idx = atoi(sig[strlen("seat,seat")]) - 1;
262r = fetch_int(red, idx);
263g = fetch_int(green, idx);
264b = fetch_int(blue, idx);
265
266set_color_class(src, r, g, b, 255);
267}
268}
269
270program {
271name: "button,out";
272signal: "seat,*,mouse,out";
273source: "button_bg,*";
274script {
275set_color_class(src, 200, 200, 200, 255);
276}
277}
278}
279}
280}
281