From 29042aeca52a8cbe5ace2485084820c59f2ed1c7 Mon Sep 17 00:00:00 2001 From: falkTX Date: Mon, 16 Feb 2015 16:08:18 +0000 Subject: [PATCH] Allow to receive fileBrowserSelected in plugin UIs --- distrho/DistrhoUI.hpp | 6 ++++++ distrho/src/DistrhoUI.cpp | 4 ++++ distrho/src/DistrhoUIInternal.hpp | 11 +++++++++-- 3 files changed, 19 insertions(+), 2 deletions(-) diff --git a/distrho/DistrhoUI.hpp b/distrho/DistrhoUI.hpp index e6c83110..2832db0b 100644 --- a/distrho/DistrhoUI.hpp +++ b/distrho/DistrhoUI.hpp @@ -140,6 +140,12 @@ protected: */ virtual void d_uiIdle() {} + /** + File browser selected function. + @see Window::fileBrowserSelected(const char*) + */ + virtual void d_uiFileBrowserSelected(const char* filename); + /** OpenGL window reshape function, called when parent window is resized. You can reimplement this function for a custom OpenGL state. diff --git a/distrho/src/DistrhoUI.cpp b/distrho/src/DistrhoUI.cpp index 82ea7a56..49e8c3e6 100644 --- a/distrho/src/DistrhoUI.cpp +++ b/distrho/src/DistrhoUI.cpp @@ -90,6 +90,10 @@ void UI::d_sampleRateChanged(double) {} /* ------------------------------------------------------------------------------------------------------------ * UI Callbacks (optional) */ +void UI::d_uiFileBrowserSelected(const char*) +{ +} + void UI::d_uiReshape(uint width, uint height) { glEnable(GL_BLEND); diff --git a/distrho/src/DistrhoUIInternal.hpp b/distrho/src/DistrhoUIInternal.hpp index a17e2aae..a07719ca 100644 --- a/distrho/src/DistrhoUIInternal.hpp +++ b/distrho/src/DistrhoUIInternal.hpp @@ -170,16 +170,23 @@ public: } protected: + // custom window reshape void onReshape(uint width, uint height) override { DISTRHO_SAFE_ASSERT_RETURN(fUI != nullptr,); - // custom window reshape fUI->d_uiReshape(width, height); - fIsReady = true; } + // custom file-browser selected + void fileBrowserSelected(const char* filename) override + { + DISTRHO_SAFE_ASSERT_RETURN(fUI != nullptr,); + + fUI->d_uiFileBrowserSelected(filename); + } + private: UI* const fUI; bool fIsReady;