1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 16:37:35 +00:00

Let widget have a font() instead of using Font::defaultFont() everywhere.

This commit is contained in:
Andreas Kling 2018-10-14 13:06:05 +02:00
parent e5acbca0e8
commit fc1facf5c0
8 changed files with 32 additions and 25 deletions

View file

@ -9,6 +9,7 @@
Widget::Widget(Widget* parent)
: Object(parent)
{
setFont(nullptr);
m_backgroundColor = Color::White;
m_foregroundColor = Color::Black;
}
@ -146,3 +147,11 @@ void Widget::setFocus(bool focus)
if (auto* win = window())
win->setFocusedWidget(this);
}
void Widget::setFont(RetainPtr<Font>&& font)
{
if (!font)
m_font = Font::defaultFont();
else
m_font = std::move(font);
}