# VehicleListWindow Struct Reference

Window for the (old) vehicle listing. More...

Inheritance diagram for VehicleListWindow:

## Public Member Functions

| VehicleListWindow (const WindowDesc *desc, WindowNumber window_number)
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.
virtual void | SetStringParameters (int widget) const
| Initialize string parameters for a widget.
virtual void | DrawWidget (const Rect &r, int widget) const
| Draw the contents of a nested widget.
virtual void | OnPaint ()
| The window must be 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 | OnTick ()
| Called once per (game) tick.
virtual void | OnResize ()
| Called after the window got resized.
virtual void | OnInvalidateData (int data)
| Some data on this window has become invalid.

## Private Types

enum | ButtonPlanes { BP_SHOW_BUTTONS, BP_HIDE_BUTTONS }
| Enumeration of planes of the button row at the bottom. More...

## Detailed Description

Window for the (old) vehicle listing.

bitmask for w->window_number 0-7 CompanyID (owner) 8-10 window type (use flags in vehicle_gui.h) 11-15 vehicle type (using VEH_, but can be compressed to fewer bytes if needed) 16-31 StationID or OrderID depending on window type (bit 8-10)

Definition at line 973 of file vehicle_gui.cpp.

## Member Enumeration Documentation

enum VehicleListWindow::ButtonPlanes `[private]`

Enumeration of planes of the button row at the bottom.

Enumerator:

  BP_SHOW_BUTTONS | Show the buttons.
  BP_HIDE_BUTTONS | Show the empty panel.

Definition at line 976 of file vehicle_gui.cpp.

## Member Function Documentation

virtual void VehicleListWindow::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 1029 of file vehicle_gui.cpp.

References GetVehicleListHeight(), Dimension::height, VEH_AIRCRAFT, VEH_ROAD, VEH_SHIP, VEH_TRAIN, and Dimension::width.

virtual void VehicleListWindow::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 1051 of file vehicle_gui.cpp.

References GB(), Scrollbar::GetCount(), SetDParam(), VEH_AIRCRAFT, and Window::vscroll.

virtual void VehicleListWindow::DrawWidget | ( | const Rect & | r,
|  | int | widget |
| ) |  |  | const`[inline, virtual]`

Draw the contents of a nested widget.

Parameters:

  | r | Rectangle occupied by the widget.
  | widget | Number of the widget to draw.

Note:
  This method may not change any state, it may only use drawing functions.

Reimplemented from Window.

Definition at line 1097 of file vehicle_gui.cpp.

References Window::DrawSortButtonState(), INVALID_VEHICLE, Window::resize, SBS_DOWN, SBS_UP, and ResizeInfo::step_height.

virtual void VehicleListWindow::OnPaint | ( |  | ) | `[inline, virtual]`

The window must be repainted.

Note:
  This method should not change any state, it should only use drawing functions.

Reimplemented from Window.

Definition at line 1111 of file vehicle_gui.cpp.

References BP_HIDE_BUTTONS, BP_SHOW_BUTTONS, Window::DrawWidgets(), GB(), HideDropDownMenu(), NWidgetBase::SetDirty(), NWidgetStacked::SetDisplayedPlane(), Window::SetWidgetDisabledState(), Window::SetWidgetsDisabledState(), NWidgetStacked::shown_plane, and WIDGET_LIST_END.

virtual void VehicleListWindow::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 1143 of file vehicle_gui.cpp.

References CMD_MASS_START_STOP, DoCommandP(), GB(), Scrollbar::GetCapacity(), Scrollbar::GetPosition(), INVALID_STRING_ID, INVALID_TILE, Window::resize, Window::SetDirty(), ShowDropDownMenu(), ShowVehicleViewWindow(), ResizeInfo::step_height, VEH_ROAD, VEH_TRAIN, Window::vscroll, and Point::y.

virtual void VehicleListWindow::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 1204 of file vehicle_gui.cpp.

References DEFAULT_GROUP, DEPOT_MASS_SEND, DEPOT_SERVICE, DoCommandP(), GB(), and Window::SetDirty().

virtual void VehicleListWindow::OnResize | ( |  | ) | `[inline, virtual]`

Called after the window got resized.

For nested windows with a viewport, call NWidgetViewport::UpdateViewportCoordinates.

Reimplemented from Window.

Definition at line 1245 of file vehicle_gui.cpp.

References Scrollbar::GetCapacity(), MAT_COL_START, MAT_ROW_START, Scrollbar::SetCapacityFromWidget(), and Window::vscroll.

virtual void VehicleListWindow::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 1251 of file vehicle_gui.cpp.

References GB(), HasBit(), and SB().

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

- src/vehicle_gui.cpp