mo wiz work. has page infra now and can "run" the pages.

SVN revision: 31711
This commit is contained in:
Carsten Haitzler 2007-09-14 13:58:18 +00:00
parent 2e50246203
commit 4e1db54233
2 changed files with 64 additions and 17 deletions

View File

@ -29,15 +29,34 @@ EAPI E_Module_Api e_modapi =
}; };
static int t_init (E_Wizard_Page *pg){ static int t0_init (E_Wizard_Page *pg){
return 1; return 1;
} }
static int t_shutdown (E_Wizard_Page *pg){ static int t0_shutdown (E_Wizard_Page *pg){
return 1; return 1;
} }
static int t_show (E_Wizard_Page *pg){ static int t0_show (E_Wizard_Page *pg){
printf("t0\n");
return 0; /* 1 == show ui, and wait for user, 0 == just continue */
}
static int t0_hide (E_Wizard_Page *pg){
return 1;
}
static int t0_apply (E_Wizard_Page *pg){
printf("a0\n");
return 1;
}
static int t1_init (E_Wizard_Page *pg){
return 1;
}
static int t1_shutdown (E_Wizard_Page *pg){
return 1;
}
static int t1_show (E_Wizard_Page *pg){
Evas_Object *ob, *o; Evas_Object *ob, *o;
printf("t1\n");
ob = e_widget_list_add(pg->evas, 1, 0); ob = e_widget_list_add(pg->evas, 1, 0);
o = e_widget_button_add(pg->evas, o = e_widget_button_add(pg->evas,
"Hello World", NULL, "Hello World", NULL,
@ -46,13 +65,14 @@ static int t_show (E_Wizard_Page *pg){
evas_object_show(o); evas_object_show(o);
e_wizard_page_show(ob); e_wizard_page_show(ob);
pg->data = ob; pg->data = ob;
return 0; return 1; /* 1 == show ui, and wait for user, 0 == just continue */
} }
static int t_hide (E_Wizard_Page *pg){ static int t1_hide (E_Wizard_Page *pg){
evas_object_del(pg->data); evas_object_del(pg->data);
return 1; return 1;
} }
static int t_apply (E_Wizard_Page *pg){ static int t1_apply (E_Wizard_Page *pg){
printf("a1\n");
return 1; return 1;
} }
@ -65,6 +85,7 @@ static int t2_shutdown (E_Wizard_Page *pg){
static int t2_show (E_Wizard_Page *pg){ static int t2_show (E_Wizard_Page *pg){
Evas_Object *ob, *o; Evas_Object *ob, *o;
printf("t2\n");
ob = e_widget_list_add(pg->evas, 1, 0); ob = e_widget_list_add(pg->evas, 1, 0);
o = e_widget_button_add(pg->evas, o = e_widget_button_add(pg->evas,
"Hello to Another World", NULL, "Hello to Another World", NULL,
@ -73,13 +94,14 @@ static int t2_show (E_Wizard_Page *pg){
evas_object_show(o); evas_object_show(o);
e_wizard_page_show(ob); e_wizard_page_show(ob);
pg->data = ob; pg->data = ob;
return 0; return 1;
} }
static int t2_hide (E_Wizard_Page *pg){ static int t2_hide (E_Wizard_Page *pg){
evas_object_del(pg->data); evas_object_del(pg->data);
return 1; return 1;
} }
static int t2_apply (E_Wizard_Page *pg){ static int t2_apply (E_Wizard_Page *pg){
printf("a2\n");
return 1; return 1;
} }
@ -90,7 +112,8 @@ e_modapi_init(E_Module *m)
conf_module = m; conf_module = m;
e_wizard_init(); e_wizard_init();
e_wizard_page_add(t_init, t_shutdown, t_show, t_hide, t_apply); e_wizard_page_add(t0_init, t0_shutdown, t0_show, t0_hide, t0_apply);
e_wizard_page_add(t1_init, t1_shutdown, t1_show, t1_hide, t1_apply);
e_wizard_page_add(t2_init, t2_shutdown, t2_show, t2_hide, t2_apply); e_wizard_page_add(t2_init, t2_shutdown, t2_show, t2_hide, t2_apply);
e_wizard_go(); e_wizard_go();

View File

@ -62,6 +62,7 @@ e_wizard_shutdown(void)
e_object_del(E_OBJECT(pops->data)); e_object_del(E_OBJECT(pops->data));
pops = evas_list_remove_list(pops, pops); pops = evas_list_remove_list(pops, pops);
} }
/* FIXME: remove wizard module */
return 1; return 1;
} }
@ -74,8 +75,25 @@ e_wizard_go(void)
} }
if (curpage) if (curpage)
{ {
if (!curpage->data) curpage->init(curpage); if ((!curpage->data) && (curpage->init)) curpage->init(curpage);
curpage->show(curpage); if ((curpage->show) && (!curpage->show(curpage)))
{
e_wizard_next();
}
}
}
EAPI void
e_wizard_apply(void)
{
Evas_List *l;
for (l = pages; l; l = l->next)
{
E_Wizard_Page *pg;
pg = l->data;
if (pg->apply) pg->apply(pg);
} }
} }
@ -92,14 +110,16 @@ e_wizard_next(void)
{ {
if (curpage) if (curpage)
{ {
curpage->hide(curpage); if (curpage->hide)
curpage->hide(curpage);
} }
curpage = l->next->data; curpage = l->next->data;
if (!curpage->data) if (!curpage->data)
{ {
curpage->init(curpage); if (curpage->init)
curpage->init(curpage);
} }
if (curpage->show(curpage)) if ((curpage->show) && (curpage->show(curpage)))
{ {
break; break;
} }
@ -107,7 +127,9 @@ e_wizard_next(void)
else else
{ {
/* FINISH */ /* FINISH */
break; e_wizard_apply();
e_wizard_shutdown();
return;
} }
} }
} }
@ -126,14 +148,16 @@ e_wizard_back(void)
{ {
if (curpage) if (curpage)
{ {
curpage->hide(curpage); if (curpage->hide)
curpage->hide(curpage);
} }
curpage = l->prev->data; curpage = l->prev->data;
if (!curpage->data) if (!curpage->data)
{ {
curpage->init(curpage); if (curpage->init)
curpage->init(curpage);
} }
if (curpage->show(curpage)) if ((curpage->show) && (curpage->show(curpage)))
{ {
break; break;
} }