forked from enlightenment/efl
mapbuf -> hide/show content absolutely if mapbuf is hidden/shown and
add test. SVN revision: 54014
This commit is contained in:
parent
f47e9dac15
commit
32c2779ac4
|
@ -552,6 +552,21 @@ l3_smooth_cb(void *data, Evas_Object *obj, void *event_info __UNUSED__)
|
|||
}
|
||||
}
|
||||
|
||||
static void
|
||||
l3_hidden_cb(void *data, Evas_Object *obj, void *event_info __UNUSED__)
|
||||
{
|
||||
Evas_Object *win = data;
|
||||
Evas_Object *mb;
|
||||
Eina_List *mbs, *l;
|
||||
|
||||
mbs = evas_object_data_get(win, "mbs");
|
||||
EINA_LIST_FOREACH(mbs, l, mb)
|
||||
{
|
||||
if (evas_object_visible_get(mb)) evas_object_hide(mb);
|
||||
else evas_object_show(mb);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
l3_close_cb(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
|
||||
{
|
||||
|
@ -882,12 +897,21 @@ test_launcher3(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_i
|
|||
elm_table_pack(tb2, ck, 3, 0, 1, 1);
|
||||
evas_object_show(ck);
|
||||
|
||||
ck = elm_check_add(win);
|
||||
elm_check_label_set(ck, "Hid");
|
||||
elm_check_state_set(ck, 0);
|
||||
evas_object_smart_callback_add(ck, "changed", l3_hidden_cb, win);
|
||||
evas_object_size_hint_weight_set(ck, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
|
||||
evas_object_size_hint_align_set(ck, 0.5, 0.99);
|
||||
elm_table_pack(tb2, ck, 4, 0, 1, 1);
|
||||
evas_object_show(ck);
|
||||
|
||||
bt = elm_button_add(win);
|
||||
elm_button_label_set(bt, "Close");
|
||||
evas_object_smart_callback_add(bt, "clicked", l3_close_cb, win);
|
||||
evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
|
||||
evas_object_size_hint_align_set(bt, 0.95, 0.99);
|
||||
elm_table_pack(tb2, bt, 4, 0, 1, 1);
|
||||
elm_table_pack(tb2, bt, 5, 0, 1, 1);
|
||||
evas_object_show(bt);
|
||||
|
||||
evas_object_show(tb2);
|
||||
|
|
|
@ -11,7 +11,7 @@ typedef struct _Widget_Data Widget_Data;
|
|||
|
||||
struct _Widget_Data
|
||||
{
|
||||
Evas_Object *content;
|
||||
Evas_Object *content, *clip;
|
||||
Eina_Bool enabled : 1;
|
||||
Eina_Bool alpha : 1;
|
||||
Eina_Bool smooth : 1;
|
||||
|
@ -85,7 +85,7 @@ _mapbuf(Evas_Object *obj)
|
|||
Widget_Data *wd = elm_widget_data_get(obj);
|
||||
Evas_Coord x, y, w, h;
|
||||
if (!wd) return;
|
||||
evas_object_geometry_get(obj, &x, &y, &w, &h);
|
||||
evas_object_geometry_get(wd->clip, &x, &y, &w, &h);
|
||||
if (wd->enabled)
|
||||
{
|
||||
Evas_Map *m;
|
||||
|
@ -116,7 +116,7 @@ _configure(Evas_Object *obj)
|
|||
{
|
||||
Evas_Coord x, y, w, h, x2, y2;
|
||||
|
||||
evas_object_geometry_get(obj, &x, &y, &w, &h);
|
||||
evas_object_geometry_get(wd->clip, &x, &y, &w, &h);
|
||||
evas_object_geometry_get(wd->content, &x2, &y2, NULL, NULL);
|
||||
if ((x != x2) || (y != y2))
|
||||
{
|
||||
|
@ -141,15 +141,15 @@ _configure(Evas_Object *obj)
|
|||
}
|
||||
|
||||
static void
|
||||
_move(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
|
||||
_move(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
|
||||
{
|
||||
_configure(obj);
|
||||
_configure(data);
|
||||
}
|
||||
|
||||
static void
|
||||
_resize(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
|
||||
_resize(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
|
||||
{
|
||||
_configure(obj);
|
||||
_configure(data);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -178,10 +178,16 @@ elm_mapbuf_add(Evas_Object *parent)
|
|||
elm_widget_theme_hook_set(obj, _theme_hook);
|
||||
elm_widget_can_focus_set(obj, EINA_FALSE);
|
||||
|
||||
evas_object_smart_callback_add(obj, "sub-object-del", _sub_del, obj);
|
||||
evas_object_event_callback_add(obj, EVAS_CALLBACK_MOVE, _move, NULL);
|
||||
evas_object_event_callback_add(obj, EVAS_CALLBACK_RESIZE, _resize, NULL);
|
||||
wd->clip = evas_object_rectangle_add(e);
|
||||
evas_object_pass_events_set(wd->clip, EINA_TRUE);
|
||||
evas_object_color_set(wd->clip, 0, 0, 0, 0);
|
||||
|
||||
evas_object_smart_callback_add(obj, "sub-object-del", _sub_del, obj);
|
||||
evas_object_event_callback_add(wd->clip, EVAS_CALLBACK_MOVE, _move, obj);
|
||||
evas_object_event_callback_add(wd->clip, EVAS_CALLBACK_RESIZE, _resize, obj);
|
||||
|
||||
elm_widget_resize_object_set(obj, wd->clip);
|
||||
|
||||
wd->enabled = 0;
|
||||
wd->alpha = 1;
|
||||
wd->smooth = 1;
|
||||
|
@ -213,14 +219,17 @@ elm_mapbuf_content_set(Evas_Object *obj, Evas_Object *content)
|
|||
wd->content = content;
|
||||
if (content)
|
||||
{
|
||||
// FIXME: dont handle del
|
||||
evas_object_data_set(content, "_elm_leaveme", (void *)1);
|
||||
elm_widget_sub_object_add(content, obj);
|
||||
evas_object_smart_member_add(content, obj);
|
||||
evas_object_clip_set(content, evas_object_clip_get(obj));
|
||||
evas_object_clip_set(content, wd->clip);
|
||||
evas_object_color_set(wd->clip, 255, 255, 255, 255);
|
||||
evas_object_event_callback_add(content,
|
||||
EVAS_CALLBACK_CHANGED_SIZE_HINTS,
|
||||
_changed_size_hints, obj);
|
||||
}
|
||||
else
|
||||
evas_object_color_set(wd->clip, 0, 0, 0, 0);
|
||||
_sizing_eval(obj);
|
||||
_configure(obj);
|
||||
}
|
||||
|
@ -263,9 +272,11 @@ elm_mapbuf_content_unset(Evas_Object *obj)
|
|||
if (!wd) return NULL;
|
||||
if (!wd->content) return NULL;
|
||||
content = wd->content;
|
||||
elm_widget_sub_object_del(obj, wd->content);
|
||||
evas_object_smart_member_del(wd->content);
|
||||
evas_object_clip_unset(wd->content);
|
||||
elm_widget_sub_object_del(obj, content);
|
||||
evas_object_smart_member_del(content);
|
||||
evas_object_color_set(wd->clip, 0, 0, 0, 0);
|
||||
evas_object_clip_unset(content);
|
||||
evas_object_data_del(content, "_elm_leaveme");
|
||||
wd->content = NULL;
|
||||
return content;
|
||||
}
|
||||
|
|
|
@ -2582,8 +2582,6 @@ _smart_clip_unset(Evas_Object *obj)
|
|||
Eina_List *list;
|
||||
Evas_Object *o;
|
||||
INTERNAL_ENTRY;
|
||||
// evas_object_clip_unset(sd->resize_obj);
|
||||
// return;
|
||||
if ((list = evas_object_smart_members_get(obj)))
|
||||
{
|
||||
EINA_LIST_FREE(list, o)
|
||||
|
|
Loading…
Reference in New Issue