00001 /* $Id: vehicle_gui_base.h 18809 2010-01-15 16:41:15Z rubidium $ */ 00002 00003 /* 00004 * This file is part of OpenTTD. 00005 * 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. 00006 * 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. 00007 * 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/>. 00008 */ 00009 00012 #ifndef VEHICLE_GUI_BASE_H 00013 #define VEHICLE_GUI_BASE_H 00014 00015 #include "sortlist_type.h" 00016 #include "window_gui.h" 00017 00018 typedef GUIList<const Vehicle*> GUIVehicleList; 00019 00020 struct BaseVehicleListWindow : public Window { 00021 GUIVehicleList vehicles; 00022 Listing *sorting; 00023 VehicleType vehicle_type; 00024 byte unitnumber_digits; 00025 00026 static const StringID vehicle_sorter_names[]; 00027 static GUIVehicleList::SortFunction * const vehicle_sorter_funcs[]; 00028 00029 BaseVehicleListWindow() : Window() 00030 { 00031 this->vehicles.SetSortFuncs(this->vehicle_sorter_funcs); 00032 } 00033 00034 void DrawVehicleListItems(VehicleID selected_vehicle, int line_height, const Rect &r) const; 00035 void SortVehicleList(); 00036 void BuildVehicleList(Owner owner, uint16 index, uint16 window_type); 00037 }; 00038 00039 uint GetVehicleListHeight(VehicleType type, uint divisor = 1); 00040 00041 struct Sorting { 00042 Listing aircraft; 00043 Listing roadveh; 00044 Listing ship; 00045 Listing train; 00046 }; 00047 00048 extern Sorting _sorting; 00049 00050 #endif /* VEHICLE_GUI_BASE_H */