1 // Copyright (C) 2011, 2014, 2015, 2020 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 #pragma once 19 #ifndef STATUS_BOX_H 20 #define STATUS_BOX_H 21 22 #include <memory> 23 #include <sigc++/trackable.h> 24 #include <gtkmm.h> 25 #include <glibmm.h> 26 #include "Configuration.h" 27 #include "sidebar-stats.h" 28 #include "stack-tile-box.h" 29 #include "tartan-progress-bar.h" 30 31 class StackTileBox; 32 class StackTile; 33 // shows stats/progress/stack listing 34 class StatusBox: public Gtk::Box 35 { 36 public: 37 //! Constructor for building this object with gtk::builder 38 StatusBox(BaseObjectType* base, const Glib::RefPtr<Gtk::Builder> &xml); 39 40 //!Destructor. 41 ~StatusBox(); 42 43 static StatusBox * create(); 44 45 void show_stats(); 46 void enforce_height(); 47 void show_progress(); 48 void show_stack(StackTile *s); 49 void on_stack_info_changed(Stack *s); get_currently_selected_stack()50 Stack * get_currently_selected_stack() const {return stack_tile_box->get_currently_selected_stack();}; clear_selected_stack()51 void clear_selected_stack() {stack_tile_box->clear_selected_stack();}; setHeightFudgeFactor(guint32 n)52 void setHeightFudgeFactor(guint32 n) {d_height_fudge_factor = n;}; 53 54 void set_progress_label(Glib::ustring s); 55 void pulse(); 56 void reset_progress(); 57 void update_sidebar_stats(SidebarStats s); 58 void toggle_group_ungroup(); 59 //! Signals 60 sigc::signal<void, Stack*> stack_composition_modified; 61 sigc::signal<void, bool> stack_tile_group_toggle; 62 protected: 63 64 private: 65 StackTileBox *stack_tile_box; 66 guint32 d_height_fudge_factor; 67 Gtk::Notebook *notebook; 68 Gtk::Image *cities_stats_image; 69 Gtk::Label *cities_stats_label; 70 Gtk::Image *gold_stats_image; 71 Gtk::Label *gold_stats_label; 72 Gtk::Image *income_stats_image; 73 Gtk::Label *income_stats_label; 74 Gtk::Image *upkeep_stats_image; 75 Gtk::Label *upkeep_stats_label; 76 Gtk::Box *stack_info_container; 77 Gtk::Box *stack_tile_box_container; 78 Gtk::Box *stats_box; 79 Gtk::Box *tartan_box; 80 TartanProgressBar *turn_progressbar; 81 Gtk::Label *progress_status_label; 82 Glib::TimeVal last_pulsed; 83 84 void drop_connections(); 85 void pad_image(Gtk::Image *image); 86 }; 87 88 #endif // STATUS_BOX 89