Jamba C++ API  5.1.1
GUIController Class Referenceabstract

Base class from which the actual controller inherits from. More...

#include <GUIController.h>

Inherits EditController, VST3EditorDelegate, IMessageProducer, and IDialogHandler.

Public Member Functions

IPtr< IMessage > allocateMessage () override
 Allocates a message instance. More...
 
virtual IController * createCustomController (UTF8StringPtr iName, IUIDescription const *iDescription, IController *iBaseController)
 Subclasses should override this method to return the custom controller or nullptr if doesn't match the name. More...
 
bool dismissDialog () override
 Dismisses the currently shown dialog. More...
 
virtual GUIStategetGUIState ()=0
 Subclasses must implement this method to return the state. More...
 
 GUIController (char const *iXmlFileName="Views.uidesc", char const *iMainViewName="view")
 
tresult sendMessage (IPtr< IMessage > iMessage) override
 Sends the given message to the peer. More...
 
bool showDialog (std::string iTemplateName) override
 This method is called with the name of the template to use for the dialog. More...
 
 ~GUIController () override
 
- Public Member Functions inherited from IMessageProducer
virtual ~IMessageProducer ()=default
 
- Public Member Functions inherited from IDialogHandler
virtual ~IDialogHandler ()=default
 Destructor. More...
 

Protected Member Functions

IController * createSubController (UTF8StringPtr iName, const IUIDescription *iDescription, VST3Editor *iEditor) override
 Called when a sub controller needs to be created. More...
 
IPlugView *PLUGIN_API createView (const char *name) override
 Create the view. More...
 
void didOpen (VST3Editor *editor) override
 
tresult PLUGIN_API getState (IBStream *state) override
 Called to save the state (UI only!) (before saving a preset or project) More...
 
tresult PLUGIN_API initialize (FUnknown *context) override
 Called at first after constructor. More...
 
bool maybeShowDialog ()
 Shows the dialog if necessary. More...
 
tresult PLUGIN_API notify (IMessage *message) SMTG_OVERRIDE
 Called to handle a message (coming from RT) More...
 
void registerParameters (ParamAware *iParamAware)
 
tresult PLUGIN_API setComponentState (IBStream *state) override
 Sets the component state (after setting the processor) or after restore. More...
 
tresult PLUGIN_API setState (IBStream *state) override
 Restore the state (UI only!) (ex: after loading preset or project) More...
 
virtual bool switchToMainView ()
 Switch back to the main view. More...
 
virtual bool switchToView (char const *iViewName)
 This method should be called to display a totally different (root) view. More...
 
tresult PLUGIN_API terminate () override
 Called at the end before destructor. More...
 
void willClose (VST3Editor *editor) override
 

Protected Attributes

VSTGUI::CKnobMode fDefaultKnobMode {VSTGUI::CKnobMode::kLinearMode}
 
char const *const fXmlFileName
 

Private Attributes

std::string fCurrentViewName
 
std::string fDialogTemplateName {}
 
std::string fMainViewName
 
Optional< ModalViewSessionID > fModalViewSession {}
 
SharedPointer< UIDescription > fUIDescription {}
 
Views::CustomUIViewFactoryfViewFactory {nullptr}
 
VSTGUI::VST3Editor * fVST3Editor {}
 

Detailed Description

Base class from which the actual controller inherits from.

Handles most of the "framework" logic, (state loading/saving in a thread safe manner, registering VST parameters...) so that the actual controller code deals mostly with business logic.

Constructor & Destructor Documentation

◆ GUIController()

GUIController ( char const *  iXmlFileName = "Views.uidesc",
char const *  iMainViewName = "view" 
)
explicit

◆ ~GUIController()

~GUIController ( )
override

Member Function Documentation

◆ allocateMessage()

IPtr< IMessage > allocateMessage ( )
overridevirtual

Allocates a message instance.

Implements IMessageProducer.

◆ createCustomController()

virtual IController* createCustomController ( UTF8StringPtr  iName,
IUIDescription const *  iDescription,
IController *  iBaseController 
)
inlinevirtual

