initial commit, lordsawar source, slightly modified
[lordsawar] / src / gui / history-report-dialog.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 HISTORY_REPORT_DIALOG_H
19 #define HISTORY_REPORT_DIALOG_H
20
21 #include <memory>
22 #include <vector>
23 #include <sigc++/trackable.h>
24 #include <gtkmm.h>
25
26 #include "line-chart.h"
27
28 #include "LocationList.h"
29 #include "historymap.h"
30 #include "history.h"
31 #include "player.h"
32 #include "decorated.h"
33
34 class Citylist;
35 class City;
36
37 class Player;
38
39 class HistoryReportDialog: public Decorated
40 {
41  public:
42     enum HistoryReportType {CITY = 0, RUIN, EVENTS, GOLD, WINNING};
43     HistoryReportDialog(Player *p, HistoryReportType type);
44     ~HistoryReportDialog();
45
46     void generatePastCitylists(); //data for map
47     void generatePastCityCounts(); //data for chart
48     void generatePastRuinlists(); //data for map
49     void generatePastRuinCounts(); //data for chart
50     void generatePastGoldCounts(); //data for chart
51     void generatePastWinningCounts(); //data for chart
52     void generatePastEventlists(); //data for events list
53     void set_parent_window(Gtk::Window &parent);
54
55     void run();
56     void hide();
57     
58  private:
59     Gtk::Dialog* dialog;
60     HistoryMap* historymap;
61
62     Player *d_player;
63     Gtk::Scale *turn_scale;
64     Gtk::Notebook *history_notebook;
65     Gtk::Label *city_label;
66     Gtk::Label *ruin_label;
67     Gtk::Label *gold_label;
68     Gtk::Label *winner_label;
69     Gtk::Alignment *city_alignment;
70     Gtk::Alignment *ruin_alignment;
71     Gtk::Alignment *gold_alignment;
72     Gtk::Alignment *winner_alignment;
73
74     std::vector<LocationList<City*>* > past_citylists;
75     LineChart *city_chart;
76     std::vector<std::list<NetworkHistory *> > past_eventlists;
77     std::list<std::list<guint32> > past_citycounts;
78     std::vector<LocationList<Ruin*>* > past_ruinlists;
79     LineChart *ruin_chart;
80     std::list<std::list<guint32> > past_ruincounts;
81     std::list<std::list<guint32> > past_goldcounts;
82     LineChart *gold_chart;
83     std::list<std::list<guint32> > past_rankcounts;
84     LineChart *rank_chart;
85
86     Gtk::Image *map_image;
87   
88     std::list<Gdk::Color> d_colours; //player colours
89     
90     Gtk::VBox *events_list_box;
91
92     void addHistoryEvent(NetworkHistory *event);
93     void on_close_button();
94     void on_map_changed(Glib::RefPtr<Gdk::Pixmap> map);
95     void on_turn_changed(Gtk::Scale *scale);
96     void fill_in_turn_info(guint32 turn);
97     void on_switch_page(GtkNotebookPage *page, guint number);
98     void update_window_title();
99
100     bool closing;
101 };
102
103 #endif