1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 07:58:11 +00:00

LibGUI: Store text using the new String class in the AbstractButton

This change also adds non-deprecated text() and set_text() functions and
helper constructors for Button, CheckBox, and RadioButton to call the
strings directly.

The whole codebase at this point is still using the deprecated string
functions, which the class will quietly convert to a new String.
This commit is contained in:
Karol Kosek 2023-02-12 10:53:11 +01:00 committed by Linus Groh
parent d32b052f22
commit fca29eae09
8 changed files with 42 additions and 12 deletions

View file

@ -15,9 +15,9 @@
namespace GUI {
AbstractButton::AbstractButton(DeprecatedString text)
AbstractButton::AbstractButton(String text)
{
set_text_deprecated(move(text));
set_text(move(text));
set_focus_policy(GUI::FocusPolicy::StrongFocus);
set_background_role(Gfx::ColorRole::Button);
@ -34,7 +34,12 @@ AbstractButton::AbstractButton(DeprecatedString text)
REGISTER_BOOL_PROPERTY("exclusive", is_exclusive, set_exclusive);
}
void AbstractButton::set_text_deprecated(DeprecatedString text)
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)
return;