more comprehensive flip test with multiple children etc.

SVN revision: 47072
This commit is contained in:
Carsten Haitzler 2010-03-09 04:00:08 +00:00
parent f838c2a17a
commit b9f621228a
3 changed files with 176 additions and 12 deletions

View File

@ -57,6 +57,7 @@ void test_panel(void *data, Evas_Object *obj, void *event_info);
void test_map(void *data, Evas_Object *obj, void *event_info);
void test_weather(void *data, Evas_Object *obj, void *event_info);
void test_flip(void *data, Evas_Object *obj, void *event_info);
void test_flip2(void *data, Evas_Object *obj, void *event_info);
void test_label(void *data, Evas_Object *obj, void *event_info);
void test_conformant(void *data, Evas_Object *obj, void *event_info);
void test_multi(void *data, Evas_Object *obj, void *event_info);
@ -202,6 +203,7 @@ my_win_main(void)
elm_list_item_append(li, "Map", NULL, NULL, test_map, NULL);
elm_list_item_append(li, "Weather", NULL, NULL, test_weather, NULL);
elm_list_item_append(li, "Flip", NULL, NULL, test_flip, NULL);
elm_list_item_append(li, "Flip 2", NULL, NULL, test_flip2, NULL);
elm_list_item_append(li, "Label", NULL, NULL, test_label, NULL);
elm_list_item_append(li, "Conformant", NULL, NULL, test_conformant, NULL);
elm_list_item_append(li, "Multi Touch", NULL, NULL, test_multi, NULL);

View File

