1 #ifndef _TechTreeWnd_h_ 2 #define _TechTreeWnd_h_ 3 4 #include <GG/Wnd.h> 5 6 #include <boost/signals2/signal.hpp> 7 8 #include "../universe/EnumsFwd.h" 9 10 class Tech; 11 class EncyclopediaDetailPanel; 12 13 /** Returns a browse wnd for tech entries */ 14 std::shared_ptr<GG::BrowseInfoWnd> TechRowBrowseWnd(const std::string& tech_name, int empire_id); 15 16 /** Contains the tech graph layout, some controls to control what is visible in 17 * the tech layout, the tech navigator, and the tech detail window. */ 18 class TechTreeWnd : public GG::Wnd { 19 public: 20 typedef boost::signals2::signal<void (const std::string&)> TechSignalType; 21 typedef boost::signals2::signal<void (const std::string&, 22 const GG::Flags<GG::ModKey>&)> TechClickSignalType; 23 typedef boost::signals2::signal<void (const std::vector<std::string>&, int)> QueueAddTechsSignalType; 24 25 /** \name Structors */ //@{ 26 /** TechTreeWnd contructor is usually called before client has 27 access to techs. Attempting to show the tech tree takes a long 28 time and generates errors. If \p initially_hidden is true then the 29 tech categories are not parsed until the first time Show() is 30 called, speeding up the constructor and preventing spurious errors.*/ 31 TechTreeWnd(GG::X w, GG::Y h, bool initially_hidden = true); 32 ~TechTreeWnd(); 33 //@} 34 void CompleteConstruction() override; 35 36 /** \name Accessors */ //@{ 37 double Scale() const; 38 bool PediaVisible(); 39 /** If tech @p tech_name is currently visible */ 40 bool TechIsVisible(const std::string& tech_name) const; 41 //@} 42 43 //! \name Mutators //@{ 44 void SizeMove(const GG::Pt& ul, const GG::Pt& lr) override; 45 46 void Show() override; 47 48 void Update(); 49 void Clear(); 50 void Reset(); 51 52 void ShowCategory(const std::string& category); 53 void ShowAllCategories(); 54 void HideCategory(const std::string& category); 55 void HideAllCategories(); 56 void ToggleAllCategories(); 57 58 void SetTechStatus(const TechStatus status, const bool state); 59 60 void ToggleViewType(bool show_list_view); 61 void ShowTreeView(); 62 void ShowListView(); 63 64 void CenterOnTech(const std::string& tech_name); 65 void SetEncyclopediaTech(const std::string& tech_name); 66 void SelectTech(const std::string& tech_name); 67 68 void ShowPedia(); 69 void HidePedia(); 70 void TogglePedia(); 71 //@} 72 73 mutable TechSignalType TechSelectedSignal; 74 mutable QueueAddTechsSignalType AddTechsToQueueSignal; 75 76 private: 77 class TechTreeControls; 78 class LayoutPanel; 79 class TechListBox; 80 81 void TechLeftClickedSlot(const std::string& tech_name, 82 const GG::Flags<GG::ModKey>& modkeys); 83 void AddTechToResearchQueue(const std::string& tech_name, 84 bool to_front); 85 void TechPediaDisplaySlot(const std::string& tech_name); 86 87 void InitializeWindows(); 88 89 std::shared_ptr<TechTreeControls> m_tech_tree_controls; 90 std::shared_ptr<EncyclopediaDetailPanel> m_enc_detail_panel; 91 std::shared_ptr<LayoutPanel> m_layout_panel; 92 std::shared_ptr<TechListBox> m_tech_list; 93 94 /// If m_init_flag is true tech categories are not parsed until the 95 /// first time Show() is called. TechTreeWnd is constructed before the 96 /// tech categories are available to be parsed. 97 bool m_init_flag; 98 }; 99 100 #endif // _TechTreeWnd_h_ 101