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

NewGRFWindow Struct Reference

Window for showing NewGRF files. More...

Inheritance diagram for NewGRFWindow:
QueryStringBaseWindow Window QueryString ZeroedMemoryAllocator

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 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)
 Callback for when on input has been entered with the OSK.

Data Fields

GUIGRFConfigList avails
 Available (non-active) grfs.
const GRFConfigavail_sel
 Currently selected available grf. NULL is none is selected.
int avail_pos
 Index of avail_sel if existing, else -1.
GRFConfigactives
 Temporary active grf list to which changes are made.
GRFConfigactive_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.
Scrollbarvscroll
Scrollbarvscroll2

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.

Detailed Description

Window for showing NewGRF files.

Definition at line 514 of file newgrf_gui.cpp.


Member Function Documentation

FORCEINLINE PaletteID NewGRFWindow::GetPalette ( const GRFConfig c  )  const [inline]

Pick the palette for the sprite of the grf to display.

Parameters:
c grf to display.
Returns:
Palette for the sprite.

Definition at line 669 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 1216 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.

Parameters:
data Information about the changed data.

  • 0: (optionally) build availables, update button status.
  • 1: build availables, Add newly found grfs, update button status.
  • 2: (optionally) build availables, Reset preset, + 3
  • 3: (optionally) build availables, Update active scrollbar, update button status.
  • 4: Force a rebuild of the availables, + 2
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 1047 of file newgrf_gui.cpp.

References active_sel, actives, avail_pos, avail_sel, avails, Window::DisableWidget(), editable, FGCM_EXACT, FindGRFConfig(), GRFConfig::flags, GUIList< T, F >::ForceRebuild(), GCF_COMPATIBLE, GCF_INVALID, GCS_NOT_FOUND, GRFIdentifier::grfid, HasBit(), GRFConfig::ident, GRFConfig::IsOpenTTDBaseGRF(), GRFIdentifier::md5sum, GRFConfig::next, GRFConfig::original_md5sum, preset, Scrollbar::ScrollTowards(), Scrollbar::SetCapacityFromWidget(), Scrollbar::SetCount(), Window::SetWidgetDisabledState(), Window::SetWidgetsDisabledState(), GRFConfig::status, and WIDGET_LIST_END.

virtual void NewGRFWindow::OnOSKInput ( int  wid  )  [inline, virtual]

Callback for when on input has been entered with the OSK.

Parameters:
wid The widget the OSK was attached to.

Reimplemented from QueryStringBaseWindow.

Definition at line 1205 of file newgrf_gui.cpp.

References avails, QueryStringBaseWindow::edit_str_buf, editable, GUIList< T, F >::ForceRebuild(), Window::InvalidateData(), GUIList< T, F >::SetFilterState(), and StrEmpty().


Field Documentation

Initial value:
 {
  &TagNameFilter,
}

Filter functions of the GUIGRFConfigList.

Definition at line 522 of file newgrf_gui.cpp.

Initial value:
 {
  &NameSorter,
}

Sort functions of the GUIGRFConfigList.

Definition at line 521 of file newgrf_gui.cpp.


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