Files
panopainter/engine/layout.h

33 lines
788 B
C++

#pragma once
#include "shape.h"
#include "util.h"
#include "shader.h"
#include "font.h"
#include "asset.h"
#include "rtt.h"
#include "bezier.h"
#include "canvas.h"
#include "event.h"
#include <tinyxml2.h>
#include <yoga/Yoga.h>
class LayoutManager
{
std::map<uint16_t, std::unique_ptr<class Node>> m_layouts;
std::string m_path;
struct stat m_file_info { 0 };
public:
bool m_loaded = false;
std::function<void()> on_loaded;
bool load(const char* path);
bool reload();
class Node* operator[](uint16_t id)
{
auto i = m_layouts.find(id);
return i == m_layouts.end() ? nullptr : i->second.get();
}
void restore_context();
void clear_context();
//Node& operator[](const char* ids) { return m_layouts[const_hash(ids)]; }
};