initial commit, lordsawar source, slightly modified
[lordsawar] / src / gui / preferences-dialog.h
1 //  Copyright (C) 2007 Ole Laursen
2 //  Copyright (C) 2007, 2008, 2009 Ben Asselstine
3 //
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.
8 //
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.
13 //
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 
17 //  02110-1301, USA.
18
19 #ifndef PREFERENCES_DIALOG_H
20 #define PREFERENCES_DIALOG_H
21
22 #include <map>
23 #include <memory>
24 #include <sigc++/trackable.h>
25 #include <sigc++/signal.h>
26 #include <gtkmm.h>
27
28 #include "vector.h"
29
30 #include "decorated.h"
31 class Game;
32 class Player;
33 // dialog for showing sound and game preferences
34 class PreferencesDialog: public Decorated
35 {
36  public:
37     PreferencesDialog(bool readonly);
38     ~PreferencesDialog();
39
40     void set_parent_window(Gtk::Window &parent);
41
42     void run(Game *game);
43     void hide();
44
45  private:
46     Gtk::Dialog* dialog;
47     Gtk::CheckButton *commentator_checkbutton;
48     Gtk::Scale *speed_scale;
49     Gtk::CheckButton *play_music_checkbutton;
50     Gtk::Scale *music_volume_scale;
51     Gtk::Box *music_volume_hbox;
52     Gtk::VBox *players_vbox;
53
54     bool d_readonly;
55     void on_show_commentator_toggled();
56     void on_play_music_toggled();
57     void on_music_volume_changed();
58     void on_speed_changed();
59     void on_observe_toggled(Gtk::CheckButton *button);
60     void on_type_changed(Gtk::ComboBoxText *combo);
61
62     typedef std::map<Player*, Gtk::ComboBoxText*> PlayerTypeMap;
63     PlayerTypeMap player_types;
64
65     typedef std::map<Player*, Gtk::CheckButton*> PlayerObserveMap;
66     PlayerObserveMap player_observed;
67 };
68
69 #endif