summaryrefslogtreecommitdiff
path: root/src/gui/widgets
diff options
context:
space:
mode:
authorTametomo <irarice@gmail.com>2009-07-16 08:53:08 -0600
committerThorbjørn Lindeijer <thorbjorn@lindeijer.nl>2010-02-14 21:54:11 +0100
commitd33ed5923ab5336005257203d21ddcb3d37d0ff8 (patch)
tree5eefe32329abd94851a71f5b591bcbc3cad464b7 /src/gui/widgets
parent135ed667ef82eaf348ce043a9864a6e7864ebad3 (diff)
downloadmana-d33ed5923ab5336005257203d21ddcb3d37d0ff8.tar.gz
mana-d33ed5923ab5336005257203d21ddcb3d37d0ff8.tar.bz2
mana-d33ed5923ab5336005257203d21ddcb3d37d0ff8.tar.xz
mana-d33ed5923ab5336005257203d21ddcb3d37d0ff8.zip
Remove focus from a window's internal widgets on hiding.
Signed-off-by: Tametomo <irarice@gmail.com>
Diffstat (limited to 'src/gui/widgets')
-rw-r--r--src/gui/widgets/window.cpp9
-rw-r--r--src/gui/widgets/window.h2
2 files changed, 10 insertions, 1 deletions
diff --git a/src/gui/widgets/window.cpp b/src/gui/widgets/window.cpp
index d4ecf75d..59ec8939 100644
--- a/src/gui/widgets/window.cpp
+++ b/src/gui/widgets/window.cpp
@@ -35,6 +35,7 @@
#include "resources/image.h"
#include <guichan/exception.hpp>
+#include <guichan/focushandler.hpp>
int Window::instances = 0;
int Window::mouseResize = 0;
@@ -285,6 +286,14 @@ void Window::widgetHidden(const gcn::Event &event)
{
gui->setCursorType(Gui::CURSOR_POINTER);
}
+
+ WidgetListIterator it;
+
+ for (it = mWidgets.begin(); it != mWidgets.end(); it++)
+ {
+ if (mFocusHandler->isFocused(*it))
+ mFocusHandler->focusNone();
+ }
}
void Window::setCloseButton(bool flag)
diff --git a/src/gui/widgets/window.h b/src/gui/widgets/window.h
index 37a6b1eb..5df431a3 100644
--- a/src/gui/widgets/window.h
+++ b/src/gui/widgets/window.h
@@ -105,7 +105,7 @@ class Window : public gcn::Window, gcn::WidgetListener
/**
* Called whenever the widget is hidden.
*/
- void widgetHidden(const gcn::Event &event);
+ virtual void widgetHidden(const gcn::Event& event);
/**
* Sets whether or not the window has a close button.