From a28bbd52a10bcfe94fbb9a4b980bf7e3119849ea Mon Sep 17 00:00:00 2001 From: steffen Date: Sun, 10 Mar 2013 00:09:40 +0000 Subject: [PATCH] softkeyboard events.. --- gui/gui.h | 7 ++++--- gui/gui_button.c | 6 ++++-- gui/gui_entry.c | 6 +++--- gui/gui_list.c | 8 +++++--- gui/gui_softkeyboard.c | 7 ++++++- 5 files changed, 22 insertions(+), 12 deletions(-) diff --git a/gui/gui.h b/gui/gui.h index 26e0872..f825174 100644 --- a/gui/gui.h +++ b/gui/gui.h @@ -170,12 +170,13 @@ extern void gui_window_item_add (GUIWindow *win, GUIItem *item); /* softkeyboard functions. */ extern void gui_softkeyb_show (int enable); +extern int gui_softkeyb_event (GUIEvent event); extern void gui_softkeyb_draw (); /* button functions */ #define GUI_BUTTON_T(_item_) ((GUIButton*)(_item_)->data) extern void gui_button_draw (GUIItem *item); -extern void gui_button_event (GUIItem *item, GUIEvent *event); +extern int gui_button_event (GUIItem *item, GUIEvent *event); extern GUIItem *gui_button_new (char *name, int x, int y, int w, int h); /* label functions */ @@ -186,13 +187,13 @@ extern GUIItem *gui_label_new (char *text, int x, int y); /* entry functions */ #define GUI_ENTRY_T(_item_) ((GUIEntry*)(_item_)->data) extern void gui_entry_draw (GUIItem *item); -extern void gui_entry_event (GUIItem *item, GUIEvent *event); +extern int gui_entry_event (GUIItem *item, GUIEvent *event); extern GUIItem *gui_entry_new (char *text, int x, int y, int w, int h); /* list functions */ #define GUI_LIST_T(_item_) ((GUIList*)(_item_)->data) extern void gui_list_draw (GUIItem *item); -extern void gui_list_event (GUIItem *item, GUIEvent *event); +extern int gui_list_event (GUIItem *item, GUIEvent *event); extern void gui_list_setselect (GUIItem *item); extern GUIItem *gui_list_new (int x, int y, int w, int h); diff --git a/gui/gui_button.c b/gui/gui_button.c index bc95e0c..f022c25 100644 --- a/gui/gui_button.c +++ b/gui/gui_button.c @@ -1,4 +1,4 @@ -/* $Id: gui_button.c,v 1.7 2013/03/06 23:27:25 steffen Exp $ */ +/* $Id: gui_button.c,v 1.8 2013/03/10 00:09:40 steffen Exp $ */ /*************************************************************************** * gui_button.c * @@ -78,7 +78,7 @@ GUIItem *gui_button_new (char *caption, int x, int y, int w, int h) { }; -void gui_button_event (GUIItem *item, GUIEvent *event) { +int gui_button_event (GUIItem *item, GUIEvent *event) { GUIButton *button = NULL; if (item == NULL || item->type != GUI_BUTTON) { @@ -91,5 +91,7 @@ void gui_button_event (GUIItem *item, GUIEvent *event) { gui_set_focus (item); button->callback_clicked (event->mousepos.x-item->x, event->mousepos.y-item->y); } + + return 1; }; diff --git a/gui/gui_entry.c b/gui/gui_entry.c index c36f1f2..ec607c2 100644 --- a/gui/gui_entry.c +++ b/gui/gui_entry.c @@ -1,4 +1,4 @@ -/* $Id: gui_entry.c,v 1.10 2013/03/06 23:27:25 steffen Exp $ */ +/* $Id: gui_entry.c,v 1.11 2013/03/10 00:09:40 steffen Exp $ */ /*************************************************************************** * gui_entry.c * @@ -70,7 +70,7 @@ void gui_entry_draw (GUIItem *item) { /* * event handling */ -void gui_entry_event (GUIItem *item, GUIEvent *event) { +int gui_entry_event (GUIItem *item, GUIEvent *event) { char text1[GUI_TEXTLEN]; char text2[GUI_TEXTLEN]; GUIEntry *entry = NULL; @@ -123,7 +123,7 @@ void gui_entry_event (GUIItem *item, GUIEvent *event) { } } currentwin->screen_changed = 1; - return; + return 1; }; diff --git a/gui/gui_list.c b/gui/gui_list.c index 890c092..21d3490 100644 --- a/gui/gui_list.c +++ b/gui/gui_list.c @@ -1,4 +1,4 @@ -/* $Id: gui_list.c,v 1.6 2013/03/06 23:27:25 steffen Exp $ */ +/* $Id: gui_list.c,v 1.7 2013/03/10 00:09:40 steffen Exp $ */ /*************************************************************************** * gui_list.c * @@ -80,13 +80,13 @@ void gui_list_draw (GUIItem *item) { /* * event handling */ -void gui_list_event (GUIItem *item, GUIEvent *event) { +int gui_list_event (GUIItem *item, GUIEvent *event) { int x = event->mousepos.x - item->x; int y = event->mousepos.y - item->y; int i; GUIList *list = NULL; - if (item == NULL) return; + if (item == NULL) return 0; else list = (GUIList *) item->data; /* set focus */ @@ -104,6 +104,8 @@ void gui_list_event (GUIItem *item, GUIEvent *event) { } currentwin->screen_changed = 1; draw (); + + return 1; }; diff --git a/gui/gui_softkeyboard.c b/gui/gui_softkeyboard.c index 33da5d8..e6f37b0 100644 --- a/gui/gui_softkeyboard.c +++ b/gui/gui_softkeyboard.c @@ -1,4 +1,4 @@ -/* $Id: gui_softkeyboard.c,v 1.2 2013/03/09 00:02:30 steffen Exp $ */ +/* $Id: gui_softkeyboard.c,v 1.3 2013/03/10 00:09:40 steffen Exp $ */ /*************************************************************************** * gui_softkeyboard.c * @@ -119,3 +119,8 @@ void gui_softkeyb_draw () { /* draw the last keys */ }; + + +int gui_softkeyb_event (GUIEvent event) { + return 0; +};