1 //  Copyright (C) 2007 Ole Laursen
2 //  Copyright (C) 2007, 2008, 2009, 2012, 2014, 2015 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 #pragma once
20 #ifndef CITY_WINDOW_H
21 #define CITY_WINDOW_H
22 
23 #include <vector>
24 #include <gtkmm.h>
25 #include "vectormap.h"
26 #include "army-info-tip.h"
27 #include "lw-dialog.h"
28 
29 class City;
30 
31 // dialog for displaying a friendly city
32 class CityWindow: public LwDialog
33 {
34  public:
35     CityWindow(Gtk::Window &parent, City *city, bool razing_possible, bool see_opponents_production);
36 
37     ~CityWindow();
38 
39     void run();
hide()40     void hide() {dialog->hide();};
41 
42     static bool on_raze_clicked (City *city, Gtk::Dialog *parent);
43 
44  private:
45     VectorMap* prodmap;
46     ArmyInfoTip* army_info_tip;
47     Gtk::Image *map_image;
48     Glib::RefPtr<Gdk::Pixbuf> map_pixbuf;
49     Gtk::Label *city_label;
50     Gtk::Button *buy_button;
51     Gtk::Button *on_hold_button;
52     Gtk::Button *rename_button;
53     Gtk::Button *destination_button;
54     Gtk::Button *raze_button;
55     Gtk::Label *turns_left_label;
56     Gtk::Image *current_image;
57     Gtk::Label *current_label;
58     Gtk::Label *capital_city_label;
59     Gtk::Label *defense_label;
60     Gtk::Label *income_label;
61     Gtk::Label *unit_label;
62     Gtk::Label *time_label;
63     Gtk::Label *moves_label;
64     Gtk::Label *strength_label;
65     Gtk::Label *cost_label;
66     Gtk::Label *combat_bonus_label;
67     Gtk::Label *rebellious_label;
68 
69     City *city;
70 
71     bool d_razing_possible;
72     bool d_see_all;
73 
74 
75     Gtk::Box *production_toggles_hbox;
76     std::vector<Gtk::ToggleButton *> production_toggles;
77     bool ignore_toggles;
78 
79     void fill_in_city_info();
80     void fill_in_production_toggles();
81     void fill_in_production_info();
82 
83     void on_production_toggled(Gtk::ToggleButton *toggle);
84     bool on_production_button_event(GdkEventButton *e, Gtk::ToggleButton *toggle);
85     void on_on_hold_clicked();
86     void on_buy_clicked();
87     void on_destination_clicked();
88     void on_map_changed(Cairo::RefPtr<Cairo::Surface> map);
89     bool on_map_mouse_button_event(GdkEventButton *e);
90     void on_rename_clicked ();
91     void on_raze_clicked ();
92 
93     void update_toggle_picture(int slot);
94 };
95 
96 #endif
97