From 1cab6b20ac5939589c6d199e05e53f4c8c4c7708 Mon Sep 17 00:00:00 2001 From: steffen Date: Fri, 29 Mar 2013 00:14:55 +0000 Subject: [PATCH] fixed checkbox.. --- gui/gui.c | 3 +-- gui/gui.h | 3 +++ gui/gui_checkbox.c | 7 ++++--- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/gui/gui.c b/gui/gui.c index 9933623..5e68a5e 100644 --- a/gui/gui.c +++ b/gui/gui.c @@ -1,4 +1,4 @@ -/* $Id: gui.c,v 1.21 2013/03/11 23:08:39 steffen Exp $ */ +/* $Id: gui.c,v 1.22 2013/03/29 00:14:55 steffen Exp $ */ /*************************************************************************** * gui.c * @@ -29,7 +29,6 @@ GUIWindow *currentwin = NULL; -#define GUI_ITEM_IS_INSIDE(__item__,__pos__) gui_is_inside(__item__->x, __item__->y, __item__->w, __item__->h, __pos__) int gui_is_inside (int x, int y, int w, int h, iPoint pos) { if (x <= pos.x && x+w >= pos.x && y <= pos.y && y+h >= pos.y) return 1; else return 0; diff --git a/gui/gui.h b/gui/gui.h index c206c91..58895ed 100644 --- a/gui/gui.h +++ b/gui/gui.h @@ -167,6 +167,9 @@ extern int gui_event (GUIEvent event); extern void gui_event_addmousepos (GUIEvent *event, iPoint pos, int neg); extern void gui_set_focus (GUIItem *item); +#define GUI_ITEM_IS_INSIDE(__item__,__pos__) gui_is_inside(__item__->x, __item__->y, __item__->w, __item__->h, __pos__) +extern int gui_is_inside (int x, int y, int w, int h, iPoint pos); + extern void gui_window_new (GUIWindow *win, int w, int h, char *title); extern void gui_window_close (GUIWindow *win); extern void gui_window_item_add (GUIWindow *win, GUIItem *item); diff --git a/gui/gui_checkbox.c b/gui/gui_checkbox.c index f797f8f..82666b1 100644 --- a/gui/gui_checkbox.c +++ b/gui/gui_checkbox.c @@ -1,4 +1,4 @@ -/* $Id: gui_checkbox.c,v 1.1 2013/03/10 23:32:28 steffen Exp $ */ +/* $Id: gui_checkbox.c,v 1.2 2013/03/29 00:14:55 steffen Exp $ */ /*************************************************************************** * gui_checkbox.c * @@ -58,8 +58,8 @@ GUIItem *gui_checkbox_new (char *text, int initialvalue, int x, int y) { else strncpy (checkbox->text, text, GUI_TEXTLEN); item->x = x; item->y = y; - item->w = x + 15; - item->y = y + 15; + item->w = 15; + item->h = 15; checkbox->checked = initialvalue; checkbox->callback_changed = NULL; @@ -78,6 +78,7 @@ int gui_checkbox_event (GUIItem *item, GUIEvent *event) { errorexit (-1); } + d_printf ("checkbox:%s %d,%d,%d,%d %d,%d", checkbox->text, item->x, item->y, item->w, item->h, event->mousepos.x, event->mousepos.y); if (event->event == EGUI_MOUSEPRESSED) { checkbox->checked = !checkbox->checked; if (checkbox->callback_changed != NULL) {