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

buildingtypeselector.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 buildingtypeselectorH
00019 #define buildingtypeselectorH
00020 
00021 #include <pgimage.h>
00022 #include "selectionwindow.h"
00023 #include "../buildingtype.h"
00024 #include "../paradialog.h"
00025 
00026 
00027 
00028 
00029 
00030 
00031 class BuildingTypeBaseWidget: public SelectionWidget  {
00032       const BuildingType* vt;
00033       static Surface clippingSurface;
00034       Surface& getClippingSurface() { return clippingSurface; };
00035       const Player& actplayer;
00036    public:
00037       BuildingTypeBaseWidget( PG_Widget* parent, const PG_Point& pos, int width, const BuildingType* BuildingType, const Player& player );
00038       ASCString getName() const;
00039       const BuildingType* getBuildingType() const { return vt; };
00040    protected:
00041       void display( SDL_Surface * surface, const PG_Rect & src, const PG_Rect & dst );
00042       static int getBuildingHeight( const BuildingType* type );
00043 };
00044 
00045 class BuildingTypeResourceWidget: public BuildingTypeBaseWidget  {
00046    public:
00047       BuildingTypeResourceWidget( PG_Widget* parent, const PG_Point& pos, int width, const BuildingType* BuildingType, int lackingResources, const Resources& cost, const Player& player );
00048 };
00049 
00050 
00051 class BuildingTypeCountWidget: public BuildingTypeBaseWidget  {
00052    public:
00053       BuildingTypeCountWidget( PG_Widget* parent, const PG_Point& pos, int width, const BuildingType* BuildingType, const Player& player, int number );
00054 };
00055 
00056 
00057 class BuildingTypeSelectionItemFactory: public SelectionItemFactory, public SigC::Object  {
00058       Resources plantResources;
00059       const Player& actplayer;
00060    public:
00061       typedef vector<const BuildingType*> Container;
00062 
00063    protected:
00064       Container::iterator it;
00065       Container items;
00066 
00067       virtual void BuildingTypeSelected( const BuildingType* type ) = 0;
00068       
00069       virtual Resources getCost( const BuildingType* type );
00070    
00071    private:
00072       const Container& original_items;
00073       
00074    public:
00075       BuildingTypeSelectionItemFactory( Resources plantResources, const Container& types, const Player& player );
00076       
00077       SigC::Signal0<void> reloadAllItems;
00078 
00079       void restart();
00080    
00081       void setAvailableResource( const Resources& plantResources ) { this->plantResources = plantResources; };
00082       
00083       
00084       SelectionWidget* spawnNextItem( PG_Widget* parent, const PG_Point& pos );
00085       
00086       void itemSelected( const SelectionWidget* widget, bool mouse );
00087 };
00088 
00089 bool BuildingComp ( const BuildingType* v1, const BuildingType* v2 );
00090 
00091 #endif

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