summaryrefslogtreecommitdiff
path: root/src/querystring_gui.h
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2008-08-11 22:08:56 +0000
committerrubidium <rubidium@openttd.org>2008-08-11 22:08:56 +0000
commit6995365535370da08116d49a30ebd84d56e7d8ff (patch)
tree64cc604a5c6fdb994ac66d9a17d50caab8d78364 /src/querystring_gui.h
parent3b4c3a3df690d5ec02ba2bf93a69aa6fe9908810 (diff)
downloadopenttd-6995365535370da08116d49a30ebd84d56e7d8ff.tar.xz
(svn r14046) -Codechange: make the size of querystring "widgets" more configurable.
Diffstat (limited to 'src/querystring_gui.h')
-rw-r--r--src/querystring_gui.h31
1 files changed, 28 insertions, 3 deletions
diff --git a/src/querystring_gui.h b/src/querystring_gui.h
index 004501b31..40b0c8685 100644
--- a/src/querystring_gui.h
+++ b/src/querystring_gui.h
@@ -8,6 +8,9 @@
#include "textbuf_gui.h"
#include "window_gui.h"
+/**
+ * Data stored about a string that can be modified in the GUI
+ */
struct QueryString {
StringID caption;
Textbuf text;
@@ -15,17 +18,39 @@ struct QueryString {
CharSetFilter afilter;
bool handled;
+ /**
+ * Make sure everything gets initialized properly.
+ */
+ QueryString() : orig(NULL)
+ {
+ }
+
+ /**
+ * Make sure everything gets freed.
+ */
+ ~QueryString()
+ {
+ free((void*)this->orig);
+ }
+
void DrawEditBox(Window *w, int wid);
void HandleEditBox(Window *w, int wid);
int HandleEditBoxKey(Window *w, int wid, uint16 key, uint16 keycode, Window::EventState &state);
};
struct QueryStringBaseWindow : public Window, public QueryString {
- char edit_str_buf[64];
- char orig_str_buf[64];
+ const size_t edit_str_size;
+ char *edit_str_buf;
+ char *orig_str_buf;
+
+ QueryStringBaseWindow(size_t size, const WindowDesc *desc, WindowNumber window_number = 0) : Window(desc, window_number), edit_str_size(size)
+ {
+ this->edit_str_buf = CallocT<char>(size);
+ }
- QueryStringBaseWindow(const WindowDesc *desc, WindowNumber window_number = 0) : Window(desc, window_number)
+ ~QueryStringBaseWindow()
{
+ free(this->edit_str_buf);
}
void DrawEditBox(int wid);