From ef92ce016e328c1270597f2f1627c72bc3490d64 Mon Sep 17 00:00:00 2001 From: Simon Howard Date: Fri, 2 Jun 2006 20:14:39 +0000 Subject: Make mouse button presses on widgets actually do useful things Subversion-branch: /trunk/chocolate-doom Subversion-revision: 553 --- textscreen/txt_checkbox.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'textscreen/txt_checkbox.c') diff --git a/textscreen/txt_checkbox.c b/textscreen/txt_checkbox.c index d32a240c..cde095a8 100644 --- a/textscreen/txt_checkbox.c +++ b/textscreen/txt_checkbox.c @@ -82,12 +82,25 @@ static int TXT_CheckBoxKeyPress(TXT_UNCAST_ARG(checkbox), int key) return 0; } +static void TXT_CheckBoxMousePress(TXT_UNCAST_ARG(checkbox), int x, int y, int b) +{ + TXT_CAST_ARG(txt_checkbox_t, checkbox); + + if (b == TXT_MOUSE_LEFT) + { + // Equivalent to pressing enter + + TXT_CheckBoxKeyPress(checkbox, KEY_ENTER); + } +} + txt_widget_class_t txt_checkbox_class = { TXT_CheckBoxSizeCalc, TXT_CheckBoxDrawer, TXT_CheckBoxKeyPress, TXT_CheckBoxDestructor, + TXT_CheckBoxMousePress, }; txt_checkbox_t *TXT_NewCheckBox(char *label, int *variable) -- cgit v1.2.3