From 5943323aff9db6c1405177478564072e9d2214b3 Mon Sep 17 00:00:00 2001 From: Bjørn Lindeijer Date: Mon, 28 Apr 2008 18:29:04 +0000 Subject: Properly fix problems with ItemContainer in InventoryWindow not resizing properly since upgrade to Guichan 0.8.0. --- src/gui/itemcontainer.h | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) (limited to 'src/gui/itemcontainer.h') diff --git a/src/gui/itemcontainer.h b/src/gui/itemcontainer.h index 58b19179..9320cdcf 100644 --- a/src/gui/itemcontainer.h +++ b/src/gui/itemcontainer.h @@ -26,6 +26,7 @@ #include #include +#include #include @@ -42,7 +43,8 @@ namespace gcn { * * \ingroup GUI */ -class ItemContainer : public gcn::Widget, public gcn::MouseListener +class ItemContainer : public gcn::Widget, public gcn::MouseListener, + public gcn::WidgetListener { public: /** @@ -66,10 +68,9 @@ class ItemContainer : public gcn::Widget, public gcn::MouseListener void draw(gcn::Graphics *graphics); /** - * Sets the width of the container. This is used to determine the new - * height of the container. + * Called whenever the widget changes size. */ - void setWidth(int width); + void widgetResized(const gcn::Event &event); /** * Handles mouse click. @@ -110,6 +111,11 @@ class ItemContainer : public gcn::Widget, public gcn::MouseListener */ void setSelectedItem(Item *item); + /** + * Determine and set the height of the container. + */ + void recalculateHeight(); + /** * Sends out selection events to the list of selection listeners. */ @@ -122,6 +128,9 @@ class ItemContainer : public gcn::Widget, public gcn::MouseListener int mMaxItems; std::list mListeners; + + static const int gridWidth; + static const int gridHeight; }; #endif -- cgit v1.2.3-70-g09d2