'ifnot' template property + hpp

This commit is contained in:
MihailRis
2024-05-06 00:45:43 +03:00
parent 8b1c102cfe
commit 9ea67deb13
59 changed files with 204 additions and 201 deletions
+53
View File
@@ -0,0 +1,53 @@
#ifndef FRONTEND_UI_DOCUMENT_HPP_
#define FRONTEND_UI_DOCUMENT_HPP_
#include "../typedefs.h"
#include <string>
#include <memory>
#include <filesystem>
#include <unordered_map>
namespace fs = std::filesystem;
namespace gui {
class UINode;
}
struct uidocscript {
bool onopen : 1;
bool onprogress : 1;
bool onclose : 1;
};
using uinodes_map = std::unordered_map<std::string, std::shared_ptr<gui::UINode>>;
class UiDocument {
std::string id;
uidocscript script;
uinodes_map map;
std::shared_ptr<gui::UINode> root;
scriptenv env;
public:
UiDocument(
std::string id,
uidocscript script,
std::shared_ptr<gui::UINode> root,
scriptenv env
);
void rebuildIndices();
const std::string& getId() const;
const uinodes_map& getMap() const;
uinodes_map& getMapWriteable();
const std::shared_ptr<gui::UINode> getRoot() const;
const std::shared_ptr<gui::UINode> get(const std::string& id) const;
const uidocscript& getScript() const;
scriptenv getEnvironment() const;
static std::unique_ptr<UiDocument> read(scriptenv parent_env, std::string name, fs::path file);
static std::shared_ptr<gui::UINode> readElement(fs::path file);
};
#endif // FRONTEND_UI_DOCUMENT_HPP_