mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 05:48:12 +00:00
LibGUI: Start building a way to instantiate GUI from JSON
My original idea for GUI building tools was to have the "VisualBuilder" app generate C++ code which in turn programmatically instantiated UI. That never really materialized in any useful way beyond static UIs. This is a fresh, new approach: using JSON to declare the UI and parsing and constructing this UI at runtime. This will allow for way more dynamic and flexible approaches to GUI development (I think.) The basic idea is that you pass a JSON string to Widget::load_from_json and it takes care of the rest. This first version supports basic box layouts and instantiation of arbitrary widgets, as long as those widgets have been registered. This code has some pretty rough edges right now as it's evolving and we need to figure out a lot of things about how it should work. Nevertheless, it feels pretty cool. :^)
This commit is contained in:
parent
c7133bf081
commit
ea17b0cbb6
2 changed files with 143 additions and 0 deletions
|
@ -281,6 +281,11 @@ public:
|
|||
Gfx::StandardCursor override_cursor() const { return m_override_cursor; }
|
||||
void set_override_cursor(Gfx::StandardCursor);
|
||||
|
||||
bool load_from_json(const StringView&);
|
||||
bool load_from_json(const JsonObject&);
|
||||
Widget* find_child_by_name(const String&);
|
||||
Widget* find_descendant_by_name(const String&);
|
||||
|
||||
protected:
|
||||
Widget();
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue