enable/disable back/next as needed. allow pages to do it too.

SVN revision: 31743
This commit is contained in:
Carsten Haitzler 2007-09-16 18:32:32 +00:00
parent a548d436d0
commit e7de4981f9
4 changed files with 144 additions and 10 deletions

View File

@ -109,6 +109,7 @@ group {
mouse_events: 1;
description {
state: "default" 0.0;
visible: 0;
align: 0.0 1.0;
rel1 {
to: "e.button.back.label";
@ -125,9 +126,15 @@ group {
border: 7 7 7 7;
}
}
description {
state: "visible" 0.0;
inherit: "default" 0.0;
visible: 1;
}
description {
state: "clicked" 0.0;
inherit: "default" 0.0;
visible: 1;
image {
normal: "e17_wiz_b2.png";
}
@ -140,6 +147,7 @@ group {
mouse_events: 0;
description {
state: "default" 0.0;
visible: 0;
rel1 {
relative: 0.0 1.0;
offset: 16 -17;
@ -160,9 +168,17 @@ group {
text_class: "wizard_button";
}
}
description {
state: "visible" 0.0;
inherit: "default" 0.0;
visible: 1;
color: 255 255 255 255;
color3: 0 0 0 8;
}
description {
state: "clicked" 0.0;
inherit: "default" 0.0;
visible: 1;
color: 255 255 255 255;
color3: 0 0 0 8;
}
@ -172,6 +188,7 @@ group {
mouse_events: 1;
description {
state: "default" 0.0;
visible: 0;
align: 0.0 1.0;
rel1 {
to: "e.button.next.label";
@ -188,9 +205,15 @@ group {
border: 7 7 7 7;
}
}
description {
state: "visible" 0.0;
inherit: "default" 0.0;
visible: 1;
}
description {
state: "clicked" 0.0;
inherit: "default" 0.0;
visible: 1;
image {
normal: "e17_wiz_b2.png";
}
@ -203,6 +226,7 @@ group {
mouse_events: 0;
description {
state: "default" 0.0;
visible: 0;
rel1 {
relative: 1.0 1.0;
offset: -17 -17;
@ -223,9 +247,15 @@ group {
text_class: "wizard_button";
}
}
description {
state: "visible" 0.0;
inherit: "default" 0.0;
visible: 1;
}
description {
state: "clicked" 0.0;
inherit: "default" 0.0;
visible: 1;
color: 255 255 255 255;
color3: 0 0 0 8;
}
@ -275,7 +305,7 @@ group {
name: "b1_unclick";
signal: "mouse,up,1";
source: "b1";
action: STATE_SET "default" 0.0;
action: STATE_SET "visible" 0.0;
target: "b1";
target: "e.button.back.label";
after: "b1";
@ -292,7 +322,7 @@ group {
name: "b2_unclick";
signal: "mouse,up,1";
source: "b2";
action: STATE_SET "default" 0.0;
action: STATE_SET "visible" 0.0;
target: "b2";
target: "e.button.next.label";
after: "b2";
@ -305,5 +335,37 @@ group {
name: "b2";
action: SIGNAL_EMIT "e,action,next" "";
}
program {
name: "b1_enable";
signal: "e,state,back,enable";
source: "e";
action: STATE_SET "visible" 0.0;
target: "b1";
target: "e.button.back.label";
}
program {
name: "b1_disable";
signal: "e,state,back,disable";
source: "e";
action: STATE_SET "default" 0.0;
target: "b1";
target: "e.button.back.label";
}
program {
name: "b2_enable";
signal: "e,state,next,enable";
source: "e";
action: STATE_SET "visible" 0.0;
target: "b2";
target: "e.button.next.label";
}
program {
name: "b2_disable";
signal: "e,state,next,disable";
source: "e";
action: STATE_SET "default" 0.0;
target: "b2";
target: "e.button.next.label";
}
}
}

View File

@ -4,6 +4,8 @@
#include "e.h"
#include "e_mod_main.h"
static void _e_wizard_back_eval(void);
static void _e_wizard_next_eval(void);
static E_Popup *_e_wizard_main_new(E_Zone *zone);
static E_Popup *_e_wizard_extra_new(E_Zone *zone);
static void _e_wizard_cb_key_down(void *data, Evas *e, Evas_Object *obj, void *event);
@ -16,6 +18,12 @@ static Evas_Object *o_bg = NULL;
static Evas_Object *o_content = NULL;
static Evas_List *pages = NULL;
static E_Wizard_Page *curpage = NULL;
static int next_ok = 1;
static int back_ok = 1;
static int next_can = 0;
static int back_can = 0;
static int next_prev = 0;
static int back_prev = 0;
EAPI int
e_wizard_init(void)
@ -74,11 +82,17 @@ e_wizard_go(void)
{
if (!curpage)
{
if (pages) curpage = pages->data;
if (pages)
{
curpage = pages->data;
if (pages->next) next_can = 1;
}
}
if (curpage)
{
if ((!curpage->data) && (curpage->init)) curpage->init(curpage);
_e_wizard_back_eval();
_e_wizard_next_eval();
if ((curpage->show) && (!curpage->show(curpage)))
{
e_wizard_next();
@ -122,6 +136,11 @@ e_wizard_next(void)
if (curpage->init)
curpage->init(curpage);
}
next_can = 1;
if (l->prev) back_can = 1;
else back_can = 0;
_e_wizard_back_eval();
_e_wizard_next_eval();
if ((curpage->show) && (curpage->show(curpage)))
{
break;
@ -160,6 +179,11 @@ e_wizard_back(void)
if (curpage->init)
curpage->init(curpage);
}
next_can = 1;
if (l->prev) back_can = 1;
else back_can = 0;
_e_wizard_back_eval();
_e_wizard_next_eval();
if ((curpage->show) && (curpage->show(curpage)))
{
break;
@ -228,6 +252,50 @@ e_wizard_page_del(E_Wizard_Page *pg)
free(pg);
}
EAPI void
e_wizard_button_back_enable_set(int enable)
{
back_ok = enable;
_e_wizard_back_eval();
}
EAPI void
e_wizard_button_next_enable_set(int enable)
{
next_ok = enable;
_e_wizard_next_eval();
}
static void
_e_wizard_back_eval(void)
{
int ok;
ok = back_can;
if (!back_ok) ok = 0;
if (back_prev != ok)
{
if (ok) edje_object_signal_emit(o_bg, "e,state,back,enable", "e");
else edje_object_signal_emit(o_bg, "e,state,back,disable", "e");
back_prev = ok;
}
}
static void
_e_wizard_next_eval(void)
{
int ok;
ok = next_can;
if (!next_ok) ok = 0;
if (next_prev != ok)
{
if (ok) edje_object_signal_emit(o_bg, "e,state,next,enable", "e");
else edje_object_signal_emit(o_bg, "e,state,next,disable", "e");
next_prev = ok;
}
}
static E_Popup *
_e_wizard_main_new(E_Zone *zone)
{
@ -333,10 +401,6 @@ _e_wizard_cb_key_down(void *data, Evas *e, Evas_Object *obj, void *event)
o = e_widget_focused_object_get(o_content);
if (o) e_widget_activate(o);
}
else if (!strcmp(ev->keyname, "Escape"))
{
e_wizard_shutdown();
}
}
static void

View File

@ -36,8 +36,9 @@ EAPI E_Wizard_Page *
int (*hide) (E_Wizard_Page *pg),
int (*apply) (E_Wizard_Page *pg)
);
EAPI void
e_wizard_page_del(E_Wizard_Page *pg);
EAPI void e_wizard_page_del(E_Wizard_Page *pg);
EAPI void e_wizard_button_back_enable_set(int enable);
EAPI void e_wizard_button_next_enable_set(int enable);
#endif
#endif

View File

@ -4,6 +4,12 @@
#include "e.h"
#include "e_mod_main.h"
static void
button_cb(void *data, void *data2)
{
e_wizard_button_next_enable_set(1);
}
EAPI int
wizard_page_init(E_Wizard_Page *pg)
{
@ -23,11 +29,12 @@ wizard_page_show(E_Wizard_Page *pg)
ob = e_widget_list_add(pg->evas, 1, 0);
o = e_widget_button_add(pg->evas,
"Hello World", NULL,
NULL, NULL, NULL);
button_cb, NULL, NULL);
e_widget_list_object_append(ob, o, 0, 0, 0.5);
evas_object_show(o);
e_wizard_page_show(ob);
pg->data = ob;
e_wizard_button_next_enable_set(0);
return 1; /* 1 == show ui, and wait for user, 0 == just continue */
}
EAPI int