Main Page | Class Hierarchy | Class List | Directories | File List | Class Members | Related Pages

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::hasFocus

Widget::requestFocus

Widget::setFocusable

Widget::isFocusable

Widget::gotFocus

Widget::lostFocus

Definition at line 80 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 hasFocus (const Widget *widget) const
 Checks if a Widget has focus.
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


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 246 of file focushandler.cpp.

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 126 of file focushandler.cpp.

References gcn::Widget::gotFocus(), and gcn::Widget::lostFocus().

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 178 of file focushandler.cpp.

References gcn::Widget::gotFocus(), and gcn::Widget::lostFocus().

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 116 of file focushandler.cpp.

Referenced by 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 111 of file focushandler.cpp.

Referenced by gcn::DropDown::_keyInputMessage(), 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 121 of file focushandler.cpp.

Referenced by gcn::Widget::_keyInputMessage(), gcn::Widget::_mouseInputMessage(), and gcn::Widget::hasModalFocus().

bool gcn::FocusHandler::hasFocus (  const Widget *  widget  )  const [virtual]
 

Checks if a Widget has focus.

Parameters:
widget widget to check if it has focus..
Returns:
true if the widget has focus.

Definition at line 236 of file focushandler.cpp.

Referenced by gcn::Widget::hasFocus(), and remove().

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 241 of file focushandler.cpp.

Referenced by gcn::Widget::isDragged().

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 103 of file focushandler.cpp.

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 251 of file focushandler.cpp.

References hasFocus().

Referenced by gcn::Widget::_setFocusHandler(), gcn::Widget::removeActionListener(), gcn::Widget::removeKeyListener(), and gcn::Widget::removeMouseListener().

void gcn::FocusHandler::requestDrag (  Widget *  widget  )  [virtual]
 

Sets drag to a Widget.

Parameters:
widget the Widget to drag.

Definition at line 78 of file focushandler.cpp.

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 73 of file focushandler.cpp.

Referenced by gcn::DropDown::dropDown(), and 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 83 of file focushandler.cpp.

References dragNone(), focusNone(), and gcn::Widget::hasModalFocus().

Referenced by gcn::Widget::requestModalFocus().


The documentation for this class was generated from the following files:
Generated on Tue May 17 21:23:26 2005 for Guichan by  doxygen 1.4.1