jaehyun pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=736de05ea7fde749f0b6f356cb6a2b3acd8e3586
commit 736de05ea7fde749f0b6f356cb6a2b3acd8e3586 Author: YeongJong Lee <[email protected]> Date: Mon Feb 26 20:28:37 2018 +0900 efl.ui.check: change signal name for icon/text Summary: see also 73f8b3b78f0ff92ddfc1c16426bf7c176f10293a Test Plan: 1. elementary_test -to check 2. check that icon is visible Reviewers: cedric, woohyun, Jaehyun_Cho Reviewed By: Jaehyun_Cho Differential Revision: https://phab.enlightenment.org/D5816 --- data/elementary/themes/edc/efl/check.edc | 934 ++++++++++++++++++++++++- src/Makefile_Elementary.am | 1 + src/lib/elementary/efl_ui_check.c | 123 ++-- src/lib/elementary/efl_ui_check.eo | 1 - src/lib/elementary/efl_ui_check_legacy.eo | 3 + src/lib/elementary/efl_ui_check_legacy_part.eo | 8 + 6 files changed, 1027 insertions(+), 43 deletions(-) diff --git a/data/elementary/themes/edc/efl/check.edc b/data/elementary/themes/edc/efl/check.edc index 76db7a8d28..6bcc5cfa78 100644 --- a/data/elementary/themes/edc/efl/check.edc +++ b/data/elementary/themes/edc/efl/check.edc @@ -1,7 +1,937 @@ group { "efl/check"; - inherit: "elm/check/base/default"; + images.image: "inset_shadow_tiny.png" COMP; + images.image: "bevel_in.png" COMP; + images.image: "sym_check_alum.png" COMP; +#define ICON 1 +#define LABEL 2 +#define MASK 3 +#define DISABLE 4 + script { + public btmode; + public eval_mode(m) { + new m1 = m & MASK; + new d = m & DISABLE; + if (m1 == (ICON | LABEL)) { + if (!d) { + set_state(PART:"elm.swallow.content", "visible", 0.0); + set_state(PART:"sizer.content", "visible", 0.0); + set_state(PART:"elm.text", "visible", 0.0); + set_state(PART:"shadow", "default", 0.0); + set_state(PART:"base", "default", 0.0); + set_state(PART:"clip", "default", 0.0); + set_state(PART:"event", "default", 0.0); + } else { + set_state(PART:"elm.swallow.content", "visible", 0.0); + set_state(PART:"sizer.content", "visible", 0.0); + set_state(PART:"elm.text", "disabled_visible", 0.0); + set_state(PART:"shadow", "disabled", 0.0); + set_state(PART:"base", "disabled", 0.0); + set_state(PART:"clip", "disabled", 0.0); + set_state(PART:"event", "disabled", 0.0); + } + } else if (m1 == (ICON)) { + if (!d) { + set_state(PART:"elm.swallow.content", "visible", 0.0); + set_state(PART:"sizer.content", "icononly", 0.0); + set_state(PART:"elm.text", "default", 0.0); + set_state(PART:"shadow", "default", 0.0); + set_state(PART:"base", "default", 0.0); + set_state(PART:"clip", "default", 0.0); + set_state(PART:"event", "default", 0.0); + } else { + set_state(PART:"elm.swallow.content", "visible", 0.0); + set_state(PART:"sizer.content", "icononly", 0.0); + set_state(PART:"elm.text", "disabled", 0.0); + set_state(PART:"shadow", "disabled", 0.0); + set_state(PART:"base", "disabled", 0.0); + set_state(PART:"clip", "disabled", 0.0); + set_state(PART:"event", "disabled", 0.0); + } + } else if (m1 == (LABEL)) { + if (!d) { + set_state(PART:"elm.swallow.content", "default", 0.0); + set_state(PART:"sizer.content", "default", 0.0); + set_state(PART:"elm.text", "visible", 0.0); + set_state(PART:"shadow", "default", 0.0); + set_state(PART:"base", "default", 0.0); + set_state(PART:"clip", "default", 0.0); + set_state(PART:"event", "default", 0.0); + } else { + set_state(PART:"elm.swallow.content", "default", 0.0); + set_state(PART:"sizer.content", "default", 0.0); + set_state(PART:"elm.text", "disabled_visible", 0.0); + set_state(PART:"shadow", "disabled", 0.0); + set_state(PART:"base", "disabled", 0.0); + set_state(PART:"clip", "disabled", 0.0); + set_state(PART:"event", "disabled", 0.0); + } + } else { + if (!d) { + set_state(PART:"elm.swallow.content", "default", 0.0); + set_state(PART:"sizer.content", "default", 0.0); + set_state(PART:"elm.text", "default", 0.0); + set_state(PART:"shadow", "default", 0.0); + set_state(PART:"base", "default", 0.0); + set_state(PART:"clip", "default", 0.0); + set_state(PART:"event", "default", 0.0); + } else { + set_state(PART:"elm.swallow.content", "default", 0.0); + set_state(PART:"sizer.content", "default", 0.0); + set_state(PART:"elm.text", "default", 0.0); + set_state(PART:"shadow", "disabled", 0.0); + set_state(PART:"base", "disabled", 0.0); + set_state(PART:"clip", "disabled", 0.0); + set_state(PART:"event", "disabled", 0.0); + } + } + } + } + parts { + part { name: "base"; type: RECT; + description { state: "default" 0.0; + rel1.offset: 1 1; + rel1.to: "inset"; + rel2.offset: -2 -2; + rel2.to: "inset"; + color: 24 24 24 255; + } + description { state: "disabled" 0.0; + inherit: "default" 0.0; + color: 64 64 64 255; + } + } + part { name: "shadow"; mouse_events: 0; + description { state: "default" 0.0; + image.normal: "inset_shadow_tiny.png"; + image.border: 4 4 4 4; + rel1.to: "base"; + rel2.to: "base"; + } + description { state: "disabled" 0.0; + inherit: "default" 0.0; + visible: 0; + } + } + part { name: "inset"; mouse_events: 0; + scale: 1; + description { state: "default" 0.0; + fixed: 1 0; + rel1.offset: 2 2; + rel2.relative: 0.0 1.0; + rel2.offset: 2 -3; + align: 0.0 0.5; + min: 13 13; + max: 13 13; + image.normal: "bevel_in.png"; + image.border: 1 1 1 1; + image.middle: 0; + fill.smooth: 0; + } + } + part { name: "indicator"; mouse_events: 0; + scale: 1; + clip_to: "clip"; + description { state: "default" 0.0; + fixed: 1 1; + rel1.to: "base"; + rel2.to: "base"; + image.normal: "sym_check_alum.png"; + min: 11 11; + max: 11 11; + visible: 0; + } + description { state: "selected" 0.0; + inherit: "default" 0.0; + visible: 1; + } + } + part { name: "clip"; type: RECT; + description { state: "default" 0.0; + } + description { state: "disabled" 0.0; + inherit: "default" 0.0; + color: 255 255 255 64; + } + } + part { name: "elm.swallow.content"; type: SWALLOW; + scale: 1; + clip_to: "clip"; + required; + description { state: "default" 0.0; + fixed: 1 0; + visible: 0; + align: 0.0 0.5; + max: 0 0; + rel1.to_x: "inset"; + rel1.relative: 1.0 0.0; + rel1.offset: 1 1; + rel2.to_x: "inset"; + rel2.offset: 1 -2; + rel2.relative: 1.0 1.0; + } + description { state: "visible" 0.0; + inherit: "default" 0.0; + visible: 1; + aspect: 1.0 1.0; + min: 16 16; + } + } + part { name: "sizer.content"; type: TEXT; mouse_events: 0; + scale: 1; + description { state: "default" 0.0; + fixed: 1 1; + visible: 0; + text { font: FN; size: 10; + min: 0 0; + text_class: "check_text"; + } + } + description { state: "visible" 0.0; + inherit: "default" 0.0; + rel1.to: "elm.swallow.content"; + rel2.to: "elm.swallow.content"; + text { + min: 1 1; + ellipsis: -1; + text: "M"; + } + } + description { state: "icononly" 0.0; + inherit: "default" 0.0; + rel1.to: "elm.swallow.content"; + rel2.to: "elm.swallow.content"; + text { + min: 1 1; + ellipsis: -1; + text: "M"; + } + } + } + part { name: "elm.text"; type: TEXT; mouse_events: 0; + effect: SHADOW BOTTOM; + scale: 1; + required; + description { state: "default" 0.0; + rel1.offset: 2 2; + rel1.to_x: "elm.swallow.content"; + rel1.relative: 1.0 0.0; + rel2.offset: -3 -3; + color: FN_COL_DEFAULT; + color_class: "check_text"; + text { font: FN; size: 10; + min: 0 0; + align: 0.0 0.5; + text_class: "check"; + } + } + description { state: "disabled" 0.0; + inherit: "default" 0.0; + color_class: "check_text_disabled"; + color3: 255 255 255 255; + } + description { state: "visible" 0.0; + inherit: "default" 0.0; + visible: 1; + text.min: 1 1; + text.ellipsis: -1; + } + description { state: "disabled_visible" 0.0; + inherit: "default" 0.0; + color_class: "check_text_disabled"; + color3: 255 255 255 255; + visible: 1; + text.min: 1 1; + text.ellipsis: -1; + } + } + part { name: "event"; type: RECT; + ignore_flags: ON_HOLD; + description { state: "default" 0.0; + color: 0 0 0 0; + } + description { state: "disabled" 0.0; + inherit: "default" 0.0; + visible: 0; + } + } + } + programs { + program { + signal: "mouse,clicked,1"; source: "event"; + action: SIGNAL_EMIT "elm,action,check,toggle" "elm"; + } + program { + signal: "elm,state,check,on"; source: "elm"; + action: STATE_SET "selected" 0.0; + target: "indicator"; + } + program { + signal: "elm,state,check,off"; source: "elm"; + action: STATE_SET "default" 0.0; + target: "indicator"; + } + program { + signal: "elm,state,elm.text,set"; source: "elm"; + script { + new m = get_int(btmode); + m |= LABEL; set_int(btmode, m); + eval_mode(m); + } + } + program { + signal: "elm,state,elm.text,unset"; source: "elm"; + script { + new m = get_int(btmode); + m &= ~LABEL; set_int(btmode, m); + eval_mode(m); + } + } + program { + signal: "elm,state,content,set"; source: "elm"; + script { + new m = get_int(btmode); + m |= ICON; set_int(btmode, m); + eval_mode(m); + } + } + program { + signal: "elm,state,content,unset"; source: "elm"; + script { + new m = get_int(btmode); + m &= ~ICON; set_int(btmode, m); + eval_mode(m); + } + } + program { + signal: "elm,state,disabled"; source: "elm"; + script { + new m = get_int(btmode); + m |= DISABLE; set_int(btmode, m); + eval_mode(m); + } + } + program { + signal: "elm,state,enabled"; source: "elm"; + script { + new m = get_int(btmode); + m &= ~DISABLE; set_int(btmode, m); + eval_mode(m); + } + } + } +#undef ICON +#undef LABEL +#undef MASK +#undef DISABLE } group { "efl/check:toggle"; - inherit: "elm/check/base/toggle"; + images.image: "inset_shadow_tiny.png" COMP; + images.image: "bevel_in.png" COMP; + images.image: "bevel_out.png" COMP; + images.image: "vgrad_med_lighter.png" COMP; + images.image: "shadow_square_tiny.png" COMP; + images.image: "glow_small.png" COMP; + +#define ICON 1 +#define LABEL 2 +#define MASK 3 +#define DISABLE 4 + script { + public is_rtl; + public is_drag; + public was_drag; + public btmode; + public eval_mode(m) { + new m1 = m & MASK; + new d = m & DISABLE; + if (m1 == (ICON | LABEL)) { + if (!d) { + set_state(PART:"elm.swallow.content", "visible", 0.0); + set_state(PART:"sizer.content", "visible", 0.0); + set_state(PART:"elm.text", "visible", 0.0); + set_state(PART:"shadow", "default", 0.0); + set_state(PART:"clip", "default", 0.0); + set_state(PART:"event", "default", 0.0); + set_state(PART:"event2", "default", 0.0); + set_state(PART:"elm.ontext", "default", 0.0); + set_state(PART:"elm.offtext", "default", 0.0); + set_state(PART:"onrect", "default", 0.0); + set_state(PART:"offrect", "default", 0.0); + } else { + set_state(PART:"elm.swallow.content", "visible", 0.0); + set_state(PART:"sizer.content", "visible", 0.0); + set_state(PART:"elm.text", "disabled_visible", 0.0); + set_state(PART:"shadow", "disabled", 0.0); + set_state(PART:"clip", "disabled", 0.0); + set_state(PART:"event", "disabled", 0.0); + set_state(PART:"event2", "disabled", 0.0); + set_state(PART:"elm.ontext", "disabled", 0.0); + set_state(PART:"elm.offtext", "disabled", 0.0); + set_state(PART:"onrect", "disabled", 0.0); + set_state(PART:"offrect", "disabled", 0.0); + } + } else if (m1 == (ICON)) { + if (!d) { + set_state(PART:"elm.swallow.content", "visible", 0.0); + set_state(PART:"sizer.content", "icononly", 0.0); + set_state(PART:"elm.text", "default", 0.0); + set_state(PART:"shadow", "default", 0.0); + set_state(PART:"clip", "default", 0.0); + set_state(PART:"event", "default", 0.0); + set_state(PART:"event2", "default", 0.0); + set_state(PART:"elm.ontext", "default", 0.0); + set_state(PART:"elm.offtext", "default", 0.0); + set_state(PART:"onrect", "default", 0.0); + set_state(PART:"offrect", "default", 0.0); + } else { + set_state(PART:"elm.swallow.content", "visible", 0.0); + set_state(PART:"sizer.content", "icononly", 0.0); + set_state(PART:"elm.text", "disabled", 0.0); + set_state(PART:"shadow", "disabled", 0.0); + set_state(PART:"clip", "disabled", 0.0); + set_state(PART:"event", "disabled", 0.0); + set_state(PART:"event2", "disabled", 0.0); + set_state(PART:"elm.ontext", "disabled", 0.0); + set_state(PART:"elm.offtext", "disabled", 0.0); + set_state(PART:"onrect", "disabled", 0.0); + set_state(PART:"offrect", "disabled", 0.0); + } + } else if (m1 == (LABEL)) { + if (!d) { + set_state(PART:"elm.swallow.content", "default", 0.0); + set_state(PART:"sizer.content", "default", 0.0); + set_state(PART:"elm.text", "visible", 0.0); + set_state(PART:"shadow", "default", 0.0); + set_state(PART:"clip", "default", 0.0); + set_state(PART:"event", "default", 0.0); + set_state(PART:"event2", "default", 0.0); + set_state(PART:"elm.ontext", "default", 0.0); + set_state(PART:"elm.offtext", "default", 0.0); + set_state(PART:"onrect", "default", 0.0); + set_state(PART:"offrect", "default", 0.0); + } else { + set_state(PART:"elm.swallow.content", "default", 0.0); + set_state(PART:"sizer.content", "default", 0.0); + set_state(PART:"elm.text", "disabled_visible", 0.0); + set_state(PART:"shadow", "disabled", 0.0); + set_state(PART:"clip", "disabled", 0.0); + set_state(PART:"event", "disabled", 0.0); + set_state(PART:"event2", "disabled", 0.0); + set_state(PART:"elm.ontext", "disabled", 0.0); + set_state(PART:"elm.offtext", "disabled", 0.0); + set_state(PART:"onrect", "disabled", 0.0); + set_state(PART:"offrect", "disabled", 0.0); + } + } else { + if (!d) { + set_state(PART:"elm.swallow.content", "default", 0.0); + set_state(PART:"sizer.content", "default", 0.0); + set_state(PART:"elm.text", "default", 0.0); + set_state(PART:"shadow", "default", 0.0); + set_state(PART:"clip", "default", 0.0); + set_state(PART:"event", "default", 0.0); + set_state(PART:"event2", "default", 0.0); + set_state(PART:"elm.ontext", "default", 0.0); + set_state(PART:"elm.offtext", "default", 0.0); + set_state(PART:"onrect", "default", 0.0); + set_state(PART:"offrect", "default", 0.0); + } else { + set_state(PART:"elm.swallow.content", "default", 0.0); + set_state(PART:"sizer.content", "default", 0.0); + set_state(PART:"elm.text", "default", 0.0); + set_state(PART:"shadow", "disabled", 0.0); + set_state(PART:"clip", "disabled", 0.0); + set_state(PART:"event", "disabled", 0.0); + set_state(PART:"event2", "disabled", 0.0); + set_state(PART:"elm.ontext", "disabled", 0.0); + set_state(PART:"elm.offtext", "disabled", 0.0); + set_state(PART:"onrect", "disabled", 0.0); + set_state(PART:"offrect", "disabled", 0.0); + } + } + } + } + parts { + part { name: "tog"; type: SPACER; + scale: 1; + description { state: "default" 0.0; + fixed: 1 0; + rel1.relative: 1.0 0.0; + rel1.offset: 2 2; + rel2.offset: -3 -3; + align: 1.0 0.5; + min: 88 15; + max: 88 15; + } + } + part { name: "onrect"; type: RECT; mouse_events: 0; + scale: 1; + clip_to: "tog_clip"; + description { state: "default" 0.0; + rel1.to: "button"; + rel1.relative: -5.0 0.0; + rel2.to: "button"; + rel2.relative: 0.5 1.0; + color: 24 24 24 255; + } + description { state: "disabled" 0.0; + inherit: "default" 0.0; + color: 64 64 64 255; + } + } + part { name: "offrect"; type: RECT; mouse_events: 0; + scale: 1; + clip_to: "tog_clip"; + description { state: "default" 0.0; + rel1.to: "button"; + rel1.relative: 0.5 0.0; + rel2.to: "button"; + rel2.relative: 6.0 1.0; + color: 24 24 24 255; + } + description { state: "disabled" 0.0; + inherit: "default" 0.0; + color: 64 64 64 255; + } + } + part { name: "elm.offtext"; type: TEXT; mouse_events: 0; + effect: SHADOW BOTTOM; + scale: 1; + clip_to: "tog_clip"; + description { state: "default" 0.0; + fixed: 1 1; + rel1.to: "button"; + rel1.relative: 1.0 0.0; + rel2.to: "offrect"; + color: FN_COL_DEFAULT; + color_class: "check_off_text"; + 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_class: "check_off_text_disabled"; + color3: 255 255 255 255; + } + } + part { name: "elm.ontext"; type: TEXT; mouse_events: 0; + effect: GLOW; + scale: 1; + clip_to: "tog_clip"; + description { state: "default" 0.0; + fixed: 1 1; + rel1.to: "onrect"; + rel1.offset: 2 -1; + rel2.to: "button"; + rel2.relative: 0.0 1.0; + rel2.offset: -1 -2; + color_class: "check_on_text"; + color2: 255 255 255 255; + color3: 255 255 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_class: "check_on_text_disabled"; + color3: 255 255 255 255; + } + } + part { name: "shadow"; mouse_events: 0; + description { state: "default" 0.0; + image.normal: "inset_shadow_tiny.png"; + image.border: 4 4 4 4; + rel1.to: "tog"; + rel2.to: "tog"; + } + description { state: "disabled" 0.0; + inherit: "default" 0.0; + visible: 0; + } + } + part { name: "inset"; mouse_events: 0; + scale: 1; + description { state: "default" 0.0; + fixed: 1 1; + rel1.to: "tog"; + rel1.offset: -1 -1; + rel2.to: "tog"; + rel2.offset: 0 0; + image.normal: "bevel_in.png"; + image.border: 1 1 1 1; + image.middle: 0; + fill.smooth: 0; + } + } + part { name: "tog_clip"; type: RECT; + description { state: "default" 0.0; + rel1.to: "tog"; + rel2.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; + rel1.to: "tog"; + rel2.to: "tog"; + min: 15 15; + max: 15 99999; + color: 0 0 0 0; + } + } + part { name: "shadow_but"; mouse_events: 0; + description { state: "default" 0.0; + rel1.offset: -3 -2; + rel1.to: "base_but"; + rel2.offset: 2 4; + rel2.to: "base_but"; + image.normal: "shadow_square_tiny.png"; + image.border: 6 6 6 6; + fill.smooth: 0; + } + description { state: "clicked" 0.0; + inherit: "default" 0.0; + rel1.offset: -2 -2; + rel2.offset: 1 1; + color: 255 255 255 128; + } + } + part { name: "glow_but"; mouse_events: 0; + description { state: "default" 0.0; + rel1.offset: -3 -3; + rel1.to: "base_but"; + rel2.offset: 2 2; + rel2.to: "base_but"; + image.normal: "glow_small.png"; + image.border: 7 7 7 7; + fill.smooth: 0; + visible: 0; + } + description { state: "clicked" 0.0; + inherit: "default" 0.0; + visible: 1; + } + } + part { name: "base_but"; mouse_events: 0; + description { state: "default" 0.0; + rel1.to: "button"; + rel2.to: "button"; + image.normal: "vgrad_med_lighter.png"; + fill.smooth: 0; + TILED_HORIZ(120) + } + } + part { name: "bevel_but"; mouse_events: 0; + description { state: "default" 0.0; + rel1.to: "base_but"; + rel2.to: "base_but"; + image.normal: "bevel_out.png"; + image.border: 1 1 1 1; + image.middle: 0; + fill.smooth: 0; + } + } + part { name: "button_events"; type: RECT; + dragable.events: "button"; + description { state: "default" 0.0; + color: 0 0 0 0; + } + } + part { name: "clip"; type: RECT; + description { state: "default" 0.0; + } + description { state: "disabled" 0.0; + inherit: "default" 0.0; + color: 255 255 255 64; + } + } + part { name: "elm.swallow.content"; type: SWALLOW; + scale: 1; + clip_to: "clip"; + description { state: "default" 0.0; + fixed: 1 0; + visible: 0; + align: 0.0 0.5; + max: 0 0; + rel1.offset: 1 1; + rel2.offset: 1 -2; + rel2.relative: 0.0 1.0; + } + description { state: "visible" 0.0; + inherit: "default" 0.0; + fixed: 0 0; + visible: 1; + min: 16 16; + } + } + part { name: "sizer.content"; type: TEXT; mouse_events: 0; + scale: 1; + description { state: "default" 0.0; + fixed: 1 1; + visible: 0; + text { font: FN; size: 10; + min: 0 0; + text_class: "check_text"; + } + } + description { state: "visible" 0.0; + inherit: "default" 0.0; + rel1.to: "elm.swallow.content"; + rel2.to: "elm.swallow.content"; + text { + min: 1 1; + ellipsis: -1; + text: "M"; + } + } + description { state: "icononly" 0.0; + inherit: "default" 0.0; + rel1.to: "elm.swallow.content"; + rel2.to: "elm.swallow.content"; + text { + min: 1 1; + ellipsis: -1; + text: "M"; + } + } + } + part { name: "elm.text"; type: TEXT; mouse_events: 0; + effect: SHADOW BOTTOM; + scale: 1; + description { state: "default" 0.0; + rel1.to_x: "elm.swallow.content"; + rel1.relative: 1.0 0.0; + rel1.offset: 2 2; + rel2.to_x: "tog"; + rel2.relative: 0.0 1.0; + rel2.offset: -5 -3; + color: FN_COL_DEFAULT; + color_class: "check_text"; + text { font: FN; size: 10; + min: 0 0; + align: 0.0 0.5; + text_class: "check"; + } + } + description { state: "disabled" 0.0; + inherit: "default" 0.0; + color_class: "check_text_disabled"; + color3: 255 255 255 255; + } + description { state: "visible" 0.0; + inherit: "default" 0.0; + visible: 1; + text.min: 1 1; + text.ellipsis: -1; + } + description { state: "disabled_visible" 0.0; + inherit: "default" 0.0; + color_class: "check_text_disabled"; + color3: 255 255 255 255; + visible: 1; + text.min: 1 1; + text.ellipsis: -1; + } + } + part { name: "event"; type: RECT; + ignore_flags: ON_HOLD; + description { state: "default" 0.0; + color: 0 0 0 0; + rel1.to_x: "elm.swallow.content"; + rel2.to_x: "elm.text"; + } + description { state: "disabled" 0.0; + inherit: "default" 0.0; + visible: 0; + } + } + part { name: "event2"; type: RECT; + ignore_flags: ON_HOLD; + 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: "event"; + action: SIGNAL_EMIT "elm,action,check,toggle" "elm"; + } + 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 { name: "drag_end"; + 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: "shadow_but"; + target: "glow_but"; + } + program { + signal: "mouse,up,1"; source: "button"; + action: STATE_SET "default" 0.0; + target: "shadow_but"; + target: "glow_but"; + } + program { + signal: "elm,state,elm.text,set"; source: "elm"; + script { + new m = get_int(btmode); + m |= LABEL; set_int(btmode, m); + eval_mode(m); + } + } + program { + signal: "elm,state,elm.text,unset"; source: "elm"; + script { + new m = get_int(btmode); + m &= ~LABEL; set_int(btmode, m); + eval_mode(m); + } + } + program { + signal: "elm,state,content,set"; source: "elm"; + script { + new m = get_int(btmode); + m |= ICON; set_int(btmode, m); + eval_mode(m); + } + } + program { + signal: "elm,state,content,unset"; source: "elm"; + script { + new m = get_int(btmode); + m &= ~ICON; set_int(btmode, m); + eval_mode(m); + } + } + program { + signal: "elm,state,disabled"; source: "elm"; + script { + new m = get_int(btmode); + m |= DISABLE; set_int(btmode, m); + eval_mode(m); + } + } + program { + signal: "elm,state,enabled"; source: "elm"; + script { + new m = get_int(btmode); + m &= ~DISABLE; set_int(btmode, m); + eval_mode(m); + } + } + 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); + } + } + } +#undef ICON +#undef LABEL +#undef MASK +#undef DISABLE } diff --git a/src/Makefile_Elementary.am b/src/Makefile_Elementary.am index 8cdc38478b..27cab7b3ae 100644 --- a/src/Makefile_Elementary.am +++ b/src/Makefile_Elementary.am @@ -108,6 +108,7 @@ elm_public_eolian_files += \ lib/elementary/efl_ui_legacy.eo \ lib/elementary/efl_ui_button_legacy_part.eo \ lib/elementary/efl_ui_radio_legacy_part.eo \ + lib/elementary/efl_ui_check_legacy_part.eo \ lib/elementary/elm_spinner.eo \ lib/elementary/elm_multibuttonentry_item.eo \ lib/elementary/elm_interface_scrollable.eo \ diff --git a/src/lib/elementary/efl_ui_check.c b/src/lib/elementary/efl_ui_check.c index a4cce48c46..168ab6304e 100644 --- a/src/lib/elementary/efl_ui_check.c +++ b/src/lib/elementary/efl_ui_check.c @@ -12,6 +12,7 @@ #include "efl_ui_nstate.eo.h" #include "efl_ui_check_private.h" #include "efl_ui_nstate_private.h" +#include "elm_part_helper.h" #define MY_CLASS EFL_UI_CHECK_CLASS #define MY_CLASS_PFX efl_ui_check @@ -84,23 +85,6 @@ _activate(Evas_Object *obj) efl_ui_nstate_value_get(obj)); } -/* FIXME: replicated from elm_layout just because check's icon spot - * is elm.swallow.content, not elm.swallow.icon. Fix that whenever we - * can changed the theme API */ -static void -_icon_signal_emit(Evas_Object *obj) -{ - ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd); - char buf[64]; - - if (!elm_widget_resize_object_get(obj)) return; - snprintf(buf, sizeof(buf), "elm,state,icon,%s", - elm_layout_content_get(obj, "icon") ? "visible" : "hidden"); - - elm_layout_signal_emit(obj, buf, "elm"); - edje_object_message_signal_process(wd->resize_obj); -} - EOLIAN static Efl_Access_State_Set _efl_ui_check_efl_access_state_set_get(Eo *obj, Efl_Ui_Check_Data *_pd EINA_UNUSED) { @@ -114,24 +98,6 @@ _efl_ui_check_efl_access_state_set_get(Eo *obj, Efl_Ui_Check_Data *_pd EINA_UNUS return states; } -/* FIXME: replicated from elm_layout just because check's icon spot - * is elm.swallow.content, not elm.swallow.icon. Fix that whenever we - * can changed the theme API */ -EOLIAN static Eina_Bool -_efl_ui_check_efl_ui_widget_widget_sub_object_del(Eo *obj, Efl_Ui_Check_Data *_pd EINA_UNUSED, Evas_Object *sobj) -{ - Eina_Bool int_ret = EINA_FALSE; - - int_ret = elm_widget_sub_object_del(efl_super(obj, MY_CLASS), sobj); - if (!int_ret) return EINA_FALSE; - - _icon_signal_emit(obj); - - elm_layout_sizing_eval(obj); - - return EINA_TRUE; -} - EOLIAN static Eina_Bool _efl_ui_check_efl_ui_widget_on_access_activate(Eo *obj EINA_UNUSED, Efl_Ui_Check_Data *_pd EINA_UNUSED, Efl_Ui_Activate act) { @@ -168,11 +134,6 @@ _efl_ui_check_efl_ui_widget_theme_apply(Eo *obj, Efl_Ui_Check_Data *sd EINA_UNUS edje_object_message_signal_process(wd->resize_obj); - /* FIXME: replicated from elm_layout just because check's icon spot - * is elm.swallow.content, not elm.swallow.icon. Fix that whenever - * we can changed the theme API */ - _icon_signal_emit(obj); - elm_layout_sizing_eval(obj); return int_ret; @@ -413,6 +374,7 @@ ELM_LAYOUT_TEXT_ALIASES_IMPLEMENT(MY_CLASS_PFX) #include "efl_ui_check.eo.c" #include "efl_ui_check_legacy.eo.h" +#include "efl_ui_check_legacy_part.eo.h" #define MY_CLASS_NAME_LEGACY "elm_check" @@ -430,6 +392,87 @@ _efl_ui_check_legacy_efl_object_constructor(Eo *obj, void *pd EINA_UNUSED) return obj; } +/* FIXME: replicated from elm_layout just because check's icon spot + * is elm.swallow.content, not elm.swallow.icon. Fix that whenever we + * can changed the theme API */ +static void +_icon_signal_emit(Evas_Object *obj) +{ + ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd); + char buf[64]; + + if (!elm_widget_resize_object_get(obj)) return; + snprintf(buf, sizeof(buf), "elm,state,icon,%s", + elm_layout_content_get(obj, "icon") ? "visible" : "hidden"); + + elm_layout_signal_emit(obj, buf, "elm"); + edje_object_message_signal_process(wd->resize_obj); + + elm_layout_sizing_eval(obj); +} + +/* FIXME: replicated from elm_layout just because check's icon spot + * is elm.swallow.content, not elm.swallow.icon. Fix that whenever we + * can changed the theme API */ +EOLIAN static Efl_Ui_Theme_Apply +_efl_ui_check_legacy_efl_ui_widget_theme_apply(Eo *obj, void *_pd EINA_UNUSED) +{ + Efl_Ui_Theme_Apply int_ret = EFL_UI_THEME_APPLY_FAILED; + + int_ret = efl_ui_widget_theme_apply(efl_super(obj, EFL_UI_CHECK_LEGACY_CLASS)); + if (!int_ret) return EFL_UI_THEME_APPLY_FAILED; + + _icon_signal_emit(obj); + + return int_ret; +} + +/* FIXME: replicated from elm_layout just because check's icon spot + * is elm.swallow.content, not elm.swallow.icon. Fix that whenever we + * can changed the theme API */ +EOLIAN static Eina_Bool +_efl_ui_check_legacy_efl_ui_widget_widget_sub_object_del(Eo *obj, void *_pd EINA_UNUSED, Evas_Object *sobj) +{ + Eina_Bool int_ret = EINA_FALSE; + + int_ret = elm_widget_sub_object_del(efl_super(obj, EFL_UI_CHECK_LEGACY_CLASS), sobj); + if (!int_ret) return EINA_FALSE; + + _icon_signal_emit(obj); + + return EINA_TRUE; +} + +/* FIXME: replicated from elm_layout just because check's icon spot + * is elm.swallow.content, not elm.swallow.icon. Fix that whenever we + * can changed the theme API */ +static Eina_Bool +_efl_ui_check_legacy_content_set(Eo *obj, void *_pd EINA_UNUSED, const char *part, Evas_Object *content) +{ + Eina_Bool int_ret = EINA_FALSE; + + int_ret = efl_content_set(efl_part(efl_super(obj, EFL_UI_CHECK_LEGACY_CLASS), part), content); + if (!int_ret) return EINA_FALSE; + + _icon_signal_emit(obj); + + return EINA_TRUE; +} + +/* Efl.Part begin */ + +static Eina_Bool +_part_is_efl_ui_check_legacy_part(const Eo *obj EINA_UNUSED, const char *part) +{ + return eina_streq(part, "elm.swallow.content"); +} + +ELM_PART_OVERRIDE_PARTIAL(efl_ui_check_legacy, EFL_UI_CHECK_LEGACY, void, _part_is_efl_ui_check_legacy_part) +ELM_PART_OVERRIDE_CONTENT_SET(efl_ui_check_legacy, EFL_UI_CHECK_LEGACY, void) +#include "efl_ui_check_legacy_part.eo.c" + +/* Efl.Part end */ + EAPI Evas_Object * elm_check_add(Evas_Object *parent) { diff --git a/src/lib/elementary/efl_ui_check.eo b/src/lib/elementary/efl_ui_check.eo index 508d3fa7a7..5784fc9409 100644 --- a/src/lib/elementary/efl_ui_check.eo +++ b/src/lib/elementary/efl_ui_check.eo @@ -24,7 +24,6 @@ class Efl.Ui.Check (Efl.Ui.Nstate, Efl.Access.Widget.Action) Efl.Object.constructor; Efl.Ui.Widget.on_access_activate; Efl.Ui.Widget.theme_apply; - Efl.Ui.Widget.widget_sub_object_del; Efl.Ui.Widget.widget_event; Efl.Ui.Nstate.count { set; } Efl.Ui.Nstate.value { set; } diff --git a/src/lib/elementary/efl_ui_check_legacy.eo b/src/lib/elementary/efl_ui_check_legacy.eo index b140077a5a..781e8b9f10 100644 --- a/src/lib/elementary/efl_ui_check_legacy.eo +++ b/src/lib/elementary/efl_ui_check_legacy.eo @@ -11,5 +11,8 @@ class Efl.Ui.Check_Legacy (Efl.Ui.Check, Efl.Ui.Legacy) implements { class.constructor; Efl.Object.constructor; + Efl.Ui.Widget.theme_apply; + Efl.Ui.Widget.widget_sub_object_del; + Efl.Part.part; } } diff --git a/src/lib/elementary/efl_ui_check_legacy_part.eo b/src/lib/elementary/efl_ui_check_legacy_part.eo new file mode 100644 index 0000000000..5abfae7010 --- /dev/null +++ b/src/lib/elementary/efl_ui_check_legacy_part.eo @@ -0,0 +1,8 @@ +class Efl.Ui.Check_Legacy.Part (Efl.Ui.Layout.Part_Content) +{ + [[Elementary check internal part class]] + data: null; + implements { + Efl.Content.content { set; } + } +} --
