OpenTTD
vehicle_gui_base.h
Go to the documentation of this file.
1 /* $Id: vehicle_gui_base.h 27677 2016-11-05 19:16:59Z frosch $ */
2 
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  */
9 
12 #ifndef VEHICLE_GUI_BASE_H
13 #define VEHICLE_GUI_BASE_H
14 
15 #include "sortlist_type.h"
16 #include "vehiclelist.h"
17 #include "window_gui.h"
18 #include "widgets/dropdown_type.h"
19 
21 
22 struct BaseVehicleListWindow : public Window {
26  Scrollbar *vscroll;
28 
29  enum ActionDropdownItem {
30  ADI_REPLACE,
31  ADI_SERVICE,
32  ADI_DEPOT,
33  ADI_ADD_SHARED,
34  ADI_REMOVE_ALL,
35  };
36 
37  static const StringID vehicle_depot_name[];
38  static const StringID vehicle_sorter_names[];
39  static GUIVehicleList::SortFunction * const vehicle_sorter_funcs[];
40 
42  {
43  this->vehicles.SetSortFuncs(this->vehicle_sorter_funcs);
44  }
45 
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);
51 };
52 
53 uint GetVehicleListHeight(VehicleType type, uint divisor = 1);
54 
55 struct Sorting {
56  Listing aircraft;
57  Listing roadveh;
58  Listing ship;
59  Listing train;
60 };
61 
62 extern Sorting _sorting;
63 
64 #endif /* VEHICLE_GUI_BASE_H */