1 //  Copyright (C) 2008, 2009, 2014, 2020 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 GUI_REWARDLIST_DIALOG_H
20 #define GUI_REWARDLIST_DIALOG_H
21 
22 #include <gtkmm.h>
23 
24 #include "rewardlist.h"
25 #include "lw-editor-dialog.h"
26 
27 //! Scenario editor.  Manages Reward objects in the Rewardlist.
28 class RewardlistDialog: public LwEditorDialog
29 {
30  public:
31     RewardlistDialog(Gtk::Window &parent, bool select, bool clear);
~RewardlistDialog()32     ~RewardlistDialog() {};
33 
34     bool run ();
get_reward()35     Reward *get_reward () {return d_reward;}
36 
37  private:
38     bool d_changed;
39     bool d_select;
40     bool d_clear;
41     Reward *d_reward; //current reward
42     Gtk::TreeView *rewards_treeview;
43     Gtk::Button *add_button;
44     Gtk::Button *remove_button;
45     Gtk::Button *edit_button;
46     Gtk::Button *clear_button;
47     Gtk::Button *close_button;
48 
49     class RewardsColumns: public Gtk::TreeModelColumnRecord {
50     public:
RewardsColumns()51 	RewardsColumns()
52         { add(name); add(reward);}
53 
54 	Gtk::TreeModelColumn<Glib::ustring> name;
55 	Gtk::TreeModelColumn<Reward *> reward;
56     };
57     const RewardsColumns rewards_columns;
58     Glib::RefPtr<Gtk::ListStore> rewards_list;
59 
60     void addReward(Reward *reward);
61     void update_rewardlist_buttons();
62 
63     //callbacks
64     void on_add_clicked();
65     void on_remove_clicked();
66     void on_edit_clicked();
67     void on_reward_selected();
68 };
69 
70 #endif
71