group { name: "elm/check/base/toggle"; images { image: "/whitetheme/check_cover.png" COMP; image: "/whitetheme/action_slider_guage_on.png" COMP; image: "/whitetheme/action_slider_guage_off.png" COMP; image: "/whitetheme/check_btn.png" COMP; } script { public is_rtl; public is_drag; public was_drag; } parts { part { name: "bg"; type: RECT; mouse_events: 0; scale: 1; description { min: CHECK_TOGGLE_BG_MIN_WIDTH_INC CHECK_TOGGLE_BG_MIN_HEIGHT_INC; max: CHECK_TOGGLE_BG_MIN_WIDTH_INC CHECK_TOGGLE_BG_MIN_HEIGHT_INC; state: "default" 0.0; fixed: 1 0; rel1.relative: 1.0 0.0; align: 1.0 0.5; visible: 0; } } part { name: "clipper"; type: RECT; mouse_events: 0; scale: 1; description { state: "default" 0.0; rel1.to: "bg"; rel2.to: "bg"; color: BG_DEFAULT_COLOR_INC; } } part { name: "button"; type: SPACER; scale: 1; clip_to: "clipper"; mouse_events: 1; dragable { x: 1 1 0; y: 0 0 0; confine: "bg"; } description { state: "default" 0.0; fixed: 1 1; align: 0.5 0.5; min: CHECK_TOGGLE_BUTTON_MIN_WIDTH_INC CHECK_TOGGLE_BUTTON_MIN_HEIGHT_INC; max: CHECK_TOGGLE_BUTTON_MIN_WIDTH_INC CHECK_TOGGLE_BUTTON_MIN_HEIGHT_INC; rel1 { to: "bg"; relative: 0 0.5; } rel2 { to: "bg"; relative: 1 0.5; } aspect: 1.0 1.0; aspect_preference: VERTICAL; } } part { name: "button_events"; type: RECT; scale: 1; dragable { events: "button"; } description { state: "default" 0.0; color: CHECK_TOGGLE_COLOR_TRANSPARENT; } } part { name: "elm.padding.bar.top"; type: SPACER; scale: 1; description { state: "default" 0.0; min: CHECK_TOGGLE_PADDING_BAR_LEFT_TOP_INC; fixed: 1 1; align: 0 0; rel1.to: "bg"; rel2 { to: "bg"; relative: 0 0; } } } part { name: "elm.padding.bar.bottom"; type: SPACER; scale: 1; description { state: "default" 0.0; min: CHECK_TOGGLE_PADDING_BAR_RIGHT_BOTTOM_INC; fixed: 1 1; align: 1 1; rel1 { to: "bg"; relative: 1 1; } rel2.to: "bg"; } } part { name: "bar_clipper"; type: RECT; mouse_events: 0; scale: 1; description { state: "default" 0.0; color: CHECK_TOGGLE_COLOR_VISIBLE; min: CHECK_TOGGLE_BAR_MIN_HEIGHT_INC; rel1 { to: "elm.padding.bar.top"; relative: 1 1; } rel2 { to: "elm.padding.bar.bottom"; relative: 0 0; } } } part { name: "onrect"; scale: 1; clip_to: "bar_clipper"; mouse_events: 0; description { state: "default" 0.0; rel1 { to: "button"; relative: -2.55 0.0; } rel2 { to: "button"; relative: 0.5 1.0; } image { normal: "/whitetheme/action_slider_guage_on.png"; border: CHECK_TOGGLE_BAR_BORDER_INC; border_scale: 1; } } description { state: "disabled" 0.0; inherit: "default" 0.0; image { normal: "/whitetheme/action_slider_guage_off.png"; border: CHECK_TOGGLE_BAR_BORDER_INC; border_scale: 1; } } } part { name: "offrect"; scale: 1; clip_to: "bar_clipper"; mouse_events: 0; description { state: "default" 0.0; rel1 { to: "button"; relative: 0.5 0.0; } rel2 { to: "button"; relative: 3.55 1.0; } image { normal: "/whitetheme/action_slider_guage_off.png"; border: CHECK_TOGGLE_BAR_BORDER_INC; border_scale: 1; } } description { state: "disabled" 0.0; inherit: "default" 0.0; image { normal: "/whitetheme/action_slider_guage_off.png"; border: CHECK_TOGGLE_BAR_BORDER_INC; border_scale: 1; } } } part { name: "elm.padding.text.off"; type: SPACER; scale: 1; description { state: "default" 0.0; min: CHECK_TOGGLE_PADDING_TEXT_OFF_MIN_INC; fixed: 1 0; align: 0 0.5; rel1 { to: "button"; relative: 1 0; } rel2 { to: "button"; relative: 1 1; } } } part { name: "elm.offtext"; type: TEXT; effect: SHADOW TOP; mouse_events: 0; scale: 1; clip_to: "bar_clipper"; description { state: "default" 0.0; align: 0.5 0.5; color: CHECK_TOGGLE_TEXT_OFF_COLOR_INC; color2: CHECK_TOGGLE_TEXT_OFF_SHADOW_COLOR_INC; rel1 { to: "button"; relative: 1 0; } rel2.to: "offrect"; text { font: "SLP:style=Bold"; size: CHECK_TOGGLE_TEXT_SIZE_INC; min: 0 1; text: "OFF"; text_class: "slp_bold"; } } description { state: "disabled" 0.0; inherit: "default" 0.0; color: CHECK_TOGGLE_TEXT_DISABLE_COLOR_INC; } } part { name: "elm.padding.text.on"; type: SPACER; scale: 1; description { state: "default" 0.0; min: CHECK_TOGGLE_PADDING_TEXT_ON_MIN_INC; fixed: 1 0; align: 1 0.5; rel1 { to: "button"; relative: 0 0; } rel2 { to: "button"; relative: 0 1; } } } part { name: "elm.padding.text.on.left"; type: SPACER; scale: 1; description { state: "default" 0.0; min: CHECK_TOGGLE_PADDING_TEXT_ON_MIN_INC; fixed: 1 0; align: 0 0.5; rel1.to: "onrect"; rel2 { to: "onrect"; relative: 0 1; } } } part { name: "elm.ontext"; type: TEXT; effect: SHADOW TOP; mouse_events: 0; scale: 1; clip_to: "bar_clipper"; description { state: "default" 0.0; fixed: 1 1; align: 1.0 0.5; color: CHECK_TOGGLE_TEXT_ON_COLOR_INC; color2: CHECK_TOGGLE_TEXT_ON_SHADOW_COLOR_INC; rel1 { to_x: "elm.padding.text.on.left"; to_y: "onrect"; relative: 1 0; } rel2 { to_x: "button"; to_y: "onrect"; relative: 0 1; } text { font: "SLP:style=Bold"; size: CHECK_TOGGLE_TEXT_SIZE_INC; min: 0 1; text: "ON"; } } description { state: "disabled" 0.0; inherit: "default" 0.0; color: CHECK_TOGGLE_TEXT_DISABLE_COLOR_INC; } } part { name: "conf_over"; mouse_events: 0; scale: 1; description { state: "default" 0.0; rel1.to: "bg"; rel2.to: "bg"; fixed: 1 1; image { normal: "/whitetheme/check_cover.png"; border: CHECK_TOGGLE_BG_BORDER_INC; border_scale: 1; } fill.smooth : 0; } } part { name: "button2"; mouse_events: 0; scale: 1; description { state: "default" 0.0; color: CHECK_TOGGLE_COLOR_VISIBLE; rel1.to: "button"; rel2.to: "button"; image { normal: "/whitetheme/check_btn.png"; } } } part { name: "elm.swallow.content"; type: SWALLOW; scale: 1; description { state: "default" 0.0; fixed: 1 0; visible: 0; align: 0.0 0.5; rel2.relative: 0.0 1.0; } description { state: "visible" 0.0; inherit: "default" 0.0; visible: 1; aspect: 1.0 1.0; } description { state: "disabled" 0.0; inherit: "default" 0.0; color: CHECK_TOGGLE_TEXT_DISABLE_COLOR_INC; } description { state: "disabled_visible" 0.0; inherit: "default" 0.0; color: CHECK_TOGGLE_TEXT_DISABLE_COLOR_INC; visible: 1; aspect: 1.0 1.0; } } part { name: "elm.text"; type: TEXT; mouse_events: 0; scale: 1; description { state: "default" 0.0; visible: 0; fixed: 0 0; rel1 { to_x: "elm.swallow.content"; relative: 1.0 0.0; } rel2 { to_x: "bg"; relative: 0.0 1.0; } color: CHECK_TOGGLE_COLOR_BLACK; text { font: "SLP:style=Medium"; size: CHECK_TOGGLE_OFF_TEXT_SIZE_INC; min: 0 0; align: 0.0 0.5; } } description { state: "visible" 0.0; inherit: "default" 0.0; visible: 1; text.min: 1 1; } description { state: "disabled" 0.0; inherit: "default" 0.0; color: CHECK_TOGGLE_TEXT_DISABLE_COLOR_INC; } description { state: "disabled_visible" 0.0; inherit: "default" 0.0; color: CHECK_TOGGLE_TEXT_DISABLE_COLOR_INC; visible: 1; text.min: 1 1; } } part { name: "disabler"; type: RECT; scale: 1; description { state: "default" 0.0; color: 0 0 0 0; visible: 0; } description { state: "disabled" 0.0; inherit: "default" 0.0; visible: 1; } } } programs { 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", ""); else emit("elm,action,check,on", ""); } } } 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 { name: "drag_end"; signal: "mouse,up,1"; source: "button"; script { new Float:dx, Float:dy; get_drag(PART:"button", dx, dy); 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", ""); } else { emit("elm,action,check,off", ""); } set_int(was_drag, get_int(is_drag)); set_int(is_drag, 0); } } program { name: "check_on"; 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 { name: "check_off"; 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 { name: "text_show"; signal: "elm,state,text,visible"; source: "elm"; action: STATE_SET "visible" 0.0; target: "elm.text"; } program { name: "text_hide"; signal: "elm,state,text,hidden"; source: "elm"; action: STATE_SET "default" 0.0; target: "elm.text"; } program { name: "icon_show"; signal: "elm,state,icon,visible"; source: "elm"; action: STATE_SET "visible" 0.0; target: "elm.swallow.content"; } program { name: "icon_hide"; signal: "elm,state,icon,hidden"; source: "elm"; action: STATE_SET "default" 0.0; target: "elm.swallow.content"; } program { name: "disable"; signal: "elm,state,disabled"; source: "elm"; action: STATE_SET "disabled" 0.0; target: "elm.offtext"; target: "elm.ontext"; target: "onrect"; target: "offrect"; target: "disabler"; after: "disable_text"; } program { name: "disable_text"; script { new st[31]; new Float:vl; get_state(PART:"elm.text", st, 30, vl); if (!strcmp(st, "visible")) set_state(PART:"elm.text", "disabled_visible", 0.0); else set_state(PART:"elm.text", "disabled", 0.0); get_state(PART:"elm.swallow.content", st, 30, vl); if (!strcmp(st, "visible")) set_state(PART:"elm.swallow.content", "disabled_visible", 0.0); else set_state(PART:"elm.swallow.content", "disabled", 0.0); } } program { name: "enable"; signal: "elm,state,enabled"; source: "elm"; action: STATE_SET "default" 0.0; target: "disabler"; target: "onrect"; target: "offrect"; after: "enable_text"; } program { name: "enable_text"; script { new st[31]; new Float:vl; get_state(PART:"elm.text", st, 30, vl); if (!strcmp(st, "disabled_visible")) set_state(PART:"elm.text", "visible", 0.0); else set_state(PART:"elm.text", "default", 0.0); get_state(PART:"elm.swallow.content", st, 30, vl); if (!strcmp(st, "visible")) set_state(PART:"elm.swallow.content", "visible", 0.0); else set_state(PART:"elm.swallow.content", "default", 0.0); } } program { name: "to_rtl"; signal: "edje,state,rtl"; source: "edje"; script { set_int(is_rtl, 1); } } program { name: "to_ltr"; signal: "edje,state,ltr"; source: "edje"; script { set_int(is_rtl, 0); } } } }