Fix old map array tunnel head conversion
[openttd/fttd.git] / src / vehicle_gui_base.h
blobe64ea96ac2a9f0ba9dd08a70ca3061971b26230e
1 /* $Id$ */
3 /*
4 * This file is part of OpenTTD.
5 * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
6 * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
7 * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
8 */
10 /** @file vehicle_gui_base.h Functions/classes shared between the different vehicle list GUIs. */
12 #ifndef VEHICLE_GUI_BASE_H
13 #define VEHICLE_GUI_BASE_H
15 #include "sortlist_type.h"
16 #include "vehiclelist.h"
17 #include "window_gui.h"
18 #include "widgets/dropdown_type.h"
20 typedef GUIList<const Vehicle*> GUIVehicleList;
22 struct BaseVehicleListWindow : public Window {
23 GUIVehicleList vehicles; ///< The list of vehicles
24 Listing *sorting; ///< Pointer to the vehicle type related sorting.
25 byte unitnumber_digits; ///< The number of digits of the highest unit number
26 Scrollbar *vscroll;
27 VehicleListIdentifier vli; ///< Identifier of the vehicle list we want to currently show.
29 enum ActionDropdownItem {
30 ADI_REPLACE,
31 ADI_SERVICE,
32 ADI_DEPOT,
33 ADI_ADD_SHARED,
34 ADI_REMOVE_ALL,
37 static const StringID vehicle_depot_name[];
38 static const StringID vehicle_sorter_names[];
39 static GUIVehicleList::SortFunction * const vehicle_sorter_funcs[];
41 BaseVehicleListWindow (const WindowDesc *desc, WindowNumber wno)
42 : Window (desc), vehicles(), sorting (NULL),
43 unitnumber_digits (0), vscroll (NULL),
44 vli (VehicleListIdentifier::UnPack(wno))
46 this->vehicles.SetSortFuncs(this->vehicle_sorter_funcs);
49 void DrawVehicleListItems (BlitArea *dpi, VehicleID selected_vehicle, int line_height, const Rect &r) const;
50 void SortVehicleList();
51 void BuildVehicleList();
52 Dimension GetActionDropdownSize(bool show_autoreplace, bool show_group);
53 DropDownList *BuildActionDropdownList(bool show_autoreplace, bool show_group);
56 uint GetVehicleListHeight(VehicleType type, uint divisor = 1);
58 struct Sorting {
59 Listing aircraft;
60 Listing roadveh;
61 Listing ship;
62 Listing train;
65 extern Sorting _sorting;
67 #endif /* VEHICLE_GUI_BASE_H */