src/vehicle_gui_base.h
author rubidium
Thu, 18 Dec 2008 12:23:08 +0000
changeset 10436 8d3a9fbe8f19
parent 10207 c291a21b304e
permissions -rw-r--r--
(svn r14689) -Change: make configure die on commonly made user mistakes, like not having SDL development files or zlib headers installed; you can still compile a dedicated server or a binary without zlib, but you have to explicitly force it.
2186
db48cf29b983 (svn r2701) Insert Id tags into all source files
tron
parents: 2159
diff changeset
     1
/* $Id$ */
db48cf29b983 (svn r2701) Insert Id tags into all source files
tron
parents: 2159
diff changeset
     2
10122
c524226103f1 (svn r14306) -Codechange: unify the code to draw the vehicle list.
rubidium
parents: 10117
diff changeset
     3
/** @file vehicle_gui_base.h Functions/classes shared between the different vehicle list GUIs. */
6423
8e10e79e0fd1 (svn r9559) -Documentation: doxygen and comment changes: 'U' and 'V' now. Almost done. Yeah. I know, I've already said that...
belugas
parents: 6385
diff changeset
     4
10122
c524226103f1 (svn r14306) -Codechange: unify the code to draw the vehicle list.
rubidium
parents: 10117
diff changeset
     5
#ifndef VEHICLE_GUI_BASE_H
c524226103f1 (svn r14306) -Codechange: unify the code to draw the vehicle list.
rubidium
parents: 10117
diff changeset
     6
#define VEHICLE_GUI_BASE_H
164
0cbdf3c9bde1 (svn r165) -Feature: Option to sort vehicles in vehicle-list window by different criteria. Total independent sort for all types and players. Periodic resort of list every 10 TTD days. Thank you for your graphical inspiration follow and buxo (since none of you provided any code).
darkvater
parents:
diff changeset
     7
9274
42b67e65f1c2 (svn r13140) -Codechange: move the gui-list-sorting out of window_gui.h so window_gui.h only needs to be included in *_gui.cpp.
rubidium
parents: 9183
diff changeset
     8
#include "sortlist_type.h"
8350
8979cccdbed2 (svn r11916) -Codechange: use enums from VehicleViewWindowWidgets instead of constants
smatz
parents: 8212
diff changeset
     9
8979cccdbed2 (svn r11916) -Codechange: use enums from VehicleViewWindowWidgets instead of constants
smatz
parents: 8212
diff changeset
    10
/** Start of functions regarding vehicle list windows */
6643
f81bee57bc09 (svn r9874) -Feature: advanced vehicle lists a.k.a. group interface. Now you can make groups of vehicles and perform all kinds of tasks on that given group. Original code by nycom and graphics by skidd13.
rubidium
parents: 6638
diff changeset
    11
enum {
f81bee57bc09 (svn r9874) -Feature: advanced vehicle lists a.k.a. group interface. Now you can make groups of vehicles and perform all kinds of tasks on that given group. Original code by nycom and graphics by skidd13.
rubidium
parents: 6638
diff changeset
    12
	PLY_WND_PRC__OFFSET_TOP_WIDGET = 26,
f81bee57bc09 (svn r9874) -Feature: advanced vehicle lists a.k.a. group interface. Now you can make groups of vehicles and perform all kinds of tasks on that given group. Original code by nycom and graphics by skidd13.
rubidium
parents: 6638
diff changeset
    13
	PLY_WND_PRC__SIZE_OF_ROW_TINY  = 13,
f81bee57bc09 (svn r9874) -Feature: advanced vehicle lists a.k.a. group interface. Now you can make groups of vehicles and perform all kinds of tasks on that given group. Original code by nycom and graphics by skidd13.
rubidium
parents: 6638
diff changeset
    14
	PLY_WND_PRC__SIZE_OF_ROW_SMALL = 26,
10117
dd9f49319539 (svn r14301) -Codechange: give the vehicle list and group list the same relative size and the same absolute height for the vehicle list items.
rubidium
parents: 9963
diff changeset
    15
	PLY_WND_PRC__SIZE_OF_ROW_BIG   = 39,
6643
f81bee57bc09 (svn r9874) -Feature: advanced vehicle lists a.k.a. group interface. Now you can make groups of vehicles and perform all kinds of tasks on that given group. Original code by nycom and graphics by skidd13.
rubidium
parents: 6638
diff changeset
    16
};
f81bee57bc09 (svn r9874) -Feature: advanced vehicle lists a.k.a. group interface. Now you can make groups of vehicles and perform all kinds of tasks on that given group. Original code by nycom and graphics by skidd13.
rubidium
parents: 6638
diff changeset
    17
9182
412cb6c0caf1 (svn r13045) -Codechange: make list_d (now GUIList) more generic and uniform.
rubidium
parents: 9174
diff changeset
    18
typedef GUIList<const Vehicle*> GUIVehicleList;
412cb6c0caf1 (svn r13045) -Codechange: make list_d (now GUIList) more generic and uniform.
rubidium
parents: 9174
diff changeset
    19
10122
c524226103f1 (svn r14306) -Codechange: unify the code to draw the vehicle list.
rubidium
parents: 10117
diff changeset
    20
