add remote page loading

This commit is contained in:
2019-11-27 19:55:31 +01:00
parent 7701e6771b
commit 41579fa3c6
18 changed files with 373 additions and 41 deletions

View File

@@ -97,6 +97,7 @@ enum class kWidget : uint16_t
UserManual = const_hash("usermanual"),
ToolBucket = const_hash("tool-bucket"),
Timeline = const_hash("timeline"),
Metadata = const_hash("metadata"),
};
class Node : public std::enable_shared_from_this<Node>
@@ -143,6 +144,9 @@ public:
// it's actually rendering
bool m_on_screen = false;
bool auto_width = true;
bool auto_height = true;
Node(const Node&) = delete;
Node& operator=(const Node&) = delete;
Node&& operator=(Node&& o);
@@ -279,6 +283,15 @@ public:
}
return nullptr;
}
template<class T = Node> std::shared_ptr<T> add_child_xml(const std::string& xml_string, const std::string& name)
{
if (auto t = parse_template(xml_string, 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);
@@ -296,6 +309,7 @@ public:
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;
std::shared_ptr<Node> parse_template(const std::string& xml_stirng, const std::string& name) const;
void tick(float dt);
void app_redraw();
void add_child(Node* n);