diff options
author | Dave Davenport <qball@gmpclient.org> | 2016-01-09 16:22:09 +0100 |
---|---|---|
committer | Dave Davenport <qball@gmpclient.org> | 2016-01-09 16:22:09 +0100 |
commit | d7dab65e5b89f2a223fba00c62accee2d5313609 (patch) | |
tree | b1eb366a352f7ff07672c09d351fb98986fe367a /source/widget.c | |
parent | 06c7f30b7e39775698ab241583adb0b23d4ac4bd (diff) |
Making widget class, moving stuff around
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; + } + +} |