diff --git a/dgl/SubWidget.hpp b/dgl/SubWidget.hpp index 81c8ad59..45778703 100644 --- a/dgl/SubWidget.hpp +++ b/dgl/SubWidget.hpp @@ -23,6 +23,15 @@ START_NAMESPACE_DGL // ----------------------------------------------------------------------- +/** + Sub-Widget class. + + This is a handy Widget class that can be freely positioned to be used directly on a Window. + + This widget takes the full size of the Window it is mapped to. + Sub-widgets can be added on top of this top-level widget, by creating them with this class as parent. + Doing so allows for custom position and sizes. + */ class SubWidget : public Widget { public: diff --git a/dgl/TopLevelWidget.hpp b/dgl/TopLevelWidget.hpp index 5b3fdb5f..056cbac8 100644 --- a/dgl/TopLevelWidget.hpp +++ b/dgl/TopLevelWidget.hpp @@ -35,8 +35,16 @@ START_NAMESPACE_DGL class TopLevelWidget : public Widget { public: + /** + Constructor. + */ explicit TopLevelWidget(Window& windowToMapTo); + /** + Destructor. + */ + virtual ~TopLevelWidget(); + private: struct PrivateData; PrivateData* const pData; diff --git a/dgl/src/SubWidget.cpp b/dgl/src/SubWidget.cpp index b987c518..f7934d75 100644 --- a/dgl/src/SubWidget.cpp +++ b/dgl/src/SubWidget.cpp @@ -16,6 +16,14 @@ #include "SubWidgetPrivateData.hpp" +SubWidget::SubWidget(Widget* const widgetToGroupTo) + : pData(new PrivateData(this, widgetToGroupTo)) {} + +SubWidget::~SubWidget() +{ + delete pData; +} + template bool SubWidget::contains(T x, T y) const noexcept { diff --git a/dgl/src/TopLevelWidget.cpp b/dgl/src/TopLevelWidget.cpp index 782bd6af..903ccdca 100644 --- a/dgl/src/TopLevelWidget.cpp +++ b/dgl/src/TopLevelWidget.cpp @@ -15,3 +15,11 @@ */ #include "TopLevelWidgetPrivateData.hpp" + +TopLevelWidget::TopLevelWidget(Window& windowToMapTo) + : pData(new PrivateData(this, windowToMapTo)) {} + +TopLevelWidget::~TopLevelWidget() +{ + delete pData; +}