mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 15:40:19 +00:00
LibGUI: Add missing properties to Widget gml
Add a few properties to Widget class for usage when in a gml environment
This commit is contained in:
parent
39908fd569
commit
b795f582cf
Notes:
sideshowbarker
2024-07-19 00:11:16 +09:00
Author: https://github.com/kingwill101 🔰 Commit: https://github.com/SerenityOS/serenity/commit/b795f582cf0 Pull-request: https://github.com/SerenityOS/serenity/pull/4755 Reviewed-by: https://github.com/awesomekling
1 changed files with 31 additions and 0 deletions
|
@ -94,15 +94,20 @@ Widget::Widget()
|
||||||
|
|
||||||
REGISTER_SIZE_PROPERTY("min_size", min_size, set_min_size);
|
REGISTER_SIZE_PROPERTY("min_size", min_size, set_min_size);
|
||||||
REGISTER_SIZE_PROPERTY("max_size", max_size, set_max_size);
|
REGISTER_SIZE_PROPERTY("max_size", max_size, set_max_size);
|
||||||
|
REGISTER_INT_PROPERTY("width", width, set_width);
|
||||||
REGISTER_INT_PROPERTY("min_width", min_width, set_min_width);
|
REGISTER_INT_PROPERTY("min_width", min_width, set_min_width);
|
||||||
REGISTER_INT_PROPERTY("max_width", max_width, set_max_width);
|
REGISTER_INT_PROPERTY("max_width", max_width, set_max_width);
|
||||||
REGISTER_INT_PROPERTY("min_height", min_height, set_min_height);
|
REGISTER_INT_PROPERTY("min_height", min_height, set_min_height);
|
||||||
|
REGISTER_INT_PROPERTY("height", height, set_height);
|
||||||
REGISTER_INT_PROPERTY("max_height", max_height, set_max_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_width", dummy_fixed_width, set_fixed_width);
|
||||||
REGISTER_INT_PROPERTY("fixed_height", dummy_fixed_height, set_fixed_height);
|
REGISTER_INT_PROPERTY("fixed_height", dummy_fixed_height, set_fixed_height);
|
||||||
REGISTER_SIZE_PROPERTY("fixed_size", dummy_fixed_size, set_fixed_size);
|
REGISTER_SIZE_PROPERTY("fixed_size", dummy_fixed_size, set_fixed_size);
|
||||||
|
|
||||||
|
REGISTER_INT_PROPERTY("x", x, set_x);
|
||||||
|
REGISTER_INT_PROPERTY("y", y, set_y);
|
||||||
|
|
||||||
register_property(
|
register_property(
|
||||||
"focus_policy", [this]() -> JsonValue {
|
"focus_policy", [this]() -> JsonValue {
|
||||||
auto policy = focus_policy();
|
auto policy = focus_policy();
|
||||||
|
@ -136,6 +141,32 @@ Widget::Widget()
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
register_property(
|
||||||
|
"foreground_color", [this]() -> JsonValue { return palette().color(foreground_role()).to_string(); },
|
||||||
|
[this](auto& value) {
|
||||||
|
auto c = Color::from_string(value.to_string());
|
||||||
|
if (c.has_value()) {
|
||||||
|
auto _palette = palette();
|
||||||
|
_palette.set_color(foreground_role(), c.value());
|
||||||
|
set_palette(_palette);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
});
|
||||||
|
|
||||||
|
register_property(
|
||||||
|
"background_color", [this]() -> JsonValue { return palette().color(background_role()).to_string(); },
|
||||||
|
[this](auto& value) {
|
||||||
|
auto c = Color::from_string(value.to_string());
|
||||||
|
if (c.has_value()) {
|
||||||
|
auto _palette = palette();
|
||||||
|
_palette.set_color(background_role(), c.value());
|
||||||
|
set_palette(_palette);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget::~Widget()
|
Widget::~Widget()
|
||||||
|
|
Loading…
Reference in a new issue