|
FifeGUI 0.2.0
A C++ GUI library designed for games.
|
#include <focushandler.hpp>
Public Member Functions | |
| virtual void | add (Widget *widget) |
| FocusHandler (FocusHandler &&)=delete | |
| FocusHandler (FocusHandler const &)=delete | |
| virtual void | focusNext () |
| virtual void | focusNone () |
| virtual void | focusPrevious () |
| virtual Widget * | getDraggedWidget () |
| virtual Widget * | getFocused () const |
| virtual Widget * | getLastWidgetPressed () |
| virtual Widget * | getLastWidgetWithModalFocus () |
| virtual Widget * | getLastWidgetWithModalMouseInputFocus () |
| virtual Widget * | getLastWidgetWithMouse () |
| virtual Widget * | getModalFocused () const |
| virtual Widget * | getModalMouseInputFocused () const |
| virtual bool | isFocused (Widget const *widget) const |
| FocusHandler & | operator= (FocusHandler &&)=delete |
| FocusHandler & | operator= (FocusHandler const &)=delete |
| virtual void | releaseModalFocus (Widget *widget) |
| virtual void | releaseModalMouseInputFocus (Widget *widget) |
| virtual void | remove (Widget *widget) |
| virtual void | requestFocus (Widget *widget) |
| virtual void | requestModalFocus (Widget *widget) |
| virtual void | requestModalMouseInputFocus (Widget *widget) |
| virtual void | setDraggedWidget (Widget *draggedWidget) |
| virtual void | setLastWidgetPressed (Widget *lastWidgetPressed) |
| virtual void | setLastWidgetWithModalFocus (Widget *lastWidgetWithModalFocus) |
| virtual void | setLastWidgetWithModalMouseInputFocus (Widget *lastWidgetWithModalMouseInputFocus) |
| virtual void | setLastWidgetWithMouse (Widget *lastWidgetWithMouse) |
| virtual void | tabNext () |
| virtual void | tabPrevious () |
| virtual void | widgetHidden (Widget *widget) |
Protected Types | |
| using | WidgetIterator = WidgetVector::iterator |
| using | WidgetVector = std::vector<Widget*> |
Protected Member Functions | |
| virtual void | distributeFocusGainedEvent (Event const &focusEvent) |
| virtual void | distributeFocusLostEvent (Event const &focusEvent) |
Manages focus navigation and assignment among widgets within a Gui instance.
Each Gui has at least one focus handler. You will probably not use the focus handler directly as Widget has functions that automatically uses the active focus handler.
Definition at line 32 of file focushandler.hpp.
|
protected |
Typedef.
Definition at line 309 of file focushandler.hpp.
|
protected |
Typedef.
Definition at line 304 of file focushandler.hpp.
| fcn::FocusHandler::FocusHandler | ( | ) |
Definition at line 19 of file focushandler.cpp.
|
virtual |
Adds a widget to by handles by the focus handler.
| widget | The widget to add. |
Definition at line 225 of file focushandler.cpp.
References add(), and mWidgets.
Referenced by fcn::Widget::_setFocusHandler(), and add().
|
protectedvirtual |
Distributes a focus gained event.
| focusEvent | the event to distribute. |
Definition at line 410 of file focushandler.cpp.
References fcn::Widget::_getFocusListeners(), distributeFocusGainedEvent(), and fcn::Event::getSource().
Referenced by distributeFocusGainedEvent(), focusNext(), focusPrevious(), requestFocus(), tabNext(), and tabPrevious().
|
protectedvirtual |
Distributes a focus lost event.
| focusEvent | the event to distribute. |
Definition at line 398 of file focushandler.cpp.
References fcn::Widget::_getFocusListeners(), distributeFocusLostEvent(), and fcn::Event::getSource().
Referenced by distributeFocusLostEvent(), focusNext(), focusNone(), focusPrevious(), requestFocus(), tabNext(), and tabPrevious().
|
virtual |
Focuses the next widget added to a container.
If no widget has focus the first widget gets focus. The order in which the widgets are focused is determined by the order they were added to a container.
Definition at line 116 of file focushandler.cpp.
References distributeFocusGainedEvent(), distributeFocusLostEvent(), focusNext(), mFocusedWidget, and mWidgets.
Referenced by focusNext().
|
virtual |
Focuses nothing.
A focus event will also be sent to the focused widget's focus listeners if a widget has focus.
Definition at line 267 of file focushandler.cpp.
References distributeFocusLostEvent(), focusNone(), and mFocusedWidget.
Referenced by focusNone(), and requestModalFocus().
|
virtual |
Focuses the previous widget added to a container.
If no widget has focus the first widget gets focus. The order in which the widgets are focused is determined by the order they were added to a container.
Definition at line 166 of file focushandler.cpp.
References distributeFocusGainedEvent(), distributeFocusLostEvent(), focusPrevious(), mFocusedWidget, and mWidgets.
Referenced by focusPrevious().
|
virtual |
Gets the widget being dragged.
Used by the Gui class to keep track of the dragged widget.
Definition at line 422 of file focushandler.cpp.
References getDraggedWidget(), and mDraggedWidget.
Referenced by getDraggedWidget().
|
virtual |
Gets the widget with focus.
Definition at line 101 of file focushandler.cpp.
References getFocused(), and mFocusedWidget.
Referenced by getFocused(), and fcn::Gui::getKeyEventSource().
|
virtual |
Gets the last widget pressed.
Used by the Gui class to keep track of pressed widgets.
Definition at line 462 of file focushandler.cpp.
References getLastWidgetPressed(), and mLastWidgetPressed.
Referenced by getLastWidgetPressed().
|
virtual |
Gets the last widget with modal focus.
Definition at line 442 of file focushandler.cpp.
References getLastWidgetWithModalFocus(), and mLastWidgetWithModalFocus.
Referenced by getLastWidgetWithModalFocus().
|
virtual |
Gets the last widget with modal mouse input focus.
Definition at line 452 of file focushandler.cpp.
References getLastWidgetWithModalMouseInputFocus(), and mLastWidgetWithModalMouseInputFocus.
Referenced by getLastWidgetWithModalMouseInputFocus().
|
virtual |
Gets the last widget with the mouse.
Used by the Gui class to keep track the last widget with the mouse.
Definition at line 432 of file focushandler.cpp.
References getLastWidgetWithMouse(), and mLastWidgetWithMouse.
Referenced by getLastWidgetWithMouse().
|
virtual |
Gets the widget with modal focus.
Definition at line 106 of file focushandler.cpp.
References getModalFocused(), and mModalFocusedWidget.
Referenced by getModalFocused().
|
virtual |
Gets the widget with modal mouse input focus.
Definition at line 111 of file focushandler.cpp.
References getModalMouseInputFocused(), and mModalMouseInputFocusedWidget.
Referenced by getModalMouseInputFocused().
|
virtual |
Checks if a widget is focused.
| widget | The widget to check. |
Definition at line 220 of file focushandler.cpp.
References isFocused(), and mFocusedWidget.
Referenced by isFocused(), and remove().
|
virtual |
Releases modal focus if the widget has modal focus.
If the widget doesn't have modal focus no release will occur.
| widget | The widget to release modal focus for. |
Definition at line 87 of file focushandler.cpp.
References mModalFocusedWidget, and releaseModalFocus().
Referenced by releaseModalFocus().
|
virtual |
Releases modal mouse input focus if the widget has modal mouse input focus.
If the widget doesn't have modal mouse input focus no release will occur.
| widget | the widget to release modal mouse input focus for. |
Definition at line 94 of file focushandler.cpp.
References mModalMouseInputFocusedWidget, and releaseModalMouseInputFocus().
Referenced by releaseModalMouseInputFocus().
|
virtual |
Removes a widget from the focus handler.
| widget | The widget to remove. |
Definition at line 230 of file focushandler.cpp.
References isFocused(), mDraggedWidget, mFocusedWidget, mLastWidgetPressed, mLastWidgetWithModalFocus, mLastWidgetWithModalMouseInputFocus, mLastWidgetWithMouse, mWidgets, and remove().
Referenced by remove().
|
virtual |
Requests focus for a widget.
Focus will only be granted to a widget if it's focusable and if no other widget has modal focus. If a widget receives focus a focus event will be sent to the focus listeners of the widget.
| widget | The widget to request focus for. |
Definition at line 31 of file focushandler.cpp.
References distributeFocusGainedEvent(), distributeFocusLostEvent(), mFocusedWidget, mWidgets, and requestFocus().
Referenced by requestFocus().
|
virtual |
Requests modal focus for a widget.
Focus will only be granted to a widget if it's focusable and if no other widget has modal focus.
| widget | The widget to request modal focus for. |
| Exception | when another widget already has modal focus. |
Definition at line 65 of file focushandler.cpp.
References focusNone(), mFocusedWidget, mModalFocusedWidget, and requestModalFocus().
Referenced by requestModalFocus().
|
virtual |
Requests modal mouse input focus for a widget.
Focus will only be granted to a widget if it's focusable and if no other widget has modal mouse input focus.
Modal mouse input focus means no other widget then the widget with modal mouse input focus will receive mouse input. The widget with modal mouse input focus will also receive mouse input no matter what the mouse input is or where the mouse input occurs.
| widget | The widget to focus for modal mouse input focus. |
| Exception | when another widget already has modal mouse input focus. |
Definition at line 78 of file focushandler.cpp.
References mModalMouseInputFocusedWidget, and requestModalMouseInputFocus().
Referenced by requestModalMouseInputFocus().
|
virtual |
Sets the widget being dragged.
Used by the Gui class to keep track of the dragged widget.
| draggedWidget | The widget being dragged. |
Definition at line 427 of file focushandler.cpp.
References mDraggedWidget, and setDraggedWidget().
Referenced by setDraggedWidget().
|
virtual |
Sets the last widget pressed.
Used by the Gui class to keep track of pressed widgets.
| lastWidgetPressed | The last widget pressed. |
Definition at line 467 of file focushandler.cpp.
References mLastWidgetPressed, and setLastWidgetPressed().
Referenced by setLastWidgetPressed().
|
virtual |
Sets the last widget with modal focus.
| lastWidgetWithModalFocus | The last widget with modal focus. |
Definition at line 447 of file focushandler.cpp.
References mLastWidgetWithModalFocus, and setLastWidgetWithModalFocus().
Referenced by setLastWidgetWithModalFocus().
|
virtual |
Sets the last widget with modal mouse input focus.
| lastWidgetWithModalMouseInputFocus | The last widget with modal mouse input focus. |
Definition at line 457 of file focushandler.cpp.
References mLastWidgetWithModalMouseInputFocus, and setLastWidgetWithModalMouseInputFocus().
Referenced by setLastWidgetWithModalMouseInputFocus().
|
virtual |
Sets the last widget with the mouse.
Used by the Gui class to keep track the last widget with the mouse.
| lastWidgetWithMouse | The last widget with the mouse. |
Definition at line 437 of file focushandler.cpp.
References mLastWidgetWithMouse, and setLastWidgetWithMouse().
Referenced by setLastWidgetWithMouse().
|
virtual |
Focuses the next widget which allows tabbing in unless the current focused Widget disallows tabbing out.
Definition at line 278 of file focushandler.cpp.
References distributeFocusGainedEvent(), distributeFocusLostEvent(), mFocusedWidget, mModalFocusedWidget, mWidgets, and tabNext().
Referenced by tabNext().
|
virtual |
Focuses the previous widget which allows tabbing in unless current focused widget disallows tabbing out.
Definition at line 338 of file focushandler.cpp.
References distributeFocusGainedEvent(), distributeFocusLostEvent(), mFocusedWidget, mModalFocusedWidget, mWidgets, and tabPrevious().
Referenced by tabPrevious().
|
virtual |
Informs the focus handler that a widget was hidden.
This is needed because the focus handler must determine which widget has the mouse now.
| widget | Widget that was hidden |
Definition at line 472 of file focushandler.cpp.
References widgetHidden().
Referenced by widgetHidden().
|
protected |
Holds the dragged widget.
Nullptr if no widget is being dragged.
Definition at line 338 of file focushandler.hpp.
Referenced by getDraggedWidget(), remove(), and setDraggedWidget().
|
protected |
Holds the focused widget.
Nullptr if no widget has focus.
Definition at line 320 of file focushandler.hpp.
Referenced by focusNext(), focusNone(), focusPrevious(), getFocused(), isFocused(), remove(), requestFocus(), requestModalFocus(), tabNext(), and tabPrevious().
|
protected |
Holds the last widget pressed.
Definition at line 358 of file focushandler.hpp.
Referenced by getLastWidgetPressed(), remove(), and setLastWidgetPressed().
|
protected |
Holds the last widget with modal focus.
Definition at line 348 of file focushandler.hpp.
Referenced by getLastWidgetWithModalFocus(), remove(), and setLastWidgetWithModalFocus().
|
protected |
Holds the last widget with modal mouse input focus.
Definition at line 353 of file focushandler.hpp.
Referenced by getLastWidgetWithModalMouseInputFocus(), remove(), and setLastWidgetWithModalMouseInputFocus().
|
protected |
Holds the last widget with the mouse.
Definition at line 343 of file focushandler.hpp.
Referenced by getLastWidgetWithMouse(), remove(), and setLastWidgetWithMouse().
|
protected |
Holds the modal focused widget.
Nullptr if no widget has modal focused.
Definition at line 326 of file focushandler.hpp.
Referenced by getModalFocused(), releaseModalFocus(), requestModalFocus(), tabNext(), and tabPrevious().
|
protected |
Holds the modal mouse input focused widget.
Nullptr if no widget is being dragged.
Definition at line 332 of file focushandler.hpp.
Referenced by getModalMouseInputFocused(), releaseModalMouseInputFocus(), and requestModalMouseInputFocus().
|
protected |
Holds the widgets currently being handled by the focus handler.
Definition at line 315 of file focushandler.hpp.
Referenced by add(), focusNext(), focusPrevious(), remove(), requestFocus(), tabNext(), and tabPrevious().