summaryrefslogtreecommitdiff
path: root/src/gui/itemcontainer.h
diff options
context:
space:
mode:
authorBjørn Lindeijer <bjorn@lindeijer.nl>2008-04-28 18:29:04 +0000
committerBjørn Lindeijer <bjorn@lindeijer.nl>2008-04-28 18:29:04 +0000
commit5943323aff9db6c1405177478564072e9d2214b3 (patch)
tree410aa9db803119f4ae1ee09883591f382390a5b1 /src/gui/itemcontainer.h
parenta59a96dc0f162a48f8cedcc804e9f89af3b1b9d3 (diff)
downloadMana-5943323aff9db6c1405177478564072e9d2214b3.tar.gz
Mana-5943323aff9db6c1405177478564072e9d2214b3.tar.bz2
Mana-5943323aff9db6c1405177478564072e9d2214b3.tar.xz
Mana-5943323aff9db6c1405177478564072e9d2214b3.zip
Properly fix problems with ItemContainer in InventoryWindow not resizing
properly since upgrade to Guichan 0.8.0.
Diffstat (limited to 'src/gui/itemcontainer.h')
-rw-r--r--src/gui/itemcontainer.h17
1 files changed, 13 insertions, 4 deletions
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 <guichan/mouselistener.hpp>
#include <guichan/widget.hpp>
+#include <guichan/widgetlistener.hpp>
#include <list>
@@ -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.
@@ -111,6 +112,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.
*/
void distributeValueChangedEvent();
@@ -122,6 +128,9 @@ class ItemContainer : public gcn::Widget, public gcn::MouseListener
int mMaxItems;
std::list<gcn::SelectionListener*> mListeners;
+
+ static const int gridWidth;
+ static const int gridHeight;
};
#endif