commit 471a00f4f60e6b977311827f3ffebf139f76e22a
parent faec332e359886027592a2b301f86dbebe2eaefc
Author: falkTX <falktx@falktx.com>
Date: Sun, 30 May 2021 00:44:59 +0100
Expose SubWidget::setNeedsViewportScaling and use it in NanoWidget
Signed-off-by: falkTX <falktx@falktx.com>
Diffstat:
3 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/dgl/SubWidget.hpp b/dgl/SubWidget.hpp
@@ -127,6 +127,11 @@ public:
void setNeedsFullViewportDrawing(bool needsFullViewportForDrawing = true);
/**
+ Indicate that this subwidget will always draw at its own internal size and needs scaling to fit target size.
+ */
+ void setNeedsViewportScaling(bool needsViewportScaling = true);
+
+ /**
Indicate that this subwidget should not be drawn on screen, typically because it is managed by something else.
*/
void setSkipDrawing(bool skipDrawing = true);
@@ -141,7 +146,6 @@ private:
struct PrivateData;
PrivateData* const pData;
friend class Widget;
- template <class BaseWidget> friend class NanoBaseWidget;
DISTRHO_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(SubWidget)
};
diff --git a/dgl/src/NanoVG.cpp b/dgl/src/NanoVG.cpp
@@ -945,7 +945,7 @@ NanoBaseWidget<SubWidget>::NanoBaseWidget(Widget* const parent, int flags)
: SubWidget(parent),
NanoVG(flags)
{
- pData->needsViewportScaling = true;
+ setNeedsViewportScaling();
}
template class NanoBaseWidget<SubWidget>;
diff --git a/dgl/src/SubWidget.cpp b/dgl/src/SubWidget.cpp
@@ -123,6 +123,11 @@ void SubWidget::setNeedsFullViewportDrawing(const bool needsFullViewportForDrawi
pData->needsFullViewportForDrawing = needsFullViewportForDrawing;
}
+void SubWidget::setNeedsViewportScaling(const bool needsViewportScaling)
+{
+ pData->needsViewportScaling = needsViewportScaling;
+}
+
void SubWidget::setSkipDrawing(const bool skipDrawing)
{
pData->skipDrawing = skipDrawing;