summaryrefslogtreecommitdiff
path: root/src/gui/widgets/browserbox.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2011-06-07 23:12:08 +0300
committerAndrei Karas <akaras@inbox.ru>2011-06-09 18:54:45 +0300
commit352409f22230698bc32661b916f708663a4179b5 (patch)
treeae61ad48814a076ae5f32137c297fc1b3198ab7c /src/gui/widgets/browserbox.cpp
parent59ce7917ffb4e6b89593a54fed590d439585ae5f (diff)
downloadManaVerse-352409f22230698bc32661b916f708663a4179b5.tar.gz
ManaVerse-352409f22230698bc32661b916f708663a4179b5.tar.bz2
ManaVerse-352409f22230698bc32661b916f708663a4179b5.tar.xz
ManaVerse-352409f22230698bc32661b916f708663a4179b5.zip
Add "did you know?" dialog and some messages for it.
Fix browserbox images position and size.
Diffstat (limited to 'src/gui/widgets/browserbox.cpp')
-rw-r--r--src/gui/widgets/browserbox.cpp14
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()