summaryrefslogtreecommitdiff
path: root/src/gui/npcdialog.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2013-06-12 23:45:14 +0300
committerAndrei Karas <akaras@inbox.ru>2013-06-13 12:49:24 +0300
commit24f4c6de03a3a65df1ad9100e912e968fe9b8b18 (patch)
treed1a858ac91f493d97334499c4056abfb044501cd /src/gui/npcdialog.cpp
parent9233c3936657f6dc4ca9c73d84ea8c045b3fc09d (diff)
downloadmanaverse-24f4c6de03a3a65df1ad9100e912e968fe9b8b18.tar.gz
manaverse-24f4c6de03a3a65df1ad9100e912e968fe9b8b18.tar.bz2
manaverse-24f4c6de03a3a65df1ad9100e912e968fe9b8b18.tar.xz
manaverse-24f4c6de03a3a65df1ad9100e912e968fe9b8b18.zip
add copy to clipboard in npc dialog.
Diffstat (limited to 'src/gui/npcdialog.cpp')
-rw-r--r--src/gui/npcdialog.cpp26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/gui/npcdialog.cpp b/src/gui/npcdialog.cpp
index 2271a0bc7..0d9a27bcc 100644
--- a/src/gui/npcdialog.cpp
+++ b/src/gui/npcdialog.cpp
@@ -50,6 +50,7 @@
#include "net/net.h"
#include "net/npchandler.h"
+#include "utils/copynpaste.h"
#include "utils/gettext.h"
#include <guichan/font.hpp>
@@ -787,3 +788,28 @@ void NpcDialog::clearDialogs()
}
mNpcDialogs.clear();
}
+
+void NpcDialog::mousePressed(gcn::MouseEvent &event)
+{
+ Window::mousePressed(event);
+ if (event.getButton() == gcn::MouseEvent::RIGHT
+ && event.getSource() == mTextBox)
+ {
+ if (viewport)
+ viewport->showNpcDialogPopup(mNpcId);
+ }
+}
+
+void NpcDialog::copyToClipboard(const int npcId, const int x, const int y)
+{
+ NpcDialogs::iterator it = mNpcDialogs.find(npcId);
+ if (it != mNpcDialogs.end())
+ {
+ const BrowserBox *const text = (*it).second->mTextBox;
+ if (!text)
+ return;
+
+ std::string str = text->getTextAtPos(x, y);
+ sendBuffer(str);
+ }
+}