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:
parent
6f37429f57
commit
77bac7216c
7 changed files with 341 additions and 28 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue