cedric pushed a commit to branch master. http://git.enlightenment.org/core/elementary.git/commit/?id=4e3e6b8f02d677846aec4106a9fafea61b499f89
commit 4e3e6b8f02d677846aec4106a9fafea61b499f89 Author: woochan lee <[email protected]> Date: Mon Jan 4 14:55:04 2016 -0800 multibuttonentry: add color classes and text classes. Summary: The following new color classes and text classes for multibuttonentry widget are added. "multibuttonentry_bg", "Multibuttonentry Background" "multibuttonentry_item_bg", "Multibuttonentry Item Background" "multibuttonentry_item_bg_selected", "Multibuttonentry Item Selected Background" "multibuttonentry_item_text", "Multibuttonentry Item Text" "multibuttonentry_item_text_pressed", "Multibuttonentry Item Pressed Text" "multibuttonentry_item_text_disabled", "Multibuttonentry Item Disabled Text" @feature Reviewers: raster, cedric, Hermet, kimcinoo, woohyun Subscribers: SanghyeonLee, eagleeye, id213sin Differential Revision: https://phab.enlightenment.org/D3494 Signed-off-by: Cedric BAIL <[email protected]> --- data/themes/colorclasses.edc | 24 +++++++++ data/themes/edc/elm/multibuttonentry.edc | 84 +++++++++++++++++++++++++++----- src/lib/elm_config.c | 9 ++++ 3 files changed, 105 insertions(+), 12 deletions(-) diff --git a/data/themes/colorclasses.edc b/data/themes/colorclasses.edc index a67d445..5d92ec1 100644 --- a/data/themes/colorclasses.edc +++ b/data/themes/colorclasses.edc @@ -324,6 +324,30 @@ color_classes { color: 255 255 255 255; desc: "Color of ctxpopup background"; } + color_class { name: "multibuttonentry_bg"; + color: 0 0 0 0; + desc: "Background of a multibuttonentry widget"; + } + color_class { name: "multibuttonentry_item_bg"; + color: 0 0 0 0; + desc: "Background of a multibuttonentry item object"; + } + color_class { name: "multibuttonentry_item_bg_selected"; + color: 0 0 0 0; + desc: "Background of a selected multibuttonentry item object"; + } + color_class { name: "multibuttonentry_item_text"; + color: FN_COL_DEFAULT; + desc: "Text of a multibuttonentry item"; + } + color_class { name: "multibuttonentry_item_text_pressed"; + color: FN_COL_HIGHLIGHT; + desc: "Text of a pressed multibuttonentry item"; + } + color_class { name: "multibuttonentry_item_text_disabled"; + color: FN_COL_DISABLE; + desc: "Text of a disabled multibuttonentry item"; + } // modules color_class { name: "module_label"; diff --git a/data/themes/edc/elm/multibuttonentry.edc b/data/themes/edc/elm/multibuttonentry.edc index 35eddca..0cca897 100644 --- a/data/themes/edc/elm/multibuttonentry.edc +++ b/data/themes/edc/elm/multibuttonentry.edc @@ -7,7 +7,7 @@ group { name: "elm/multibuttonentry/base/default"; type: RECT; scale: 1; description { state: "default" 0.0; - color: 0 0 0 0; + color_class: "multibuttonentry_bg"; } } part { name: "box.swallow"; type: SWALLOW; @@ -74,7 +74,20 @@ group { name: "elm/multibuttonentry/btn/default"; tag: "tab" "\t"; } } + + script { + public disabled = 0; + } + parts { + part { name: "bg"; type: RECT; + description { state: "default" 0.0; + color_class: "multibuttonentry_item_bg"; + } + description { state: "pressed" 0.0; + color_class: "multibuttonentry_item_bg_selected"; + } + } part { name: "base"; description { state: "default" 0.0; image.normal: "button_normal.png"; @@ -84,7 +97,7 @@ group { name: "elm/multibuttonentry/btn/default"; rel2.offset: 0 1; fill.smooth: 0; } - description { state: "clicked" 0.0; + description { state: "pressed" 0.0; inherit: "default" 0.0; image.normal: "button_clicked.png"; image.border: 5 5 4 6; @@ -141,12 +154,12 @@ group { name: "elm/multibuttonentry/btn/default"; part { name: "elm.btn.text"; type: TEXTBLOCK; mouse_events: 0; scale: 1; description { state: "default" 0.0; - color_class: "multibuttonentry_label"; + color_class: "multibuttonentry_item_text"; text { style: "multibuttonentry_textblock_style"; min: 1 1; ellipsis: -1; - text_class: "multibuttonentry_label"; - } + text_class: "multibuttonentry_item_text"; + } visible: 0; rel1.offset: 5 5; rel1.to: "base"; @@ -159,12 +172,12 @@ group { name: "elm/multibuttonentry/btn/default"; part { name: "text"; type: TEXTBLOCK; mouse_events: 0; scale: 1; description { state: "default" 0.0; - color_class: "multibuttonentry_label"; + color_class: "multibuttonentry_item_text"; text { style: "multibuttonentry_textblock_style"; text_source: "elm.btn.text"; min: 0 1; align: 0.0 0.5; - text_class: "multibuttonentry_label"; + text_class: "multibuttonentry_item_text"; } align: 0.0 0.5; rel1.offset: 5 5; @@ -174,12 +187,30 @@ group { name: "elm/multibuttonentry/btn/default"; rel2.relative: 0.0 1.0; rel2.offset: -3 -7; } + description { state: "pressed" 0.0; + inherit: "default"; + color_class: "multibuttonentry_item_text_pressed"; + text { + text_class: "multibuttonentry_item_text_pressed"; + } + } + description { state: "disabled" 0.0; + inherit: "default"; + color_class: "multibuttonentry_item_text_disabled"; + text { + text_class: "multibuttonentry_item_text_disabled"; + } + } } } programs { program { signal: "mouse,clicked,1"; source: "base"; - action: SIGNAL_EMIT "clicked" "elm"; + script { + if (get_int(disabled) == 0) { + emit("clicked", ""); + } + } } program { signal: "elm,state,default"; source: "elm"; @@ -192,14 +223,43 @@ group { name: "elm/multibuttonentry/btn/default"; target: "glow"; } program { + signal: "elm,state,enabled"; source: "elm"; + script { + set_state(PART:"text", "default", 0.0); + set_int(disabled , 0); + } + } + program { + signal: "elm,state,disabled"; source: "elm"; + script { + new st[31]; + new Float: vl; + get_state(PART:"glow", st, 30, vl); + if (!strcmp(st, "focused")) + set_state(PART:"glow", "default", 0.0); + set_state(PART:"text", "disabled", 0.0); + set_int(disabled , 1); + } + } + program { signal: "mouse,down,1"; source: "base"; - action: STATE_SET "clicked" 0.0; - target: "base"; + script { + if (get_int(disabled) == 0) { + set_state(PART:"base", "pressed", 0.0); + set_state(PART:"bg", "pressed", 0.0); + set_state(PART:"text", "pressed", 0.0); + } + } } program { signal: "mouse,up,1"; source: "base"; - action: STATE_SET "default" 0.0; - target: "base"; + script { + if (get_int(disabled) == 0) { + set_state(PART:"base", "default", 0.0); + set_state(PART:"bg", "default", 0.0); + set_state(PART:"text", "default", 0.0); + } + } } program { signal: "mouse,clicked,1"; source: "del"; diff --git a/src/lib/elm_config.c b/src/lib/elm_config.c index 991ecd2..3496c6c 100644 --- a/src/lib/elm_config.c +++ b/src/lib/elm_config.c @@ -74,6 +74,9 @@ static const Elm_Text_Class _elm_text_classes[] = { {"index_highlight_text," "Index Highlight Text"}, {"index_item_text," "Index Items Text"}, {"index_item_text_selected," "Index Selected Items Text"}, + {"multibuttonentry_item_text", "Multibuttonentry Items"}, + {"multibuttonentry_item_text_pressed", "Multibuttonentry Pressed Items"}, + {"multibuttonentry_item_text_disabled", "Multibuttonentry Disabled Items"}, {"title_bar", "Title Bar"}, {"list_item", "List Items"}, {"grid_item", "Grid Items"}, @@ -142,6 +145,12 @@ static const Elm_Color_Class _elm_color_classes[] = { {"bubble_info", "Bubble Info Text"}, {"menu_item_active", "Menu Item Text"}, {"menu_item_disabled", "Menu Item Disabled Text"}, + {"multibuttonentry_bg", "Multibuttonentry Background"}, + {"multibuttonentry_item_bg", "Multibuttonentry Item Background"}, + {"multibuttonentry_item_bg_selected", "Multibuttonentry Item Selected Background"}, + {"multibuttonentry_item_text", "Multibuttonentry Item Text"}, + {"multibuttonentry_item_text_pressed", "Multibuttonentry Item Pressed Text"}, + {"multibuttonentry_item_text_disabled", "Multibuttonentry Item Disabled Text"}, {"border_title", "Border Title Text"}, {"border_title_active", "Border Title Active Text"}, {"datetime_text", "Datetime Text"}, --
