VSTGUI  4.10
Graphical User Interface Framework not only for VST plugins
UIDescription Class Reference

XML description parser and view creator. More...

+ Inheritance diagram for UIDescription:

Classes

struct  Impl
 

Public Types

enum  SaveFlags {
  kWriteWindowsResourceFile = 1 << WriteWindowsResourceFileBit, kWriteImagesIntoUIDescFile = 1 << WriteImagesIntoUIDescFileBit, kDoNotVerifyImageData = 1 << DoNotVerifyImageDataBit, kWriteAsXML = 1 << WriteAsXmlBit,
  kWriteImagesIntoXMLFile = kWriteImagesIntoUIDescFile, kDoNotVerifyImageXMLData = kDoNotVerifyImageData
}
 
using FocusDrawing = FocusDrawingSettings
 

Public Member Functions

 UIDescription (const CResourceDescription &uidescFile, IViewFactory *viewFactory=nullptr)
 
 UIDescription (IContentProvider *contentProvider, IViewFactory *viewFactory=nullptr)
 
 ~UIDescription () noexcept override
 
virtual bool parse ()
 
virtual bool save (UTF8StringPtr filename, int32_t flags=kWriteWindowsResourceFile)
 
virtual bool saveWindowsRCFile (UTF8StringPtr filename)
 
bool storeViews (const std::list< CView * > &views, OutputStream &stream, UIAttributes *customData=nullptr) const
 
bool restoreViews (InputStream &stream, std::list< SharedPointer< CView > > &views, UIAttributes **customData=nullptr)
 
UTF8StringPtr getFilePath () const
 
void setFilePath (UTF8StringPtr path)
 
void setSharedResources (const SharedPointer< UIDescription > &resources)
 
const SharedPointer< UIDescription > & getSharedResources () const
 
const UIAttributesgetViewAttributes (UTF8StringPtr name) const
 
void setController (IController *controller) const
 
CViewcreateView (UTF8StringPtr name, IController *controller) const override
 
CBitmapgetBitmap (UTF8StringPtr name) const override
 
CFontRef getFont (UTF8StringPtr name) const override
 
bool getColor (UTF8StringPtr name, CColor &color) const override
 
CGradientgetGradient (UTF8StringPtr name) const override
 
int32_t getTagForName (UTF8StringPtr name) const override
 
IControlListenergetControlListener (UTF8StringPtr name) const override
 
IControllergetController () const override
 
const IViewFactorygetViewFactory () const override
 
UTF8StringPtr lookupColorName (const CColor &color) const override
 
UTF8StringPtr lookupFontName (const CFontRef font) const override
 
UTF8StringPtr lookupBitmapName (const CBitmap *bitmap) const override
 
UTF8StringPtr lookupGradientName (const CGradient *gradient) const override
 
UTF8StringPtr lookupControlTagName (const int32_t tag) const override
 
bool getVariable (UTF8StringPtr name, double &value) const override
 
bool getVariable (UTF8StringPtr name, std::string &value) const override
 
void collectTemplateViewNames (std::list< const std::string * > &names) const override
 
void collectColorNames (std::list< const std::string * > &names) const override
 
void collectFontNames (std::list< const std::string * > &names) const override
 
void collectBitmapNames (std::list< const std::string * > &names) const override
 
void collectGradientNames (std::list< const std::string * > &names) const override
 
void collectControlTagNames (std::list< const std::string * > &names) const override
 
void changeColorName (UTF8StringPtr oldName, UTF8StringPtr newName)
 
void changeTagName (UTF8StringPtr oldName, UTF8StringPtr newName)
 
void changeFontName (UTF8StringPtr oldName, UTF8StringPtr newName)
 
void changeBitmapName (UTF8StringPtr oldName, UTF8StringPtr newName)
 
void changeGradientName (UTF8StringPtr oldName, UTF8StringPtr newName)
 
void changeColor (UTF8StringPtr name, const CColor &newColor)
 
void changeFont (UTF8StringPtr name, CFontRef newFont)
 
void changeGradient (UTF8StringPtr name, CGradient *newGradient)
 
void changeBitmap (UTF8StringPtr name, UTF8StringPtr newName, const CRect *nineparttiledOffset=nullptr)
 
void changeBitmapFilters (UTF8StringPtr bitmapName, const std::list< SharedPointer< UIAttributes > > &filters)
 
void collectBitmapFilters (UTF8StringPtr bitmapName, std::list< SharedPointer< UIAttributes > > &filters) const
 
void removeColor (UTF8StringPtr name)
 
void removeTag (UTF8StringPtr name)
 
void removeFont (UTF8StringPtr name)
 
void removeBitmap (UTF8StringPtr name)
 
void removeGradient (UTF8StringPtr name)
 
