GuiBorder Class Reference
[2D graphical user interface]

Draws a border at its rect boundaries. More...

#include <guibackground.h>

Inheritance diagram for GuiBorder:

Inheritance graph
[legend]
Collaboration diagram for GuiBorder:

Collaboration graph
[legend]
List of all members.

Public Member Functions

DECLSPEC GuiBorder (const SDL_Rect &r, GuiElement *p, const char *name, SdlSurfaceContainer *bmps=0, bool themestyle=true)
DECLSPEC GuiBorder (TiXmlElement *el, GuiElement *p)
virtual const char * getClassName ()
DECLSPEC void setBmps (SdlSurfaceContainer *sc)
SdlSurfaceContainergetBmps ()
 
Returns:
the surfaces, that are used for the appearance


Static Public Member Functions

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

Public Attributes

bool invert
bool neutral
bool left
 determine the visibility of the borders
bool right
bool top
bool bottom

Protected Member Functions

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

Protected Attributes

bool bCanNeutral
 if true, flat mode is possible
bool bShowBorder
 if true, border is shown, if false, it is hidden
int nCornerWidth
 size of the border's corner
int nCornerHeight
int nBmpWidth
 width of horizontal border surface
int nBmpHeight
 height of vertical border surface

Detailed Description

Draws a border at its rect boundaries.

This class is used to draw a border to the rect's boundary. The borders at the top, bottom, left and right can appear different or be hidden. Corners are displayed using other bitmap-sources.

The appearance can be switched between three modes: raised, flat or sunken, by setting the variables neutral and invert accordingly.


Constructor & Destructor Documentation

GuiBorder::GuiBorder ( const SDL_Rect &  r,
GuiElement p,
const char *  name,
SdlSurfaceContainer bmps = 0,
bool  themestyle = true 
)

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
bmps the source for the look of the borders; if flat (neutral) mode should be possible, at least 18 surfaces have to be in the container: always three surfaces belong together, the first should be light, the second dark, the third is shown in flat mode; the first three are used to show horizontal borders, the next for vertical borders, then the corners follow: top-left, top-right, bottom-left, bottom-right (6 * 3 = 18). If flat mode is not needed, then 6 * 2 = 12 surfaces are needed, because there are always two in a group (the neutral is not needed). If this param is NULL, the theme's default surfaces are taken.
themestyle if true, the variables neutral and invert are set as the theme wants them to be, but changing them has still the same effect as if the param is false.

GuiBorder::GuiBorder ( TiXmlElement el,
GuiElement p 
)

Constructor. Uses XML data.

Parameters:
el the XML data for initialisation, the following attributes are read: InvertBorder, BorderEdges, HideBorder, BorderBmps, NeutralBorder, BorderTheme
p parent element (or NULL, to take GuiManager::the as parent)
See also:
GuiElement(TiXmlElement*,GuiElement*)


Member Function Documentation

virtual const char* GuiBorder::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 GuiDynamicButton, GuiClickableBtn, GuiCheckableBtn, GuiRadioBtn, and GuiForm.

void GuiBorder::setBmps ( SdlSurfaceContainer sc  ) 

Changes the source surfaces for the border's look

Parameters:
sc the surfaces that are used; if less than 18 are in the container, flat (neutral) mode is switched off, otherwise it is switched on

Uint32 GuiBorder::onResize (  )  [protected, virtual]

This event is called, when the element changed its place or size.

Returns:
currently the result is not used; may be zero, if no error...

Reimplemented from GuiElement.

Uint32 GuiBorder::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 GuiDynamicButton.

void GuiBorder::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 GuiDynamicButton, GuiClickableBtn, GuiCheckableBtn, GuiRadioBtn, and GuiForm.

Uint32 GuiBorder::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 GuiDynamicButton, GuiClickableBtn, GuiCheckableBtn, GuiRadioBtn, and GuiForm.


Member Data Documentation

bool GuiBorder::invert

if neutral is true, invert has no effect; otherwise, if invert, the usually dark borders become light and the other way round


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