Planeshift
pawsStyles Class Reference

Class pawsStyles keeps definitions of PAWS styles - a PAWS style is collection of XML attributes and XML nodes that are automatically applied to all PAWS XML widgets that are using this PAWS style. More...

#include <pawsstyles.h>

Public Member Functions

void ApplyStyle (const char *style, iDocumentNode *target)
 Applies style with given name to 'target'. More...
 
void ApplyStyle (iDocumentNode *style, iDocumentNode *target)
 
bool LoadStyles (const csString &fileName)
 Loads style definitions from file. More...
 
 pawsStyles (iObjectRegistry *objectReg)
 

Protected Member Functions

void InheritFromParent (iDocumentNode *style, STRING_HASH(bool)&alreadyInh, STRING_HASH(bool)&beingInh)
 Inherits from parent - copies nodes/attributes from parent of 'style' to 'style'. More...
 
void InheritStyles ()
 All styles inherit attributes/nodes from parent styles. More...
 
 STRING_HASH (csRef< iDocumentNode >) styles
 Collection of styles - iDocumentNodes accessed by style names. More...
 

Protected Attributes

iObjectRegistry * objectReg
 

Detailed Description

Class pawsStyles keeps definitions of PAWS styles - a PAWS style is collection of XML attributes and XML nodes that are automatically applied to all PAWS XML widgets that are using this PAWS style.

styles.xml

<!– defines standard letter look –> <style name="standard font"> <font name="cupandtalon.ttf" r="-1" g="-1" b="-1" size="12" sr="0" sg="0" sb="0"/> </style>

<!– style "big" overrides font size –> <style name="big" inherit="standard font"> <font size="20"/> </style>

mywidget.zml

<!– this widget uses "big" style but changes font face to "verdana" –> <widget name="version" factory="pawsTextBox" style="big"> <frame x="100" y="100" width="330" height="30" /> <font name="LiberationSans-Regular.ttf"/> <text string="omgwtf" horizAdjust="CENTRE" /> </widget>

Definition at line 67 of file pawsstyles.h.

Constructor & Destructor Documentation

pawsStyles::pawsStyles ( iObjectRegistry *  objectReg)

Member Function Documentation

void pawsStyles::ApplyStyle ( const char *  style,
iDocumentNode *  target 
)

Applies style with given name to 'target'.

It adds all attributes and child nodes to 'target'. If target already contains some of these attributes/nodes, then they are not overwritten

void pawsStyles::ApplyStyle ( iDocumentNode *  style,
iDocumentNode *  target 
)
void pawsStyles::InheritFromParent ( iDocumentNode *  style,
STRING_HASH(bool)&  alreadyInh,
STRING_HASH(bool)&  beingInh 
)
protected

Inherits from parent - copies nodes/attributes from parent of 'style' to 'style'.

'alreadyInh' contains all styles with finished inheritance (so that we won't recalc it more times) 'beingInh' contains all styles whose inheritance is just being recursively calculated

  • this is used to detect cycles in the inheritance relationships
void pawsStyles::InheritStyles ( )
protected

All styles inherit attributes/nodes from parent styles.

bool pawsStyles::LoadStyles ( const csString &  fileName)

Loads style definitions from file.

Return true = success

pawsStyles::STRING_HASH ( csRef< iDocumentNode >  )
protected

Collection of styles - iDocumentNodes accessed by style names.

Member Data Documentation

iObjectRegistry* pawsStyles::objectReg
protected

Definition at line 94 of file pawsstyles.h.


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