# BaseVehicleListWindow Struct Reference

Inheritance diagram for BaseVehicleListWindow:

## Public Types
enum | ActionDropdownItem { ADI_REPLACE, ADI_SERVICE, ADI_DEPOT, ADI_ADD_SHARED, ADI_REMOVE_ALL }
## Public Member Functions
| BaseVehicleListWindow (WindowNumber wno)
void | DrawVehicleListItems (VehicleID selected_vehicle, int line_height, const Rect &r) const
| Draw all the vehicle list items.
void | SortVehicleList ()
void | BuildVehicleList ()
Dimension | GetActionDropdownSize (bool show_autoreplace, bool show_group)
| Compute the size for the Action dropdown.
DropDownList * | BuildActionDropdownList (bool show_autoreplace, bool show_group)
| Display the Action dropdown window.
## Data Fields
GUIVehicleList | vehicles
| The list of vehicles.
Listing * | sorting
| Pointer to the vehicle type related sorting.
byte | unitnumber_digits
| The number of digits of the highest unit number.
Scrollbar * | vscroll
VehicleListIdentifier | vli
| Identifier of the vehicle list we want to currently show.
## Static Public Attributes
static const StringID | vehicle_depot_name []
static const StringID | vehicle_sorter_names []
static GUIVehicleList::SortFunction *const | vehicle_sorter_funcs []

## Detailed Description

Definition at line 22 of file vehicle_gui_base.h.

## Member Function Documentation

DropDownList * BaseVehicleListWindow::BuildActionDropdownList | ( | bool | show_autoreplace,
|  | bool | show_group |
| ) |  |  |

Display the Action dropdown window.

Parameters:

  | show_autoreplace | If true include the autoreplace item.
  | show_group | If true include group-related stuff.

Returns:
  Itemlist for dropdown

Definition at line 157 of file vehicle_gui.cpp.

References vli, and VehicleListIdentifier::vtype.

Referenced by VehicleListWindow::OnClick(), and VehicleGroupWindow::OnClick().

void BaseVehicleListWindow::DrawVehicleListItems | ( | VehicleID | selected_vehicle,
|  | int | line_height,
|  | const Rect & | r |
| ) |  |  | const

Draw all the vehicle list items.

Parameters:

  | selected_vehicle | The vehicle that is to be highlighted.
  | line_height | Height of a single item line.
  | r | Rectangle with edge positions of the matrix widget.

Definition at line 1277 of file vehicle_gui.cpp.

References _current_text_dir, Vehicle::age, Vehicle::cur_real_order_index, DAYS_IN_LEAP_YEAR, DEFAULT_GROUP, DrawString(), DrawVehicleImage(), DrawVehicleProfitButton(), FONT_HEIGHT_NORMAL, FONT_HEIGHT_SMALL, Scrollbar::GetCapacity(), GetDigitWidth(), Vehicle::GetDisplayProfitLastYear(), Vehicle::GetDisplayProfitThisYear(), Scrollbar::GetPosition(), GetSpriteSize(), Vehicle::group_id, Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tcache, Tzero >::PoolItem< Tpool >::index, Vehicle::IsInDepot(), SmallVector< T, S >::Length(), max(), Vehicle::max_age, min(), Vehicle::name, SetDParam(), TD_RTL, Vehicle::unitnumber, unitnumber_digits, VEH_SHIP, vehicles, vli, VehicleListIdentifier::vtype, WD_FRAMERECT_BOTTOM, WD_FRAMERECT_RIGHT, WD_MATRIX_LEFT, WD_MATRIX_RIGHT, and Window::width.

Referenced by VehicleListWindow::DrawWidget(), and VehicleGroupWindow::DrawWidget().

Dimension BaseVehicleListWindow::GetActionDropdownSize | ( | bool | show_autoreplace,
|  | bool | show_group |
| ) |  |  |

Compute the size for the Action dropdown.

Parameters:

  | show_autoreplace | If true include the autoreplace item.
  | show_group | If true include group-related stuff.

Returns:
  Required size.

Definition at line 135 of file vehicle_gui.cpp.

References GetStringBoundingBox(), maxdim(), vli, and VehicleListIdentifier::vtype.

Referenced by VehicleListWindow::UpdateWidgetSize(), and VehicleGroupWindow::UpdateWidgetSize().

## Field Documentation

const StringID BaseVehicleListWindow::vehicle_depot_name`[static]`

Initial value:

     {
      STR_VEHICLE_LIST_SEND_TRAIN_TO_DEPOT,
      STR_VEHICLE_LIST_SEND_ROAD_VEHICLE_TO_DEPOT,
      STR_VEHICLE_LIST_SEND_SHIP_TO_DEPOT,
      STR_VEHICLE_LIST_SEND_AIRCRAFT_TO_HANGAR
    }

Definition at line 37 of file vehicle_gui_base.h.

GUIVehicleList::SortFunction *const BaseVehicleListWindow::vehicle_sorter_funcs`[static]`

Initial value:

     {
      &VehicleNumberSorter,
      &VehicleNameSorter,
      &VehicleAgeSorter,
      &VehicleProfitThisYearSorter,
      &VehicleProfitLastYearSorter,
      &VehicleCargoSorter,
      &VehicleReliabilitySorter,
      &VehicleMaxSpeedSorter,
      &VehicleModelSorter,
      &VehicleValueSorter,
      &VehicleLengthSorter,
      &VehicleTimeToLiveSorter,
      &VehicleTimetableDelaySorter,
    }

Definition at line 39 of file vehicle_gui_base.h.

const StringID BaseVehicleListWindow::vehicle_sorter_names`[static]`

Initial value:

     {
      STR_SORT_BY_NUMBER,
      STR_SORT_BY_NAME,
      STR_SORT_BY_AGE,
      STR_SORT_BY_PROFIT_THIS_YEAR,
      STR_SORT_BY_PROFIT_LAST_YEAR,
      STR_SORT_BY_TOTAL_CAPACITY_PER_CARGOTYPE,
      STR_SORT_BY_RELIABILITY,
      STR_SORT_BY_MAX_SPEED,
      STR_SORT_BY_MODEL,
      STR_SORT_BY_VALUE,
      STR_SORT_BY_LENGTH,
      STR_SORT_BY_LIFE_TIME,
      STR_SORT_BY_TIMETABLE_DELAY,
      INVALID_STRING_ID
    }

Definition at line 38 of file vehicle_gui_base.h.

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

- src/vehicle_gui_base.h
- src/vehicle_gui.cpp