_________ __                 __
        /   _____//  |_____________ _/  |______     ____  __ __  ______
        \_____  \\   __\_  __ \__  \\   __\__  \   / ___\|  |  \/  ___/
        /        \|  |  |  | \// __ \|  |  / __ \_/ /_/  >  |  /\___ \
       /_______  /|__|  |__|  (____  /__| (____  /\___  /|____//____  >
               \/                  \/          \//_____/            \/
    ______________________                           ______________________
                          T H E   W A R   B E G I N S
                   Stratagus - A free fantasy real time strategy game engine

Public Member Functions | Protected Types | Protected Attributes | List of all members
gcn::FocusHandler Class Reference

#include <focushandler.h>

Public Member Functions

 FocusHandler ()
 
virtual ~FocusHandler ()
 
virtual void requestFocus (Widget *widget)
 
virtual void setFocus (Widget *widget)
 
virtual void requestDrag (Widget *widget)
 
virtual void requestModalFocus (Widget *widget)
 
virtual void releaseModalFocus (Widget *widget)
 
virtual WidgetgetFocused () const
 
virtual WidgetgetDragged () const
 
virtual WidgetgetModalFocused () const
 
virtual void focusNext ()
 
virtual void focusPrevious ()
 
virtual bool hasFocus (const Widget *widget) const
 
virtual bool isDragged (const Widget *widget) const
 
virtual void add (Widget *widget)
 
virtual void remove (Widget *widget)
 
virtual void focusNone ()
 
virtual void tabNext ()
 
virtual void tabPrevious ()
 
virtual void applyChanges ()
 
virtual void dragNone ()
 
virtual void checkHotKey (const KeyInput &keyInput)
 

Protected Types

typedef std::vector< Widget * > WidgetVector
 
typedef WidgetVector::iterator WidgetIterator
 

Protected Attributes

WidgetVector mWidgets
 
WidgetmFocusedWidget
 
WidgetmDraggedWidget
 
WidgetmToBeFocused
 
WidgetmToBeDragged
 
WidgetmModalFocusedWidget
 

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

Member Typedef Documentation

◆ WidgetIterator

typedef WidgetVector::iterator gcn::FocusHandler::WidgetIterator
protected

◆ WidgetVector

typedef std::vector<Widget*> gcn::FocusHandler::WidgetVector
protected

Constructor & Destructor Documentation

◆ FocusHandler()

gcn::FocusHandler::FocusHandler ( )

Constructor.

◆ ~FocusHandler()

virtual gcn::FocusHandler::~FocusHandler ( )
inlinevirtual

Destructor.

Member Function Documentation

◆ add()

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

Adds a widget to the FocusHandler.

Parameters
widgetthe widget to add.

◆ applyChanges()

void gcn::FocusHandler::applyChanges ( )
virtual

Applies the changes.

◆ checkHotKey()

void gcn::FocusHandler::checkHotKey ( const KeyInput keyInput)
virtual

Check if a hot key was pressed.

◆ dragNone()

void gcn::FocusHandler::dragNone ( )
virtual

Drag nothing.

◆ focusNext()

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.

◆ focusNone()

void gcn::FocusHandler::focusNone ( )
virtual

Focuses nothing.

◆ focusPrevious()

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.

◆ getDragged()

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.

◆ getFocused()

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.

◆ getModalFocused()

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.

◆ hasFocus()

bool gcn::FocusHandler::hasFocus ( const Widget widget) const
virtual

Checks if a Widget has focus.

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

◆ isDragged()

bool gcn::FocusHandler::isDragged ( const Widget widget) const
virtual

Checks if a widget is being dragged

Parameters
widgetthe Widget to check if it is being dragged.
Returns
true if the widget is being dragged.

◆ releaseModalFocus()

void gcn::FocusHandler::releaseModalFocus ( Widget widget)
virtual

Releases modal focus if the Widget has modal focus. Otherwise nothing will be done.

Parameters
widgetthe Widget to release modal focus for.

◆ remove()

void gcn::FocusHandler::remove ( Widget widget)
virtual

Removes a widget from the FocusHandler.

Parameters
widgetthe widget to remove.

◆ requestDrag()

void gcn::FocusHandler::requestDrag ( Widget widget)
virtual

Sets drag to a Widget.

Parameters
widgetthe Widget to drag.

◆ requestFocus()

void gcn::FocusHandler::requestFocus ( Widget widget)
virtual

Sets focus to a Widget. Widget::lostFocus and Widget::gotFocus will be called.

Parameters
widgetthe Widget to focus.

◆ requestModalFocus()

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
widgetthe Widget to focus modal.
Exceptions
Exceptionwhen another widget already has modal focus.

◆ setFocus()

void gcn::FocusHandler::setFocus ( Widget widget)
virtual

Sets focus immediately.

◆ tabNext()

void gcn::FocusHandler::tabNext ( )
virtual

Focuses the next Widget which allows tab in unless current focused Widget disallows tab out.

◆ tabPrevious()

void gcn::FocusHandler::tabPrevious ( )
virtual

Focuses the previous Widget which allows tab in unless current focused Widget disallows tab out.

Member Data Documentation

◆ mDraggedWidget

Widget* gcn::FocusHandler::mDraggedWidget
protected

◆ mFocusedWidget

Widget* gcn::FocusHandler::mFocusedWidget
protected

◆ mModalFocusedWidget

Widget* gcn::FocusHandler::mModalFocusedWidget
protected

◆ mToBeDragged

Widget* gcn::FocusHandler::mToBeDragged
protected

◆ mToBeFocused

Widget* gcn::FocusHandler::mToBeFocused
protected

◆ mWidgets

WidgetVector gcn::FocusHandler::mWidgets
protected

The documentation for this class was generated from the following files:
(C) Copyright 1998-2012 by The Stratagus Project under the GNU General Public License.
All trademarks and copyrights on this page are owned by their respective owners.