1 // Copyright (C) 2007 Ole Laursen 2 // Copyright (C) 2007-2009, 2014, 2017 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 BUY_PRODUCTION_DIALOG_H 21 #define BUY_PRODUCTION_DIALOG_H 22 23 #include <gtkmm.h> 24 25 #include "army-info-tip.h" 26 #include "armyproto.h" 27 #include "lw-dialog.h" 28 29 class City; 30 31 // dialog for buying a production slot for a city 32 class BuyProductionDialog: public LwDialog 33 { 34 public: 35 BuyProductionDialog(Gtk::Window &parent, City *city); 36 ~BuyProductionDialog(); 37 38 void run(); hide()39 void hide() {dialog->hide();}; 40 41 enum { NO_ARMY_SELECTED = -1 }; get_selected_army()42 int get_selected_army() { return selected_army == NO_ARMY_SELECTED ? int(NO_ARMY_SELECTED) : purchasables[selected_army]->getId(); } 43 44 private: 45 ArmyInfoTip* army_info_tip; 46 Gtk::Label *unit_label; 47 Gtk::Label *cost_label; 48 Gtk::Label *time_label; 49 Gtk::Label *moves_label; 50 Gtk::Label *strength_label; 51 Gtk::Label *upkeep_label; 52 Gtk::Button *buy_button; 53 54 City *city; 55 int selected_army; 56 57 std::vector<Gtk::ToggleButton *> production_toggles; 58 bool ignore_toggles; 59 std::vector<const ArmyProto*> purchasables; 60 61 void on_production_toggled(Gtk::ToggleButton *toggle); 62 bool on_production_button_event(GdkEventButton *e, Gtk::ToggleButton *toggle); 63 void fill_in_production_info(); 64 void fill_pixbuf (int i); 65 void set_buy_button_state(); 66 const ArmyProto *army_id_to_army(); 67 int lookup_slot (Gtk::ToggleButton *toggle); 68 }; 69 70 #endif 71