Browse Source

Tests for popup windows

Signed-off-by: falkTX <falktx@falktx.com>
popup-tests
falkTX 1 month ago
parent
commit
3ef59a7250
Signed by: falkTX <falktx@falktx.com> GPG Key ID: CDBAA37ABC74FBA0
3 changed files with 29 additions and 0 deletions
  1. +8
    -0
      dgl/Window.hpp
  2. +14
    -0
      dgl/src/Window.cpp
  3. +7
    -0
      examples/FileHandling/FileHandlingUI.cpp

+ 8
- 0
dgl/Window.hpp View File

@@ -158,6 +158,11 @@ public:
*/
virtual ~Window();

/**
TEST.
*/
Window* createPopup();

/**
Whether this Window is embed into another (usually not DGL-controlled) Window.
*/
@@ -574,6 +579,9 @@ private:
bool usesSizeRequest,
bool doPostInit);

/** @internal */
explicit Window(Application& app, Window& transientParentWindow, uint type);

DISTRHO_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(Window)
};



+ 14
- 0
dgl/src/Window.cpp View File

@@ -111,6 +111,15 @@ Window::Window(Application& app,
pData->initPost();
}

Window::Window(Application& app, Window& transientParentWindow, const uint type)
: pData(new PrivateData(app, this, transientParentWindow.pData))
{
if (pData->view != nullptr)
puglSetViewHint(pData->view, PUGL_VIEW_TYPE, type);

pData->initPost();
}

Window::Window(Application& app,
const uintptr_t parentWindowHandle,
const uint width,
@@ -132,6 +141,11 @@ Window::~Window()
delete pData;
}

Window* Window::createPopup()
{
return new Window(pData->app, *this, PUGL_VIEW_TYPE_UTILITY);
}

bool Window::isEmbed() const noexcept
{
return pData->isEmbed;


+ 7
- 0
examples/FileHandling/FileHandlingUI.cpp View File

@@ -49,6 +49,8 @@ public:
static const uint kInitialWidth = 600;
static const uint kInitialHeight = 350;

ScopedPointer<Window> win;

FileHandlingExampleUI()
: UI(kInitialWidth, kInitialHeight),
fButton1(this, this),
@@ -70,6 +72,11 @@ public:
#endif

setGeometryConstraints(kInitialWidth, kInitialHeight, false);

win = getWindow().createPopup();
win->setTitle("test1");
win->setSize(300, 300);
win->runAsModal();
}

protected:


Loading…
Cancel
Save