summaryrefslogtreecommitdiff
path: root/plugingui/tabwidget.cc
diff options
context:
space:
mode:
Diffstat (limited to 'plugingui/tabwidget.cc')
-rw-r--r--plugingui/tabwidget.cc19
1 files changed, 19 insertions, 0 deletions
diff --git a/plugingui/tabwidget.cc b/plugingui/tabwidget.cc
index 06e7425..dde2137 100644
--- a/plugingui/tabwidget.cc
+++ b/plugingui/tabwidget.cc
@@ -46,6 +46,7 @@ void TabWidget::addTab(const std::string& title, Widget* widget)
button.setText(title);
stack.addWidget(widget);
CONNECT(&button, switchTabNotifier, this, &TabWidget::switchTab);
+ CONNECT(&button, scrollNotifier, this, &TabWidget::rotateTab);
sizeChanged(width(), height());
}
@@ -54,6 +55,24 @@ std::size_t TabWidget::getBarHeight() const
return topbar.height();
}
+void TabWidget::rotateTab(float delta)
+{
+ Widget* widget{nullptr};
+ if(delta > 0.0f)
+ {
+ widget = stack.getWidgetAfter(stack.getCurrentWidget());
+ }
+ else
+ {
+ widget = stack.getWidgetBefore(stack.getCurrentWidget());
+ }
+
+ if(widget)
+ {
+ switchTab(widget);
+ }
+}
+
void TabWidget::switchTab(Widget* tabWidget)
{
stack.setCurrentWidget(tabWidget);