diff options
Diffstat (limited to 'src/gui/statuswindow.cpp')
-rw-r--r-- | src/gui/statuswindow.cpp | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/src/gui/statuswindow.cpp b/src/gui/statuswindow.cpp index b96720341..fcc324730 100644 --- a/src/gui/statuswindow.cpp +++ b/src/gui/statuswindow.cpp @@ -22,6 +22,7 @@ #include "gui/statuswindow.h" +#include "chatwindow.h" #include "configuration.h" #include "event.h" #include "equipment.h" @@ -71,6 +72,14 @@ class AttrDisplay : public Container virtual Type getType() { return UNKNOWN; } + std::string getValue() + { + if (!mValue) + return "-"; + else + return mValue->getCaption(); + } + protected: AttrDisplay(int id, const std::string &name); @@ -228,6 +237,10 @@ StatusWindow::StatusWindow(): mCharacterPointsLabel = new Label("C"); place(0, 6, mCharacterPointsLabel, 5); + mCopyButton = new Button(_("Copy to chat"), "copy", this); + + place(0, 5, mCopyButton); + if (Net::getPlayerHandler()->canCorrectAttributes()) { mCorrectionPointsLabel = new Label("C"); @@ -890,6 +903,27 @@ void StatusWindow::updateStatusBar(ProgressBar *bar, bool percent A_UNUSED) } } +void StatusWindow::action(const gcn::ActionEvent &event) +{ + if (!chatWindow) + return; + + if (event.getId() == "copy") + { + Attrs::iterator it = mAttrs.begin(); + Attrs::iterator it_end = mAttrs.end(); + std::string str; + while (it != it_end) + { + ChangeDisplay *attr = dynamic_cast<ChangeDisplay*>((*it).second); + if (attr) + str += attr->getValue() + " "; + ++ it; + } + chatWindow->addInputText(str); + } +} + AttrDisplay::AttrDisplay(int id, const std::string &name): mId(id), mName(name) |