initial commit, lordsawar source, slightly modified
[lordsawar] / src / editor / shieldset-window.h
1 //  Copyright (C) 2007, 2008, 2009 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 #ifndef GUI_SHIELDSET_WINDOW_H
19 #define GUI_SHIELDSET_WINDOW_H
20
21 #include <memory>
22 #include <vector>
23 #include <sigc++/signal.h>
24 #include <sigc++/trackable.h>
25 #include <gtkmm.h>
26
27 #include "shield.h"
28 #include "shieldset.h"
29 #include "shield.h"
30
31 //! Shieldset Editor.  Edit an Shieldset.
32 class ShieldSetWindow: public sigc::trackable
33 {
34  public:
35     ShieldSetWindow(std::string load_filename = "");
36     ~ShieldSetWindow();
37
38     void show();
39     void hide();
40
41     Gtk::Window &get_window() { return *window; }
42
43  private:
44     Gtk::Window* window;
45     std::string current_save_filename;
46     Shieldset *d_shieldset; //current shieldset
47     Shield *d_shield; //current shield
48     bool needs_saving;
49     Gtk::TreeView *shields_treeview;
50     Gtk::MenuItem *new_shieldset_menuitem;
51     Gtk::MenuItem *load_shieldset_menuitem;
52     Gtk::MenuItem *save_shieldset_menuitem;
53     Gtk::MenuItem *validate_shieldset_menuitem;
54     Gtk::MenuItem *edit_shieldset_info_menuitem;
55     Gtk::MenuItem *quit_menuitem;
56     Gtk::MenuItem *help_about_menuitem;
57     Gtk::Frame *shield_frame;
58     Gtk::Button *change_smallpic_button;
59     Gtk::Button *change_mediumpic_button;
60     Gtk::Button *change_largepic_button;
61     Gtk::ColorButton *player_colorbutton;
62
63     class ShieldsColumns: public Gtk::TreeModelColumnRecord {
64     public:
65         ShieldsColumns() 
66         { add(name); add(shield);}
67         
68         Gtk::TreeModelColumn<Glib::ustring> name;
69         Gtk::TreeModelColumn<Shield*> shield;
70     };
71     const ShieldsColumns shields_columns;
72     Glib::RefPtr<Gtk::ListStore> shields_list;
73
74     void on_new_shieldset_activated();
75     void on_load_shieldset_activated();
76     void on_save_shieldset_activated();
77     void on_validate_shieldset_activated();
78     void on_quit_activated();
79     bool on_delete_event(GdkEventAny *e);
80     bool on_window_closed(GdkEventAny*);
81     void on_edit_shieldset_info_activated();
82     void on_help_about_activated();
83     void on_shield_selected();
84     void on_change_smallpic_clicked();
85     void on_change_mediumpic_clicked();
86     void on_change_largepic_clicked();
87     void on_player_color_changed();
88
89     void fill_shield_info(Shield *shield);
90     void load_shieldset(std::string filename);
91     void update_shield_panel();
92     void update_shieldset_menuitems();
93     bool quit();
94     
95     void addNewShield(Shield::Colour owner, Gdk::Color colour);
96     void loadShield(Shield *shield);
97 };
98
99 #endif