Public Member Functions | Private Types | Private Member Functions

# VehicleViewWindow Struct Reference

Window manager class for viewing a vehicle. More...

Inheritance diagram for VehicleViewWindow:

## Public Member Functions
| VehicleViewWindow (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 | OnPaint ()
| The window must be repainted.
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 | OnClick (Point pt, int widget, int click_count)
| A click with the left mouse button has been made on the window.
virtual void | OnResize ()
| Called after the window got resized.
virtual void | OnTick ()
| Called once per (game) tick.
virtual void | OnInvalidateData (int data=0, bool gui_scope=true)
| Some data on this window has become invalid.
virtual bool | IsNewGRFInspectable () const
| Is the data related to this window NewGRF inspectable?
virtual void | ShowNewGRFInspectWindow () const
| Show the NewGRF inspection window.
## Private Types
enum | PlaneSelections { SEL_DC_GOTO_DEPOT, SEL_DC_CLONE, SEL_RT_REFIT, SEL_RT_TURN_AROUND, SEL_DC_BASEPLANE = SEL_DC_GOTO_DEPOT, SEL_RT_BASEPLANE = SEL_RT_REFIT }
| Display planes available in the vehicle view window. More...
## Private Member Functions
void | SelectPlane (PlaneSelections plane)
| Display a plane in the window.

## Detailed Description

Window manager class for viewing a vehicle.

Definition at line 2248 of file vehicle_gui.cpp.

## Member Enumeration Documentation

enum VehicleViewWindow::PlaneSelections`[private]`

Display planes available in the vehicle view window.

Enumerator:

  SEL_DC_GOTO_DEPOT | Display 'goto depot' button in WID_VV_SELECT_DEPOT_CLONE stacked widget.
  SEL_DC_CLONE | Display 'clone vehicle' button in WID_VV_SELECT_DEPOT_CLONE stacked widget.
  SEL_RT_REFIT | Display 'refit' button in WID_VV_SELECT_REFIT_TURN stacked widget.
  SEL_RT_TURN_AROUND | Display 'turn around' button in WID_VV_SELECT_REFIT_TURN stacked widget.
  SEL_DC_BASEPLANE | First plane of the WID_VV_SELECT_DEPOT_CLONE stacked widget.
  SEL_RT_BASEPLANE | First plane of the WID_VV_SELECT_REFIT_TURN stacked widget.

Definition at line 2251 of file vehicle_gui.cpp.

## Member Function Documentation

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

References Vehicle::breakdown_ctr, Vehicle::cur_speed, Vehicle::current_order, DrawSprite(), DrawString(), SpecializedVehicle< Aircraft, VEH_AIRCRAFT >::From(), SpecializedVehicle< Train, Type >::From(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_vehicle_pool >::Get(), Order::GetDepotActionType(), Order::GetDestination(), Vehicle::GetDisplaySpeed(), Vehicle::GetNumManualOrders(), Order::GetType(), HasBit(), Order::IsType(), SA_HOR_CENTER, SetDParam(), BaseVehicle::type, VAF_DEST_TOO_FAR, VEH_AIRCRAFT, VEH_SHIP, VEH_TRAIN, Vehicle::vehstatus, VRF_TRAIN_STUCK, VS_CRASHED, VS_STOPPED, WD_FRAMERECT_LEFT, WD_FRAMERECT_RIGHT, WD_FRAMERECT_TOP, and WID_VV_START_STOP.

virtual bool VehicleViewWindow::IsNewGRFInspectable | ( |  | ) | const`[inline, virtual]`

Is the data related to this window NewGRF inspectable?

Returns:
  true iff it is inspectable.

Reimplemented from Window.

Definition at line 2588 of file vehicle_gui.cpp.

References Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_vehicle_pool >::Get(), GetGrfSpecFeature(), and IsNewGRFInspectable().

virtual void VehicleViewWindow::OnClick | ( | Point | pt,
|  | int | widget,
|  | int | click_count |
| ) |  |  | `[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.
  | click_count | Number of fast consecutive clicks at same position

Reimplemented from Window.

Definition at line 2482 of file vehicle_gui.cpp.

References _ctrl_pressed, CcCloneVehicle(), CMD_FORCE_TRAIN_PROCEED, CMD_MSG, Vehicle::current_order, DEPOT_SERVICE, DoCommandP(), FindWindowById(), ViewportData::follow_vehicle, Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_vehicle_pool >::Get(), Order::GetLocation(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem< Tpool >::index, INVALID_TILE, INVALID_VEH_ORDER_ID, Vehicle::IsGroundVehicle(), ScrollMainWindowTo(), ScrollMainWindowToTile(), ShowTimetableWindow(), ShowVehicleDetailsWindow(), ShowVehicleRefitWindow(), StartStopVehicle(), Vehicle::tile, BaseVehicle::type, VEH_TRAIN, Window::viewport, WC_MAIN_WINDOW, WID_VV_CENTER_MAIN_VIEW, WID_VV_CLONE, WID_VV_FORCE_PROCEED, WID_VV_GOTO_DEPOT, WID_VV_REFIT, WID_VV_SHOW_DETAILS, WID_VV_SHOW_ORDERS, WID_VV_START_STOP, WID_VV_TURN_AROUND, Vehicle::x_pos, Vehicle::y_pos, Vehicle::z_pos, ViewPort::zoom, and ZOOM_LVL_OUT_4X.

virtual void VehicleViewWindow::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.
  | gui_scope | Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See InvalidateWindowData() for details.

Reimplemented from Window.

Definition at line 2579 of file vehicle_gui.cpp.

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

References _local_company, SpecializedVehicle< Train, Type >::From(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_vehicle_pool >::Get(), IsVehicleRefitable(), Vehicle::owner, TFP_SIGNAL, BaseVehicle::type, VEH_TRAIN, WID_VV_CLONE, WID_VV_FORCE_PROCEED, WID_VV_GOTO_DEPOT, WID_VV_REFIT, and WID_VV_TURN_AROUND.

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

Called after the window got resized.

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

Reimplemented from Window.

Definition at line 2541 of file vehicle_gui.cpp.

References NWidgetViewport::UpdateViewportCoordinates().

void VehicleViewWindow::SelectPlane | ( | PlaneSelections | plane | ) | `[inline, private]`

Display a plane in the window.

Parameters:

  | plane | Plane to show.

Definition at line 2266 of file vehicle_gui.cpp.

References SEL_DC_BASEPLANE, SEL_DC_CLONE, SEL_DC_GOTO_DEPOT, SEL_RT_BASEPLANE, SEL_RT_REFIT, and SEL_RT_TURN_AROUND.

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

References Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_vehicle_pool >::Get(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem< Tpool >::index, SetDParam(), and WID_VV_CAPTION.

virtual void VehicleViewWindow::ShowNewGRFInspectWindow | ( |  | ) | const`[inline, virtual]`

Show the NewGRF inspection window.

When this function is called it is up to the window to call and pass the right parameters to the ShowInspectWindow function.

Precondition:
  this->IsNewGRFInspectable()

Reimplemented from Window.

Definition at line 2593 of file vehicle_gui.cpp.

References Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_vehicle_pool >::Get(), GetGrfSpecFeature(), and ShowNewGRFInspectWindow().

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

References Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_vehicle_pool >::Get(), BaseVehicle::type, VEH_TRAIN, WID_VV_FORCE_PROCEED, and WID_VV_VIEWPORT.

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

- src/vehicle_gui.cpp