From d7c67fa2b6faa3e81269244224da4b72f045d659 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sun, 31 May 2015 14:23:11 +0300 Subject: Convert ProgressColorId enum into strong typed enum. --- src/gui/widgets/progressbar.cpp | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'src/gui/widgets/progressbar.cpp') diff --git a/src/gui/widgets/progressbar.cpp b/src/gui/widgets/progressbar.cpp index dfba99892..2965fc410 100644 --- a/src/gui/widgets/progressbar.cpp +++ b/src/gui/widgets/progressbar.cpp @@ -43,7 +43,7 @@ ProgressBar::ProgressBar(const Widget2 *const widget, float progress, const int width, const int height, - const int backColor, + const ProgressColorIdT backColor, const std::string &skin, const std::string &skinFill) : Widget(widget), @@ -62,8 +62,10 @@ ProgressBar::ProgressBar(const Widget2 *const widget, mSmoothProgress(true), mSmoothColorChange(true) { - mBackgroundColor = Theme::getProgressColor(backColor >= 0 - ? backColor : 0, mProgress); + mBackgroundColor = Theme::getProgressColor( + backColor >= ProgressColorId::PROG_HP + ? backColor : ProgressColorId::PROG_HP, + mProgress); mBackgroundColorToGo = mBackgroundColor; mForegroundColor2 = getThemeColor(ThemeColorId::PROGRESS_BAR_OUTLINE); @@ -297,20 +299,21 @@ void ProgressBar::setProgress(const float progress) if (!mSmoothProgress) mProgress = p; - if (mProgressPalette >= 0) + if (mProgressPalette >= ProgressColorId::PROG_HP) { mBackgroundColorToGo = Theme::getProgressColor( mProgressPalette, progress); } } -void ProgressBar::setProgressPalette(const int progressPalette) +void ProgressBar::setProgressPalette(const ProgressColorIdT progressPalette) { - const int oldPalette = mProgressPalette; + const ProgressColorIdT oldPalette = mProgressPalette; mProgressPalette = progressPalette; mRedraw = true; - if (mProgressPalette != oldPalette && mProgressPalette >= 0) + if (mProgressPalette != oldPalette && + mProgressPalette >= ProgressColorId::PROG_HP) { mBackgroundColorToGo = Theme::getProgressColor( mProgressPalette, mProgressToGo); -- cgit v1.2.3-60-g2f50