1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 13:17: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:
Andreas Kling 2019-09-01 12:26:35 +02:00
parent e7d15ccca4
commit 3e2e086011
4 changed files with 22 additions and 6 deletions

View file

@ -176,8 +176,8 @@ public:
bool fill_with_background_color() const { return m_fill_with_background_color; }
const Font& font() const { return *m_font; }
void set_font(Font*);
void set_font(Font& font) { set_font(&font); }
void set_font(const Font*);
void set_font(const Font& font) { set_font(&font); }
void set_global_cursor_tracking(bool);
bool global_cursor_tracking() const;
@ -219,6 +219,8 @@ public:
virtual void save_to(AK::JsonObject&) override;
virtual void did_change_font() {}
private:
void handle_paint_event(GPaintEvent&);
void handle_resize_event(GResizeEvent&);
@ -237,7 +239,7 @@ private:
Rect m_relative_rect;
Color m_background_color;
Color m_foreground_color;
RefPtr<Font> m_font;
NonnullRefPtr<Font> m_font;
String m_tooltip;
SizePolicy m_horizontal_size_policy { SizePolicy::Fill };