diff options
author | Tametomo <irarice@gmail.com> | 2009-07-16 08:53:08 -0600 |
---|---|---|
committer | Thorbjørn Lindeijer <thorbjorn@lindeijer.nl> | 2010-02-14 21:54:11 +0100 |
commit | d33ed5923ab5336005257203d21ddcb3d37d0ff8 (patch) | |
tree | 5eefe32329abd94851a71f5b591bcbc3cad464b7 /src | |
parent | 135ed667ef82eaf348ce043a9864a6e7864ebad3 (diff) | |
download | mana-client-d33ed5923ab5336005257203d21ddcb3d37d0ff8.tar.gz mana-client-d33ed5923ab5336005257203d21ddcb3d37d0ff8.tar.bz2 mana-client-d33ed5923ab5336005257203d21ddcb3d37d0ff8.tar.xz mana-client-d33ed5923ab5336005257203d21ddcb3d37d0ff8.zip |
Remove focus from a window's internal widgets on hiding.
Signed-off-by: Tametomo <irarice@gmail.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/gui/widgets/window.cpp | 9 | ||||
-rw-r--r-- | src/gui/widgets/window.h | 2 |
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. |