Public Member Functions | Private Types | Private Member Functions | Private Attributes

Skin Class Reference

Skin Resource. More...

#include <Skin.h>

Inheritance diagram for Skin:
Resource

List of all members.

Public Member Functions

 Skin (const std::string &filePath)
 ~Skin ()
bool hasPart (const std::string &partName) const
SkinPartgetPart (const std::string &name, ControlState state=STATE_NORMAL)
const string & getSkinName () const

Private Types

typedef std::multimap< string,
SkinPart * > 
PartList

Private Member Functions

void load ()
bool readSkin (const std::string &path)
bool getSourceImage (TiXmlNode *node)
bool getSkinName (TiXmlNode *node)
bool parseControlNode (TiXmlNode *node)
SkinPartparseStateNode (TiXmlNode *node)
bool parseRegionNode (TiXmlNode *node, SkinPart *part)
bool parseColordefNode (TiXmlNode *node, SkinPart *part)
TextOffsets parseCaptionTextNode (TiXmlNode *node)
ControlState enumerateState (const string &state)
Uint countChildNodes (TiXmlNode *node, const std::string &filter="")
ImageRegion translateRegion (const std::string &region) const
const std::string translateState (ControlState state) const

Private Attributes

TiXmlDocument * mXmlDoc
ImagemSource
PartList mPartList
std::string mSkinName
StringList mMessageList

Detailed Description

Skin Resource.

Parses and interprets Skin XML Definitions and builds a set of SkinParts that can then be used to draw GUI Elements.


Member Typedef Documentation

typedef std::multimap<string, SkinPart*> Skin::PartList [private]

Constructor & Destructor Documentation

Skin::Skin ( const std::string &  filePath  ) 
Skin::~Skin (  ) 

Member Function Documentation

Uint Skin::countChildNodes ( TiXmlNode *  node,
const std::string &  filter = "" 
) [private]
ControlState Skin::enumerateState ( const string &  state  )  [private]

Translates a string into a ConstrolState enumeration.

Parameters:
state A string defining a state. Case insensitive.
Returns:
Returns a ControlState enumeration. STATE_UNDEFINED if if an unrecognized string is passed in.
SkinPart* Skin::getPart ( const std::string &  name,
ControlState  state = STATE_NORMAL 
)
const string& Skin::getSkinName (  )  const [inline]

Gets the name of the Skin.

Note:
This is not the same as the Resource object's getName() function.
bool Skin::getSkinName ( TiXmlNode *  node  )  [private]

Searches a specified XML node for a 'name' attribute and then sets the internal Skin name.

bool Skin::getSourceImage ( TiXmlNode *  node  )  [private]

Searches a specified XML node for an 'image' attribute and then attempts to load the specified image file.

bool Skin::hasPart ( const std::string &  partName  )  const
void Skin::load (  )  [private, virtual]

Performs the necessary operations to load a Resource.

Note:
This is a pure virtual function and so must be overridden by all derived classes.
It is the responsibility of the derived class to call this function.

Implements Resource.

TextOffsets Skin::parseCaptionTextNode ( TiXmlNode *  node  )  [private]

Parses a 'captiontext' node.

bool Skin::parseColordefNode ( TiXmlNode *  node,
SkinPart part 
) [private]

Parses a 'colordef' node.

bool Skin::parseControlNode ( TiXmlNode *  node  )  [private]
bool Skin::parseRegionNode ( TiXmlNode *  node,
SkinPart part 
) [private]

Parses a 'region' node.

SkinPart * Skin::parseStateNode ( TiXmlNode *  node  )  [private]

Parses a 'state' node.

bool Skin::readSkin ( const std::string &  path  )  [private]
ImageRegion Skin::translateRegion ( const std::string &  region  )  const [private]
const std::string Skin::translateState ( ControlState  state  )  const [private]

Translates a ControlState to a human readable string.


Member Data Documentation

List of messages, error and otherwise.

List of Controls and their various associated parts.

std::string Skin::mSkinName [private]

Name of the Skin.

Image* Skin::mSource [private]

Image containing all part graphics.

TiXmlDocument* Skin::mXmlDoc [private]

XML Document.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines