summaryrefslogtreecommitdiff
path: root/textscreen/txt_button.c
diff options
context:
space:
mode:
Diffstat (limited to 'textscreen/txt_button.c')
-rw-r--r--textscreen/txt_button.c13
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)