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