VSTGUI  4.3
Graphical User Interface Framework not only for VST plugins
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Groups Pages
UIDescription Class Reference

XML description parser and view creator. More...

+ Inheritance diagram for UIDescription:
+ Collaboration diagram for UIDescription:

Public Types

enum  SaveFlags { kWriteWindowsResourceFile = 1 << 0, kWriteImagesIntoXMLFile = 1 << 1 }
 

Public Member Functions

 UIDescription (const CResourceDescription &xmlFile, IViewFactory *viewFactory=0)
 
 UIDescription (Xml::IContentProvider *xmlContentProvider, IViewFactory *viewFactory=0)
 
 ~UIDescription ()
 
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=0) const
 
bool restoreViews (InputStream &stream, std::list< SharedPointer< CView > > &views, UIAttributes **customData=0)
 
UTF8StringPtr getFilePath () const
 
void setFilePath (UTF8StringPtr path)
 
const UIAttributesgetViewAttributes (UTF8StringPtr name) const
 
void setController (IController *controller) const
 
CViewcreateView (UTF8StringPtr name, IController *controller) const
 
CBitmapgetBitmap (UTF8StringPtr name) const
 
CFontRef getFont (UTF8StringPtr name) const
 
bool getColor (UTF8StringPtr name, CColor &color) const
 
CGradientgetGradient (UTF8StringPtr name) const
 
int32_t getTagForName (UTF8StringPtr name) const
 
IControlListenergetControlListener (UTF8StringPtr name) const
 
IControllergetController () const
 
const IViewFactorygetViewFactory () const
 
UTF8StringPtr lookupColorName (const CColor &color) const
 
UTF8StringPtr lookupFontName (const CFontRef font) const
 
UTF8StringPtr lookupBitmapName (const CBitmap *bitmap) const
 
UTF8StringPtr lookupGradientName (const CGradient *gradient) const
 
UTF8StringPtr lookupControlTagName (const int32_t tag) const
 
bool getVariable (UTF8StringPtr name, double &value) const
 
bool getVariable (UTF8StringPtr name, std::string &value) const
 
void collectTemplateViewNames (std::list< const std::string * > &names) const
 
void collectColorNames (std::list< const std::string * > &names) const
 
void collectFontNames (std::list< const std::string * > &names) const
 
void collectBitmapNames (std::list< const std::string * > &names) const
 
void collectGradientNames (std::list< const std::string * > &names) const
 
void collectControlTagNames (std::list< const std::string * > &names) const
 
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=0)
 
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, UIAttributes *attr)
 
bool removeTemplate (UTF8StringPtr name)
 
bool changeTemplateName (UTF8StringPtr name, UTF8StringPtr newName)
 
bool duplicateTemplate (UTF8StringPtr name, UTF8StringPtr duplicateName)
 
bool setCustomAttributes (UTF8StringPtr name, UIAttributes *attr)
 
UIAttributesgetCustomAttributes (UTF8StringPtr name, bool create=false)
 
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 setBitmapCreator (IBitmapCreator *bitmapCreator)
 
virtual void beforeDelete ()
 
virtual void addDependency (CBaseObject *obj)
 
virtual void removeDependency (CBaseObject *obj)
 
virtual void changed (IdStringPtr message)
 
virtual void deferChanges (bool state)
 
Reference Counting Methods
virtual void forget ()
 decrease refcount and delete object if refcount == 0 More...
 
virtual void remember ()
 increase refcount More...
 
virtual int32_t getNbReference () const
 get refcount More...
 
Message Methods
virtual CMessageResult notify (CBaseObject *sender, IdStringPtr message)
 

Static Public Member Functions

static bool parseColor (const std::string &colorString, CColor &color)
 

Static Public Attributes

static CViewAttributeID kTemplateNameAttributeID = 'uitl'
 
static IdStringPtr kMessageTagChanged = "kMessageTagChanged"
 
static IdStringPtr kMessageColorChanged = "kMessageColorChanged"
 
static IdStringPtr kMessageFontChanged = "kMessageFontChanged"
 
static IdStringPtr kMessageBitmapChanged = "kMessageBitmapChanged"
 
static IdStringPtr kMessageTemplateChanged = "kMessageTemplateChanged"
 
static IdStringPtr kMessageGradientChanged = "kMessageGradientChanged"
 
