From 1f2310937e195ddab098bd866b171d7e4347fd11 Mon Sep 17 00:00:00 2001 From: steffen Date: Wed, 27 Feb 2013 22:21:35 +0000 Subject: [PATCH] gui events and items changed.. --- gui/gui.c | 18 +++++++------- gui/gui.h | 5 ++++ gui/gui_button.c | 6 +++-- gui/gui_entry.c | 35 +++++++++++++++++---------- gui/gui_label.c | 22 ++++++++++------- gui/gui_list.c | 5 ++-- gui/gui_window.c | 3 ++- main/gui_buttons.c | 54 +++++++++++++++++++++--------------------- main/gui_config.c | 14 +++++------ main/gui_favorites.c | 56 ++++++++++++++++++++++---------------------- main/gui_mainmenu.c | 44 +++++++++++++++++----------------- 11 files changed, 143 insertions(+), 119 deletions(-) diff --git a/gui/gui.c b/gui/gui.c index f195e4e..43a6754 100644 --- a/gui/gui.c +++ b/gui/gui.c @@ -1,4 +1,4 @@ -/* $Id: gui.c,v 1.11 2013/02/26 22:13:04 steffen Exp $ */ +/* $Id: gui.c,v 1.12 2013/02/27 22:21:35 steffen Exp $ */ /*************************************************************************** * gui.c * @@ -75,7 +75,7 @@ void gui_draw () { currentwin->screen_changed = 1; } -// d_printf ("GUI draw: %p %s screen:%p(changed:%d) pos: %d,%d size:%d,%d", currentwin, currentwin->title, currentwin->screen, currentwin->screen_changed, currentwin->x, currentwin->y, currentwin->w, currentwin->h); + // d_printf ("GUI draw: %p %s screen:%p(changed:%d) pos: %d,%d size:%d,%d", currentwin, currentwin->title, currentwin->screen, currentwin->screen_changed, currentwin->x, currentwin->y, currentwin->w, currentwin->h); if (currentwin && (currentwin->screen_changed || now-1 > lastupdate || now < lastupdate)) { lastupdate = now; if ((currentwin->style & WGUI_S_NOTITLE) == WGUI_S_NOTITLE) { @@ -157,24 +157,24 @@ int gui_event (GUIEvent event) { if (GUI_ITEM_IS_INSIDE (currentwin->items[i], winpos)) item = currentwin->items[i]; - d_printf ("%p", item); + d_printf ("item:%p , type:%d , focus:%p", item, item ? item->type : -1, currentwin->focus); if (item) switch (item->type) { - case (GUI_ENTRY): + case (GUI_BUTTON): gui_event_addmousepos (&event, winpos, -1); gui_button_event (item, &event); - event_called = 1; + event_called = 0; return 1; break; - case (GUI_BUTTON): + case (GUI_ENTRY): gui_event_addmousepos (&event, winpos, -1); gui_entry_event (item, &event); - event_called = 1; + event_called = 0; return 1; break; case (GUI_LIST): gui_list_event (item, &event); - event_called = 1; + event_called = 0; return 1; break; default: @@ -183,7 +183,7 @@ int gui_event (GUIEvent event) { } /* no gui active nor any window is responsible.. */ -// d_printf ("no event.."); + d_printf ("no event.."); switch (event.event) { case (EGUI_MOUSERELEASED): draw_mousebtnup (event.mousepos.x, event.mousepos.y, event.mousebtn); diff --git a/gui/gui.h b/gui/gui.h index 28f4264..2f8c5e5 100644 --- a/gui/gui.h +++ b/gui/gui.h @@ -147,20 +147,24 @@ extern void gui_window_close (GUIWindow *win); extern void gui_window_item_add (GUIWindow *win, GUIItem *item); /* 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 GUIItem *gui_button_new (char *name, int x, int y, int w, int h); /* label functions */ +#define GUI_LABEL_T(_item_) ((GUILabel*)(_item_)->data) extern void gui_label_draw (GUIItem *item); 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 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 void gui_list_setselect (GUIItem *item); @@ -173,6 +177,7 @@ extern void gui_search_show (); extern void gui_fav_show (); extern void gui_mainmenu_show (); extern void gui_buttons_show (); +extern void gui_config_show (); extern void gpswin_show (); #endif diff --git a/gui/gui_button.c b/gui/gui_button.c index 7d109d1..af54076 100644 --- a/gui/gui_button.c +++ b/gui/gui_button.c @@ -1,4 +1,4 @@ -/* $Id: gui_button.c,v 1.5 2013/02/26 22:13:04 steffen Exp $ */ +/* $Id: gui_button.c,v 1.6 2013/02/27 22:21:35 steffen Exp $ */ /*************************************************************************** * gui_button.c * @@ -44,7 +44,8 @@ void gui_button_draw (GUIItem *item) { ls.width = 1.0; ls.c = ls.borderc = color[COLOR_white][3]; - +// d_printf ("gui_button_draw \"%s\" %d,%d,%d,%d", button->caption, item->x, item->y, item->w, item->h); + draw_polygonstart (); draw_polygonadd (item->x, item->y); draw_polygonadd (item->x, item->y + item->h); @@ -67,6 +68,7 @@ GUIItem *gui_button_new (char *caption, int x, int y, int w, int h) { item->y = y; item->w = w; item->h = h; + item->type = GUI_BUTTON; button->col = &color[COLOR_white][1]; button->textcol = &color[COLOR_white][3]; button->callback_clicked = NULL; diff --git a/gui/gui_entry.c b/gui/gui_entry.c index b24c998..cd8d5f2 100644 --- a/gui/gui_entry.c +++ b/gui/gui_entry.c @@ -1,4 +1,4 @@ -/* $Id: gui_entry.c,v 1.5 2013/02/26 23:33:27 steffen Exp $ */ +/* $Id: gui_entry.c,v 1.6 2013/02/27 22:21:35 steffen Exp $ */ /*************************************************************************** * gui_entry.c * @@ -35,7 +35,9 @@ void gui_entry_draw (GUIItem *item) { char text1[GUI_TEXTLEN]; char text2[GUI_TEXTLEN]; struct line_style ls; - GUIEntry *entry; + GUIEntry *entry = NULL; + + if (item) entry = (GUIEntry *) item->data; ls.width = 1.0; if (currentwin->focus == (void*) item) @@ -58,23 +60,26 @@ void gui_entry_draw (GUIItem *item) { strncpy (text2, entry->text, entry->curpos); snprintf (text1, GUI_TEXTLEN, "%s|%s", text2, entry->text+entry->curpos); } - gfx_draw_text (currentwin->screen, entry->x+2, entry->y, text1, &color[COLOR_white][3]); + gfx_draw_text (currentwin->screen, item->x+2, item->y, text1, &color[COLOR_white][3]); }; /* * event handling */ -void gui_entry_event (GUIEntry *entry, GUIEvent *event) { +void gui_entry_event (GUIItem *item, GUIEvent *event) { char text1[GUI_TEXTLEN]; + GUIEntry *entry = NULL; + + if (item) entry = (GUIEntry *) item->data; d_printf ("event: %d pos: %d,%d", event->event, event->mousepos.x, event->mousepos.y); if (event->event == EGUI_MOUSERELEASED - && event->mousepos.x >= 0 && entry->x+entry->w >= event->mousepos.x - && event->mousepos.y >= 0 && entry->y+entry->h >= event->mousepos.y) { + && event->mousepos.x < item->x && item->x+item->w >= event->mousepos.x + && event->mousepos.y < item->y && item->y+item->h >= event->mousepos.y) { d_printf ("gui_entry_event set focus"); - currentwin->focus = entry; + currentwin->focus = item; } else if (event->event == EGUI_KEYRELEASED) { @@ -113,17 +118,21 @@ void gui_entry_event (GUIEntry *entry, GUIEvent *event) { }; -GUIEntry *gui_entry_new (char *text, int x, int y, int w, int h) { - GUIEntry *item = (GUIEntry*) ml_malloc (sizeof (GUIEntry)); +GUIItem *gui_entry_new (char *text, int x, int y, int w, int h) { + GUIItem *item = (GUIItem*) ml_malloc (sizeof (GUIItem) + sizeof (GUIEntry) + POINTERALIGNMENT); + GUIEntry *entry = NULL; - if (text == NULL) item->text[0] = 0; - else strncpy (item->text, text, GUI_TEXTLEN); + if (item) entry = (GUIEntry *) item->data; + + if (text == NULL) entry->text[0] = 0; + else strncpy (entry->text, text, GUI_TEXTLEN); item->x = x; item->y = y; item->w = w; item->h = h; - item->callback_changed = NULL; - item->callback_enter = NULL; + item->type = GUI_ENTRY; + entry->callback_changed = NULL; + entry->callback_enter = NULL; return item; }; diff --git a/gui/gui_label.c b/gui/gui_label.c index 215efd2..c9f739b 100644 --- a/gui/gui_label.c +++ b/gui/gui_label.c @@ -1,4 +1,4 @@ -/* $Id: gui_label.c,v 1.2 2013/02/21 23:07:19 steffen Exp $ */ +/* $Id: gui_label.c,v 1.3 2013/02/27 22:21:35 steffen Exp $ */ /*************************************************************************** * gui_label.c * @@ -32,24 +32,30 @@ /**************************************************************************** * label */ -void gui_label_draw (GUILabel *label) { +void gui_label_draw (GUIItem *item) { + GUILabel *label = NULL; + if (item) label = (GUILabel*) item->data; + struct line_style ls; ls.width = 1.0; ls.c = ls.borderc = color[COLOR_white][3]; - gfx_draw_text (currentwin->screen, label->x, label->y, label->text, label->textcol); + gfx_draw_text (currentwin->screen, item->x, item->y, label->text, label->textcol); }; -GUILabel *gui_label_new (char *text, int x, int y) { - GUILabel *item = (GUILabel*) ml_malloc (sizeof (GUILabel)); +GUIItem *gui_label_new (char *text, int x, int y) { + GUIItem *item = (GUIItem*) ml_malloc (sizeof (GUILabel) + sizeof (GUIItem) + POINTERALIGNMENT); + GUILabel *label = NULL; + if (item) label = (GUILabel*) item->data; - if (text == NULL) item->text[0] = 0; - else strncpy (item->text, text, GUI_TEXTLEN); + if (text == NULL) label->text[0] = 0; + else strncpy (label->text, text, GUI_TEXTLEN); item->x = x; item->y = y; - item->textcol = &color[COLOR_white][2]; + label->textcol = &color[COLOR_white][2]; + item->type = GUI_LABEL; return item; }; diff --git a/gui/gui_list.c b/gui/gui_list.c index 3837b01..e248869 100644 --- a/gui/gui_list.c +++ b/gui/gui_list.c @@ -1,4 +1,4 @@ -/* $Id: gui_list.c,v 1.4 2013/02/26 22:13:04 steffen Exp $ */ +/* $Id: gui_list.c,v 1.5 2013/02/27 22:21:35 steffen Exp $ */ /*************************************************************************** * gui_list.c * @@ -110,7 +110,8 @@ void gui_list_event (GUIItem *item, GUIEvent *event) { GUIItem *gui_list_new (int x, int y, int w, int h) { GUIItem *item = (GUIItem *) ml_malloc (sizeof (GUIList) + sizeof (GUIItem) + POINTERALIGNMENT); GUIList *list = (GUIList *) item->data; - + + item->type = GUI_LIST; item->x = x; item->y = y; item->w = w; diff --git a/gui/gui_window.c b/gui/gui_window.c index ccf30f9..05f80a2 100644 --- a/gui/gui_window.c +++ b/gui/gui_window.c @@ -1,4 +1,4 @@ -/* $Id: gui_window.c,v 1.5 2013/02/26 22:13:04 steffen Exp $ */ +/* $Id: gui_window.c,v 1.6 2013/02/27 22:21:35 steffen Exp $ */ /*************************************************************************** * gui_window.c * @@ -87,5 +87,6 @@ void gui_window_item_add (GUIWindow *win, GUIItem *item) { } win->items[ifree] = item; + d_printf ("gui_window_item_add win:%p ifree:%d item:%p", win, ifree, item); }; diff --git a/main/gui_buttons.c b/main/gui_buttons.c index 2d7f331..f247240 100644 --- a/main/gui_buttons.c +++ b/main/gui_buttons.c @@ -38,13 +38,13 @@ enum { static GUIWindow wbutton = {0}; -static GUIButton *btn_zoomin = NULL, - *btn_zoomout = NULL, - *btn_gps = NULL, - *btn_menu = NULL, - *btn_fav = NULL; +static GUIItem *btn_zoomin = NULL, + *btn_zoomout = NULL, + *btn_gps = NULL, + *btn_menu = NULL, + *btn_fav = NULL; void gui_buttons_closecallback (); -void gui_buttons_draw (GUIButton *btn); +void gui_buttons_draw (GUIItem *btn); void gui_buttons_zoomin(); void gui_buttons_zoomout(); void gui_buttons_gps(); @@ -60,41 +60,41 @@ void gui_buttons_show () { /* add buttons */ if (btn_zoomin == NULL) { btn_zoomin = gui_button_new (_("+"), 1, 1, 30, 30); - btn_zoomin->callback_clicked = (void*)gui_buttons_zoomin; - btn_zoomin->callback_draw = (void*)gui_buttons_draw; + GUI_BUTTON_T(btn_zoomin)->callback_clicked = (void*)gui_buttons_zoomin; + GUI_BUTTON_T(btn_zoomin)->func_draw = (void*)gui_buttons_draw; } if (btn_zoomout == NULL) { btn_zoomout = gui_button_new (_("-"), 41, 1, 30, 30); - btn_zoomout->callback_clicked = (void*)gui_buttons_zoomout; - btn_zoomout->callback_draw = (void*)gui_buttons_draw; + GUI_BUTTON_T(btn_zoomout)->callback_clicked = (void*)gui_buttons_zoomout; + GUI_BUTTON_T(btn_zoomout)->func_draw = (void*)gui_buttons_draw; } if (btn_gps == NULL) { btn_gps = gui_button_new (_("GPS"), 81, 1, 30, 30); - btn_gps->callback_clicked = (void*)gui_buttons_gps; - btn_gps->callback_draw = (void*)gui_buttons_draw; + GUI_BUTTON_T(btn_gps)->callback_clicked = (void*)gui_buttons_gps; + GUI_BUTTON_T(btn_gps)->func_draw = (void*)gui_buttons_draw; } if (btn_menu == NULL) { btn_menu = gui_button_new (_("M"), 121, 1, 30, 30); - btn_menu->callback_clicked = (void*)gui_buttons_menu; - btn_menu->callback_draw = (void*)gui_buttons_draw; + GUI_BUTTON_T(btn_menu)->callback_clicked = (void*)gui_buttons_menu; + GUI_BUTTON_T(btn_menu)->func_draw = (void*)gui_buttons_draw; } if (btn_fav == NULL) { btn_fav = gui_button_new (_("F"), 161, 1, 30, 30); - btn_fav->callback_clicked = (void*)gui_buttons_fav; - btn_fav->callback_draw = (void*)gui_buttons_draw; + GUI_BUTTON_T(btn_fav)->callback_clicked = (void*)gui_buttons_fav; + GUI_BUTTON_T(btn_fav)->func_draw = (void*)gui_buttons_draw; } if (wbutton.screen == NULL) { gui_window_new (&wbutton, 192, 32, NULL); - gui_window_item_add (&wbutton, GUI_BUTTON, btn_fav); - gui_window_item_add (&wbutton, GUI_BUTTON, btn_zoomin); - gui_window_item_add (&wbutton, GUI_BUTTON, btn_zoomout); - gui_window_item_add (&wbutton, GUI_BUTTON, btn_gps); - gui_window_item_add (&wbutton, GUI_BUTTON, btn_menu); + gui_window_item_add (&wbutton, btn_fav); + gui_window_item_add (&wbutton, btn_zoomin); + gui_window_item_add (&wbutton, btn_zoomout); + gui_window_item_add (&wbutton, btn_gps); + gui_window_item_add (&wbutton, btn_menu); } gui_show (&wbutton); @@ -108,15 +108,15 @@ void gui_buttons_closecallback () { }; -void gui_buttons_draw (GUIButton *btn) { +void gui_buttons_draw (GUIItem *btn) { int j; - + if (btn == btn_gps) { j = gps_isrunning (); - if (j == 0) btn->col = &color[COLOR_white][2]; - else if (j < 0) btn->col = &color[COLOR_red][2]; - else if (view_flags & DRAW_GPSFOLLOW) btn->col = &color[COLOR_green][3]; - else btn->col = &color[COLOR_green][2]; + if (j == 0) GUI_BUTTON_T(btn)->col = &color[COLOR_white][2]; + else if (j < 0) GUI_BUTTON_T(btn)->col = &color[COLOR_red][2]; + else if (view_flags & DRAW_GPSFOLLOW) GUI_BUTTON_T(btn)->col = &color[COLOR_green][3]; + else GUI_BUTTON_T(btn)->col = &color[COLOR_green][2]; } gui_button_draw (btn); diff --git a/main/gui_config.c b/main/gui_config.c index 58ec39b..cbf1c75 100644 --- a/main/gui_config.c +++ b/main/gui_config.c @@ -30,12 +30,12 @@ void gui_config_close (); GUIWindow wcfg = {0}; -GUIEntry *map_path = NULL; -GUIButton *map_seldir = NULL; -GUIEntry *gps_device = NULL; -GUIList *gps_list = NULL; -GUIButton *gps_file = NULL; -GUIButton *wcfg_close = NULL; +GUIItem *map_path = NULL; +GUIItem *map_seldir = NULL; +GUIItem *gps_device = NULL; +GUIItem *gps_list = NULL; +GUIItem *gps_file = NULL; +GUIItem *wcfg_close = NULL; void gui_config_show () { if (wcfg.screen == NULL) gui_window_new (&wcfg, 220, 240, _("Config")); @@ -45,7 +45,7 @@ void gui_config_show () { gui_show (&wcfg); if (map_path == NULL) map_path = gui_entry_new (NULL, 5, 30, 155, 20); - gui_window_item_add (&wcfg, GUI_ENTRY, map_path); + gui_window_item_add (&wcfg, map_path); }; diff --git a/main/gui_favorites.c b/main/gui_favorites.c index adda171..b065a40 100644 --- a/main/gui_favorites.c +++ b/main/gui_favorites.c @@ -39,12 +39,12 @@ void gui_fav_selitem (int nr); void gui_fav_fl_create (); void gui_fav_fl_free (); -GUIList *favlist = NULL; -GUIEntry *faventry_name = NULL; -GUIButton *favbtn_close = NULL; -GUIButton *favbtn_add = NULL; -GUIButton *favbtn_ren = NULL; -GUIButton *favbtn_del = NULL; +GUIItem *favlist = NULL; +GUIItem *faventry_name = NULL; +GUIItem *favbtn_close = NULL; +GUIItem *favbtn_add = NULL; +GUIItem *favbtn_ren = NULL; +GUIItem *favbtn_del = NULL; char **fl_array = NULL; // array to all elements int fl_array_cnt = 0; @@ -58,9 +58,9 @@ void gui_fav_close () { void gui_fav_add () { struct favorite f; - if (faventry_name->text[0] == 0) return; - d_printf ("gui_fav_add: '%s'", faventry_name->text); - strncpy (f.name, faventry_name->text, FAV_NAME_LEN); + if (GUI_ENTRY_T(faventry_name)->text[0] == 0) return; + d_printf ("gui_fav_add: '%s'", GUI_ENTRY_T(faventry_name)->text); + strncpy (f.name, GUI_ENTRY_T(faventry_name)->text, FAV_NAME_LEN); f.pos.lon = view_lon; f.pos.lat = view_lat; fav_add (-1, &f); @@ -69,28 +69,28 @@ void gui_fav_add () { void gui_fav_del () { - if (favlist->selected < 0) return; - fav_del (favlist->selected); + if (GUI_LIST_T(favlist)->selected < 0) return; + fav_del (GUI_LIST_T(favlist)->selected); gui_fav_refresh (); }; void gui_fav_ren () { - if (favlist->selected < 0 || faventry_name->text[0] == 0) return; - strncpy (favorites[favlist->selected].name, faventry_name->text, FAV_NAME_LEN); + if (GUI_LIST_T(favlist)->selected < 0 || GUI_ENTRY_T(faventry_name)->text[0] == 0) return; + strncpy (favorites[GUI_LIST_T(favlist)->selected].name, GUI_ENTRY_T(faventry_name)->text, FAV_NAME_LEN); gui_fav_refresh (); }; void gui_fav_selitem (int nr) { if (nr < favorites_cnt) { - strncpy (faventry_name->text, favorites[nr].name, GUI_TEXTLEN); + strncpy (GUI_ENTRY_T(faventry_name)->text, favorites[nr].name, GUI_TEXTLEN); view_lon = favorites[nr].pos.lon; view_lat = favorites[nr].pos.lat; gui_close (); draw_del_flag (DRAW_GPSFOLLOW); } - else faventry_name->text[0] = 0; + else GUI_ENTRY_T(faventry_name)->text[0] = 0; }; @@ -102,8 +102,8 @@ void gui_fav_callback_close () { void gui_fav_refresh () { gui_fav_fl_create (); - faventry_name->text[0] = 0; - favlist->data = fl_array; + GUI_ENTRY_T(faventry_name)->text[0] = 0; + GUI_LIST_T(favlist)->data = fl_array; }; @@ -142,38 +142,38 @@ void gui_fav_show () { /* favotires buttons */ if (favbtn_close == NULL) { favbtn_close = gui_button_new (_("Close"), 5, 210, 60, 20); - favbtn_close->callback_clicked = (void*)gui_fav_close; + GUI_BUTTON_T(favbtn_close)->callback_clicked = (void*)gui_fav_close; } if (favbtn_add == NULL) { favbtn_add = gui_button_new (_("Add"), 5, 15, 60, 20); - favbtn_add->callback_clicked = (void*)gui_fav_add; + GUI_BUTTON_T(favbtn_add)->callback_clicked = (void*)gui_fav_add; } if (favbtn_del == NULL) { favbtn_del = gui_button_new (_("Del"), 70, 15, 60, 20); - favbtn_del->callback_clicked = (void*)gui_fav_ren; + GUI_BUTTON_T(favbtn_del)->callback_clicked = (void*)gui_fav_ren; } if (favbtn_ren == NULL) { favbtn_ren = gui_button_new (_("Ren"), 135, 15, 60, 20); - favbtn_ren->callback_clicked = (void*)gui_fav_ren; + GUI_BUTTON_T(favbtn_ren)->callback_clicked = (void*)gui_fav_ren; } if (favlist == NULL) { favlist = gui_list_new (5, 45, 210, 130); - favlist->callback_selectitem = (void*)gui_fav_selitem; + GUI_LIST_T(favlist)->callback_selectitem = (void*)gui_fav_selitem; } if (faventry_name == NULL) { faventry_name = gui_entry_new (NULL, 5, 180, 210, 20); } - gui_window_item_add (&wfav, GUI_ENTRY, faventry_name); - gui_window_item_add (&wfav, GUI_LIST, favlist); - gui_window_item_add (&wfav, GUI_BUTTON, favbtn_ren); - gui_window_item_add (&wfav, GUI_BUTTON, favbtn_del); - gui_window_item_add (&wfav, GUI_BUTTON, favbtn_add); - gui_window_item_add (&wfav, GUI_BUTTON, favbtn_close); + gui_window_item_add (&wfav, faventry_name); + gui_window_item_add (&wfav, favlist); + gui_window_item_add (&wfav, favbtn_ren); + gui_window_item_add (&wfav, favbtn_del); + gui_window_item_add (&wfav, favbtn_add); + gui_window_item_add (&wfav, favbtn_close); gui_fav_refresh (); gui_show (&wfav); diff --git a/main/gui_mainmenu.c b/main/gui_mainmenu.c index 15b156a..17bdf17 100644 --- a/main/gui_mainmenu.c +++ b/main/gui_mainmenu.c @@ -1,4 +1,4 @@ -/* $Id: gui_mainmenu.c,v 1.8 2013/02/24 20:33:42 steffen Exp $ */ +/* $Id: gui_mainmenu.c,v 1.9 2013/02/27 22:21:35 steffen Exp $ */ /*************************************************************************** * gui_mainmenu.c * @@ -36,13 +36,13 @@ void gui_mainmenu_quit (); void gui_mainmenu_routing (); void gui_mainmenu_config (); -GUIButton *mbtn_close = NULL; -GUIButton *mbtn_quit = NULL; -GUIButton *mbtn_refreshidx = NULL; -GUIButton *mbtn_refresh = NULL; -GUIButton *mbtn_search = NULL; -GUIButton *mbtn_routing= NULL; -GUIButton *mbtn_config= NULL; +GUIItem *mbtn_close = NULL; +GUIItem *mbtn_quit = NULL; +GUIItem *mbtn_refreshidx = NULL; +GUIItem *mbtn_refresh = NULL; +GUIItem *mbtn_search = NULL; +GUIItem *mbtn_routing= NULL; +GUIItem *mbtn_config= NULL; static GUIWindow wmmenu = {0}; @@ -55,45 +55,45 @@ void gui_mainmenu_show () { /* add buttons */ if (mbtn_refresh == NULL) { mbtn_refresh = gui_button_new (_("Update Map"), 5, 30, 90, 20); - mbtn_refresh->callback_clicked = (void*)gui_mainmenu_refresh; + GUI_BUTTON_T(mbtn_refresh)->callback_clicked = (void*)gui_mainmenu_refresh; } - gui_window_item_add (&wmmenu, GUI_BUTTON, mbtn_refresh); + gui_window_item_add (&wmmenu, mbtn_refresh); if (mbtn_refreshidx == NULL) { mbtn_refreshidx = gui_button_new (_("Update Index"), 105, 30, 90, 20); - mbtn_refreshidx->callback_clicked = (void*)gui_mainmenu_refreshidx; + GUI_BUTTON_T(mbtn_refreshidx)->callback_clicked = (void*)gui_mainmenu_refreshidx; } - gui_window_item_add (&wmmenu, GUI_BUTTON, mbtn_refreshidx); + gui_window_item_add (&wmmenu, mbtn_refreshidx); if (mbtn_routing == NULL) { mbtn_routing = gui_button_new (_("Routing"), 5, 60, 190, 20); - mbtn_routing->callback_clicked = (void*)gui_mainmenu_routing; + GUI_BUTTON_T(mbtn_routing)->callback_clicked = (void*)gui_mainmenu_routing; } - gui_window_item_add (&wmmenu, GUI_BUTTON, mbtn_routing); + gui_window_item_add (&wmmenu, mbtn_routing); if (mbtn_search == NULL) { mbtn_search = gui_button_new (_("Search"), 5, 90, 190, 20); - mbtn_search->callback_clicked = (void*)gui_mainmenu_search; + GUI_BUTTON_T(mbtn_search)->callback_clicked = (void*)gui_mainmenu_search; } - gui_window_item_add (&wmmenu, GUI_BUTTON, mbtn_search); + gui_window_item_add (&wmmenu, mbtn_search); if (mbtn_config == NULL) { mbtn_config = gui_button_new (_("Config"), 5, 120, 130, 20); - mbtn_config->callback_clicked = (void*)gui_mainmenu_config; + GUI_BUTTON_T(mbtn_config)->callback_clicked = (void*)gui_mainmenu_config; } - gui_window_item_add (&wmmenu, GUI_BUTTON, mbtn_config); + gui_window_item_add (&wmmenu, mbtn_config); if (mbtn_quit == NULL) { mbtn_quit = gui_button_new (_("Quit"), 145, 120, 50, 20); - mbtn_quit->callback_clicked = (void*)gui_mainmenu_quit; + GUI_BUTTON_T(mbtn_quit)->callback_clicked = (void*)gui_mainmenu_quit; } - gui_window_item_add (&wmmenu, GUI_BUTTON, mbtn_quit); + gui_window_item_add (&wmmenu, mbtn_quit); if (mbtn_close == NULL) { mbtn_close = gui_button_new (_("Close"), 5, 155, 190, 20); - mbtn_close->callback_clicked = (void*)gui_mainmenu_close; + GUI_BUTTON_T(mbtn_close)->callback_clicked = (void*)gui_mainmenu_close; } - gui_window_item_add (&wmmenu, GUI_BUTTON, mbtn_close); + gui_window_item_add (&wmmenu, mbtn_close); gui_show (&wmmenu); };