mirror of
https://github.com/RGBCube/serenity
synced 2025-07-10 06:57:35 +00:00
LibGUI: Add a way for GWidget subclasses to learn that the font changed
Use this in GTextEditor to update the vertical scrolling step size so we always scroll one-line-at-a-time.
This commit is contained in:
parent
e7d15ccca4
commit
3e2e086011
4 changed files with 22 additions and 6 deletions
|
@ -14,8 +14,8 @@
|
|||
|
||||
GWidget::GWidget(GWidget* parent)
|
||||
: CObject(parent, true)
|
||||
, m_font(Font::default_font())
|
||||
{
|
||||
set_font(nullptr);
|
||||
m_background_color = Color::WarmGray;
|
||||
m_foreground_color = Color::Black;
|
||||
}
|
||||
|
@ -372,12 +372,17 @@ void GWidget::set_focus(bool focus)
|
|||
}
|
||||
}
|
||||
|
||||
void GWidget::set_font(Font* font)
|
||||
void GWidget::set_font(const Font* font)
|
||||
{
|
||||
if (m_font.ptr() == font)
|
||||
return;
|
||||
|
||||
if (!font)
|
||||
m_font = Font::default_font();
|
||||
else
|
||||
m_font = font;
|
||||
m_font = *font;
|
||||
|
||||
did_change_font();
|
||||
update();
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue