diff options
Diffstat (limited to 'source/widget.c')
-rw-r--r-- | source/widget.c | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/source/widget.c b/source/widget.c new file mode 100644 index 00000000..648462a5 --- /dev/null +++ b/source/widget.c @@ -0,0 +1,27 @@ +#include <glib.h> +#include "widget.h" + + +int widget_intersect ( const Widget *widget, int x, int y) +{ + if(widget == NULL ){ + return FALSE; + } + + if ( x >= ( widget->x ) && x < ( widget->x + widget->w ) ) { + if ( y >= ( widget->y ) && y < ( widget->y + widget->h ) ) { + return TRUE; + } + } + return FALSE; + +} + +void widget_move(Widget *widget, short x, short y) +{ + if ( widget != NULL ){ + widget->x = x; + widget->y = y; + } + +} |