summaryrefslogtreecommitdiff
path: root/src/gui/speechbubble.cpp
diff options
context:
space:
mode:
authorBjørn Lindeijer <bjorn@lindeijer.nl>2009-02-15 18:29:15 +0100
committerBjørn Lindeijer <bjorn@lindeijer.nl>2009-02-15 18:29:15 +0100
commit83bbc5cc3afeea0f0b248cd755e1011f4760a298 (patch)
tree1207131c234ad7c5ae6a5849d1d5d53de45b1b0b /src/gui/speechbubble.cpp
parent7b3b60f86c545e0c5b6b8cb1ab7b1cbbf22d5e02 (diff)
parent38708de52f00689088eda29f9b6ee257ce7038ad (diff)
downloadmana-83bbc5cc3afeea0f0b248cd755e1011f4760a298.tar.gz
mana-83bbc5cc3afeea0f0b248cd755e1011f4760a298.tar.bz2
mana-83bbc5cc3afeea0f0b248cd755e1011f4760a298.tar.xz
mana-83bbc5cc3afeea0f0b248cd755e1011f4760a298.zip
Merge commit 'aethyra/master'
Conflicts: CMakeLists.txt configure.ac data/help/header.txt packaging/windows/setup.nsi po/POTFILES.in src/being.cpp src/being.h src/game.cpp src/gui/color.cpp src/gui/color.h src/gui/equipmentwindow.h src/gui/popupmenu.cpp src/gui/recorder.cpp src/gui/setup_colors.h src/gui/setup_keyboard.cpp src/gui/setup_keyboard.h src/gui/skill.cpp src/gui/speechbubble.cpp src/gui/speechbubble.h src/gui/table.cpp src/keyboardconfig.cpp src/keyboardconfig.h src/localplayer.cpp src/main.cpp src/main.h src/map.cpp src/resources/colordb.cpp src/resources/colordb.h src/resources/emotedb.cpp src/resources/emotedb.h src/text.cpp src/text.h src/tmw.rc src/winver.h
Diffstat (limited to 'src/gui/speechbubble.cpp')
-rw-r--r--src/gui/speechbubble.cpp20
1 files changed, 14 insertions, 6 deletions
diff --git a/src/gui/speechbubble.cpp b/src/gui/speechbubble.cpp
index dd404a63..c1451d51 100644
--- a/src/gui/speechbubble.cpp
+++ b/src/gui/speechbubble.cpp
@@ -73,20 +73,28 @@ void SpeechBubble::setCaption(const std::string &name, const gcn::Color &color)
mCaption->setForegroundColor(color);
}
-void SpeechBubble::setText(std::string mText)
+void SpeechBubble::setText(std::string mText, bool showName)
{
- int width = mCaption->getWidth() + 3;
+ int width = mCaption->getWidth();
mSpeechBox->setTextWrapped(mText, 130 > width ? 130 : width);
const int fontHeight = getFont()->getHeight();
- const int numRows = mSpeechBox->getNumberOfRows() + 1;
+ const int numRows = showName ? mSpeechBox->getNumberOfRows() + 1 :
+ mSpeechBox->getNumberOfRows();
+ int yPos = showName ? fontHeight + 3 : 3;
+ int height = (numRows * fontHeight);
if (width < mSpeechBox->getMinWidth())
width = mSpeechBox->getMinWidth();
- setContentSize(width + fontHeight, (numRows * fontHeight) + 6);
- mSpeechArea->setDimension(gcn::Rectangle(4, fontHeight + 3, width + 5,
- (numRows * fontHeight)));
+ if (numRows == 1)
+ {
+ yPos = (fontHeight / 4) + 3;
+ height = ((3 * fontHeight) / 2) + 1;
+ }
+
+ setContentSize(width + fontHeight, height + 6);
+ mSpeechArea->setDimension(gcn::Rectangle(4, yPos, width + 5, height));
}
unsigned int SpeechBubble::getNumRows()