From aa5925952ce757f2e81a50db062d37eb39552340 Mon Sep 17 00:00:00 2001 From: falkTX Date: Tue, 21 Apr 2015 11:12:14 +0200 Subject: [PATCH] Allow to specify widget UI size during construction --- distrho/DistrhoUI.hpp | 2 +- distrho/src/DistrhoUI.cpp | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/distrho/DistrhoUI.hpp b/distrho/DistrhoUI.hpp index 2832db0b..ef75f6c0 100644 --- a/distrho/DistrhoUI.hpp +++ b/distrho/DistrhoUI.hpp @@ -47,7 +47,7 @@ public: UI class constructor. The UI should be initialized to a default state that matches the plugin side. */ - UI(); + UI(uint width = 0, uint height = 0); /** Destructor. diff --git a/distrho/src/DistrhoUI.cpp b/distrho/src/DistrhoUI.cpp index 49e8c3e6..4e977300 100644 --- a/distrho/src/DistrhoUI.cpp +++ b/distrho/src/DistrhoUI.cpp @@ -28,11 +28,14 @@ Window* d_lastUiWindow = nullptr; /* ------------------------------------------------------------------------------------------------------------ * UI */ -UI::UI() +UI::UI(uint width, uint height) : UIWidget(*d_lastUiWindow), pData(new PrivateData()) { UIWidget::setNeedsFullViewport(true); + + if (width > 0 && height > 0) + setSize(width, height); } UI::~UI()