diff options
author | Andreas Kling <awesomekling@gmail.com> | 2019-05-25 13:40:57 +0200 |
---|---|---|
committer | Andreas Kling <awesomekling@gmail.com> | 2019-05-25 13:40:57 +0200 |
commit | d12857fc36879cddfaf2d0c7f607454ab7a96958 (patch) | |
tree | 0ef12fd702005855ba32868cec0e73b38e67b8d9 /LibGUI/GScrollBar.cpp | |
parent | e478a2fb0ab8b1b392e4dd0bfaa7eafb7d12c6a4 (diff) | |
download | serenity-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.cpp | 9 |
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); +} |