summaryrefslogtreecommitdiff
path: root/LibGUI/GScrollBar.cpp
diff options
context:
space:
mode:
authorAndreas Kling <awesomekling@gmail.com>2019-05-25 13:40:57 +0200
committerAndreas Kling <awesomekling@gmail.com>2019-05-25 13:40:57 +0200
commitd12857fc36879cddfaf2d0c7f607454ab7a96958 (patch)
tree0ef12fd702005855ba32868cec0e73b38e67b8d9 /LibGUI/GScrollBar.cpp
parente478a2fb0ab8b1b392e4dd0bfaa7eafb7d12c6a4 (diff)
downloadserenity-d12857fc36879cddfaf2d0c7f607454ab7a96958.zip
LibGUI: Notify widgets when their enabled state changes.
This is done by dispatching a (synchronous) "EnabledChange" event that can be picked up in change_event(). Use this event to kick widgets out of their "being pressed"-type modes if the user is interacting with them while the state is programmatically changed.
Diffstat (limited to 'LibGUI/GScrollBar.cpp')
-rw-r--r--LibGUI/GScrollBar.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/LibGUI/GScrollBar.cpp b/LibGUI/GScrollBar.cpp
index acad0ecdb9..bc932dd242 100644
--- a/LibGUI/GScrollBar.cpp
+++ b/LibGUI/GScrollBar.cpp
@@ -300,3 +300,12 @@ void GScrollBar::leave_event(CEvent&)
update();
}
}
+
+void GScrollBar::change_event(GEvent& event)
+{
+ if (event.type() == GEvent::Type::EnabledChange) {
+ if (!is_enabled())
+ m_scrubbing = false;
+ }
+ return GWidget::change_event(event);
+}