2016-01-09 10:22:09 -05:00
|
|
|
#include <glib.h>
|
|
|
|
#include "widget.h"
|
|
|
|
|
2016-01-09 13:25:03 -05:00
|
|
|
int widget_intersect ( const Widget *widget, int x, int y )
|
2016-01-09 10:22:09 -05:00
|
|
|
{
|
2016-01-09 13:25:03 -05:00
|
|
|
if ( widget == NULL ) {
|
2016-01-09 10:22:09 -05:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( x >= ( widget->x ) && x < ( widget->x + widget->w ) ) {
|
|
|
|
if ( y >= ( widget->y ) && y < ( widget->y + widget->h ) ) {
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2016-01-09 13:25:03 -05:00
|
|
|
void widget_move ( Widget *widget, short x, short y )
|
2016-01-09 10:22:09 -05:00
|
|
|
{
|
2016-01-09 13:25:03 -05:00
|
|
|
if ( widget != NULL ) {
|
2016-01-09 10:22:09 -05:00
|
|
|
widget->x = x;
|
2016-01-09 13:25:03 -05:00
|
|
|
widget->y = y;
|
2016-01-09 10:22:09 -05:00
|
|
|
}
|
|
|
|
}
|
2016-06-26 09:48:12 -04:00
|
|
|
|
|
|
|
gboolean widget_enabled ( Widget *widget )
|
|
|
|
{
|
|
|
|
if ( widget != NULL ) {
|
|
|
|
return widget->enabled;
|
|
|
|
}
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
void widget_enable ( Widget *widget )
|
|
|
|
{
|
|
|
|
if ( widget ) {
|
|
|
|
widget->enabled = TRUE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
void widget_disable ( Widget *widget )
|
|
|
|
{
|
|
|
|
if ( widget ) {
|
|
|
|
widget->enabled = FALSE;
|
|
|
|
}
|
|
|
|
}
|