summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibGUI/Widget.h
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2021-10-23 17:53:11 +0200
committerAndreas Kling <kling@serenityos.org>2021-10-23 17:53:11 +0200
commit24651f854c5e0bcc2ce13ed5b61f7c6e795f2160 (patch)
treef52f0f1a18933b1fc86292c8cbf37086d213568e /Userland/Libraries/LibGUI/Widget.h
parentda86f4e38414499357bce41b389adfd28a6e8fa6 (diff)
downloadserenity-24651f854c5e0bcc2ce13ed5b61f7c6e795f2160.zip
LibGUI: Add Widget::repaint() to force an immediate repaint
In most situations, Widget::update() is preferable, since that allows us to coalesce repaints and avoid redundant work, reducing system load. However, there are some cases where you really want a paint to happen right away, to make sure that the user has a chance to see a short-lived visual state.
Diffstat (limited to 'Userland/Libraries/LibGUI/Widget.h')
-rw-r--r--Userland/Libraries/LibGUI/Widget.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/Userland/Libraries/LibGUI/Widget.h b/Userland/Libraries/LibGUI/Widget.h
index d8de4d6ff5..29ae0f0079 100644
--- a/Userland/Libraries/LibGUI/Widget.h
+++ b/Userland/Libraries/LibGUI/Widget.h
@@ -136,9 +136,14 @@ public:
Gfx::IntRect rect() const { return { 0, 0, width(), height() }; }
Gfx::IntSize size() const { return m_relative_rect.size(); }
+ // Invalidate the widget (or an area thereof), causing a repaint to happen soon.
void update();
void update(const Gfx::IntRect&);
+ // Repaint the widget (or an area thereof) immediately.
+ void repaint();
+ void repaint(Gfx::IntRect const&);
+
bool is_focused() const;
void set_focus(bool, FocusSource = FocusSource::Programmatic);