static IdStringPtr kMessageBeforeSave = "kMessageBeforeSave"
 
static IdStringPtr kCustomViewName = "custom-view-name"
 

Protected Types

typedef std::set< IdStringPtrDeferedChangesSet
 
typedef std::list< CBaseObject * > DependentList
 

Protected Member Functions

CViewcreateViewFromNode (UINode *node) const
 
UINode * getBaseNode (UTF8StringPtr name) const
 
UINode * findChildNodeByNameAttribute (UINode *node, UTF8StringPtr nameAttribute) const
 
UINode * findNodeForView (CView *view) const
 
bool updateAttributesForView (UINode *node, CView *view, bool deep=true)
 
void removeNode (UTF8StringPtr name, IdStringPtr mainNodeName, IdStringPtr changeMsg)
 
template<typename NodeType , typename ObjType , typename CompareFunction >
UTF8StringPtr lookupName (const ObjType &obj, IdStringPtr mainNodeName, CompareFunction compare) const
 
template<typename NodeType >
void changeNodeName (UTF8StringPtr oldName, UTF8StringPtr newName, IdStringPtr mainNodeName, IdStringPtr changeMsg)
 
template<typename NodeType >
void collectNamesFromNode (IdStringPtr mainNodeName, std::list< const std::string * > &names) const
 
void addDefaultNodes ()
 
bool saveToStream (OutputStream &stream, int32_t flags)
 
void startXmlElement (Xml::Parser *parser, IdStringPtr elementName, UTF8StringPtr *elementAttributes)
 
void endXmlElement (Xml::Parser *parser, IdStringPtr name)
 
void xmlCharData (Xml::Parser *parser, const int8_t *data, int32_t length)
 
void xmlComment (Xml::Parser *parser, IdStringPtr comment)
 

Static Protected Member Functions

static void rememberObject (CBaseObject *obj)
 
static void forgetObject (CBaseObject *obj)
 

Protected Attributes

CResourceDescription xmlFile
 
std::string filePath
 
UINode * nodes
 
IControllercontroller
 
IViewFactoryviewFactory
 
Xml::IContentProviderxmlContentProvider
 
IBitmapCreatorbitmapCreator
 
std::deque< IController * > subControllerStack
 
std::deque< UINode * > nodeStack
 
bool restoreViewsMode
 
int32_t deferChangeCount
 
DeferedChangesSet deferedChanges
 
DependentList dependents
 

Detailed Description

XML description parser and view creator.

Member Typedef Documentation

typedef std::set<IdStringPtr> DeferedChangesSet
protectedinherited
typedef std::list<CBaseObject*> DependentList
protectedinherited

Member Enumeration Documentation

enum SaveFlags
Enumerator
kWriteWindowsResourceFile 
kWriteImagesIntoXMLFile 

Constructor & Destructor Documentation

UIDescription ( const CResourceDescription xmlFile,
IViewFactory viewFactory = 0 
)

+ Here is the call graph for this function:

UIDescription ( Xml::IContentProvider xmlContentProvider,
IViewFactory viewFactory = 0 
)

+ Here is the call graph for this function:

Member Function Documentation

void addDefaultNodes ( )
protected

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void addDependency ( CBaseObject obj)
inlinevirtualinherited

add a dependent object

+ Here is the caller graph for this function:

bool addNewTemplate ( UTF8StringPtr  name,
UIAttributes attr 
)

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

virtual void beforeDelete ( )
inlinevirtualinherited

Reimplemented in CView.

+ Here is the caller graph for this function:

bool calculateStringValue ( UTF8StringPtr  str,
double &  result 
) const

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void changeAlternativeFontNames ( UTF8StringPtr  name,
UTF8StringPtr  alternativeFonts 
)

+ Here is the call graph for this function:

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

+ Here is the call graph for this function:

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

+ Here is the call graph for this function:

void changeBitmapName ( UTF8StringPtr  oldName,
UTF8StringPtr  newName 
)
void changeColor ( UTF8StringPtr  name,
const CColor newColor 
)

+ Here is the call graph for this function:

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

+ Here is the call graph for this function:

void changed ( IdStringPtr  message)
inlinevirtualinherited

notify dependent objects of change with message.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void changeFont ( UTF8StringPtr  name,
CFontRef  newFont 
)

+ Here is the call graph for this function:

