initial commit, lordsawar source, slightly modified
[lordsawar] / src / editor / cityset-window.h
1 //  Copyright (C) 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_CITYSET_WINDOW_H
19 #define GUI_CITYSET_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 "cityset.h"
28
29 //! Cityset Editor.  Edit an cityset.
30 class CitySetWindow: public sigc::trackable
31 {
32  public:
33     CitySetWindow(std::string load_filename = "");
34     ~CitySetWindow();
35
36     void show();
37     void hide();
38
39     Gtk::Window &get_window() { return *window; }
40
41  private:
42     Gtk::Window* window;
43     std::string current_save_filename;
44     Cityset *d_cityset; //current cityset
45     bool needs_saving;
46     Gtk::MenuItem *new_cityset_menuitem;
47     Gtk::MenuItem *load_cityset_menuitem;
48     Gtk::MenuItem *save_cityset_menuitem;
49     Gtk::MenuItem *validate_cityset_menuitem;
50     Gtk::MenuItem *edit_cityset_info_menuitem;
51     Gtk::MenuItem *quit_menuitem;
52     Gtk::MenuItem *help_about_menuitem;
53     Gtk::Button *change_citypics_button;
54     Gtk::Button *change_razedcitypics_button;
55     Gtk::Button *change_portpic_button;
56     Gtk::Button *change_signpostpic_button;
57     Gtk::Button *change_ruinpics_button;
58     Gtk::Button *change_templepic_button;
59     Gtk::Button *change_towerpics_button;
60     Gtk::SpinButton *city_tile_width_spinbutton;
61     Gtk::SpinButton *ruin_tile_width_spinbutton;
62     Gtk::SpinButton *temple_tile_width_spinbutton;
63     Gtk::Frame *cityset_frame;
64
65     bool on_delete_event(GdkEventAny *e);
66
67     void update_cityset_panel();
68     void update_cityset_menuitems();
69
70     void load_cityset(std::string filename);
71
72     //callbacks
73     void on_new_cityset_activated();
74     void on_load_cityset_activated();
75     void on_save_cityset_activated();
76     void on_validate_cityset_activated();
77     void on_quit_activated();
78     bool on_window_closed(GdkEventAny*);
79     bool quit();
80     void on_edit_cityset_info_activated();
81     void on_help_about_activated();
82     void on_city_tile_width_changed();
83     void on_city_tile_width_text_changed(const Glib::ustring &s, int* p);
84     void on_ruin_tile_width_changed();
85     void on_ruin_tile_width_text_changed(const Glib::ustring &s, int* p);
86     void on_temple_tile_width_changed();
87     void on_temple_tile_width_text_changed(const Glib::ustring &s, int* p);
88     void on_change_citypics_clicked();
89     void on_change_razedcitypics_clicked();
90     void on_change_portpic_clicked();
91     void on_change_signpostpic_clicked();
92     void on_change_ruinpics_clicked();
93     void on_change_templepic_clicked();
94     void on_change_towerpics_clicked();
95 };
96
97 #endif