Planeshift

pawsprogressbar.h

Go to the documentation of this file.
00001 /*
00002  * pawsprogressbar.h - Author: Andrew Craig
00003  *
00004  * Copyright (C) 2003 Atomic Blue ([email protected], http://www.atomicblue.org)
00005  *
00006  *
00007  * This program is free software; you can redistribute it and/or
00008  * modify it under the terms of the GNU General Public License
00009  * as published by the Free Software Foundation (version 2 of the License)
00010  * This program is distributed in the hope that it will be useful,
00011  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013  * GNU General Public License for more details.
00014  * You should have received a copy of the GNU General Public License
00015  * along with this program; if not, write to the Free Software
00016  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
00017  *
00018  */
00019 #ifndef PAWS_PROGRESS_BAR_HEADER
00020 #define PAWS_PROGRESS_BAR_HEADER
00021 
00022 #include "pawswidget.h"
00023 
00028 class pawsProgressBar : public pawsWidget
00029 {
00030 public:
00031     pawsProgressBar();
00032     pawsProgressBar(const pawsProgressBar &origin);
00033     ~pawsProgressBar();
00034 
00035     float GetTotalValue() const
00036     {
00037         return totalValue;
00038     }
00039     void SetTotalValue(float newValue)
00040     {
00041         totalValue = newValue;
00042     }
00043 
00049     virtual void SetColor( int red, int green, int blue );
00050 
00057     virtual void SetFlashLevel(float level, bool low);
00058 
00064     virtual void SetFlashColor( int red, int green, int blue );
00065 
00069     virtual void SetFlashRate( int rate);
00070 
00073     float GetFlashLevel();
00074 
00079     virtual void SetWarningLevel( float level, bool low);
00080 
00086     virtual void SetWarningColor(  int red, int green, int blue );
00087 
00090     float GetWarningLevel();
00091 
00096     virtual void SetDangerLevel( float level, bool low);
00097 
00103     virtual void SetDangerColor(  int red, int green, int blue );
00104 
00107     float GetDangerLevel();
00108 
00109     void Completed()
00110     {
00111         complete = true;
00112     }
00113     void SetCurrentValue(float newValue);
00114     float GetCurrentValue()
00115     {
00116         return currentValue;
00117     }
00118     virtual void Draw();
00119 
00120     static void DrawProgressBar(const csRect &rect, iGraphics3D* graphics3D, float percent,
00121                                 int start_r, int start_g, int start_b,
00122                                 int diff_r,  int diff_g,  int diff_b,
00123                                 int alpha = 255);
00124 
00125     bool IsDone()
00126     {
00127         return complete;
00128     }
00129     bool Setup(iDocumentNode* node);
00130 
00131     void OnUpdateData(const char* dataname,PAWSData &value);
00132 
00136     void SetReversed( bool val );
00137 
00138     void SetOn( bool val );
00139 
00140 private:
00141     float totalValue;
00142     float flashLevel;
00143     float warnLevel;
00144     float dangerLevel;
00145     float currentValue;
00146     float percent;
00147     int   flashRate;
00148     int   flashLastTime;
00149     bool  complete;
00150     bool  flashLow;     //Low = TRUE; High = FALSE
00151     bool  warnLow;      //Low = TRUE; High = FALSE
00152     bool  dangerLow;    //Low = TRUE; High = FALSE
00153     bool  On;           //Primary color showing = TRUE; flash color = FALSE;
00154     bool  reversed;     //FALSE = left-to-right (default); TRUE = right-to-left (reversed)
00155 
00156     int   start_r,start_g,start_b;
00157     int   flash_r,flash_g,flash_b;
00158     int   warn_r,warn_g,warn_b;
00159     int   danger_r,danger_g,danger_b;
00160     int   diff_r,diff_g,diff_b;
00161 };
00162 
00163 CREATE_PAWS_FACTORY(pawsProgressBar);
00164 
00167 #endif