commit d6c2658a5c1c25494ab931dd923a5fc8d743baee
parent c2a3737d8bccf5d2787298267e273c5810156ce2
Author: falkTX <falktx@falktx.com>
Date: Fri, 28 May 2021 22:27:38 +0100
Move TopLevelWidget::isResizable to UI, where it makes more sense
Signed-off-by: falkTX <falktx@falktx.com>
Diffstat:
4 files changed, 18 insertions(+), 15 deletions(-)
diff --git a/dgl/TopLevelWidget.hpp b/dgl/TopLevelWidget.hpp
@@ -67,16 +67,6 @@ public:
Window& getWindow() const noexcept;
/**
- Check if this top-level widget's window is resizable (by the user or window manager).
- For situations where this top-level widget is an embed plugin UI and the plugin host does not support resizing,
- this function can return false where it normally returns true.
-
- You might want to add a resize handle for such cases, so the user is still allowed to resize the window.
- (programatically resizing a window is always possible, but the same is not true for the window manager)
- */
- bool isResizable() const noexcept;
-
- /**
Set width of this widget's window.
@note This will not change the widget's size right away, but be pending on OS resizing the window
*/
diff --git a/dgl/src/TopLevelWidget.cpp b/dgl/src/TopLevelWidget.cpp
@@ -40,11 +40,6 @@ Window& TopLevelWidget::getWindow() const noexcept
return pData->window;
}
-bool TopLevelWidget::isResizable() const noexcept
-{
- return pData->window.isResizable();
-}
-
void TopLevelWidget::setWidth(const uint width)
{
pData->window.setWidth(width);
diff --git a/distrho/DistrhoUI.hpp b/distrho/DistrhoUI.hpp
@@ -82,6 +82,15 @@ public:
* Host state */
/**
+ Check if this UI window is resizable (by the user or window manager).
+ There are situations where an UI supports resizing but the plugin host does not, so this could return false.
+
+ You might want to add a resize handle for such cases, so the user is still allowed to resize the window.
+ (programatically resizing a window is always possible, but the same is not true for the window manager)
+ */
+ bool isResizable() const noexcept;
+
+ /**
Get the color used for UI background (i.e. window color) in RGBA format.
Returns 0 by default, in case of error or lack of host support.
diff --git a/distrho/src/DistrhoUI.cpp b/distrho/src/DistrhoUI.cpp
@@ -57,6 +57,15 @@ UI::~UI()
/* ------------------------------------------------------------------------------------------------------------
* Host state */
+bool UI::isResizable() const noexcept
+{
+#if DISTRHO_UI_USER_RESIZABLE
+ return uiData->window->isResizable();
+#else
+ return false;
+#endif
+}
+
uint UI::getBackgroundColor() const noexcept
{
return uiData->bgColor;