00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef PROGRESSBAR_H
00023 #define PROGRESSBAR_H
00024
00025 #include <string>
00026
00027 #include <guichan/widget.hpp>
00028
00029 #include <SDL_types.h>
00030
00031 class ImageRect;
00032
00038 class ProgressBar : public gcn::Widget
00039 {
00040 public:
00044 ProgressBar(float progress = 0.0f,
00045 unsigned int width = 40, unsigned int height = 7,
00046 Uint8 red = 150, Uint8 green = 150, Uint8 blue = 150);
00047
00051 ~ProgressBar();
00052
00056 void logic();
00057
00061 void draw(gcn::Graphics *graphics);
00062
00066 void setProgress(float progress);
00067
00071 float getProgress() const { return mProgress; }
00072
00076 void setColor(Uint8, Uint8 green, Uint8 blue);
00077
00081 Uint8 getRed() const { return mRed; }
00082
00086 Uint8 getGreen() const { return mGreen; }
00087
00091 Uint8 getBlue() const { return mBlue; }
00092
00096 void setText(const std::string &text)
00097 { mText = text; }
00098
00102 const std::string &text() const
00103 { return mText; }
00104
00108 void setSmoothProgress(bool smoothProgress)
00109 { mSmoothProgress = smoothProgress; }
00110
00114 void setSmoothColorChange(bool smoothColorChange)
00115 { mSmoothColorChange = smoothColorChange; }
00116
00117
00118 private:
00119 float mProgress, mProgressToGo;
00120 bool mSmoothProgress;
00121
00122 Uint8 mRed, mGreen, mBlue;
00123 Uint8 mRedToGo, mGreenToGo, mBlueToGo;
00124 bool mSmoothColorChange;
00125
00126 std::string mText;
00127 bool mUpdated;
00128
00129 static ImageRect mBorder;
00130 static int mInstances;
00131 static float mAlpha;
00132
00133 static const gcn::Color TEXT_COLOR;
00134 };
00135
00136 #endif