summaryrefslogtreecommitdiff
path: root/textscreen/txt_inputbox.c
diff options
context:
space:
mode:
authorSimon Howard2006-06-02 20:14:39 +0000
committerSimon Howard2006-06-02 20:14:39 +0000
commitef92ce016e328c1270597f2f1627c72bc3490d64 (patch)
tree0a487dc17f613bd7deeecd7c931d02c19834808f /textscreen/txt_inputbox.c
parenta990e948564aa96f95dc5c692e512a68fd48852e (diff)
downloadchocolate-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_inputbox.c')
-rw-r--r--textscreen/txt_inputbox.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/textscreen/txt_inputbox.c b/textscreen/txt_inputbox.c
index cb7bf4fa..59d62da3 100644
--- a/textscreen/txt_inputbox.c
+++ b/textscreen/txt_inputbox.c
@@ -188,12 +188,31 @@ static int TXT_IntInputBoxKeyPress(TXT_UNCAST_ARG(inputbox), int key)
return 1;
}
+static void TXT_InputBoxMousePress(TXT_UNCAST_ARG(inputbox),
+ int x, int y, int b)
+{
+ TXT_CAST_ARG(txt_inputbox_t, inputbox);
+
+ if (b == TXT_MOUSE_LEFT)
+ {
+ // Make mouse clicks start editing the box
+
+ if (!inputbox->editing)
+ {
+ // Send a simulated keypress to start editing
+
+ TXT_WidgetKeyPress(inputbox, KEY_ENTER);
+ }
+ }
+}
+
txt_widget_class_t txt_inputbox_class =
{
TXT_InputBoxSizeCalc,
TXT_InputBoxDrawer,
TXT_InputBoxKeyPress,
TXT_InputBoxDestructor,
+ TXT_InputBoxMousePress,
};
txt_widget_class_t txt_int_inputbox_class =
@@ -202,6 +221,7 @@ txt_widget_class_t txt_int_inputbox_class =
TXT_InputBoxDrawer,
TXT_IntInputBoxKeyPress,
TXT_InputBoxDestructor,
+ TXT_InputBoxMousePress,
};
static void SetBufferFromValue(txt_inputbox_t *inputbox)