diff --git a/dgl/SubWidget.hpp b/dgl/SubWidget.hpp index eefb4c5a..28119842 100644 --- a/dgl/SubWidget.hpp +++ b/dgl/SubWidget.hpp @@ -137,6 +137,12 @@ public: */ void repaint() noexcept override; + /** + Pushes this widget to the "bottom" of the parent widget. + Makes the widget behave as if it was the first to be registered on the parent widget, thus being "on bottom". + */ + virtual void toBottom(); + /** Bring this widget to the "front" of the parent widget. Makes the widget behave as if it was the last to be registered on the parent widget, thus being "in front". diff --git a/dgl/src/SubWidget.cpp b/dgl/src/SubWidget.cpp index d0f38917..75ca4dad 100644 --- a/dgl/src/SubWidget.cpp +++ b/dgl/src/SubWidget.cpp @@ -145,6 +145,14 @@ void SubWidget::repaint() noexcept } } +void SubWidget::toBottom() +{ + std::list& subwidgets(pData->parentWidget->pData->subWidgets); + + subwidgets.remove(this); + subwidgets.insert(subwidgets.begin(), this); +} + void SubWidget::toFront() { std::list& subwidgets(pData->parentWidget->pData->subWidgets);