summaryrefslogtreecommitdiff
path: root/src/gui/windows/statuswindow.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2016-07-25 18:00:58 +0300
committerAndrei Karas <akaras@inbox.ru>2016-07-25 18:00:58 +0300
commitd6bbfaaf473f369b3bd893aa5e52403ea575e5c7 (patch)
tree25eed6eb82551799de7ef627919475faf8639315 /src/gui/windows/statuswindow.cpp
parent5d82960de69aef6b9668b8454cb701e1db97af60 (diff)
downloadplus-d6bbfaaf473f369b3bd893aa5e52403ea575e5c7.tar.gz
plus-d6bbfaaf473f369b3bd893aa5e52403ea575e5c7.tar.bz2
plus-d6bbfaaf473f369b3bd893aa5e52403ea575e5c7.tar.xz
plus-d6bbfaaf473f369b3bd893aa5e52403ea575e5c7.zip
Move attrdisplay class into separate file.
Diffstat (limited to 'src/gui/windows/statuswindow.cpp')
-rw-r--r--src/gui/windows/statuswindow.cpp36
1 files changed, 2 insertions, 34 deletions
diff --git a/src/gui/windows/statuswindow.cpp b/src/gui/windows/statuswindow.cpp
index b37896476..4cc02794c 100644
--- a/src/gui/windows/statuswindow.cpp
+++ b/src/gui/windows/statuswindow.cpp
@@ -45,6 +45,8 @@
#include "gui/widgets/vertcontainer.h"
#include "gui/widgets/windowcontainer.h"
+#include "gui/widgets/attrs/attrdisplay.h"
+
#include "net/inventoryhandler.h"
#include "net/playerhandler.h"
#include "net/serverfeatures.h"
@@ -712,40 +714,6 @@ void StatusWindow::action(const ActionEvent &event)
}
}
-AttrDisplay::AttrDisplay(const Widget2 *const widget,
- const AttributesT id,
- const std::string &restrict name,
- const std::string &restrict shortName) :
- Container(widget),
- mId(id),
- mName(name),
- mShortName(shortName),
- mLayout(new LayoutHelper(this)),
- mLabel(new Label(this, name)),
- mValue(new Label(this, "1 "))
-{
- setSize(100, 32);
-
- mLabel->setAlignment(Graphics::CENTER);
- mValue->setAlignment(Graphics::CENTER);
-}
-
-AttrDisplay::~AttrDisplay()
-{
- delete2(mLayout);
-}
-
-std::string AttrDisplay::update()
-{
- const int base = PlayerInfo::getStatBase(mId);
- const int bonus = PlayerInfo::getStatMod(mId);
- std::string value = toString(base + bonus);
- if (bonus)
- value.append(strprintf("=%d%+d", base, bonus));
- mValue->setCaption(value);
- return mName;
-}
-
DerDisplay::DerDisplay(const Widget2 *const widget,
const AttributesT id,
const std::string &restrict name,