initial commit, lordsawar source, slightly modified
[lordsawar] / src / editor / select-army-dialog.h
1 //  Copyright (C) 2007 Ole Laursen
2 //  Copyright (C) 2007, 2008, 2009 Ben Asselstine
3 //
4 //  This program is free software; you can redistribute it and/or modify
5 //  it under the terms of the GNU General Public License as published by
6 //  the Free Software Foundation; either version 3 of the License, or
7 //  (at your option) any later version.
8 //
9 //  This program is distributed in the hope that it will be useful,
10 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
11 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12 //  GNU Library General Public License for more details.
13 //
14 //  You should have received a copy of the GNU General Public License
15 //  along with this program; if not, write to the Free Software
16 //  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 
17 //  02110-1301, USA.
18
19 #ifndef SELECT_ARMY_DIALOG_H
20 #define SELECT_ARMY_DIALOG_H
21
22 #include <memory>
23 #include <vector>
24 #include <sigc++/trackable.h>
25 #include <gtkmm.h>
26
27 #include "gui/army-info-tip.h"
28
29 class ArmyProto;
30 class City;
31 class Player;
32
33 //! Scenario editor.  Select an Army prototype.
34 class SelectArmyDialog: public sigc::trackable
35 {
36  public:
37     SelectArmyDialog(Player *p, bool hero_too = false,
38                      bool defends_ruins = false,
39                      bool rewardable = false);
40     ~SelectArmyDialog();
41
42     void set_parent_window(Gtk::Window &parent);
43
44     void run();
45
46     const ArmyProto *get_selected_army() { return selected_army; }
47     
48  private:
49     Gtk::Dialog* dialog;
50     ArmyInfoTip* army_info_tip;
51     Gtk::Label *army_info_label1;
52     Gtk::Label *army_info_label2;
53     Gtk::Table *toggles_table;
54     Gtk::Button *select_button;
55     std::vector<guint32> armysets;
56
57     const ArmyProto *selected_army;
58     Player *player;
59     bool d_defends_ruins;
60     bool d_awardable;
61     bool d_hero_too;
62
63     std::vector<Gtk::ToggleButton *> army_toggles;
64     bool ignore_toggles;
65     std::vector<const ArmyProto*> selectable;
66
67     void on_army_toggled(Gtk::ToggleButton *toggle);
68     bool on_army_button_event(GdkEventButton *e, Gtk::ToggleButton *toggle);
69     
70     void fill_in_army_toggles();
71     void fill_in_army_info();
72     void set_select_button_state();
73 };
74
75 #endif