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

# NewGRFInspectWindow Struct Reference

Window used for inspecting NewGRFs. More...

Inheritance diagram for NewGRFInspectWindow:

## Public Member Functions
void | SetCallerGRFID (uint32 grfid)
| Set the GRFID of the item opening this window.
bool | HasChainIndex () const
| Check whether this feature has chain index, i.e.
uint | GetFeatureIndex () const
| Get the feature index.
void | ValidateChainIndex ()
| Ensure that this->chain_index is in range.
| NewGRFInspectWindow (WindowDesc *desc, WindowNumber wno)
virtual void | SetStringParameters (int widget) const
| Initialize string parameters for a widget.
virtual void | UpdateWidgetSize (int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize)
| Update size and resize step of a widget in the window.
void | WARN_FORMAT (4, 5) DrawString(const Rect &r
| Helper function to draw a string (line) in the window.
## Static Public Member Functions
static bool | HasVariableParameter (uint variable)
| Check whether the given variable has a parameter.
## Data Fields
uint32 | caller_grfid
| GRFID of the caller of this window, 0 if it has no caller.
uint | chain_index
| For ground vehicles: Index in vehicle chain.
byte | current_edit_param
| The currently edited parameter, to update the right one.
Scrollbar * | vscroll
void int | offset
void int const char * | format
## Static Public Attributes
static const int | LEFT_OFFSET = 5
| Position of left edge.
static const int | RIGHT_OFFSET = 5
| Position of right edge.
static const int | TOP_OFFSET = 5
| Position of top edge.
static const int | BOTTOM_OFFSET = 5
| Position of bottom edge.
static uint32 | var60params [GSF_FAKE_END][0x20] = { {0} }
| The value for the variable 60 parameters.

## Detailed Description

Window used for inspecting NewGRFs.

Definition at line 272 of file newgrf_debug_gui.cpp.

## Member Function Documentation

uint NewGRFInspectWindow::GetFeatureIndex | ( |  | ) | const`[inline]`

Get the feature index.

Returns:
  the feature index

Definition at line 325 of file newgrf_debug_gui.cpp.

References chain_index, Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_vehicle_pool >::Get(), HasChainIndex(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem< Tpool >::index, Vehicle::Move(), and Window::window_number.

Referenced by SetStringParameters(), and ValidateChainIndex().

bool NewGRFInspectWindow::HasChainIndex | ( |  | ) | const`[inline]`

Check whether this feature has chain index, i.e.

refers to ground vehicles.

Definition at line 315 of file newgrf_debug_gui.cpp.

References GetFeatureNum(), and Window::window_number.

Referenced by GetFeatureIndex(), UpdateWidgetSize(), and ValidateChainIndex().

static bool NewGRFInspectWindow::HasVariableParameter | ( | uint | variable | ) | `[inline, static]`

Check whether the given variable has a parameter.

Parameters:

  | variable | the variable to check.

Returns:
  true iff the variable has a parameter.

Definition at line 297 of file newgrf_debug_gui.cpp.

References IsInsideBS().

void NewGRFInspectWindow::SetCallerGRFID | ( | uint32 | grfid | ) | `[inline]`

Set the GRFID of the item opening this window.

Parameters:

  | grfid | GRFID of the item opening this window, or 0 if not opened by other window.

Definition at line 306 of file newgrf_debug_gui.cpp.

References caller_grfid, and Window::SetDirty().

Referenced by ShowNewGRFInspectWindow().

virtual void NewGRFInspectWindow::SetStringParameters | ( | int | widget | ) | const`[inline, virtual]`

Initialize string parameters for a widget.

Calls to this function are made during initialization to measure the size (that is as part of InitNested()), during drawing, and while re-initializing the window. Only for widgets that render text initializing is requested.

Parameters:

  | widget | Widget number.

Reimplemented from Window.

Definition at line 363 of file newgrf_debug_gui.cpp.

References GetFeatureHelper(), GetFeatureIndex(), NIHelper::SetStringParameters(), WID_NGRFI_CAPTION, and Window::window_number.

virtual void NewGRFInspectWindow::UpdateWidgetSize | ( | int | widget,
|  | Dimension * | size,
|  | const Dimension & | padding,
|  | Dimension * | fill,
|  | Dimension * | resize |
| ) |  |  | `[inline, virtual]`

Update size and resize step of a widget in the window.

After retrieval of the minimal size and the resize-steps of a widget, this function is called to allow further refinement, typically by computing the real maximal size of the content. Afterwards, size is taken to be the minimal size of the widget and resize is taken to contain the resize steps. For the convenience of the callee, padding contains the amount of padding between the content and the edge of the widget. This should be added to the returned size.

Parameters:

  | widget | Widget number.
  | size | Size of the widget.
  | padding | Recommended amount of space between the widget content and the widget edge.
  | fill | Fill step of the widget.
  | resize | Resize step of the widget.

Reimplemented from Window.

Definition at line 370 of file newgrf_debug_gui.cpp.

References BOTTOM_OFFSET, EIT_IN_DEPOT, FONT_HEIGHT_NORMAL, GetFeatureNum(), GetVehicleImageCellSize(), HasChainIndex(), Window::height, max(), TOP_OFFSET, VEH_TRAIN, WD_BEVEL_BOTTOM, WD_BEVEL_TOP, WID_NGRFI_MAINPANEL, WID_NGRFI_VEH_CHAIN, and Window::window_number.

void NewGRFInspectWindow::WARN_FORMAT | ( | 4 | ,
|  | 5 |  |
| ) |  |  | const

Helper function to draw a string (line) in the window.

Parameters:

  | r | The (screen) rectangle we must draw within
  | offset | The offset (in lines) we want to draw for
  | format | The format string

## Field Documentation

uint32 NewGRFInspectWindow::caller_grfid

GRFID of the caller of this window, 0 if it has no caller.

Definition at line 282 of file newgrf_debug_gui.cpp.

Referenced by SetCallerGRFID().

uint NewGRFInspectWindow::chain_index

For ground vehicles: Index in vehicle chain.

Definition at line 285 of file newgrf_debug_gui.cpp.

Referenced by GetFeatureIndex(), and ValidateChainIndex().

byte NewGRFInspectWindow::current_edit_param

The currently edited parameter, to update the right one.

Definition at line 288 of file newgrf_debug_gui.cpp.

uint32 NewGRFInspectWindow::var60params = { {0} }`[static]`

The value for the variable 60 parameters.

Definition at line 279 of file newgrf_debug_gui.cpp.

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

- src/newgrf_debug_gui.cpp