1
Fork 0
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:
Andreas Kling 2019-01-20 04:49:48 +01:00
parent a026da47e7
commit b91479d9b9
33 changed files with 623 additions and 581 deletions

35
LibGUI/GLabel.cpp Normal file
View 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);
}