Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00012 #ifndef VEHICLE_GUI_BASE_H
00013 #define VEHICLE_GUI_BASE_H
00014
00015 #include "sortlist_type.h"
00016 #include "vehiclelist.h"
00017 #include "window_gui.h"
00018 #include "widgets/dropdown_type.h"
00019
00020 typedef GUIList<const Vehicle*> GUIVehicleList;
00021
00022 struct BaseVehicleListWindow : public Window {
00023 GUIVehicleList vehicles;
00024 Listing *sorting;
00025 byte unitnumber_digits;
00026 Scrollbar *vscroll;
00027 VehicleListIdentifier vli;
00028
00029 enum ActionDropdownItem {
00030 ADI_REPLACE,
00031 ADI_SERVICE,
00032 ADI_DEPOT,
00033 ADI_ADD_SHARED,
00034 ADI_REMOVE_ALL,
00035 };
00036
00037 static const StringID vehicle_depot_name[];
00038 static const StringID vehicle_sorter_names[];
00039 static GUIVehicleList::SortFunction * const vehicle_sorter_funcs[];
00040
00041 BaseVehicleListWindow(WindowDesc *desc, WindowNumber wno) : Window(desc), vli(wno)
00042 {
00043 this->vehicles.SetSortFuncs(this->vehicle_sorter_funcs);
00044 }
00045
00046 void DrawVehicleListItems(VehicleID selected_vehicle, int line_height, const Rect &r) const;
00047 void SortVehicleList();
00048 void BuildVehicleList();
00049 Dimension GetActionDropdownSize(bool show_autoreplace, bool show_group);
00050 DropDownList *BuildActionDropdownList(bool show_autoreplace, bool show_group);
00051 };
00052
00053 uint GetVehicleListHeight(VehicleType type, uint divisor = 1);
00054
00055 struct Sorting {
00056 Listing aircraft;
00057 Listing roadveh;
00058 Listing ship;
00059 Listing train;
00060 };
00061
00062 extern Sorting _sorting;
00063
00064 #endif