1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 21:17:44 +00:00

More rage hacking on Widgets. Some very basic text drawing. :^)

This commit is contained in:
Andreas Kling 2018-10-10 20:06:58 +02:00
parent 6f37429f57
commit 77bac7216c
7 changed files with 341 additions and 28 deletions

View file

@ -5,17 +5,25 @@
Label::Label(Widget* parent)
: Widget(parent)
{
setRect(Rect(100, 100, 100, 100));
}
Label::~Label()
{
}
void Label::setText(String&& text)
{
if (text == m_text)
return;
m_text = std::move(text);
update();
}
void Label::onPaint(PaintEvent&)
{
Painter painter(*this);
painter.fillRect({ 0, 0, width(), height() }, Color(0xc0, 0xc0, 0xc0));
painter.drawText({ 4, 4 }, text());
}
void Label::onMouseMove(MouseEvent& event)