1 #ifndef _SystemResourceSummaryBrowseWnd_h_
2 #define _SystemResourceSummaryBrowseWnd_h_
3 
4 #include <GG/GGFwd.h>
5 #include <GG/BrowseInfoWnd.h>
6 
7 #include "../universe/EnumsFwd.h"
8 #include "../util/Export.h"
9 
10 FO_COMMON_API extern const int ALL_EMPIRES;
11 
12 /** Gives information about inporting and exporting of resources to and from this system when mousing
13   * over the system resource production summary. */
14 class SystemResourceSummaryBrowseWnd : public GG::BrowseInfoWnd {
15 public:
16     SystemResourceSummaryBrowseWnd(ResourceType resource_type, int system_id,
17                                    int empire_id = ALL_EMPIRES);
18 
19     bool WndHasBrowseInfo(const Wnd* wnd, std::size_t mode) const override;
20     void Render() override;
21 
22 private:
23     void UpdateImpl(std::size_t mode, const GG::Wnd* target) override;
24     void Clear();
25     void Initialize();
26 
27     void UpdateProduction(GG::Y& top);  // adds pairs of labels for ResourceCenter name and production of resource starting at vertical position \a top and updates \a top to the vertical position after the last entry
28     void UpdateAllocation(GG::Y& top);  // adds pairs of labels for allocation of resources in system, starting at vertical position \a top and updates \a top to be the vertical position after the last entry
29     void UpdateImportExport(GG::Y& top);// sets m_import_export_label and m_import_export text and amount to indicate how much resource is being imported or exported from this system, and moves them to vertical position \a top and updates \a top to be the vertical position below these labels
30 
31     ResourceType    m_resource_type;
32     int             m_system_id;
33     int             m_empire_id;
34     double          m_production;       // set by UpdateProduction - used to store production in system so that import / export / unused can be more easily calculated
35     double          m_allocation;       // set by UpdateAllocation - used like m_production
36 
37     std::shared_ptr<GG::Label> m_production_label;
38     std::shared_ptr<GG::Label> m_allocation_label;
39     std::shared_ptr<GG::Label> m_import_export_label;
40 
41     std::vector<std::pair<std::shared_ptr<GG::Label>, std::shared_ptr<GG::Label>>> m_production_labels_and_amounts;
42     std::vector<std::pair<std::shared_ptr<GG::Label>, std::shared_ptr<GG::Label>>> m_allocation_labels_and_amounts;
43     std::vector<std::pair<std::shared_ptr<GG::Label>, std::shared_ptr<GG::Label>>> m_import_export_labels_and_amounts;
44 
45     GG::Y row_height;
46     GG::Y production_label_top;
47     GG::Y allocation_label_top;
48     GG::Y import_export_label_top;
49 };
50 
51 #endif
52