#include <focushandler.hpp>
You will probably not have to use the FocusHandler directly to handle focus. Widget has functions for handling focus which uses a FocusHandler. Use them instead.
Definition at line 81 of file focushandler.hpp.
Public Member Functions | |
FocusHandler () | |
Constructor. | |
virtual | ~FocusHandler () |
Destructor. | |
virtual void | requestFocus (Widget *widget) |
Sets focus to a Widget. | |
virtual void | requestDrag (Widget *widget) |
Sets drag to a Widget. | |
virtual void | requestModalFocus (Widget *widget) |
Sets modal focus to a Widget. | |
virtual void | releaseModalFocus (Widget *widget) |
Releases modal focus if the Widget has modal focus. | |
virtual Widget * | getFocused () const |
Gets the Widget with focus. | |
virtual Widget * | getDragged () const |
Gets the widget that is dragged. | |
virtual Widget * | getModalFocused () const |
Gets the Widget with modal focus. | |
virtual void | focusNext () |
Focuses the next Widget. | |
virtual void | focusPrevious () |
Focuses the previous Widget. | |
virtual bool | isFocused (const Widget *widget) const |
Checks if a Widget is focused. | |
virtual bool | isDragged (const Widget *widget) const |
Checks if a widget is being dragged. | |
virtual void | add (Widget *widget) |
Adds a widget to the FocusHandler. | |
virtual void | remove (Widget *widget) |
Removes a widget from the FocusHandler. | |
virtual void | focusNone () |
Focuses nothing. | |
virtual void | tabNext () |
Focuses the next Widget which allows tab in unless current focused Widget disallows tab out. | |
virtual void | tabPrevious () |
Focuses the previous Widget which allows tab in unless current focused Widget disallows tab out. | |
virtual void | applyChanges () |
Applies the changes. | |
virtual void | dragNone () |
Drag nothing. | |
Protected Types | |
typedef std::vector< Widget * > | WidgetVector |
typedef WidgetVector::iterator | WidgetIterator |
Protected Attributes | |
WidgetVector | mWidgets |
Widget * | mFocusedWidget |
Widget * | mDraggedWidget |
Widget * | mToBeFocused |
Widget * | mToBeDragged |
Widget * | mModalFocusedWidget |
void gcn::FocusHandler::add | ( | Widget * | widget | ) | [virtual] |
Adds a widget to the FocusHandler.
widget | the widget to add. |
Definition at line 250 of file focushandler.cpp.
References mWidgets.
Referenced by gcn::Widget::_setFocusHandler().
void gcn::FocusHandler::focusNext | ( | ) | [virtual] |
Focuses the next Widget.
If no Widget has focus the first Widget gets focus. The order in which the Widgets are focused depends on the order you add them to the GUI.
Definition at line 130 of file focushandler.cpp.
References mFocusedWidget, and mWidgets.
void gcn::FocusHandler::focusPrevious | ( | ) | [virtual] |
Focuses the previous Widget.
If no Widget has focus the first Widget gets focus. The order in which the widgets are focused depends on the order you add them to the GUI.
Definition at line 182 of file focushandler.cpp.
References mFocusedWidget, and mWidgets.
Widget * gcn::FocusHandler::getDragged | ( | ) | const [virtual] |
Gets the widget that is dragged.
Definition at line 120 of file focushandler.cpp.
References mDraggedWidget.
Referenced by gcn::BasicContainer::_mouseInputMessage(), and gcn::Gui::logic().
Widget * gcn::FocusHandler::getFocused | ( | ) | const [virtual] |
Gets the Widget with focus.
Definition at line 115 of file focushandler.cpp.
References mFocusedWidget.
Referenced by gcn::BasicContainer::_keyInputMessage(), gcn::BasicContainer::_mouseInputMessage(), and gcn::Gui::logic().
Widget * gcn::FocusHandler::getModalFocused | ( | ) | const [virtual] |
Gets the Widget with modal focus.
Definition at line 125 of file focushandler.cpp.
References mModalFocusedWidget.
Referenced by gcn::Widget::_keyInputMessage(), gcn::Widget::_mouseInputMessage(), and gcn::Widget::hasModalFocus().
bool gcn::FocusHandler::isDragged | ( | const Widget * | widget | ) | const [virtual] |
Checks if a widget is being dragged.
widget | the Widget to check if it is being dragged. |
Definition at line 245 of file focushandler.cpp.
References mDraggedWidget.
Referenced by gcn::Widget::isDragged().
bool gcn::FocusHandler::isFocused | ( | const Widget * | widget | ) | const [virtual] |
Checks if a Widget is focused.
widget | widget to check if it is focused. |
Definition at line 240 of file focushandler.cpp.
References mFocusedWidget.
Referenced by gcn::Widget::isFocused(), and remove().
void gcn::FocusHandler::releaseModalFocus | ( | Widget * | widget | ) | [virtual] |
Releases modal focus if the Widget has modal focus.
Otherwise nothing will be done.
widget | the Widget to release modal focus for. |
Definition at line 107 of file focushandler.cpp.
References mModalFocusedWidget.
Referenced by gcn::Widget::releaseModalFocus().
void gcn::FocusHandler::remove | ( | Widget * | widget | ) | [virtual] |
Removes a widget from the FocusHandler.
widget | the widget to remove. |
Definition at line 255 of file focushandler.cpp.
References isFocused(), mFocusedWidget, mToBeDragged, mToBeFocused, and mWidgets.
Referenced by gcn::Widget::_setFocusHandler().
void gcn::FocusHandler::requestDrag | ( | Widget * | widget | ) | [virtual] |
Sets drag to a Widget.
widget | the Widget to drag. |
Definition at line 82 of file focushandler.cpp.
References mToBeDragged.
Referenced by gcn::Widget::_mouseInputMessage().
void gcn::FocusHandler::requestFocus | ( | Widget * | widget | ) | [virtual] |
Sets focus to a Widget.
Widget::lostFocus and Widget::gotFocus will be called.
widget | the Widget to focus. |
Definition at line 77 of file focushandler.cpp.
References mToBeFocused.
Referenced by gcn::Widget::requestFocus().
void gcn::FocusHandler::requestModalFocus | ( | Widget * | widget | ) | [virtual] |
Sets modal focus to a Widget.
If another Widget already has modal focus will an exception be thrown.
widget | the Widget to focus modal. |
Exception | when another widget already has modal focus. |
Definition at line 87 of file focushandler.cpp.
References dragNone(), focusNone(), gcn::Widget::hasModalFocus(), mDraggedWidget, mFocusedWidget, and mModalFocusedWidget.
Referenced by gcn::Widget::requestModalFocus().