From 352409f22230698bc32661b916f708663a4179b5 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Tue, 7 Jun 2011 23:12:08 +0300 Subject: Add "did you know?" dialog and some messages for it. Fix browserbox images position and size. --- src/gui/widgets/browserbox.cpp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'src/gui/widgets/browserbox.cpp') 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(mTextRows.size()) + wrappedLines) * fontHeight; + if (getWidth() != maxWidth) + setWidth(maxWidth); + + return (static_cast(mTextRows.size()) + wrappedLines) + * fontHeight + moreHeight; } void BrowserBox::updateHeight() -- cgit v1.2.3-60-g2f50