diff options
author | Aaron Marks <nymacro@gmail.com> | 2005-04-09 13:33:35 +0000 |
---|---|---|
committer | Aaron Marks <nymacro@gmail.com> | 2005-04-09 13:33:35 +0000 |
commit | 744cc5f0f3d07b86fd781e2e813201d6c33b154d (patch) | |
tree | 09df6c63913c6a1ec3f423414cc6923ea86e6484 /src | |
parent | b81c5e80634736b0069eedfa56604c141e7c9bbf (diff) | |
download | mana-client-744cc5f0f3d07b86fd781e2e813201d6c33b154d.tar.gz mana-client-744cc5f0f3d07b86fd781e2e813201d6c33b154d.tar.bz2 mana-client-744cc5f0f3d07b86fd781e2e813201d6c33b154d.tar.xz mana-client-744cc5f0f3d07b86fd781e2e813201d6c33b154d.zip |
Fixed up problem with inventory display.
Added maximum width/height of window (for resizing).
Diffstat (limited to 'src')
-rw-r--r-- | src/gui/inventory.cpp | 9 | ||||
-rw-r--r-- | src/gui/window.cpp | 17 | ||||
-rw-r--r-- | src/gui/window.h | 14 |
3 files changed, 36 insertions, 4 deletions
diff --git a/src/gui/inventory.cpp b/src/gui/inventory.cpp index 17903ba3..7bf5971f 100644 --- a/src/gui/inventory.cpp +++ b/src/gui/inventory.cpp @@ -168,9 +168,10 @@ void InventoryWindow::mouseMotion(int mx, int my) void InventoryWindow::updateWidgets() { //resize widgets - useButton->setPosition(20, getHeight() - 48); - dropButton->setPosition(60, getHeight() - 48); - items->setSize(getWidth() - 24 - 12 - 8 - 1, (getHeight() - 40 - 8 - 1) + items->getQuantity() * 24 - 1); - invenScroll->setSize(getWidth() - 32, getHeight() - 48 - 8); + useButton->setPosition(20, getHeight() - 24); + dropButton->setPosition(60, getHeight() - 24); + items->setSize(getWidth() - 24 - 12 - 8 - 1, (INVENTORY_SIZE * 24) / (getWidth() / 24) - 1); + invenScroll->setSize(getWidth() - 32, getHeight() - 32 - 8); setContentSize(getWidth(), getHeight()); } + diff --git a/src/gui/window.cpp b/src/gui/window.cpp index ee2474ba..c9c51032 100644 --- a/src/gui/window.cpp +++ b/src/gui/window.cpp @@ -35,6 +35,8 @@ Window::Window(const std::string& caption, bool modal, Window *parent): modal(modal), minWinWidth(256), minWinHeight(128), + maxWinWidth(512), + maxWinHeight(512), isWinResizeable(false) { logger.log("Window::Window(\"%s\")", caption.c_str()); @@ -169,6 +171,16 @@ void Window::setMinHeight(unsigned int height) minWinHeight = height; } +void Window::setMaxWidth(unsigned int width) +{ + maxWinWidth = width; +} + +void Window::setMaxHeight(unsigned int height) +{ + maxWinHeight = height; +} + void Window::setResizeable(bool r) { isWinResizeable = r; @@ -224,6 +236,11 @@ void Window::mouseMotion(int mx, int my) mx = minWinWidth; if (my < minWinHeight) my = minWinHeight; + if (mx >= maxWinWidth) + mx = maxWinWidth - 1; + if (my >= maxWinHeight) + my = maxWinHeight - 1; + setWidth(mx); setHeight(my); } else { diff --git a/src/gui/window.h b/src/gui/window.h index 33c7f5b8..b7cab031 100644 --- a/src/gui/window.h +++ b/src/gui/window.h @@ -53,6 +53,9 @@ class Window : public gcn::Window, public ConfigListener bool isWinResizeable; /**< Window can be resized */ int minWinWidth; /**< Minimum window width */ int minWinHeight; /**< Minimum window height */ + int maxWinWidth; /**< Maximum window width */ + int maxWinHeight; /**< Maximum window height */ + /** The window container windows add themselves to. */ static WindowContainer* windowContainer; @@ -141,6 +144,17 @@ class Window : public gcn::Window, public ConfigListener */ void setMinHeight(unsigned int height); + /** + * Sets the maximum width of the window + */ + void setMaxWidth(unsigned int width); + + /** + * Sets the minimum height of the window + */ + void setMaxHeight(unsigned int height); + + /** * Returns the parent window. * |