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-09-08 21:28:50 +00:00
|
|
|
#include "vehiclelist.h"
|
2010-01-15 16:41:15 +00:00
|
|
|
#include "window_gui.h"
|
2010-07-17 14:36:36 +00:00
|
|
|
#include "widgets/dropdown_type.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.
|
2009-12-20 16:44:41 +00:00
|
|
|
byte unitnumber_digits; ///< The number of digits of the highest unit number
|
2010-08-12 08:37:01 +00:00
|
|
|
Scrollbar *vscroll;
|
2010-09-09 14:40:39 +00:00
|
|
|
VehicleListIdentifier vli; ///< Identifier of the vehicle list we want to currently show.
|
2008-09-13 10:04:36 +00:00
|
|
|
|
2010-07-17 14:36:36 +00:00
|
|
|
enum ActionDropdownItem {
|
|
|
|
ADI_REPLACE,
|
|
|
|
ADI_SERVICE,
|
|
|
|
ADI_DEPOT,
|
|
|
|
ADI_ADD_SHARED,
|
|
|
|
ADI_REMOVE_ALL,
|
|
|
|
};
|
|
|
|
|
2010-07-17 14:53:46 +00:00
|
|
|
static const StringID vehicle_depot_name[];
|
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
|
|
|
|
2010-09-09 14:40:39 +00:00
|
|
|
BaseVehicleListWindow(WindowNumber wno) : Window(), vli(wno)
|
2009-10-25 14:52:46 +00:00
|
|
|
{
|
|
|
|
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();
|
2010-09-09 14:40:39 +00:00
|
|
|
void BuildVehicleList();
|
2010-07-17 14:58:35 +00:00
|
|
|
Dimension GetActionDropdownSize(bool show_autoreplace, bool show_group);
|
|
|
|
DropDownList *BuildActionDropdownList(bool show_autoreplace, bool show_group);
|
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 */
|