forked from enlightenment/efl
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>
This commit is contained in:
parent
666bc393eb
commit
9fd9a33b7a
|
@ -107,7 +107,6 @@ _hoversel_selected_cb(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED,
|
|||
const char *txt = elm_object_item_text_get(event_info);
|
||||
|
||||
printf("'selected' callback is called. (selected item : %s)\n", txt);
|
||||
elm_object_text_set(obj, txt);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -165,6 +164,7 @@ test_hoversel(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_
|
|||
hoversel = elm_hoversel_add(win);
|
||||
// FIXME: need to add horizontal hoversel theme to default some day
|
||||
// elm_hoversel_horizontal_set(bt, EINA_TRUE);
|
||||
elm_hoversel_auto_update_set(hoversel, EINA_TRUE);
|
||||
elm_hoversel_hover_parent_set(hoversel, win);
|
||||
elm_object_text_set(hoversel, "Labels");
|
||||
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_
|
|||
evas_object_show(hoversel);
|
||||
|
||||
hoversel = elm_hoversel_add(win);
|
||||
elm_hoversel_auto_update_set(hoversel, EINA_TRUE);
|
||||
elm_hoversel_hover_parent_set(hoversel, win);
|
||||
elm_object_text_set(hoversel, "Custom Item Style");
|
||||
elm_hoversel_item_add(hoversel, "Item 1", NULL, ELM_ICON_NONE, NULL, NULL);
|
||||
|
|
|
@ -121,20 +121,14 @@ _on_hover_clicked(void *data EINA_UNUSED,
|
|||
return EINA_TRUE;
|
||||
}
|
||||
|
||||
static Eina_Bool
|
||||
_on_item_clicked(void *data EINA_UNUSED,
|
||||
Eo *obj EINA_UNUSED, const Eo_Event_Description *desc EINA_UNUSED,
|
||||
void *event_info EINA_UNUSED)
|
||||
static void
|
||||
_auto_update(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
|
||||
{
|
||||
Elm_Hoversel_Item_Data *item = data;
|
||||
Evas_Object *obj2 = WIDGET(item);
|
||||
Elm_Object_Item *eo_it = EO_OBJ(item);
|
||||
|
||||
ELM_HOVERSEL_DATA_GET(obj2, sd);
|
||||
|
||||
if (item->func) item->func((void *)WIDGET_ITEM_DATA_GET(eo_it), obj2, eo_it);
|
||||
eo_do(obj2, eo_event_callback_call(EVAS_SELECTABLE_INTERFACE_EVENT_SELECTED, eo_it));
|
||||
|
||||
if (sd->auto_update)
|
||||
{
|
||||
Evas_Object *ic;
|
||||
|
@ -156,6 +150,23 @@ _on_item_clicked(void *data EINA_UNUSED,
|
|||
if(item->label)
|
||||
elm_object_text_set(obj2, item->label);
|
||||
}
|
||||
}
|
||||
|
||||
static Eina_Bool
|
||||
_on_item_clicked(void *data EINA_UNUSED,
|
||||
Eo *obj EINA_UNUSED, const Eo_Event_Description *desc EINA_UNUSED,
|
||||
void *event_info EINA_UNUSED)
|
||||
{
|
||||
Elm_Hoversel_Item_Data *item = data;
|
||||
Evas_Object *obj2 = WIDGET(item);
|
||||
Elm_Object_Item *eo_it = EO_OBJ(item);
|
||||
|
||||
ELM_HOVERSEL_DATA_GET(obj2, sd);
|
||||
|
||||
if (item->func) item->func((void *)WIDGET_ITEM_DATA_GET(eo_it), obj2, eo_it);
|
||||
eo_do(obj2, eo_event_callback_call(EVAS_SELECTABLE_INTERFACE_EVENT_SELECTED, eo_it));
|
||||
|
||||
evas_object_event_callback_add(sd->hover, EVAS_CALLBACK_DEL, _auto_update, item);
|
||||
|
||||
elm_hoversel_hover_end(obj2);
|
||||
|
||||
|
|
Loading…
Reference in New Issue