1 // Copyright (C) 2007 Ole Laursen
2 // Copyright (C) 2007, 2008, 2009 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 3 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
19 #ifndef PLAYERS_DIALOG_H
20 #define PLAYERS_DIALOG_H
24 #include <sigc++/signal.h>
28 class CreateScenarioRandomize;
30 //! Scenario editor. Edit Player objects in the scenario.
34 PlayersDialog(CreateScenarioRandomize *randomizer, int width, int height);
37 void set_parent_window(Gtk::Window &parent);
44 Gtk::TreeView *player_treeview;
46 class PlayerColumns: public Gtk::TreeModelColumnRecord {
49 { add(type); add(name); add(gold); add(player); }
51 Gtk::TreeModelColumn<Glib::ustring> type, name;
52 Gtk::TreeModelColumn<int> gold;
53 Gtk::TreeModelColumn<Player *> player;
55 const PlayerColumns player_columns;
56 Glib::RefPtr<Gtk::ListStore> player_list;
58 Gtk::CellRendererCombo type_renderer;
59 Gtk::TreeViewColumn type_column;
60 Gtk::CellRendererSpin gold_renderer;
61 Gtk::TreeViewColumn gold_column;
62 Gtk::CellRendererText name_renderer;
63 Gtk::TreeViewColumn name_column;
65 class PlayerTypeColumns: public Gtk::TreeModelColumnRecord {
70 Gtk::TreeModelColumn<Glib::ustring> type;
72 const PlayerTypeColumns player_type_columns;
73 Glib::RefPtr<Gtk::ListStore> player_type_list;
75 typedef std::vector<Glib::ustring> player_name_seq;
76 player_name_seq default_player_names;
78 void cell_data_type(Gtk::CellRenderer *renderer, const Gtk::TreeIter &i);
79 void on_type_edited(const Glib::ustring &path,
80 const Glib::ustring &new_text);
81 void cell_data_gold(Gtk::CellRenderer *renderer, const Gtk::TreeIter& i);
82 void on_gold_edited(const Glib::ustring &path, const Glib::ustring &new_text);
83 void cell_data_name(Gtk::CellRenderer *renderer, const Gtk::TreeIter& i);
84 void on_name_edited(const Glib::ustring &path, const Glib::ustring &new_text);
86 void add_player(const Glib::ustring &type, const Glib::ustring &name,
87 int gold, Player *player);