guiprogressbar.h

Go to the documentation of this file.
00001 /********************************************************************************/
00002 /*                                                                              */
00003 /*  Netrinjo-Engine - a library for game-development                            */
00004 /*  Copyright (C) 1999, 2000, 2005 by Tobias Nadler und Georg Schnattinger      */
00005 /*                                                                              */
00006 /*  This library is free software; you can redistribute it and/or               */
00007 /*  modify it under the terms of the GNU Lesser General Public                  */
00008 /*  License as published by the Free Software Foundation; either                */
00009 /*  version 2.1 of the License, or (at your option) any later version.          */
00010 /*                                                                              */
00011 /*  This library is distributed in the hope that it will be useful,             */
00012 /*  but WITHOUT ANY WARRANTY; without even the implied warranty of              */
00013 /*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU           */
00014 /*  Lesser General Public License for more details.                             */
00015 /*                                                                              */
00016 /*  You should have received a copy of the GNU Lesser General Public            */
00017 /*  License along with this library; if not, write to the Free Software         */
00018 /*  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA   */
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

Generated on Wed May 9 17:35:55 2007 for netrinjo by  doxygen 1.5.1