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_button.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_button.c')
-rw-r--r-- | textscreen/txt_button.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/textscreen/txt_button.c b/textscreen/txt_button.c index 8b8e704b..26e148b0 100644 --- a/textscreen/txt_button.c +++ b/textscreen/txt_button.c @@ -64,12 +64,25 @@ static int TXT_ButtonKeyPress(TXT_UNCAST_ARG(button), int key) return 0; } +static void TXT_ButtonMousePress(TXT_UNCAST_ARG(button), int x, int y, int b) +{ + TXT_CAST_ARG(txt_button_t, button); + + if (b == TXT_MOUSE_LEFT) + { + // Equivalent to pressing enter + + TXT_ButtonKeyPress(button, KEY_ENTER); + } +} + txt_widget_class_t txt_button_class = { TXT_ButtonSizeCalc, TXT_ButtonDrawer, TXT_ButtonKeyPress, TXT_ButtonDestructor, + TXT_ButtonMousePress, }; txt_button_t *TXT_NewButton(char *label) |