mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 21:08:12 +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:
parent
d32b052f22
commit
fca29eae09
8 changed files with 42 additions and 12 deletions
|
@ -7,6 +7,7 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <AK/String.h>
|
||||
#include <LibGUI/Widget.h>
|
||||
#include <LibGfx/TextWrapping.h>
|
||||
|
||||
|
@ -21,7 +22,9 @@ public:
|
|||
Function<void(bool)> on_checked;
|
||||
|
||||
virtual void set_text_deprecated(DeprecatedString);
|
||||
DeprecatedString const& text_deprecated() const { return m_text; }
|
||||
DeprecatedString text_deprecated() const { return m_text.to_deprecated_string(); }
|
||||
virtual void set_text(String);
|
||||
String const& text() const { return m_text; }
|
||||
|
||||
bool is_exclusive() const { return m_exclusive; }
|
||||
void set_exclusive(bool b) { m_exclusive = b; }
|
||||
|
@ -47,7 +50,7 @@ public:
|
|||
void set_auto_repeat_interval(int interval) { m_auto_repeat_interval = interval; }
|
||||
|
||||
protected:
|
||||
explicit AbstractButton(DeprecatedString = {});
|
||||
explicit AbstractButton(String = {});
|
||||
|
||||
virtual void mousedown_event(MouseEvent&) override;
|
||||
virtual void mousemove_event(MouseEvent&) override;
|
||||
|
@ -62,7 +65,7 @@ protected:
|
|||
void paint_text(Painter&, Gfx::IntRect const&, Gfx::Font const&, Gfx::TextAlignment, Gfx::TextWrapping = Gfx::TextWrapping::DontWrap);
|
||||
|
||||
private:
|
||||
DeprecatedString m_text;
|
||||
String m_text;
|
||||
bool m_checked { false };
|
||||
bool m_checkable { false };
|
||||
bool m_hovered { false };
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue