# vehicle_gui_base.h

Go to the documentation of this file.

    00001 /* $Id: vehicle_gui_base.h 18576 2009-12-20 16:44:41Z 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
    00017 typedef GUIList<const Vehicle*> GUIVehicleList;
    00018
    00019 struct BaseVehicleListWindow : public Window {
    00020   GUIVehicleList vehicles;
    00021   Listing *sorting;
    00022   VehicleType vehicle_type;
    00023   byte unitnumber_digits;
    00024
    00025   static const StringID vehicle_sorter_names[];
    00026   static GUIVehicleList::SortFunction * const vehicle_sorter_funcs[];
    00027
    00028   BaseVehicleListWindow() : Window()
    00029   {
    00030     this->vehicles.SetSortFuncs(this->vehicle_sorter_funcs);
    00031   }
    00032
    00033   void DrawVehicleListItems(VehicleID selected_vehicle, int line_height, const Rect &r) const;
    00034   void SortVehicleList();
    00035   void BuildVehicleList(Owner owner, uint16 index, uint16 window_type);
    00036 };
    00037
    00038 uint GetVehicleListHeight(VehicleType type, uint divisor = 1);
    00039
    00040 struct Sorting {
    00041   Listing aircraft;
    00042   Listing roadveh;
    00043   Listing ship;
    00044   Listing train;
    00045 };
    00046
    00047 extern Sorting _sorting;
    00048
    00049 #endif /* VEHICLE_GUI_BASE_H */