Advanced Strategic Command
fieldmarker.h
Go to the documentation of this file.
1 /*
2  This file is part of Advanced Strategic Command; http://www.asc-hq.de
3  Copyright (C) 1994-2010 Martin Bickel and Marc Schellenberger
4 
5  This program is free software; you can redistribute it and/or modify
6  it under the terms of the GNU General Public License as published by
7  the Free Software Foundation; either version 2 of the License, or
8  (at your option) any later version.
9 
10  This program is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  GNU General Public License for more details.
14 
15  You should have received a copy of the GNU General Public License
16  along with this program; see the file COPYING. If not, write to the
17  Free Software Foundation, Inc., 59 Temple Place, Suite 330,
18  Boston, MA 02111-1307 USA
19 */
20 
21 
22 #ifndef fieldmarkerH
23 #define fieldmarkerH
24 
25 #include <vector>
26 #include "../paradialog.h"
27 
28 class MapDisplayPG;
29 class OverviewMapPanel;
30 class GameMap;
31 
33  private:
34  MapDisplayPG* md;
35  OverviewMapPanel* omp;
36 
37  PG_ListBox* listbox;
38  bool justOne;
39  bool readOnly;
40 
41  bool markField2( const MapCoordinate& pos, const SPoint& mouse, bool cursorChanged, int button, int prio );
42  int oldprio;
43 
44  public:
45  typedef vector<MapCoordinate> CoordinateList;
46  protected:
49 
50  bool ProcessEvent ( const SDL_Event * event,bool bModal = false );
51  virtual bool accept( const MapCoordinate& pos );
52  virtual void showFieldMarking( const CoordinateList& coordinateList );
53  virtual bool mark();
54  virtual bool markField( const MapCoordinate& pos );
55  bool eventKeyDown (const SDL_KeyboardEvent *key);
56  void updateList();
57  bool listItemClicked( PG_ListBoxBaseItem* item );
58  virtual bool isOk() { return true; };
59  bool closeDialog() { if ( isOk()) QuitModal(); return true; };
60  public:
61  SelectFromMap( CoordinateList& list, GameMap* map, bool justOne = false, bool readOnly = false );
62  void Show( bool fade = false );
64 
65 };
66 
67 
69  protected:
70  virtual bool accept( const MapCoordinate& pos );
71  virtual bool isOk() { return !coordinateList.empty(); };
72  public:
73  SelectBuildingFromMap ( CoordinateList& list, GameMap* map ) : SelectFromMap ( list, map, true ) {};
74 };
75 
77  protected:
78  virtual bool accept( const MapCoordinate& pos );
79  virtual bool isOk() { return !coordinateList.empty(); };
80  public:
81  SelectUnitFromMap ( CoordinateList& list, GameMap* map ) : SelectFromMap ( list, map, true ) {};
82 };
83 
84 
85 
86 
87 #endif
88 
SelectBuildingFromMap(CoordinateList &list, GameMap *map)
Definition: fieldmarker.h:73
bool listItemClicked(PG_ListBoxBaseItem *item)
CoordinateList & coordinateList
Definition: fieldmarker.h:48
virtual bool accept(const MapCoordinate &pos)
Definition: fieldmarker.cpp:89
virtual bool accept(const MapCoordinate &pos)
bool eventKeyDown(const SDL_KeyboardEvent *key)
virtual bool isOk()
Definition: fieldmarker.h:71
void Show(bool fade=false)
SelectUnitFromMap(CoordinateList &list, GameMap *map)
Definition: fieldmarker.h:81
Coordinate on the twodimensional map.
Definition: typen.h:202
Adapter class for using Paragui Dialogs in ASC. This class transfers the event control from ASC to Pa...
Definition: paradialog.h:127
virtual bool mark()
virtual bool isOk()
Definition: fieldmarker.h:79
virtual bool markField(const MapCoordinate &pos)
bool closeDialog()
Definition: fieldmarker.h:59
SDLmm::SPoint SPoint
Definition: surface.h:27
virtual void showFieldMarking(const CoordinateList &coordinateList)
Definition: fieldmarker.cpp:93
vector< MapCoordinate > CoordinateList
Definition: fieldmarker.h:45
GameMap * actmap
Definition: fieldmarker.h:47
virtual bool accept(const MapCoordinate &pos)
SelectFromMap(CoordinateList &list, GameMap *map, bool justOne=false, bool readOnly=false)
Definition: fieldmarker.cpp:43
bool ProcessEvent(const SDL_Event *event, bool bModal=false)
Definition: fieldmarker.cpp:78
virtual bool isOk()
Definition: fieldmarker.h:58
The map. THE central structure of ASC, which holds everything not globally available together...
Definition: gamemap.h:182