Browse Source

Add UI::sizeChanged as needed for external UIs

Signed-off-by: falkTX <falktx@falktx.com>
pull/318/head
falkTX 4 years ago
parent
commit
d3bd0ec61b
Signed by: falkTX <falktx@falktx.com> GPG Key ID: CDBAA37ABC74FBA0
2 changed files with 21 additions and 3 deletions
  1. +11
    -2
      distrho/DistrhoUI.hpp
  2. +10
    -1
      distrho/src/DistrhoUI.cpp

+ 11
- 2
distrho/DistrhoUI.hpp View File

@@ -303,17 +303,26 @@ protected:
*/
virtual void uiFileBrowserSelected(const char* filename);
# endif
#endif // !DISTRHO_PLUGIN_HAS_EXTERNAL_UI

/* --------------------------------------------------------------------------------------------------------
* UI Resize Handling, internal */

#if DISTRHO_PLUGIN_HAS_EXTERNAL_UI
/**
External Window resize function, called when the window is resized.
This is overriden here so the host knows when the UI is resized by you.
@see ExternalWindow::sizeChanged(uint,uint)
*/
void sizeChanged(uint width, uint height) override;
#else
/**
OpenGL widget resize function, called when the widget is resized.
Widget resize function, called when the widget is resized.
This is overriden here so the host knows when the UI is resized by you.
@see Widget::onResize(const ResizeEvent&)
*/
void onResize(const ResizeEvent& ev) override;
#endif // !DISTRHO_PLUGIN_HAS_EXTERNAL_UI
#endif

// -------------------------------------------------------------------------------------------------------



+ 10
- 1
distrho/src/DistrhoUI.cpp View File

@@ -209,10 +209,19 @@ void UI::uiFileBrowserSelected(const char*)
{
}
# endif
#endif // !DISTRHO_PLUGIN_HAS_EXTERNAL_UI

/* ------------------------------------------------------------------------------------------------------------
* UI Resize Handling, internal */

#if DISTRHO_PLUGIN_HAS_EXTERNAL_UI
void UI::sizeChanged(const uint width, const uint height)
{
UIWidget::sizeChanged(width, height);

uiData->setSizeCallback(width, height);
}
#else
void UI::onResize(const ResizeEvent& ev)
{
UIWidget::onResize(ev);
@@ -221,7 +230,7 @@ void UI::onResize(const ResizeEvent& ev)
const uint height = ev.size.getHeight();
uiData->setSizeCallback(width, height);
}
#endif // !DISTRHO_PLUGIN_HAS_EXTERNAL_UI
#endif

// -----------------------------------------------------------------------------------------------------------



Loading…
Cancel
Save