summaryrefslogtreecommitdiff
path: root/src/gui/speechbubble.cpp
diff options
context:
space:
mode:
authorIra Rice <irarice@gmail.com>2009-02-04 13:24:05 -0700
committerIra Rice <irarice@gmail.com>2009-02-04 13:24:05 -0700
commit98f8f12759fe0aaf05bc124e5682903503fe3fe6 (patch)
tree3947956b869ef055b468da218581467d17dde0be /src/gui/speechbubble.cpp
parent3d18b2830f00fc4bd85e504b54531bbc0d2c2ce0 (diff)
downloadmana-98f8f12759fe0aaf05bc124e5682903503fe3fe6.tar.gz
mana-98f8f12759fe0aaf05bc124e5682903503fe3fe6.tar.bz2
mana-98f8f12759fe0aaf05bc124e5682903503fe3fe6.tar.xz
mana-98f8f12759fe0aaf05bc124e5682903503fe3fe6.zip
Not sure how this happened in the first place, but this should ensure
that speech bubbles are always at least as long as the name is. Signed-off-by: Ira Rice <irarice@gmail.com>
Diffstat (limited to 'src/gui/speechbubble.cpp')
-rw-r--r--src/gui/speechbubble.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/gui/speechbubble.cpp b/src/gui/speechbubble.cpp
index 8e3fe3c7..1137af4b 100644
--- a/src/gui/speechbubble.cpp
+++ b/src/gui/speechbubble.cpp
@@ -73,9 +73,12 @@ void SpeechBubble::setText(std::string mText)
const int fontHeight = getFont()->getHeight();
const int numRows = mSpeechBox->getNumberOfRows() + 1;
+ int width = mCaption->getWidth() + 3;
if (numRows > 2)
{
+ if (width < mSpeechBox->getMinWidth())
+ width = mSpeechBox->getMinWidth();
setContentSize(mSpeechBox->getMinWidth() + fontHeight,
(numRows * fontHeight) + 6);
mSpeechArea->setDimension(gcn::Rectangle(4, fontHeight + 3,
@@ -84,7 +87,6 @@ void SpeechBubble::setText(std::string mText)
}
else
{
- int width = mCaption->getWidth() + 3;
if (width < getFont()->getWidth(mText))
width = getFont()->getWidth(mText);
setContentSize(width + fontHeight, (fontHeight * 2) + 6);