00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef GUIPROGRESSBAR_H
00023 #define GUIPROGRESSBAR_H
00024
00025 #include "guibackground.h"
00026 #include "guielement.h"
00027 #include "guitext.h"
00028
00042 class DECLSPEC GuiProgressBar : public GuiPictureBg
00043 {
00044 public:
00052 static DECLSPEC void showprogresssimple( float p, Uint32 barcolor = RGB(50,200,50), Uint32 bordercolor = RGB(0,100,200), Uint32 emptycolor = RGB(200,100,0) );
00058 static DECLSPEC void uninitsimple();
00069 static DECLSPEC bool initsimple( const char *waitbmp );
00070
00071 DECLSPEC GuiProgressBar( const SDL_Rect &r, GuiElement *el, const char *name, SdlSurface * progbmp = 0, SdlSurface *backbmp = 0 );
00078 DECLSPEC GuiProgressBar(TiXmlElement *el, GuiElement *p);
00079 virtual DECLSPEC ~GuiProgressBar();
00080
00081 virtual const char *getClassName() { return "GuiProgressBar"; }
00082
00083 DECLSPEC int operator ++();
00084 DECLSPEC int operator += ( int i );
00085 void setFramebmp( SdlSurfaceContainer * r ) { brd->setBmps( r ); }
00086 DECLSPEC void doFrame( SdlSurface *dst );
00087 DECLSPEC void setProgress( int i );
00088 DECLSPEC void setFont( SdlFont *f );
00089
00090 DECLSPEC void setValues( int max, int step );
00091 DECLSPEC void setHorizontal( bool h );
00092
00093 static void newguiobject(void *presult, BasicObject *o, void *xmldata)
00094 {
00095 GuiElement *r = new GuiProgressBar((TiXmlElement*)xmldata, (GuiElement*)o);
00096 *(GuiElement**)presult = r;
00097 }
00098
00099 protected:
00100 virtual DECLSPEC Uint32 onResize();
00101 virtual DECLSPEC Uint32 onFrame( SdlSurface *dst );
00102 virtual DECLSPEC void onInit();
00103 virtual DECLSPEC Uint32 onThemeChanged( UiTheme *t );
00104
00105 SdlSurface *bmp;
00106 int maxvalue, stepsize;
00107 bool horizontal;
00108
00109 private:
00110 void arrange();
00111 int progress;
00112 int width;
00113 GuiBorder * brd;
00114 GuiText * text;
00115
00116 bool bThemeBmp, bThemeFont, bThemeVal, bThemeHorz;
00117 static SdlSurface *waitres;
00118 };
00119
00120 #endif