#define DG_BUFFERED 0
#define DG_DIRECT 1
-#define GADGET_DEACTIVATED(g) ((g)->x < 0 || (g)->y < 0)
-
#define OPTION_TEXT_SELECTABLE(g, t) \
(t[0] != g->selectbox.char_unselectable && \
t[0] != '\0' && \
int state = (pressed ? GD_BUTTON_PRESSED : GD_BUTTON_UNPRESSED);
boolean redraw_selectbox = FALSE;
- if (gi == NULL)
+ if (gi == NULL || gi->deactivated)
return;
gd = (!gi->active ? &gi->alt_design[state] :
{
int tag = first_tag;
- if (gi == NULL)
+ if (gi == NULL || gi->deactivated)
return;
while (tag != GDI_END)
tag = va_arg(ap, int); /* read next tag */
}
- /* check if gadget is complete */
+ gi->deactivated = FALSE;
+
+ /* check if gadget has undefined bitmaps */
if (gi->type != GD_TYPE_DRAWING_AREA &&
- (!gi->design[GD_BUTTON_UNPRESSED].bitmap ||
- !gi->design[GD_BUTTON_PRESSED].bitmap))
- Error(ERR_EXIT, "gadget incomplete (missing Bitmap)");
+ (gi->design[GD_BUTTON_UNPRESSED].bitmap == NULL ||
+ gi->design[GD_BUTTON_PRESSED].bitmap == NULL))
+ gi->deactivated = TRUE;
+
+ /* check if gadget is placed off-screen */
+ if (gi->x < 0 || gi->y < 0)
+ gi->deactivated = TRUE;
/* adjust gadget values in relation to other gadget values */
void RedrawGadget(struct GadgetInfo *gi)
{
- if (gi == NULL)
+ if (gi == NULL || gi->deactivated)
return;
if (gi->mapped)
static void MapGadgetExt(struct GadgetInfo *gi, boolean redraw)
{
- if (gi == NULL || gi->mapped || GADGET_DEACTIVATED(gi))
+ if (gi == NULL || gi->deactivated || gi->mapped)
return;
gi->mapped = TRUE;
void UnmapGadget(struct GadgetInfo *gi)
{
- if (gi == NULL || !gi->mapped)
+ if (gi == NULL || gi->deactivated || !gi->mapped)
return;
gi->mapped = FALSE;
{
struct GadgetInfo *gi = last_gi;
- if (gi == NULL || !gi->mapped ||
+ if (gi == NULL || gi->deactivated || !gi->mapped ||
!(gi->type & GD_TYPE_TEXT_INPUT ||
gi->type & GD_TYPE_TEXT_AREA ||
gi->type & GD_TYPE_SELECTBOX))