initial commit, lordsawar source, slightly modified
[lordsawar] / src / gui / stack-info-dialog.h
1 //  Copyright (C) 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 STACK_INFO_DIALOG_H
19 #define STACK_INFO_DIALOG_H
20
21 #include <memory>
22 #include <sigc++/trackable.h>
23 #include <sigc++/signal.h>
24 #include <gtkmm.h>
25 #include <list>
26
27 #include "army-info-tip.h"
28
29 class Stack;
30 class Army;
31
32 #include "vector.h"
33 #include "decorated.h"
34
35 // dialog for showing hero information
36 class StackInfoDialog: public Decorated
37 {
38  public:
39     StackInfoDialog(Vector<int> pos);
40     ~StackInfoDialog();
41
42     void set_parent_window(Gtk::Window &parent);
43
44     void run();
45     Stack * get_selected_stack() {return currently_selected_stack;};
46     void hide();
47
48  private:
49     Gtk::Dialog* dialog;
50
51     Vector<int> tile;
52     Gtk::Table *stack_table;
53
54     ArmyInfoTip* army_info_tip;
55     std::vector<Gtk::ToggleButton *> toggles;
56     std::vector<const Army*> armies;
57     std::vector<Gtk::RadioButton *> radios;
58     Gtk::Button *group_button;
59     Gtk::Button *ungroup_button;
60     Stack *currently_selected_stack;
61
62     void addArmy (bool first, Stack *s, Army *a, guint32 modified_strength, int idx);
63     void addStack(Stack *s, guint32 &idx);
64     void on_group_clicked();
65     void on_ungroup_clicked();
66     void fill_stack_info();
67     void on_stack_toggled(Gtk::RadioButton *radio, Stack *s);
68     void on_army_toggled(Gtk::ToggleButton *toggle, Stack *s, Army *a);
69     bool on_army_button_event(GdkEventButton *e, Gtk::ToggleButton *toggle);
70 };
71
72 #endif