mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-28 23:39:02 +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:
parent
42f2696355
commit
3edcaa9b99
Notes:
sideshowbarker
2024-07-19 08:53:51 +09:00
Author: https://github.com/awesomekling
Commit: 3edcaa9b99
4 changed files with 50 additions and 0 deletions
|
@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue