|
OpenTTD Source
1.11.0-beta1
|
Go to the documentation of this file.
10 #ifndef VEHICLE_GUI_BASE_H
11 #define VEHICLE_GUI_BASE_H
35 std::ptrdiff_t NumVehicles()
const
39 const Vehicle *GetSingleVehicle()
const
41 assert(NumVehicles() == 1);
68 enum ActionDropdownItem {
76 static const StringID vehicle_depot_name[];
77 static const StringID vehicle_group_by_names[];
78 static const StringID vehicle_group_none_sorter_names[];
79 static const StringID vehicle_group_shared_orders_sorter_names[];
80 static VehicleGroupSortFunction *
const vehicle_group_none_sorter_funcs[];
81 static VehicleGroupSortFunction *
const vehicle_group_shared_orders_sorter_funcs[];
85 void UpdateSortingFromGrouping();
88 void UpdateVehicleGroupBy(GroupBy group_by);
89 void SortVehicleList();
90 void BuildVehicleList();
94 const StringID *GetVehicleSorterNames()
96 switch (this->grouping) {
98 return vehicle_group_none_sorter_names;
99 case GB_SHARED_ORDERS:
100 return vehicle_group_shared_orders_sorter_names;
106 VehicleGroupSortFunction *
const *GetVehicleSorterFuncs()
108 switch (this->grouping) {
110 return vehicle_group_none_sorter_funcs;
111 case GB_SHARED_ORDERS:
112 return vehicle_group_shared_orders_sorter_funcs;
128 extern BaseVehicleListWindow::GroupBy _grouping[VLT_END][
VEH_COMPANY_END];
129 extern Sorting _sorting[BaseVehicleListWindow::GB_END];
Dimension GetActionDropdownSize(bool show_autoreplace, bool show_group)
Compute the size for the Action dropdown.
std::vector< const Vehicle * > VehicleList
A list of vehicles.
Dimensions (a width and height) of a rectangle in 2D.
GroupBy grouping
How we want to group the list.
The information about a vehicle list.
List template of 'things' T to sort in a GUI.
std::vector< std::unique_ptr< const DropDownListItem > > DropDownList
A drop down list is a collection of drop down list items.
uint GetVehicleListHeight(VehicleType type, uint divisor=1)
Get the height of a vehicle in the vehicle list GUIs.
Listing * sorting
Pointer to the vehicle type related sorting.
VehicleList::const_iterator vehicles_begin
Pointer to beginning element of this vehicle group.
Date age
Age in days of oldest vehicle in the group.
int32 WindowNumber
Number to differentiate different windows of the same class.
High level window description.
Money display_profit_this_year
Total profit for the vehicle group this year.
VehicleListIdentifier vli
Identifier of the vehicle list we want to currently show.
DropDownList BuildActionDropdownList(bool show_autoreplace, bool show_group)
Display the Action dropdown window.
Data structure describing how to show the list (what sort direction and criteria).
@ VEH_COMPANY_END
Last company-ownable type.
bool SortFunction(const GUIVehicleGroup &, const GUIVehicleGroup &)
Signature of sort function.
int32 Date
The type to store our dates in.
VehicleType
Available vehicle types.
void DrawVehicleListItems(VehicleID selected_vehicle, int line_height, const Rect &r) const
Draw all the vehicle list items.
uint32 StringID
Numeric value that represents a string, independent of the selected language.
GUIVehicleGroupList vehgroups
List of (groups of) vehicles. This stores iterators of vehicles, and should be rebuilt if vehicles is...
uint32 VehicleID
The type all our vehicle IDs have.
VehicleList vehicles
List of vehicles. This is the buffer for vehgroups to point into; if this is structurally modified,...
byte unitnumber_digits
The number of digits of the highest unit number.
Data structure for an opened window.
Specification of a rectangle with absolute coordinates of all edges.
Money display_profit_last_year
Total profit for the vehicle group laste year.
VehicleList::const_iterator vehicles_end
Pointer to past-the-end element of this vehicle group.