From 24f4c6de03a3a65df1ad9100e912e968fe9b8b18 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Wed, 12 Jun 2013 23:45:14 +0300 Subject: add copy to clipboard in npc dialog. --- src/gui/npcdialog.cpp | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'src/gui/npcdialog.cpp') 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 @@ -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); + } +} -- cgit v1.2.3-60-g2f50