Jamba C++ API 7.5.0
Loading...
Searching...
No Matches
TCustomViewCreator< TView > Class Template Reference

Generic custom view creator base class. More...

#include <CustomViewCreator.h>

Inherits ViewCreatorAdapter.

Inherited by CustomViewCreator< TCustomControlView< T >, CustomControlView >, and CustomViewCreator< TView, TBaseView >.

Classes

class  BitmapAttribute
 Specialization for a bitmap attribute. More...
class  BooleanAttribute
 Specialization for the boolean attribute. More...
class  ColorAttribute
 Specialization for the color attribute. More...
class  FloatAttribute
 Specialization for an float attribute (which can be a double or a float, etc..). More...
class  FontAttribute
 Specialization for a bitmap attribute. More...
class  GradientAttribute
 Specialization for the color attribute. More...
class  IntegerAttribute
 Specialization for an Integer attribute (which can be any kind of integer, like short, int32_t, etc..). More...
class  ListAttribute
 Specialization for a list of possible values defined by the AttributeMap. More...
class  MarginAttribute
 Specialization for the margin attribute. More...
class  RangeAttribute
 Specialization for the range attribute. More...
class  TagAttribute
 Specialization for a tag attribute (vst type TagID). More...
class  TAttribute
 Generic base class that implements the logic for a ViewAttribute that uses a getter and setter in TView. More...
class  VectorStringAttribute
 Specialization for a vector of strings. More...

Public Member Functions

bool apply (CView *view, const UIAttributes &attributes, const IUIDescription *description) const override
 Extract all the attribute values and apply them to the view.
CView * create (const UIAttributes &attributes, const IUIDescription *description) const override
 This is the factory method which will instantiate the view.
bool getAttributeNames (std::list< std::string > &attributeNames) const override
AttrType getAttributeType (const std::string &attributeName) const override
IdStringPtr getBaseViewName () const override
UTF8StringPtr getDisplayName () const override
IdStringPtr getViewName () const override
template<typename XView>
void registerAttributes (TCustomViewCreator< XView > const &iOther)
 This method is called to register all the attributes from another CustomViewCreator (used in case of inheritance).
void registerBitmapAttribute (std::string const &iName, typename BitmapAttribute::Getter iGetter, typename BitmapAttribute::Setter iSetter)
 Registers a bitmap attribute with the given name and getter/setter.
void registerBooleanAttribute (std::string const &iName, typename BooleanAttribute::Getter iGetter, typename BooleanAttribute::Setter iSetter)
 Registers a boolean attribute with the given name and getter/setter.
void registerColorAttribute (std::string const &iName, typename ColorAttribute::Getter iGetter, typename ColorAttribute::Setter iSetter)
 Registers a color attribute with the given name and getter/setter.
void registerDoubleAttribute (std::string const &iName, typename FloatAttribute< double >::Getter iGetter, typename FloatAttribute< double >::Setter iSetter)
 Registers a double attribute with the given name and getter/setter.
void registerFloatAttribute (std::string const &iName, typename FloatAttribute< float >::Getter iGetter, typename FloatAttribute< float >::Setter iSetter)
 Registers a float attribute with the given name and getter/setter.
void registerFontAttribute (std::string const &iName, typename FontAttribute::Getter iGetter, typename FontAttribute::Setter iSetter)
 Registers a font attribute with the given name and getter/setter.
void registerGradientAttribute (std::string const &iName, typename GradientAttribute::Getter iGetter, typename GradientAttribute::Setter iSetter)
 Registers a gradient attribute with the given name and getter/setter.
void registerIntAttribute (std::string const &iName, typename IntegerAttribute< int32_t >::Getter iGetter, typename IntegerAttribute< int32_t >::Setter iSetter)
 Registers an int attribute with the given name and getter/setter.
template<typename TInt>
void registerIntegerAttribute (std::string const &iName, typename IntegerAttribute< TInt >::Getter iGetter, typename IntegerAttribute< TInt >::Setter iSetter)
 Registers an Integer (any kind) attribute with the given name and getter/setter.
template<typename T>
void registerListAttribute (std::string const &iName, typename ListAttribute< T >::Getter iGetter, typename ListAttribute< T >::Setter iSetter, AttrValInitList< T > const &iAttributeValues)
 Registers a list attribute with the given name and getter/setter.
void registerMarginAttribute (std::string const &iName, typename MarginAttribute::Getter iGetter, typename MarginAttribute::Setter iSetter)
 Registers a Margin attribute with the given name and getter/setter.
void registerRangeAttribute (std::string const &iName, typename RangeAttribute::Getter iGetter, typename RangeAttribute::Setter iSetter)
 Registers a Range attribute with the given name and getter/setter.
void registerTagAttribute (std::string const &iName, typename TagAttribute::Getter iGetter, typename TagAttribute::Setter iSetter)
 Registers a tag attribute with the given name and getter/setter.
void registerVectorStringAttribute (std::string const &iName, typename VectorStringAttribute::Getter iGetter, typename VectorStringAttribute::Setter iSetter, char iDelimiter=',', bool iSkipEmptyEntries=false)
 Registers a Range attribute with the given name and getter/setter.
 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 &)>
 ByRefAttribute defines getter/setter by const reference.
