summaryrefslogtreecommitdiff
path: root/plugingui/stackedwidget.cc
diff options
context:
space:
mode:
authorBent Bisballe Nyeng <deva@aasimon.org>2017-04-30 10:30:47 +0200
committerBent Bisballe Nyeng <deva@aasimon.org>2017-04-30 10:30:47 +0200
commit8fe6d2ec950ed1ebdedd776bab125dff90e5a20f (patch)
tree08a27b00831425367c1831269008feac14b97028 /plugingui/stackedwidget.cc
parentd1e803d4be4cadc3e1204cbd096ae3bbe57c7a95 (diff)
Add support for rotating the tabs using the scroll-wheel.
Diffstat (limited to 'plugingui/stackedwidget.cc')
-rw-r--r--plugingui/stackedwidget.cc45
1 files changed, 45 insertions, 0 deletions
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: