GuiFileElement Class Reference

A GUI class that creates subelements as specified in a XML-file. More...

#include <guifileelement.h>

Inheritance diagram for GuiFileElement:

Inheritance graph
[legend]
Collaboration diagram for GuiFileElement:

Collaboration graph
[legend]
List of all members.

Public Member Functions

DECLSPEC GuiFileElement (SDL_Rect &r, GuiElement *el, const char *name, const char *filename=NULL)
DECLSPEC GuiFileElement (TiXmlElement *el, GuiElement *p)
DECLSPEC bool initByFile (const char *fn)
virtual const char * getClassName ()

Static Public Member Functions

static void newguiobject (void *presult, BasicObject *o, void *xmldata)

Protected Member Functions

virtual DECLSPEC void onInit ()

Detailed Description

A GUI class that creates subelements as specified in a XML-file.

This class can be used to distribute the xml-data to more files or to create elements during run-time using a xml-file.

XML-files that are specified to be parsed, should have a root element named as the classname (here "GuiFileElement"; if you derive a class from this, then the value from getClassname() should be used).


Constructor & Destructor Documentation

GuiFileElement::GuiFileElement ( SDL_Rect &  r,
GuiElement el,
const char *  name,
const char *  filename = NULL 
)

Parameters:
filename the XML-file to use for initialization, NULL if no child elements should be created here

GuiFileElement::GuiFileElement ( TiXmlElement el,
GuiElement p 
)

Constructor. Uses XML data.

Parameters:
el the XML data for initialisation, the attribute Filename can be specified for initialization
p parent element
See also:
GuiElement(TiXmlElement*,GuiElement*)


Member Function Documentation

bool GuiFileElement::initByFile ( const char *  fn  ) 

Destroys all child elements and creates new child elements as defined in the specified XML-file. The onInit() method of the newly created elements is called after their creation.

Parameters:
fn the XML-file's filename
Returns:
true on success (if XML-file could be loaded and parsed), false on failure

virtual const char* GuiFileElement::getClassName (  )  [inline, virtual]

This function should be overriden in every sub-class of BasicObject!

Returns:
the name of the class.

Reimplemented from GuiElement.

void GuiFileElement::onInit (  )  [protected, virtual]

Initializes the object's variables by reading data from the XML element. If there were no XML data used for creation, nothing is done. This function calls onInit() of its children recursively (after it has inited itself). It is highly recommended to call BasicObject::onInit(), usually at the end of the onInit() method, when overwriting it in a derived class.

Reimplemented from GuiElement.


The documentation for this class was generated from the following files:
Generated on Wed May 9 17:36:17 2007 for netrinjo by  doxygen 1.5.1