diff --git a/dgl/Window.hpp b/dgl/Window.hpp index 64d0f561..39995d87 100644 --- a/dgl/Window.hpp +++ b/dgl/Window.hpp @@ -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) }; diff --git a/dgl/src/Window.cpp b/dgl/src/Window.cpp index 57ae2570..0db40e8e 100644 --- a/dgl/src/Window.cpp +++ b/dgl/src/Window.cpp @@ -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; diff --git a/examples/FileHandling/FileHandlingUI.cpp b/examples/FileHandling/FileHandlingUI.cpp index 9babc9c1..4bee37c2 100644 --- a/examples/FileHandling/FileHandlingUI.cpp +++ b/examples/FileHandling/FileHandlingUI.cpp @@ -49,6 +49,8 @@ public: static const uint kInitialWidth = 600; static const uint kInitialHeight = 350; + ScopedPointer 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: