1 // Copyright (C) 2007, 2008, 2009, 2012, 2014 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 #pragma once
19 #ifndef RUINMAP_H
20 #define RUINMAP_H
21 
22 #include <sigc++/signal.h>
23 
24 #include "overviewmap.h"
25 #include "input-events.h"
26 #include "NamedLocation.h"
27 
28 //! Draw the ruins and temples onto a miniature map graphic.
29 /**
30   * This method draws Ruin and Temple objects onto a miniature map graphic.
31   * The ruins and temples are depicted with icons instead of little white dots.
32   *
33   * The RuinMap is interactive.  Each Ruin and Temple is selectable with the
34   * left mouse button.
35   */
36 class RuinMap : public OverviewMap
37 {
38  public:
39      //! Default constructor.  Make a new RuinMap.
40      /**
41       * @param ruin  The Ruin or Temple object that is selected initially when
42       *              the miniature map graphic is created.
43       */
44      RuinMap(NamedLocation *ruin, Stack *stack);
45 
46      //! Destructor.
~RuinMap()47      ~RuinMap() {};
48 
49      // Set Methods
50 
51      //! Change the Ruin or Temple object that is currently selected.
setNamedLocation(NamedLocation * r)52      void setNamedLocation (NamedLocation *r) {ruin = r;}
53 
54 
55      // Get Methods
56 
57      //! Return the Ruin or Temple object that is currently selected.
getNamedLocation()58      NamedLocation * getNamedLocation () const {return ruin;}
59 
60 
61      // Methods that operate on the class data and modify the class.
62 
63      //! Realize the given mouse button event.
64      void mouse_button_event(MouseButtonEvent e);
65 
66 
67      // Signals
68 
69      //! Emitted when the objects are finished being drawn on the map surface.
70      /**
71       * Classes that use RuinMap must catch this signal to display the map.
72       */
73      sigc::signal<void, Cairo::RefPtr<Cairo::Surface> > map_changed;
74 
75  private:
76      //! Draw the Ruin objects on the map.
77      /**
78       * @param show_selected  Whether or not to draw a box around a Ruin object
79       *                       that is the selected object (RuinMap::ruin).
80       */
81      void draw_ruins (bool show_selected);
82 
83      //! Draw the Temple objects on the map.
84      /**
85       * @param show_selected  Whether or not to draw a box around a Temple object
86       *                       that is the selected object (RuinMap::ruin).
87       */
88      void draw_temples (bool show_selected);
89 
90      //! Draw the Ruin and Temple objects objects onto the miniature map graphic.
91      /**
92       * This method is automatically called by the RuinMap::draw method.
93       */
94      virtual void after_draw();
95 
96      // DATA
97 
98      //! The currently selected Ruin or Temple object.
99      NamedLocation *ruin;
100 
101      //! The stack doing the searching.
102      Stack *stack;
103 
104 };
105 
106 #endif
107