summaryrefslogtreecommitdiff
path: root/src/gui/widgets/progressbar.h
diff options
context:
space:
mode:
authorBjørn Lindeijer <bjorn@lindeijer.nl>2009-05-08 18:27:27 +0200
committerBjørn Lindeijer <bjorn@lindeijer.nl>2009-05-08 18:29:54 +0200
commit8ee8ea70b5a32e1b8a5ad3e670cfe9ebee47bb4c (patch)
tree694cbbfbf0e191c8a3f245441a93cc027319a8f6 /src/gui/widgets/progressbar.h
parentb4150856b56584b3922f2a9e2489ba472d2e864b (diff)
downloadmana-8ee8ea70b5a32e1b8a5ad3e670cfe9ebee47bb4c.tar.gz
mana-8ee8ea70b5a32e1b8a5ad3e670cfe9ebee47bb4c.tar.bz2
mana-8ee8ea70b5a32e1b8a5ad3e670cfe9ebee47bb4c.tar.xz
mana-8ee8ea70b5a32e1b8a5ad3e670cfe9ebee47bb4c.zip
Fixed one pixel missing from progress bars
Also fixed the progress bar during connecting to reset again when full, by disabling the smooth updating there. The ProgressBar now uses gcn::Color instead of three separate color attributes.
Diffstat (limited to 'src/gui/widgets/progressbar.h')
-rw-r--r--src/gui/widgets/progressbar.h41
1 files changed, 16 insertions, 25 deletions
diff --git a/src/gui/widgets/progressbar.h b/src/gui/widgets/progressbar.h
index e75b1d44..77670f57 100644
--- a/src/gui/widgets/progressbar.h
+++ b/src/gui/widgets/progressbar.h
@@ -26,8 +26,6 @@
#include <guichan/widget.hpp>
-#include <SDL_types.h>
-
class ImageRect;
/**
@@ -42,12 +40,9 @@ class ProgressBar : public gcn::Widget
* Constructor, initializes the progress with the given value.
*/
ProgressBar(float progress = 0.0f,
- unsigned int width = 40, unsigned int height = 7,
- Uint8 red = 150, Uint8 green = 150, Uint8 blue = 150);
+ int width = 40, int height = 7,
+ const gcn::Color &color = gcn::Color(150, 150, 150));
- /**
- * Destructor.
- */
~ProgressBar();
/**
@@ -71,24 +66,22 @@ class ProgressBar : public gcn::Widget
float getProgress() const { return mProgress; }
/**
- * Change the filling of the progress bar.
- */
- void setColor(Uint8, Uint8 green, Uint8 blue);
-
- /**
- * Returns the red value of color.
+ * Change the color of the progress bar.
*/
- Uint8 getRed() const { return mRed; }
+ void setColor(const gcn::Color &color);
/**
- * Returns the green value of color.
+ * Change the color of the progress bar.
+ *
+ * This is an overload provided for convenience.
*/
- Uint8 getGreen() const { return mGreen; }
+ inline void setColor(int r, int g, int b)
+ { setColor(gcn::Color(r, g, b)); }
/**
- * Returns the blue value of color.
+ * Returns the color of the progress bar.
*/
- Uint8 getBlue() const { return mBlue; }
+ const gcn::Color &getColor() const { return mColor; }
/**
* Sets the text shown on the progress bar.
@@ -103,33 +96,31 @@ class ProgressBar : public gcn::Widget
{ return mText; }
/**
- * Set wether the progress is moved smoothly.
+ * Set whether the progress is moved smoothly.
*/
void setSmoothProgress(bool smoothProgress)
{ mSmoothProgress = smoothProgress; }
/**
- * Set wether the color changing is made smoothly.
+ * Set whether the color changing is made smoothly.
*/
void setSmoothColorChange(bool smoothColorChange)
{ mSmoothColorChange = smoothColorChange; }
-
private:
float mProgress, mProgressToGo;
bool mSmoothProgress;
- Uint8 mRed, mGreen, mBlue;
- Uint8 mRedToGo, mGreenToGo, mBlueToGo;
+ gcn::Color mColor;
+ gcn::Color mColorToGo;
bool mSmoothColorChange;
std::string mText;
- bool mUpdated;
static ImageRect mBorder;
static int mInstances;
static float mAlpha;
-
+
static const gcn::Color TEXT_COLOR;
};