initial commit, lordsawar source, slightly modified
[lordsawar] / src / ruinmap.h
1 // Copyright (C) 2007, 2008, 2009 Ben Asselstine
2 //
3 //  This program is free software; you can redistribute it and/or modify
4 //  it under the terms of the GNU General Public License as published by
5 //  the Free Software Foundation; either version 3 of the License, or
6 //  (at your option) any later version.
7 //
8 //  This program is distributed in the hope that it will be useful,
9 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
10 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11 //  GNU Library General Public License for more details.
12 //
13 //  You should have received a copy of the GNU General Public License
14 //  along with this program; if not, write to the Free Software
15 //  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 
16 //  02110-1301, USA.
17
18 #ifndef RUINMAP_H
19 #define RUINMAP_H
20
21 #include <sigc++/signal.h>
22
23 #include "overviewmap.h"
24 #include "input-events.h"
25 #include "NamedLocation.h"
26
27 class Ruin;
28
29 //! Draw the ruins and temples onto a miniature map graphic.
30 /** 
31   * This method draws Ruin and Temple objects onto a miniature map graphic.
32   * The ruins and temples are depicted with icons instead of little white dots.
33   *
34   * The RuinMap is interactive.  Each Ruin and Temple is selectable with the 
35   * left mouse button.
36   */
37 class RuinMap : public OverviewMap
38 {
39  public:
40      //! Default constructor.  Make a new RuinMap.
41      /**
42       * @param ruin  The Ruin or Temple object that is selected initially when
43       *              the miniature map graphic is created.
44       */
45      RuinMap(NamedLocation *ruin);
46
47      // Set Methods
48
49      //! Change the Ruin or Temple object that is currently selected.
50      void setNamedLocation (NamedLocation *r) {ruin = r;}
51
52
53      // Get Methods
54   
55      //! Return the Ruin or Temple object that is currently selected.
56      NamedLocation * getNamedLocation () const {return ruin;}
57
58
59      // Methods that operate on the class data and modify the class.
60   
61      //! Realize the given mouse button event.
62      void mouse_button_event(MouseButtonEvent e);
63
64
65      // Signals
66
67      //! Emitted when a new Ruin or Temple object has been clicked.
68      sigc::signal<void, NamedLocation *> location_changed;
69
70      //! Emitted when the objects are finished being drawn on the map surface.
71      /**
72       * Classes that use RuinMap must catch this signal to display the map.
73       */
74      sigc::signal<void, Glib::RefPtr<Gdk::Pixmap> > map_changed;
75
76  private:
77      //! Draw the Ruin objects on the map.
78      /**
79       * @param show_selected  Whether or not to draw a box around a Ruin object
80       *                       that is the selected object (RuinMap::ruin).
81       */
82      void draw_ruins (bool show_selected);
83
84      //! Draw the Temple objects on the map.
85      /**
86       * @param show_selected  Whether or not to draw a box around a Temple object
87       *                       that is the selected object (RuinMap::ruin).
88       */
89      void draw_temples (bool show_selected);
90
91      //! Draw the Ruin and Temple objects objects onto the miniature map graphic.
92      /**
93       * This method is automatically called by the RuinMap::draw method.
94       */
95      virtual void after_draw();
96
97      // DATA
98
99      //! The currently selected Ruin or Temple object.
100      NamedLocation *ruin;
101
102 };
103
104 #endif