struct BaseVehicleListWindow: public Window {
9182
412cb6c0caf1 (svn r13045) -Codechange: make list_d (now GUIList) more generic and uniform.
rubidium
parents: 9174
diff changeset
    21
	GUIVehicleList vehicles;  ///< The list of vehicles
412cb6c0caf1 (svn r13045) -Codechange: make list_d (now GUIList) more generic and uniform.
rubidium
parents: 9174
diff changeset
    22
	Listing *sorting;         ///< Pointer to the vehicle type related sorting.
412cb6c0caf1 (svn r13045) -Codechange: make list_d (now GUIList) more generic and uniform.
rubidium
parents: 9174
diff changeset
    23
	VehicleType vehicle_type; ///< The vehicle type that is sorted
9563
c75bee824deb (svn r13587) -Codechange: make some globals members of VehicleListBase since they are used as such
skidd13
parents: 9297
diff changeset
    24
c75bee824deb (svn r13587) -Codechange: make some globals members of VehicleListBase since they are used as such
skidd13
parents: 9297
diff changeset
    25
	static const StringID vehicle_sorter_names[];
c75bee824deb (svn r13587) -Codechange: make some globals members of VehicleListBase since they are used as such
skidd13
parents: 9297
diff changeset
    26
	static GUIVehicleList::SortFunction *const vehicle_sorter_funcs[];
c75bee824deb (svn r13587) -Codechange: make some globals members of VehicleListBase since they are used as such
skidd13
parents: 9297
diff changeset
    27
10122
c524226103f1 (svn r14306) -Codechange: unify the code to draw the vehicle list.
rubidium
parents: 10117
diff changeset
    28
	BaseVehicleListWindow(const WindowDesc *desc, WindowNumber window_number) : Window(desc, window_number)
9563
c75bee824deb (svn r13587) -Codechange: make some globals members of VehicleListBase since they are used as such
skidd13
parents: 9297
diff changeset
    29
	{
c75bee824deb (svn r13587) -Codechange: make some globals members of VehicleListBase since they are used as such
skidd13
parents: 9297
diff changeset
    30
		this->vehicles.SetSortFuncs(this->vehicle_sorter_funcs);
c75bee824deb (svn r13587) -Codechange: make some globals members of VehicleListBase since they are used as such
skidd13
parents: 9297
diff changeset
    31
	}
10122
c524226103f1 (svn r14306) -Codechange: unify the code to draw the vehicle list.
rubidium
parents: 10117
diff changeset
    32
10143
38ea4e64508a (svn r14329) -Fix (r14306): selections in the group GUI weren't shown anymore.
rubidium
parents: 10122
diff changeset
    33
	void DrawVehicleListItems(int x, VehicleID selected_vehicle);
10122
c524226103f1 (svn r14306) -Codechange: unify the code to draw the vehicle list.
rubidium
parents: 10117
diff changeset
    34
	void SortVehicleList();
10207
c291a21b304e (svn r14421) -Codechange: rename all player variables/types to company *or* client so it is immediatelly clear which one you are working with.
rubidium
parents: 10143
diff changeset
    35
	void BuildVehicleList(Owner owner, uint16 index, uint16 window_type);
9182
412cb6c0caf1 (svn r13045) -Codechange: make list_d (now GUIList) more generic and uniform.
rubidium
parents: 9174
diff changeset
    36
};
412cb6c0caf1 (svn r13045) -Codechange: make list_d (now GUIList) more generic and uniform.
rubidium
parents: 9174
diff changeset
    37
412cb6c0caf1 (svn r13045) -Codechange: make list_d (now GUIList) more generic and uniform.
rubidium
parents: 9174
diff changeset
    38
struct Sorting {
412cb6c0caf1 (svn r13045) -Codechange: make list_d (now GUIList) more generic and uniform.
rubidium
parents: 9174
diff changeset
    39
	Listing aircraft;
412cb6c0caf1 (svn r13045) -Codechange: make list_d (now GUIList) more generic and uniform.
rubidium
parents: 9174
diff changeset
    40
	Listing roadveh;
412cb6c0caf1 (svn r13045) -Codechange: make list_d (now GUIList) more generic and uniform.
rubidium
parents: 9174
diff changeset
    41
	Listing ship;
412cb6c0caf1 (svn r13045) -Codechange: make list_d (now GUIList) more generic and uniform.
rubidium
parents: 9174
diff changeset
    42
	Listing train;
412cb6c0caf1 (svn r13045) -Codechange: make list_d (now GUIList) more generic and uniform.
rubidium
parents: 9174
diff changeset
    43
};
412cb6c0caf1 (svn r13045) -Codechange: make list_d (now GUIList) more generic and uniform.
rubidium
parents: 9174
diff changeset
    44
412cb6c0caf1 (svn r13045) -Codechange: make list_d (now GUIList) more generic and uniform.
rubidium
parents: 9174
diff changeset
    45
extern Sorting _sorting;
412cb6c0caf1 (svn r13045) -Codechange: make list_d (now GUIList) more generic and uniform.
rubidium
parents: 9174
diff changeset
    46
10122
c524226103f1 (svn r14306) -Codechange: unify the code to draw the vehicle list.
rubidium
parents: 10117
diff changeset
    47
#endif /* VEHICLE_GUI_BASE_H */