Public Member Functions | |
VehicleDetailsWindow (const WindowDesc *desc, WindowNumber window_number) | |
Initialize a newly created vehicle details window. | |
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 () |
Repaint vehicle details window. | |
virtual void | OnClick (Point pt, int widget) |
A click with the left mouse button has been made on the window. | |
virtual void | OnQueryTextFinished (char *str) |
The query window opened from this window has closed. | |
virtual void | OnResize () |
Called after the window got resized. | |
Static Public Member Functions | |
static bool | IsVehicleServiceIntervalEnabled (const VehicleType vehicle_type, CompanyID company_id) |
Checks whether service interval is enabled for the vehicle. | |
static void | DrawVehicleDetails (const Vehicle *v, int left, int right, int y, int vscroll_pos, uint vscroll_cap, TrainDetailsWindowTabs det_tab) |
Draw the details for the given vehicle at the position of the Details windows. | |
Data Fields | |
TrainDetailsWindowTabs | tab |
For train vehicles: which tab is displayed. |
Definition at line 1413 of file vehicle_gui.cpp.
virtual void VehicleDetailsWindow::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 1429 of file vehicle_gui.cpp.
References DAYS_IN_YEAR, FONT_HEIGHT_NORMAL, SpecializedVehicle< RoadVehicle, VEH_ROAD >::From(), GetStringBoundingBox(), Dimension::height, lengthof, max(), MAX_YEAR, maxdim(), SetDParam(), VEH_AIRCRAFT, VEH_ROAD, VEH_SHIP, WD_FRAMERECT_BOTTOM, WD_FRAMERECT_LEFT, WD_FRAMERECT_TOP, WD_MATRIX_BOTTOM, WD_MATRIX_TOP, and Dimension::width.
static bool VehicleDetailsWindow::IsVehicleServiceIntervalEnabled | ( | const VehicleType | vehicle_type, | |
CompanyID | company_id | |||
) | [inline, static] |
Checks whether service interval is enabled for the vehicle.
Definition at line 1497 of file vehicle_gui.cpp.
References VehicleDefaultSettings::servint_aircraft, VehicleDefaultSettings::servint_roadveh, VehicleDefaultSettings::servint_ships, VehicleDefaultSettings::servint_trains, VEH_AIRCRAFT, VEH_ROAD, VEH_SHIP, and VEH_TRAIN.
Referenced by OnPaint().
static void VehicleDetailsWindow::DrawVehicleDetails | ( | const Vehicle * | v, | |
int | left, | |||
int | right, | |||
int | y, | |||
int | vscroll_pos, | |||
uint | vscroll_cap, | |||
TrainDetailsWindowTabs | det_tab | |||
) | [inline, static] |
Draw the details for the given vehicle at the position of the Details windows.
v | current vehicle | |
left | The left most coordinate to draw | |
right | The right most coordinate to draw | |
y | The y coordinate | |
vscroll_pos | Position of scrollbar (train only) | |
vscroll_cap | Number of lines currently displayed (train only) | |
det_tab | Selected details tab (train only) |
Definition at line 1520 of file vehicle_gui.cpp.
References DrawAircraftDetails(), DrawRoadVehDetails(), DrawShipDetails(), DrawTrainDetails(), SpecializedVehicle< Aircraft, VEH_AIRCRAFT >::From(), SpecializedVehicle< Train, VEH_TRAIN >::From(), VEH_AIRCRAFT, VEH_ROAD, VEH_SHIP, and VEH_TRAIN.
Referenced by DrawWidget().
virtual void VehicleDetailsWindow::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 1531 of file vehicle_gui.cpp.
References SetDParam().
virtual void VehicleDetailsWindow::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 1536 of file vehicle_gui.cpp.
References _dynlang, _settings_game, Rect::bottom, DAYS_IN_LEAP_YEAR, DIR_E, DIR_W, DrawString(), DrawVehicleDetails(), DrawVehicleImage(), FONT_HEIGHT_NORMAL, SpecializedVehicle< Train, VEH_TRAIN >::From(), Scrollbar::GetCapacity(), INVALID_VEHICLE, Rect::left, Train::railtype, RAILTYPE_MAGLEV, Rect::right, SetDParam(), ST_NORMAL, tab, TD_RTL, DynamicLanguages::text_dir, Rect::top, ToPercent16(), VehicleSettings::train_acceleration_model, VEH_AIRCRAFT, VEH_ROAD, VEH_SHIP, VEH_TRAIN, GameSettings::vehicle, Window::vscroll, WD_FRAMERECT_LEFT, WD_FRAMERECT_TOP, WD_MATRIX_LEFT, WD_MATRIX_RIGHT, and WD_MATRIX_TOP.
virtual void VehicleDetailsWindow::OnPaint | ( | ) | [inline, virtual] |
Repaint vehicle details window.
Reimplemented from Window.
Definition at line 1618 of file vehicle_gui.cpp.
References Window::DisableWidget(), Window::DrawWidgets(), GetTrainDetailsWndVScroll(), IsVehicleServiceIntervalEnabled(), Scrollbar::SetCount(), Window::SetWidgetDisabledState(), Window::SetWidgetsDisabledState(), tab, VEH_TRAIN, Window::vscroll, and WIDGET_LIST_END.
virtual void VehicleDetailsWindow::OnClick | ( | Point | pt, | |
int | widget | |||
) | [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. |
Reimplemented from Window.
Definition at line 1638 of file vehicle_gui.cpp.
References _ctrl_pressed, CMD_CHANGE_SERVICE_INT, CMD_MSG, CS_ALPHANUMERAL, DoCommandP(), GetServiceIntervalClamped(), MAX_LENGTH_VEHICLE_NAME_BYTES, MAX_LENGTH_VEHICLE_NAME_PIXELS, QSF_ENABLE_DEFAULT, Window::SetDirty(), SetDParam(), Window::SetWidgetsDisabledState(), ShowQueryString(), tab, and WIDGET_LIST_END.
virtual void VehicleDetailsWindow::OnQueryTextFinished | ( | char * | str | ) | [inline, virtual] |
The query window opened from this window has closed.
str | the new value of the string or NULL if the window was cancelled. |
Reimplemented from Window.
Definition at line 1678 of file vehicle_gui.cpp.
References CMD_MSG, CMD_RENAME_VEHICLE, and DoCommandP().
virtual void VehicleDetailsWindow::OnResize | ( | ) | [inline, virtual] |
Called after the window got resized.
For nested windows with a viewport, call NWidgetViewport::UpdateViewportCoordinates.
Reimplemented from Window.
Definition at line 1685 of file vehicle_gui.cpp.
References Scrollbar::GetCapacity(), MAT_COL_START, MAT_ROW_START, Scrollbar::SetCapacityFromWidget(), Window::vscroll, and NWidgetCore::widget_data.