diff options
author | Bjørn Lindeijer <bjorn@lindeijer.nl> | 2005-06-16 01:29:37 +0000 |
---|---|---|
committer | Bjørn Lindeijer <bjorn@lindeijer.nl> | 2005-06-16 01:29:37 +0000 |
commit | 06afc063b8538b90b8dd8eb662a9ae0e11812963 (patch) | |
tree | fbae681cc37ebac36a1ededa7a292d5ec8505842 /src/gui/inventory.cpp | |
parent | cf0b73ed23fa2213521c23fcd927aab37151a484 (diff) | |
download | mana-06afc063b8538b90b8dd8eb662a9ae0e11812963.tar.gz mana-06afc063b8538b90b8dd8eb662a9ae0e11812963.tar.bz2 mana-06afc063b8538b90b8dd8eb662a9ae0e11812963.tar.xz mana-06afc063b8538b90b8dd8eb662a9ae0e11812963.zip |
Fixed window resizing to work properly, and on all edges and corners.
Diffstat (limited to 'src/gui/inventory.cpp')
-rw-r--r-- | src/gui/inventory.cpp | 26 |
1 files changed, 17 insertions, 9 deletions
diff --git a/src/gui/inventory.cpp b/src/gui/inventory.cpp index 66ccff58..59be88b8 100644 --- a/src/gui/inventory.cpp +++ b/src/gui/inventory.cpp @@ -63,7 +63,7 @@ InventoryWindow::InventoryWindow(): add(itemDescriptionLabel); add(weightLabel); - setResizeable(true); + setResizable(true); setMinWidth(240); setMinHeight(150); @@ -215,18 +215,26 @@ void InventoryWindow::mouseMotion(int mx, int my) void InventoryWindow::updateWidgets() { + int width = getContent()->getWidth(); + int height = getContent()->getHeight(); + int columns = width / 24; + + if (columns < 1) + { + columns = 1; + } + // Resize widgets - useButton->setPosition(8, getHeight() - 24); - dropButton->setPosition(48 + 16, getHeight() - 24); - items->setSize(getWidth() - 24 - 12 - 1, - (INVENTORY_SIZE * 24) / (getWidth() / 24) - 1); - invenScroll->setSize(getWidth() - 16, getHeight() - 90); + useButton->setPosition(8, height - 24); + dropButton->setPosition(48 + 16, height - 24); + items->setSize(width - 24 - 12 - 1, + (INVENTORY_SIZE * 24) / columns - 1); + invenScroll->setSize(width - 16, height - 90); - itemNameLabel->setPosition(8, invenScroll->getY() + invenScroll->getHeight() + 4); + itemNameLabel->setPosition(8, + invenScroll->getY() + invenScroll->getHeight() + 4); itemDescriptionLabel->setPosition(8, itemNameLabel->getY() + itemNameLabel->getHeight() + 4); - - setContentSize(getWidth(), getHeight()); } void InventoryWindow::updateButtons() |