equal
deleted
inserted
replaced
5 #ifndef TEXTBUF_GUI_H |
5 #ifndef TEXTBUF_GUI_H |
6 #define TEXTBUF_GUI_H |
6 #define TEXTBUF_GUI_H |
7 |
7 |
8 #include "window_type.h" |
8 #include "window_type.h" |
9 #include "string_type.h" |
9 #include "string_type.h" |
|
10 #include "strings_type.h" |
10 |
11 |
11 struct Textbuf { |
12 struct Textbuf { |
12 char *buf; ///< buffer in which text is saved |
13 char *buf; ///< buffer in which text is saved |
13 uint16 maxlength, maxwidth; ///< the maximum size of the buffer. Maxwidth specifies screensize in pixels, maxlength is in bytes |
14 uint16 maxlength, maxwidth; ///< the maximum size of the buffer. Maxwidth specifies screensize in pixels, maxlength is in bytes |
14 uint16 length, width; ///< the current size of the string. Width specifies screensize in pixels, length is in bytes |
15 uint16 length, width; ///< the current size of the string. Width specifies screensize in pixels, length is in bytes |
24 CharSetFilter afilter; |
25 CharSetFilter afilter; |
25 bool handled; |
26 bool handled; |
26 }; |
27 }; |
27 assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(querystr_d)); |
28 assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(querystr_d)); |
28 |
29 |
|
30 extern char _edit_str_buf[64]; |
|
31 extern char _orig_str_buf[lengthof(_edit_str_buf)]; |
29 |
32 |
30 void DrawEditBox(Window *w, querystr_d *string, int wid); |
33 void DrawEditBox(Window *w, querystr_d *string, int wid); |
31 void HandleEditBox(Window *w, querystr_d *string, int wid); |
34 void HandleEditBox(Window *w, querystr_d *string, int wid); |
32 int HandleEditBoxKey(Window *w, querystr_d *string, int wid, WindowEvent *we); |
35 int HandleEditBoxKey(Window *w, querystr_d *string, int wid, WindowEvent *we); |
33 bool HandleCaret(Textbuf *tb); |
36 bool HandleCaret(Textbuf *tb); |
41 void UpdateTextBufferSize(Textbuf *tb); |
44 void UpdateTextBufferSize(Textbuf *tb); |
42 |
45 |
43 void ShowQueryString(StringID str, StringID caption, uint maxlen, uint maxwidth, Window *parent, CharSetFilter afilter); |
46 void ShowQueryString(StringID str, StringID caption, uint maxlen, uint maxwidth, Window *parent, CharSetFilter afilter); |
44 void ShowQuery(StringID caption, StringID message, Window *w, void (*callback)(Window*, bool)); |
47 void ShowQuery(StringID caption, StringID message, Window *w, void (*callback)(Window*, bool)); |
45 |
48 |
|
49 /** The number of 'characters' on the on-screen keyboard. */ |
|
50 static const uint OSK_KEYBOARD_ENTRIES = 50; |
|
51 |
|
52 /** |
|
53 * The number of characters has to be OSK_KEYBOARD_ENTRIES. However, these |
|
54 * have to be UTF-8 encoded, which means up to 4 bytes per character. |
|
55 * Furthermore the string needs to be '\0'-terminated. |
|
56 */ |
|
57 extern char _keyboard_opt[2][OSK_KEYBOARD_ENTRIES * 4 + 1]; |
|
58 |
|
59 void ShowOnScreenKeyboard(Window *parent, querystr_d *q, int button, int cancel, int ok); |
|
60 |
46 #endif /* TEXTBUF_GUI_H */ |
61 #endif /* TEXTBUF_GUI_H */ |