# vehicle_gui.h

Go to the documentation of this file.

    00001 /* $Id: vehicle_gui.h 15480 2009-02-14 18:42:03Z michi_cc $ */
    00002
    00005 #ifndef VEHICLE_GUI_H
    00006 #define VEHICLE_GUI_H
    00007
    00008 #include "window_type.h"
    00009 #include "vehicle_type.h"
    00010 #include "order_type.h"
    00011 #include "station_type.h"
    00012 #include "engine_type.h"
    00013 #include "waypoint.h"
    00014
    00015 void DrawVehicleProfitButton(const Vehicle *v, int x, int y);
    00016 void ShowVehicleRefitWindow(const Vehicle *v, VehicleOrderID order, Window *parent);
    00017
    00019 enum VehicleViewWindowWidgets {
    00020   VVW_WIDGET_CLOSEBOX = 0,
    00021   VVW_WIDGET_CAPTION,
    00022   VVW_WIDGET_STICKY,
    00023   VVW_WIDGET_PANEL,
    00024   VVW_WIDGET_VIEWPORT,
    00025   VVW_WIDGET_START_STOP_VEH,
    00026   VVW_WIDGET_CENTER_MAIN_VIEH,
    00027   VVW_WIDGET_GOTO_DEPOT,
    00028   VVW_WIDGET_REFIT_VEH,
    00029   VVW_WIDGET_SHOW_ORDERS,
    00030   VVW_WIDGET_SHOW_DETAILS,
    00031   VVW_WIDGET_CLONE_VEH,
    00032   VVW_WIDGET_EMPTY_BOTTOM_RIGHT,
    00033   VVW_WIDGET_RESIZE,
    00034   VVW_WIDGET_TURN_AROUND,
    00035   VVW_WIDGET_FORCE_PROCEED,
    00036 };
    00037
    00039 enum {
    00040   VLW_STANDARD      = 0 << 8,
    00041   VLW_SHARED_ORDERS = 1 << 8,
    00042   VLW_STATION_LIST  = 2 << 8,
    00043   VLW_DEPOT_LIST    = 3 << 8,
    00044   VLW_GROUP_LIST    = 4 << 8,
    00045   VLW_WAYPOINT_LIST = 5 << 8,
    00046   VLW_MASK          = 0x700,
    00047 };
    00048
    00049 static inline bool ValidVLWFlags(uint16 flags)
    00050 {
    00051   return (flags == VLW_STANDARD || flags == VLW_SHARED_ORDERS || flags == VLW_STATION_LIST || flags == VLW_DEPOT_LIST || flags == VLW_GROUP_LIST);
    00052 }
    00053
    00054 int DrawVehiclePurchaseInfo(int x, int y, uint w, EngineID engine_number);
    00055
    00056 void DrawTrainImage(const Vehicle *v, int x, int y, VehicleID selection, int count, int skip);
    00057 void DrawRoadVehImage(const Vehicle *v, int x, int y, VehicleID selection, int count);
    00058 void DrawShipImage(const Vehicle *v, int x, int y, VehicleID selection);
    00059 void DrawAircraftImage(const Vehicle *v, int x, int y, VehicleID selection);
    00060
    00061 void ShowBuildVehicleWindow(TileIndex tile, VehicleType type);
    00062
    00063 uint ShowAdditionalText(int x, int y, uint w, EngineID engine);
    00064 uint ShowRefitOptionsList(int x, int y, uint w, EngineID engine);
    00065 StringID GetCargoSubtypeText(const Vehicle *v);
    00066
    00067 void ShowVehicleListWindow(const Vehicle *v);
    00068 void ShowVehicleListWindow(const Waypoint *wp);
    00069 void ShowVehicleListWindow(CompanyID company, VehicleType vehicle_type);
    00070 void ShowVehicleListWindow(CompanyID company, VehicleType vehicle_type, StationID station);
    00071 void ShowVehicleListWindow(CompanyID company, VehicleType vehicle_type, TileIndex depot_tile);
    00072
    00073
    00074 /* ChangeVehicleViewWindow() moves all windows for one vehicle to another vehicle.
    00075  * For ease of use it can be called with both Vehicle pointers and VehicleIDs. */
    00076 void ChangeVehicleViewWindow(VehicleID from_index, VehicleID to_index);
    00077
    00078 static inline uint GetVehicleListHeight(VehicleType type)
    00079 {
    00080   return (type == VEH_TRAIN || type == VEH_ROAD) ? 14 : 24;
    00081 }
    00082
    00088 static inline WindowClass GetWindowClassForVehicleType(VehicleType vt)
    00089 {
    00090   switch (vt) {
    00091     default: NOT_REACHED();
    00092     case VEH_TRAIN:    return WC_TRAINS_LIST;
    00093     case VEH_ROAD:     return WC_ROADVEH_LIST;
    00094     case VEH_SHIP:     return WC_SHIPS_LIST;
    00095     case VEH_AIRCRAFT: return WC_AIRCRAFT_LIST;
    00096   }
    00097 }
    00098
    00099 /* Unified window procedure */
    00100 void ShowVehicleViewWindow(const Vehicle *v);
    00101
    00102 Vehicle *CheckClickOnVehicle(const struct ViewPort *vp, int x, int y);
    00103
    00104 #endif /* VEHICLE_GUI_H */