summaryrefslogtreecommitdiff
path: root/plugingui/stackedwidget.cc
diff options
context:
space:
mode:
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: