aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeeyong Um <conr2d@gmail.com>2017-04-19 10:41:08 -0700
committerCedric BAIL <cedric@osg.samsung.com>2017-04-19 10:49:21 -0700
commitc8ca766a49de425d42e93a30d1c432e9ee9f90cd (patch)
tree467a94bcff26bfa19a9b20d2d6e8024bcd147414
parentedje_pick: fix a couple spelling errors (diff)
downloadefl-c8ca766a49de425d42e93a30d1c432e9ee9f90cd.tar.gz
elm.hoversel: highlight selected item when auto update is enabled
Summary: When auto update is enabled, the label of the hoversel will be that of selected item. This feature is usually used when changing state of something. Highlighting item previous selected will show what is current state more explicitly especailly hoversel has many items. Test Plan: elementary_test -to hoversel Reviewers: cedric, jpeg Differential Revision: https://phab.enlightenment.org/D4799 Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
-rw-r--r--data/elementary/themes/edc/elm/button.edc44
-rw-r--r--src/lib/elementary/elc_hoversel.c11
2 files changed, 44 insertions, 11 deletions
diff --git a/data/elementary/themes/edc/elm/button.edc b/data/elementary/themes/edc/elm/button.edc
index 052893110f..a05260f4e3 100644
--- a/data/elementary/themes/edc/elm/button.edc
+++ b/data/elementary/themes/edc/elm/button.edc
@@ -1032,6 +1032,7 @@ group { name: "elm/button/base/hoversel_vertical_entry/default";
#define DISABLE 4
script {
public btmode;
+ public is_selected;
public eval_mode(m) {
new m1 = m & MASK;
new d = m & DISABLE;
@@ -1345,12 +1346,14 @@ group { name: "elm/button/base/hoversel_vertical_entry/default";
after: "button_unclick_anim";
}
program { name: "button_unclick_anim";
- action: STATE_SET "default" 0.0;
- target: "shadow";
- target: "base";
- target: "shine";
- target: "click_clip";
- target: "label3";
+ script {
+ set_state(PART:"shadow", "default", 0.0);
+ set_state(PART:"base", "default", 0.0);
+ set_state(PART:"shine", "default", 0.0);
+ set_state(PART:"click_clip", "default", 0.0);
+ if (!get_int(is_selected))
+ set_state(PART:"label3", "default", 0.0);
+ }
}
program { name: "buttonactivate";
signal: "elm,anim,activate"; source: "elm";
@@ -1365,11 +1368,14 @@ group { name: "elm/button/base/hoversel_vertical_entry/default";
program { name: "button_unpressed_anim";
action: STATE_SET "default" 0.0;
in: 0.5 0.0;
- target: "shadow";
- target: "base";
- target: "shine";
- target: "click_clip";
- target: "label3";
+ script {
+ set_state(PART:"shadow", "default", 0.0);
+ set_state(PART:"base", "default", 0.0);
+ set_state(PART:"shine", "default", 0.0);
+ set_state(PART:"click_clip", "default", 0.0);
+ if (!get_int(is_selected))
+ set_state(PART:"label3", "default", 0.0);
+ }
}
program {
signal: "mouse,clicked,1"; source: "event";
@@ -1424,6 +1430,22 @@ group { name: "elm/button/base/hoversel_vertical_entry/default";
eval_mode(m);
}
}
+ program { "selected";
+ signal: "elm,state,selected";
+ source: "elm";
+ script {
+ set_int(is_selected, 1);
+ set_state(PART:"label3", "clicked", 0.0);
+ }
+ }
+ program { "unselected";
+ signal: "elm,state,unselected";
+ source: "elm";
+ script {
+ set_int(is_selected, 0);
+ set_state(PART:"label3", "default", 0.0);
+ }
+ }
}
#undef ICON
#undef LABEL
diff --git a/src/lib/elementary/elc_hoversel.c b/src/lib/elementary/elc_hoversel.c
index 002bf33b6d..e8b673eabe 100644
--- a/src/lib/elementary/elc_hoversel.c
+++ b/src/lib/elementary/elc_hoversel.c
@@ -151,6 +151,17 @@ _auto_update(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void
if(item->label)
elm_object_text_set(obj2, item->label);
+
+ Eina_List *l;
+ Elm_Object_Item *eo_item;
+
+ EINA_LIST_FOREACH(sd->items, l, eo_item)
+ {
+ if (eo_item == EO_OBJ(item))
+ elm_wdg_item_signal_emit(eo_item, "elm,state,selected", "elm");
+ else
+ elm_wdg_item_signal_emit(eo_item, "elm,state,unselected", "elm");
+ }
}
}