GuiBackground Class Reference
[2D graphical user interface]

A class for filling a rect with a color. More...

#include <guibackground.h>

Inheritance diagram for GuiBackground:

Inheritance graph
[legend]
Collaboration diagram for GuiBackground:

Collaboration graph
[legend]
List of all members.

Public Member Functions

DECLSPEC GuiBackground (const SDL_Rect &r, GuiElement *p, const char *name, Uint32 c=CLR_STANDARD)
DECLSPEC GuiBackground (TiXmlElement *el, GuiElement *p)
virtual const char * getClassName ()

Static Public Member Functions

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

Public Attributes

Uint32 bgcolor
 the color to use for filling

Protected Member Functions

virtual DECLSPEC Uint32 onFrame (SdlSurface *dst)
virtual DECLSPEC void onInit ()
virtual DECLSPEC Uint32 onThemeChanged (UiTheme *t)
virtual DECLSPEC void paintBg (SdlSurface *dst)

Detailed Description

A class for filling a rect with a color.

Use this class to either clear a rect, where graphics will be drawn on, or to draw a simple, filled rect.


Constructor & Destructor Documentation

GuiBackground::GuiBackground ( const SDL_Rect &  r,
GuiElement p,
const char *  name,
Uint32  c = CLR_STANDARD 
)

Constructor.

Parameters:
r the rect of the element's appearance, relative to the parent's top-left position
p the parent element; or NULL, if it will be used as top level
name the element's name
c the color to use for filling; if CLR_STANDARD, then the theme's default color for this kind of element is used; if CLR_INVALID, then it is like a GuiElement

GuiBackground::GuiBackground ( TiXmlElement el,
GuiElement p 
)

Constructor. Uses XML data.

Parameters:
el the XML data for initialisation: if the attribute "BgColor" is specified, the value is assigned to the element's bgcolor
p parent element (or NULL, to take GuiManager::the as parent)
See also:
GuiElement(TiXmlElement*,GuiElement*)


Member Function Documentation

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

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

Returns:
the name of the class.

Reimplemented from GuiElement.

Reimplemented in GuiFrame, GuiRadioContainer, GuiPictureBg, GuiFlowWindow, GuiPageControl, GuiCursor, GuiFlowMenu, GuiHint, GuiMessageBox, GuiProgressBar, GuiScroller, GuiTextField, and GuiUpDown.

Uint32 GuiBackground::onFrame ( SdlSurface dst  )  [protected, virtual]

This event is called, when a frame is drawn. If the object should be visible, is has to draw it's look to a valid surface. This method calls the children's function, if visible.

Returns:
zero, if no error occured; if not zero, drawing is stopped
Note:
if you derive the function, then call GuiElement::onFrame(SdlSurface*) after your class's drawing was done in the onFrame-event, otherwise you paint over the children elements

Reimplemented from GuiElement.

Reimplemented in GuiPictureBg, GuiFlowWindow, and GuiProgressBar.

void GuiBackground::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.

Reimplemented in GuiFrame, GuiRadioContainer, GuiPictureBg, GuiFlowWindow, GuiPageControl, GuiCursor, GuiFlowMenu, GuiHint, GuiMessageBox, GuiProgressBar, GuiScroller, GuiTextField, and GuiUpDown.

Uint32 GuiBackground::onThemeChanged ( UiTheme t  )  [protected, virtual]

This event is called, when the theme changes. Perform here the changes of the object's look and feel.

Parameters:
t pointer to the new used theme
Returns:
currently the result is not used; may be zero, if no error...

Reimplemented from GuiElement.

Reimplemented in GuiPictureBg, GuiFlowWindow, GuiPageControl, GuiHint, GuiProgressBar, GuiScroller, and GuiUpDown.

void GuiBackground::paintBg ( SdlSurface dst  )  [protected, virtual]

Fills the clip rect with the color bgcolor. Especially useful, when deriving this class and you want to draw something onto the background: call this method at the beginning of the onFrame() event, then draw your things and finally call GuiElement::onFrame(dst)

Parameters:
dst the surface to paint on

Reimplemented in GuiPictureBg.


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