diff options
author | Simon Howard | 2006-06-02 20:14:39 +0000 |
---|---|---|
committer | Simon Howard | 2006-06-02 20:14:39 +0000 |
commit | ef92ce016e328c1270597f2f1627c72bc3490d64 (patch) | |
tree | 0a487dc17f613bd7deeecd7c931d02c19834808f /textscreen/txt_checkbox.c | |
parent | a990e948564aa96f95dc5c692e512a68fd48852e (diff) | |
download | chocolate-doom-ef92ce016e328c1270597f2f1627c72bc3490d64.tar.gz chocolate-doom-ef92ce016e328c1270597f2f1627c72bc3490d64.tar.bz2 chocolate-doom-ef92ce016e328c1270597f2f1627c72bc3490d64.zip |
Make mouse button presses on widgets actually do useful things
Subversion-branch: /trunk/chocolate-doom
Subversion-revision: 553
Diffstat (limited to 'textscreen/txt_checkbox.c')
-rw-r--r-- | textscreen/txt_checkbox.c | 13 |
1 files changed, 13 insertions, 0 deletions
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) |