1 #ifndef _DesignWnd_h_ 2 #define _DesignWnd_h_ 3 4 #include <GG/Wnd.h> 5 #include <boost/uuid/uuid.hpp> 6 7 class EncyclopediaDetailPanel; 8 struct SaveGameUIData; 9 10 /** ShipDesignManager tracks information known to the client about ShipDesigns. 11 * This includes the order of designs to be shown DesignWnd and the 12 * BuildDesignator. */ 13 class ShipDesignManager { 14 public: 15 /** Designs provides ordered lists of designs for display in the UI. 16 Derived classes provide an implementation for the pure virtual 17 OrderedIDs(), which provides ship design ids in display order. They may 18 also provide additional functionality used by the DesignWnd. */ 19 class Designs { 20 public: 21 virtual std::vector<int> OrderedIDs() const = 0; 22 }; 23 24 ShipDesignManager(); 25 virtual ~ShipDesignManager(); 26 27 virtual void StartGame(int empire_id, bool is_new_game); 28 virtual void Load(const SaveGameUIData& data); 29 virtual void Save(SaveGameUIData& data) const; 30 31 /** DisplayedDesigns are design currently producible by the empire, in the ProductionWnd.*/ 32 virtual Designs* DisplayedDesigns(); 33 /** SavedDesigns are designs that the player has saved on their own machine 34 for future use. They may/may not also be in use in the current game. */ 35 virtual Designs* SavedDesigns(); 36 37 private: 38 std::unique_ptr<Designs> m_displayed_designs;// designs shown to the player in the UI 39 std::unique_ptr<Designs> m_saved_designs; // loaded from saved design script files, can be added to empire by player or automatically 40 }; 41 42 /** Lets the player design ships */ 43 class DesignWnd : public GG::Wnd { 44 public: 45 /** \name Structors */ //@{ 46 DesignWnd(GG::X w, GG::Y h); 47 //@} 48 void CompleteConstruction() override; 49 50 /** \name Mutators */ //@{ 51 void SizeMove(const GG::Pt& ul, const GG::Pt& lr) override; 52 void Render() override; 53 void Reset(); 54 void Sanitize(); 55 56 //! Shows @a ship_part in design encyclopedia window 57 void ShowShipPartInEncyclopedia(const std::string& ship_part); 58 59 //! Shows @p ship_hull in design encyclopedia window 60 void ShowShipHullInEncyclopedia(const std::string& ship_hull); 61 62 /** Shows ship design with id \a design_id in design encyclopedia window */ 63 void ShowShipDesignInEncyclopedia(int design_id); 64 65 /** Enables, or disables if \a enable is false, issuing orders via this DesignWnd. */ 66 void EnableOrderIssuing(bool enable = true); 67 //@} 68 69 private: 70 class BaseSelector; // has tabs to pick empty hull, previously-saved design or an autodesign template to start new design 71 class PartPalette; // shows parts that can be clicked for detailed or dragged on slots in design 72 class MainPanel; // shows image of hull, slots and parts, design name and description entry boxes, confirm button 73 74 void DesignChanged(); 75 void DesignNameChanged(); 76 void InitializeWindows(); 77 78 std::shared_ptr<EncyclopediaDetailPanel> m_detail_panel; 79 std::shared_ptr<BaseSelector> m_base_selector; 80 std::shared_ptr<PartPalette> m_part_palette; 81 std::shared_ptr<MainPanel> m_main_panel; 82 }; 83 84 #endif // _DesignWnd_h_ 85