diff options
author | rubidium <rubidium@openttd.org> | 2010-12-05 22:22:54 +0000 |
---|---|---|
committer | rubidium <rubidium@openttd.org> | 2010-12-05 22:22:54 +0000 |
commit | 66c7f00b607666df05849e66f6911dac9b426bd4 (patch) | |
tree | 173929763007a6333a78df6531c6120a9d01203f /src/textbuf_gui.h | |
parent | bbaa262b0db6cf3b9ba942e0d0018ea403224c09 (diff) | |
download | openttd-66c7f00b607666df05849e66f6911dac9b426bd4.tar.xz |
(svn r21407) -Codechange: prepare the text buffer code for limiting on number of characters besides the number of bytes
Diffstat (limited to 'src/textbuf_gui.h')
-rw-r--r-- | src/textbuf_gui.h | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/textbuf_gui.h b/src/textbuf_gui.h index 618eb4d4c..a5d65735b 100644 --- a/src/textbuf_gui.h +++ b/src/textbuf_gui.h @@ -21,8 +21,10 @@ struct Textbuf { char *buf; ///< buffer in which text is saved uint16 max_bytes; ///< the maximum size of the buffer in bytes (including terminating '\0') + uint16 max_chars; ///< the maximum size of the buffer in characters (including terminating '\0') uint16 max_pixels; ///< the maximum size of the buffer in pixels uint16 bytes; ///< the current size of the string in bytes (including terminating '\0') + uint16 chars; ///< the current size of the string in characters (including terminating '\0') uint16 pixels; ///< the current size of the string in pixels bool caret; ///< is the caret ("_") visible or not uint16 caretpos; ///< the current position of the caret in the buffer, in bytes @@ -37,6 +39,7 @@ bool InsertTextBufferChar(Textbuf *tb, uint32 key); bool InsertTextBufferClipboard(Textbuf *tb); bool MoveTextBufferPos(Textbuf *tb, int navmode); void InitializeTextBuffer(Textbuf *tb, char *buf, uint16 max_bytes, uint16 max_pixels); +void InitializeTextBuffer(Textbuf *tb, char *buf, uint16 max_bytes, uint16 max_chars, uint16 max_pixels); void UpdateTextBufferSize(Textbuf *tb); /** Flags used in ShowQueryString() call */ @@ -44,6 +47,7 @@ enum QueryStringFlags { QSF_NONE = 0, QSF_ACCEPT_UNCHANGED = 0x01, ///< return success even when the text didn't change QSF_ENABLE_DEFAULT = 0x02, ///< enable the 'Default' button ("\0" is returned) + QSF_LEN_IN_CHARS = 0x04, ///< the length of the string is counted in characters }; DECLARE_ENUM_AS_BIT_SET(QueryStringFlags) |