mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-01-06 00:25:12 +00:00
LibGUI: Implement set_property() on Widget and AbstractButton
This makes it possible for an RPC client to modify some interesting widget properties.
This commit is contained in:
@@ -739,6 +739,31 @@ void Widget::save_to(AK::JsonObject& json)
|
||||
Core::Object::save_to(json);
|
||||
}
|
||||
|
||||
bool Widget::set_property(const StringView& name, const JsonValue& value)
|
||||
{
|
||||
if (name == "fill_with_background_color") {
|
||||
set_fill_with_background_color(value.to_bool());
|
||||
return true;
|
||||
}
|
||||
if (name == "tooltip") {
|
||||
set_tooltip(value.to_string());
|
||||
return true;
|
||||
}
|
||||
if (name == "enable") {
|
||||
set_enabled(value.to_bool());
|
||||
return true;
|
||||
}
|
||||
if (name == "focused") {
|
||||
set_focus(value.to_bool());
|
||||
return true;
|
||||
}
|
||||
if (name == "visible") {
|
||||
set_visible(value.to_bool());
|
||||
return true;
|
||||
}
|
||||
return Core::Object::set_property(name, value);
|
||||
}
|
||||
|
||||
Vector<Widget*> Widget::child_widgets() const
|
||||
{
|
||||
Vector<Widget*> widgets;
|
||||
|
||||
Reference in New Issue
Block a user