void changeAlternativeFontNames (UTF8StringPtr name, UTF8StringPtr alternativeFonts)
 
bool getAlternativeFontNames (UTF8StringPtr name, std::string &alternativeFonts) const
 
bool hasColorName (UTF8StringPtr name) const
 
bool hasTagName (UTF8StringPtr name) const
 
bool hasFontName (UTF8StringPtr name) const
 
bool hasBitmapName (UTF8StringPtr name) const
 
bool hasGradientName (UTF8StringPtr name) const
 
void updateViewDescription (UTF8StringPtr name, CView *view)
 
bool getTemplateNameFromView (CView *view, std::string &templateName) const
 
bool addNewTemplate (UTF8StringPtr name, const SharedPointer< UIAttributes > &attr)
 
bool removeTemplate (UTF8StringPtr name)
 
bool changeTemplateName (UTF8StringPtr name, UTF8StringPtr newName)
 
bool duplicateTemplate (UTF8StringPtr name, UTF8StringPtr duplicateName)
 
bool setCustomAttributes (UTF8StringPtr name, const SharedPointer< UIAttributes > &attr)
 
SharedPointer< UIAttributesgetCustomAttributes (UTF8StringPtr name) const
 
SharedPointer< UIAttributesgetCustomAttributes (UTF8StringPtr name, bool create)
 
bool getControlTagString (UTF8StringPtr tagName, std::string &tagString) const
 
bool changeControlTagString (UTF8StringPtr tagName, const std::string &newTagString, bool create=false)
 
bool calculateStringValue (UTF8StringPtr str, double &result) const
 
void registerListener (UIDescriptionListener *listener)
 
void unregisterListener (UIDescriptionListener *listener)
 
void setBitmapCreator (IBitmapCreator *bitmapCreator)
 
void setBitmapCreator2 (IBitmapCreator2 *bitmapCreator)
 
FocusDrawing getFocusDrawingSettings () const
 
void setFocusDrawingSettings (const FocusDrawing &fd)
 
void freePlatformResources ()
 
SharedPointer< UINode > getRootNode () const
 
- Public Member Functions inherited from ReferenceCounted< T >
 ReferenceCounted ()=default
 
virtual ~ReferenceCounted () noexcept=default
 
 ReferenceCounted (const ReferenceCounted &)
 
ReferenceCountedoperator= (const ReferenceCounted &)
 
void forget () override
 decrease refcount and delete object if refcount == 0 More...
 
void remember () override
 increase refcount More...
 
virtual int32_t getNbReference () const
 get refcount More...
 
virtual void beforeDelete ()
 
- Public Member Functions inherited from IUIDescription
virtual ~IUIDescription () noexcept=default
 

Static Public Attributes

static CViewAttributeID kTemplateNameAttributeID = 'uitl'
 
- Static Public Attributes inherited from IUIDescription
static IdStringPtr kCustomViewName = "custom-view-name"
 

Protected Types

enum  SaveFlagBits {
  WriteWindowsResourceFileBit = 0, WriteImagesIntoUIDescFileBit, DoNotVerifyImageDataBit, WriteAsXmlBit,
  LastSaveFlagBit
}
 

Protected Member Functions

void addDefaultNodes ()
 
bool saveToStream (OutputStream &stream, int32_t flags)
 
bool parsed () const
 
void setContentProvider (IContentProvider *provider)
 
const CResourceDescriptiongetUIDescFile () const
 

Detailed Description

XML description parser and view creator.

Member Typedef Documentation

◆ FocusDrawing

Member Enumeration Documentation

◆ SaveFlagBits

enum SaveFlagBits
protected
Enumerator
WriteWindowsResourceFileBit 
WriteImagesIntoUIDescFileBit 
DoNotVerifyImageDataBit 
WriteAsXmlBit 
LastSaveFlagBit 

◆ SaveFlags

enum SaveFlags
Enumerator
kWriteWindowsResourceFile 
kWriteImagesIntoUIDescFile 
kDoNotVerifyImageData 
kWriteAsXML 
kWriteImagesIntoXMLFile 
kDoNotVerifyImageXMLData 

Constructor & Destructor Documentation

◆ UIDescription() [1/2]

UIDescription ( const CResourceDescription uidescFile,
IViewFactory viewFactory = nullptr 
)

◆ UIDescription() [2/2]

UIDescription ( IContentProvider contentProvider,
IViewFactory viewFactory = nullptr 
)

◆ ~UIDescription()

~UIDescription ( )
overridenoexcept

Member Function Documentation

◆ addDefaultNodes()

void addDefaultNodes ( )
protected

◆ addNewTemplate()

bool addNewTemplate ( UTF8StringPtr  name,
const SharedPointer< UIAttributes > &  attr 
)

