mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-25 09:00:22 +00:00
GScrollBar: Allow scrolling the scrollbar by mouse-wheeling over it
This commit is contained in:
parent
076827a05d
commit
dc3c6be6f2
Notes:
sideshowbarker
2024-07-19 12:35:20 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/dc3c6be6f22
2 changed files with 11 additions and 0 deletions
|
@ -281,6 +281,14 @@ void GScrollBar::mouseup_event(GMouseEvent& event)
|
|||
update();
|
||||
}
|
||||
|
||||
void GScrollBar::mousewheel_event(GMouseEvent& event)
|
||||
{
|
||||
if (!is_scrollable())
|
||||
return;
|
||||
set_value(value() + event.wheel_delta());
|
||||
GWidget::mousewheel_event(event);
|
||||
}
|
||||
|
||||
void GScrollBar::set_automatic_scrolling_active(bool active)
|
||||
{
|
||||
if (active) {
|
||||
|
|
|
@ -12,6 +12,8 @@ public:
|
|||
|
||||
Orientation orientation() const { return m_orientation; }
|
||||
|
||||
bool is_scrollable() const { return max() != min(); }
|
||||
|
||||
int value() const { return m_value; }
|
||||
int min() const { return m_min; }
|
||||
int max() const { return m_max; }
|
||||
|
@ -41,6 +43,7 @@ private:
|
|||
virtual void mousedown_event(GMouseEvent&) override;
|
||||
virtual void mouseup_event(GMouseEvent&) override;
|
||||
virtual void mousemove_event(GMouseEvent&) override;
|
||||
virtual void mousewheel_event(GMouseEvent&) override;
|
||||
virtual void leave_event(CEvent&) override;
|
||||
virtual void change_event(GEvent&) override;
|
||||
|
||||
|
|
Loading…
Reference in a new issue