#ifndef FRONTEND_UI_DOCUMENT_H_ #define FRONTEND_UI_DOCUMENT_H_ #include "../logic/scripting/Environment.h" #include #include #include #include namespace fs = std::filesystem; namespace gui { class UINode; } namespace scripting { class Environment; } struct uidocscript { int environment; bool onopen : 1; bool onclose : 1; }; using uinodes_map = std::unordered_map>; class UiDocument { std::string id; uidocscript script; uinodes_map map; std::shared_ptr root; std::unique_ptr env; public: UiDocument( std::string id, uidocscript script, std::shared_ptr root, std::unique_ptr env ); void rebuildIndices(); const std::string& getId() const; const uinodes_map& getMap() const; uinodes_map& getMapWriteable(); const std::shared_ptr getRoot() const; const std::shared_ptr get(const std::string& id) const; const uidocscript& getScript() const; int getEnvironment() const; static std::unique_ptr read(int env, std::string name, fs::path file); static std::shared_ptr readElement(fs::path file); }; #endif // FRONTEND_UI_DOCUMENT_H_