Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

vehicletypeselector.h

Go to the documentation of this file.
00001 /***************************************************************************
00002                           cargodialog.cpp  -  description
00003                              -------------------
00004     begin                : Tue Oct 24 2000
00005     copyright            : (C) 2000 by Martin Bickel
00006     email                : bickel@asc-hq.org
00007  ***************************************************************************/
00008 
00009 /***************************************************************************
00010  *                                                                         *
00011  *   This program is free software; you can redistribute it and/or modify  *
00012  *   it under the terms of the GNU General Public License as published by  *
00013  *   the Free Software Foundation; either version 2 of the License, or     *
00014  *   (at your option) any later version.                                   *
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

Generated on Tue Jun 24 01:27:55 2008 for Advanced Strategic Command by  doxygen 1.4.2