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