#pragma once #include "typedefs.hpp" #include #include #include #include "io/fwd.hpp" namespace gui { class GUI; class UINode; } struct uidocscript { bool onopen : 1; bool onprogress : 1; bool onclose : 1; }; using UINodesMap = std::unordered_map>; class UiDocument { std::string id; uidocscript script; UINodesMap map; std::shared_ptr root; scriptenv env; public: UiDocument( std::string id, uidocscript script, const std::shared_ptr &root, scriptenv env ); void rebuildIndices(); const std::string& getId() const; const UINodesMap& getMap() const; UINodesMap& getMapWriteable(); std::shared_ptr getRoot() const; std::shared_ptr get(const std::string& id) const; const uidocscript& getScript() const; scriptenv getEnvironment() const; static std::unique_ptr read( gui::GUI&, const scriptenv& parent_env, const std::string& name, const io::path& file, const std::string& fileName ); static std::shared_ptr readElement( gui::GUI&, const io::path& file, const std::string& fileName ); };