diff options
author | rubidium <rubidium@openttd.org> | 2008-09-13 10:04:36 +0000 |
---|---|---|
committer | rubidium <rubidium@openttd.org> | 2008-09-13 10:04:36 +0000 |
commit | fc62d736f700ca344531a96ca02324695af8d761 (patch) | |
tree | 8353668207ed45dd097f497674f94e32c038e784 /src/vehicle_gui_base.h | |
parent | 1647597943ecf5e1e8bf1370de3bd9385aa49296 (diff) | |
download | openttd-fc62d736f700ca344531a96ca02324695af8d761.tar.xz |
(svn r14306) -Codechange: unify the code to draw the vehicle list.
-Fix [FS#2292]: inconsistency between drawn vehicle lists in the vehicle list and group windows.
Diffstat (limited to 'src/vehicle_gui_base.h')
-rw-r--r-- | src/vehicle_gui_base.h | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/src/vehicle_gui_base.h b/src/vehicle_gui_base.h new file mode 100644 index 000000000..be2b5897b --- /dev/null +++ b/src/vehicle_gui_base.h @@ -0,0 +1,47 @@ +/* $Id$ */ + +/** @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" + +/** Start of functions regarding vehicle list windows */ +enum { + PLY_WND_PRC__OFFSET_TOP_WIDGET = 26, + PLY_WND_PRC__SIZE_OF_ROW_TINY = 13, + PLY_WND_PRC__SIZE_OF_ROW_SMALL = 26, + PLY_WND_PRC__SIZE_OF_ROW_BIG = 39, +}; + +typedef GUIList<const Vehicle*> GUIVehicleList; + +struct BaseVehicleListWindow: public Window { + GUIVehicleList vehicles; ///< The list of vehicles + Listing *sorting; ///< Pointer to the vehicle type related sorting. + VehicleType vehicle_type; ///< The vehicle type that is sorted + + static const StringID vehicle_sorter_names[]; + static GUIVehicleList::SortFunction *const vehicle_sorter_funcs[]; + + BaseVehicleListWindow(const WindowDesc *desc, WindowNumber window_number) : Window(desc, window_number) + { + this->vehicles.SetSortFuncs(this->vehicle_sorter_funcs); + } + + void DrawVehicleListItems(int x); + void SortVehicleList(); + void BuildVehicleList(PlayerID owner, uint16 index, uint16 window_type); +}; + +struct Sorting { + Listing aircraft; + Listing roadveh; + Listing ship; + Listing train; +}; + +extern Sorting _sorting; + +#endif /* VEHICLE_GUI_BASE_H */ |