diff options
author | Ira Rice <irarice@gmail.com> | 2009-01-25 21:51:58 -0700 |
---|---|---|
committer | Ira Rice <irarice@gmail.com> | 2009-01-25 21:51:58 -0700 |
commit | c40a6d645c4721077313145cc5f692d19c99508a (patch) | |
tree | 8896dd147b6a5201c7053efae159f9c54a1994b0 /src/gui/inventorywindow.cpp | |
parent | 1702c84521ab707326de720aea0a53136779300d (diff) | |
download | mana-c40a6d645c4721077313145cc5f692d19c99508a.tar.gz mana-c40a6d645c4721077313145cc5f692d19c99508a.tar.bz2 mana-c40a6d645c4721077313145cc5f692d19c99508a.tar.xz mana-c40a6d645c4721077313145cc5f692d19c99508a.zip |
Fixed use button so that it starts out at the maximum width it will
need. TODO: Modify layout rendering to be able to detect resizes.
Signed-off-by: Ira Rice <irarice@gmail.com>
Diffstat (limited to 'src/gui/inventorywindow.cpp')
-rw-r--r-- | src/gui/inventorywindow.cpp | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/gui/inventorywindow.cpp b/src/gui/inventorywindow.cpp index 52198180..32817479 100644 --- a/src/gui/inventorywindow.cpp +++ b/src/gui/inventorywindow.cpp @@ -57,7 +57,17 @@ InventoryWindow::InventoryWindow(int invSize): // If you adjust these defaults, don't forget to adjust the trade window's. setDefaultSize(115, 25, 322, 200); - mUseButton = new Button(_("Use"), "use", this); + std::string longestUseString = getFont()->getWidth(_("Equip")) > + getFont()->getWidth(_("Use")) ? + _("Equip") : _("Use"); + + if (getFont()->getWidth(longestUseString) < + getFont()->getWidth(_("Unequip"))) + { + longestUseString = _("Unequip"); + } + + mUseButton = new Button(longestUseString, "use", this); mDropButton = new Button(_("Drop"), "drop", this); mItems = new ItemContainer(player_node->getInventory(), 2); |