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 #include "strings_type.h" |
|
11 #include "core/enum_type.hpp" |
11 |
12 |
12 struct Textbuf { |
13 struct Textbuf { |
13 char *buf; ///< buffer in which text is saved |
14 char *buf; ///< buffer in which text is saved |
14 uint16 maxlength, maxwidth; ///< the maximum size of the buffer. Maxwidth specifies screensize in pixels, maxlength is in bytes |
15 uint16 maxlength, maxwidth; ///< the maximum size of the buffer. Maxwidth specifies screensize in pixels, maxlength is in bytes |
15 uint16 length, width; ///< the current size of the string. Width specifies screensize in pixels, length is in bytes |
16 uint16 length, width; ///< the current size of the string. Width specifies screensize in pixels, length is in bytes |
26 bool InsertTextBufferClipboard(Textbuf *tb); |
27 bool InsertTextBufferClipboard(Textbuf *tb); |
27 bool MoveTextBufferPos(Textbuf *tb, int navmode); |
28 bool MoveTextBufferPos(Textbuf *tb, int navmode); |
28 void InitializeTextBuffer(Textbuf *tb, const char *buf, uint16 maxlength, uint16 maxwidth); |
29 void InitializeTextBuffer(Textbuf *tb, const char *buf, uint16 maxlength, uint16 maxwidth); |
29 void UpdateTextBufferSize(Textbuf *tb); |
30 void UpdateTextBufferSize(Textbuf *tb); |
30 |
31 |
|
32 /** Flags used in ShowQueryString() call */ |
|
33 enum QueryStringFlags { |
|
34 QSF_NONE = 0, |
|
35 QSF_ACCEPT_UNCHANGED = 0x01, ///< return success even when the text didn't change |
|
36 }; |
|
37 |
|
38 DECLARE_ENUM_AS_BIT_SET(QueryStringFlags) |
|
39 |
|
40 |
31 typedef void QueryCallbackProc(Window*, bool); |
41 typedef void QueryCallbackProc(Window*, bool); |
32 |
42 |
33 void ShowQueryString(StringID str, StringID caption, uint maxlen, uint maxwidth, Window *parent, CharSetFilter afilter); |
43 void ShowQueryString(StringID str, StringID caption, uint maxlen, uint maxwidth, Window *parent, CharSetFilter afilter, QueryStringFlags flags); |
34 void ShowQuery(StringID caption, StringID message, Window *w, QueryCallbackProc *callback); |
44 void ShowQuery(StringID caption, StringID message, Window *w, QueryCallbackProc *callback); |
35 |
45 |
36 /** The number of 'characters' on the on-screen keyboard. */ |
46 /** The number of 'characters' on the on-screen keyboard. */ |
37 static const uint OSK_KEYBOARD_ENTRIES = 50; |
47 static const uint OSK_KEYBOARD_ENTRIES = 50; |
38 |
48 |