initial commit, lordsawar source, slightly modified
[lordsawar] / src / historymap.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 HISTORYMAP_H
19 #define HISTORYMAP_H
20
21 #include <sigc++/signal.h>
22 #include <sigc++/connection.h>
23 #include <sigc++/trackable.h>
24
25 #include "overviewmap.h"
26 #include "LocationList.h"
27
28 class City;
29 class Ruin;
30 //! Draw the given cities and ruins on the map.
31 /** 
32  * Draw a set of cities and ruins onto the miniature map graphic.
33  *
34  * @note This is called HistoryMap because it is used for the HistoryDialog.
35  *
36  */
37 class HistoryMap: public OverviewMap
38 {
39  public:
40      //! Default constructor.  Make a new HistoryMap.
41      /**
42       * @param clist  The list of the City objects to draw on the miniature map.
43       */
44      HistoryMap(LocationList<City*> *clist, LocationList<Ruin*> *rlist);
45  
46      //! Emitted when the cities are finished being drawn on the map surface.
47      /**
48       * Classes that use HistoryMap must catch this signal to display the map.
49       */
50      sigc::signal<void, Glib::RefPtr<Gdk::Pixmap> > map_changed;
51         
52      //! Change which cities are shown on the miniature map graphic.
53      /**
54       * This method erases the cities that were previously drawn and shows
55       * a new set of City objects.
56       *
57       * @param clist  The new list of City objects to draw onto the miniature
58       *               map graphic.
59       * @param rlist  The new list of Ruin objects to draw onto the miniature
60       *               map graphic.
61       */
62      void updateCities (LocationList<City*> *clist, LocationList<Ruin*> *rlist);
63
64  private:
65
66      //! The set of city objects to show on the miniature map graphic.
67      LocationList<City*> *d_clist;
68
69      //! The set of ruin objects to show on the miniature map graphic.
70      LocationList<Ruin*> *d_rlist;
71
72      //! Draw the City objects onto the miniature map graphic.
73      /**
74       * This method is automatically called by the HistoryMap::draw method.
75       */
76      virtual void after_draw();
77
78      //! Draw the cities.
79      /**
80       * This method iterates over the members of HistoryMap::d_clist and draws
81       * each city onto the minature map graphic.
82       *
83       * We can't use the OverviewMap::draw_cities method because it draws the
84       * City objects of Citylist, and not the set of cities defined here.
85       */
86      void drawCities ();
87
88      //! Draw the ruins.
89      void drawRuins();
90 };
91
92 #endif