diff options
author | Andrei Karas <akaras@inbox.ru> | 2011-06-09 18:55:54 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2011-06-09 18:55:54 +0300 |
commit | 01c43410488f80156f0d47bb3762a1fe2af38b3f (patch) | |
tree | a79145b7e9df1cba08e205038e6ba4d43b13fe07 /src/gui/widgets/browserbox.cpp | |
parent | 4d875e356660d5196df8cd1ccc1e84ddfec429fd (diff) | |
parent | 352409f22230698bc32661b916f708663a4179b5 (diff) | |
download | mv-01c43410488f80156f0d47bb3762a1fe2af38b3f.tar.gz mv-01c43410488f80156f0d47bb3762a1fe2af38b3f.tar.bz2 mv-01c43410488f80156f0d47bb3762a1fe2af38b3f.tar.xz mv-01c43410488f80156f0d47bb3762a1fe2af38b3f.zip |
Merge branch 'didyouknow'
Diffstat (limited to 'src/gui/widgets/browserbox.cpp')
-rw-r--r-- | src/gui/widgets/browserbox.cpp | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/gui/widgets/browserbox.cpp b/src/gui/widgets/browserbox.cpp index f3ee7270b..140a72770 100644 --- a/src/gui/widgets/browserbox.cpp +++ b/src/gui/widgets/browserbox.cpp @@ -368,6 +368,8 @@ int BrowserBox::calcHeight() { unsigned x = 0, y = 0; int wrappedLines = 0; + int moreHeight = 0; + int maxWidth = getWidth(); int link = 0; if (getWidth() < 0) return 1; @@ -412,8 +414,12 @@ int BrowserBox::calcHeight() Image *img = resman->getImage(str); if (img) { + img->incRef(); mLineParts.push_back(LinePart(x, y, selColor, img)); - y += img->getHeight(); + y += img->getHeight() + 2; + moreHeight += img->getHeight(); + if (img->getWidth() > maxWidth) + maxWidth = img->getWidth() + 2; } continue; } @@ -570,7 +576,11 @@ int BrowserBox::calcHeight() } y += fontHeight; } - return (static_cast<int>(mTextRows.size()) + wrappedLines) * fontHeight; + if (getWidth() != maxWidth) + setWidth(maxWidth); + + return (static_cast<int>(mTextRows.size()) + wrappedLines) + * fontHeight + moreHeight; } void BrowserBox::updateHeight() |