summaryrefslogtreecommitdiff
path: root/src/gui
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/ministatus.cpp15
-rw-r--r--src/gui/ministatus.h1
-rw-r--r--src/gui/statuswindow.cpp19
-rw-r--r--src/gui/statuswindow.h1
4 files changed, 36 insertions, 0 deletions
diff --git a/src/gui/ministatus.cpp b/src/gui/ministatus.cpp
index 8308fe15b..ed124d3b4 100644
--- a/src/gui/ministatus.cpp
+++ b/src/gui/ministatus.cpp
@@ -90,6 +90,9 @@ MiniStatusWindow::MiniStatusWindow():
mInvSlotsBar = createBar(0, 45, 20, Theme::PROG_INVY_SLOTS,
"inventory slots bar", _("inventory slots bar"));
+ mMoneyBar = createBar(0, 130, 20, Theme::PROG_INVY_SLOTS,
+ "money bar", _("money bar"));
+
mStatusBar = createBar(100, 150, 20, Theme::PROG_EXP,
"status bar", _("status bar"));
@@ -105,6 +108,8 @@ MiniStatusWindow::MiniStatusWindow():
Inventory *inv = PlayerInfo::getInventory();
if (inv)
inv->addInventoyListener(this);
+
+ StatusWindow::updateMoneyBar(mMoneyBar);
updateStatus();
}
@@ -214,6 +219,8 @@ void MiniStatusWindow::event(Channels channel _UNUSED_,
StatusWindow::updateXPBar(mXpBar);
else if (id == TOTAL_WEIGHT || id == MAX_WEIGHT)
StatusWindow::updateWeightBar(mWeightBar);
+ else if (id == MONEY)
+ StatusWindow::updateMoneyBar(mMoneyBar);
}
else if (event.getName() == EVENT_UPDATESTAT)
{
@@ -341,6 +348,12 @@ void MiniStatusWindow::mouseMoved(gcn::MouseEvent &event)
}
mStatusPopup->hide();
}
+ else if (event.getSource() == mMoneyBar)
+ {
+ mTextPopup->show(x + getX(), y + getY(),
+ event.getSource()->getId(),
+ toString(PlayerInfo::getAttribute(MONEY)));
+ }
else
{
mTextPopup->hide();
@@ -392,6 +405,8 @@ void MiniStatusWindow::loadBars()
mWeightBar->setVisible(false);
if (mInvSlotsBar)
mInvSlotsBar->setVisible(false);
+ if (mMoneyBar)
+ mMoneyBar->setVisible(false);
return;
}
diff --git a/src/gui/ministatus.h b/src/gui/ministatus.h
index 3cf9eef16..dad9d6b0f 100644
--- a/src/gui/ministatus.h
+++ b/src/gui/ministatus.h
@@ -108,6 +108,7 @@ class MiniStatusWindow : public Popup,
ProgressBar *mJobBar;
ProgressBar *mWeightBar;
ProgressBar *mInvSlotsBar;
+ ProgressBar *mMoneyBar;
ProgressBar *mStatusBar;
TextPopup *mTextPopup;
StatusPopup *mStatusPopup;
diff --git a/src/gui/statuswindow.cpp b/src/gui/statuswindow.cpp
index 30fec8773..ffc00db5a 100644
--- a/src/gui/statuswindow.cpp
+++ b/src/gui/statuswindow.cpp
@@ -548,6 +548,25 @@ void StatusWindow::updateWeightBar(ProgressBar *bar)
}
}
+void StatusWindow::updateMoneyBar(ProgressBar *bar)
+{
+ if (!bar)
+ return;
+
+ int money = PlayerInfo::getAttribute(MONEY);
+ bar->setText(Units::formatCurrency(money).c_str());
+ if (money > 0)
+ {
+ float progress = static_cast<float>(money)
+ / static_cast<float>(1000000000);
+ bar->setProgress(progress);
+ }
+ else
+ {
+ bar->setProgress(1.0);
+ }
+}
+
void StatusWindow::updateInvSlotsBar(ProgressBar *bar)
{
Inventory *inv = PlayerInfo::getInventory();
diff --git a/src/gui/statuswindow.h b/src/gui/statuswindow.h
index 38ae16e37..413ab9313 100644
--- a/src/gui/statuswindow.h
+++ b/src/gui/statuswindow.h
@@ -68,6 +68,7 @@ class StatusWindow : public Window, public Mana::Listener
static void updateXPBar(ProgressBar *bar, bool percent = true);
static void updateWeightBar(ProgressBar *bar);
static void updateInvSlotsBar(ProgressBar *bar);
+ static void updateMoneyBar(ProgressBar *bar);
static void updateStatusBar(ProgressBar *bar, bool percent = true);
static void updateProgressBar(ProgressBar *bar, int value, int max,
bool percent);