Jamba C++ API  4.0.0
StateAwareView< TView, TGUIState > Class Template Reference

Override from this class if you need to implement a (custom) view specific to a given plugin. More...

#include <CustomView.h>

Inherits TView, and StateAware< TGUIState >.

Inherited by PluginCustomView< TGUIState >, and PluginView< TView, TGUIState >.

Public Member Functions

template<typename... Args>
 StateAwareView (const CRect &iSize, Args &&...args)
 

Protected Member Functions

void initState (GUIState *iGUIState) override
 Overriden to call both ParamAware::initState() and StateAware::initState() More...
 

Additional Inherited Members

- Public Attributes inherited from StateAware< TGUIState >
TGUIState::PluginParameters const * fParams {}
 Gives direct access to parameters (ex: fParams->fBypassParam) More...
 
TGUIState * fState {}
 Gives access to the GUI state (ex: fState->fLabelA) More...
 

Detailed Description

template<typename TView, typename TGUIState>
class pongasoft::VST::GUI::Views::StateAwareView< TView, TGUIState >

Override from this class if you need to implement a (custom) view specific to a given plugin.

When writing a "generic" view (for example, a MomentaryButtonView), you deal with parameters by their ids, since the view is meant to work with many parameters. But if you write a view that is very specific to a given plugin, it makes the code easier to write and more type safe if you tie the view to the state.

By inheriting from this class you automatically get access to all the parameters of your plugin (via StateAware::fParams) as well as the GUI state (via StateAware::fState).

// Example
class SliceSettingView : public StateAwareView<ToggleButtonView, SampleSplitterGUIState> {
void registerParameters() {
fSelectedSlice = registerParam(fParams->fSelectedSlice);
fSlicesSettings = registerParam(fState->fSlicesSettings);
setToggleFromSetting();
}
protected:
GUIVstParam<int> fSelectedSlice{};
GUIJmbParam<SlicesSettings> fSlicesSettings{};
};
Template Parameters
TViewthe parent view (must be a subclass of CView)
TGUIStatetype of the gui state for the plugin (must be a subclass of GUIState)

Constructor & Destructor Documentation

◆ StateAwareView()

StateAwareView ( const CRect &  iSize,
Args &&...  args 
)
inlineexplicit

Member Function Documentation

◆ initState()

void initState ( GUIState iGUIState)
inlineoverrideprotectedvirtual

Overriden to call both ParamAware::initState() and StateAware::initState()

Reimplemented from StateAware< TGUIState >.


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