diff options
author | Andrei Karas <akaras@inbox.ru> | 2011-10-02 18:57:10 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2011-10-02 18:57:10 +0300 |
commit | f1e92aca00a4859047e83fab76220767b9a2f814 (patch) | |
tree | 8aaa9d6853c6a8e0e8fc568c6f981cbd889b0cc3 /src/gui/spellpopup.cpp | |
parent | 70b520b1e876f9698bb95baa2d274ea289a0c6bd (diff) | |
parent | 99771a1fb50286fdb0b511f425312503e657eddc (diff) | |
download | manaverse-f1e92aca00a4859047e83fab76220767b9a2f814.tar.gz manaverse-f1e92aca00a4859047e83fab76220767b9a2f814.tar.bz2 manaverse-f1e92aca00a4859047e83fab76220767b9a2f814.tar.xz manaverse-f1e92aca00a4859047e83fab76220767b9a2f814.zip |
Merge branch 'master' into strippedstripped1.1.10.2
Conflicts:
packaging/debian/watch
Diffstat (limited to 'src/gui/spellpopup.cpp')
-rw-r--r-- | src/gui/spellpopup.cpp | 35 |
1 files changed, 29 insertions, 6 deletions
diff --git a/src/gui/spellpopup.cpp b/src/gui/spellpopup.cpp index c7d25e257..66d69b197 100644 --- a/src/gui/spellpopup.cpp +++ b/src/gui/spellpopup.cpp @@ -42,14 +42,15 @@ #include "debug.h" SpellPopup::SpellPopup(): - Popup("SpellPopup", "spellpopup.xml") + Popup("SpellPopup", "spellpopup.xml"), + mItemName(new Label), + mItemComment(new Label) { - // Item Name - mItemName = new Label; mItemName->setFont(boldFont); - mItemName->setPosition(getPadding(), getPadding()); add(mItemName); + add(mItemComment); + addMouseListener(this); } @@ -60,17 +61,39 @@ SpellPopup::~SpellPopup() void SpellPopup::setItem(TextCommand *spell) { if (spell) + { mItemName->setCaption(spell->getName()); + mItemComment->setCaption(spell->getComment()); + } else + { mItemName->setCaption("?"); + mItemComment->setCaption(""); + } mItemName->adjustSize(); + mItemComment->adjustSize(); int minWidth = mItemName->getWidth(); + if (mItemComment->getWidth() > minWidth) + minWidth = mItemComment->getWidth(); minWidth += 8; - setWidth(minWidth); + setWidth(minWidth + 2 * getPadding()); - setContentSize(minWidth, getPadding() + getFont()->getHeight()); + mItemName->setPosition(getPadding(), getPadding()); + mItemComment->setPosition(getPadding(), + getPadding() + mItemName->getHeight()); + + if (mItemComment->getCaption() != "") + { + setContentSize(minWidth, getPadding() + + 2 * getFont()->getHeight()); + } + else + { + setContentSize(minWidth, getPadding() + + getFont()->getHeight()); + } } void SpellPopup::view(int x, int y) |