Jamba  3.0.2
pongasoft::VST::GUI::Views::CustomView Class Reference

#include <CustomView.h>

Inherits CView, and pongasoft::VST::GUI::Params::GUIParamCxAware.

Inherited by pongasoft::VST::GUI::Views::CustomControlView, and pongasoft::VST::GUI::Views::ScrollbarView.

Classes

class  Creator
 

Public Member Functions

 CustomView (const CRect &iSize)
 
 CustomView (const CustomView &c)=delete
 
void draw (CDrawContext *iContext) override
 
virtual void drawBackColor (CDrawContext *iContext)
 
void drawStyleChanged ()
 
CColor const & getBackColor () const
 
int32_t getCustomViewTag () const
 
bool getEditorMode () const
 
void markDirty ()
 
void onParameterChange (ParamID iParamID) override
 
void setBackColor (CColor const &iColor)
 
void setCustomViewTag (int32_t iTag)
 
void setEditorMode (bool iEditorMode)
 
- 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 > &oGUIVstParam)
 
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)
 
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)
 
virtual void registerParameters ()
 
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

void sizeToFit (CCoord iWidth, CCoord iHeight)
 
bool sizeToFit (BitmapPtr iBitmap, int iFrameCount=1)
 

Protected Attributes

CColor fBackColor
 
bool fEditorMode
 
int32_t fTag
 
- Protected Attributes inherited from pongasoft::VST::GUI::Params::GUIParamCxAware
std::unique_ptr< GUIParamCxMgrfParamCxMgr {}
 

Detailed Description

Base class that all custom views will inherit from. Defines a basic back color. The custom view tag should be a tag associated to the view itself not a parameter (like it is the case for CControl). The registerParameters method is the method that you inherit from to register which VST parameters your view will use. By default each parameter will be also be registered to listen for changes which will trigger the view to be redrawn: the onParameterChange method can be overridden to react differently (or additionally) to handle parameter changes. You use the convenient registerXXParameter methods to register each parameter. Ex: ... std::unique_ptr<BooleanParameter> fMyBoolParameter{nullptr}; std::unique_ptr<PercentParameter> fMyPercentParameter{nullptr}; std::unique_ptr<PercentParameter::Editor> fMyPercentParameterEditor{nullptr}; ... void registerParameters() override { fMyBoolParameter = registerBooleanParameter(EParamIDs::kMyBoolParamID); fMyPercentParameter = registerPercentParameter(EParamIDs::kMyPercentParamID); } ... void draw() override { CustomView::draw();

if(fMyBoolParameter->getValue()) ... do something ...

CColor c = CColor{255, 255, 255, fMyPercentParameter->getValue() * 255); ... }

void onMouseDown(CPoint &where, const CButtonState &buttons) { double percent = ...; // for example using where.y compute a percentage value fMyPercentParameterEditor = fMyPercentParameter->edit(percent); }

void onMouseMoved(CPoint &where, const CButtonState &buttons) { if(fMyPercentParameterEditor) { double percent = ...; // for example using where.y compute a percentage value fMyPercentParameterEditor->setValue(percent); } }

void onMouseUp(CPoint &where, const CButtonState &buttons) { if(fMyPercentParameterEditor) { double percent = ...; // for example using where.y compute a percentage value fMyPercentParameterEditor->commit(percent); fMyPercentParameterEditor = nullptr; } }

void onMouseCancel() { if(fMyPercentParameterEditor) { fMyPercentParameterEditor->rollback(); fMyPercentParameterEditor = nullptr; } }

Constructor & Destructor Documentation

◆ CustomView() [1/2]

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

◆ CustomView() [2/2]

pongasoft::VST::GUI::Views::CustomView::CustomView ( const CustomView c)
delete

Member Function Documentation

◆ draw()

void pongasoft::VST::GUI::Views::CustomView::draw ( CDrawContext *  iContext)
override

Implement this if you want to have a specific behavior when editor mode is changed.The basic draw method which will erase the background with the back color. You override this method to implement your additional own logic.

◆ drawBackColor()

void pongasoft::VST::GUI::Views::CustomView::drawBackColor ( CDrawContext *  iContext)
virtual

Draws the back color (if not set to transparent)

◆ drawStyleChanged()

void pongasoft::VST::GUI::Views::CustomView::drawStyleChanged ( )

Called when the draw style is changed (simply marks the view dirty)

◆ getBackColor()

CColor const& pongasoft::VST::GUI::Views::CustomView::getBackColor ( ) const
inline

◆ getCustomViewTag()

int32_t pongasoft::VST::GUI::Views::CustomView::getCustomViewTag ( ) const
inline

◆ getEditorMode()

bool pongasoft::VST::GUI::Views::CustomView::getEditorMode ( ) const

◆ markDirty()

void pongasoft::VST::GUI::Views::CustomView::markDirty ( )
inline

◆ onParameterChange()

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

Callback when a parameter changes. By default simply marks the view as dirty.

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

Reimplemented in pongasoft::VST::GUI::Views::ScrollbarView.

◆ setBackColor()

void pongasoft::VST::GUI::Views::CustomView::setBackColor ( CColor const &  iColor)

◆ setCustomViewTag()

void pongasoft::VST::GUI::Views::CustomView::setCustomViewTag ( int32_t  iTag)
inline

◆ setEditorMode()

void pongasoft::VST::GUI::Views::CustomView::setEditorMode ( bool  iEditorMode)

◆ sizeToFit() [1/2]

void pongasoft::VST::GUI::Views::CustomView::sizeToFit ( CCoord  iWidth,
CCoord  iHeight 
)
inlineprotected

Convenient call to size to fit this view according to the and height provided

◆ sizeToFit() [2/2]

bool pongasoft::VST::GUI::Views::CustomView::sizeToFit ( BitmapPtr  iBitmap,
int  iFrameCount = 1 
)
inlineprotected

Convenient call to size to fit this view to match the bitmap

Member Data Documentation

◆ fBackColor

CColor pongasoft::VST::GUI::Views::CustomView::fBackColor
protected

◆ fEditorMode

bool pongasoft::VST::GUI::Views::CustomView::fEditorMode
protected

◆ fTag

int32_t pongasoft::VST::GUI::Views::CustomView::fTag
protected

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