diff options
author | Thorbjørn Lindeijer <bjorn@lindeijer.nl> | 2024-03-27 15:54:25 +0100 |
---|---|---|
committer | Thorbjørn Lindeijer <bjorn@lindeijer.nl> | 2024-03-28 09:34:21 +0100 |
commit | 474442f1a49d29d85de769c4fbb3aa8636877b49 (patch) | |
tree | 2d8218d3648f370d31009831c86fc4c6b9f30033 /src/gui/beingpopup.cpp | |
parent | dac3832265fa17de8d3b9d3ea8d930b83efe9c17 (diff) | |
download | mana-474442f1a49d29d85de769c4fbb3aa8636877b49.tar.gz mana-474442f1a49d29d85de769c4fbb3aa8636877b49.tar.bz2 mana-474442f1a49d29d85de769c4fbb3aa8636877b49.tar.xz mana-474442f1a49d29d85de769c4fbb3aa8636877b49.zip |
Fixed size and child positions for various popups
Most prominently, fixes the tooltips on the window buttons being clipped
due to their position being slightly outside of the clipping children
area. And fixes NPC tooltips from having a lot of empty space below the
NPC name.
Also reduced the space between texts in the item tooltip to match the
padding rather than being an entire empty line.
Diffstat (limited to 'src/gui/beingpopup.cpp')
-rw-r--r-- | src/gui/beingpopup.cpp | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/src/gui/beingpopup.cpp b/src/gui/beingpopup.cpp index 9cb585db..c11937e9 100644 --- a/src/gui/beingpopup.cpp +++ b/src/gui/beingpopup.cpp @@ -21,11 +21,8 @@ #include "gui/beingpopup.h" #include "being.h" -#include "graphics.h" -#include "units.h" #include "gui/gui.h" -#include "gui/palette.h" #include "gui/widgets/label.h" @@ -38,16 +35,19 @@ BeingPopup::BeingPopup(): Popup("BeingPopup") { + setMinWidth(0); + setMinHeight(0); + + const int fontHeight = getFont()->getHeight(); + // Being Name mBeingName = new Label("A"); mBeingName->setFont(boldFont); - mBeingName->setPosition(getPadding(), getPadding()); - - const int fontHeight = mBeingName->getHeight() + getPadding(); + mBeingName->setPosition(0, 0); // Being's party mBeingParty = new Label("A"); - mBeingParty->setPosition(getPadding(), fontHeight); + mBeingParty->setPosition(0, fontHeight); add(mBeingName); add(mBeingParty); @@ -67,7 +67,7 @@ void BeingPopup::show(int x, int y, Being *b) mBeingName->adjustSize(); int minWidth = mBeingName->getWidth(); - const int height = getFont()->getHeight(); + const int fontHeight = getFont()->getHeight(); if (!(b->getPartyName().empty())) { @@ -75,15 +75,14 @@ void BeingPopup::show(int x, int y, Being *b) b->getPartyName().c_str())); mBeingParty->adjustSize(); - if (minWidth < mBeingParty->getWidth()) - minWidth = mBeingParty->getWidth(); + minWidth = std::max(minWidth, mBeingParty->getWidth()); - setContentSize(minWidth + 10, (height * 2) + 10); + setContentSize(minWidth, (fontHeight * 2)); } else { mBeingParty->setCaption(std::string()); - setContentSize(minWidth + 10, height + 10); + setContentSize(minWidth, fontHeight); } position(x, y); |