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

LibGUI: Tweak GUI::Label API a bit and add did_change_text() virtual

This commit is contained in:
Andreas Kling 2020-12-26 13:10:50 +01:00
parent 9fe310c470
commit 4e084793df
2 changed files with 10 additions and 7 deletions

View file

@ -32,8 +32,8 @@
namespace GUI {
Label::Label(const StringView& text)
: m_text(text)
Label::Label(String text)
: m_text(move(text))
{
set_frame_thickness(0);
set_frame_shadow(Gfx::FrameShadow::Plain);
@ -66,14 +66,15 @@ void Label::set_icon(const Gfx::Bitmap* icon)
update();
}
void Label::set_text(const StringView& text)
void Label::set_text(String text)
{
if (text == m_text)
return;
m_text = text;
m_text = move(text);
if (m_autosize)
size_to_fit();
update();
did_change_text();
}
void Label::paint_event(PaintEvent& event)