summaryrefslogtreecommitdiff
path: root/src/gui/statuswindow.cpp
diff options
context:
space:
mode:
authorSocapex <philippe_groarke@yahoo.ca>2013-01-19 21:02:01 -0500
committerSocapex <philippe_groarke@yahoo.ca>2013-01-19 21:02:01 -0500
commitdf606ace309acaf0c78f52e1f98eabed6c844ae2 (patch)
treed9799b0e4a507d9eacbbafc1755eecea03f0b373 /src/gui/statuswindow.cpp
parentd0169223b889a115b486e974e5b287c3ccb00d85 (diff)
parent678d4e70999ade5a36862039875aa5564291d09d (diff)
downloadmanaplus-df606ace309acaf0c78f52e1f98eabed6c844ae2.tar.gz
manaplus-df606ace309acaf0c78f52e1f98eabed6c844ae2.tar.bz2
manaplus-df606ace309acaf0c78f52e1f98eabed6c844ae2.tar.xz
manaplus-df606ace309acaf0c78f52e1f98eabed6c844ae2.zip
Merge remote-tracking branch 'upstream/master' into osx
Diffstat (limited to 'src/gui/statuswindow.cpp')
-rw-r--r--src/gui/statuswindow.cpp39
1 files changed, 27 insertions, 12 deletions
diff --git a/src/gui/statuswindow.cpp b/src/gui/statuswindow.cpp
index 691333703..188ff5d66 100644
--- a/src/gui/statuswindow.cpp
+++ b/src/gui/statuswindow.cpp
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011-2012 The ManaPlus Developers
+ * Copyright (C) 2011-2013 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
@@ -77,12 +77,17 @@ class AttrDisplay : public Container
return mValue->getCaption();
}
+ const std::string &getShortName() const
+ { return mShortName; }
+
protected:
AttrDisplay(const Widget2 *const widget,
- const int id, const std::string &name);
+ const int id, const std::string &name,
+ const std::string &shortName);
const int mId;
const std::string mName;
+ const std::string mShortName;
LayoutHelper *mLayout;
Label *mLabel;
@@ -93,7 +98,8 @@ class DerDisplay final : public AttrDisplay
{
public:
DerDisplay(const Widget2 *const widget,
- const int id, const std::string &name);
+ const int id, const std::string &name,
+ const std::string &shortName);
A_DELETE_COPY(DerDisplay)
@@ -105,7 +111,8 @@ class ChangeDisplay final : public AttrDisplay, gcn::ActionListener
{
public:
ChangeDisplay(const Widget2 *const widget,
- const int id, const std::string &name);
+ const int id, const std::string &name,
+ const std::string &shortName);
A_DELETE_COPY(ChangeDisplay)
@@ -436,6 +443,7 @@ void StatusWindow::setPointsNeeded(const int id, const int needed)
}
void StatusWindow::addAttribute(const int id, const std::string &name,
+ const std::string &shortName,
const bool modifiable,
const std::string &description A_UNUSED)
{
@@ -443,12 +451,12 @@ void StatusWindow::addAttribute(const int id, const std::string &name,
if (modifiable)
{
- disp = new ChangeDisplay(this, id, name);
+ disp = new ChangeDisplay(this, id, name, shortName);
mAttrCont->add1(disp);
}
else
{
- disp = new DerDisplay(this, id, name);
+ disp = new DerDisplay(this, id, name, shortName);
mDAttrCont->add1(disp);
}
mAttrs[id] = disp;
@@ -743,7 +751,10 @@ void StatusWindow::action(const gcn::ActionEvent &event)
const ChangeDisplay *const attr = dynamic_cast<ChangeDisplay*>(
(*it).second);
if (attr)
- str += attr->getValue() + " ";
+ {
+ str += strprintf("%s:%s ", attr->getShortName().c_str(),
+ attr->getValue().c_str());
+ }
++ it;
}
chatWindow->addInputText(str);
@@ -751,10 +762,12 @@ void StatusWindow::action(const gcn::ActionEvent &event)
}
AttrDisplay::AttrDisplay(const Widget2 *const widget,
- const int id, const std::string &name) :
+ const int id, const std::string &name,
+ const std::string &shortName) :
Container(widget),
mId(id),
mName(name),
+ mShortName(shortName),
mLayout(new LayoutHelper(this)),
mLabel(new Label(this, name)),
mValue(new Label(this, "1 "))
@@ -785,8 +798,9 @@ std::string AttrDisplay::update()
}
DerDisplay::DerDisplay(const Widget2 *const widget,
- const int id, const std::string &name) :
- AttrDisplay(widget, id, name)
+ const int id, const std::string &name,
+ const std::string &shortName) :
+ AttrDisplay(widget, id, name, shortName)
{
ContainerPlacer place = mLayout->getPlacer(0, 0);
@@ -797,8 +811,9 @@ DerDisplay::DerDisplay(const Widget2 *const widget,
}
ChangeDisplay::ChangeDisplay(const Widget2 *const widget,
- const int id, const std::string &name) :
- AttrDisplay(widget, id, name),
+ const int id, const std::string &name,
+ const std::string &shortName) :
+ AttrDisplay(widget, id, name, shortName),
gcn::ActionListener(),
mNeeded(1),
mPoints(new Label(this, _("Max"))),