1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 13:48:12 +00:00

LibGUI: Remove deprecated text and set_text functions in AbstractButton

This moves the functions to lambda when registering a property.
External code can now only communicate using the new String API.
This commit is contained in:
Karol Kosek 2023-02-11 21:42:24 +01:00 committed by Linus Groh
parent e39adc4772
commit 14951b92ca
8 changed files with 8 additions and 30 deletions

View file

@ -28,17 +28,19 @@ AbstractButton::AbstractButton(String text)
click();
};
REGISTER_STRING_PROPERTY("text", text_deprecated, set_text_deprecated);
// FIXME: Port JsonValue to the new String class.
register_property(
"text",
[this]() { return this->text().to_deprecated_string(); },
[this](auto& value) {
this->set_text(String::from_deprecated_string(value.to_deprecated_string()).release_value_but_fixme_should_propagate_errors());
return true;
});
REGISTER_BOOL_PROPERTY("checked", is_checked, set_checked);
REGISTER_BOOL_PROPERTY("checkable", is_checkable, set_checkable);
REGISTER_BOOL_PROPERTY("exclusive", is_exclusive, set_exclusive);
}
void AbstractButton::set_text_deprecated(DeprecatedString deprecated_text)
{
set_text(String::from_deprecated_string(deprecated_text).release_value_but_fixme_should_propagate_errors());
}
void AbstractButton::set_text(String text)
{
if (m_text == text)