diff options
author | Andrei Karas <akaras@inbox.ru> | 2012-01-22 02:20:43 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2012-01-22 02:20:43 +0300 |
commit | e71376322cbe85d59ca7d1a9d7f2a3db9ae9b914 (patch) | |
tree | 4e9f65c3ef67e6e06e1e1dca140e2d7ef6a22ff7 /src/gui/widgets/browserbox.cpp | |
parent | b6eb53b9abdf48b88cb1978b9af97f2a879d2717 (diff) | |
parent | acc25a7dffefb8b8b4e8022af918794d26048453 (diff) | |
download | plus-e71376322cbe85d59ca7d1a9d7f2a3db9ae9b914.tar.gz plus-e71376322cbe85d59ca7d1a9d7f2a3db9ae9b914.tar.bz2 plus-e71376322cbe85d59ca7d1a9d7f2a3db9ae9b914.tar.xz plus-e71376322cbe85d59ca7d1a9d7f2a3db9ae9b914.zip |
Merge commit 'v1.2.1.22' into stripped
Conflicts:
data/fonts/mplus-1p-bold.ttf
data/fonts/mplus-1p-regular.ttf
src/CMakeLists.txt
src/Makefile.am
src/guichan/gui.cpp
Diffstat (limited to 'src/gui/widgets/browserbox.cpp')
-rw-r--r-- | src/gui/widgets/browserbox.cpp | 39 |
1 files changed, 34 insertions, 5 deletions
diff --git a/src/gui/widgets/browserbox.cpp b/src/gui/widgets/browserbox.cpp index 5ded29c55..5856a91b1 100644 --- a/src/gui/widgets/browserbox.cpp +++ b/src/gui/widgets/browserbox.cpp @@ -2,7 +2,7 @@ * The ManaPlus Client * Copyright (C) 2004-2009 The Mana World Development Team * Copyright (C) 2009-2010 The Mana Developers - * Copyright (C) 2011 The ManaPlus Developers + * Copyright (C) 2011-2012 The ManaPlus Developers * Copyright (C) 2009 Aethyra Development Team * * This file is part of The ManaPlus Client. @@ -79,6 +79,7 @@ BrowserBox::BrowserBox(unsigned int mode, bool opaque): mColors[PURPLE] = Theme::getThemeColor(Theme::PURPLE); mColors[GRAY] = Theme::getThemeColor(Theme::GRAY); mColors[BROWN] = Theme::getThemeColor(Theme::BROWN); + setForegroundColor(Theme::getThemeColor(Theme::TEXT)); } BrowserBox::~BrowserBox() @@ -406,8 +407,8 @@ int BrowserBox::calcHeight() char const *hyphen = "~"; int hyphenWidth = font->getWidth(hyphen); - gcn::Color selColor = Theme::getThemeColor(Theme::TEXT); - const gcn::Color textColor = Theme::getThemeColor(Theme::TEXT); + gcn::Color selColor = getForegroundColor(); + const gcn::Color textColor = getForegroundColor(); ResourceManager *resman = ResourceManager::getInstance(); mLineParts.clear(); @@ -450,6 +451,7 @@ int BrowserBox::calcHeight() } gcn::Color prevColor = selColor; + bold = false; // TODO: Check if we must take texture size limits into account here // TODO: Check if some of the O(n) calls can be removed @@ -465,8 +467,6 @@ int BrowserBox::calcHeight() wrapped = false; } - bold = false; - // "Tokenize" the string at control sequences if (mUseLinksAndUserColors) end = row.find("##", start + 1); @@ -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) |