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

ONE::gui::FocusManager Class Reference

List of all members.

Detailed Description

manages the user input focus.

This class manages the currently active top level window and the currently focused widget to permit proper event dispatching by the EventMulticaster. Most of the functions provided by this class should not be called directly, rather, the appropriate functions provided by the respective classes should be used.

Author:
Daniel Seibert


Public Types

typedef ONE::util::STLIterator<
TopLevel *, Layers::iterator > 
BTFLayerIt
 back to front layer iterator
typedef ONE::util::STLIterator<
TopLevel *, Layers::reverse_iterator > 
FTBLayerIt
 front to back layer iterator
typedef ONE::util::SmartPointer<
ONE::util::Iterator< TopLevel * >,
ONE::util::DestructiveCopy
LayerItSP
 smart pointer to any of the layer iterator types
typedef std::list< TopLevel * > Layers
 organizes registered windows in layers back to front.

Public Member Functions

void bringToFront (TopLevel *tl)
 places the given object on top of all other layers
void deregisterTopLevel (const TopLevel *tl)
 deregisters a TopLevel
void destroyScheduled ()
 deletes all scheduled TopLevel s
ComponentgetFocusedComponent () const
 accesses the focused component
TopLevelgetFocusedTopLevel () const
 accesses the focused top level container
LayerItSP getLayersBTF ()
 accesses the layers in back to front order
LayerItSP getLayersFTB ()
 accesses the layers in front to back order
TopLevelgetModalTopLevel () const
 accesses the modal top level container
bool hasFocus (const Control *f) const
 checks if the given object has the input focus
bool isModal (const TopLevel *tl) const
 checks if the given object is modal
bool isRegistered (const TopLevel *)
 checks if the given TopLevel is registered
void registerTopLevel (TopLevel *tl)
 registers a TopLevel with the focus manager
void releaseFocus (const Component *comp)
 unfocuses comp
void releaseFocus (const TopLevel *tl)
 unfocuses tl if it is focused
bool requestFocus (TopLevel *tl)
 attempts to get the focus for the given TopLevel
bool requestFocus (Component *comp)
 attempts to get the focus for the given component
void scheduleDestruction (TopLevel *)
 schedules the given container for destruction
void setModal (TopLevel *tl, bool modal)
 sets the given container to modal


Member Typedef Documentation

typedef ONE::util::STLIterator<TopLevel*,Layers::iterator> ONE::gui::FocusManager::BTFLayerIt
 

back to front layer iterator

typedef ONE::util::STLIterator<TopLevel*,Layers::reverse_iterator> ONE::gui::FocusManager::FTBLayerIt
 

front to back layer iterator

typedef ONE::util::SmartPointer<ONE::util::Iterator<TopLevel*>,ONE::util::DestructiveCopy> ONE::gui::FocusManager::LayerItSP
 

smart pointer to any of the layer iterator types

Note that this is a destructive copy pointer.

typedef std::list<TopLevel*> ONE::gui::FocusManager::Layers
 

organizes registered windows in layers back to front.

The first entry is the rearmost window, all subsequent entries are further to the front.


Member Function Documentation

void ONE::gui::FocusManager::bringToFront TopLevel tl  ) 
 

places the given object on top of all other layers

Parameters:
tl a top level container

void ONE::gui::FocusManager::deregisterTopLevel const TopLevel tl  ) 
 

deregisters a TopLevel

all top level containers call this function when they are destroyed, it should not be invoked manually.

Parameters:
tl the container that will be deregistered

void ONE::gui::FocusManager::destroyScheduled  ) 
 

deletes all scheduled TopLevel s

Component * ONE::gui::FocusManager::getFocusedComponent  )  const [inline]
 

accesses the focused component

Returns:
the component that has the input focus or 0 if no such component exists

TopLevel * ONE::gui::FocusManager::getFocusedTopLevel  )  const [inline]
 

accesses the focused top level container

Returns:
the TopLevel that has the input focus or 0 if no such object exists

LayerItSP ONE::gui::FocusManager::getLayersBTF  ) 
 

accesses the layers in back to front order

LayerItSP ONE::gui::FocusManager::getLayersFTB  ) 
 

accesses the layers in front to back order

TopLevel * ONE::gui::FocusManager::getModalTopLevel  )  const [inline]
 

accesses the modal top level container

Returns:
the modal TopLevel or 0 if no container is set to modal

bool ONE::gui::FocusManager::hasFocus const Control f  )  const
 

checks if the given object has the input focus

Users should call Control::hasFocus() instead of this function.

Parameters:
f an object
Returns:
if f has the input focus

bool ONE::gui::FocusManager::isModal const TopLevel tl  )  const [inline]
 

checks if the given object is modal

A true return value when calling isModal(0) means that no container is currently modal. Users should call TopLevel::isModal() instead of this function.

Parameters:
tl the container that will be checked
Returns:
true if tl is modal, false otherwise

bool ONE::gui::FocusManager::isRegistered const TopLevel  ) 
 

checks if the given TopLevel is registered

Note that this function runs in linear time.

void ONE::gui::FocusManager::registerTopLevel TopLevel tl  ) 
 

registers a TopLevel with the focus manager

all top level containers call this function when they are created, it should not be invoked manually.

Parameters:
tl the container that will be registered

void ONE::gui::FocusManager::releaseFocus const Component comp  ) 
 

unfocuses comp

Parameters:
comp a Component

void ONE::gui::FocusManager::releaseFocus const TopLevel tl  ) 
 

unfocuses tl if it is focused

If available, the focused component will also release the focus.

Parameters:
tl a TopLevel

bool ONE::gui::FocusManager::requestFocus TopLevel tl  ) 
 

attempts to get the focus for the given TopLevel

If the currently focused Component is not a child of tl, it will lose the input focus. Calling this function will fail if a different container is set to modal or if tl is invisible. Users should call TopLevel::requestFocus() instead of this function.

Parameters:
tl the container that should get the focus.
Returns:
if the request was granted

bool ONE::gui::FocusManager::requestFocus Component comp  ) 
 

attempts to get the focus for the given component

If the operation succeeds, comp 's top level parent will also be focused. Calling this function will fail in situations where a modal TopLevel exists, but comp is not a child of that container or when comp or its parent containers are invisible. Users should call Component::requestFocus() instead of this function.

Parameters:
comp the component that should get the focus
Returns:
if the request was granted

void ONE::gui::FocusManager::scheduleDestruction TopLevel  ) 
 

schedules the given container for destruction

The object will be deleted when destroyScheduled is called.

void ONE::gui::FocusManager::setModal TopLevel tl,
bool  modal
 

sets the given container to modal

If another TopLevel is already set to modal, that container will lose its status. If modal is false and tl is not currently modal, this function will fail silently. Calling this function with a null pointer will clear any modal object, regardless of the modal parameter. Users should call TopLevel::setModal() instead of this function.

Parameters:
tl the top level container
modal the tl 's new status


Generated on Wed Sep 7 19:03:17 2005 for ONEngine by  doxygen 1.4.3