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:
Andreas Kling 2020-03-05 15:46:37 +01:00
parent 42f2696355
commit 3edcaa9b99
Notes: sideshowbarker 2024-07-19 08:53:51 +09:00
4 changed files with 50 additions and 0 deletions

View file

@ -206,4 +206,26 @@ void AbstractButton::save_to(JsonObject& json)
Widget::save_to(json);
}
bool AbstractButton::set_property(const StringView& name, const JsonValue& value)
{
if (name == "text") {
set_text(value.to_string());
return true;
}
if (name == "checked") {
set_checked(value.to_bool());
return true;
}
if (name == "checkable") {
set_checkable(value.to_bool());
return true;
}
if (name == "exclusive") {
set_exclusive(value.to_bool());
return true;
}
return Widget::set_property(name, value);
}
}