Jamba C++ API 7.5.0
Loading...
Searching...
No Matches
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 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().

Additional Inherited Members

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

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{};
};
This is the main class that the plugin should use as it exposes only the necessary methods of the par...
Definition GUIJmbParameter.h:497
This is the main class that the plugin should use as it exposes only the necessary methods of the par...
Definition GUIVstParameter.h:280
virtual void registerParameters()
Subclasses should override this method to register each parameter.
Definition ParamAware.h:498
TGUIState::PluginParameters const * fParams
Gives direct access to parameters (ex: fParams->fBypassParam).
Definition StateAware.h:57
TGUIState * fState
Gives access to the GUI state (ex: fState->fLabelA).
Definition StateAware.h:53
StateAwareView(const CRect &iSize, Args &&...args)
Definition CustomView.h:296
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()

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

Member Function Documentation

◆ initState()

template<typename TView, typename TGUIState>
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: