Jamba  3.0.2
pongasoft::VST::GUI::Views::TCustomViewCreator< TView > Class Template Reference

#include <CustomViewCreator.h>

Inherits ViewCreatorAdapter.

Inherited by pongasoft::VST::GUI::Views::CustomViewCreator< TView, TBaseView >.

Classes

class  BitmapAttribute
 
class  BooleanAttribute
 
class  ColorAttribute
 
class  FloatAttribute
 
class  FontAttribute
 
class  GradientAttribute
 
class  IntegerAttribute
 
class  MarginAttribute
 
class  RangeAttribute
 
class  TagAttribute
 
class  TAttribute
 

Public Member Functions

bool apply (CView *view, const UIAttributes &attributes, const IUIDescription *description) const override
 
CView * create (const UIAttributes &attributes, const IUIDescription *description) const override
 
bool getAttributeNames (std::list< std::string > &attributeNames) const override
 
AttrType getAttributeType (const std::string &attributeName) const override
 
bool getAttributeValue (CView *iView, const std::string &iAttributeName, std::string &oStringValue, const IUIDescription *iDescription) const override
 
IdStringPtr getBaseViewName () const override
 
UTF8StringPtr getDisplayName () const override
 
IdStringPtr getViewName () const override
 
template<typename XView >
void registerAttributes (TCustomViewCreator< XView > const &iOther)
 
void registerBitmapAttribute (std::string const &iName, typename BitmapAttribute::Getter iGetter, typename BitmapAttribute::Setter iSetter)
 
void registerBooleanAttribute (std::string const &iName, typename BooleanAttribute::Getter iGetter, typename BooleanAttribute::Setter iSetter)
 
void registerColorAttribute (std::string const &iName, typename ColorAttribute::Getter iGetter, typename ColorAttribute::Setter iSetter)
 
void registerDoubleAttribute (std::string const &iName, typename FloatAttribute< double >::Getter iGetter, typename FloatAttribute< double >::Setter iSetter)
 
void registerFloatAttribute (std::string const &iName, typename FloatAttribute< float >::Getter iGetter, typename FloatAttribute< float >::Setter iSetter)
 
void registerFontAttribute (std::string const &iName, typename FontAttribute::Getter iGetter, typename FontAttribute::Setter iSetter)
 
void registerGradientAttribute (std::string const &iName, typename GradientAttribute::Getter iGetter, typename GradientAttribute::Setter iSetter)
 
void registerIntAttribute (std::string const &iName, typename IntegerAttribute< int32_t >::Getter iGetter, typename IntegerAttribute< int32_t >::Setter iSetter)
 
template<typename TInt >
void registerIntegerAttribute (std::string const &iName, typename IntegerAttribute< TInt >::Getter iGetter, typename IntegerAttribute< TInt >::Setter iSetter)
 
void registerMarginAttribute (std::string const &iName, typename MarginAttribute::Getter iGetter, typename MarginAttribute::Setter iSetter)
 
void registerRangeAttribute (std::string const &iName, typename RangeAttribute::Getter iGetter, typename RangeAttribute::Setter iSetter)
 
void registerTagAttribute (std::string const &iName, typename TagAttribute::Getter iGetter, typename TagAttribute::Setter iSetter)
 
 TCustomViewCreator (char const *iViewName=nullptr, char const *iDisplayName=nullptr, char const *iBaseViewName=VSTGUI::UIViewCreator::kCView)
 
 ~TCustomViewCreator () override
 

Private Types

template<typename T >
using ByRefAttribute = TAttribute< T, T const &(TView::*)() const, void(TView::*)(T const &)>
 
template<typename T >
using ByValAttribute = TAttribute< T, T(TView::*)() const, void(TView::*)(T)>
 

Private Member Functions

void registerAttribute (std::shared_ptr< ViewAttribute > iAttribute)
 
template<typename TViewAttribute >
void registerAttribute (std::string const &iName, typename TViewAttribute::Getter iGetter, typename TViewAttribute::Setter iSetter)
 

Private Attributes

std::map< std::string, std::shared_ptr< ViewAttribute > > fAttributes
 
char const * fBaseViewName
 
char const * fDisplayName
 
char const * fViewName
 

Friends

template<typename XView >
class TCustomViewCreator
 

Detailed Description

template<typename TView>
class pongasoft::VST::GUI::Views::TCustomViewCreator< TView >

Generic custom view creator base class. Inherit from it and call the various "registerXX" methods in the constructor.

In case of inheritance, you do the following:

class CustomView1 : public CControl { ... } class CustomView2 : public CustomView1 { ... }