template<typename T>
using ByValAttribute = TAttribute<T, T (TView::*)() const, void (TView::*)(T)>
 ByValAttribute defines getter/setter by value (copy).

Private Member Functions

void registerAttribute (std::shared_ptr< ViewAttribute > iAttribute)
 Internal method to register an attribute... check that names are not duplicate!
template<typename TViewAttribute, typename... Args>
void registerAttribute (std::string const &iName, typename TViewAttribute::Getter iGetter, typename TViewAttribute::Setter iSetter, Args &&...iArgs)
 Generic register attribute.

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 TCustomViewCreator<CustomView1> {
public:
explicit CustomView1Creator(char const *iViewName = nullptr, char const *iDisplayName = nullptr) :
TCustomViewCreator(iViewName, iDisplayName)
{
... register CustomView1 attributes here ...
}
};
class CustomView2Creator : public TCustomViewCreator<CustomView2> {
public:
explicit CustomView2Creator(char const *iViewName = nullptr, char const *iDisplayName = nullptr) :
TCustomViewCreator(iViewName, iDisplayName)
{
registerAttributes(CustomView1Creator());
... register CustomView2 attributes here ...
}
};
Generic custom view creator base class.
Definition CustomViewCreator.h:158
friend class TCustomViewCreator
Definition CustomViewCreator.h:1200
Note
It is recommended to follow the convention that the view has an inner class called Creator in which case you should use the more convenient class CustomViewCreator instead.

Member Typedef Documentation

◆ ByRefAttribute

template<typename TView>
template<typename T>
using 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 ByValAttribute = TAttribute<T, T (TView::*)() const, void (TView::*)(T)>
private

ByValAttribute defines getter/setter by value (copy).

Constructor & Destructor Documentation

◆ TCustomViewCreator()

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

◆ ~TCustomViewCreator()

template<typename TView>
~TCustomViewCreator ( )
inlineoverride

Member Function Documentation

◆ apply()

template<typename TView>
bool 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 * create ( const UIAttributes & attributes,
const IUIDescription * description ) const
inlineoverride

This is the factory method which will instantiate the view.

◆ getAttributeNames()

template<typename TView>
bool getAttributeNames ( std::list< std::string > & attributeNames) const
inlineoverride

◆ getAttributeType()

template<typename TView>
AttrType getAttributeType ( const std::string & attributeName) const
inlineoverride

◆ getBaseViewName()

template<typename TView>
IdStringPtr getBaseViewName ( ) const
inlineoverride

◆ getDisplayName()

template<typename TView>
UTF8StringPtr getDisplayName ( ) const
inlineoverride

◆ getViewName()

template<typename TView>
IdStringPtr getViewName ( ) const
inlineoverride

◆ registerAttribute() [1/2]

template<typename TView>
void 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, typename... Args>
void registerAttribute ( std::string const & iName,
typename TViewAttribute::Getter iGetter,
typename TViewAttribute::Setter iSetter,
Args &&... iArgs )
inlineprivate

Generic register attribute.

◆ registerAttributes()

template<typename TView>
template<typename XView>
void 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 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 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 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 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 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 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 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 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 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.

◆ registerListAttribute()

template<typename TView>
template<typename T>
void registerListAttribute ( std::string const & iName,
typename ListAttribute< T >::Getter iGetter,
typename ListAttribute< T >::Setter iSetter,
AttrValInitList< T > const & iAttributeValues )
inline

Registers a list attribute with the given name and getter/setter.

This kind of attribute is represented in the editor with a drop down list of values: for example "vertical" / "horizontal" and usually maps to an enum of some kind (or in other words, in general T is an enum). The iAttributeValues parameter is an initializer list of pairs (string,T) which makes it easy to initialize. This list is also used to populate the dropdown (in the editor) in the order defined.

Example:

registerListAttribute<EOrientation>("orientation", &MyView::getOrientation, &MyView::setOrientation,
{
{ "vertical", EOrientation::kVertical },
{ "horizontal", EOrientation::kHorizontal }
}
void registerListAttribute(std::string const &iName, typename ListAttribute< T >::Getter iGetter, typename ListAttribute< T >::Setter iSetter, AttrValInitList< T > const &iAttributeValues)
Registers a list attribute with the given name and getter/setter.
Definition CustomViewCreator.h:1038

◆ registerMarginAttribute()

template<typename TView>
void 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 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 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.

◆ registerVectorStringAttribute()

template<typename TView>
void registerVectorStringAttribute ( std::string const & iName,
typename VectorStringAttribute::Getter iGetter,
typename VectorStringAttribute::Setter iSetter,
char iDelimiter = ',',
bool iSkipEmptyEntries = false )
inline

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

◆ 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> > fAttributes
private

◆ fBaseViewName

template<typename TView>
char const* fBaseViewName
private

◆ fDisplayName

template<typename TView>
char const* fDisplayName
private

◆ fViewName

template<typename TView>
char const* fViewName
private

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