diff --git a/dgl/SubWidget.hpp b/dgl/SubWidget.hpp index 6e50c99f..d439771b 100644 --- a/dgl/SubWidget.hpp +++ b/dgl/SubWidget.hpp @@ -126,6 +126,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. */ @@ -141,7 +146,6 @@ private: struct PrivateData; PrivateData* const pData; friend class Widget; - template friend class NanoBaseWidget; DISTRHO_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(SubWidget) }; diff --git a/dgl/src/NanoVG.cpp b/dgl/src/NanoVG.cpp index 8f9589a7..13d6d5fa 100644 --- a/dgl/src/NanoVG.cpp +++ b/dgl/src/NanoVG.cpp @@ -945,7 +945,7 @@ NanoBaseWidget::NanoBaseWidget(Widget* const parent, int flags) : SubWidget(parent), NanoVG(flags) { - pData->needsViewportScaling = true; + setNeedsViewportScaling(); } template class NanoBaseWidget; diff --git a/dgl/src/SubWidget.cpp b/dgl/src/SubWidget.cpp index 87de0827..066d5ab3 100644 --- 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;