diff options
author | Andrei Karas <akaras@inbox.ru> | 2013-12-16 19:51:22 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2013-12-16 20:05:42 +0300 |
commit | 7f7ac0e998506fb2b19b03ae4f2ef6ef04b87b13 (patch) | |
tree | ff445411d6b69e6f65f7f83bf7ff634974f472c6 /src/gui/popups/speechbubble.cpp | |
parent | bf3205aafa71fad7138e7be8a4b641907ec056ce (diff) | |
download | manaplus-7f7ac0e998506fb2b19b03ae4f2ef6ef04b87b13.tar.gz manaplus-7f7ac0e998506fb2b19b03ae4f2ef6ef04b87b13.tar.bz2 manaplus-7f7ac0e998506fb2b19b03ae4f2ef6ef04b87b13.tar.xz manaplus-7f7ac0e998506fb2b19b03ae4f2ef6ef04b87b13.zip |
fix speechbubble size.
Diffstat (limited to 'src/gui/popups/speechbubble.cpp')
-rw-r--r-- | src/gui/popups/speechbubble.cpp | 29 |
1 files changed, 11 insertions, 18 deletions
diff --git a/src/gui/popups/speechbubble.cpp b/src/gui/popups/speechbubble.cpp index 3033b7923..7febfdf4c 100644 --- a/src/gui/popups/speechbubble.cpp +++ b/src/gui/popups/speechbubble.cpp @@ -36,16 +36,16 @@ SpeechBubble::SpeechBubble() : Popup("Speech", "speechbubble.xml"), mText(), + mSpacing(mSkin ? mSkin->getOption("spacing") : 2), mCaption(new Label(this)), mSpeechBox(new BrowserBox(this, BrowserBox::AUTO_SIZE, true, - "browserbox.xml")) + "speechbrowserbox.xml")) { setContentSize(140, 46); - setMinWidth(29); - setMinHeight(29); + setMinWidth(8); + setMinHeight(8); mCaption->setFont(boldFont); -// mSpeechBox->setEditable(false); mSpeechBox->setOpaque(false); mSpeechBox->setForegroundColorAll(getThemeColor(Theme::BUBBLE_TEXT), getThemeColor(Theme::BUBBLE_TEXT_OUTLINE)); @@ -75,28 +75,21 @@ void SpeechBubble::setText(const std::string &text, const bool showName) getThemeColor(Theme::BUBBLE_TEXT_OUTLINE)); const int pad = mPadding; - const int pad2 = 2 * pad; - int width = mCaption->getWidth() + pad2; + int width = mCaption->getWidth(); mSpeechBox->clearRows(); mSpeechBox->addRow(text); - const int speechWidth = mSpeechBox->getWidth() + pad2; + mSpeechBox->setWidth(mSpeechBox->getDataWidth()); + const int speechWidth = mSpeechBox->getWidth(); const int fontHeight = getFont()->getHeight(); - const int nameHeight = showName ? mCaption->getHeight() + pad / 2 : 0; - const int numRows = 1; - const int height = fontHeight + nameHeight + pad; + const int nameHeight = showName ? mCaption->getHeight() + mSpacing : 0; + int height = fontHeight + nameHeight; if (width < speechWidth) width = speechWidth; - width += pad2; - setContentSize(width, height); - const gcn::Rectangle &rect = mDimension; - const int xPos = ((rect.width - width) / 2); - const int yPos = ((rect.height - height) / 2) + nameHeight; - - mCaption->setPosition(xPos, pad); - mSpeechBox->setPosition(xPos, yPos); + mCaption->setPosition(0, 0); + mSpeechBox->setPosition(0, nameHeight); } |