1 #ifndef _MilitaryPanel_h_ 2 #define _MilitaryPanel_h_ 3 4 #include "AccordionPanel.h" 5 #include "../universe/EnumsFwd.h" 6 7 8 class MultiIconValueIndicator; 9 class MultiMeterStatusBar; 10 class Planet; 11 class StatisticIcon; 12 13 /** Shows military-related meters including stealth, detection, shields, defense; with meter bars */ 14 class MilitaryPanel : public AccordionPanel { 15 public: 16 /** \name Structors */ //@{ 17 MilitaryPanel(GG::X w, int planet_id); 18 ~MilitaryPanel(); 19 //@} 20 void CompleteConstruction() override; 21 22 /** \name Accessors */ //@{ PlanetID()23 int PlanetID() const { return m_planet_id; } 24 //@} 25 26 /** \name Mutators */ //@{ 27 void PreRender() override; 28 /** expands or collapses panel to show details or just summary info */ 29 void ExpandCollapse(bool expanded); 30 31 /** updates indicators with values of associated object. Does not do layout and resizing. */ 32 void Update(); 33 /** updates, redoes layout, resizes indicator */ 34 void Refresh(); 35 //@} 36 37 protected: 38 /** \name Mutators */ //@{ 39 /** resizes panel and positions widgets */ 40 void DoLayout() override; 41 //@} 42 43 private: 44 /** toggles panel expanded or collapsed */ 45 void ExpandCollapseButtonPressed(); 46 47 /** object id for the Planet that this panel displays */ 48 int m_planet_id; 49 50 /** Icons for the associated meter type. */ 51 std::vector<std::pair<MeterType, std::shared_ptr<StatisticIcon>>> m_meter_stats; 52 53 /** textually / numerically indicates military capabilities */ 54 std::shared_ptr<MultiIconValueIndicator> m_multi_icon_value_indicator; 55 /** graphically indicates meter values */ 56 std::shared_ptr<MultiMeterStatusBar> m_multi_meter_status_bar; 57 58 /** map indexed by popcenter ID indicating whether the PopulationPanel for each object is expanded (true) or collapsed (false) */ 59 static std::map<int, bool> s_expanded_map; 60 }; 61 62 #endif 63