diff options
author | Bent Bisballe Nyeng <deva@aasimon.org> | 2022-01-08 12:43:07 +0100 |
---|---|---|
committer | Bent Bisballe Nyeng <deva@aasimon.org> | 2022-01-22 23:15:29 +0100 |
commit | 414606b64aa6c6cf3209861b81a92a6af873937f (patch) | |
tree | 408992e785dde59748aa2f94bd8666f190575567 /dggui/scrollbar.cc | |
parent | 235ad6fbbce2e0ae9e06db960a5ba3b099936ace (diff) |
Make UI events const refs and celan up redundant use of virtual with override.event_cleanup
Diffstat (limited to 'dggui/scrollbar.cc')
-rw-r--r-- | dggui/scrollbar.cc | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/dggui/scrollbar.cc b/dggui/scrollbar.cc index e78aab3..00ed727 100644 --- a/dggui/scrollbar.cc +++ b/dggui/scrollbar.cc @@ -117,7 +117,7 @@ static void drawArrow(Painter &p, int x, int y, int w, int h) p.drawLine(x + (w / 2), y + h, x + w, y); } -void ScrollBar::repaintEvent(RepaintEvent* repaintEvent) +void ScrollBar::repaintEvent(const RepaintEvent& repaintEvent) { Painter p(*this); @@ -150,19 +150,19 @@ void ScrollBar::repaintEvent(RepaintEvent* repaintEvent) p.drawLine(0, height() - width(), width(), height() - width()); } -void ScrollBar::scrollEvent(ScrollEvent* scrollEvent) +void ScrollBar::scrollEvent(const ScrollEvent& scrollEvent) { - setValue(value() + scrollEvent->delta); + setValue(value() + scrollEvent.delta); } -void ScrollBar::mouseMoveEvent(MouseMoveEvent* mouseMoveEvent) +void ScrollBar::mouseMoveEvent(const MouseMoveEvent& mouseMoveEvent) { if(!dragging) { return; } - float delta = yOffset - mouseMoveEvent->y; + float delta = yOffset - mouseMoveEvent.y; int h = height() - 2 * width() - 3; delta /= (float)h / (float)maxValue; @@ -174,17 +174,17 @@ void ScrollBar::mouseMoveEvent(MouseMoveEvent* mouseMoveEvent) } } -void ScrollBar::buttonEvent(ButtonEvent* buttonEvent) +void ScrollBar::buttonEvent(const ButtonEvent& buttonEvent) { // Ignore everything except left clicks. - if(buttonEvent->button != MouseButton::left) + if(buttonEvent.button != MouseButton::left) { return; } - if((buttonEvent->y < (int)width()) && buttonEvent->y > 0) + if((buttonEvent.y < (int)width()) && buttonEvent.y > 0) { - if(buttonEvent->direction == Direction::down) + if(buttonEvent.direction == Direction::down) { addValue(-1); } @@ -192,10 +192,10 @@ void ScrollBar::buttonEvent(ButtonEvent* buttonEvent) return; } - if((buttonEvent->y > ((int)height() - (int)width())) && - (buttonEvent->y < (int)height())) + if((buttonEvent.y > ((int)height() - (int)width())) && + (buttonEvent.y < (int)height())) { - if(buttonEvent->direction == Direction::down) + if(buttonEvent.direction == Direction::down) { addValue(1); } @@ -203,13 +203,13 @@ void ScrollBar::buttonEvent(ButtonEvent* buttonEvent) return; } - if(buttonEvent->direction == Direction::down) + if(buttonEvent.direction == Direction::down) { - yOffset = buttonEvent->y; + yOffset = buttonEvent.y; valueOffset = value(); } - dragging = (buttonEvent->direction == Direction::down); + dragging = (buttonEvent.direction == Direction::down); } } // dggui:: |