Window for the (old) vehicle listing. More...
Public Member Functions | |
VehicleListWindow (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, int click_count) |
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=0, bool gui_scope=true) |
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... |
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 1417 of file vehicle_gui.cpp.
enum VehicleListWindow::ButtonPlanes [private] |
Enumeration of planes of the button row at the bottom.
Definition at line 1420 of file vehicle_gui.cpp.
virtual void VehicleListWindow::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 1549 of file vehicle_gui.cpp.
References Window::DrawSortButtonState(), BaseVehicleListWindow::DrawVehicleListItems(), INVALID_VEHICLE, GUIList< T, F >::IsDescSortOrder(), Window::resize, SBS_DOWN, ResizeInfo::step_height, BaseVehicleListWindow::vehicles, WID_VL_LIST, and WID_VL_SORT_ORDER.
virtual void VehicleListWindow::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 1595 of file vehicle_gui.cpp.
References BaseVehicleListWindow::BuildActionDropdownList(), CMD_MASS_START_STOP, DoCommandP(), Scrollbar::GetScrolledRowFromWidget(), INVALID_TILE, SmallVector< T, S >::Length(), Window::SetDirty(), ShowDropDownList(), ShowDropDownMenu(), ShowVehicleViewWindow(), GUIList< T, F >::SortType(), GUIList< T, F >::ToggleSortOrder(), VEH_TRAIN, VehicleClicked(), BaseVehicleListWindow::vehicles, BaseVehicleListWindow::vli, VehicleListIdentifier::vtype, WID_VL_AVAILABLE_VEHICLES, WID_VL_LIST, WID_VL_MANAGE_VEHICLES_DROPDOWN, WID_VL_SORT_BY_PULLDOWN, WID_VL_SORT_ORDER, WID_VL_START_ALL, and WID_VL_STOP_ALL.
virtual void VehicleListWindow::OnDropdownSelect | ( | int | widget, | |
int | index | |||
) | [inline, virtual] |
A dropdown option associated to this window has been selected.
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 1634 of file vehicle_gui.cpp.
References ALL_GROUP, DEPOT_MASS_SEND, DEPOT_SERVICE, DoCommandP(), SmallVector< T, S >::Length(), Window::SetDirty(), GUIList< T, F >::SetSortType(), ShowReplaceGroupVehicleWindow(), BaseVehicleListWindow::vehicles, BaseVehicleListWindow::vli, VehicleListIdentifier::vtype, WID_VL_MANAGE_VEHICLES_DROPDOWN, and WID_VL_SORT_BY_PULLDOWN.
virtual void VehicleListWindow::OnInvalidateData | ( | int | data = 0 , |
|
bool | gui_scope = true | |||
) | [inline, virtual] |
Some data on this window has become invalid.
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 1682 of file vehicle_gui.cpp.
References GUIList< T, F >::ForceRebuild(), GUIList< T, F >::ForceResort(), GB(), HasBit(), VehicleListIdentifier::index, VehicleListIdentifier::Pack(), VehicleListIdentifier::type, BaseVehicleListWindow::vehicles, and BaseVehicleListWindow::vli.
virtual void VehicleListWindow::OnPaint | ( | ) | [inline, virtual] |
The window must be repainted.
Reimplemented from Window.
Definition at line 1563 of file vehicle_gui.cpp.
References _local_company, BP_HIDE_BUTTONS, BP_SHOW_BUTTONS, Window::DrawWidgets(), HideDropDownMenu(), Window::IsWidgetLowered(), SmallVector< T, S >::Length(), Window::owner, NWidgetBase::SetDirty(), NWidgetStacked::SetDisplayedPlane(), Window::SetWidgetDisabledState(), Window::SetWidgetsDisabledState(), NWidgetStacked::shown_plane, GUIList< T, F >::SortType(), VehicleListIdentifier::type, BaseVehicleListWindow::vehicles, BaseVehicleListWindow::vli, WID_VL_AVAILABLE_VEHICLES, WID_VL_MANAGE_VEHICLES_DROPDOWN, and WIDGET_LIST_END.
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 1671 of file vehicle_gui.cpp.
References Scrollbar::GetCapacity(), MAT_COL_START, Scrollbar::SetCapacityFromWidget(), and WID_VL_LIST.
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.
widget | Widget number. |
Reimplemented from Window.
Definition at line 1506 of file vehicle_gui.cpp.
References Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_station_pool >::Get(), Scrollbar::GetCount(), VehicleListIdentifier::index, SpecializedStation< Station, false >::IsExpected(), SmallVector< T, S >::Length(), SetDParam(), VehicleListIdentifier::type, BaseVehicleListWindow::vehicles, BaseVehicleListWindow::vli, VehicleListIdentifier::vtype, WID_VL_AVAILABLE_VEHICLES, and WID_VL_CAPTION.
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.
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 1469 of file vehicle_gui.cpp.
References BaseVehicleListWindow::GetActionDropdownSize(), GetStringBoundingBox(), GetVehicleListHeight(), maxdim(), VehicleListIdentifier::type, VEH_AIRCRAFT, VEH_ROAD, VEH_SHIP, VEH_TRAIN, BaseVehicleListWindow::vli, VehicleListIdentifier::vtype, WD_SORTBUTTON_ARROW_WIDTH, WID_VL_LIST, WID_VL_MANAGE_VEHICLES_DROPDOWN, and WID_VL_SORT_ORDER.