summaryrefslogtreecommitdiff
path: root/src/gui/npcdialog.cpp
diff options
context:
space:
mode:
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);
+ }
+}