From 8fe6d2ec950ed1ebdedd776bab125dff90e5a20f Mon Sep 17 00:00:00 2001 From: Bent Bisballe Nyeng Date: Sun, 30 Apr 2017 10:30:47 +0200 Subject: Add support for rotating the tabs using the scroll-wheel. --- plugingui/stackedwidget.cc | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) (limited to 'plugingui/stackedwidget.cc') diff --git a/plugingui/stackedwidget.cc b/plugingui/stackedwidget.cc index 069e80b..05f8f3c 100644 --- a/plugingui/stackedwidget.cc +++ b/plugingui/stackedwidget.cc @@ -93,6 +93,51 @@ void StackedWidget::setCurrentWidget(Widget *widget) currentChanged(currentWidget); } +Widget* StackedWidget::getWidgetAfter(Widget* widget) +{ + bool found_it{false}; + + for(auto w : widgets) + { + if(found_it) + { + return w; + } + + if(w == widget) + { + found_it = true; + } + } + + if(found_it) + { + // widget was the last in the list. + return nullptr; + } + + // The Widget pointed to by 'widget' was not in the list... + return nullptr; +} + +Widget* StackedWidget::getWidgetBefore(Widget* widget) +{ + Widget* last{nullptr}; + + for(auto w : widgets) + { + if(w == widget) + { + return last; + } + + last = w; + } + + // The Widget pointed to by 'widget' was not in the list... + return nullptr; +} + void StackedWidget::sizeChanged(int width, int height) { // Propagate size change to child: -- cgit v1.2.3