Public Member Functions | Data Fields | Static Public Attributes | Private Member Functions

TextfileWindow Struct Reference

Window for displaying a textfile. More...

#include <textfile_gui.h>

Inheritance diagram for TextfileWindow:
Window MissingGlyphSearcher ZeroedMemoryAllocator BaseSetTextfileWindow< TBaseSet > ContentTextfileWindow NewGRFTextfileWindow ScriptTextfileWindow

Public Member Functions

 TextfileWindow (TextfileType file_type)
virtual void UpdateWidgetSize (int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize)
virtual void OnClick (Point pt, int widget, int click_count)
virtual void DrawWidget (const Rect &r, int widget) const
virtual void OnResize ()
virtual void Reset ()
 Reset the search, i.e.
virtual FontSize DefaultSize ()
 Get the default (font) size of the string.
virtual const char * NextString ()
 Get the next string to search through.
virtual bool Monospace ()
 Whether to search for a monospace font or not.
virtual void SetFontNames (FreeTypeSettings *settings, const char *font_name)
 Set the right font names.
virtual void LoadTextfile (const char *textfile, Subdirectory dir)
 Loads the textfile text from file and setup lines.

Data Fields

TextfileType file_type
 Type of textfile to view.
Scrollbarvscroll
 Vertical scrollbar.
Scrollbarhscroll
 Horizontal scrollbar.
char * text
 Lines of text from the NewGRF's textfile.
SmallVector< const char *, 64 > lines
 text, split into lines in a table with lines.
uint search_iterator
 Iterator for the font check search.

Static Public Attributes

static const int TOP_SPACING = WD_FRAMETEXT_TOP
 Additional spacing at the top of the WID_TF_BACKGROUND widget.
static const int BOTTOM_SPACING = WD_FRAMETEXT_BOTTOM
 Additional spacing at the bottom of the WID_TF_BACKGROUND widget.

Private Member Functions

uint GetContentHeight ()
 Get the total height of the content displayed in this window, if wrapping is disabled.
void SetupScrollbars ()
 Set scrollbars to the right lengths.

Detailed Description

Window for displaying a textfile.

Definition at line 23 of file textfile_gui.h.


Member Function Documentation

FontSize TextfileWindow::DefaultSize (  )  [virtual]

Get the default (font) size of the string.

Returns:
The font size.

Implements MissingGlyphSearcher.

Definition at line 170 of file textfile_gui.cpp.

uint TextfileWindow::GetContentHeight (  )  [private]

Get the total height of the content displayed in this window, if wrapping is disabled.

Returns:
the height in pixels

Definition at line 74 of file textfile_gui.cpp.

References FS_MONO, GetStringHeight(), Window::height, SmallVector< T, S >::Length(), lines, WD_FRAMERECT_RIGHT, and WD_FRAMETEXT_LEFT.

Referenced by SetupScrollbars().

bool TextfileWindow::Monospace (  )  [virtual]

Whether to search for a monospace font or not.

Returns:
True if searching for monospace.

Implements MissingGlyphSearcher.

Definition at line 182 of file textfile_gui.cpp.

const char * TextfileWindow::NextString (  )  [virtual]

Get the next string to search through.

Returns:
The next string or NULL if there is none.

Implements MissingGlyphSearcher.

Definition at line 175 of file textfile_gui.cpp.

References SmallVector< T, S >::Length(), lines, and search_iterator.

void TextfileWindow::Reset (  )  [virtual]

Reset the search, i.e.

begin from the beginning again.

Implements MissingGlyphSearcher.

Definition at line 165 of file textfile_gui.cpp.

References search_iterator.

void TextfileWindow::SetFontNames ( FreeTypeSettings settings,
const char *  font_name 
) [virtual]

Set the right font names.

Parameters:
settings The settings to modify.
font_name The new font name.

Implements MissingGlyphSearcher.

Definition at line 187 of file textfile_gui.cpp.

References FreeTypeSubSetting::font, lastof, FreeTypeSettings::mono, and strecpy().


The documentation for this struct was generated from the following files: