2 * Copyright (c) 2010 Samsung Electronics Co., Ltd All Rights Reserved
4 * PROPRIETARY/CONFIDENTIAL
6 * This software is the confidential and proprietary information of SAMSUNG
7 * ELECTRONICS ("Confidential Information"). You agree and acknowledge that this
8 * software is owned by Samsung and you shall not disclose such Confidential
9 * Information and shall use it only in accordance with the terms of the license
10 * agreement you entered into with SAMSUNG ELECTRONICS. SAMSUNG make no
11 * representations or warranties about the suitability of the software, either
12 * express or implied, including but not limited to the implied warranties of
13 * merchantability, fitness for a particular purpose, or non-infringement.
14 * SAMSUNG shall not be liable for any damages suffered by licensee arising out
15 * of or releated to this software.
20 name: "elm/toggle/base/style1";
23 image: "switch_btn.png" COMP;
24 image: "switch_bg.png" COMP;
25 image: "switch_left_padding.png" COMP;
26 image: "switch_right_padding.png" COMP;
30 public timer_on(val) {
32 get_drag(PART:"button", x, y);
34 set_state(PART:"bg", "on", 0.0);
36 set_drag(PART:"button", x, y);
37 emit("elm,action,toggle,on", "");
38 } else if (x <= 0.5) {
40 set_drag(PART:"button", x, y);
41 timer(0.01, "timer_on", 0);
44 set_drag(PART:"button", x, y);
45 timer(0.01, "timer_on", 0);
49 public timer_off(val) {
51 get_drag(PART:"button", x, y);
53 set_state(PART:"bg", "off", 0.0);
55 set_drag(PART:"button", x, y);
56 emit("elm,action,toggle,off", "");
57 } else if (x >= 0.5) {
59 set_drag(PART:"button", x, y);
60 timer(0.01, "timer_off", 0);
63 set_drag(PART:"button", x, y);
64 timer(0.01, "timer_off", 0);
82 color: 255 255 255 255;
86 inherit: "default" 0.0;
98 rel2 { relative: 0 1; to: "bg"; }
100 image.normal: "switch_left_padding.png";
104 name: "right_padding";
108 state: "default" 0.0;
111 rel1 { relative: 1 0; to: "bg"; }
114 image.normal: "switch_right_padding.png";
118 name: "button_clipper";
122 state: "default" 0.0;
123 rel1.to: "left_padding";
124 rel2.to: "right_padding";
132 state: "default" 0.0;
133 rel1 { relative: 1 0; to_x: "left_padding"; to_y: "bg"; }
134 rel2 { relative: 0 1; to_x: "right_padding"; to_y: "bg"; }
137 part { name: "button";
147 state: "default" 0.0;
157 name: "button_events";
163 state: "default" 0.0;
176 state: "default" 0.0;
178 rel1.relative: -2.0 0.0;
180 rel2.relative: 0.0 1.0;
191 state: "default" 0.0;
193 rel1.relative: 1.0 0.0;
195 rel2.relative: 3.0 1.0;
203 description { state: "default" 0.0;
206 image.normal: "switch_bg.png";
212 clip_to: "button_clipper";
214 state: "default" 0.0;
218 normal: "switch_btn.png";
229 state: "default" 0.0;
234 state: "disabled" 0.0;
235 inherit: "default" 0.0;
244 signal: "mouse,up,1";
249 get_state(PART:"bg", st, 30, vl)
250 if (!strncmp(st, "default", 7)) {
251 set_state(PART:"bg", "on", 0.0);
254 set_state(PART:"bg", "off", 0.0);
261 signal: "elm,state,toggle,on";
264 set_state(PART:"bg", "on", 0.0);
270 signal: "elm,state,toggle,off";
273 set_state(PART:"bg", "off", 0.0);
279 signal: "elm,state,disabled";
281 action: STATE_SET "disabled" 0.0;
287 signal: "elm,state,enabled";
289 action: STATE_SET "default" 0.0;
295 ///////////////////////////////////////////////////////////////////////////////////////
296 group { name: "elm/toggle/base/default";
298 image: "00_button_on.png" COMP;
299 image: "00_button_on_press.png" COMP;
300 image: "00_button_off.png" COMP;
301 image: "00_button_off_press.png" COMP;
302 image: "00_button_onoff_handle.png" COMP;
303 image: "00_button_onoff_handle_press.png" COMP;
306 public toggle_move_state = 0; //0:no movement, 1: moved
307 public toggle_is_down = 0; //0:not down, 1: down
314 description { state: "default" 0.0;
317 rel1.relative: 1.0 0.0;
324 name: "padding_left";
328 description { state: "default" 0.0;
330 rel1{ relative: 0.0 0.0; to: "bg"; }
331 rel2{ relative: 0.0 1.0; to: "bg"; }
338 name: "padding_right";
342 description { state: "default" 0.0;
344 rel1{ relative: 1.0 0.0; to: "bg"; }
345 rel2{ relative: 1.0 1.0; to: "bg"; }
356 description { state: "default" 0.0;
358 rel1{ relative: 0.0 0.0; to: "bg"; }
359 rel2{ relative: 1.0 0.0; to: "bg"; }
366 name: "padding_bottom";
370 description { state: "default" 0.0;
372 rel1{ relative: 0.0 1.0; to: "bg"; }
373 rel2{ relative: 1.0 1.0; to: "bg"; }
379 part { name: "bg_image";
383 description { state: "default" 0.0;
385 rel1{ relative: 0.0 1.0; to_x: "bg"; to_y: "padding_top"; }
386 rel2{ relative: 1.0 0.0; to_x: "bg"; to_y: "padding_bottom"; }
387 image.normal: "00_button_off.png";
389 description { state: "off_pressed" 0.0;
390 inherit: "default" 0.0;
391 image.normal: "00_button_off_press.png";
393 description { state: "on_pressed" 0.0;
394 inherit: "default" 0.0;
395 image.normal: "00_button_on_press.png";
397 description { state: "on" 0.0;
398 inherit: "default" 0.0;
399 image.normal: "00_button_on.png";
402 part { name: "drag_container";
406 description { state: "default" 0.0;
407 rel1{ relative: 1.0 0.0; to_x: "padding_left"; to_y: "bg_image"; }
408 rel2{ relative: 0.0 1.0; to_x: "padding_right"; to_y: "bg_image"; }
412 part { name: "clipper";
415 description { state: "default" 0.0;
418 color: 255 255 255 255;
421 part { name: "clipper_inner";
424 description { state: "default" 0.0;
429 color: 255 255 255 255;
432 part { name: "button";
440 confine: "drag_container";
442 description { state: "default" 0.0;
445 image.normal: "00_button_onoff_handle.png";
447 description { state: "pressed" 0.0;
448 inherit: "default" 0.0;
449 image.normal: "00_button_onoff_handle_press.png";
452 part { name: "button_events";
457 description { state: "default" 0.0;
463 part { name: "onrect";
468 description { state: "default" 0.0;
469 rel1{ relative: -1.0 0.0; to: "button"; }
470 rel2{ relative: 0.0 1.0; to: "button"; }
475 part { name: "offrect";
480 description { state: "default" 0.0;
481 rel1{ relative: 1.0 0.0; to: "button"; }
482 rel2{ relative: 2.0 1.0; to: "button"; }
486 part { name: "elm.offtext";
490 clip_to: "clipper_inner";
491 description { state: "default" 0.0;
494 color: 255 255 255 255;
496 font: "SLP:style=Medium";
501 text_class: "slp_medium";
504 description { state: "disabled" 0.0;
505 inherit: "default" 0.0;
506 color: 128 128 128 128;
509 part { name: "elm.ontext";
513 clip_to: "clipper_inner";
514 description { state: "default" 0.0;
517 color: 255 255 255 255;
519 font: "SLP:style=Medium";
524 text_class: "slp_medium";
527 description { state: "disabled" 0.0;
528 inherit: "default" 0.0;
529 color: 128 128 128 128;
533 part { name: "elm.swallow.content";
535 description { state: "default" 0.0;
540 rel2.relative: 0.0 1.0;
543 description { state: "visible" 0.0;
544 inherit: "default" 0.0;
548 aspect_preference: VERTICAL;
551 description { state: "disabled" 0.0;
552 inherit: "default" 0.0;
553 color: 128 128 128 128;
555 description { state: "disabled_visible" 0.0;
556 inherit: "default" 0.0;
557 color: 128 128 128 128;
563 part { name: "elm.text";
567 description { state: "default" 0.0;
569 rel1.to_x: "elm.swallow.content";
570 rel1.relative: 1.0 0.0;
573 rel2.relative: 0.0 1.0;
577 font: "SLP:style=Medium";
581 text_class: "slp_medium";
584 description { state: "visible" 0.0;
585 inherit: "default" 0.0;
589 description { state: "disabled" 0.0;
590 inherit: "default" 0.0;
591 color: 128 128 128 128;
593 description { state: "disabled_visible" 0.0;
594 inherit: "default" 0.0;
595 color: 128 128 128 128;
599 part { name: "disabler";
601 description { state: "default" 0.0;
605 description { state: "disabled" 0.0;
606 inherit: "default" 0.0;
612 program { name: "drag_end";
613 signal: "mouse,up,1";
616 new Float:dx, Float:dy;
619 get_drag(PART:"button", dx, dy);
620 set_int(toggle_is_down, 0);
621 get_state(PART:"bg_image", st, 30, vl)
622 if(get_int(toggle_move_state) == 0) //no movement
626 set_drag(PART:"button", 0.0, 0.0);
627 emit("elm,action,toggle,off", "");
628 set_state(PART:"bg_image", "default", 0.0);
632 set_drag(PART:"button", 1.0, 0.0);
633 emit("elm,action,toggle,on", "");
634 set_state(PART:"bg_image", "on", 0.0);
641 set_drag(PART:"button", 1.0, 0.0);
642 if (!strcmp(st, "off_pressed")) {
643 emit("elm,action,toggle,on", "");
645 set_state(PART:"bg_image", "on", 0.0);
649 set_drag(PART:"button", 0.0, 0.0);
650 if (!strcmp(st, "on_pressed")) {
651 emit("elm,action,toggle,off", "");
653 set_state(PART:"bg_image", "default", 0.0);
656 set_state(PART:"button", "default", 0.0);
657 set_int(toggle_move_state,0);
660 program { name: "toggle_on";
661 signal: "elm,state,toggle,on";
664 set_drag(PART:"button", 100.0, 0.0);
665 set_state(PART:"bg_image", "on", 0.0);
668 program { name: "toggle_off";
669 signal: "elm,state,toggle,off";
672 set_drag(PART:"button", 0.0, 0.0);
673 set_state(PART:"bg_image", "default", 0.0);
676 program { name: "mouse_press,";
677 signal: "mouse,down,1";
682 set_int(toggle_is_down, 1);
683 get_state(PART:"bg_image", st, 30, vl)
684 if (!strcmp(st, "default")) {
685 set_state(PART:"bg_image", "off_pressed", 0.0);
688 set_state(PART:"bg_image", "on_pressed", 0.0);
690 set_state(PART:"button", "pressed", 0.0);
693 program { name: "mouse_move,";
694 signal: "mouse,move";
697 if(get_int(toggle_is_down) == 0)
699 set_int(toggle_move_state,0);
703 set_int(toggle_move_state,1);
707 program { name: "text_show";
708 signal: "elm,state,text,visible";
710 action: STATE_SET "visible" 0.0;
713 program { name: "text_hide";
714 signal: "elm,state,text,hidden";
716 action: STATE_SET "default" 0.0;
719 program { name: "icon_show";
720 signal: "elm,state,icon,visible";
722 action: STATE_SET "visible" 0.0;
723 target: "elm.swallow.content";
725 program { name: "icon_hide";
726 signal: "elm,state,icon,hidden";
728 action: STATE_SET "default" 0.0;
729 target: "elm.swallow.content";
731 program { name: "disable";
732 signal: "elm,state,disabled";
734 action: STATE_SET "disabled" 0.0;
735 target: "elm.ontext";
736 target: "elm.offtext";
738 after: "disable_text";
740 program { name: "disable_text";
744 get_state(PART:"elm.text", st, 30, vl);
745 if (!strcmp(st, "visible"))
746 set_state(PART:"elm.text", "disabled_visible", 0.0);
748 set_state(PART:"elm.text", "disabled", 0.0);
750 get_state(PART:"elm.swallow.content", st, 30, vl);
751 if (!strcmp(st, "visible"))
752 set_state(PART:"elm.swallow.content", "disabled_visible", 0.0);
754 set_state(PART:"elm.swallow.content", "disabled", 0.0);
757 program { name: "enable";
758 signal: "elm,state,enabled";
760 action: STATE_SET "default" 0.0;
761 target: "elm.ontext";
762 target: "elm.offtext";
764 after: "enable_text";
766 program { name: "enable_text";
770 get_state(PART:"elm.text", st, 30, vl);
771 if (!strcmp(st, "disabled_visible"))
772 set_state(PART:"elm.text", "visible", 0.0);
774 set_state(PART:"elm.text", "default", 0.0);
776 get_state(PART:"elm.swallow.content", st, 30, vl);
777 if (!strcmp(st, "visible"))
778 set_state(PART:"elm.swallow.content", "visible", 0.0);
780 set_state(PART:"elm.swallow.content", "default", 0.0);