aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/libraries/elementary/data/themes/widgets/segment_control.edc
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--libraries/elementary/data/themes/widgets/segment_control.edc533
1 files changed, 533 insertions, 0 deletions
diff --git a/libraries/elementary/data/themes/widgets/segment_control.edc b/libraries/elementary/data/themes/widgets/segment_control.edc
new file mode 100644
index 0000000..39dfbee
--- /dev/null
+++ b/libraries/elementary/data/themes/widgets/segment_control.edc
@@ -0,0 +1,533 @@
1///////////////////////////////////////////////////////////////////////////////
2group { name: "elm/segment_control/base/default";
3 #define SEGMENT_TYPE_SINGLE 1
4 #define SEGMENT_TYPE_LEFT 2
5 #define SEGMENT_TYPE_MIDDLE 3
6 #define SEGMENT_TYPE_RIGHT 4
7 #define SEGMENT_STATE_NORMAL 1
8 #define SEGMENT_STATE_PRESSED 2
9 #define SEGMENT_STATE_SELECTED 3
10 #define SEGMENT_STATUS_ENABLED 0
11 #define SEGMENT_STATUS_DISABLED 1
12 parts {
13 part { name: "bg";
14 type: RECT;
15 mouse_events: 0;
16 scale: 1;
17 description {
18 state: "default" 0.0;
19 color: 0 0 0 0;
20 min: 100 40;
21 }
22 }
23 }
24}
25group { name: "elm/segment_control/item/default";
26 images {
27 image: "seg_single_pressed.png" COMP;
28 image: "seg_single_selected.png" COMP;
29 image: "seg_single_normal.png" COMP;
30
31 image: "seg_left_pressed.png" COMP;
32 image: "seg_left_selected.png" COMP;
33 image: "seg_left_normal.png" COMP;
34
35 image: "seg_middle_pressed.png" COMP;
36 image: "seg_middle_selected.png" COMP;
37 image: "seg_middle_normal.png" COMP;
38
39 image: "seg_right_pressed.png" COMP;
40 image: "seg_right_selected.png" COMP;
41 image: "seg_right_normal.png" COMP;
42 }
43 parts {
44 part { name: "segment";
45 mouse_events: 1;
46 scale: 1;
47 description { state: "default" 0.0;
48 min: 1 1;
49 visible: 0;
50 image {
51 normal: "seg_single_normal.png";
52 border: 7 7 7 7;
53 border_scale: 1;
54 middle: 1;
55 }
56 }
57 description { state: "default_single" 0.0;
58 inherit: "default" 0.0;
59 visible: 1;
60 image {
61 normal: "seg_single_normal.png";
62 border: 7 7 7 7;
63 }
64 }
65 description { state: "default_left" 0.0;
66 inherit: "default" 0.0;
67 visible: 1;
68 image {
69 normal: "seg_left_normal.png";
70 border: 6 1 7 7;
71 }
72 }
73 description { state: "default_right" 0.0;
74 inherit: "default" 0.0;
75 visible: 1;
76 image {
77 normal: "seg_right_normal.png";
78 border: 1 6 7 7;
79 }
80 }
81 description { state: "default_middle" 0.0;
82 inherit: "default" 0.0;
83 visible: 1;
84 image {
85 normal: "seg_middle_normal.png";
86 border: 2 2 2 2;
87 }
88 }
89 description { state: "pressed_single" 0.0;
90 inherit: "default" 0.0;
91 visible: 1;
92 image {
93 normal: "seg_single_pressed.png";
94 border: 7 7 7 7;
95 }
96 }
97 description { state: "pressed_left" 0.0;
98 inherit: "default" 0.0;
99 visible: 1;
100 image {
101 normal: "seg_left_pressed.png";
102 border: 6 1 7 7;
103 }
104 }
105 description { state: "pressed_right" 0.0;
106 inherit: "default" 0.0;
107 visible: 1;
108 image {
109 normal: "seg_right_pressed.png";
110 border: 1 6 7 7;
111 }
112 }
113 description { state: "pressed_middle" 0.0;
114 inherit: "default" 0.0;
115 visible: 1;
116 image {
117 normal: "seg_middle_pressed.png";
118 border: 1 1 2 2;
119 }
120 }
121 description { state: "selected_single" 0.0;
122 inherit: "default" 0.0;
123 visible: 1;
124 image {
125 normal: "seg_single_selected.png";
126 border: 7 7 7 7;
127 }
128 }
129 description { state: "selected_left" 0.0;
130 inherit: "default" 0.0;
131 visible: 1;
132 image {
133 normal: "seg_left_selected.png";
134 border: 6 3 7 7;
135 }
136 }
137 description { state: "selected_right" 0.0;
138 inherit: "default" 0.0;
139 visible: 1;
140 image {
141 normal: "seg_right_selected.png";
142 border: 3 6 7 7;
143 }
144 }
145 description { state: "selected_middle" 0.0;
146 inherit: "default" 0.0;
147 visible: 1;
148 image {
149 normal: "seg_middle_selected.png";
150 border: 3 3 3 3;
151 }
152 }
153 }
154 part { name: "padding_frame";
155 type: RECT;
156 scale: 1;
157 mouse_events: 0;
158 description { state: "default" 0.0;
159 visible: 0;
160 /* Add a padding of 2 pxs in all directions */
161 rel1.offset: 2 2;
162 rel2.offset: -3 -3;
163 }
164 }
165 part { name: "icon.bg";
166 type: RECT;
167 scale: 1;
168 mouse_events: 0;
169 description { state: "default" 0.0;
170 visible: 0;
171 fixed: 1 0;
172 rel1.to: "elm.swallow.icon";
173 rel2.to: "elm.swallow.icon";
174 }
175 }
176 part { name: "padding_icon_text";
177 type: RECT;
178 scale: 1;
179 mouse_events: 0;
180 description { state: "default" 0.0; //when only icon or no icon is there
181 visible: 0;
182 align: 0.0 0.0;
183 rel1 {
184 to: "icon.bg";
185 relative: 1.0 0.0;
186 }
187 rel2 {
188 to: "icon.bg";
189 relative: 1.0 1.0;
190 }
191 }
192 description { state: "icononly" 0.0;
193 inherit: "default" 0.0;
194 }
195 description { state: "visible" 0.0; //when icon is visible
196 inherit: "default" 0.0;
197 rel2.offset: 2 0;
198 }
199 }
200 part { name: "elm.swallow.icon";
201 type: SWALLOW;
202 scale: 1;
203 description { state: "default" 0.0;
204 visible: 0;
205 align: 0.5 0.5;
206 rel1.to: "padding_frame";
207 rel2.to: "padding_frame";
208 rel2.relative: 0.0 0.0;
209 aspect: 1.0 1.0;
210 aspect_preference: BOTH;
211 }
212 description { state: "visible" 0.0;
213 inherit: "default" 0.0;
214 visible: 1;
215 rel2.relative: 0.3 1.0;
216 }
217 description { state: "icononly" 0.0;
218 inherit: "default" 0.0;
219 visible: 1;
220 rel2.relative: 1.0 1.0;
221 }
222 }
223 part { name: "elm.text";
224 type: TEXT;
225 mouse_events: 0;
226 scale: 1;
227 description {
228 state: "default" 0.0;
229 visible: 0;
230 fixed: 1 1;
231 min: 1 1;
232 rel1 {
233 to_x: "padding_icon_text";
234 relative: 1.0 0.0;
235 }
236 rel2.to: "padding_frame";
237 color: 224 224 224 255;
238 color3: 0 0 0 64;
239 text {
240 font: "Sans";
241 ellipsis: 0.0;
242 fit: 1 1;
243 size: 24;
244 size_range: 8 36;
245 min: 0 1;
246 }
247 }
248 description { state: "normal" 0.0;
249 inherit: "default" 0.0;
250 visible: 1;
251 }
252 description { state: "pressed" 0.0;
253 inherit: "default" 0.0;
254 visible: 1;
255 color: 0 0 0 255;
256 }
257 description { state: "selected" 0.0;
258 inherit: "default" 0.0;
259 visible: 1;
260 color: 50 50 50 255;
261 }
262 description { state: "disabled" 0.0;
263 inherit: "default" 0.0;
264 visible: 1;
265 color: 200 200 200 255;
266 }
267 }
268 part { name: "disabler";
269 repeat_events: 0;
270 scale: 1;
271 description { state: "default" 0.0;
272 visible: 0;
273 fixed: 1 1;
274 min: 1 1;
275 align: 0.0 0.5;
276 rel1 {
277 relative: 0.0 0.0;
278 to: "segment";
279 }
280 rel2 {
281 relative: 1.0 1.0;
282 to: "segment";
283 }
284 color: 255 255 255 150;
285 }
286 description { state: "disabled_single" 0.0;
287 inherit: "default" 0.0;
288 visible: 1;
289 image {
290 normal: "seg_single_normal.png";
291 border: 7 7 7 7;
292 }
293 }
294 description { state: "disabled_left" 0.0;
295 inherit: "default" 0.0;
296 visible: 1;
297 image {
298 normal: "seg_left_normal.png";
299 border: 6 1 7 7;
300 }
301 }
302 description { state: "disabled_right" 0.0;
303 inherit: "default" 0.0;
304 visible: 1;
305 image {
306 normal: "seg_right_normal.png";
307 border: 1 6 7 7;
308 }
309 }
310 description { state: "disabled_middle" 0.0;
311 inherit: "default" 0.0;
312 visible: 1;
313 image {
314 normal: "seg_middle_normal.png";
315 border: 2 2 2 2;
316 }
317 }
318 }
319 }
320 programs {
321 script {
322 public seg_type; // Single, Left, Middle, Right.
323 public seg_state; // Normal/Default, Pressed, Selected.
324 public seg_status;// Enabled/Default, Disabled
325
326 public update_state() {
327 new type, state, disabled;
328 type = get_int(seg_type);
329 state = get_int(seg_state);
330 disabled = get_int(seg_status);
331
332 if(state == SEGMENT_STATE_NORMAL)
333 {
334 if(type == SEGMENT_TYPE_SINGLE)
335 set_state(PART:"segment", "default_single", 0.0);
336 else if(type == SEGMENT_TYPE_LEFT)
337 set_state(PART:"segment", "default_left", 0.0);
338 else if(type == SEGMENT_TYPE_MIDDLE)
339 set_state(PART:"segment", "default_middle", 0.0);
340 else if(type == SEGMENT_TYPE_RIGHT)
341 set_state(PART:"segment", "default_right", 0.0);
342 set_state(PART:"elm.text", "normal", 0.0);
343 }
344 else if(state == SEGMENT_STATE_PRESSED)
345 {
346 if(type == SEGMENT_TYPE_SINGLE)
347 set_state(PART:"segment", "pressed_single", 0.0);
348 else if(type == SEGMENT_TYPE_LEFT)
349 set_state(PART:"segment", "pressed_left", 0.0);
350 else if(type == SEGMENT_TYPE_MIDDLE)
351 set_state(PART:"segment", "pressed_middle", 0.0);
352 else if(type == SEGMENT_TYPE_RIGHT)
353 set_state(PART:"segment", "pressed_right", 0.0);
354 set_state(PART:"elm.text", "pressed", 0.0);
355 }
356 else if(state == SEGMENT_STATE_SELECTED)
357 {
358 if(type == SEGMENT_TYPE_SINGLE)
359 set_state(PART:"segment", "selected_single", 0.0);
360 else if(type == SEGMENT_TYPE_LEFT)
361 set_state(PART:"segment", "selected_left", 0.0);
362 else if(type == SEGMENT_TYPE_MIDDLE)
363 set_state(PART:"segment", "selected_middle", 0.0);
364 else if(type == SEGMENT_TYPE_RIGHT)
365 set_state(PART:"segment", "selected_right", 0.0);
366 set_state(PART:"elm.text", "selected", 0.0);
367 }
368 if(disabled == SEGMENT_STATUS_DISABLED)
369 {
370 if(type == SEGMENT_TYPE_SINGLE)
371 set_state(PART:"disabler", "disabled_single", 0.0);
372 else if(type == SEGMENT_TYPE_LEFT)
373 set_state(PART:"disabler", "disabled_left", 0.0);
374 else if(type == SEGMENT_TYPE_MIDDLE)
375 set_state(PART:"disabler", "disabled_middle", 0.0);
376 else if(type == SEGMENT_TYPE_RIGHT)
377 set_state(PART:"disabler", "disabled_right", 0.0);
378 set_state(PART:"elm.text", "disabled", 0.0);
379 }
380 else
381 set_state(PART:"disabler", "default", 0.0);
382
383 }
384 }
385 program {
386 name: "segment_type_s";
387 signal: "elm,type,segment,single";
388 source: "elm";
389 script {
390 set_int(seg_type, SEGMENT_TYPE_SINGLE);
391 update_state();
392 }
393 }
394 program {
395 name: "segment_type_l";
396 signal: "elm,type,segment,left";
397 source: "elm";
398 script {
399 set_int(seg_type, SEGMENT_TYPE_LEFT);
400 update_state();
401 }
402 }
403 program {
404 name: "segment_type_m";
405 signal: "elm,type,segment,middle";
406 source: "elm";
407 script {
408 set_int(seg_type, SEGMENT_TYPE_MIDDLE);
409 update_state();
410 }
411 }
412 program {
413 name: "segment_type_r";
414 signal: "elm,type,segment,right";
415 source: "elm";
416 script {
417 set_int(seg_type, SEGMENT_TYPE_RIGHT);
418 update_state();
419 }
420 }
421 program {
422 name: "normal_segment";
423 signal: "elm,state,segment,normal";
424 source: "elm";
425 script {
426 set_int(seg_state, SEGMENT_STATE_NORMAL);
427 update_state();
428 }
429 }
430 program {
431 name: "pressed_segment";
432 signal: "elm,state,segment,pressed";
433 source: "elm";
434 script {
435 set_int(seg_state, SEGMENT_STATE_PRESSED);
436 update_state();
437 }
438 }
439 program {
440 name: "selected_segment";
441 signal: "elm,state,segment,selected";
442 source: "elm";
443 script {
444 set_int(seg_state, SEGMENT_STATE_SELECTED);
445 update_state();
446 }
447 }
448 program { name: "disable_segment";
449 signal: "elm,state,disabled";
450 source: "elm";
451 script {
452 set_int(seg_status, SEGMENT_STATUS_DISABLED);
453 update_state();
454 }
455 }
456 program { name: "enable_segment";
457 signal: "elm,state,enabled";
458 source: "elm";
459 script {
460 set_int(seg_status, SEGMENT_STATUS_ENABLED);
461 update_state();
462 }
463 }
464 program { name: "text_show";
465 signal: "elm,state,text,visible";
466 source: "elm";
467 script {
468 new st[31];
469 new Float:vl;
470 get_state(PART:"elm.swallow.icon", st, 30, vl);
471 if (!strcmp(st, "icononly"))
472 {
473 set_state(PART:"elm.swallow.icon", "visible", 0.0);
474 set_state(PART:"padding_icon_text", "visible", 0.0);
475 }
476 get_state(PART:"elm.text", st, 30, vl);
477 if (!strcmp(st, "selected"))
478 set_state(PART:"elm.text", "selected", 0.0);
479 else
480 set_state(PART:"elm.text", "normal", 0.0);
481 }
482 }
483 program { name: "text_hide";
484 signal: "elm,state,text,hidden";
485 source: "elm";
486 script {
487 new st[31];
488 new Float:vl;
489 get_state(PART:"elm.swallow.icon", st, 30, vl);
490 if (!strcmp(st, "visible"))
491 {
492 set_state(PART:"elm.swallow.icon", "icononly", 0.0);
493 set_state(PART:"padding_icon_text", "icononly", 0.0);
494 }
495 set_state(PART:"elm.text", "default", 0.0);
496 }
497 }
498 program { name: "icon_show";
499 signal: "elm,state,icon,visible";
500 source: "elm";
501 script {
502 new st[31];
503 new Float:vl;
504 get_state(PART:"elm.text", st, 30, vl);
505 if ((!strcmp(st, "normal")) || (!strcmp(st, "selected")))
506 {
507 set_state(PART:"elm.swallow.icon", "visible", 0.0);
508 set_state(PART:"padding_icon_text", "visible", 0.0);
509 }
510 else
511 {
512 set_state(PART:"elm.swallow.icon", "icononly", 0.0);
513 set_state(PART:"padding_icon_text", "icononly", 0.0);
514 }
515 }
516 }
517 program { name: "icon_hide";
518 signal: "elm,state,icon,hidden";
519 source: "elm";
520 action: STATE_SET "default" 0.0;
521 target: "elm.swallow.icon";
522 }
523 }
524 #undef SEGMENT_TYPE_SINGLE
525 #undef SEGMENT_TYPE_LEFT
526 #undef SEGMENT_TYPE_MIDDLE
527 #undef SEGMENT_TYPE_RIGHT
528 #undef SEGMENT_STATE_NORMAL
529 #undef SEGMENT_STATE_PRESSED
530 #undef SEGMENT_STATE_SELECTED
531 #undef SEGMENT_STATUS_ENABLED
532 #undef SEGMENT_STATUS_DISABLED
533}