Window for showing NewGRF files. More...
Public Types | |
typedef GUIList< const GRFConfig * > | GUIGRFConfigList |
Public Member Functions | |
NewGRFWindow (const WindowDesc *desc, bool editable, bool show_params, bool execute, GRFConfig **orig_list) | |
virtual void | UpdateWidgetSize (int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) |
virtual void | OnResize () |
virtual void | SetStringParameters (int widget) const |
virtual void | OnPaint () |
FORCEINLINE PaletteID | GetPalette (const GRFConfig *c) const |
Pick the palette for the sprite of the grf to display. | |
virtual void | DrawWidget (const Rect &r, int widget) const |
virtual void | OnClick (Point pt, int widget, int click_count) |
virtual void | OnNewGRFsScanned () |
Called whenever the NewGRF scan completed. | |
virtual void | OnDropdownSelect (int widget, int index) |
virtual void | OnQueryTextFinished (char *str) |
virtual void | OnInvalidateData (int data=0, bool gui_scope=true) |
Some data on this window has become invalid. | |
virtual void | OnMouseLoop () |
virtual EventState | OnKeyPress (uint16 key, uint16 keycode) |
virtual void | OnOSKInput (int wid) |
Data Fields | |
GUIGRFConfigList | avails |
Available (non-active) grfs. | |
const GRFConfig * | avail_sel |
Currently selected available grf. NULL is none is selected. | |
int | avail_pos |
Index of avail_sel if existing, else -1 . | |
GRFConfig * | actives |
Temporary active grf list to which changes are made. | |
GRFConfig * | active_sel |
Selected active grf item. | |
GRFConfig ** | orig_list |
List active grfs in the game. Used as initial value, may be updated by the window. | |
bool | editable |
Is the window editable? | |
bool | show_params |
Are the grf-parameters shown in the info-panel? | |
bool | execute |
On pressing 'apply changes' are grf changes applied immediately, or only list is updated. | |
int | preset |
Selected preset. | |
Scrollbar * | vscroll |
Scrollbar * | vscroll2 |
Static Public Attributes | |
static const uint | EDITBOX_MAX_SIZE = 50 |
static Listing | last_sorting = {false, 0} |
Default sorting of GUIGRFConfigList. | |
static Filtering | last_filtering = {false, 0} |
Default filtering of GUIGRFConfigList. | |
static GUIGRFConfigList::SortFunction *const | sorter_funcs [] |
Sort functions of the GUIGRFConfigList. | |
static GUIGRFConfigList::FilterFunction *const | filter_funcs [] |
Filter functions of the GUIGRFConfigList. | |
Private Member Functions | |
void | BuildAvailables () |
Static Private Member Functions | |
static int CDECL | NameSorter (const GRFConfig *const *a, const GRFConfig *const *b) |
Sort grfs by name. | |
static bool CDECL | TagNameFilter (const GRFConfig *const *a, const char *filter_string) |
Filter grfs by tags/name. |
Window for showing NewGRF files.
Definition at line 732 of file newgrf_gui.cpp.
Pick the palette for the sprite of the grf to display.
c | grf to display. |
Definition at line 891 of file newgrf_gui.cpp.
References GRFConfig::flags, GCF_COMPATIBLE, GCF_STATIC, GCS_ACTIVATED, GCS_DISABLED, GCS_NOT_FOUND, HasBit(), and GRFConfig::status.
static int CDECL NewGRFWindow::NameSorter | ( | const GRFConfig *const * | a, | |
const GRFConfig *const * | b | |||
) | [inline, static, private] |
Sort grfs by name.
Definition at line 1447 of file newgrf_gui.cpp.
References lengthof, and strnatcmp().
virtual void NewGRFWindow::OnInvalidateData | ( | int | data = 0 , |
|
bool | gui_scope = true | |||
) | [inline, virtual] |
Some data on this window has become invalid.
data | Information about the changed data. |
gui_scope | Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See InvalidateWindowData() for details. |
Definition at line 1273 of file newgrf_gui.cpp.
References active_sel, actives, avail_pos, avails, Window::DisableWidget(), editable, FGCM_EXACT, FindGRFConfig(), GRFConfig::flags, GUIList< T, F >::ForceRebuild(), GCF_COMPATIBLE, GCF_INVALID, GCS_NOT_FOUND, GRFConfig::GetTextfile(), GOID_NEWGRF_LIST_EDITED, GOID_NEWGRF_PRESET_LOADED, GOID_NEWGRF_RESCANNED, GRFIdentifier::grfid, HasBit(), GRFConfig::ident, GRFConfig::IsOpenTTDBaseGRF(), GRFIdentifier::md5sum, GRFConfig::next, GRFConfig::num_valid_params, GRFConfig::original_md5sum, preset, Scrollbar::ScrollTowards(), Scrollbar::SetCapacityFromWidget(), Scrollbar::SetCount(), Window::SetWidgetDisabledState(), Window::SetWidgetsDisabledState(), GRFConfig::status, and WIDGET_LIST_END.
virtual void NewGRFWindow::OnNewGRFsScanned | ( | ) | [inline, virtual] |
Called whenever the NewGRF scan completed.
Implements NewGRFScanCallback.
Definition at line 1224 of file newgrf_gui.cpp.
References avail_pos, avails, Window::DeleteChildWindows(), and GUIList< T, F >::ForceRebuild().
{ &TagNameFilter, }
Filter functions of the GUIGRFConfigList.
Definition at line 740 of file newgrf_gui.cpp.
{ &NameSorter, }
Sort functions of the GUIGRFConfigList.
Definition at line 739 of file newgrf_gui.cpp.