split layout.xml into multiple files loaded on demand, update changelog

This commit is contained in:
2019-09-25 22:59:04 +02:00
parent 7e732cc9b8
commit b10fa60d1b
51 changed files with 2009 additions and 1607 deletions

View File

@@ -206,7 +206,7 @@ public:
void watch(std::function<bool(Node*)> observer);
virtual void destroy();
Node* root();
void set_manager(LayoutManager* manager);
template<class T = Node> std::shared_ptr<T> clone()
{
@@ -242,7 +242,7 @@ public:
template<class T> T* add_child()
{
auto* n = new T;
n->m_manager = m_manager;
n->set_manager(m_manager);
n->m_parent = m_parent;
n->init();
n->create();
@@ -253,7 +253,7 @@ public:
template<class T> std::shared_ptr<T> add_child_ref()
{
auto n = std::make_shared<T>();
n->m_manager = m_manager;
n->set_manager(m_manager);
n->m_parent = m_parent;
n->init();
n->create();
@@ -261,6 +261,15 @@ public:
add_child(n);
return n;
}
template<class T = Node> std::shared_ptr<T> add_child_file(const std::string& filename, const std::string& name)
{
if (auto t = load_template(filename, name))
{
add_child(t);
return std::dynamic_pointer_cast<T>(t);
}
return nullptr;
}
virtual void on_tick(float dt) { };
virtual kEventResult on_event(Event* e);
@@ -276,6 +285,8 @@ public:
virtual void on_child_added(Node* child) { };
virtual void on_child_removed(Node* child) { };
const Node* init_template(const char* id);
bool init_template_file(const std::string& path, const std::string& id);
std::shared_ptr<Node> load_template(const std::string& filename, const std::string& name) const;
void tick(float dt);
void app_redraw();
void add_child(Node* n);