gcn::FocusHandler Class Reference

#include <focushandler.hpp>

List of all members.


Detailed Description

Used to keep track of widget focus.

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.

See also:
Widget::isFocused

Widget::requestFocus

Widget::setFocusable

Widget::isFocusable

Widget::gotFocus

Widget::lostFocus

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 WidgetgetFocused () const
 Gets the Widget with focus.
virtual WidgetgetDragged () const
 Gets the widget that is dragged.
virtual WidgetgetModalFocused () 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
WidgetmFocusedWidget
WidgetmDraggedWidget
WidgetmToBeFocused
WidgetmToBeDragged
WidgetmModalFocusedWidget


Member Function Documentation

void gcn::FocusHandler::add ( Widget widget  )  [virtual]

Adds a widget to the FocusHandler.

Parameters:
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.

Returns:
the widget that is dragged. NULL will be returned if no Widget 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.

Returns:
the Widget with focus. NULL will be returned if no Widget has 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.

Returns:
the Widget with modal focus. NULL will be returned if no Widget has 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.

Parameters:
widget the Widget to check if it is being dragged.
Returns:
true if the widget 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.

Parameters:
widget widget to check if it is focused.
Returns:
true if the widget 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.

Parameters:
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.

Parameters:
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.

Parameters:
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.

Parameters:
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.

Parameters:
widget the Widget to focus modal.
Exceptions:
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().


The documentation for this class was generated from the following files:
Generated on Sat Jul 29 19:38:48 2006 for Guichan by  doxygen 1.4.7