Planeshift
pawsprogressbar.h
Go to the documentation of this file.
1 /*
2  * pawsprogressbar.h - Author: Andrew Craig
3  *
4  * Copyright (C) 2003 Atomic Blue (info@planeshift.it, http://www.atomicblue.org)
5  *
6  *
7  * This program is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License
9  * as published by the Free Software Foundation (version 2 of the License)
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17  *
18  */
19 #ifndef PAWS_PROGRESS_BAR_HEADER
20 #define PAWS_PROGRESS_BAR_HEADER
21 
22 #include "pawswidget.h"
23 
29 {
30 public:
32  pawsProgressBar(const pawsProgressBar &origin);
34 
35  float GetTotalValue() const
36  {
37  return totalValue;
38  }
39  void SetTotalValue(float newValue)
40  {
41  totalValue = newValue;
42  }
43 
49  virtual void SetColor( int red, int green, int blue );
50 
57  virtual void SetFlashLevel(float level, bool low);
58 
64  virtual void SetFlashColor( int red, int green, int blue );
65 
69  virtual void SetFlashRate( int rate);
70 
73  float GetFlashLevel();
74 
79  virtual void SetWarningLevel( float level, bool low);
80 
86  virtual void SetWarningColor( int red, int green, int blue );
87 
90  float GetWarningLevel();
91 
96  virtual void SetDangerLevel( float level, bool low);
97 
103  virtual void SetDangerColor( int red, int green, int blue );
104 
107  float GetDangerLevel();
108 
109  void Completed()
110  {
111  complete = true;
112  }
113  void SetCurrentValue(float newValue);
115  {
116  return currentValue;
117  }
118  virtual void Draw();
119 
120  static void DrawProgressBar(const csRect &rect, iGraphics3D* graphics3D, float percent,
121  int start_r, int start_g, int start_b,
122  int diff_r, int diff_g, int diff_b,
123  int alpha = 255);
124 
125  bool IsDone()
126  {
127  return complete;
128  }
129  bool Setup(iDocumentNode* node);
130 
131  void OnUpdateData(const char* dataname,PAWSData &value);
132 
136  void SetReversed( bool val );
137 
138  void SetOn( bool val );
139 
140 private:
141  float totalValue;
142  float flashLevel;
143  float warnLevel;
144  float dangerLevel;
145  float currentValue;
146  float percent;
147  int flashRate;
148  int flashLastTime;
149  bool complete;
150  bool flashLow; //Low = TRUE; High = FALSE
151  bool warnLow; //Low = TRUE; High = FALSE
152  bool dangerLow; //Low = TRUE; High = FALSE
153  bool On; //Primary color showing = TRUE; flash color = FALSE;
154  bool reversed; //FALSE = left-to-right (default); TRUE = right-to-left (reversed)
155 
156  int start_r,start_g,start_b;
157  int flash_r,flash_g,flash_b;
158  int warn_r,warn_g,warn_b;
159  int danger_r,danger_g,danger_b;
160  int diff_r,diff_g,diff_b;
161 };
162 
164 
167 #endif
CREATE_PAWS_FACTORY(pawsProgressBar)
The main base widget that all other widgets should inherit from.
Definition: pawswidget.h:116
virtual void SetColor(int red, int green, int blue)
set the base color
virtual void SetFlashRate(int rate)
Set rate of flash.
virtual void SetFlashLevel(float level, bool low)
Set threshold for flashing numbers outside of min & max = no flash.
virtual void SetWarningLevel(float level, bool low)
Set threshold for warn color.
virtual void SetDangerColor(int red, int green, int blue)
Set Danger Color.
bool Setup(iDocumentNode *node)
Setup this widget.
float GetWarningLevel()
return the current "Warn" level
int alpha
The original background alpha.
Definition: pawswidget.h:254
virtual void SetWarningColor(int red, int green, int blue)
Set warn color.
void SetTotalValue(float newValue)
void SetCurrentValue(float newValue)
float GetTotalValue() const
float GetDangerLevel()
return the current "Danger" level
void OnUpdateData(const char *dataname, PAWSData &value)
virtual void SetFlashColor(int red, int green, int blue)
Set flash color.
float GetFlashLevel()
return the current "flash" level
void SetOn(bool val)
virtual void SetDangerLevel(float level, bool low)
set threshold for danger color
void SetReversed(bool val)
increse values from left-to-right, or right-to-left ?
virtual void Draw()
Draws the widget and all of it's children.
static void DrawProgressBar(const csRect &rect, iGraphics3D *graphics3D, float percent, int start_r, int start_g, int start_b, int diff_r, int diff_g, int diff_b, int alpha=255)