void changeFontName ( UTF8StringPtr  oldName,
UTF8StringPtr  newName 
)
void changeGradient ( UTF8StringPtr  name,
CGradient newGradient 
)

+ Here is the call graph for this function:

void changeGradientName ( UTF8StringPtr  oldName,
UTF8StringPtr  newName 
)
void changeNodeName ( UTF8StringPtr  oldName,
UTF8StringPtr  newName,
IdStringPtr  mainNodeName,
IdStringPtr  changeMsg 
)
protected

+ Here is the call graph for this function:

void changeTagName ( UTF8StringPtr  oldName,
UTF8StringPtr  newName 
)
bool changeTemplateName ( UTF8StringPtr  name,
UTF8StringPtr  newName 
)

+ Here is the call graph for this function:

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

+ Here is the call graph for this function:

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

Implements IUIDescription.

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

Implements IUIDescription.

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

Implements IUIDescription.

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

Implements IUIDescription.

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

Implements IUIDescription.

void collectNamesFromNode ( IdStringPtr  mainNodeName,
std::list< const std::string * > &  names 
) const
protected

+ Here is the call graph for this function:

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

Implements IUIDescription.

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

Implements IUIDescription.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

CView * createViewFromNode ( UINode *  node) const
protected

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void deferChanges ( bool  state)
inlinevirtualinherited

defer changes until later. can be nested. If you use this, you must make sure that all message pointers are valid the whole time.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool duplicateTemplate ( UTF8StringPtr  name,
UTF8StringPtr  duplicateName 
)

+ Here is the call graph for this function:

void endXmlElement ( Xml::Parser parser,
IdStringPtr  name 
)
protectedvirtual

Implements IHandler.

UINode * findChildNodeByNameAttribute ( UINode *  node,
UTF8StringPtr  nameAttribute 
) const
protected

+ Here is the caller graph for this function:

UINode * findNodeForView ( CView view) const
protected

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

virtual void forget ( )
inlinevirtualinherited

decrease refcount and delete object if refcount == 0

+ Here is the call graph for this function:

static void forgetObject ( CBaseObject obj)
inlinestaticprotectedinherited

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

+ Here is the call graph for this function:

UINode * getBaseNode ( UTF8StringPtr  name) const
protected

+ Here is the caller graph for this function:

CBitmap * getBitmap ( UTF8StringPtr  name) const
virtual

Implements IUIDescription.

+ Here is the call graph for this function:

bool getColor ( UTF8StringPtr  name,
CColor color 
) const
virtual

Implements IUIDescription.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

IController* getController ( ) const
inlinevirtual

Implements IUIDescription.

IControlListener * getControlListener ( UTF8StringPtr  name) const
virtual

Implements IUIDescription.

+ Here is the call graph for this function:

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

+ Here is the call graph for this function:

UIAttributes * getCustomAttributes ( UTF8StringPtr  name,
bool  create = false 
)

+ Here is the call graph for this function:

UTF8StringPtr getFilePath ( ) const
inline
CFontRef getFont ( UTF8StringPtr  name) const
virtual

Implements IUIDescription.

+ Here is the call graph for this function:

CGradient * getGradient ( UTF8StringPtr  name) const
virtual

Implements IUIDescription.

+ Here is the call graph for this function:

virtual int32_t getNbReference ( ) const
inlinevirtualinherited

get refcount

int32_t getTagForName ( UTF8StringPtr  name) const
virtual

Implements IUIDescription.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

Implements IUIDescription.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

Implements IUIDescription.

+ Here is the call graph for this function:

const UIAttributes * getViewAttributes ( UTF8StringPtr  name) const

+ Here is the caller graph for this function:

const IViewFactory* getViewFactory ( ) const
inlinevirtual

Implements IUIDescription.

bool hasBitmapName ( UTF8StringPtr  name) const

+ Here is the call graph for this function:

bool hasColorName ( UTF8StringPtr  name) const

+ Here is the call graph for this function:

bool hasFontName ( UTF8StringPtr  name) const

+ Here is the call graph for this function:

bool hasGradientName ( UTF8StringPtr  name) const

+ Here is the call graph for this function:

bool hasTagName ( UTF8StringPtr  name) const

+ Here is the call graph for this function:

UTF8StringPtr lookupBitmapName ( const CBitmap bitmap) const
virtual

Implements IUIDescription.

UTF8StringPtr lookupColorName ( const CColor color) const
virtual

