DISTRHO Plugin Framework
|
#include <Application.hpp>
Public Member Functions | |
Application (bool isStandalone=true) | |
virtual | ~Application () |
void | idle () |
void | exec (uint idleTimeInMs=30) |
void | quit () |
bool | isQuitting () const noexcept |
bool | isStandalone () const noexcept |
double | getTime () const |
void | addIdleCallback (IdleCallback *callback) |
void | removeIdleCallback (IdleCallback *callback) |
const char * | getClassName () const noexcept |
void | setClassName (const char *name) |
Friends | |
class | Window |
class | DISTRHO_NAMESPACE::PluginApplication |
Base DGL Application class.
One application instance is required for creating a window. There's no single/global application instance in DGL, and multiple windows can share the same app instance.
In standalone mode an application will automatically quit its event-loop when all its windows are closed.
Unless stated otherwise, functions within this class are not thread-safe.
Application::Application | ( | bool | isStandalone = true | ) |
Constructor.
|
virtual |
Destructor.
void Application::idle | ( | ) |
Idle function. This runs the application event-loop once.
void Application::exec | ( | uint | idleTimeInMs = 30 | ) |
Run the application event-loop until all Windows are closed. idle() is called at regular intervals.
void Application::quit | ( | ) |
Quit the application. This stops the event-loop and closes all Windows. This function is thread-safe.
|
noexcept |
Check if the application is about to quit. Returning true means there's no event-loop running at the moment (or it's just about to stop). This function is thread-safe.
|
noexcept |
Check if the application is standalone, otherwise running as a module or plugin. This function is thread-safe.
double Application::getTime | ( | ) | const |
Return the time in seconds.
This is a monotonically increasing clock with high resolution.
The returned time is only useful to compare against other times returned by this function, its absolute value has no meaning.
void Application::addIdleCallback | ( | IdleCallback * | callback | ) |
Add a callback function to be triggered on every idle cycle. You can add more than one, and remove them at anytime with removeIdleCallback(). Idle callbacks trigger right after OS event handling and Window idle events (within the same cycle). There are no guarantees in terms of timing, use Window::addIdleCallback for time-relative callbacks.
void Application::removeIdleCallback | ( | IdleCallback * | callback | ) |
Remove an idle callback previously added via addIdleCallback().
|
noexcept |
Get the class name of the application.
This is a stable identifier for the application, used as the window class/instance name on X11 and Windows. It is not displayed to the user, but can be used in scripts and by window managers, so it should be the same for every instance of the application, but different from other applications.
Plugins created with DPF have their class name automatically set based on DGL_NAMESPACE and plugin name.
void Application::setClassName | ( | const char * | name | ) |
Set the class name of the application.