Browse Source

Continue split implementation

pull/272/head
falkTX 4 years ago
parent
commit
291c88576a
4 changed files with 33 additions and 0 deletions
  1. +9
    -0
      dgl/SubWidget.hpp
  2. +8
    -0
      dgl/TopLevelWidget.hpp
  3. +8
    -0
      dgl/src/SubWidget.cpp
  4. +8
    -0
      dgl/src/TopLevelWidget.cpp

+ 9
- 0
dgl/SubWidget.hpp View File

@@ -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:


+ 8
- 0
dgl/TopLevelWidget.hpp View File

@@ -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;


+ 8
- 0
dgl/src/SubWidget.cpp View File

@@ -16,6 +16,14 @@

#include "SubWidgetPrivateData.hpp"

SubWidget::SubWidget(Widget* const widgetToGroupTo)
: pData(new PrivateData(this, widgetToGroupTo)) {}

SubWidget::~SubWidget()
{
delete pData;
}

template<typename T>
bool SubWidget::contains(T x, T y) const noexcept
{


+ 8
- 0
dgl/src/TopLevelWidget.cpp View File

@@ -15,3 +15,11 @@
*/

#include "TopLevelWidgetPrivateData.hpp"

TopLevelWidget::TopLevelWidget(Window& windowToMapTo)
: pData(new PrivateData(this, windowToMapTo)) {}

TopLevelWidget::~TopLevelWidget()
{
delete pData;
}

Loading…
Cancel
Save