GuiProgressBar Class Reference
[2D graphical user interface]

A class to display the progress of some calculation. More...

#include <guiprogressbar.h>

Inheritance diagram for GuiProgressBar:

Inheritance graph
[legend]
Collaboration diagram for GuiProgressBar:

Collaboration graph
[legend]
List of all members.

Public Member Functions

DECLSPEC GuiProgressBar (const SDL_Rect &r, GuiElement *el, const char *name, SdlSurface *progbmp=0, SdlSurface *backbmp=0)
DECLSPEC GuiProgressBar (TiXmlElement *el, GuiElement *p)
virtual const char * getClassName ()
DECLSPEC int operator++ ()
DECLSPEC int operator+= (int i)
void setFramebmp (SdlSurfaceContainer *r)
DECLSPEC void doFrame (SdlSurface *dst)
DECLSPEC void setProgress (int i)
DECLSPEC void setFont (SdlFont *f)
DECLSPEC void setValues (int max, int step)
DECLSPEC void setHorizontal (bool h)

Static Public Member Functions

static DECLSPEC void showprogresssimple (float p, Uint32 barcolor=RGB(50, 200, 50), Uint32 bordercolor=RGB(0, 100, 200), Uint32 emptycolor=RGB(200, 100, 0))
static DECLSPEC void uninitsimple ()
static DECLSPEC bool initsimple (const char *waitbmp)
static void newguiobject (void *presult, BasicObject *o, void *xmldata)

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

SdlSurfacebmp
int maxvalue
int stepsize
bool horizontal

Detailed Description

A class to display the progress of some calculation.

Test:
This class is not tested yet, but the static methods are.


Constructor & Destructor Documentation

GuiProgressBar::GuiProgressBar ( TiXmlElement el,
GuiElement p 
)

Constructor. Uses XML data.

Parameters:
el the XML data for initialisation
p parent element (or NULL, to take GuiManager::the as parent)
See also:
GuiElement(TiXmlElement*,GuiElement*)


Member Function Documentation

void GuiProgressBar::showprogresssimple ( float  p,
Uint32  barcolor = RGB(50, 200, 50),
Uint32  bordercolor = RGB(0, 100, 200),
Uint32  emptycolor = RGB(200, 100, 0) 
) [static]

Shows the previously initialized progressbar.

Parameters:
p the progress (between 0 and 1)
barcolor the color of the progressbar
bordercolor the color of the border, shown around the bar
emptycolor the color of the bar for the missing progress

void GuiProgressBar::uninitsimple (  )  [static]

Uninitializes the progressbar by destroying the bitmap-surface.

Note:
the surface is also freed, if it has been initialized somewhere before initsimple().

bool GuiProgressBar::initsimple ( const char *  waitbmp  )  [static]

Initializes a simple progressbar. The progressbar is drawn directly onto the top-level surface and refreshed by showprogresssimple(). So you see it only, if there are no frames drawn by other objects. Usually these static methods are used in a single method containing a loop that ends when the progress is at 100%.

Parameters:
waitbmp the name of the image's surface to show above the bar; if there is none with that name, a new one is created, taking this param as an image's file-path (using BasicApp::makeDataPath()).

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

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

Returns:
the name of the class.

Reimplemented from GuiPictureBg.

Uint32 GuiProgressBar::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 GuiProgressBar::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 GuiPictureBg.

void GuiProgressBar::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 GuiPictureBg.

Uint32 GuiProgressBar::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 GuiPictureBg.


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