Jamba  3.2.0
pongasoft::VST::GUI::Views::SwitchViewContainer Class Reference

#include <SwitchViewContainer.h>

Inherits pongasoft::VST::GUI::Views::CustomViewAdapter< CViewContainer >, and IViewContainerListenerAdapter.

Classes

class  Creator
 

Public Member Functions

virtual void afterCreate (IUIDescription const *iDescription, IController *iController)
 
int32_t getSwitchControlTag () const
 
const std::vector< std::string > & getTemplateNames () const
 
void onParameterChange (ParamID iParamID) override
 
void registerParameters () override
 
virtual void setSwitchControlTag (int32_t iTag)
 
void setTemplateNames (const std::vector< std::string > &iNames)
 
 SwitchViewContainer (const CRect &iSize)
 
 ~SwitchViewContainer () override
 
- Public Member Functions inherited from pongasoft::VST::GUI::Views::CustomViewAdapter< CViewContainer >
 CustomViewAdapter (const CRect &iSize, Args... args)
 
int32_t getCustomViewTag () const
 
void markDirty ()
 
void onParameterChange (ParamID iParamID) override
 
void setCustomViewTag (int32_t iTag)
 
- Public Member Functions inherited from pongasoft::VST::GUI::Params::GUIParamCxAware
bool __internal__registerRawVstControl (int32_t iParamID, ParamValue &oControlValue, GUIRawVstParam &oGUIRawVstParam)
 
template<typename T >
bool __internal__registerVstControl (int32_t iParamID, T &oControlValue, GUIVstParam< T > &oParam)
 
bool __internal__registerVstControl (int32_t iParamID, ParamValue &oControlValue, GUIRawVstParam &oParam)
 
virtual void initState (GUIState *iGUIState)
 
void invokeAll ()
 
GUIRawVstParam registerCallback (RawVstParam const &iParamDef, Parameters::ChangeCallback iChangeCallback, bool iInvokeCallback=false)
 
template<typename T >
GUIVstParam< T > registerCallback (VstParam< T > const &iParamDef, Parameters::ChangeCallback iChangeCallback, bool iInvokeCallback=false)
 
template<typename T >
bool registerCallback (VstParam< T > const &iParamDef, Parameters::ChangeCallback1< GUIVstParam< T >> iChangeCallback, bool iInvokeCallback=false)
 
template<typename T >
GUIJmbParam< T > registerCallback (GUIJmbParam< T > &iParamDef, Parameters::ChangeCallback iChangeCallback, bool iInvokeCallback=false)
 
template<typename T >
bool registerCallback (GUIJmbParam< T > &iParamDef, Parameters::ChangeCallback1< GUIJmbParam< T >> iChangeCallback, bool iInvokeCallback=false)
 
template<typename T >
GUIJmbParam< T > registerJmbCallback (ParamID iParamID, Parameters::ChangeCallback iChangeCallback, bool iInvokeCallback=false)
 
template<typename T >
GUIJmbParam< T > registerJmbParam (ParamID iParamID, bool iSubscribeToChanges=true)
 
bool registerParam (int32_t iParamID, GUIRawVstParam &oGUIRawVstParam)
 
GUIRawVstParam registerParam (RawVstParam const &iParamDef, bool iSubscribeToChanges=true)
 
template<typename T >
GUIVstParam< T > registerParam (VstParam< T > const &iParamDef, bool iSubscribeToChanges=true)
 
template<typename T >
GUIJmbParam< T > registerParam (GUIJmbParam< T > &iParamDef)
 
GUIRawVstParam registerRawVstCallback (ParamID iParamID, Parameters::ChangeCallback iChangeCallback, bool iInvokeCallback=false)
 
GUIRawVstParam registerRawVstParam (ParamID iParamID, bool iSubscribeToChanges=true)
 
GUIVstParam< bool > registerVstBooleanParam (ParamID iParamID, bool iSubscribeToChanges=true)
 
template<typename T >
GUIVstParam< T > registerVstCallback (ParamID iParamID, Parameters::ChangeCallback iChangeCallback, bool iInvokeCallback=false)
 
template<typename T >
GUIVstParam< T > registerVstParam (ParamID iParamID, bool iSubscribeToChanges=true)
 
GUIVstParam< PercentregisterVstPercentParam (ParamID iParamID, bool iSubscribeToChanges=true)
 
void unregisterAll ()
 
bool unregisterParam (ParamID iParamID)
 
GUIRawVstParam unregisterParam (GUIRawVstParam const &iParam)
 
template<typename T >
GUIVstParam< T > unregisterParam (GUIVstParam< T > const &iParam)
 
template<typename T >
GUIJmbParam< T > unregisterParam (GUIJmbParam< T > const &iParam)
 
virtual ~GUIParamCxAware ()
 

Protected Member Functions

virtual std::string computeTemplateName (int iIndex)
 
virtual void setCurrentView (CView *iCurrentView)
 
virtual void switchCurrentView ()
 
void viewContainerViewAdded (CViewContainer *container, CView *view) override
 

Protected Attributes

GUIRawVstParam fControlSwitch {}
 
