1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-10 03:47:34 +00:00

LibGUI: Add fixed_size/fixed_width/fixed_height helpers to Widget

Fixed sizes are really just shorthands for setting min and max size to
the same value.

This makes it much nicer to express fixed sizes in GML:

Before:

    @GUI::Widget {
        horizontal_size_policy: "Fixed"
        preferred_width: 20
    }

After:

    @GUI::Widget {
        fixed_width: 20
    }
This commit is contained in:
Andreas Kling 2020-12-29 18:46:42 +01:00
parent c9331a96d6
commit ee85713e52
2 changed files with 29 additions and 0 deletions

View file

@ -145,6 +145,10 @@ Widget::Widget()
REGISTER_INT_PROPERTY("min_height", min_height, set_min_height);
REGISTER_INT_PROPERTY("max_height", max_height, set_max_height);
REGISTER_INT_PROPERTY("fixed_width", dummy_fixed_width, set_fixed_width);
REGISTER_INT_PROPERTY("fixed_height", dummy_fixed_height, set_fixed_height);
REGISTER_SIZE_PROPERTY("fixed_size", dummy_fixed_size, set_fixed_size);
register_property(
"focus_policy", [this]() -> JsonValue {
auto policy = focus_policy();