Subclasses should override this method to return the custom controller or nullptr if doesn't match the name.

◆ createSubController()

IController * createSubController ( UTF8StringPtr  iName,
const IUIDescription *  iDescription,
VST3Editor *  iEditor 
)
overrideprotected

Called when a sub controller needs to be created.

◆ createView()

IPlugView * createView ( const char *  name)
overrideprotected

Create the view.

◆ didOpen()

void didOpen ( VST3Editor *  editor)
overrideprotected

◆ dismissDialog()

bool dismissDialog ( )
overridevirtual

Dismisses the currently shown dialog.

Returns
true if there was a dialog shown or false otherwise

Implements IDialogHandler.

◆ getGUIState()

virtual GUIState* getGUIState ( )
pure virtual

Subclasses must implement this method to return the state.

◆ getState()

tresult getState ( IBStream *  state)
overrideprotected

Called to save the state (UI only!) (before saving a preset or project)

◆ initialize()

tresult initialize ( FUnknown *  context)
overrideprotected

Called at first after constructor.

◆ maybeShowDialog()

bool maybeShowDialog ( )
protected

Shows the dialog if necessary.

◆ notify()

tresult notify ( IMessage *  message)
protected

Called to handle a message (coming from RT)

◆ registerParameters()

void registerParameters ( ParamAware iParamAware)
protected

◆ sendMessage()

tresult sendMessage ( IPtr< IMessage >  iMessage)
overridevirtual

Sends the given message to the peer.

Implements IMessageProducer.

◆ setComponentState()

tresult setComponentState ( IBStream *  state)
overrideprotected

Sets the component state (after setting the processor) or after restore.

◆ setState()

tresult setState ( IBStream *  state)
overrideprotected

Restore the state (UI only!) (ex: after loading preset or project)

◆ showDialog()

bool showDialog ( std::string  iTemplateName)
overridevirtual

This method is called with the name of the template to use for the dialog.

It should be a template defined in the xml file (.uidesc) as a top level template.

Note
Because the view is modal it must include a way for the user to dismiss it, like a button.
Parameters
iTemplateNamethe name of the top level template to use
Returns
true if the dialog was shown and false if there was a problem (for example iTemplateName does not refer to a valid top level template name)

Implements IDialogHandler.

◆ switchToMainView()

virtual bool switchToMainView ( )
inlineprotectedvirtual

Switch back to the main view.

◆ switchToView()

bool switchToView ( char const *  iViewName)
protectedvirtual

This method should be called to display a totally different (root) view.

Example: with xxx.uidesc like this one, you would call switchToView("compact_view");

<vstgui-ui-description version="1">
  <!-- Main view opened on creation -->
    <template class="CViewContainer" name="view" ...>
  </template>
  <!-- Secondary view you can switch to -->
    <template class="CViewContainer" name="compact_view" ...>
  </template>
<vstgui-ui-description
Returns
true if switching worked

◆ terminate()

tresult terminate ( )
overrideprotected

Called at the end before destructor.

◆ willClose()

void willClose ( VST3Editor *  editor)
overrideprotected

Member Data Documentation

◆ fCurrentViewName

std::string fCurrentViewName
private

◆ fDefaultKnobMode

VSTGUI::CKnobMode fDefaultKnobMode {VSTGUI::CKnobMode::kLinearMode}
protected

◆ fDialogTemplateName

std::string fDialogTemplateName {}
private

◆ fMainViewName

std::string fMainViewName
private

◆ fModalViewSession

Optional<ModalViewSessionID> fModalViewSession {}
private

◆ fUIDescription

SharedPointer<UIDescription> fUIDescription {}
private

◆ fViewFactory

Views::CustomUIViewFactory* fViewFactory {nullptr}
private

◆ fVST3Editor

VSTGUI::VST3Editor* fVST3Editor {}
private

◆ fXmlFileName

char const* const fXmlFileName
protected

The documentation for this class was generated from the following files: