VSTGUI: IViewCreator Class Reference

VSTGUI 4.10 Graphical User Interface Framework not only for VST plugins

Loading...
Searching...
No Matches
Public Types | Public Member Functions | List of all members
IViewCreator Class Referenceabstract
New classes » Version 4.0

View creator interface. More...

`#include <iviewcreator.h>`

Inheritance diagram for IViewCreator:

## Public Types
enum | AttrType { kUnknownType , kBooleanType , kIntegerType , kFloatType , kStringType , kColorType , kFontType , kBitmapType , kPointType , kRectType , kTagType , kListType , kGradientType , kScriptType }
using | string = std::string
using | StringList = std::list<string>
using | ConstStringPtrList = std::list<const string*>

## Public Member Functions
virtual | ~IViewCreator () noexcept=default
virtual IdStringPtr | getViewName () const =0
virtual IdStringPtr | getBaseViewName () const =0
virtual CView * | create (const UIAttributes &attributes, const IUIDescription *description) const =0
virtual bool | apply (CView *view, const UIAttributes &attributes, const IUIDescription *description) const =0
virtual bool | getAttributeNames (StringList &attributeNames) const =0
virtual AttrType | getAttributeType (const string &attributeName) const =0
virtual bool | getAttributeValue (CView *view, const string &attributeName, string &stringValue, const IUIDescription *desc) const =0
virtual bool | getPossibleListValues (const string &attributeName, ConstStringPtrList &values) const =0
virtual bool | getAttributeValueRange (const string &attributeName, double &minValue, double &maxValue) const =0
virtual UTF8StringPtr | getDisplayName () const =0

## Detailed Description

View creator interface.

You can register your own custom views with the UIViewFactory by inheriting from this interface and register it with UIViewFactory::registerViewCreator().

Example for an imaginary view class called MyView which directly inherites from CView:

class MyViewCreator : public ViewCreatorAdapter
{
public:
// register this class with the view factory
MyViewCreator () { UIViewFactory::registerViewCreator (*this); }
// return an unique name here
IdStringPtr getViewName () const { return "MyView"; }
// return the name here from where your custom view inherites.
// Your view automatically supports the attributes from it.
IdStringPtr getBaseViewName () const { return "CView"; }
// create your view here.
// Note you don't need to apply attributes here as the apply method will be called with this new view
CView* create (const UIAttributes& attributes, const IUIDescription* description) const { return new MyView (); }
// apply custom attributes to your view
bool apply (CView* view, const UIAttributes& attributes, const IUIDescription* description) const
{
MyView* myView = dynamic_cast<MyView*> (view);
if (myView == 0)
return false;
int32_t value;
if (attributes.getIntegerAttribute ("my-custom-attribute", value))
myView->setCustomAttribute (value);
return true;
}
// add your custom attributes to the list
bool getAttributeNames (StringList& attributeNames) const
{
attributeNames.emplace_back ("my-custom-attribute");
return true;
}
// return the type of your custom attributes
AttrType getAttributeType (const std::string& attributeName) const
{
if (attributeName == "my-custom-attribute")
return kIntegerType;
return kUnknownType;
}
// return the string value of the custom attributes of the view
bool getAttributeValue (CView* view, const string& attributeName, string& stringValue, const IUIDescription* desc) const
{
MyView* myView = dynamic_cast<MyView*> (view);
if (myView == 0)
return false;
if (attributeName == "my-custom-attribute")
{
stringValue = UIAttributes::integerToString (myView->getCustomAttribute ());
return true;
}
return false;
}
};
// create a static instance so that it registers itself with the view factory
MyViewCreator __gMyViewCreator;
VSTGUI::IViewCreator::getBaseViewName
virtual IdStringPtr getBaseViewName() const =0
VSTGUI::IViewCreator::StringList
std::list< string > StringList
Definition iviewcreator.h:23
VSTGUI::IViewCreator::create
virtual CView * create(const UIAttributes &attributes, const IUIDescription *description) const =0
VSTGUI::IViewCreator::getViewName
virtual IdStringPtr getViewName() const =0
VSTGUI::IViewCreator::AttrType
AttrType
Definition iviewcreator.h:29
VSTGUI::IViewCreator::kUnknownType
@ kUnknownType
Definition iviewcreator.h:30
VSTGUI::IViewCreator::kIntegerType
@ kIntegerType
Definition iviewcreator.h:32
VSTGUI::UIAttributes::integerToString
static std::string integerToString(int32_t value)
Definition uiattributes.cpp:140
VSTGUI::UIViewFactory::registerViewCreator
static void registerViewCreator(const IViewCreator &viewCreator)
Definition uiviewfactory.cpp:502
VSTGUI::ViewCreatorAdapter
View creator interface adapter.
Definition iviewcreator.h:70
VSTGUI::ViewCreatorAdapter::getAttributeType
AttrType getAttributeType(const string &attributeName) const override
Definition iviewcreator.h:78
VSTGUI::ViewCreatorAdapter::getAttributeNames
bool getAttributeNames(StringList &attributeNames) const override
Definition iviewcreator.h:77
VSTGUI::ViewCreatorAdapter::getAttributeValue
bool getAttributeValue(CView *view, const string &attributeName, string &stringValue, const IUIDescription *desc) const override
Definition iviewcreator.h:79
VSTGUI::ViewCreatorAdapter::apply
bool apply(CView *view, const UIAttributes &attributes, const IUIDescription *description) const override
Definition iviewcreator.h:72
VSTGUI::IdStringPtr
const char * IdStringPtr
ID String pointer.
Definition vstguibase.h:216

