1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 21:17:44 +00:00

VisualBuilder: Support nested widgets

This patch makes it possible to put widgets inside one another. The way
you do this right now is by having a (single) widget selected when you
insert a new widget. The new widget then becomes a child of the
selected widget. (In the future we'll make it possible to drag widgets
into each other, and things like that.)

I've also changed the grabber coordinates to be window-relative instead
of parent-relative in order to simplify things for myself. Maybe that's
not the ideal design and we can revisit that.
This commit is contained in:
Andreas Kling 2019-09-17 21:00:11 +02:00
parent ce44d9a32f
commit 9acdf9bb0a
3 changed files with 23 additions and 13 deletions

View file

@ -45,7 +45,7 @@ class VBWidget : public RefCounted<VBWidget>
friend class VBWidgetPropertyModel;
public:
static NonnullRefPtr<VBWidget> create(VBWidgetType type, VBForm& form) { return adopt(*new VBWidget(type, form)); }
static NonnullRefPtr<VBWidget> create(VBWidgetType type, VBForm& form, VBWidget* parent) { return adopt(*new VBWidget(type, form, parent)); }
~VBWidget();
bool is_selected() const;
@ -73,7 +73,7 @@ public:
void capture_transform_origin_rect();
private:
VBWidget(VBWidgetType, VBForm&);
VBWidget(VBWidgetType, VBForm&, VBWidget* parent);
void add_property(const String& name, Function<GVariant(const GWidget&)>&& getter, Function<void(GWidget&, const GVariant&)>&& setter);