diff options
author | Andrei Karas <akaras@inbox.ru> | 2015-05-31 14:23:11 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2015-05-31 14:23:11 +0300 |
commit | d7c67fa2b6faa3e81269244224da4b72f045d659 (patch) | |
tree | 596010d034e44ff46eabccca3c77d995626fca88 /src/gui/widgets/progressbar.cpp | |
parent | b072723595e729eed79199f246439ffed62cdbb5 (diff) | |
download | manaverse-d7c67fa2b6faa3e81269244224da4b72f045d659.tar.gz manaverse-d7c67fa2b6faa3e81269244224da4b72f045d659.tar.bz2 manaverse-d7c67fa2b6faa3e81269244224da4b72f045d659.tar.xz manaverse-d7c67fa2b6faa3e81269244224da4b72f045d659.zip |
Convert ProgressColorId enum into strong typed enum.
Diffstat (limited to 'src/gui/widgets/progressbar.cpp')
-rw-r--r-- | src/gui/widgets/progressbar.cpp | 17 |
1 files changed, 10 insertions, 7 deletions
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); |