From 28999e7571b66733dcf0ddbc7e376c2c3fc1bfae Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Mon, 9 Dec 2013 13:57:30 +0300 Subject: Add text colors for mp bar. New theme colors: MP_BAR, MP_BAR_OUTLINE, NO_MP_BAR, NO_MP_BAR_OUTLINE --- src/gui/windows/statuswindow.cpp | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) (limited to 'src/gui/windows/statuswindow.cpp') diff --git a/src/gui/windows/statuswindow.cpp b/src/gui/windows/statuswindow.cpp index 19d862443..bf93efbee 100644 --- a/src/gui/windows/statuswindow.cpp +++ b/src/gui/windows/statuswindow.cpp @@ -209,11 +209,21 @@ StatusWindow::StatusWindow() : max = PlayerInfo::getAttribute(PlayerInfo::MAX_MP); // TRANSLATORS: status window label mMpLabel = new Label(this, _("MP:")); + const bool useMagic = Net::getPlayerHandler()->canUseMagic(); mMpBar = new ProgressBar(this, max ? static_cast( PlayerInfo::getAttribute(PlayerInfo::MAX_MP)) / static_cast(max) : static_cast(0), - 80, 0, Net::getPlayerHandler()->canUseMagic() ? - Theme::PROG_MP : Theme::PROG_NO_MP); + 80, 0, useMagic ? Theme::PROG_MP : Theme::PROG_NO_MP); + if (useMagic) + { + mMpBar->setColor(Theme::getThemeColor(Theme::MP_BAR), + Theme::getThemeColor(Theme::MP_BAR_OUTLINE)); + } + else + { + mMpBar->setColor(Theme::getThemeColor(Theme::NO_MP_BAR), + Theme::getThemeColor(Theme::NO_MP_BAR_OUTLINE)); + } } else { @@ -523,9 +533,17 @@ void StatusWindow::updateMPBar(ProgressBar *const bar, const bool showMax) prog = static_cast(mp) / static_cast(maxMp); if (Net::getPlayerHandler()->canUseMagic()) + { + bar->setColor(Theme::getThemeColor(Theme::MP_BAR), + Theme::getThemeColor(Theme::MP_BAR_OUTLINE)); bar->setProgressPalette(Theme::PROG_MP); + } else + { + bar->setColor(Theme::getThemeColor(Theme::NO_MP_BAR), + Theme::getThemeColor(Theme::NO_MP_BAR_OUTLINE)); bar->setProgressPalette(Theme::PROG_NO_MP); + } bar->setProgress(prog); } -- cgit v1.2.3-60-g2f50