class CustomView1Creator : public CustomViewCreator<CustomView1> { public: explicit CustomView1Creator(char const *iViewName = nullptr, char const *iDisplayName = nullptr) : CustomViewCreator(iViewName, iDisplayName) { ... register CustomView1 attributes here ... } } class CustomView2Creator : public CustomViewCreator<CustomView2> { public: explicit CustomView2Creator(char const *iViewName = nullptr, char const *iDisplayName = nullptr) : CustomViewCreator(iViewName, iDisplayName) { registerAttributes(CustomView1Creator()); ... register CustomView2 attributes here ... } }

Member Typedef Documentation

◆ ByRefAttribute

template<typename TView>
template<typename T >
using pongasoft::VST::GUI::Views::TCustomViewCreator< TView >::ByRefAttribute = TAttribute<T, T const &(TView::*)() const, void (TView::*)(T const &)>
private

ByRefAttribute defines getter/setter by const reference

◆ ByValAttribute

template<typename TView>
template<typename T >
using pongasoft::VST::GUI::Views::TCustomViewCreator< TView >::ByValAttribute = TAttribute<T, T (TView::*)() const, void (TView::*)(T)>
private

ByValAttribute defines getter/setter by value (copy)

Constructor & Destructor Documentation

◆ TCustomViewCreator()

template<typename TView>
pongasoft::VST::GUI::Views::TCustomViewCreator< TView >::TCustomViewCreator ( char const *  iViewName = nullptr,
char const *  iDisplayName = nullptr,
char const *  iBaseViewName = VSTGUI::UIViewCreator::kCView 
)
inlineexplicit

◆ ~TCustomViewCreator()

template<typename TView>
pongasoft::VST::GUI::Views::TCustomViewCreator< TView >::~TCustomViewCreator ( )
inlineoverride

Member Function Documentation

◆ apply()

template<typename TView>
bool pongasoft::VST::GUI::Views::TCustomViewCreator< TView >::apply ( CView *  view,
const UIAttributes &  attributes,
const IUIDescription *  description 
) const
inlineoverride

Extract all the attribute values and apply them to the view. This is for example what happens when the xml file is read to populate the view with the stored values

◆ create()

template<typename TView>
CView* pongasoft::VST::GUI::Views::TCustomViewCreator< TView >::create ( const UIAttributes &  attributes,
const IUIDescription *  description 
) const
inlineoverride

This is the factory method which will instantiate the view

◆ getAttributeNames()

template<typename TView>
bool pongasoft::VST::GUI::Views::TCustomViewCreator< TView >::getAttributeNames ( std::list< std::string > &  attributeNames) const
inlineoverride

◆ getAttributeType()

template<typename TView>
AttrType pongasoft::VST::GUI::Views::TCustomViewCreator< TView >::getAttributeType ( const std::string &  attributeName) const
inlineoverride

◆ getAttributeValue()

template<typename TView>
bool pongasoft::VST::GUI::Views::TCustomViewCreator< TView >::getAttributeValue ( CView *  iView,
const std::string &  iAttributeName,
std::string &  oStringValue,
const IUIDescription *  iDescription 
) const
inlineoverride

This is used by the editor when instantiating a new view (drag & drop) and populating the various attributes with the values coming from the view

◆ getBaseViewName()

template<typename TView>
IdStringPtr pongasoft::VST::GUI::Views::TCustomViewCreator< TView >::getBaseViewName ( ) const
inlineoverride

◆ getDisplayName()

template<typename TView>
UTF8StringPtr pongasoft::VST::GUI::Views::TCustomViewCreator< TView >::getDisplayName ( ) const
inlineoverride

◆ getViewName()

template<typename TView>
IdStringPtr pongasoft::VST::GUI::Views::TCustomViewCreator< TView >::getViewName ( ) const
inlineoverride

◆ registerAttribute() [1/2]

template<typename TView>
void pongasoft::VST::GUI::Views::TCustomViewCreator< TView >::registerAttribute ( std::shared_ptr< ViewAttribute >  iAttribute)
inlineprivate

Internal method to register an attribute... check that names are not duplicate!

◆ registerAttribute() [2/2]

template<typename TView>
template<typename TViewAttribute >
void pongasoft::VST::GUI::Views::TCustomViewCreator< TView >::registerAttribute ( std::string const &  iName,
typename TViewAttribute::Getter  iGetter,
typename TViewAttribute::Setter  iSetter 
)
inlineprivate

Generic register attribute

◆ registerAttributes()

template<typename TView>
template<typename XView >
void pongasoft::VST::GUI::Views::TCustomViewCreator< TView >::registerAttributes ( TCustomViewCreator< XView > const &  iOther)
inline

This method is called to register all the attributes from another CustomViewCreator (used in case of inheritance)

◆ registerBitmapAttribute()

template<typename TView>
void pongasoft::VST::GUI::Views::TCustomViewCreator< TView >::registerBitmapAttribute ( std::string const &  iName,
typename BitmapAttribute::Getter  iGetter,
typename BitmapAttribute::Setter  iSetter 
)
inline

