Update readme.md
[openttd-joker.git] / src / textbuf_gui.h
blob53784f31bd1b24bed897b2e89b0710817c47e6d3
1 /* $Id: textbuf_gui.h 24323 2012-06-04 15:29:37Z frosch $ */
3 /*
4 * This file is part of OpenTTD.
5 * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
6 * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
7 * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
8 */
10 /** @file textbuf_gui.h Stuff related to the text buffer GUI. */
12 #ifndef TEXTBUF_GUI_H
13 #define TEXTBUF_GUI_H
15 #include "string_type.h"
16 #include "strings_type.h"
18 #include <functional>
20 struct Window;
22 /** Flags used in ShowQueryString() call */
23 enum QueryStringFlags {
24 QSF_NONE = 0,
25 QSF_ACCEPT_UNCHANGED = 0x01, ///< return success even when the text didn't change
26 QSF_ENABLE_DEFAULT = 0x02, ///< enable the 'Default' button ("\0" is returned)
27 QSF_LEN_IN_CHARS = 0x04, ///< the length of the string is counted in characters
30 DECLARE_ENUM_AS_BIT_SET(QueryStringFlags)
32 /** Callback procedure for the ShowQuery method. */
33 typedef std::function<void(Window*, bool)> QueryCallback;
35 void ShowQueryString(StringID str, StringID caption, uint max_len, Window *parent, CharSetFilter afilter, QueryStringFlags flags);
36 void ShowQuery(StringID caption, StringID message, Window *w, QueryCallback callback);
38 /** The number of 'characters' on the on-screen keyboard. */
39 static const uint OSK_KEYBOARD_ENTRIES = 50;
41 /**
42 * The number of characters has to be OSK_KEYBOARD_ENTRIES. However, these
43 * have to be UTF-8 encoded, which means up to 4 bytes per character.
44 * Furthermore the string needs to be '\0'-terminated.
46 extern char _keyboard_opt[2][OSK_KEYBOARD_ENTRIES * 4 + 1];
48 #endif /* TEXTBUF_GUI_H */