std::string fCurrentTemplateName {}
 
CView * fCurrentView {}
 
int32_t fSwitchControlTag {-1}
 
std::vector< std::string > fTemplateNames
 
IController * fUIController {}
 
IUIDescription const * fUIDescription {}
 
- Protected Attributes inherited from pongasoft::VST::GUI::Views::CustomViewAdapter< CViewContainer >
int32_t fTag
 
- Protected Attributes inherited from pongasoft::VST::GUI::Params::GUIParamCxAware
std::unique_ptr< GUIParamCxMgrfParamCxMgr {}
 

Detailed Description

This view offers dynamic switching between multiple views based on the value of a discrete vst parameter (the control switch as defined by switch-control-tag). The multiple views come from the list of template names (comma separated list of names template-names).

The VST SDK comes with a similar implementation which a) is buggy, b) requires an actual control tied to a vst parameter (so for example does not work with StepButtonView or cannot be changed by the RT). This implementation uses a VST parameter directly so has none of these restrictions.

Note
When editing the layout using the editor, and saving the xml file, unfortunately the editor will save the children of this class (in this case, the one that was added dynamically). Although the code handles this case, it is recommended (for production) to manually edit the xml file to remove any child of this entry (otherwise objects will be created to be destroyed right away).

Constructor & Destructor Documentation

◆ SwitchViewContainer()

pongasoft::VST::GUI::Views::SwitchViewContainer::SwitchViewContainer ( const CRect &  iSize)
explicit

◆ ~SwitchViewContainer()

pongasoft::VST::GUI::Views::SwitchViewContainer::~SwitchViewContainer ( )
override

Member Function Documentation

◆ afterCreate()

void pongasoft::VST::GUI::Views::SwitchViewContainer::afterCreate ( IUIDescription const *  iDescription,
IController *  iController 
)
virtual

◆ computeTemplateName()

std::string pongasoft::VST::GUI::Views::SwitchViewContainer::computeTemplateName ( int  iIndex)
protectedvirtual

Lookup the name of the template in the vector. Can be overridden to implement different behavior

◆ getSwitchControlTag()

int32_t pongasoft::VST::GUI::Views::SwitchViewContainer::getSwitchControlTag ( ) const
inline

◆ getTemplateNames()

const std::vector<std::string>& pongasoft::VST::GUI::Views::SwitchViewContainer::getTemplateNames ( ) const
inline

◆ onParameterChange()

void pongasoft::VST::GUI::Views::SwitchViewContainer::onParameterChange ( ParamID  iParamID)
overridevirtual

Callback when a parameter changes. Empty default implementation

Reimplemented from pongasoft::VST::GUI::Params::GUIParamCxAware.

◆ registerParameters()

void pongasoft::VST::GUI::Views::SwitchViewContainer::registerParameters ( )
overridevirtual

Subclasses should override this method to register each parameter

Reimplemented from pongasoft::VST::GUI::Params::GUIParamCxAware.

◆ setCurrentView()

void pongasoft::VST::GUI::Views::SwitchViewContainer::setCurrentView ( CView *  iCurrentView)
protectedvirtual

Sets the current view to the one provided (remove previous view from container children and add this one). Handles no view properly.

◆ setSwitchControlTag()

virtual void pongasoft::VST::GUI::Views::SwitchViewContainer::setSwitchControlTag ( int32_t  iTag)
inlinevirtual

◆ setTemplateNames()

void pongasoft::VST::GUI::Views::SwitchViewContainer::setTemplateNames ( const std::vector< std::string > &  iNames)
inline

◆ switchCurrentView()

void pongasoft::VST::GUI::Views::SwitchViewContainer::switchCurrentView ( )
protectedvirtual

Called whenever something has changed to switch to a new current view

◆ viewContainerViewAdded()

void pongasoft::VST::GUI::Views::SwitchViewContainer::viewContainerViewAdded ( CViewContainer *  container,
CView *  view 
)
overrideprotected

The only purpose of this callback (from IViewContainerListenerAdapter) is to catch the unavoidable cases when the editor will save the children of this class as there does not seem to be a way to prevent this behavior from happening.

Member Data Documentation

◆ fControlSwitch

GUIRawVstParam pongasoft::VST::GUI::Views::SwitchViewContainer::fControlSwitch {}
protected

◆ fCurrentTemplateName

std::string pongasoft::VST::GUI::Views::SwitchViewContainer::fCurrentTemplateName {}
protected

◆ fCurrentView

CView* pongasoft::VST::GUI::Views::SwitchViewContainer::fCurrentView {}
protected

◆ fSwitchControlTag

int32_t pongasoft::VST::GUI::Views::SwitchViewContainer::fSwitchControlTag {-1}
protected

◆ fTemplateNames

std::vector<std::string> pongasoft::VST::GUI::Views::SwitchViewContainer::fTemplateNames
protected

◆ fUIController

IController* pongasoft::VST::GUI::Views::SwitchViewContainer::fUIController {}
protected

◆ fUIDescription

IUIDescription const* pongasoft::VST::GUI::Views::SwitchViewContainer::fUIDescription {}
protected

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