#include <guiprogressbar.h>
Inheritance diagram for GuiProgressBar:
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 | |
SdlSurface * | bmp |
int | maxvalue |
int | stepsize |
bool | horizontal |
GuiProgressBar::GuiProgressBar | ( | TiXmlElement * | el, | |
GuiElement * | p | |||
) |
Constructor. Uses XML data.
el | the XML data for initialisation | |
p | parent element (or NULL, to take GuiManager::the as parent) |
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.
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.
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%.
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!
Reimplemented from GuiPictureBg.
Uint32 GuiProgressBar::onResize | ( | ) | [protected, virtual] |
This event is called, when the element changed its place or size.
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.
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.
t | pointer to the new used theme |
Reimplemented from GuiPictureBg.