diff src/textbuf_gui.h @ 8737:b62e473a9029 draft

(svn r12425) -Feature [FS#1846]: On Screen Keyboard for input fields so someone without a keyboard can enter text too. Patch by Dominik.
author rubidium <rubidium@openttd.org>
date Wed, 26 Mar 2008 10:08:17 +0000 (2008-03-26)
parents 6385dffc0b37
children 3b7b689031d6
line wrap: on
line diff
--- a/src/textbuf_gui.h
+++ b/src/textbuf_gui.h
@@ -7,6 +7,7 @@
 
 #include "window_type.h"
 #include "string_type.h"
+#include "strings_type.h"
 
 struct Textbuf {
 	char *buf;                  ///< buffer in which text is saved
@@ -26,6 +27,8 @@
 };
 assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(querystr_d));
 
+extern char _edit_str_buf[64];
+extern char _orig_str_buf[lengthof(_edit_str_buf)];
 
 void DrawEditBox(Window *w, querystr_d *string, int wid);
 void HandleEditBox(Window *w, querystr_d *string, int wid);
@@ -43,4 +46,16 @@
 void ShowQueryString(StringID str, StringID caption, uint maxlen, uint maxwidth, Window *parent, CharSetFilter afilter);
 void ShowQuery(StringID caption, StringID message, Window *w, void (*callback)(Window*, bool));
 
+/** The number of 'characters' on the on-screen keyboard. */
+static const uint OSK_KEYBOARD_ENTRIES = 50;
+
+/**
+ * The number of characters has to be OSK_KEYBOARD_ENTRIES. However, these
+ * have to be UTF-8 encoded, which means up to 4 bytes per character.
+ * Furthermore the string needs to be '\0'-terminated.
+ */
+extern char _keyboard_opt[2][OSK_KEYBOARD_ENTRIES * 4 + 1];
+
+void ShowOnScreenKeyboard(Window *parent, querystr_d *q, int button, int cancel, int ok);
+
 #endif /* TEXTBUF_GUI_H */