## Member Typedef Documentation

## ◆ ConstStringPtrList

using ConstStringPtrList = std::list<const string*>

## ◆ string

using string = std::string

## ◆ StringList

using StringList = std::list<string>

## Member Enumeration Documentation

## ◆ AttrType

enum AttrType

Enumerator
kUnknownType |
kBooleanType |
kIntegerType |
kFloatType |
kStringType |
kColorType |
kFontType |
kBitmapType |
kPointType |
kRectType |
kTagType |
kListType |
kGradientType |
kScriptType |

## Constructor & Destructor Documentation

## ◆ ~IViewCreator()

virtual ~IViewCreator | ( |  | ) |
| virtualdefaultnoexcept

## Member Function Documentation

## ◆ apply()

virtual bool apply | ( | CView * | view,
|  | const UIAttributes & | attributes,
|  | const IUIDescription * | description ) const
| pure virtual

Implemented in AnimationSplashScreenCreator, AnimKnobCreator, AutoAnimationCreator, CheckBoxCreator, ControlCreator, GradientViewCreator, KnobBaseCreator, KnobCreator, LayeredViewContainerCreator, MultiBitmapControlCreator, MultiLineTextLabelCreator, OptionMenuCreator, ParamDisplayCreator, RowColumnViewCreator, ScrollViewCreator, SearchTextEditCreator, SegmentButtonCreator, ShadowViewContainerCreator, SliderBaseCreator, SliderCreator, SplitViewCreator, StringListControlCreator, SwitchBaseCreator, TextButtonCreator, TextEditCreator, TextLabelCreator, UIViewSwitchContainerCreator, ViewContainerCreator, ViewCreator, VuMeterCreator, XYPadCreator, and ViewCreatorAdapter.

## ◆ create()

virtual CView * create | ( | const UIAttributes & | attributes,
|  | const IUIDescription * | description ) const
| pure virtual

Implemented in AnimationSplashScreenCreator, AnimKnobCreator, AutoAnimationCreator, CheckBoxCreator, ControlCreator, GradientViewCreator, HorizontalSwitchCreator, KickButtonCreator, KnobCreator, LayeredViewContainerCreator, MovieBitmapCreator, MovieButtonCreator, MultiLineTextLabelCreator, OnOffButtonCreator, OptionMenuCreator, ParamDisplayCreator, RockerSwitchCreator, RowColumnViewCreator, ScrollViewCreator, SearchTextEditCreator, SegmentButtonCreator, ShadowViewContainerCreator, SliderCreator, SplitViewCreator, StringListControlCreator, TextButtonCreator, TextEditCreator, TextLabelCreator, UIViewSwitchContainerCreator, VerticalSwitchCreator, ViewContainerCreator, ViewCreator, VuMeterCreator, and XYPadCreator.

## ◆ getAttributeNames()

virtual bool getAttributeNames | ( | StringList & | attributeNames | ) | const
| pure virtual

Implemented in AnimationSplashScreenCreator, AnimKnobCreator, AutoAnimationCreator, CheckBoxCreator, ControlCreator, GradientViewCreator, KnobBaseCreator, KnobCreator, LayeredViewContainerCreator, MultiBitmapControlCreator, MultiLineTextLabelCreator, OptionMenuCreator, ParamDisplayCreator, RowColumnViewCreator, ScrollViewCreator, SearchTextEditCreator, SegmentButtonCreator, ShadowViewContainerCreator, SliderBaseCreator, SliderCreator, SplitViewCreator, StringListControlCreator, SwitchBaseCreator, TextButtonCreator, TextEditCreator, TextLabelCreator, UIViewSwitchContainerCreator, ViewContainerCreator, ViewCreator, VuMeterCreator, XYPadCreator, and ViewCreatorAdapter.

## ◆ getAttributeType()

virtual AttrType getAttributeType | ( | const string & | attributeName | ) | const
| pure virtual

Implemented in AnimationSplashScreenCreator, AnimKnobCreator, AutoAnimationCreator, CheckBoxCreator, ControlCreator, GradientViewCreator, KnobBaseCreator, KnobCreator, LayeredViewContainerCreator, MultiBitmapControlCreator, MultiLineTextLabelCreator, OptionMenuCreator, ParamDisplayCreator, RowColumnViewCreator, ScrollViewCreator, SearchTextEditCreator, SegmentButtonCreator, ShadowViewContainerCreator, SliderBaseCreator, SliderCreator, SplitViewCreator, StringListControlCreator, SwitchBaseCreator, TextButtonCreator, TextEditCreator, TextLabelCreator, UIViewSwitchContainerCreator, ViewContainerCreator, ViewCreator, VuMeterCreator, XYPadCreator, and ViewCreatorAdapter.

