About
- Note
- The Standalone Library is a preview. The API may change in the future !
The standalone library adds a minimal set of classes to write simple cross-platform UI applications. See this page for a list of classes.
Here's a minimal sample just showing one window:
#include "vstgui/standalone/include/iapplication.h"
#include "vstgui/standalone/include/iuidescwindow.h"
#include "vstgui/standalone/include/helpers/appdelegate.h"
#include "vstgui/standalone/include/helpers/windowlistener.h"
{
public:
MyApplication ()
:
DelegateAdapter ({
"simple_standalone",
"1.0.0",
"com.mycompany.simplestandalone"})
{}
void finishLaunching () override
{
UIDesc::Config config;
if (auto window = UIDesc::makeWindow (config))
{
window->show ();
window->registerWindowListener (this);
}
else
{
IApplication::instance ().quit ();
}
}
void onClosed (const IWindow& window) override
{
IApplication::instance ().quit ();
}
};
static Init gAppDelegate (std::make_unique<MyApplication> ());
Application delegate adapter
Definition appdelegate.h:20
Window listener adapter
Definition windowlistener.h:20
Standalone Library
Definition appinit.h:11
Init application.
Definition appinit.h:90
UTF8String uiDescFileName
Filename of the UIDescription xml file.
Definition iuidescwindow.h:72
UTF8String viewName
Template name of the view in the uidesc file to show in the window.
Definition iuidescwindow.h:75
WindowConfiguration windowConfig
Window configuration.
Definition iuidescwindow.h:78
UTF8String title
Window title.
Definition iwindow.h:145
UTF8String autoSaveFrameName
Window save frame name.
Definition iwindow.h:147
WindowStyle style
Window style.
Definition iwindow.h:141
WindowStyle & border()
Definition iwindow.h:89
WindowStyle & centered()
Definition iwindow.h:114
WindowStyle & close()
Definition iwindow.h:94
WindowStyle & size()
Definition iwindow.h:99
Adding a real user interface to the window is done via a "What You See Is What You Get" editor at runtime as known from the VST3 inline editor. Bindings are done via the IModelBinding interface.
Bindings
Binding the user interface with your code is done via IValue objects. A list of value objects are exposed via an object that implements the IModelBinding interface.
As an example implementation there is the ModelBindingCallbacks class in the helpers sub directory. For example you want to have a button in the UI which triggers a function, you can implement it like this :
executeMyFunction ();
}));
Value interface.
Definition ivalue.h:21
static ModelBindingCallbacksPtr make()
Definition modelbinding.h:60
ValuePtr make(const UTF8String &id, IValue::Type initialValue=0., const ValueConverterPtr &valueConverter=nullptr)
make a value in the normalized range [0..1]
ModelBindingPtr modelBinding
Model binding.
Definition iuidescwindow.h:86
static ValueCalls onAction(Call &&call)
Definition modelbinding.h:41
After you have set the binding as the UIDesc::Config::modelBinding parameter when you create the window, you can start your program, enable the inline editor, create a button and bind that button to the "control-tag" of "MyFunction" as written in the above code. When the button is clicked, the function 'executeMyFunction' is called.
Customization
If you need deeper control of the UI you can supply an object implementing the ICustomization interface as the UIDesc::Config::customization parameter. In the UI editor you can set the 'sub-controller' attribute of a view container to create a new IController object out of your ICustomization object. This controller can alter the UI in many ways, it can even create custom views if you don't want to use the way described in IViewCreator to support the view inside the UI editor.
Supported operating systems
- Microsoft Windows 64bit
- minimum supported version : 7
- Apple macOS 64bit
- minimum supported version : 10.10
Compiler requirements
To compile and use the library you need a compiler supporting most of c++14.
As of this writing the following compilers work (others not tested):
- Visual Studio 15
- Xcode 7.3