@ -49,8 +49,6 @@ test_flip(void *data, Evas_Object *obj, void *event_info)
elm_win_resize_object_add(win, bx);
evas_object_show(bx);
#if 1 // working on it
fl = elm_flip_add(win);
evas_object_size_hint_align_set(fl, EVAS_HINT_FILL, EVAS_HINT_FILL);
evas_object_size_hint_weight_set(fl, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
@ -128,7 +126,147 @@ test_flip(void *data, Evas_Object *obj, void *event_info)
elm_box_pack_end(bx, bx2);
evas_object_show(bx2);
#endif
evas_object_resize(win, 320, 480);
evas_object_show(win);
}
void
test_flip2(void *data, Evas_Object *obj, void *event_info)
{
Evas_Object *win, *bg, *bx, *bx2, *fl, *o, *bt, *tb, *ic, *li;
char buf[PATH_MAX];
win = elm_win_add(NULL, "flip2", ELM_WIN_BASIC);
elm_win_title_set(win, "Flip 2");
elm_win_autodel_set(win, 1);
bg = elm_bg_add(win);
snprintf(buf, sizeof(buf), "%s/images/%s", PACKAGE_DATA_DIR, "sky_01.jpg");
elm_bg_file_set(bg, buf, NULL);
elm_win_resize_object_add(win, bg);
evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_show(bg);
bx = elm_box_add(win);
evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
elm_win_resize_object_add(win, bx);
evas_object_show(bx);
fl = elm_flip_add(win);
evas_object_size_hint_align_set(fl, EVAS_HINT_FILL, EVAS_HINT_FILL);
evas_object_size_hint_weight_set(fl, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
elm_box_pack_end(bx, fl);
o = elm_box_add(win);
evas_object_size_hint_align_set(o, EVAS_HINT_FILL, EVAS_HINT_FILL);
evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
tb = elm_toolbar_add(win);
elm_toolbar_homogenous_set(tb, 0);
evas_object_size_hint_weight_set(tb, 0.0, 0.0);
evas_object_size_hint_align_set(tb, EVAS_HINT_FILL, 0.0);
ic = elm_icon_add(win);
snprintf(buf, sizeof(buf), "%s/images/logo_small.png", PACKAGE_DATA_DIR);
elm_icon_file_set(ic, buf, NULL);
elm_toolbar_item_add(tb, ic, "Hello", NULL, NULL);
ic = elm_icon_add(win);
snprintf(buf, sizeof(buf), "%s/images/logo_small.png", PACKAGE_DATA_DIR);
elm_icon_file_set(ic, buf, NULL);
elm_toolbar_item_add(tb, ic, "Out", NULL, NULL);
ic = elm_icon_add(win);
snprintf(buf, sizeof(buf), "%s/images/logo_small.png", PACKAGE_DATA_DIR);
elm_icon_file_set(ic, buf, NULL);
elm_toolbar_item_add(tb, ic, "There", NULL, NULL);
ic = elm_icon_add(win);
snprintf(buf, sizeof(buf), "%s/images/logo_small.png", PACKAGE_DATA_DIR);
elm_icon_file_set(ic, buf, NULL);
elm_toolbar_item_add(tb, ic, "World", NULL, NULL);
elm_box_pack_end(o, tb);
evas_object_show(tb);
li = elm_list_add(win);
evas_object_size_hint_align_set(li, EVAS_HINT_FILL, EVAS_HINT_FILL);
evas_object_size_hint_weight_set(li, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
elm_list_item_append(li, "This is a list", NULL, NULL, NULL, NULL);
elm_list_item_append(li, "Second item", NULL, NULL, NULL, NULL);
elm_list_item_append(li, "3rd", NULL, NULL, NULL, NULL);
elm_list_item_append(li, "Fourth", NULL, NULL, NULL, NULL);
elm_list_item_append(li, "Number five is alive!", NULL, NULL, NULL, NULL);
elm_list_item_append(li, "The quick brown fox jumps over the lazy dog", NULL, NULL, NULL, NULL);
elm_list_item_append(li, "Booyah", NULL, NULL, NULL, NULL);
elm_list_item_append(li, "And another item", NULL, NULL, NULL, NULL);
elm_list_item_append(li, "More of them", NULL, NULL, NULL, NULL);
elm_list_item_append(li, "Get with it", NULL, NULL, NULL, NULL);
elm_list_go(li);
elm_box_pack_end(o, li);
evas_object_show(li);
elm_flip_content_front_set(fl, o);
evas_object_show(o);
li = elm_list_add(win);
evas_object_size_hint_align_set(li, EVAS_HINT_FILL, EVAS_HINT_FILL);
evas_object_size_hint_weight_set(li, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
elm_list_item_append(li, "This is a list", NULL, NULL, NULL, NULL);
elm_list_item_append(li, "Second item", NULL, NULL, NULL, NULL);
elm_list_item_append(li, "3rd", NULL, NULL, NULL, NULL);
elm_list_go(li);
elm_flip_content_back_set(fl, li);
evas_object_show(li);
evas_object_show(fl);
bx2 = elm_box_add(win);
elm_box_horizontal_set(bx2, 1);
evas_object_size_hint_align_set(bx2, EVAS_HINT_FILL, EVAS_HINT_FILL);
evas_object_size_hint_weight_set(bx2, EVAS_HINT_EXPAND, 0.0);
bt = elm_button_add(win);
elm_button_label_set(bt, "1");
evas_object_smart_callback_add(bt, "clicked", my_fl_1, fl);
evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0);
elm_box_pack_end(bx2, bt);
evas_object_show(bt);
bt = elm_button_add(win);
elm_button_label_set(bt, "2");
evas_object_smart_callback_add(bt, "clicked", my_fl_2, fl);
evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0);
elm_box_pack_end(bx2, bt);
evas_object_show(bt);
bt = elm_button_add(win);
elm_button_label_set(bt, "3");
evas_object_smart_callback_add(bt, "clicked", my_fl_3, fl);
evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0);
elm_box_pack_end(bx2, bt);
evas_object_show(bt);
bt = elm_button_add(win);
elm_button_label_set(bt, "4");
evas_object_smart_callback_add(bt, "clicked", my_fl_4, fl);
evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0);
elm_box_pack_end(bx2, bt);
evas_object_show(bt);
elm_box_pack_end(bx, bx2);
evas_object_show(bx2);
evas_object_resize(win, 320, 480);
evas_object_show(win);

View File