## ◆ getAttributeValue()

virtual bool getAttributeValue | ( | CView * | view,
|  | const string & | attributeName,
|  | string & | stringValue,
|  | const IUIDescription * | desc ) const
| pure virtual

Implemented in AnimationSplashScreenCreator, AnimKnobCreator, AutoAnimationCreator, CheckBoxCreator, ControlCreator, GradientViewCreator, KnobBaseCreator, KnobCreator, LayeredViewContainerCreator, MultiBitmapControlCreator, MultiLineTextLabelCreator, OptionMenuCreator, ParamDisplayCreator, RowColumnViewCreator, ScrollViewCreator, SearchTextEditCreator, SegmentButtonCreator, ShadowViewContainerCreator, SliderBaseCreator, SliderCreator, SplitViewCreator, StringListControlCreator, SwitchBaseCreator, TextButtonCreator, TextEditCreator, TextLabelCreator, UIViewSwitchContainerCreator, ViewContainerCreator, ViewCreator, VuMeterCreator, XYPadCreator, and ViewCreatorAdapter.

## ◆ getAttributeValueRange()

virtual bool getAttributeValueRange | ( | const string & | attributeName,
|  | double & | minValue,
|  | double & | maxValue ) const
| pure virtual

Implemented in GradientViewCreator, ParamDisplayCreator, ShadowViewContainerCreator, ViewCreator, and ViewCreatorAdapter.

## ◆ getBaseViewName()

virtual IdStringPtr getBaseViewName | ( |  | ) | const
| pure virtual

Implemented in AnimationSplashScreenCreator, AnimKnobCreator, AutoAnimationCreator, CheckBoxCreator, ControlCreator, GradientViewCreator, HorizontalSwitchCreator, KickButtonCreator, KnobCreator, LayeredViewContainerCreator, MovieBitmapCreator, MovieButtonCreator, MultiLineTextLabelCreator, OnOffButtonCreator, OptionMenuCreator, ParamDisplayCreator, RockerSwitchCreator, RowColumnViewCreator, ScrollViewCreator, SearchTextEditCreator, SegmentButtonCreator, ShadowViewContainerCreator, SliderCreator, SplitViewCreator, StringListControlCreator, TextButtonCreator, TextEditCreator, TextLabelCreator, UIViewSwitchContainerCreator, VerticalSwitchCreator, ViewContainerCreator, ViewCreator, VuMeterCreator, and XYPadCreator.

## ◆ getDisplayName()

virtual UTF8StringPtr getDisplayName | ( |  | ) | const
| pure virtual

Implemented in AnimationSplashScreenCreator, AnimKnobCreator, AutoAnimationCreator, CheckBoxCreator, ControlCreator, GradientViewCreator, HorizontalSwitchCreator, KickButtonCreator, KnobCreator, LayeredViewContainerCreator, MovieBitmapCreator, MovieButtonCreator, MultiLineTextLabelCreator, OnOffButtonCreator, OptionMenuCreator, ParamDisplayCreator, RockerSwitchCreator, RowColumnViewCreator, ScrollViewCreator, SearchTextEditCreator, SegmentButtonCreator, ShadowViewContainerCreator, SliderCreator, SplitViewCreator, StringListControlCreator, TextButtonCreator, TextEditCreator, TextLabelCreator, UIViewSwitchContainerCreator, VerticalSwitchCreator, ViewContainerCreator, ViewCreator, VuMeterCreator, XYPadCreator, and ViewCreatorAdapter.

## ◆ getPossibleListValues()

virtual bool getPossibleListValues | ( | const string & | attributeName,
|  | ConstStringPtrList & | values ) const
| pure virtual

Implemented in GradientViewCreator, MultiLineTextLabelCreator, RowColumnViewCreator, SegmentButtonCreator, SliderBaseCreator, SplitViewCreator, TextButtonCreator, TextLabelCreator, UIViewSwitchContainerCreator, ViewContainerCreator, VuMeterCreator, and ViewCreatorAdapter.

## ◆ getViewName()

virtual IdStringPtr getViewName | ( |  | ) | const
| pure virtual

Implemented in AnimationSplashScreenCreator, AnimKnobCreator, AutoAnimationCreator, CheckBoxCreator, ControlCreator, GradientViewCreator, HorizontalSwitchCreator, KickButtonCreator, KnobCreator, LayeredViewContainerCreator, MovieBitmapCreator, MovieButtonCreator, MultiLineTextLabelCreator, OnOffButtonCreator, OptionMenuCreator, ParamDisplayCreator, RockerSwitchCreator, RowColumnViewCreator, ScrollViewCreator, SearchTextEditCreator, SegmentButtonCreator, ShadowViewContainerCreator, SliderCreator, SplitViewCreator, StringListControlCreator, TextButtonCreator, TextEditCreator, TextLabelCreator, UIViewSwitchContainerCreator, VerticalSwitchCreator, ViewContainerCreator, ViewCreator, VuMeterCreator, and XYPadCreator.

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

- iviewcreator.h