diff options
author | Ira Rice <irarice@gmail.com> | 2009-02-10 17:24:57 -0700 |
---|---|---|
committer | Ira Rice <irarice@gmail.com> | 2009-02-10 17:24:57 -0700 |
commit | d067d7da8e6ee333a4941d4fe6ee9eb926d37f00 (patch) | |
tree | 03374aa436a0f2e1f3ba7cca250f260a5b4d60d3 /src/gui/speechbubble.cpp | |
parent | 00d8f57800042a324795b30dd35b21d67d47a2aa (diff) | |
download | mana-d067d7da8e6ee333a4941d4fe6ee9eb926d37f00.tar.gz mana-d067d7da8e6ee333a4941d4fe6ee9eb926d37f00.tar.bz2 mana-d067d7da8e6ee333a4941d4fe6ee9eb926d37f00.tar.xz mana-d067d7da8e6ee333a4941d4fe6ee9eb926d37f00.zip |
Added two more options for displaying speech overhead (don't show it at
all and show speech bubbles without names). Since a checkbox won't work
any more for all of these modes, it's now a slider.
Signed-off-by: Ira Rice <irarice@gmail.com>
Diffstat (limited to 'src/gui/speechbubble.cpp')
-rw-r--r-- | src/gui/speechbubble.cpp | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/src/gui/speechbubble.cpp b/src/gui/speechbubble.cpp index f8c69e87..7a191c37 100644 --- a/src/gui/speechbubble.cpp +++ b/src/gui/speechbubble.cpp @@ -74,20 +74,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() |