Browse Source

Allow to receive fileBrowserSelected in plugin UIs

gh-pages
falkTX 10 years ago
parent
commit
29042aeca5
3 changed files with 19 additions and 2 deletions
  1. +6
    -0
      distrho/DistrhoUI.hpp
  2. +4
    -0
      distrho/src/DistrhoUI.cpp
  3. +9
    -2
      distrho/src/DistrhoUIInternal.hpp

+ 6
- 0
distrho/DistrhoUI.hpp View File

@@ -140,6 +140,12 @@ protected:
*/ */
virtual void d_uiIdle() {} 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. OpenGL window reshape function, called when parent window is resized.
You can reimplement this function for a custom OpenGL state. You can reimplement this function for a custom OpenGL state.


+ 4
- 0
distrho/src/DistrhoUI.cpp View File

@@ -90,6 +90,10 @@ void UI::d_sampleRateChanged(double) {}
/* ------------------------------------------------------------------------------------------------------------ /* ------------------------------------------------------------------------------------------------------------
* UI Callbacks (optional) */ * UI Callbacks (optional) */


void UI::d_uiFileBrowserSelected(const char*)
{
}

void UI::d_uiReshape(uint width, uint height) void UI::d_uiReshape(uint width, uint height)
{ {
glEnable(GL_BLEND); glEnable(GL_BLEND);


+ 9
- 2
distrho/src/DistrhoUIInternal.hpp View File

@@ -170,16 +170,23 @@ public:
} }


protected: protected:
// custom window reshape
void onReshape(uint width, uint height) override void onReshape(uint width, uint height) override
{ {
DISTRHO_SAFE_ASSERT_RETURN(fUI != nullptr,); DISTRHO_SAFE_ASSERT_RETURN(fUI != nullptr,);


// custom window reshape
fUI->d_uiReshape(width, height); fUI->d_uiReshape(width, height);

fIsReady = true; fIsReady = true;
} }


// custom file-browser selected
void fileBrowserSelected(const char* filename) override
{
DISTRHO_SAFE_ASSERT_RETURN(fUI != nullptr,);

fUI->d_uiFileBrowserSelected(filename);
}

private: private:
UI* const fUI; UI* const fUI;
bool fIsReady; bool fIsReady;


Loading…
Cancel
Save