1
// Copyright (C) 2007, Ole Laursen
2
// Copyright (C) 2007, 2008 Ben Asselstine
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 2 of the License, or
7
// (at your option) any later version.
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.
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
23
#include <sigc++/trackable.h>
24
#include <gtkmm/button.h>
25
#include <gtkmm/checkbutton.h>
26
#include <gtkmm/dialog.h>
27
#include <gtkmm/entry.h>
28
#include <gtkmm/spinbutton.h>
29
#include <gtkmm/comboboxtext.h>
30
#include <gtkmm/treeview.h>
31
#include <gtkmm/liststore.h>
34
class CreateScenarioRandomize;
38
//! Scenario editor. Edits a City object.
39
class CityDialog: public sigc::trackable
42
CityDialog(City *city, CreateScenarioRandomize *randomizer);
44
void set_parent_window(Gtk::Window &parent);
49
std::auto_ptr<Gtk::Dialog> dialog;
50
Gtk::ComboBoxText *player_combobox;
51
Gtk::CheckButton *capital_checkbutton;
52
Gtk::Entry *name_entry;
53
Gtk::SpinButton *income_spinbutton;
54
Gtk::CheckButton *burned_checkbutton;
56
Gtk::TreeView *army_treeview;
58
class ArmyColumns: public Gtk::TreeModelColumnRecord {
61
{ add(army); add(name);
62
add(strength); add(moves); add(upkeep); add(duration); }
64
Gtk::TreeModelColumn<const ArmyProdBase *> army;
65
Gtk::TreeModelColumn<Glib::ustring> name;
66
Gtk::TreeModelColumn<int> strength, moves, upkeep, duration;
68
const ArmyColumns army_columns;
69
Glib::RefPtr<Gtk::ListStore> army_list;
70
Gtk::Button *add_button;
71
Gtk::Button *remove_button;
72
Gtk::Button *randomize_armies_button;
73
Gtk::Button *randomize_name_button;
74
Gtk::Button *randomize_income_button;
78
void on_add_clicked();
79
void on_remove_clicked();
80
void on_randomize_armies_clicked();
81
void on_randomize_name_clicked();
82
void on_randomize_income_clicked();
83
void on_selection_changed();
84
void on_player_changed();
86
void add_army(const ArmyProdBase *a);
87
void set_button_sensitivity();
88
CreateScenarioRandomize *d_randomizer;