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 VehicleTypeResourceWidget: public VehicleTypeBaseWidget {
00047 public:
00048 VehicleTypeResourceWidget( PG_Widget* parent, const PG_Point& pos, int width, const Vehicletype* vehicletype, int lackingResources, const Resources& cost, const Player& player );
00049 };
00050
00051
00052 class VehicleTypeCountWidget: public VehicleTypeBaseWidget {
00053 public:
00054 VehicleTypeCountWidget( PG_Widget* parent, const PG_Point& pos, int width, const Vehicletype* vehicletype, const Player& player, int number );
00055 };
00056
00057 class VehicleTypeCountLocateWidget: public VehicleTypeCountWidget {
00058 private:
00059 bool locate();
00060 public:
00061 VehicleTypeCountLocateWidget( PG_Widget* parent, const PG_Point& pos, int width, const Vehicletype* vehicletype, const Player& player, int number );
00062
00063 SigC::Signal1<void,const Vehicletype*> locateVehicles;
00064 };
00065
00066
00067 class VehicleTypeSelectionItemFactory: public SelectionItemFactory, public SigC::Object {
00068 Resources plantResources;
00069 const Player& actplayer;
00070 bool showResourcesForUnit;
00071 public:
00072 typedef vector<const Vehicletype*> Container;
00073
00074 static SigC::Signal1<void,const Vehicletype*> showVehicleInfo;
00075
00076 protected:
00077 Container::iterator it;
00078 Container items;
00079
00080 virtual void vehicleTypeSelected( const Vehicletype* type, bool mouse ) {};
00081
00082 virtual const Container& getOriginalItems() { return original_items; };
00083
00084 private:
00085 const Container& original_items;
00086
00087 public:
00088 VehicleTypeSelectionItemFactory( Resources plantResources, const Container& types, const Player& player );
00089 VehicleTypeSelectionItemFactory( const Container& types, const Player& player );
00090
00091 SigC::Signal0<void> reloadAllItems;
00092
00093 void restart();
00094
00095 void setAvailableResource( const Resources& plantResources ) { this->plantResources = plantResources; };
00096
00097 virtual Resources getCost( const Vehicletype* type ) {return Resources(); };
00098
00099 SelectionWidget* spawnNextItem( PG_Widget* parent, const PG_Point& pos );
00100
00101 void itemSelected( const SelectionWidget* widget, bool mouse );
00102 };
00103
00104
00105 #endif