Registers a bitmap attribute with the given name and getter/setter

◆ registerBooleanAttribute()

template<typename TView>
void pongasoft::VST::GUI::Views::TCustomViewCreator< TView >::registerBooleanAttribute ( std::string const &  iName,
typename BooleanAttribute::Getter  iGetter,
typename BooleanAttribute::Setter  iSetter 
)
inline

Registers a boolean attribute with the given name and getter/setter

◆ registerColorAttribute()

template<typename TView>
void pongasoft::VST::GUI::Views::TCustomViewCreator< TView >::registerColorAttribute ( std::string const &  iName,
typename ColorAttribute::Getter  iGetter,
typename ColorAttribute::Setter  iSetter 
)
inline

Registers a color attribute with the given name and getter/setter

◆ registerDoubleAttribute()

template<typename TView>
void pongasoft::VST::GUI::Views::TCustomViewCreator< TView >::registerDoubleAttribute ( std::string const &  iName,
typename FloatAttribute< double >::Getter  iGetter,
typename FloatAttribute< double >::Setter  iSetter 
)
inline

Registers a double attribute with the given name and getter/setter

◆ registerFloatAttribute()

template<typename TView>
void pongasoft::VST::GUI::Views::TCustomViewCreator< TView >::registerFloatAttribute ( std::string const &  iName,
typename FloatAttribute< float >::Getter  iGetter,
typename FloatAttribute< float >::Setter  iSetter 
)
inline

Registers a float attribute with the given name and getter/setter

◆ registerFontAttribute()

template<typename TView>
void pongasoft::VST::GUI::Views::TCustomViewCreator< TView >::registerFontAttribute ( std::string const &  iName,
typename FontAttribute::Getter  iGetter,
typename FontAttribute::Setter  iSetter 
)
inline

Registers a font attribute with the given name and getter/setter

◆ registerGradientAttribute()

template<typename TView>
void pongasoft::VST::GUI::Views::TCustomViewCreator< TView >::registerGradientAttribute ( std::string const &  iName,
typename GradientAttribute::Getter  iGetter,
typename GradientAttribute::Setter  iSetter 
)
inline

Registers a gradient attribute with the given name and getter/setter

◆ registerIntAttribute()

template<typename TView>
void pongasoft::VST::GUI::Views::TCustomViewCreator< TView >::registerIntAttribute ( std::string const &  iName,
typename IntegerAttribute< int32_t >::Getter  iGetter,
typename IntegerAttribute< int32_t >::Setter  iSetter 
)
inline

Registers an int attribute with the given name and getter/setter

◆ registerIntegerAttribute()

template<typename TView>
template<typename TInt >
void pongasoft::VST::GUI::Views::TCustomViewCreator< TView >::registerIntegerAttribute ( std::string const &  iName,
typename IntegerAttribute< TInt >::Getter  iGetter,
typename IntegerAttribute< TInt >::Setter  iSetter 
)
inline

Registers an Integer (any kind) attribute with the given name and getter/setter

◆ registerMarginAttribute()

template<typename TView>
void pongasoft::VST::GUI::Views::TCustomViewCreator< TView >::registerMarginAttribute ( std::string const &  iName,
typename MarginAttribute::Getter  iGetter,
typename MarginAttribute::Setter  iSetter 
)
inline

Registers a Margin attribute with the given name and getter/setter

◆ registerRangeAttribute()

template<typename TView>
void pongasoft::VST::GUI::Views::TCustomViewCreator< TView >::registerRangeAttribute ( std::string const &  iName,
typename RangeAttribute::Getter  iGetter,
typename RangeAttribute::Setter  iSetter 
)
inline

Registers a Range attribute with the given name and getter/setter

◆ registerTagAttribute()

template<typename TView>
void pongasoft::VST::GUI::Views::TCustomViewCreator< TView >::registerTagAttribute ( std::string const &  iName,
typename TagAttribute::Getter  iGetter,
typename TagAttribute::Setter  iSetter 
)
inline

Registers a tag attribute with the given name and getter/setter

Friends And Related Function Documentation

◆ TCustomViewCreator

template<typename TView>
template<typename XView >
friend class TCustomViewCreator
friend

Member Data Documentation

◆ fAttributes

template<typename TView>
std::map<std::string, std::shared_ptr<ViewAttribute> > pongasoft::VST::GUI::Views::TCustomViewCreator< TView >::fAttributes
private

◆ fBaseViewName

template<typename TView>
char const* pongasoft::VST::GUI::Views::TCustomViewCreator< TView >::fBaseViewName
private

◆ fDisplayName

template<typename TView>
char const* pongasoft::VST::GUI::Views::TCustomViewCreator< TView >::fDisplayName
private

◆ fViewName

template<typename TView>
char const* pongasoft::VST::GUI::Views::TCustomViewCreator< TView >::fViewName
private

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