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 GAME_PREFERENCES_DIALOG_H
20 #define GAME_PREFERENCES_DIALOG_H
24 #include <sigc++/signal.h>
27 #include "game-parameters.h"
28 #include "game-options-dialog.h"
29 #include "GameScenario.h"
31 #include "decorated.h"
34 // dialog for choosing parameters for starting a new game
35 class GamePreferencesDialog: public Decorated
38 GamePreferencesDialog(std::string filename, GameScenario::PlayMode mode);
39 ~GamePreferencesDialog();
41 void set_title(std::string title);
43 void set_parent_window(Gtk::Window &parent);
45 sigc::signal<void, GameParameters> game_started;
47 bool run(std::string nickname = "guest");
51 void init(std::string filename);
53 GameScenario::PlayMode mode;
55 Gtk::VBox *dialog_vbox;
56 Gtk::ProgressBar *progressbar;
57 Gtk::Button *start_game_button;
58 Gtk::Button *edit_options_button;
59 Gtk::Label *game_name_label;
60 Gtk::Entry *game_name_entry;
61 Gtk::Label *difficulty_label;
62 Gtk::ComboBox *difficulty_combobox;
64 enum { BEGINNER = 0, INTERMEDIATE, ADVANCED, I_AM_THE_GREATEST, CUSTOM};
66 Gtk::VBox *players_vbox;
68 typedef std::vector<Glib::ustring> player_name_seq;
70 std::list<Gtk::ComboBoxText *> player_types;
71 std::list<Gtk::Entry *> player_names;
72 std::list<Gtk::Image *> player_shields;
74 GameOptionsDialog *game_options_dialog;
76 void add_player(GameParameters::Player::Type type,
77 const Glib::ustring &name);
78 void on_difficulty_changed();
79 void on_start_game_clicked();
80 void on_edit_options_clicked();
81 void on_player_type_changed();
83 bool is_intermediate();
86 void update_difficulty_combobox();
87 void update_difficulty_rating();
88 void update_shields();
89 Glib::RefPtr<Gdk::Pixbuf> getShieldPic(guint32 type, guint32 owner);
90 std::string d_filename;