Implements IUIDescription.

UTF8StringPtr lookupControlTagName ( const int32_t  tag) const
virtual

Implements IUIDescription.

+ Here is the call graph for this function:

UTF8StringPtr lookupFontName ( const CFontRef  font) const
virtual

Implements IUIDescription.

UTF8StringPtr lookupGradientName ( const CGradient gradient) const
virtual

Implements IUIDescription.

+ Here is the call graph for this function:

UTF8StringPtr lookupName ( const ObjType &  obj,
IdStringPtr  mainNodeName,
CompareFunction  compare 
) const
protected

+ Here is the call graph for this function:

bool parse ( )
virtual

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool parseColor ( const std::string &  colorString,
CColor color 
)
static

+ Here is the caller graph for this function:

virtual void remember ( )
inlinevirtualinherited

increase refcount

+ Here is the caller graph for this function:

static void rememberObject ( CBaseObject obj)
inlinestaticprotectedinherited

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void removeBitmap ( UTF8StringPtr  name)

+ Here is the call graph for this function:

void removeColor ( UTF8StringPtr  name)

+ Here is the call graph for this function:

void removeDependency ( CBaseObject obj)
inlinevirtualinherited

remove a dependent object.

+ Here is the caller graph for this function:

void removeFont ( UTF8StringPtr  name)

+ Here is the call graph for this function:

void removeGradient ( UTF8StringPtr  name)

+ Here is the call graph for this function:

void removeNode ( UTF8StringPtr  name,
IdStringPtr  mainNodeName,
IdStringPtr  changeMsg 
)
protected

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void removeTag ( UTF8StringPtr  name)

+ Here is the call graph for this function:

bool removeTemplate ( UTF8StringPtr  name)

+ Here is the call graph for this function:

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

+ Here is the call graph for this function:

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

+ Here is the call graph for this function:

bool saveToStream ( OutputStream stream,
int32_t  flags 
)
protected

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool saveWindowsRCFile ( UTF8StringPtr  filename)
virtual

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void setBitmapCreator ( IBitmapCreator bitmapCreator)
void setController ( IController controller) const

+ Here is the caller graph for this function:

bool setCustomAttributes ( UTF8StringPtr  name,
UIAttributes attr 
)

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void setFilePath ( UTF8StringPtr  path)

+ Here is the caller graph for this function:

void startXmlElement ( Xml::Parser parser,
IdStringPtr  elementName,
UTF8StringPtr elementAttributes 
)
protectedvirtual

Implements IHandler.

+ Here is the call graph for this function:

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

+ Here is the call graph for this function:

bool updateAttributesForView ( UINode *  node,
CView view,
bool  deep = true 
)
protected

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void updateViewDescription ( UTF8StringPtr  name,
CView view 
)

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void xmlCharData ( Xml::Parser parser,
const int8_t *  data,
int32_t  length 
)
protectedvirtual

Implements IHandler.

void xmlComment ( Xml::Parser parser,
IdStringPtr  comment 
)
protectedvirtual

Implements IHandler.

Member Data Documentation

IBitmapCreator* bitmapCreator
protected
IController* controller
mutableprotected
int32_t deferChangeCount
protectedinherited
DeferedChangesSet deferedChanges
protectedinherited
DependentList dependents
protectedinherited
std::string filePath
protected
IdStringPtr kCustomViewName = "custom-view-name"
staticinherited
IdStringPtr kMessageBeforeSave = "kMessageBeforeSave"
static
IdStringPtr kMessageBitmapChanged = "kMessageBitmapChanged"
static
IdStringPtr kMessageColorChanged = "kMessageColorChanged"
static
IdStringPtr kMessageFontChanged = "kMessageFontChanged"
static
IdStringPtr kMessageGradientChanged = "kMessageGradientChanged"
static
IdStringPtr kMessageTagChanged = "kMessageTagChanged"
static
IdStringPtr kMessageTemplateChanged = "kMessageTemplateChanged"
static
CViewAttributeID kTemplateNameAttributeID = 'uitl'
static
UINode* nodes
protected
std::deque<UINode*> nodeStack
protected
bool restoreViewsMode
protected
std::deque<IController*> subControllerStack
mutableprotected
IViewFactory* viewFactory
protected
Xml::IContentProvider* xmlContentProvider
protected
CResourceDescription xmlFile
protected

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