File: vehicletypeselector.h

package info (click to toggle)
asc 2.6.0.0-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 82,860 kB
  • ctags: 26,395
  • sloc: cpp: 158,660; sh: 11,274; ansic: 6,878; makefile: 604; perl: 138
file content (118 lines) | stat: -rw-r--r-- 4,432 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
/***************************************************************************
                          cargodialog.cpp  -  description
                             -------------------
    begin                : Tue Oct 24 2000
    copyright            : (C) 2000 by Martin Bickel
    email                : bickel@asc-hq.org
 ***************************************************************************/

/***************************************************************************
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 ***************************************************************************/

#ifndef vehicletypeselectorH
#define vehicletypeselectorH

#include <pgimage.h>
#include "selectionwindow.h"
#include "../containerbase.h"
#include "../paradialog.h"




class Player;

class VehicleTypeBaseWidget: public SelectionWidget  {
      const VehicleType* vt;
      static Surface clippingSurface;
      Surface& getClippingSurface() { return clippingSurface; };
      const Player& actplayer;
      bool info();
   public:
      VehicleTypeBaseWidget( PG_Widget* parent, const PG_Point& pos, int width, const VehicleType* vehicletype, const Player& player );
      ASCString getName() const;
      const VehicleType* getVehicletype() const { return vt; };
   protected:
      void display( SDL_Surface * surface, const PG_Rect & src, const PG_Rect & dst );
      static int buttonXPos( int width, int num );  
};

class VehicleBaseWidget: public SelectionWidget  {
      const Vehicle* v;
      static Surface clippingSurface;
      Surface& getClippingSurface() { return clippingSurface; };
      const Player& actplayer;
      bool info();
   public:
      VehicleBaseWidget( PG_Widget* parent, const PG_Point& pos, int width, const Vehicle* vehicle, const Player& player );
      ASCString getName() const;

   protected:
      void display( SDL_Surface * surface, const PG_Rect & src, const PG_Rect & dst );
      static int buttonXPos( int width, int num );
};

class VehicleTypeResourceWidget: public VehicleTypeBaseWidget  {
   public:
      VehicleTypeResourceWidget( PG_Widget* parent, const PG_Point& pos, int width, const VehicleType* vehicletype, int lackingResources, const Resources& cost, const Player& player );
};


class VehicleTypeCountWidget: public VehicleTypeBaseWidget  {
   public:
      VehicleTypeCountWidget( PG_Widget* parent, const PG_Point& pos, int width, const VehicleType* vehicletype, const Player& player, int number );
};

class VehicleTypeCountLocateWidget: public VehicleTypeCountWidget  {
   private:
      bool locate();
   public:
      VehicleTypeCountLocateWidget( PG_Widget* parent, const PG_Point& pos, int width, const VehicleType* vehicletype, const Player& player, int number );
      
      SigC::Signal1<void,const VehicleType*> locateVehicles;
};


class VehicleTypeSelectionItemFactory: public SelectionItemFactory, public SigC::Object  {
      Resources plantResources;
      const Player& actplayer;
      bool showResourcesForUnit;
   public:
      typedef vector<const VehicleType*> Container;

      static SigC::Signal1<void,const VehicleType*> showVehicleInfo;
      
   protected:
      Container::iterator it;
      Container items;

      virtual void vehicleTypeSelected( const VehicleType* type, bool mouse ) {};

   private:
      const Container& original_items;
      
   public:
      VehicleTypeSelectionItemFactory( Resources plantResources, const Container& types, const Player& player );
      VehicleTypeSelectionItemFactory( const Container& types, const Player& player );
      
      SigC::Signal0<void> reloadAllItems;

      void restart();
   
      void setAvailableResource( const Resources& plantResources ) { this->plantResources = plantResources; };
      
      virtual Resources getCost( const VehicleType* type ) {return Resources(); };
      
      SelectionWidget* spawnNextItem( PG_Widget* parent, const PG_Point& pos );
      
      void itemSelected( const SelectionWidget* widget, bool mouse );
};


#endif