◆ calculateStringValue()

bool calculateStringValue ( UTF8StringPtr  str,
double &  result 
) const

◆ changeAlternativeFontNames()

void changeAlternativeFontNames ( UTF8StringPtr  name,
UTF8StringPtr  alternativeFonts 
)

◆ changeBitmap()

void changeBitmap ( UTF8StringPtr  name,
UTF8StringPtr  newName,
const CRect nineparttiledOffset = nullptr 
)

◆ changeBitmapFilters()

void changeBitmapFilters ( UTF8StringPtr  bitmapName,
const std::list< SharedPointer< UIAttributes > > &  filters 
)

◆ changeBitmapName()

void changeBitmapName ( UTF8StringPtr  oldName,
UTF8StringPtr  newName 
)

◆ changeColor()

void changeColor ( UTF8StringPtr  name,
const CColor newColor 
)

◆ changeColorName()

void changeColorName ( UTF8StringPtr  oldName,
UTF8StringPtr  newName 
)

◆ changeControlTagString()

bool changeControlTagString ( UTF8StringPtr  tagName,
const std::string &  newTagString,
bool  create = false 
)

◆ changeFont()

void changeFont ( UTF8StringPtr  name,
CFontRef  newFont 
)

◆ changeFontName()

void changeFontName ( UTF8StringPtr  oldName,
UTF8StringPtr  newName 
)

◆ changeGradient()

void changeGradient ( UTF8StringPtr  name,
CGradient newGradient 
)

◆ changeGradientName()

void changeGradientName ( UTF8StringPtr  oldName,
UTF8StringPtr  newName 
)

◆ changeTagName()

void changeTagName ( UTF8StringPtr  oldName,
UTF8StringPtr  newName 
)

◆ changeTemplateName()

bool changeTemplateName ( UTF8StringPtr  name,
UTF8StringPtr  newName 
)

◆ collectBitmapFilters()

void collectBitmapFilters ( UTF8StringPtr  bitmapName,
std::list< SharedPointer< UIAttributes > > &  filters 
) const

◆ collectBitmapNames()

void collectBitmapNames ( std::list< const std::string * > &  names) const
overridevirtual

Implements IUIDescription.

◆ collectColorNames()

void collectColorNames ( std::list< const std::string * > &  names) const
overridevirtual

Implements IUIDescription.

◆ collectControlTagNames()

void collectControlTagNames ( std::list< const std::string * > &  names) const
overridevirtual

Implements IUIDescription.

◆ collectFontNames()

void collectFontNames ( std::list< const std::string * > &  names) const
overridevirtual

Implements IUIDescription.

◆ collectGradientNames()

void collectGradientNames ( std::list< const std::string * > &  names) const
overridevirtual

Implements IUIDescription.

◆ collectTemplateViewNames()

void collectTemplateViewNames ( std::list< const std::string * > &  names) const
overridevirtual

Implements IUIDescription.

◆ createView()

CView * createView ( UTF8StringPtr  name,
IController controller 
) const
overridevirtual

Implements IUIDescription.

◆ duplicateTemplate()

bool duplicateTemplate ( UTF8StringPtr  name,
UTF8StringPtr  duplicateName 
)

◆ freePlatformResources()

void freePlatformResources ( )

◆ getAlternativeFontNames()

bool getAlternativeFontNames ( UTF8StringPtr  name,
std::string &  alternativeFonts 
) const

◆ getBitmap()

CBitmap * getBitmap ( UTF8StringPtr  name) const
overridevirtual

Implements IUIDescription.

◆ getColor()

bool getColor ( UTF8StringPtr  name,
CColor color 
) const
overridevirtual

Implements IUIDescription.

◆ getController()

IController * getController ( ) const
overridevirtual

Implements IUIDescription.

◆ getControlListener()

IControlListener * getControlListener ( UTF8StringPtr  name) const
overridevirtual

Implements IUIDescription.

◆ getControlTagString()

bool getControlTagString ( UTF8StringPtr  tagName,
std::string &  tagString 
) const

◆ getCustomAttributes() [1/2]

SharedPointer< UIAttributes > getCustomAttributes ( UTF8StringPtr  name) const

◆ getCustomAttributes() [2/2]

SharedPointer< UIAttributes > getCustomAttributes ( UTF8StringPtr  name,
bool  create 
)

◆ getFilePath()

UTF8StringPtr getFilePath ( ) const

◆ getFocusDrawingSettings()

UIDescription::FocusDrawing getFocusDrawingSettings ( ) const

◆ getFont()

CFontRef getFont ( UTF8StringPtr  name) const
overridevirtual

Implements IUIDescription.

◆ getGradient()

CGradient * getGradient ( UTF8StringPtr  name) const
overridevirtual

Implements IUIDescription.

