Rearrange storage of reserved tracks for railway tiles
[openttd/fttd.git] / src / vehicle_gui_base.h
blob1c03f7b34dde8dd0f19f703db8c83c4c2ce3c0f6
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(WindowDesc *desc, WindowNumber wno) : Window(desc), vli(wno)
43 this->vehicles.SetSortFuncs(this->vehicle_sorter_funcs);
46 void DrawVehicleListItems(VehicleID selected_vehicle, int line_height, const Rect &r) const;
47 void SortVehicleList();
48 void BuildVehicleList();
49 Dimension GetActionDropdownSize(bool show_autoreplace, bool show_group);
50 DropDownList *BuildActionDropdownList(bool show_autoreplace, bool show_group);
53 uint GetVehicleListHeight(VehicleType type, uint divisor = 1);
55 struct Sorting {
56 Listing aircraft;
57 Listing roadveh;
58 Listing ship;
59 Listing train;
62 extern Sorting _sorting;
64 #endif /* VEHICLE_GUI_BASE_H */