return;
}
+static void DoGadgetCallbackAction(struct GadgetInfo *gi, boolean changed)
+{
+ if (changed || gi->callback_action_always)
+ gi->callback_action(gi);
+}
+
static void DrawGadget(struct GadgetInfo *gi, boolean pressed, boolean direct)
{
struct GadgetDesign *gd;
gi->direct_draw = (boolean)va_arg(ap, int);
break;
+ case GDI_CALLBACK_ACTION_ALWAYS:
+ gi->callback_action_always = (boolean)va_arg(ap, int);
+ break;
+
case GDI_CHECKED:
gi->checked = (boolean)va_arg(ap, int);
break;
gi->event.type = GD_EVENT_TEXT_LEAVING;
- if (gadget_changed && !(gi->type & GD_TYPE_SELECTBOX))
- gi->callback_action(gi);
+ if (!(gi->type & GD_TYPE_SELECTBOX))
+ DoGadgetCallbackAction(gi, gadget_changed);
last_gi = NULL;
gi->event.type = GD_EVENT_MOVING;
gi->event.off_borders = FALSE;
- if (gi->event_mask & GD_EVENT_MOVING && changed_position)
- gi->callback_action(gi);
+ if (gi->event_mask & GD_EVENT_MOVING)
+ DoGadgetCallbackAction(gi, changed_position);
return TRUE;
}
gi->event.type = GD_EVENT_MOVING;
gi->event.off_borders = gadget_moving_off_borders;
- if (gi->event_mask & GD_EVENT_MOVING && changed_position &&
+ if (gi->event_mask & GD_EVENT_MOVING &&
(gadget_moving_inside || gi->event_mask & GD_EVENT_OFF_BORDERS))
- gi->callback_action(gi);
+ DoGadgetCallbackAction(gi, changed_position);
}
if (gadget_released_inside)
gi->state = GD_BUTTON_UNPRESSED;
gi->event.type = GD_EVENT_RELEASED;
- if ((gi->event_mask & GD_EVENT_RELEASED) && gadget_changed)
- {
- gi->callback_action(gi);
- }
+ if ((gi->event_mask & GD_EVENT_RELEASED))
+ DoGadgetCallbackAction(gi, gadget_changed);
}
if (gadget_released_off_borders)
last_gi = NULL;
}
- if (gadget_changed)
- gi->callback_action(gi);
+ DoGadgetCallbackAction(gi, gadget_changed);
}
else if (gi->type & GD_TYPE_TEXT_INPUT) /* only valid for text input */
{
#define GDI_INFO_TEXT 48
#define GDI_ACTIVE 49
#define GDI_DIRECT_DRAW 50
+#define GDI_CALLBACK_ACTION_ALWAYS 51
/* gadget deactivation hack */
#define GDI_ACTIVE_POS(a) ((a) < 0 ? POS_OFFSCREEN : (a))
boolean mapped; /* gadget is mapped on the screen */
boolean active; /* gadget is active */
boolean direct_draw; /* directly draw to frontbuffer */
+ boolean callback_action_always; /* also callback if gadget unchanged */
int font; /* font to use when inactive */
int font_active; /* font to use when active */
int font_unselectable; /* font to use when unselectable */