00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #ifndef vehicletypeselectorH
00019 #define vehicletypeselectorH
00020
00021 #include <pgimage.h>
00022 #include "selectionwindow.h"
00023 #include "../containerbase.h"
00024 #include "../paradialog.h"
00025
00026
00027
00028
00029 class Player;
00030
00031 class VehicleTypeBaseWidget: public SelectionWidget {
00032 const VehicleType* vt;
00033 static Surface clippingSurface;
00034 Surface& getClippingSurface() { return clippingSurface; };
00035 const Player& actplayer;
00036 bool info();
00037 public:
00038 VehicleTypeBaseWidget( PG_Widget* parent, const PG_Point& pos, int width, const VehicleType* vehicletype, const Player& player );
00039 ASCString getName() const;
00040 const VehicleType* getVehicletype() const { return vt; };
00041 protected:
00042 void display( SDL_Surface * surface, const PG_Rect & src, const PG_Rect & dst );
00043 static int buttonXPos( int width, int num );
00044 };
00045
00046 class VehicleBaseWidget: public SelectionWidget {
00047 const Vehicle* v;
00048 static Surface clippingSurface;
00049 Surface& getClippingSurface() { return clippingSurface; };
00050 const Player& actplayer;
00051 bool info();
00052 public:
00053 VehicleBaseWidget( PG_Widget* parent, const PG_Point& pos, int width, const Vehicle* vehicle, const Player& player );
00054 ASCString getName() const;
00055
00056 protected:
00057 void display( SDL_Surface * surface, const PG_Rect & src, const PG_Rect & dst );
00058 static int buttonXPos( int width, int num );
00059 };
00060
00061 class VehicleTypeResourceWidget: public VehicleTypeBaseWidget {
00062 public:
00063 VehicleTypeResourceWidget( PG_Widget* parent, const PG_Point& pos, int width, const VehicleType* vehicletype, int lackingResources, const Resources& cost, const Player& player );
00064 };
00065
00066
00067 class VehicleTypeCountWidget: public VehicleTypeBaseWidget {
00068 public:
00069 VehicleTypeCountWidget( PG_Widget* parent, const PG_Point& pos, int width, const VehicleType* vehicletype, const Player& player, int number );
00070 };
00071
00072 class VehicleTypeCountLocateWidget: public VehicleTypeCountWidget {
00073 private:
00074 bool locate();
00075 public:
00076 VehicleTypeCountLocateWidget( PG_Widget* parent, const PG_Point& pos, int width, const VehicleType* vehicletype, const Player& player, int number );
00077
00078 SigC::Signal1<void,const VehicleType*> locateVehicles;
00079 };
00080
00081
00082 class VehicleTypeSelectionItemFactory: public SelectionItemFactory, public SigC::Object {
00083 Resources plantResources;
00084 const Player& actplayer;
00085 bool showResourcesForUnit;
00086 public:
00087 typedef vector<const VehicleType*> Container;
00088
00089 static SigC::Signal1<void,const VehicleType*> showVehicleInfo;
00090
00091 protected:
00092 Container::iterator it;
00093 Container items;
00094
00095 virtual void vehicleTypeSelected( const VehicleType* type, bool mouse ) {};
00096
00097 private:
00098 const Container& original_items;
00099
00100 public:
00101 VehicleTypeSelectionItemFactory( Resources plantResources, const Container& types, const Player& player );
00102 VehicleTypeSelectionItemFactory( const Container& types, const Player& player );
00103
00104 SigC::Signal0<void> reloadAllItems;
00105
00106 void restart();
00107
00108 void setAvailableResource( const Resources& plantResources ) { this->plantResources = plantResources; };
00109
00110 virtual Resources getCost( const VehicleType* type ) {return Resources(); };
00111
00112 SelectionWidget* spawnNextItem( PG_Widget* parent, const PG_Point& pos );
00113
00114 void itemSelected( const SelectionWidget* widget, bool mouse );
00115 };
00116
00117
00118 #endif