1 //  Copyright (C) 2015 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 FIGHT_ORDER_EDITOR_DIALOG_H
20 #define FIGHT_ORDER_EDITOR_DIALOG_H
21 
22 #include <gtkmm.h>
23 #include <list>
24 
25 #include "lw-editor-dialog.h"
26 class Stack;
27 class Player;
28 
29 // edit the default fight order of the armies controlled by every player
30 class FightOrderEditorDialog: public LwEditorDialog
31 {
32  public:
33     FightOrderEditorDialog(Gtk::Window &parent);
~FightOrderEditorDialog()34     ~FightOrderEditorDialog() {}
35 
36     void hide();
37     int run();
get_modified()38     bool get_modified() {return modified;}
39 
40  private:
41     Gtk::TreeView *armies_treeview;
42     Gtk::Button *make_same_button;
43     Gtk::ComboBoxText *player_combobox;
44 
45     class ArmiesColumns: public Gtk::TreeModelColumnRecord {
46     public:
ArmiesColumns()47 	ArmiesColumns()
48         { add(image); add(name); add(army_type);}
49 
50 	Gtk::TreeModelColumn<Glib::RefPtr<Gdk::Pixbuf> > image;
51 	Gtk::TreeModelColumn<Glib::ustring> name;
52 	Gtk::TreeModelColumn<guint32> army_type;
53     };
54     const ArmiesColumns armies_columns;
55     Glib::RefPtr<Gtk::ListStore> armies_list;
56     bool modified;
57 
58     void addArmyType(guint32 army_type, Player *player);
59     void on_make_same_button_clicked();
60     void on_player_changed();
61     Player* get_selected_player();
62     void fill_armies(Player *player);
63     void on_army_reordered ();
64 };
65 
66 #endif
67