1 //  Copyright (C) 2007-2009, 2014, 2015, 2017 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 SAGE_DIALOG_H
20 #define SAGE_DIALOG_H
21 
22 #include <memory>
23 #include <vector>
24 #include <gtkmm.h>
25 
26 #include "ruinmap.h"
27 #include "player.h"
28 #include "hero.h"
29 #include "Sage.h"
30 #include "lw-dialog.h"
31 
32 // dialog for visiting a sage
33 class SageDialog: public LwDialog
34 {
35  public:
36     SageDialog(Gtk::Window &parent, Sage *sage, Hero *hero, Ruin *r);
~SageDialog()37     ~SageDialog() {delete ruinmap;};
38 
hide()39     void hide() {dialog->hide();};
40     Reward *run();
41 
42  private:
43     RuinMap* ruinmap;
44 
45     Gtk::TreeView *rewards_treeview;
46 
47     class RewardsColumns: public Gtk::TreeModelColumnRecord {
48     public:
RewardsColumns()49 	RewardsColumns()
50         { add(name); add(reward);}
51 
52 	Gtk::TreeModelColumn<Glib::ustring> name;
53 	Gtk::TreeModelColumn<Reward *> reward;
54     };
55     const RewardsColumns rewards_columns;
56     Glib::RefPtr<Gtk::ListStore> rewards_list;
57 
58     Gtk::Image *map_image;
59     Gtk::Button *continue_button;
60 
61     Sage *sage;
62     Hero *hero;
63     Ruin *ruin;
64 
65     std::list<Reward*> common_rewards;
66     void on_map_changed(Cairo::RefPtr<Cairo::Surface> map);
67     void addReward(Reward *reward);
68     Reward *grabSelectedReward();
69     void on_reward_selected();
70 };
71 
72 #endif
73