DISTRHO Plugin Framework
|
#include <ExternalWindow.hpp>
Public Member Functions | |
ExternalWindow () | |
ExternalWindow (const PrivateData &data) | |
virtual | ~ExternalWindow () |
virtual bool | isRunning () const |
virtual bool | isQuitting () const |
virtual uintptr_t | getNativeWindowHandle () const noexcept |
virtual void | focus () |
bool | isEmbed () const noexcept |
bool | isVisible () const noexcept |
bool | isStandalone () const noexcept |
uint | getWidth () const noexcept |
uint | getHeight () const noexcept |
double | getScaleFactor () const noexcept |
const char * | getTitle () const noexcept |
uintptr_t | getParentWindowHandle () const noexcept |
uintptr_t | getTransientWindowId () const noexcept |
void | hide () |
virtual void | close () |
void | setWidth (uint width) |
void | setHeight (uint height) |
void | setSize (uint width, uint height) |
void | setTitle (const char *title) |
void | setGeometryConstraints (uint minimumWidth, uint minimumHeight, bool keepAspectRatio=false) |
void | show () |
void | setVisible (bool visible) |
void | setTransientWindowId (uintptr_t winId) |
Protected Member Functions | |
bool | startExternalProcess (const char *args[]) |
void | terminateAndWaitForExternalProcess () |
virtual void | sizeChanged (uint, uint) |
virtual void | titleChanged (const char *) |
virtual void | visibilityChanged (bool) |
virtual void | transientParentWindowChanged (uintptr_t) |
Friends | |
class | PluginWindow |
class | UI |
External Window class.
This is a standalone TopLevelWidget/Window-compatible class, but without any real event handling. Being compatible with TopLevelWidget/Window, it allows to be used as DPF UI target.
It can be used to embed non-DPF things or to run a tool in a new process as the "UI". The uiIdle() function will be called at regular intervals to keep UI running. There are helper methods in place to launch external tools and keep track of its running state.
External windows can be setup to run in 3 different modes: Embed: Embed into the host UI, even-loop driven by the host. This is basically working as a regular plugin UI, as you typically expect them to. The plugin side does not get control over showing, hiding or closing the window (as usual for plugins). No restrictions on supported plugin format, everything should work. Requires DISTRHO_PLUGIN_HAS_EMBED_UI to be set to 1.
Semi-external: The UI is not embed into the host, but the even-loop is still driven by it. In this mode the host does not have control over the UI except for showing, hiding and setting transient parent. It is possible to close the window from the plugin, the host will be notified of such case. Host regularly calls isQuitting() to check if the UI got closed by the user or plugin side. This mode is only possible in LV2 plugin formats, using lv2ui:showInterface extension.
Standalone: The UI is not embed into the host or uses its event-loop, basically running as standalone. The host only has control over showing and hiding the window, nothing else. The UI is still free to close itself at any point. DPF will keep calling isRunning() to check if it should keep the event-loop running. Only possible in JACK and DSSI targets, as the UIs are literally standalone applications there.
Please note that for non-embed windows, you cannot show the window yourself. The plugin window is only allowed to hide or close itself, a "show" action needs to come from the host.
A few callbacks are provided so that implementations do not need to care about checking for state changes. They are not called on construction, but will be everytime something changes either by the host or the window itself.
|
inlineexplicit |
Constructor.
|
inlineexplicit |
Constructor for DPF internal use.
|
inlinevirtual |
Destructor.
|
inlinevirtual |
Check if main-loop is running. This is used under standalone mode to check whether to keep things running. Returning false from this function will stop the event-loop and close the window.
|
inlinevirtual |
Check if we are about to close. This is used when the event-loop is provided by the host to check if it should close the window. It is also used in standalone mode right after isRunning() returns false to verify if window needs to be closed.
|
inlinevirtualnoexcept |
Get the "native" window handle. This can be reimplemented in order to pass the native window to hosts that can use such informaton.
Returned value type depends on the platform:
BView
.NSView*
.HWND
.Window
.
|
inlinevirtual |
Grab the keyboard input focus. Typically you would setup OS-native methods to bring the window to front and give it focus. Default implementation does nothing.
|
inlinenoexcept |
|
inlinenoexcept |
Check if this window is visible.
|
inlinenoexcept |
Whether this Window is running as standalone, that is, without being coupled to a host event-loop. When in standalone mode, isRunning() is called to check if the event-loop should keep running.
|
inlinenoexcept |
Get width of this window. Only relevant to hosts when the UI is embedded.
|
inlinenoexcept |
Get height of this window. Only relevant to hosts when the UI is embedded.
|
inlinenoexcept |
Get the scale factor requested for this window. This is purely informational, and up to developers to choose what to do with it.
|
inlinenoexcept |
Get the title of the window previously set with setTitle(). This is typically displayed in the title bar or in window switchers.
|
inlinenoexcept |
Get the "native" window handle that this window should embed itself into. Returned value type depends on the platform:
BView
.NSView*
.HWND
.Window
.
|
inlinenoexcept |
Get the transient window that we should attach ourselves to. TODO what id? also NSView* on macOS, or NSWindow?
|
inline |
Hide window. This is the same as calling setVisible(false). Embed windows should never call this!
|
inlinevirtual |
Hide the UI and gracefully terminate. Embed windows should never call this!
|
inline |
Set width of this window. Can trigger a sizeChanged callback. Only relevant to hosts when the UI is embedded.
|
inline |
Set height of this window. Can trigger a sizeChanged callback. Only relevant to hosts when the UI is embedded.
|
inline |
Set size of this window using width and height values. Can trigger a sizeChanged callback. Only relevant to hosts when the UI is embedded.
|
inline |
Set the title of the window, typically displayed in the title bar or in window switchers. Can trigger a titleChanged callback. Only relevant to hosts when the UI is not embedded.
|
inline |
Set geometry constraints for the Window when resized by the user.
|
inline |
Show window. This is the same as calling setVisible(true).
|
inline |
Set window visible (or not) according to visible.
|
inline |
Called by the host to set the transient parent window that we should attach ourselves to. TODO what id? also NSView* on macOS, or NSWindow?
|
inlineprotectedvirtual |
A callback for when the window size changes.
|
inlineprotectedvirtual |
A callback for when the window title changes.
|
inlineprotectedvirtual |
A callback for when the window visibility changes.
|
inlineprotectedvirtual |
A callback for when the transient parent window changes.