1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 05:47:34 +00:00

LibGUI: Let ScrollableWidget handle the wheel events of its ScrollBars

Route the ScrollBar's wheel event to the ScrollableWidget so it can
handle it itself. This allows it to handle it consistently (e.g.
speed) when the cursor is hovering the scroll bars rather than the
widget's contents.

Fixes #5419
This commit is contained in:
Tom 2021-02-20 16:19:52 -07:00 committed by Andreas Kling
parent cb2db3710b
commit a0cbb9068b
3 changed files with 37 additions and 9 deletions

View file

@ -31,7 +31,7 @@
namespace GUI {
class ScrollBar final : public AbstractSlider {
class ScrollBar : public AbstractSlider {
C_OBJECT(ScrollBar);
public:
@ -49,7 +49,7 @@ public:
Scrubber,
};
private:
protected:
explicit ScrollBar(Gfx::Orientation = Gfx::Orientation::Vertical);
virtual void paint_event(PaintEvent&) override;
@ -60,6 +60,7 @@ private:
virtual void leave_event(Core::Event&) override;
virtual void change_event(Event&) override;
private:
int default_button_size() const { return 16; }
int button_size() const { return length(orientation()) <= (default_button_size() * 2) ? length(orientation()) / 2 : default_button_size(); }
int button_width() const { return orientation() == Orientation::Vertical ? width() : button_size(); }