Advanced Strategic Command
vehicletypeselector.h
Go to the documentation of this file.
1 /***************************************************************************
2  cargodialog.cpp - description
3  -------------------
4  begin : Tue Oct 24 2000
5  copyright : (C) 2000 by Martin Bickel
6  email : bickel@asc-hq.org
7  ***************************************************************************/
8 
9 /***************************************************************************
10  * *
11  * This program is free software; you can redistribute it and/or modify *
12  * it under the terms of the GNU General Public License as published by *
13  * the Free Software Foundation; either version 2 of the License, or *
14  * (at your option) any later version. *
15  * *
16  ***************************************************************************/
17 
18 #ifndef vehicletypeselectorH
19 #define vehicletypeselectorH
20 
21 #include <pgimage.h>
22 #include "selectionwindow.h"
23 #include "../containerbase.h"
24 #include "../paradialog.h"
25 
26 
27 
28 
29 class Player;
30 
32  const VehicleType* vt;
33  static Surface clippingSurface;
34  Surface& getClippingSurface() { return clippingSurface; };
35  const Player& actplayer;
36  bool info();
37  public:
38  VehicleTypeBaseWidget( PG_Widget* parent, const PG_Point& pos, int width, const VehicleType* vehicletype, const Player& player );
39  ASCString getName() const;
40  const VehicleType* getVehicletype() const { return vt; };
41  protected:
42  void display( SDL_Surface * surface, const PG_Rect & src, const PG_Rect & dst );
43  static int buttonXPos( int width, int num );
44 };
45 
47  const Vehicle* v;
48  static Surface clippingSurface;
49  Surface& getClippingSurface() { return clippingSurface; };
50  const Player& actplayer;
51  bool info();
52  public:
53  VehicleBaseWidget( PG_Widget* parent, const PG_Point& pos, int width, const Vehicle* vehicle, const Player& player );
54  ASCString getName() const;
55 
56  protected:
57  void display( SDL_Surface * surface, const PG_Rect & src, const PG_Rect & dst );
58  static int buttonXPos( int width, int num );
59 };
60 
62  public:
63  VehicleTypeResourceWidget( PG_Widget* parent, const PG_Point& pos, int width, const VehicleType* vehicletype, int lackingResources, const Resources& cost, const Player& player );
64 };
65 
66 
68  public:
69  VehicleTypeCountWidget( PG_Widget* parent, const PG_Point& pos, int width, const VehicleType* vehicletype, const Player& player, int number );
70 };
71 
73  private:
74  bool locate();
75  public:
76  VehicleTypeCountLocateWidget( PG_Widget* parent, const PG_Point& pos, int width, const VehicleType* vehicletype, const Player& player, int number );
77 
78  sigc::signal<void,const VehicleType*> locateVehicles;
79 };
80 
81 
82 class VehicleTypeSelectionItemFactory: public SelectionItemFactory, public sigc::trackable {
83  Resources plantResources;
84  const Player& actplayer;
85  bool showResourcesForUnit;
86  public:
87  typedef vector<const VehicleType*> Container;
88 
89  static sigc::signal<void,const VehicleType*> showVehicleInfo;
90 
91  protected:
92  Container::iterator it;
94 
95  virtual void vehicleTypeSelected( const VehicleType* type, bool mouse ) {};
96 
97  private:
98  const Container& original_items;
99 
100  public:
101  VehicleTypeSelectionItemFactory( Resources plantResources, const Container& types, const Player& player );
102  VehicleTypeSelectionItemFactory( const Container& types, const Player& player );
103 
104  sigc::signal<void> reloadAllItems;
105 
106  void restart();
107 
108  void setAvailableResource( const Resources& plantResources ) { this->plantResources = plantResources; };
109 
110  virtual Resources getCost( const VehicleType* type ) {return Resources(); };
111 
112  SelectionWidget* spawnNextItem( PG_Widget* parent, const PG_Point& pos );
113 
114  void itemSelected( const SelectionWidget* widget, bool mouse );
115 };
116 
117 
118 #endif
VehicleTypeCountLocateWidget(PG_Widget *parent, const PG_Point &pos, int width, const VehicleType *vehicletype, const Player &player, int number)
sigc::signal< void, const VehicleType * > locateVehicles
ASCString getName() const
SelectionWidget * spawnNextItem(PG_Widget *parent, const PG_Point &pos)
VehicleTypeBaseWidget(PG_Widget *parent, const PG_Point &pos, int width, const VehicleType *vehicletype, const Player &player)
ASCString getName() const
The ASCString class provides an abstract way to manipulate strings.
Definition: ascstring.h:14
void display(SDL_Surface *surface, const PG_Rect &src, const PG_Rect &dst)
void setAvailableResource(const Resources &plantResources)
The class describing properties that are common to all vehicles of a certain kind.
Definition: vehicletype.h:177
vector< const VehicleType * > Container
VehicleTypeResourceWidget(PG_Widget *parent, const PG_Point &pos, int width, const VehicleType *vehicletype, int lackingResources, const Resources &cost, const Player &player)
VehicleTypeSelectionItemFactory(Resources plantResources, const Container &types, const Player &player)
const VehicleType * getVehicletype() const
static int buttonXPos(int width, int num)
virtual void vehicleTypeSelected(const VehicleType *type, bool mouse)
VehicleBaseWidget(PG_Widget *parent, const PG_Point &pos, int width, const Vehicle *vehicle, const Player &player)
void itemSelected(const SelectionWidget *widget, bool mouse)
void display(SDL_Surface *surface, const PG_Rect &src, const PG_Rect &dst)
the different players in ASC. There may be 8 players (0..7) and neutral units (8) ...
Definition: player.h:99
Resources are basically the currency of ASC.
Definition: typen.h:97
static sigc::signal< void, const VehicleType * > showVehicleInfo
static int buttonXPos(int width, int num)
VehicleTypeCountWidget(PG_Widget *parent, const PG_Point &pos, int width, const VehicleType *vehicletype, const Player &player, int number)
virtual Resources getCost(const VehicleType *type)