2008-09-13 10:04:36 +00:00
|
|
|
/* $Id$ */
|
|
|
|
|
2009-08-21 20:21:05 +00:00
|
|
|
/*
|
|
|
|
* This file is part of OpenTTD.
|
|
|
|
* 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.
|
|
|
|
* 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.
|
|
|
|
* 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/>.
|
|
|
|
*/
|
|
|
|
|
2008-09-13 10:04:36 +00:00
|
|
|
/** @file vehicle_gui_base.h Functions/classes shared between the different vehicle list GUIs. */
|
|
|
|
|
|
|
|
#ifndef VEHICLE_GUI_BASE_H
|
|
|
|
#define VEHICLE_GUI_BASE_H
|
|
|
|
|
|
|
|
#include "sortlist_type.h"
|
2010-01-15 16:41:15 +00:00
|
|
|
#include "window_gui.h"
|
2008-09-13 10:04:36 +00:00
|
|
|
|
|
|
|
typedef GUIList<const Vehicle*> GUIVehicleList;
|
|
|
|
|
2009-11-17 11:36:36 +00:00
|
|
|
struct BaseVehicleListWindow : public Window {
|
2008-09-13 10:04:36 +00:00
|
|
|
GUIVehicleList vehicles; ///< The list of vehicles
|
|
|
|
Listing *sorting; ///< Pointer to the vehicle type related sorting.
|
|
|
|
VehicleType vehicle_type; ///< The vehicle type that is sorted
|
2009-12-20 16:44:41 +00:00
|
|
|
byte unitnumber_digits; ///< The number of digits of the highest unit number
|
2008-09-13 10:04:36 +00:00
|
|
|
|
|
|
|
static const StringID vehicle_sorter_names[];
|
2009-03-15 16:04:39 +00:00
|
|
|
static GUIVehicleList::SortFunction * const vehicle_sorter_funcs[];
|
2008-09-13 10:04:36 +00:00
|
|
|
|
2009-10-25 14:52:46 +00:00
|
|
|
BaseVehicleListWindow() : Window()
|
|
|
|
{
|
|
|
|
this->vehicles.SetSortFuncs(this->vehicle_sorter_funcs);
|
|
|
|
}
|
|
|
|
|
|
|
|
void DrawVehicleListItems(VehicleID selected_vehicle, int line_height, const Rect &r) const;
|
2008-09-13 10:04:36 +00:00
|
|
|
void SortVehicleList();
|
2008-09-30 20:39:50 +00:00
|
|
|
void BuildVehicleList(Owner owner, uint16 index, uint16 window_type);
|
2008-09-13 10:04:36 +00:00
|
|
|
};
|
|
|
|
|
2009-11-16 21:28:12 +00:00
|
|
|
uint GetVehicleListHeight(VehicleType type, uint divisor = 1);
|
|
|
|
|
2008-09-13 10:04:36 +00:00
|
|
|
struct Sorting {
|
|
|
|
Listing aircraft;
|
|
|
|
Listing roadveh;
|
|
|
|
Listing ship;
|
|
|
|
Listing train;
|
|
|
|
};
|
|
|
|
|
|
|
|
extern Sorting _sorting;
|
|
|
|
|
|
|
|
#endif /* VEHICLE_GUI_BASE_H */
|