mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-01-23 17:52:26 -05:00
f6d2c3ed87
Okay things kinda sorta work. Both Bochs and QEMU now boot into GUI mode. There's a ton of stuff that doesn't make sense and so many things to rework. Still it's quite cool to have made it this far. :^)
34 lines
677 B
C++
34 lines
677 B
C++
#include "Label.h"
|
|
#include "Painter.h"
|
|
|
|
Label::Label(Widget* parent)
|
|
: Widget(parent)
|
|
{
|
|
}
|
|
|
|
Label::~Label()
|
|
{
|
|
}
|
|
|
|
void Label::setText(String&& text)
|
|
{
|
|
if (text == m_text)
|
|
return;
|
|
m_text = move(text);
|
|
update();
|
|
}
|
|
|
|
void Label::paintEvent(PaintEvent&)
|
|
{
|
|
Painter painter(*this);
|
|
painter.fillRect({ 0, 0, width(), height() }, backgroundColor());
|
|
if (!text().is_empty())
|
|
painter.drawText({ 4, 4, width(), height() }, text(), Painter::TextAlignment::TopLeft, foregroundColor());
|
|
}
|
|
|
|
void Label::mouseMoveEvent(MouseEvent& event)
|
|
{
|
|
printf("Label::mouseMoveEvent: x=%d, y=%d\n", event.x(), event.y());
|
|
Widget::mouseMoveEvent(event);
|
|
}
|
|
|