@ -16,7 +16,7 @@ struct _Widget_Data
double start, len;
Elm_Flip_Mode mode;
struct {
Evas_Object *content;
Evas_Object *content, *clip;
} front, back;
Eina_Bool state : 1;
};
@ -87,6 +87,7 @@ _sub_del(void *data, Evas_Object *obj, void *event_info)
evas_object_event_callback_del_full(sub, EVAS_CALLBACK_CHANGED_SIZE_HINTS,
_changed_size_hints, obj);
wd->front.content = NULL;
evas_object_hide(wd->front.clip);
_sizing_eval(obj);
}
else if (sub == wd->back.content)
@ -94,6 +95,7 @@ _sub_del(void *data, Evas_Object *obj, void *event_info)
evas_object_event_callback_del_full(sub, EVAS_CALLBACK_CHANGED_SIZE_HINTS,
_changed_size_hints, obj);
wd->back.content = NULL;
evas_object_hide(wd->back.clip);
_sizing_eval(obj);
}
}
@ -187,8 +189,8 @@ _flip(Evas_Object *obj)
evas_map_util_3d_perspective(mf, px, py, 0, foc);
evas_object_map_set(wd->front.content, mf);
evas_object_map_enable_set(wd->front.content, 1);
if (evas_map_util_clockwise_get(mf)) evas_object_show(wd->front.content);
else evas_object_hide(wd->front.content);
if (evas_map_util_clockwise_get(mf)) evas_object_show(wd->front.clip);
else evas_object_hide(wd->front.clip);
}
if (wd->back.content)
@ -197,8 +199,8 @@ _flip(Evas_Object *obj)
evas_map_util_3d_perspective(mb, px, py, 0, foc);
evas_object_map_set(wd->back.content, mb);
evas_object_map_enable_set(wd->back.content, 1);
if (evas_map_util_clockwise_get(mb)) evas_object_show(wd->back.content);
else evas_object_hide(wd->back.content);
if (evas_map_util_clockwise_get(mb)) evas_object_show(wd->back.clip);
else evas_object_hide(wd->back.clip);
}
evas_map_free(mf);
@ -280,6 +282,20 @@ elm_flip_add(Evas_Object *parent)
elm_widget_del_hook_set(obj, _del_hook);
elm_widget_theme_hook_set(obj, _theme_hook);
wd->front.clip = evas_object_rectangle_add(e);
evas_object_color_set(wd->front.clip, 255, 255, 255, 255);
evas_object_move(wd->front.clip, -49999, -49999);
evas_object_resize(wd->front.clip, 99999, 99999);
elm_widget_sub_object_add(wd->front.clip, obj);
evas_object_smart_member_add(wd->front.clip, obj);
wd->back.clip = evas_object_rectangle_add(e);
evas_object_color_set(wd->back.clip, 255, 255, 255, 255);
evas_object_move(wd->back.clip, -49999, -49999);
evas_object_resize(wd->back.clip, 99999, 99999);
elm_widget_sub_object_add(wd->back.clip, obj);
evas_object_smart_member_add(wd->back.clip, obj);
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);
@ -306,6 +322,7 @@ elm_flip_content_front_set(Evas_Object *obj, Evas_Object *content)
if (wd->front.content == content) return;
if ((wd->front.content != content) && (wd->front.content))
{
evas_object_clip_set(wd->front.content, NULL);
elm_widget_sub_object_del(obj, wd->front.content);
evas_object_smart_member_del(wd->front.content);
}
@ -314,13 +331,16 @@ elm_flip_content_front_set(Evas_Object *obj, Evas_Object *content)
{
elm_widget_sub_object_add(content, obj);
evas_object_smart_member_add(content, obj);
evas_object_clip_set(content, wd->front.clip);
evas_object_event_callback_add(content,
EVAS_CALLBACK_CHANGED_SIZE_HINTS,
_changed_size_hints, obj);
_sizing_eval(obj);
if (!elm_flip_front_get(obj)) evas_object_hide(wd->front.clip);
else evas_object_show(wd->front.clip);
}
//XXX use clips
if (!elm_flip_front_get(obj)) evas_object_hide(wd->front.content);
else
evas_object_hide(wd->front.clip);
_configure(obj);
}
@ -340,6 +360,7 @@ elm_flip_content_back_set(Evas_Object *obj, Evas_Object *content)
if (wd->back.content == content) return;
if ((wd->back.content != content) && (wd->back.content))
{
evas_object_clip_set(wd->back.content, NULL);
elm_widget_sub_object_del(obj, wd->back.content);
evas_object_smart_member_del(wd->back.content);
}
@ -348,13 +369,16 @@ elm_flip_content_back_set(Evas_Object *obj, Evas_Object *content)
{
elm_widget_sub_object_add(content, obj);
evas_object_smart_member_add(content, obj);
evas_object_clip_set(content, wd->back.clip);
evas_object_event_callback_add(content,
EVAS_CALLBACK_CHANGED_SIZE_HINTS,
_changed_size_hints, obj);
_sizing_eval(obj);
if (elm_flip_front_get(obj)) evas_object_hide(wd->back.clip);
else evas_object_show(wd->back.clip);
}
//XXX use clips
if (elm_flip_front_get(obj)) evas_object_hide(wd->back.content);
else
evas_object_hide(wd->back.clip);
_configure(obj);
}