mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 17:57:35 +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:
parent
e39adc4772
commit
14951b92ca
8 changed files with 8 additions and 30 deletions
|
@ -28,17 +28,19 @@ AbstractButton::AbstractButton(String text)
|
||||||
click();
|
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("checked", is_checked, set_checked);
|
||||||
REGISTER_BOOL_PROPERTY("checkable", is_checkable, set_checkable);
|
REGISTER_BOOL_PROPERTY("checkable", is_checkable, set_checkable);
|
||||||
REGISTER_BOOL_PROPERTY("exclusive", is_exclusive, set_exclusive);
|
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)
|
void AbstractButton::set_text(String text)
|
||||||
{
|
{
|
||||||
if (m_text == text)
|
if (m_text == text)
|
||||||
|
|
|
@ -21,8 +21,6 @@ public:
|
||||||
|
|
||||||
Function<void(bool)> on_checked;
|
Function<void(bool)> on_checked;
|
||||||
|
|
||||||
virtual void set_text_deprecated(DeprecatedString);
|
|
||||||
DeprecatedString text_deprecated() const { return m_text.to_deprecated_string(); }
|
|
||||||
virtual void set_text(String);
|
virtual void set_text(String);
|
||||||
String const& text() const { return m_text; }
|
String const& text() const { return m_text; }
|
||||||
|
|
||||||
|
|
|
@ -20,11 +20,6 @@ REGISTER_WIDGET(GUI, DialogButton)
|
||||||
|
|
||||||
namespace GUI {
|
namespace GUI {
|
||||||
|
|
||||||
Button::Button(DeprecatedString deprecated_text)
|
|
||||||
: Button(String::from_deprecated_string(deprecated_text).release_value_but_fixme_should_propagate_errors())
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
Button::Button(String text)
|
Button::Button(String text)
|
||||||
: AbstractButton(move(text))
|
: AbstractButton(move(text))
|
||||||
{
|
{
|
||||||
|
|
|
@ -68,7 +68,6 @@ public:
|
||||||
virtual Optional<UISize> calculated_min_size() const override;
|
virtual Optional<UISize> calculated_min_size() const override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
explicit Button(DeprecatedString text);
|
|
||||||
explicit Button(String text = {});
|
explicit Button(String text = {});
|
||||||
virtual void mousedown_event(MouseEvent&) override;
|
virtual void mousedown_event(MouseEvent&) override;
|
||||||
virtual void mousemove_event(MouseEvent&) override;
|
virtual void mousemove_event(MouseEvent&) override;
|
||||||
|
@ -92,10 +91,6 @@ class DialogButton final : public Button {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
virtual ~DialogButton() override {};
|
virtual ~DialogButton() override {};
|
||||||
explicit DialogButton(DeprecatedString deprecated_text)
|
|
||||||
: DialogButton(String::from_deprecated_string(deprecated_text).release_value_but_fixme_should_propagate_errors())
|
|
||||||
{
|
|
||||||
}
|
|
||||||
explicit DialogButton(String text = {})
|
explicit DialogButton(String text = {})
|
||||||
: Button(move(text))
|
: Button(move(text))
|
||||||
{
|
{
|
||||||
|
|
|
@ -20,11 +20,6 @@ static constexpr int s_box_width = 13;
|
||||||
static constexpr int s_box_height = 13;
|
static constexpr int s_box_height = 13;
|
||||||
static constexpr int s_horizontal_padding = 6;
|
static constexpr int s_horizontal_padding = 6;
|
||||||
|
|
||||||
CheckBox::CheckBox(DeprecatedString deprecated_text)
|
|
||||||
: CheckBox(String::from_deprecated_string(deprecated_text).release_value_but_fixme_should_propagate_errors())
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
CheckBox::CheckBox(String text)
|
CheckBox::CheckBox(String text)
|
||||||
: AbstractButton(move(text))
|
: AbstractButton(move(text))
|
||||||
{
|
{
|
||||||
|
|
|
@ -30,7 +30,6 @@ public:
|
||||||
void set_checkbox_position(CheckBoxPosition value) { m_checkbox_position = value; }
|
void set_checkbox_position(CheckBoxPosition value) { m_checkbox_position = value; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
explicit CheckBox(DeprecatedString);
|
|
||||||
explicit CheckBox(String = {});
|
explicit CheckBox(String = {});
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -16,11 +16,6 @@ REGISTER_WIDGET(GUI, RadioButton)
|
||||||
|
|
||||||
namespace GUI {
|
namespace GUI {
|
||||||
|
|
||||||
RadioButton::RadioButton(DeprecatedString text)
|
|
||||||
: RadioButton(String::from_deprecated_string(text).release_value_but_fixme_should_propagate_errors())
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
RadioButton::RadioButton(String text)
|
RadioButton::RadioButton(String text)
|
||||||
: AbstractButton(move(text))
|
: AbstractButton(move(text))
|
||||||
{
|
{
|
||||||
|
|
|
@ -22,7 +22,6 @@ public:
|
||||||
virtual Optional<UISize> calculated_min_size() const override;
|
virtual Optional<UISize> calculated_min_size() const override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
explicit RadioButton(DeprecatedString text);
|
|
||||||
explicit RadioButton(String text = {});
|
explicit RadioButton(String text = {});
|
||||||
virtual void paint_event(PaintEvent&) override;
|
virtual void paint_event(PaintEvent&) override;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue