group { name: "elm/check/base/default"; script { BUTTONMODE_SCRIPT } parts { part { name: "shadow"; type: SPACER; description { state: "default"; } desc { "pressed"; inherit; } desc { "disabled"; inherit; } } swallow { "elm.swallow.background"; nomouse; desc { "default"; visible: 0; } desc { "visible"; inherit; visible: 1; } } rect { "icon_clip"; desc { "default"; color_class: "button_icon"; } desc { "pressed"; inherit; color_class: "button_icon_pressed"; } desc { "disabled"; inherit; color_class: "button_icon_disabled"; } } swallow { "elm.swallow.content"; nomouse; clip_to: "icon_clip"; scale: 1; desc { "default"; fixed: 1 0; align: 0.0 0.5; rel1.to_x: "base"; rel2.to_x: "base"; rel1.offset: 4 4; rel1.relative: 1.0 0.0; rel2.relative: 0.0 1.0; rel2.offset: 4 -5; visible: 0; offscale; } desc { "visible"; inherit; fixed: 1 0; aspect: 1.0 1.0; visible: 1; min: ICMIN ICMIN; } desc { "icononly"; inherit; fixed: 0 0; align: 0.5 0.5; rel2.relative: 1.0 1.0; rel2.offset: -5 -5; rel2.to_x: ""; visible: 1; min: ICMIN ICMIN; } } part { name: "base"; type: RECT; scale: 1; description { state: "default"; fixed: 1 0; color: 0 0 0 64; align: 0.0 0.5; min: 13 13; max: 13 13; rel1.offset: 4 4; rel2.relative: 0.0 1.0; rel2.offset: 4 -5; aspect: 1.0 1.0; aspect_preference: VERTICAL; offscale; } desc { "pressed"; inherit; color: 0 0 0 128; } desc { "disabled"; inherit; color: 0 0 0 16; } } part { name: "ck_check"; clip_to: "ck_selected"; scale: 1; description { state: "default" 0.0; fixed: 0 0; rel.to: "base"; image.normal: "i-check"; min: 15 15; max: 15 15; visible: 0; color: 160 160 160 255; fixed: 1 1; } description { state: "pressed" 0.0; inherit: "default" 0.0; color: 255 255 255 255; visible: 1; } description { state: "selected" 0.0; inherit: "default" 0.0; visible: 1; } } part { name: "ck_selected"; type: RECT; description { state: "default" 0.0; rel.to: "base"; } description { state: "disabled" 0.0; inherit: "default" 0.0; color: 153 153 153 255; } } text { "elm.text"; nomouse; scale: 1; desc { "default"; fixed: 0 1; color: 160 160 160 255; rel1.offset: 0 4; rel1.relative: 1.0 0.0; rel1.to_x: "elm.swallow.content"; rel2.offset: -5 -5; text { font: FN; size: 10; align: 0.0 0.5; min: 0 0; } visible: 0; offscale; min: 0 ICMIN; } desc { "visible"; inherit; fixed: 0 0; rel1.offset: 4 4; text.min: 1 1; text.ellipsis: -1; visible: 1; } desc { "pressed_visible"; inherit; fixed: 0 0; color: 255 255 255 255; rel1.offset: 4 4; text.min: 1 1; text.ellipsis: -1; visible: 1; } desc { "textonly"; inherit; fixed: 0 0; text.min: 1 1; text.ellipsis: -1; visible: 1; } desc { "pressed_textonly"; inherit; fixed: 0 0; color: 255 255 255 255; text.min: 1 1; text.ellipsis: -1; visible: 1; } desc { "disabled_visible"; inherit; fixed: 0 0; color: 96 96 96 255; rel1.offset: 4 4; text.min: 1 1; text.ellipsis: -1; visible: 1; } desc { "disabled_textonly"; inherit; fixed: 0 0; color: 96 96 96 255; text.min: 1 1; text.ellipsis: -1; visible: 1; } } rect { "event"; ignore_flags: ON_HOLD; desc { "default"; color: 0 0 0 0; } desc { "disabled"; inherit; visible: 0; } } } programs { program { signal: "mouse,clicked,1"; source: "event"; action: SIGNAL_EMIT "elm,action,check,toggle" "elm"; } program { signal: "mouse,down,1"; source: "event"; script { new buf[32]; new Float:val; get_state(PART:"ck_check", buf, 32, val); if (!strcmp(buf, "default")) { run_program(PROGRAM:"snd-check-on"); } else { run_program(PROGRAM:"snd-check-off"); } } } program { signal: "elm,state,check,on"; source: "elm"; action: STATE_SET "selected" 0.0; target: "ck_check"; } program { signal: "elm,state,check,off"; source: "elm"; action: STATE_SET "default" 0.0; target: "ck_check"; } program { name: "snd-check-on"; action: PLAY_SAMPLE "wood-tap1" 1.0 INPUT; } program { name: "snd-check-off"; action: PLAY_SAMPLE "wood-tap2" 1.0 INPUT; } program { signal: "mouse,down,1"; source: "event"; action: SIGNAL_EMIT "elm,action,press" "elm"; after: "button_click_anim"; } program { signal: "mouse,down,1"; source: "event"; action: STATE_SET "pressed" 0.0; target: "ck_check"; } program { name: "button_click_anim"; script { flag_set(PRESSED); } } program { name: "button_unclick"; signal: "mouse,up,1"; source: "event"; action: SIGNAL_EMIT "elm,action,unpress" "elm"; after: "button_unclick_anim"; } program { signal: "mouse,up,1"; source: "event"; action: STATE_SET "default" 0.0; target: "ck_check"; } program { name: "button_unclick_anim"; script { flag_unset(PRESSED); } } program { name: "buttonactivate"; signal: "elm,anim,activate"; source: "elm"; action: STATE_SET "pressed" 0.0; target: "ck_check"; after: "button_unpressed_anim"; } program { name: "button_unpressed_anim"; in: 0.5 0.0; action: STATE_SET "default" 0.0; target: "ck_check"; } program { signal: "mouse,clicked,1"; source: "event"; action: SIGNAL_EMIT "elm,action,click" "elm"; } program { name: "button_text_visible"; signal: "elm,state,text,visible"; source: "elm"; script { flag_set(LABEL); } } program { name: "button_text_hidden"; signal: "elm,state,text,hidden"; source: "elm"; script { flag_unset(LABEL); } } program { name: "button_icon_visible"; signal: "elm,state,icon,visible"; source: "elm"; script { flag_set(ICON); } } program { name: "button_icon_hidden"; signal: "elm,state,icon,hidden"; source: "elm"; script { flag_unset(ICON); } } program { name: "button_background_visible"; signal: "elm,state,background,visible"; source: "elm"; script { flag_set(BACKGROUND); } } program { name: "button_background_hidden"; signal: "elm,state,background,hidden"; source: "elm"; script { flag_unset(BACKGROUND); } } program { name: "button_state_disabled"; signal: "elm,state,disabled"; source: "elm"; script { flag_set(DISABLE); } } program { name: "button_state_enabled"; signal: "elm,state,enabled"; source: "elm"; script { flag_unset(DISABLE); } } program { signal: "elm,state,disabled"; source: "elm"; action: STATE_SET "disabled" 0.0; target: "ck_selected"; } program { signal: "elm,state,enabled"; source: "elm"; action: STATE_SET "default" 0.0; target: "ck_selected"; } } } group { name: "elm/check/base/toggle"; script { public is_drag; public was_drag; public is_rtl; BUTTONMODE_SCRIPT } parts { part { name: "shadow"; type: SPACER; description { state: "default"; } desc { "pressed"; inherit; } desc { "disabled"; inherit; } } swallow { "elm.swallow.background"; nomouse; desc { "default"; visible: 0; } desc { "visible"; inherit; visible: 1; } } rect { "icon_clip"; desc { "default"; color_class: "button_icon"; } desc { "pressed"; inherit; color_class: "button_icon_pressed"; } desc { "disabled"; inherit; color_class: "button_icon_disabled"; } } swallow { "elm.swallow.content"; nomouse; clip_to: "icon_clip"; scale: 1; desc { "default"; fixed: 1 0; align: 0.0 0.5; rel1.offset: 4 4; rel2.relative: 0.0 1.0; rel2.offset: 4 -5; visible: 0; offscale; } desc { "visible"; inherit; fixed: 1 0; aspect: 1.0 1.0; visible: 1; min: ICMIN ICMIN; } desc { "icononly"; inherit; fixed: 0 0; align: 0.5 0.5; rel2.relative: 1.0 1.0; rel2.offset: -5 -5; rel2.to_x: "tog"; rel2.relative: 0.0 1.0; visible: 1; min: ICMIN ICMIN; } } spacer { name: "tog"; scale: 1; description { state: "default" 0.0; fixed: 1 1; rel1.relative: 1.0 0.0; rel1.offset: -5 4; rel2.offset: -5 -5; align: 1.0 0.5; min: 88 15; max: 88 15; offscale; } } rect { name: "base"; description { state: "default"; fixed: 1 1; color: 0 0 0 64; rel.to: "tog"; } desc { "pressed"; inherit; color: 0 0 0 128; } desc { "disabled"; inherit; color: 0 0 0 16; } } spacer { name: "onrect"; description { state: "default" 0.0; rel.to: "button"; rel1.relative: -5.0 0.0; rel2.relative: 0.5 1.0; } } spacer { name: "offrect"; description { state: "default" 0.0; rel.to: "button"; rel1.relative: 0.5 0.0; rel2.relative: 6.0 1.0; } } text { name: "elm.offtext"; nomouse; scale: 1; clip_to: "tog_clip"; description { state: "default" 0.0; fixed: 1 1; rel1.to: "button"; rel1.relative: 1.0 0.0; rel1.offset: 4 0; rel2.to: "offrect"; rel2.offset: -5 -1; offscale; color: 160 160 160 255; text { font: FN; size: 10; min: 0 1; align: 0.5 0.5; text_class: "check_off_text"; text: "OFF"; } } description { state: "disabled" 0.0; inherit: "default" 0.0; color: 96 96 96 255; } description { state: "clicked" 0.0; inherit: "default" 0.0; color: 255 255 255 255; } } text { name: "elm.ontext"; nomouse; scale: 1; clip_to: "tog_clip"; description { state: "default" 0.0; fixed: 1 1; rel1.to: "onrect"; rel1.offset: 4 0; rel2.to: "button"; rel2.relative: 0.0 1.0; rel2.offset: -5 -1; offscale; color: 51 153 255 255; text { font: FN; size: 10; min: 0 1; align: 0.5 0.5; text_class: "check_on_text"; text: "ON"; } } description { state: "disabled" 0.0; inherit: "default" 0.0; color: 96 96 96 255; } description { state: "clicked" 0.0; inherit: "default" 0.0; color: 255 255 255 255; } } part { name: "tog_clip"; type: RECT; description { state: "default" 0.0; rel.to: "tog"; } } part { name: "button"; type: RECT; scale: 1; clip_to: "tog_clip"; dragable { x: 1 1 0; y: 0 0 0; confine: "tog"; } description { state: "default" 0.0; fixed: 1 1; rel.to: "tog"; min: 15 15; max: 15 99999; color: 0 0 0 0; } } rect { name: "base_but"; nomouse; description { state: "default" 0.0; rel.to: "button"; color: 51 153 255 255; } description { state: "clicked" 0.0; inherit: "default" 0.0; color: 255 255 255 255; } description { state: "disabled" 0.0; inherit: "default" 0.0; color: 64 64 64 255; } } rect { name: "button_events"; dragable.events: "button"; description { state: "default" 0.0; color: 0 0 0 0; } } text { "elm.text"; nomouse; scale: 1; desc { "default"; fixed: 0 1; color: 160 160 160 255; rel1.offset: 0 4; rel1.relative: 1.0 0.0; rel1.to_x: "elm.swallow.content"; rel2.offset: -5 -5; rel2.relative: 0.0 1.0; rel2.to_x: "tog"; text { font: FN; size: 10; align: 0.5 0.5; min: 0 0; } visible: 0; offscale; min: 0 ICMIN; } desc { "visible"; inherit; fixed: 0 0; rel1.offset: 4 4; text.min: 1 1; text.ellipsis: -1; visible: 1; } desc { "pressed_visible"; inherit; fixed: 0 0; color: 255 255 255 255; rel1.offset: 4 4; text.min: 1 1; text.ellipsis: -1; visible: 1; } desc { "textonly"; inherit; fixed: 0 0; text.min: 1 1; text.ellipsis: -1; visible: 1; } desc { "pressed_textonly"; inherit; fixed: 0 0; color: 255 255 255 255; text.min: 1 1; text.ellipsis: -1; visible: 1; } desc { "disabled_visible"; inherit; fixed: 0 0; color: 96 96 96 255; rel1.offset: 4 4; text.min: 1 1; text.ellipsis: -1; visible: 1; } desc { "disabled_textonly"; inherit; fixed: 0 0; color: 96 96 96 255; text.min: 1 1; text.ellipsis: -1; visible: 1; } } rect { "event2"; desc { "default"; color: 0 0 0 0; visible: 0; } desc { "disabled"; inherit; visible: 1; } } rect { "event"; repeat; ignore_flags: ON_HOLD; desc { "default"; color: 0 0 0 0; } desc { "disabled"; inherit; visible: 0; } } } programs { program { signal: "elm,state,check,on"; source: "elm"; script { new Float:drag; if (get_int(is_rtl) == 0) { drag = 100.0; } else { drag = 0.0; } set_drag(PART:"button", drag, 0.0); } } program { signal: "elm,state,check,off"; source: "elm"; script { new Float:drag; if (get_int(is_rtl) == 0) { drag = 0.0; } else { drag = 100.0; } set_drag(PART:"button", drag, 0.0); } } program { signal: "mouse,clicked,1"; source: "button"; script { new Float:dx, Float:dy; get_drag(PART:"button", dx, dy); if (!get_int(was_drag)) { if (dx > 0.5) { set_drag(PART:"button", 0.0, 0.0); } else { set_drag(PART:"button", 1.0, 0.0); } if (((get_int(is_rtl) == 1) && (dx <= 0.5)) || (get_int(is_rtl) == 0) && (dx > 0.5)) { emit("elm,action,check,off", "elm"); } else { emit("elm,action,check,on", "elm"); } } } } program { signal: "drag"; source: "button"; script { set_int(is_drag, 1); } } program { signal: "mouse,down,1"; source: "button"; script { set_int(was_drag, 0); set_int(is_drag, 0); } } program { signal: "mouse,up,1"; source: "button"; script { new Float:dx, Float:dy; get_drag(PART:"button", dx, dy); if (get_int(is_drag)) { if (dx > 0.5) { set_drag(PART:"button", 1.0, 0.0); } else { set_drag(PART:"button", 0.0, 0.0); } if (((get_int(is_rtl) == 1) && (dx <= 0.5)) || (get_int(is_rtl) == 0) && (dx > 0.5)) { emit("elm,action,check,on", "elm"); } else { emit("elm,action,check,off", "elm"); } set_int(was_drag, 1); set_int(is_drag, 0); } } } program { signal: "mouse,down,1"; source: "button"; action: STATE_SET "clicked" 0.0; target: "base_but"; target: "elm.ontext"; target: "elm.offtext"; } program { signal: "mouse,up,1"; source: "button"; action: STATE_SET "default" 0.0; target: "base_but"; target: "elm.ontext"; target: "elm.offtext"; } program { signal: "mouse,clicked,1"; source: "event"; action: SIGNAL_EMIT "elm,action,check,toggle" "elm"; } program { signal: "mouse,down,1"; source: "event"; action: SIGNAL_EMIT "elm,action,press" "elm"; after: "button_click_anim"; } program { name: "button_click_anim"; script { flag_set(PRESSED); } } program { name: "button_unclick"; signal: "mouse,up,1"; source: "event"; action: SIGNAL_EMIT "elm,action,unpress" "elm"; after: "button_unclick_anim"; } program { name: "button_unclick_anim"; script { flag_unset(PRESSED); } } program { signal: "elm,anim,activate"; source: "elm"; script { new Float:drag; if (get_int(is_rtl) == 0) { drag = 100.0; } else { drag = 0.0; } set_drag(PART:"button", drag, 0.0); } after: "button_unpressed_anim"; } program { name: "button_unpressed_anim"; in: 0.5 0.0; script { new Float:drag; if (get_int(is_rtl) == 0) { drag = 0.0; } else { drag = 100.0; } set_drag(PART:"button", drag, 0.0); } } program { signal: "mouse,clicked,1"; source: "event"; action: SIGNAL_EMIT "elm,action,click" "elm"; } program { name: "button_text_visible"; signal: "elm,state,text,visible"; source: "elm"; script { flag_set(LABEL); } } program { name: "button_text_hidden"; signal: "elm,state,text,hidden"; source: "elm"; script { flag_unset(LABEL); } } program { name: "button_icon_visible"; signal: "elm,state,icon,visible"; source: "elm"; script { flag_set(ICON); } } program { name: "button_icon_hidden"; signal: "elm,state,icon,hidden"; source: "elm"; script { flag_unset(ICON); } } program { name: "button_background_visible"; signal: "elm,state,background,visible"; source: "elm"; script { flag_set(BACKGROUND); } } program { name: "button_background_hidden"; signal: "elm,state,background,hidden"; source: "elm"; script { flag_unset(BACKGROUND); } } program { name: "button_state_disabled"; signal: "elm,state,disabled"; source: "elm"; script { flag_set(DISABLE); } } program { name: "button_state_enabled"; signal: "elm,state,enabled"; source: "elm"; script { flag_unset(DISABLE); } } program { signal: "elm,state,disabled"; source: "elm"; action: STATE_SET "disabled" 0.0; target: "base_but"; target: "event2"; target: "elm.offtext"; target: "elm.ontext"; } program { signal: "elm,state,enabled"; source: "elm"; action: STATE_SET "default" 0.0; target: "base_but"; target: "event2"; target: "elm.offtext"; target: "elm.ontext"; } program { signal: "edje,state,rtl"; source: "edje"; script { set_int(is_rtl, 1); } } program { signal: "edje,state,ltr"; source: "edje"; script { set_int(is_rtl, 0); } } } }