diff options
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/beingpopup.cpp | 9 | ||||
-rw-r--r-- | src/gui/itempopup.cpp | 20 | ||||
-rw-r--r-- | src/gui/textpopup.cpp | 11 | ||||
-rw-r--r-- | src/gui/widgets/popup.cpp | 10 |
4 files changed, 21 insertions, 29 deletions
diff --git a/src/gui/beingpopup.cpp b/src/gui/beingpopup.cpp index 56faed39..381bf011 100644 --- a/src/gui/beingpopup.cpp +++ b/src/gui/beingpopup.cpp @@ -41,13 +41,12 @@ BeingPopup::BeingPopup(): // Being Name mBeingName = new Label("A"); mBeingName->setFont(boldFont); - mBeingName->setPosition(getPadding(), getPadding()); - const int fontHeight = mBeingName->getHeight() + getPadding(); + const int fontHeight = mBeingName->getHeight() + 3; // Being's party mBeingParty = new Label("A"); - mBeingParty->setPosition(getPadding(), fontHeight); + mBeingParty->setPosition(0, fontHeight); add(mBeingName); add(mBeingParty); @@ -80,12 +79,12 @@ void BeingPopup::show(int x, int y, Being *b) if (minWidth < mBeingParty->getWidth()) minWidth = mBeingParty->getWidth(); - setContentSize(minWidth + 10, (height * 2) + 10); + setContentSize(minWidth, height * 2); } else { mBeingParty->setCaption(""); - setContentSize(minWidth + 10, height + 10); + setContentSize(minWidth, height); } position(x, y); diff --git a/src/gui/itempopup.cpp b/src/gui/itempopup.cpp index c09a0504..116d29d4 100644 --- a/src/gui/itempopup.cpp +++ b/src/gui/itempopup.cpp @@ -88,7 +88,6 @@ ItemPopup::ItemPopup(): // Item Name mItemName = new Label; mItemName->setFont(boldFont); - mItemName->setPosition(getPadding(), getPadding()); // Item Description mItemDesc = new TextBox; @@ -143,12 +142,12 @@ void ItemPopup::setNoItem() mItemName->adjustSize(); mItemName->setForegroundColor(Theme::getThemeColor(Theme::GENERIC)); - mItemName->setPosition(getPadding(), getPadding()); + mItemName->setPosition(0, 0); mItemDesc->setText(std::string()); mItemEffect->setText(std::string()); - setContentSize(mItemName->getWidth() + 2 * getPadding(), 0); + setContentSize(mItemName->getWidth(), 0); } void ItemPopup::setItem(const ItemInfo &item, bool showImage) @@ -171,12 +170,7 @@ void ItemPopup::setItem(const ItemInfo &item, bool showImage) mIcon->setImage(image); if (image) - { - int x = getPadding(); - int y = getPadding(); - mIcon->setPosition(x, y); space = mIcon->getWidth(); - } } else { @@ -192,7 +186,7 @@ void ItemPopup::setItem(const ItemInfo &item, bool showImage) mItemName->setCaption(caption); mItemName->adjustSize(); mItemName->setForegroundColor(getColorFromItemType(mItemType)); - mItemName->setPosition(getPadding() + space, getPadding()); + mItemName->setPosition(space, 0); mItemDesc->setTextWrapped(item.getDescription(), ITEMPOPUP_WRAP_WIDTH); { @@ -235,7 +229,7 @@ void ItemPopup::setItem(const ItemInfo &item, bool showImage) setContentSize(minWidth, nameHeight + (numRowsDesc + numRowsWeight + 1) * fontHeight); - mItemWeight->setPosition(getPadding(), + mItemWeight->setPosition(0, nameHeight + (numRowsDesc + 1) * fontHeight); } else @@ -243,12 +237,12 @@ void ItemPopup::setItem(const ItemInfo &item, bool showImage) setContentSize(minWidth, nameHeight + (numRowsDesc + numRowsEffect + numRowsWeight + 1) * fontHeight); - mItemWeight->setPosition(getPadding(), nameHeight + (numRowsDesc + + mItemWeight->setPosition(0, nameHeight + (numRowsDesc + numRowsEffect + 1) * fontHeight); } - mItemDesc->setPosition(getPadding(), nameHeight); - mItemEffect->setPosition(getPadding(), nameHeight + + mItemDesc->setPosition(0, nameHeight); + mItemEffect->setPosition(0, nameHeight + (numRowsDesc + 1) * fontHeight); } diff --git a/src/gui/textpopup.cpp b/src/gui/textpopup.cpp index 57f80275..aca02a6d 100644 --- a/src/gui/textpopup.cpp +++ b/src/gui/textpopup.cpp @@ -43,10 +43,10 @@ TextPopup::TextPopup(): const int fontHeight = getFont()->getHeight(); mText1 = new Label; - mText1->setPosition(getPadding(), getPadding()); + mText1->setPosition(0, 0); mText2 = new Label; - mText2->setPosition(getPadding(), fontHeight + getPadding()); + mText2->setPosition(0, fontHeight); add(mText1); add(mText2); @@ -68,13 +68,10 @@ void TextPopup::show(int x, int y, const std::string &str1, const std::string &s if (mText2->getWidth() > minWidth) minWidth = mText2->getWidth(); - minWidth += 4 * getPadding(); - setWidth(minWidth); - if (!str2.empty()) - setHeight((getPadding() + mText1->getFont()->getHeight()) * 2); + setContentSize(minWidth, mText1->getFont()->getHeight() * 2); else - setHeight(2 * getPadding() + mText1->getFont()->getHeight()); + setContentSize(minWidth, mText1->getFont()->getHeight()); const int distance = 20; diff --git a/src/gui/widgets/popup.cpp b/src/gui/widgets/popup.cpp index 1c7cfdd1..3b80fe5e 100644 --- a/src/gui/widgets/popup.cpp +++ b/src/gui/widgets/popup.cpp @@ -37,8 +37,8 @@ Popup::Popup(const std::string &name, const std::string &skin): mPopupName(name), - mMinWidth(100), - mMinHeight(40), + mMinWidth(64), + mMinHeight(25), mMaxWidth(graphics->getWidth()), mMaxHeight(graphics->getHeight()) { @@ -47,7 +47,7 @@ Popup::Popup(const std::string &name, const std::string &skin): if (!windowContainer) throw GCN_EXCEPTION("Popup::Popup(): no windowContainer set"); - setPadding(3); + setPadding(8); // Loads the skin mSkin = Theme::instance()->load(skin); @@ -82,7 +82,9 @@ void Popup::draw(gcn::Graphics *graphics) gcn::Rectangle Popup::getChildrenArea() { - return gcn::Rectangle(getPadding(), 0, getWidth() - getPadding() * 2, + return gcn::Rectangle(getPadding(), + getPadding(), + getWidth() - getPadding() * 2, getHeight() - getPadding() * 2); } |