Window manager class for viewing a vehicle. More...
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. | |
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. |
Window manager class for viewing a vehicle.
Definition at line 1855 of file vehicle_gui.cpp.
enum VehicleViewWindow::PlaneSelections [private] |
Display planes available in the vehicle view window.
SEL_DC_GOTO_DEPOT |
Display 'goto depot' button in VVW_WIDGET_SELECT_DEPOT_CLONE stacked widget. |
SEL_DC_CLONE |
Display 'clone vehicle' button in VVW_WIDGET_SELECT_DEPOT_CLONE stacked widget. |
SEL_RT_REFIT |
Display 'refit' button in VVW_WIDGET_SELECT_REFIT_TURN stacked widget. |
SEL_RT_TURN_AROUND |
Display 'turn around' button in VVW_WIDGET_SELECT_REFIT_TURN stacked widget. |
SEL_DC_BASEPLANE |
First plane of the VVW_WIDGET_SELECT_DEPOT_CLONE stacked widget. |
SEL_RT_BASEPLANE |
First plane of the VVW_WIDGET_SELECT_REFIT_TURN stacked widget. |
Definition at line 1858 of file vehicle_gui.cpp.
virtual void VehicleViewWindow::DrawWidget | ( | const Rect & | r, | |
int | widget | |||
) | const [inline, virtual] |
Draw the contents of a nested widget.
r | Rectangle occupied by the widget. | |
widget | Number of the widget to draw. |
Reimplemented from Window.
Definition at line 1994 of file vehicle_gui.cpp.
References _settings_client, Vehicle::cur_speed, Vehicle::current_order, DrawSprite(), DrawString(), SpecializedVehicle< Train, VEH_TRAIN >::From(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tcache, Tzero >::PoolItem<&_depot_pool >::Get(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tcache, Tzero >::PoolItem<&_vehicle_pool >::Get(), Order::GetDepotActionType(), Order::GetDestination(), Vehicle::GetDisplaySpeed(), Vehicle::GetNumOrders(), Order::GetType(), ClientSettings::gui, HasBit(), Order::IsType(), ODATFB_HALT, SA_CENTER, SetDParam(), BaseVehicle::type, VEH_AIRCRAFT, VEH_SHIP, VEH_TRAIN, GUISettings::vehicle_speed, Vehicle::vehstatus, WD_FRAMERECT_LEFT, WD_FRAMERECT_RIGHT, and WD_FRAMERECT_TOP.
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.
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 2081 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, Tcache, Tzero >::PoolItem<&_vehicle_pool >::Get(), Order::GetLocation(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tcache, Tzero >::PoolItem< Tpool >::index, INVALID_TILE, INVALID_VEH_ORDER_ID, ScrollMainWindowTo(), ShowVehicleDetailsWindow(), ShowVehicleRefitWindow(), Vehicle::tile, BaseVehicle::type, VEH_ROAD, VEH_TRAIN, and Window::viewport.
virtual void VehicleViewWindow::OnPaint | ( | ) | [inline, virtual] |
The window must be repainted.
Reimplemented from Window.
Definition at line 1967 of file vehicle_gui.cpp.
References SpecializedVehicle< Train, VEH_TRAIN >::From(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tcache, Tzero >::PoolItem<&_vehicle_pool >::Get(), IsVehicleRefitable(), BaseVehicle::type, and VEH_TRAIN.
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 2140 of file vehicle_gui.cpp.
References NWidgetViewport::UpdateViewportCoordinates(), and VVW_WIDGET_VIEWPORT.
void VehicleViewWindow::SelectPlane | ( | PlaneSelections | plane | ) | [inline, private] |
Display a plane in the window.
plane | Plane to show. |
Definition at line 1872 of file vehicle_gui.cpp.
References SEL_DC_BASEPLANE, SEL_DC_CLONE, SEL_DC_GOTO_DEPOT, SEL_RT_BASEPLANE, SEL_RT_REFIT, SEL_RT_TURN_AROUND, VVW_WIDGET_SELECT_DEPOT_CLONE, and VVW_WIDGET_SELECT_REFIT_TURN.
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.
widget | Widget number. |
Reimplemented from Window.
Definition at line 1986 of file vehicle_gui.cpp.
References Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tcache, Tzero >::PoolItem<&_vehicle_pool >::Get(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tcache, Tzero >::PoolItem< Tpool >::index, and SetDParam().
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.
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 1950 of file vehicle_gui.cpp.
References Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tcache, Tzero >::PoolItem<&_vehicle_pool >::Get(), BaseVehicle::type, VEH_TRAIN, and VVW_WIDGET_VIEWPORT.