summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJee-Yong Um <jc9.um@samsung.com>2016-01-04 15:17:23 -0800
committerCedric BAIL <cedric@osg.samsung.com>2016-01-04 15:17:26 -0800
commitbc78159ff362e6867abc2a6451af9eb84b093245 (patch)
tree88811fe4f0a21522c6b8e1654fc4559d0001af4e
parentd19f943d8dc94584c529d7b9423de5ee3eb3a211 (diff)
hoversel: auto update hoversel after dismiss animation finished.
Summary: If auto_update feature changes hoversel width, dismiss animation seems awful because hoversel contents move to changed position in an instant. This patch makes hoversel update its content with clicked item after dismiss animation finished. Test Plan: elementary_test hoversel Reviewers: raster, cedric, jpeg Differential Revision: https://phab.enlightenment.org/D3519 Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
-rw-r--r--src/bin/test_hoversel.c3
-rw-r--r--src/lib/elc_hoversel.c27
2 files changed, 21 insertions, 9 deletions
diff --git a/src/bin/test_hoversel.c b/src/bin/test_hoversel.c
index 15d420382..9dceb3f3a 100644
--- a/src/bin/test_hoversel.c
+++ b/src/bin/test_hoversel.c
@@ -107,7 +107,6 @@ _hoversel_selected_cb(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED,
107 const char *txt = elm_object_item_text_get(event_info); 107 const char *txt = elm_object_item_text_get(event_info);
108 108
109 printf("'selected' callback is called. (selected item : %s)\n", txt); 109 printf("'selected' callback is called. (selected item : %s)\n", txt);
110 elm_object_text_set(obj, txt);
111} 110}
112 111
113static void 112static void
@@ -165,6 +164,7 @@ test_hoversel(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_
165 hoversel = elm_hoversel_add(win); 164 hoversel = elm_hoversel_add(win);
166// FIXME: need to add horizontal hoversel theme to default some day 165// FIXME: need to add horizontal hoversel theme to default some day
167// elm_hoversel_horizontal_set(bt, EINA_TRUE); 166// elm_hoversel_horizontal_set(bt, EINA_TRUE);
167 elm_hoversel_auto_update_set(hoversel, EINA_TRUE);
168 elm_hoversel_hover_parent_set(hoversel, win); 168 elm_hoversel_hover_parent_set(hoversel, win);
169 elm_object_text_set(hoversel, "Labels"); 169 elm_object_text_set(hoversel, "Labels");
170 elm_hoversel_item_add(hoversel, "Item 1", NULL, ELM_ICON_NONE, NULL, NULL); 170 elm_hoversel_item_add(hoversel, "Item 1", NULL, ELM_ICON_NONE, NULL, NULL);
@@ -265,6 +265,7 @@ test_hoversel(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_
265 evas_object_show(hoversel); 265 evas_object_show(hoversel);
266 266
267 hoversel = elm_hoversel_add(win); 267 hoversel = elm_hoversel_add(win);
268 elm_hoversel_auto_update_set(hoversel, EINA_TRUE);
268 elm_hoversel_hover_parent_set(hoversel, win); 269 elm_hoversel_hover_parent_set(hoversel, win);
269 elm_object_text_set(hoversel, "Custom Item Style"); 270 elm_object_text_set(hoversel, "Custom Item Style");
270 elm_hoversel_item_add(hoversel, "Item 1", NULL, ELM_ICON_NONE, NULL, NULL); 271 elm_hoversel_item_add(hoversel, "Item 1", NULL, ELM_ICON_NONE, NULL, NULL);
diff --git a/src/lib/elc_hoversel.c b/src/lib/elc_hoversel.c
index 20285c432..51625da76 100644
--- a/src/lib/elc_hoversel.c
+++ b/src/lib/elc_hoversel.c
@@ -121,20 +121,14 @@ _on_hover_clicked(void *data EINA_UNUSED,
121 return EINA_TRUE; 121 return EINA_TRUE;
122} 122}
123 123
124static Eina_Bool 124static void
125_on_item_clicked(void *data EINA_UNUSED, 125_auto_update(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
126 Eo *obj EINA_UNUSED, const Eo_Event_Description *desc EINA_UNUSED,
127 void *event_info EINA_UNUSED)
128{ 126{
129 Elm_Hoversel_Item_Data *item = data; 127 Elm_Hoversel_Item_Data *item = data;
130 Evas_Object *obj2 = WIDGET(item); 128 Evas_Object *obj2 = WIDGET(item);
131 Elm_Object_Item *eo_it = EO_OBJ(item);
132 129
133 ELM_HOVERSEL_DATA_GET(obj2, sd); 130 ELM_HOVERSEL_DATA_GET(obj2, sd);
134 131
135 if (item->func) item->func((void *)WIDGET_ITEM_DATA_GET(eo_it), obj2, eo_it);
136 eo_do(obj2, eo_event_callback_call(EVAS_SELECTABLE_INTERFACE_EVENT_SELECTED, eo_it));
137
138 if (sd->auto_update) 132 if (sd->auto_update)
139 { 133 {
140 Evas_Object *ic; 134 Evas_Object *ic;
@@ -156,6 +150,23 @@ _on_item_clicked(void *data EINA_UNUSED,
156 if(item->label) 150 if(item->label)
157 elm_object_text_set(obj2, item->label); 151 elm_object_text_set(obj2, item->label);
158 } 152 }
153}
154
155static Eina_Bool
156_on_item_clicked(void *data EINA_UNUSED,
157 Eo *obj EINA_UNUSED, const Eo_Event_Description *desc EINA_UNUSED,
158 void *event_info EINA_UNUSED)
159{
160 Elm_Hoversel_Item_Data *item = data;
161 Evas_Object *obj2 = WIDGET(item);
162 Elm_Object_Item *eo_it = EO_OBJ(item);
163
164 ELM_HOVERSEL_DATA_GET(obj2, sd);
165
166 if (item->func) item->func((void *)WIDGET_ITEM_DATA_GET(eo_it), obj2, eo_it);
167 eo_do(obj2, eo_event_callback_call(EVAS_SELECTABLE_INTERFACE_EVENT_SELECTED, eo_it));
168
169 evas_object_event_callback_add(sd->hover, EVAS_CALLBACK_DEL, _auto_update, item);
159 170
160 elm_hoversel_hover_end(obj2); 171 elm_hoversel_hover_end(obj2);
161 172