Merge branch 'development' into master_joker
[openttd-joker.git] / src / textfile_gui.h
blobe98c6343335bb7d253fc2f491ff8149a351aabb9
1 /* $Id: textfile_gui.h 25816 2013-10-06 11:29:14Z 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 textfile_gui.h GUI functions related to textfiles. */
12 #ifndef TEXTFILE_GUI_H
13 #define TEXTFILE_GUI_H
15 #include "fileio_type.h"
16 #include "strings_func.h"
17 #include "textfile_type.h"
18 #include "window_gui.h"
20 const char *GetTextfile(TextfileType type, Subdirectory dir, const char *filename);
22 /** Window for displaying a textfile */
23 struct TextfileWindow : public Window, MissingGlyphSearcher {
24 TextfileType file_type; ///< Type of textfile to view.
25 Scrollbar *vscroll; ///< Vertical scrollbar.
26 Scrollbar *hscroll; ///< Horizontal scrollbar.
27 char *text; ///< Lines of text from the NewGRF's textfile.
28 SmallVector<const char *, 64> lines; ///< #text, split into lines in a table with lines.
29 uint search_iterator; ///< Iterator for the font check search.
31 static const int TOP_SPACING = WD_FRAMETEXT_TOP; ///< Additional spacing at the top of the #WID_TF_BACKGROUND widget.
32 static const int BOTTOM_SPACING = WD_FRAMETEXT_BOTTOM; ///< Additional spacing at the bottom of the #WID_TF_BACKGROUND widget.
34 TextfileWindow(TextfileType file_type);
35 virtual ~TextfileWindow();
36 virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize);
37 virtual void OnClick(Point pt, int widget, int click_count);
38 virtual void DrawWidget(const Rect &r, int widget) const;
39 virtual void OnResize();
40 virtual void Reset();
41 virtual FontSize DefaultSize();
42 virtual const char *NextString();
43 virtual bool Monospace();
44 virtual void SetFontNames(FreeTypeSettings *settings, const char *font_name);
45 virtual void LoadTextfile(const char *textfile, Subdirectory dir);
46 private:
47 uint GetContentHeight();
48 void SetupScrollbars();
51 #endif /* TEXTFILE_GUI_H */