diff options
author | Tametomo <irarice@gmail.com> | 2009-06-01 11:10:05 -0600 |
---|---|---|
committer | Thorbjørn Lindeijer <thorbjorn@lindeijer.nl> | 2010-02-14 20:54:03 +0100 |
commit | d2205a452c37af39fd8f76be33863ff057658d03 (patch) | |
tree | 793619fe7478e7571eaa0ac11a4a52e0854eb520 /src/gui/focushandler.cpp | |
parent | 2bb83523cd72c030aaa37c0be2f488e395fbc886 (diff) | |
download | mana-d2205a452c37af39fd8f76be33863ff057658d03.tar.gz mana-d2205a452c37af39fd8f76be33863ff057658d03.tar.bz2 mana-d2205a452c37af39fd8f76be33863ff057658d03.tar.xz mana-d2205a452c37af39fd8f76be33863ff057658d03.zip |
Overloaded the tabNext() and tabPrevious() functions in the FocusHandler
to move a window to the top when one of its contained widgets is
focused.
Signed-off-by: Tametomo <irarice@gmail.com>
Diffstat (limited to 'src/gui/focushandler.cpp')
-rw-r--r-- | src/gui/focushandler.cpp | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/src/gui/focushandler.cpp b/src/gui/focushandler.cpp index de10fece..9a0ba6b4 100644 --- a/src/gui/focushandler.cpp +++ b/src/gui/focushandler.cpp @@ -21,6 +21,8 @@ #include "focushandler.h" +#include "gui/widgets/window.h" + void FocusHandler::requestModalFocus(gcn::Widget *widget) { /* If there is another widget with modal focus, remove its modal focus @@ -60,3 +62,38 @@ void FocusHandler::remove(gcn::Widget *widget) gcn::FocusHandler::remove(widget); } + +void FocusHandler::tabNext() +{ + gcn::FocusHandler::tabNext(); + + checkForWindow(); +} + +void FocusHandler::tabPrevious() +{ + gcn::FocusHandler::tabPrevious(); + + checkForWindow(); +} + +void FocusHandler::checkForWindow() +{ + if (mFocusedWidget) + { + gcn::Widget *widget = mFocusedWidget->getParent(); + + while (widget) + { + Window *window = dynamic_cast<Window*>(widget); + + if (window) + { + window->requestMoveToTop(); + break; + } + + widget = widget->getParent(); + } + } +} |