elementary/naviframe - updated test.

SVN revision: 64720
This commit is contained in:
ChunEon Park 2011-11-04 04:46:09 +00:00
parent 48d302c9f2
commit d602f78c45
2 changed files with 97 additions and 119 deletions

View File

@ -1,59 +1,17 @@
group { name:"elm/naviframe/base/default";
images {
image: "frame_1.png" COMP;
image: "frame_2.png" COMP;
image: "dia_grad.png" COMP;
}
parts {
part { name: "base0";
mouse_events: 0;
description { state: "default" 0.0;
image.normal: "dia_grad.png";
fill {
smooth: 0;
size {
relative: 0.0 1.0;
offset: 64 0;
}
}
}
}
part { name: "base1";
type: IMAGE;
description { state: "default" 0.0;
image {
normal: "frame_2.png";
border: 5 5 32 26;
middle: 0;
}
fill.smooth : 0;
}
}
part { name: "over";
mouse_events: 0;
description { state: "default" 0.0;
rel1.offset: 4 4;
rel2.offset: 5 5;
image {
normal: "frame_1.png";
border: 2 2 28 22;
middle: 0;
}
fill.smooth : 0;
}
}
}
}
group { name:"elm/naviframe/item/basic/default";
images {
image: "flip_shad.png" COMP;
}
parts {
part { name: "title_clip";
type: RECT;
mouse_events: 0;
description { state: "default" 0.0;
min: 1 50;
description { state: "default" 0.0;
min: 1 55;
align: 0.0 0.0;
fixed: 0 1;
rel1 { relative: 0.0 0.0; }
@ -98,15 +56,22 @@ group { name:"elm/naviframe/item/basic/default";
}
part { name: "title_base";
type: RECT;
scale: 1;
repeat_events: 0;
description { state: "default" 0.0;
rel1 { to: "title_clip"; }
rel2 { to: "title_clip"; }
color: 225 225 225 255;
}
}
part { name: "title_separator";
type: RECT;
clip_to: "title_clip";
description { state: "default" 0.0;
min: 1 50;
align: 0.0 0.0;
min: 0 5;
align: 0.5 1;
fixed: 0 1;
rel1 { relative: 0.0 0.0; }
rel2 { relative: 1.0 0.0; }
rel1 { to: "title_clip"; relative: 0 1; }
rel2 { to: "title_clip"; }
color: 150 150 150 255;
}
}
part { name: "elm.swallow.prev_btn";
@ -160,7 +125,7 @@ group { name:"elm/naviframe/item/basic/default";
clip_to: "title_clip";
description { state: "default" 0.0;
text { font: "Sans,Edje-Vera";
size: 10;
size: 12;
min: 0 0;
max: 1 0;
align: 0.5 0.5;
@ -178,7 +143,7 @@ group { name:"elm/naviframe/item/basic/default";
clip_to: "title_clip";
description { state: "default" 0.0;
text { font: "Sans,Edje-Vera";
size: 8;
size: 10;
min: 0 0;
max: 1 0;
align: 0.5 1;
@ -186,29 +151,13 @@ group { name:"elm/naviframe/item/basic/default";
rel1.to_y: "elm.text.title";
rel1.relative: 0 1;
rel1.to: "title_base";
rel1.offset: 0 -3;
rel2.to: "title_base";
rel2.offset: -1 -4;
color: 50 50 50 255;
align: 0.5 0;
}
}
part { name: "shade";
type: IMAGE;
mouse_events: 0;
description { state: "default" 0.0;
align: 0.5 1;
rel1.to_y: "elm.text.title";
rel1.relative: 0 1;
rel1.offset: 0 0;
rel1.to: "title_base";
rel2.offset: -1 5;
rel2.to: "title_base";
image.normal: "flip_shad.png";
}
description { state: "hide" 0.0;
inherit: "default" 0.0;
visible: 0;
}
}
}
programs {
program { name: "content_new_pusehd";
@ -286,14 +235,12 @@ group { name:"elm/naviframe/item/basic/default";
source: "elm";
action: STATE_SET "default" 0.0;
target: "title_clip";
target: "shade";
}
program { name: "title_hide";
signal: "elm,state,title,hide";
source: "elm";
action: STATE_SET "hide" 0.0;
target: "title_clip";
target: "shade";
}
program {
name: "title_clicked";

View File

@ -4,12 +4,35 @@
#endif
#ifndef ELM_LIB_QUICKLAUNCH
static const char *img1 = PACKAGE_DATA_DIR"/images/logo.png";
static const char *img2 = PACKAGE_DATA_DIR"/images/plant_01.jpg";
static const char *img3 = PACKAGE_DATA_DIR"/images/rock_01.jpg";
static const char *img4 = PACKAGE_DATA_DIR"/images/rock_02.jpg";
static const char *img5 = PACKAGE_DATA_DIR"/images/sky_01.jpg";
Evas_Object *
_content_new(Evas_Object *parent, const char *img)
{
Evas_Object *photo = elm_photo_add(parent);
elm_photo_file_set(photo, img);
elm_photo_fill_inside_set(photo, EINA_TRUE);
elm_object_style_set(photo, "shadow");
return photo;
}
void
_navi_pop(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
{
elm_naviframe_item_pop(data);
}
void
_navi_it_del(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
{
elm_naviframe_item_del(data);
}
void
_title_clicked(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
{
@ -24,46 +47,66 @@ _title_visible(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_i
}
void
_page4(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
_page5(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
{
Evas_Object *bt, *bt2, *ic, *nf = data;
char buf[PATH_MAX];
Evas_Object *bt, *en, *content, *nf = data;
Elm_Object_Item *it;
bt = elm_button_add(nf);
evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
elm_object_text_set(bt, "Prev");
content = _content_new(nf, img5);
it = elm_naviframe_item_insert_after(elm_naviframe_top_item_get(nf),
"Page 5",
bt,
NULL,
content,
NULL);
evas_object_smart_callback_add(bt, "clicked", _navi_it_del, it);
}
void
_page4(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
{
Evas_Object *bt, *ic, *content, *nf = data;
char buf[PATH_MAX];
Elm_Object_Item *it;
ic = elm_icon_add(nf);
snprintf(buf, sizeof(buf), "%s/images/icon_right_arrow.png", elm_app_data_dir_get());
snprintf(buf, sizeof(buf), "%s/images/icon_right_arrow.png",
elm_app_data_dir_get());
elm_icon_file_set(ic, buf, NULL);
evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1);
bt = elm_button_add(nf);
evas_object_smart_callback_add(bt, "clicked", _page5, nf);
evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
elm_object_content_set(bt, ic);
bt2 = elm_button_add(nf);
evas_object_size_hint_align_set(bt2, EVAS_HINT_FILL, EVAS_HINT_FILL);
elm_object_text_set(bt2, "Naviframe Test");
ic = elm_icon_add(nf);
snprintf(buf, sizeof(buf), "%s/images/logo_small.png", elm_app_data_dir_get());
elm_icon_file_set(ic, buf, NULL);
evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1);
content = _content_new(nf, img4);
it = elm_naviframe_item_push(nf,
"Page 4",
NULL,
bt,
bt2,
content,
NULL);
elm_object_item_text_part_set(it, ELM_NAVIFRAME_ITEM_TEXT_SUBTITLE, "Here is sub-title part!");
ic = elm_icon_add(nf);
snprintf(buf, sizeof(buf), "%s/images/logo_small.png",
elm_app_data_dir_get());
elm_icon_file_set(ic, buf, NULL);
evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1);
elm_object_item_content_part_set(it, ELM_NAVIFRAME_ITEM_CONTENT_ICON, ic);
elm_naviframe_item_title_visible_set(it, EINA_FALSE);
evas_object_smart_callback_add(bt2, "clicked", _title_visible, it);
evas_object_smart_callback_add(content, "clicked", _title_visible, it);
}
void
_page3(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
{
Evas_Object *bt, *bt2, *bt3, *ic, *nf = data;
Evas_Object *bt, *bt2, *ic, *content, *nf = data;
char buf[PATH_MAX];
Elm_Object_Item *it;
@ -77,29 +120,26 @@ _page3(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
elm_object_text_set(bt2, "Next");
evas_object_smart_callback_add(bt2, "clicked", _page4, nf);
bt3 = elm_button_add(nf);
evas_object_size_hint_align_set(bt3, EVAS_HINT_FILL, EVAS_HINT_FILL);
elm_object_text_set(bt3, "Naviframe Test");
ic = elm_icon_add(nf);
snprintf(buf, sizeof(buf), "%s/images/logo_small.png", elm_app_data_dir_get());
elm_icon_file_set(ic, buf, NULL);
evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1);
content = _content_new(nf, img3);
it = elm_naviframe_item_push(nf,
"Page 3",
bt,
bt2,
bt3,
content,
NULL);
elm_object_item_text_part_set(it, "elm.text.subtitle", "Here is sub-title part!");
ic = elm_icon_add(nf);
snprintf(buf, sizeof(buf), "%s/images/logo_small.png", elm_app_data_dir_get());
elm_icon_file_set(ic, buf, NULL);
evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1);
elm_object_item_content_part_set(it, ELM_NAVIFRAME_ITEM_CONTENT_ICON, ic);
}
void
_page2(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
{
Evas_Object *bt, *bt2, *ic, *nf = data;
Evas_Object *bt, *content, *ic, *nf = data;
char buf[PATH_MAX];
Elm_Object_Item *it;
@ -107,29 +147,24 @@ _page2(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
evas_object_smart_callback_add(bt, "clicked", _page3, nf);
bt2 = elm_button_add(nf);
evas_object_size_hint_align_set(bt2, EVAS_HINT_FILL, EVAS_HINT_FILL);
elm_object_text_set(bt2, "Naviframe Test");
ic = elm_icon_add(nf);
snprintf(buf, sizeof(buf), "%s/images/icon_right_arrow.png", elm_app_data_dir_get());
snprintf(buf, sizeof(buf), "%s/images/icon_right_arrow.png",
elm_app_data_dir_get());
elm_icon_file_set(ic, buf, NULL);
evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1);
elm_object_content_set(bt, ic);
it = elm_naviframe_item_push(nf,
"Page 2",
NULL,
bt,
bt2,
NULL);
elm_object_item_text_part_set(it, ELM_NAVIFRAME_ITEM_TEXT_SUBTITLE, "Here is sub-title part!");
content = _content_new(nf, img2);
it = elm_naviframe_item_push(nf, "Page 2", NULL, bt, content, NULL);
elm_object_item_text_part_set(it, ELM_NAVIFRAME_ITEM_TEXT_SUBTITLE,
"Here is sub-title part!");
}
void
test_naviframe(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
{
Evas_Object *win, *bg, *nf, *btn;
Evas_Object *win, *bg, *nf, *btn, *content;
win = elm_win_add(NULL, "naviframe", ELM_WIN_BASIC);
elm_win_title_set(win, "Naviframe");
@ -150,15 +185,11 @@ test_naviframe(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_i
btn = elm_button_add(nf);
evas_object_size_hint_align_set(btn, EVAS_HINT_FILL, EVAS_HINT_FILL);
evas_object_smart_callback_add(btn, "clicked", _page2, nf);
elm_object_text_set(btn, "Naviframe Test");
elm_object_text_set(btn, "Next");
evas_object_show(btn);
elm_naviframe_item_push(nf,
"Page 1",
NULL,
NULL,
btn,
NULL);
content = _content_new(nf, img1);
elm_naviframe_item_push(nf, "Page 1", NULL, btn, content, NULL);
evas_object_resize(win, 400, 600);
evas_object_show(win);