mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 11:18:11 +00:00
Rename all the LibGUI classes to GClassName.
This commit is contained in:
parent
a026da47e7
commit
b91479d9b9
33 changed files with 623 additions and 581 deletions
35
LibGUI/GLabel.cpp
Normal file
35
LibGUI/GLabel.cpp
Normal file
|
@ -0,0 +1,35 @@
|
|||
#include "GLabel.h"
|
||||
#include <SharedGraphics/Painter.h>
|
||||
|
||||
GLabel::GLabel(GWidget* parent)
|
||||
: GWidget(parent)
|
||||
{
|
||||
}
|
||||
|
||||
GLabel::~GLabel()
|
||||
{
|
||||
}
|
||||
|
||||
void GLabel::setText(String&& text)
|
||||
{
|
||||
if (text == m_text)
|
||||
return;
|
||||
m_text = move(text);
|
||||
update();
|
||||
}
|
||||
|
||||
void GLabel::paintEvent(GPaintEvent&)
|
||||
{
|
||||
Painter painter(*this);
|
||||
if (fillWithBackgroundColor())
|
||||
painter.fill_rect({ 0, 0, width(), height() }, backgroundColor());
|
||||
if (!text().is_empty())
|
||||
painter.draw_text({ 4, 4, width(), height() }, text(), Painter::TextAlignment::TopLeft, foregroundColor());
|
||||
}
|
||||
|
||||
void GLabel::mouseMoveEvent(GMouseEvent& event)
|
||||
{
|
||||
dbgprintf("GLabel::mouseMoveEvent: x=%d, y=%d\n", event.x(), event.y());
|
||||
GWidget::mouseMoveEvent(event);
|
||||
}
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue