summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErik Schilling <ablu.erikschilling@googlemail.com>2011-09-18 02:39:48 +0800
committerAndrei Karas <akaras@inbox.ru>2011-09-28 21:22:21 +0300
commitd9eab6bbcd939f1238283ac9bbe003e06de4169c (patch)
tree19b08c5e1713e9e019d19312d60914ba557499db
parentb22ce8d250b1fa995f76c337e1cba6a4b164fe23 (diff)
downloadplus-d9eab6bbcd939f1238283ac9bbe003e06de4169c.tar.gz
plus-d9eab6bbcd939f1238283ac9bbe003e06de4169c.tar.bz2
plus-d9eab6bbcd939f1238283ac9bbe003e06de4169c.tar.xz
plus-d9eab6bbcd939f1238283ac9bbe003e06de4169c.zip
Fixed item popup still visible after closing inventory window.
Reviewed-by: Bertram. Conflicts: src/gui/widgets/itemcontainer.cpp
-rw-r--r--src/gui/inventorywindow.cpp6
-rw-r--r--src/gui/inventorywindow.h5
-rw-r--r--src/gui/widgets/itemcontainer.cpp5
-rw-r--r--src/gui/widgets/itemcontainer.h2
-rw-r--r--src/gui/widgets/window.h2
5 files changed, 19 insertions, 1 deletions
diff --git a/src/gui/inventorywindow.cpp b/src/gui/inventorywindow.cpp
index 35165a16a..d6377e4dd 100644
--- a/src/gui/inventorywindow.cpp
+++ b/src/gui/inventorywindow.cpp
@@ -375,6 +375,12 @@ Item *InventoryWindow::getSelectedItem() const
return mItems->getSelectedItem();
}
+void InventoryWindow::widgetHidden(const gcn::Event &event)
+{
+ Window::widgetHidden(event);
+ mItems->hidePopup();
+}
+
void InventoryWindow::mouseClicked(gcn::MouseEvent &event)
{
Window::mouseClicked(event);
diff --git a/src/gui/inventorywindow.h b/src/gui/inventorywindow.h
index 5592b9449..959f65d7c 100644
--- a/src/gui/inventorywindow.h
+++ b/src/gui/inventorywindow.h
@@ -85,6 +85,11 @@ class InventoryWindow : public Window,
Item* getSelectedItem() const;
/**
+ * Handles closing of the window
+ */
+ virtual void widgetHidden(const gcn::Event &event);
+
+ /**
* Handles the mouse clicks.
*/
void mouseClicked(gcn::MouseEvent &event);
diff --git a/src/gui/widgets/itemcontainer.cpp b/src/gui/widgets/itemcontainer.cpp
index 2cc80ee8b..de8b3c277 100644
--- a/src/gui/widgets/itemcontainer.cpp
+++ b/src/gui/widgets/itemcontainer.cpp
@@ -327,6 +327,11 @@ void ItemContainer::distributeValueChangedEvent()
}
}
+void ItemContainer::hidePopup()
+{
+ mItemPopup->setVisible(false);
+}
+
void ItemContainer::keyPressed(gcn::KeyEvent &event A_UNUSED)
{
/*switch (event.getKey().getValue())
diff --git a/src/gui/widgets/itemcontainer.h b/src/gui/widgets/itemcontainer.h
index 845bfb3a9..e4188f54b 100644
--- a/src/gui/widgets/itemcontainer.h
+++ b/src/gui/widgets/itemcontainer.h
@@ -73,6 +73,8 @@ class ItemContainer : public gcn::Widget,
*/
virtual ~ItemContainer();
+ void hidePopup();
+
/**
* Necessary for checking how full the inventory is.
*/
diff --git a/src/gui/widgets/window.h b/src/gui/widgets/window.h
index cc7c6e6a1..ffc27ab10 100644
--- a/src/gui/widgets/window.h
+++ b/src/gui/widgets/window.h
@@ -120,7 +120,7 @@ class Window : public gcn::Window, gcn::WidgetListener
/**
* Called whenever the widget is hidden.
*/
- virtual void widgetHidden(const gcn::Event& event);
+ virtual void widgetHidden(const gcn::Event &event);
/**
* Sets whether or not the window has a close button.