◆ getRootNode()

auto getRootNode ( ) const

◆ getSharedResources()

const SharedPointer< UIDescription > & getSharedResources ( ) const

◆ getTagForName()

int32_t getTagForName ( UTF8StringPtr  name) const
overridevirtual

Implements IUIDescription.

◆ getTemplateNameFromView()

bool getTemplateNameFromView ( CView view,
std::string &  templateName 
) const

◆ getUIDescFile()

const CResourceDescription & getUIDescFile ( ) const
protected

◆ getVariable() [1/2]

bool getVariable ( UTF8StringPtr  name,
double &  value 
) const
overridevirtual

Implements IUIDescription.

◆ getVariable() [2/2]

bool getVariable ( UTF8StringPtr  name,
std::string &  value 
) const
overridevirtual

Implements IUIDescription.

◆ getViewAttributes()

const UIAttributes * getViewAttributes ( UTF8StringPtr  name) const

◆ getViewFactory()

const IViewFactory * getViewFactory ( ) const
overridevirtual

Implements IUIDescription.

◆ hasBitmapName()

bool hasBitmapName ( UTF8StringPtr  name) const

◆ hasColorName()

bool hasColorName ( UTF8StringPtr  name) const

◆ hasFontName()

bool hasFontName ( UTF8StringPtr  name) const

◆ hasGradientName()

bool hasGradientName ( UTF8StringPtr  name) const

◆ hasTagName()

bool hasTagName ( UTF8StringPtr  name) const

◆ lookupBitmapName()

UTF8StringPtr lookupBitmapName ( const CBitmap bitmap) const
overridevirtual

Implements IUIDescription.

◆ lookupColorName()

UTF8StringPtr lookupColorName ( const CColor color) const
overridevirtual

Implements IUIDescription.

◆ lookupControlTagName()

UTF8StringPtr lookupControlTagName ( const int32_t  tag) const
overridevirtual

Implements IUIDescription.

◆ lookupFontName()

UTF8StringPtr lookupFontName ( const CFontRef  font) const
overridevirtual

Implements IUIDescription.

◆ lookupGradientName()

UTF8StringPtr lookupGradientName ( const CGradient gradient) const
overridevirtual

Implements IUIDescription.

◆ parse()

bool parse ( )
virtual

Reimplemented in CompressedUIDescription.

◆ parsed()

bool parsed ( ) const
protected

◆ registerListener()

void registerListener ( UIDescriptionListener listener)

◆ removeBitmap()

void removeBitmap ( UTF8StringPtr  name)

◆ removeColor()

void removeColor ( UTF8StringPtr  name)

◆ removeFont()

void removeFont ( UTF8StringPtr  name)

◆ removeGradient()

void removeGradient ( UTF8StringPtr  name)

◆ removeTag()

void removeTag ( UTF8StringPtr  name)

◆ removeTemplate()

bool removeTemplate ( UTF8StringPtr  name)

◆ restoreViews()

bool restoreViews ( InputStream stream,
std::list< SharedPointer< CView > > &  views,
UIAttributes **  customData = nullptr 
)

◆ save()

bool save ( UTF8StringPtr  filename,
int32_t  flags = kWriteWindowsResourceFile 
)
virtual

Reimplemented in CompressedUIDescription.

◆ saveToStream()

bool saveToStream ( OutputStream stream,
int32_t  flags 
)
protected

◆ saveWindowsRCFile()

bool saveWindowsRCFile ( UTF8StringPtr  filename)
virtual

◆ setBitmapCreator()

void setBitmapCreator ( IBitmapCreator bitmapCreator)

◆ setBitmapCreator2()

void setBitmapCreator2 ( IBitmapCreator2 bitmapCreator)

◆ setContentProvider()

void setContentProvider ( IContentProvider provider)
protected

◆ setController()

void setController ( IController controller) const

◆ setCustomAttributes()

bool setCustomAttributes ( UTF8StringPtr  name,
const SharedPointer< UIAttributes > &  attr 
)

◆ setFilePath()

void setFilePath ( UTF8StringPtr  path)

◆ setFocusDrawingSettings()

void setFocusDrawingSettings ( const FocusDrawing fd)

◆ setSharedResources()

void setSharedResources ( const SharedPointer< UIDescription > &  resources)

◆ storeViews()

bool storeViews ( const std::list< CView * > &  views,
OutputStream stream,
UIAttributes customData = nullptr 
) const

◆ unregisterListener()

void unregisterListener ( UIDescriptionListener listener)

◆ updateViewDescription()

void updateViewDescription ( UTF8StringPtr  name,
CView view 
)

Member Data Documentation

◆ kTemplateNameAttributeID

CViewAttributeID kTemplateNameAttributeID = 'uitl'
static

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