mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 16:37:35 +00:00
VisualBuilder: Add [x, y, width, height] properties for all widgets.
At first I tried doing this as a single "rect" property but I like the feel of the individual properties much better. :^)
This commit is contained in:
parent
c425bc2e71
commit
3cddc3484e
5 changed files with 32 additions and 5 deletions
|
@ -73,15 +73,18 @@ static GWidget* build_gwidget(VBWidgetType type, GWidget* parent)
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
GWidget* VBWidgetRegistry::build_gwidget(VBWidgetType type, GWidget* parent, Vector<OwnPtr<VBProperty>>& properties)
|
||||
{
|
||||
auto* gwidget = ::build_gwidget(type, parent);
|
||||
auto add_property = [&properties] (const String& name, const GVariant& value, bool is_readonly) {
|
||||
auto add_property = [&properties] (const String& name, const GVariant& value = { }, bool is_readonly = false) {
|
||||
auto property = make<VBProperty>(name, value);
|
||||
property->set_readonly(is_readonly);
|
||||
properties.append(move(property));
|
||||
};
|
||||
add_property("class", to_class_name(type), true);
|
||||
add_property("width");
|
||||
add_property("height");
|
||||
add_property("x");
|
||||
add_property("y");
|
||||
return gwidget;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue