# NewGRFWindow Struct Reference

Window for showing NewGRF files. More...

Inheritance diagram for NewGRFWindow:

## Public Types
enum | ShowNewGRFStateWidgets { SNGRFS_CLOSEBOX = 0, SNGRFS_CAPTION, SNGRFS_BACKGROUND1, SNGRFS_PRESET_LIST, SNGRFS_PRESET_SAVE, SNGRFS_PRESET_DELETE, SNGRFS_BACKGROUND2, SNGRFS_ADD, SNGRFS_REMOVE, SNGRFS_MOVE_UP, SNGRFS_MOVE_DOWN, SNGRFS_FILE_LIST, SNGRFS_SCROLLBAR, SNGRFS_NEWGRF_INFO, SNGRFS_SET_PARAMETERS, SNGRFS_TOGGLE_PALETTE, SNGRFS_APPLY_CHANGES, SNGRFS_CONTENT_DOWNLOAD, SNGRFS_RESIZE }
## Public Member Functions
| NewGRFWindow (const WindowDesc *desc, bool editable, bool show_params, bool exec_changes, GRFConfig **config)
void | SetupNewGRFWindow ()
virtual void | OnPaint ()
| This window is currently being repainted.
virtual void | OnClick (Point pt, int widget)
| A click with the left mouse button has been made on the window.
virtual void | OnDropdownSelect (int widget, int index)
| A dropdown option associated to this window has been selected.
virtual void | OnQueryTextFinished (char *str)
| The query window opened from this window has closed.
virtual void | OnResize (Point new_size, Point delta)
| Called when the window got resized.
virtual void | OnInvalidateData (int data)
| Some data on this window has become invalid.
## Data Fields
GRFConfig ** | orig_list
| grf list the window is shown with
GRFConfig * | list
| temporary grf list to which changes are made
GRFConfig * | sel
| selected grf item
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 | query_widget
| widget that opened a query
int | preset
| selected preset

## Detailed Description

Window for showing NewGRF files.

Definition at line 288 of file newgrf_gui.cpp.

## Member Function Documentation

virtual void NewGRFWindow::OnClick | ( | Point | pt,
|  | int | widget |
| ) |  |  | `[inline, virtual]`

A click with the left mouse button has been made on the window.

Parameters:

  | pt | the point inside the window that has been clicked.
  | widget | the clicked widget.

Reimplemented from Window.

Definition at line 459 of file newgrf_gui.cpp.

References BSWAP32(), CopyGRFConfigList(), CS_ALPHANUMERAL, DeleteWindowByClass(), execute, GRFConfig::filename, GRFConfig::flags, GamelogGetOriginalGRFMD5Checksum(), GCF_COMPATIBLE, GCS_NOT_FOUND, GRFIdentifier::grfid, HasBit(), INVALID_STRING_ID, lastof, SmallVector< T, S >::Length(), lengthof, list, GRFIdentifier::md5sum, GRFConfig::name, NewGRFConfirmationCallback(), GRFConfig::next, orig_list, Scrollbar::pos, preset, query_widget, ReloadNewGRFData(), sel, Window::SetDirty(), SetDParamStr(), ShowDropDownList(), ShowQuery(), ShowQueryString(), GRFConfig::status, ttd_strlcpy(), Window::vscroll, GRFConfig::windows_paletted, and Point::y.

virtual void NewGRFWindow::OnDropdownSelect | ( | int | widget,
|  | int | index |
| ) |  |  | `[inline, virtual]`

A dropdown option associated to this window has been selected.

Parameters:

  | widget | the widget (button) that the dropdown is associated with.
  | index | the element in the dropdown that is selected.

Reimplemented from Window.

Definition at line 627 of file newgrf_gui.cpp.

References list, preset, sel, and Window::SetDirty().

virtual void NewGRFWindow::OnQueryTextFinished | ( | char * | str | ) | `[inline, virtual]`

The query window opened from this window has closed.

Parameters:

  | str | the new value of the string or NULL if the window was cancelled.

Reimplemented from Window.

Definition at line 648 of file newgrf_gui.cpp.

References SmallVector< T, S >::Length(), lengthof, list, GRFConfig::num_params, GRFConfig::param, parse_intlist(), preset, query_widget, sel, and Window::SetDirty().

virtual void NewGRFWindow::OnResize | ( | Point | new_size,
|  | Point | delta |
| ) |  |  | `[inline, virtual]`

Called when the window got resized.

Parameters:

  | new_size | the new size of the window.
  | delta | the amount of which the window size changed.

Reimplemented from Window.

Definition at line 683 of file newgrf_gui.cpp.

References Scrollbar::cap, Widget::data, ResizeButtons(), Window::vscroll, Window::widget, Point::x, and Point::y.

virtual void NewGRFWindow::OnInvalidateData | ( | int | data | ) | `[inline, virtual]`

Some data on this window has become invalid.

Parameters:

  | data | information about the changed data.

Reimplemented from Window.

Definition at line 696 of file newgrf_gui.cpp.

References GRFConfig::filename, GCS_NOT_FOUND, GCS_UNKNOWN, GRFIdentifier::grfid, GRFConfig::info, list, GRFIdentifier::md5sum, GRFConfig::name, GRFConfig::next, preset, and GRFConfig::status.

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

- src/newgrf_gui.cpp