textfile_gui.h

Go to the documentation of this file.
00001 /* $Id: textfile_gui.h 25816 2013-10-06 11:29:14Z frosch $ */
00002 
00003 /*
00004  * This file is part of OpenTTD.
00005  * 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.
00006  * 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.
00007  * 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/>.
00008  */
00009 
00012 #ifndef TEXTFILE_GUI_H
00013 #define TEXTFILE_GUI_H
00014 
00015 #include "fileio_type.h"
00016 #include "strings_func.h"
00017 #include "textfile_type.h"
00018 #include "window_gui.h"
00019 
00020 const char *GetTextfile(TextfileType type, Subdirectory dir, const char *filename);
00021 
00023 struct TextfileWindow : public Window, MissingGlyphSearcher {
00024   TextfileType file_type;              
00025   Scrollbar *vscroll;                  
00026   Scrollbar *hscroll;                  
00027   char *text;                          
00028   SmallVector<const char *, 64> lines; 
00029   uint search_iterator;                
00030 
00031   static const int TOP_SPACING    = WD_FRAMETEXT_TOP;    
00032   static const int BOTTOM_SPACING = WD_FRAMETEXT_BOTTOM; 
00033 
00034   TextfileWindow(TextfileType file_type);
00035   virtual ~TextfileWindow();
00036   virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize);
00037   virtual void OnClick(Point pt, int widget, int click_count);
00038   virtual void DrawWidget(const Rect &r, int widget) const;
00039   virtual void OnResize();
00040   virtual void Reset();
00041   virtual FontSize DefaultSize();
00042   virtual const char *NextString();
00043   virtual bool Monospace();
00044   virtual void SetFontNames(FreeTypeSettings *settings, const char *font_name);
00045   virtual void LoadTextfile(const char *textfile, Subdirectory dir);
00046 private:
00047   uint GetContentHeight();
00048   void SetupScrollbars();
00049 };
00050 
00051 #endif /* TEXTFILE_GUI_H */