summaryrefslogtreecommitdiff
path: root/src/gui/widgets
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2011-12-03 21:05:17 +0300
committerAndrei Karas <akaras@inbox.ru>2011-12-03 21:05:17 +0300
commit284458d6c7644159eb14479e9f41127fd400ffdb (patch)
tree802e190c77a337a7645e1b6d01f66dcbbf8ef2e5 /src/gui/widgets
parent5acadea119fc2a89e944dc9431e298e5e9544770 (diff)
downloadmanaverse-284458d6c7644159eb14479e9f41127fd400ffdb.tar.gz
manaverse-284458d6c7644159eb14479e9f41127fd400ffdb.tar.bz2
manaverse-284458d6c7644159eb14479e9f41127fd400ffdb.tar.xz
manaverse-284458d6c7644159eb14479e9f41127fd400ffdb.zip
Allow copy any line from chat log to clipboard by
context menu item "Copy to clipboard".
Diffstat (limited to 'src/gui/widgets')
-rw-r--r--src/gui/widgets/browserbox.cpp29
-rw-r--r--src/gui/widgets/browserbox.h3
2 files changed, 32 insertions, 0 deletions
diff --git a/src/gui/widgets/browserbox.cpp b/src/gui/widgets/browserbox.cpp
index 5ded29c55..4af38bf67 100644
--- a/src/gui/widgets/browserbox.cpp
+++ b/src/gui/widgets/browserbox.cpp
@@ -645,6 +645,35 @@ void BrowserBox::updateHeight()
}
}
+std::string BrowserBox::getTextAtPos(const int x, const int y)
+{
+ int textX = 0;
+ int textY = 0;
+
+ getAbsolutePosition(textX, textY);
+ if (x < textX || y < textY)
+ return ""; // mouse position ourside of correct widget (outside of tab)
+
+ textX = x - textX;
+ textY = y - textY;
+
+ std::string str = "";
+
+ for (LinePartIterator i = mLineParts.begin();
+ i != mLineParts.end();
+ ++i)
+ {
+ const LinePart &part = *i;
+ if (part.mY + 50 < mYStart)
+ continue;
+ if (part.mY > textY)
+ break;
+ str = part.mText;
+ }
+
+ return str;
+}
+
LinePart::~LinePart()
{
if (mImage)
diff --git a/src/gui/widgets/browserbox.h b/src/gui/widgets/browserbox.h
index 06609b318..e26ae32e0 100644
--- a/src/gui/widgets/browserbox.h
+++ b/src/gui/widgets/browserbox.h
@@ -137,6 +137,7 @@ class BrowserBox : public gcn::Widget,
* Handles mouse actions.
*/
void mousePressed(gcn::MouseEvent &event);
+
void mouseMoved(gcn::MouseEvent &event);
/**
@@ -198,6 +199,8 @@ class BrowserBox : public gcn::Widget,
void setEnableImages(bool n)
{ mEnableImages = n; }
+ std::string getTextAtPos(const int x, const int y);
+
private:
int calcHeight();