# Home    # nevrax.com   
Nevrax
Nevrax.org
#News
#Mailing-list
#Documentation
#CVS
#Bugs
#License
Docs
 
Documentation  
Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages   Search  

NLMISC::CEventListenerAsync Class Reference

CEventListenerAsync. More...

#include <event_listener.h>

Inheritance diagram for NLMISC::CEventListenerAsync:

NLMISC::IEventListener List of all members.

Public Methods

 CEventListenerAsync ()
 Constructor. More...

virtual ~CEventListenerAsync ()
void addToServer (CEventServer &server)
 Register the listener to the server. More...

void removeFromServer (CEventServer &server)
 Unregister the listener to the server. More...

bool isKeyDown (TKey key) const
 Get a key down instant state. More...

bool isKeyPushed (TKey key, bool release=true)
 Get if a the state of key has pushed since the last call of isKeyPushed with release=true. More...

void reset ()
 Clear all the Down states to false. More...


Protected Methods

virtual void operator() (const CEvent &event)
 Call back of the listener. More...


Protected Attributes

CBitSet _KeyArray
CBitSet _KeyDownArray
CBitSet _KeyReleaseArray

Detailed Description

CEventListenerAsync.

Author:
Stephane Coutelas , Nevrax France
Date:
2000

Definition at line 66 of file event_listener.h.


Constructor & Destructor Documentation

NLMISC::CEventListenerAsync::CEventListenerAsync  
 

Constructor.

Definition at line 50 of file event_listener.cpp.

References _KeyArray, _KeyDownArray, _KeyReleaseArray, NLMISC::KeyCount, and reset.

virtual NLMISC::CEventListenerAsync::~CEventListenerAsync   [inline, virtual]
 

Definition at line 72 of file event_listener.h.


Member Function Documentation

void NLMISC::CEventListenerAsync::addToServer CEventServer   server
 

Register the listener to the server.

Definition at line 58 of file event_listener.cpp.

References NLMISC::EventKeyDownId, NLMISC::EventKeyUpId, and NLMISC::EventSetFocusId.

Referenced by NL3D::CEvent3dMouseListener::addToServer, and NL3D::CDriverUser::setDisplay.

bool NLMISC::CEventListenerAsync::isKeyDown TKey    key const
 

Get a key down instant state.

Parameters:
key  is the key to check.

Definition at line 72 of file event_listener.cpp.

References _KeyArray, and NLMISC::TKey.

Referenced by NL3D::CEvent3dMouseListener::getViewMatrix.

bool NLMISC::CEventListenerAsync::isKeyPushed TKey    key,
bool    release = true
 

Get if a the state of key has pushed since the last call of isKeyPushed with release=true.

Parameters:
key  is the key to check.
release  if true, the pushed state of the key is released (force to be false). It will return to true next time only if key is released and then re-pushed.
See also:
reset()

Definition at line 78 of file event_listener.cpp.

References _KeyDownArray, _KeyReleaseArray, and NLMISC::TKey.

Referenced by NL3D::CNELU::screenshot.

void NLMISC::CEventListenerAsync::operator() const CEvent   event [protected, virtual]
 

Call back of the listener.

Parameters:
event  is the event send to the listener

Implements NLMISC::IEventListener.

Definition at line 89 of file event_listener.cpp.

References _KeyArray, _KeyDownArray, _KeyReleaseArray, NLMISC::EventKeyDownId, NLMISC::EventKeyUpId, NLMISC::EventSetFocusId, NLMISC::KeyCONTROL, NLMISC::KeyLCONTROL, NLMISC::KeyLMENU, NLMISC::KeyLSHIFT, NLMISC::KeyMENU, NLMISC::KeyRCONTROL, NLMISC::KeyRMENU, NLMISC::KeyRSHIFT, and NLMISC::KeySHIFT.

void NLMISC::CEventListenerAsync::removeFromServer CEventServer   server
 

Unregister the listener to the server.

Definition at line 65 of file event_listener.cpp.

References NLMISC::EventKeyDownId, NLMISC::EventKeyUpId, and NLMISC::EventSetFocusId.

Referenced by NL3D::CDriverUser::release, and NL3D::CEvent3dMouseListener::removeFromServer.

void NLMISC::CEventListenerAsync::reset  
 

Clear all the Down states to false.

Usefull sometimes when you don't bother what have been pushed before. e.g.: your app listen/test to the key 'A' and 'B' for a certain long period. Then, it test 'C' and 'D' later. If the user has press (by error) the key 'C' during the first period, this API has record it, and then, at the second period, isKeyDown(KeyC) will return true the first time the key is tested, unless if you do a reset() at the beggining of the second period. Clear all the pushed states to false too.

See also:
isKeyDown()

Definition at line 195 of file event_listener.cpp.

References _KeyArray, _KeyDownArray, and _KeyReleaseArray.

Referenced by CEventListenerAsync, and NL3D::CDriverUser::setDisplay.


Member Data Documentation

CBitSet NLMISC::CEventListenerAsync::_KeyArray [protected]
 

Definition at line 118 of file event_listener.h.

Referenced by CEventListenerAsync, isKeyDown, operator(), and reset.

CBitSet NLMISC::CEventListenerAsync::_KeyDownArray [protected]
 

Definition at line 120 of file event_listener.h.

Referenced by CEventListenerAsync, isKeyPushed, operator(), and reset.

CBitSet NLMISC::CEventListenerAsync::_KeyReleaseArray [protected]
 

Definition at line 120 of file event_listener.h.

Referenced by CEventListenerAsync, isKeyPushed, operator(), and reset.


The documentation for this class was generated from the following files: