diff options
author | Ira Rice <irarice@gmail.com> | 2008-10-10 17:48:27 +0000 |
---|---|---|
committer | Ira Rice <irarice@gmail.com> | 2008-10-10 17:48:27 +0000 |
commit | 7729faaadff2e6f92d24f43e52d085f4b11be315 (patch) | |
tree | 282a8dd26928a0b71ee0262ff6c9f0e491708026 /src/gui/speechbubble.cpp | |
parent | 8d27447b01407d6605b1fed89fcd556572d8cfca (diff) | |
download | mana-7729faaadff2e6f92d24f43e52d085f4b11be315.tar.gz mana-7729faaadff2e6f92d24f43e52d085f4b11be315.tar.bz2 mana-7729faaadff2e6f92d24f43e52d085f4b11be315.tar.xz mana-7729faaadff2e6f92d24f43e52d085f4b11be315.zip |
Did a little bit of code cleanup (mostly from TMW changes) as well as
properly implemented line wrapping. Now, there are no more visual
artifacts for speech boxes, and it always chooses the most optimal box
size (which required that npc_text use it also. Do any other gui
classes use the textbox class?).
Diffstat (limited to 'src/gui/speechbubble.cpp')
-rw-r--r-- | src/gui/speechbubble.cpp | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/src/gui/speechbubble.cpp b/src/gui/speechbubble.cpp index d71ceedf..c5c653e7 100644 --- a/src/gui/speechbubble.cpp +++ b/src/gui/speechbubble.cpp @@ -61,8 +61,8 @@ SpeechBubble::SpeechBubble()//: void SpeechBubble::setText(const std::string mText) { - mSpeechBox->setTextWrapped( mText ); mSpeechBox->setMinWidth(140); + mSpeechBox->setTextWrapped( mText ); int numRows = mSpeechBox->getNumberOfRows(); @@ -76,10 +76,8 @@ void SpeechBubble::setText(const std::string mText) } else { - int width; - if (this->getCaption().length() > mText.length()) - width = getFont()->getWidth(this->getCaption()); - else + int width = getFont()->getWidth(this->getCaption()); + if (width < getFont()->getWidth(mText)) width = getFont()->getWidth(mText); setContentSize(width + 15, 30); mSpeechArea->setDimension(gcn::Rectangle(4, 15, width + 5, 17)); |