CrystalSpace

Public API Reference

csBaseEventHandler Class Reference
[Event handling]

Base implementation of a generic event handler. More...

#include <csutil/csbaseeventh.h>

List of all members.

Public Member Functions

void Initialize (iObjectRegistry *registry)
 Perform basic initialization.
bool RegisterQueue (iEventQueue *queue, csEventID names[])
 Register the event handler with an event queue.
bool RegisterQueue (iEventQueue *queue, csEventID name)
 Register the event handler with an event queue.
bool RegisterQueue (iObjectRegistry *registry, csEventID names[])
 Register the event handler with the event queue registered with the object registry.
bool RegisterQueue (iObjectRegistry *registry, csEventID name)
 Register the event handler with the event queue registered with the object registry.
void UnregisterQueue ()
 Unregister the event handler with the event queue that it is currently registered with.
virtual ~csBaseEventHandler ()
 Destructor.

Protected Member Functions

 csBaseEventHandler ()
 Constructor.
virtual void FinishFrame ()
 Invoked by the handler during a finish frame broadcast event.
virtual void Frame ()
 Invoked by the handler for the crystalspace.frame event.
virtual csHandlerID GenericID (csRef< iEventHandlerRegistry > &reg) const
virtual const char * GenericName () const
 Override this if you want to refer to your csBaseEventHandler derived event handler as anything besides "application" for purposes of event subscription scheduling.
virtual const csHandlerIDGenericPrec (csRef< iEventHandlerRegistry > &, csRef< iEventNameRegistry > &, csEventID) const
 Override this if you want to force some modules to always handle some events before csBaseEventHandler.
virtual const csHandlerIDGenericSucc (csRef< iEventHandlerRegistry > &, csRef< iEventNameRegistry > &, csEventID) const
 Override this if you want to force some modules to always handle some events after csBaseEventHandler.
virtual bool HandleEvent (iEvent &event)
 Implementation of the event handling mechanism.
virtual const csHandlerIDInstancePrec (csRef< iEventHandlerRegistry > &, csRef< iEventNameRegistry > &, csEventID) const
 Override this if you want to force some modules to always handle some events before this instance of csBaseEventHandler.
virtual const csHandlerIDInstanceSucc (csRef< iEventHandlerRegistry > &, csRef< iEventNameRegistry > &, csEventID) const
 Override this if you want to force some modules to always handle some events before this instance of csBaseEventHandler.
virtual bool OnJoystickDown (iEvent &event)
 Invoked by the event handler when a joystick button down event is received.
virtual bool OnJoystickMove (iEvent &event)
 Invoked by the event handler when a joystick movement event is received.
virtual bool OnJoystickUp (iEvent &event)
 Invoked by the event handler when a joystick button up event is received.
virtual bool OnKeyboard (iEvent &event)
 Invoked by the event handler when a keyboard event is received.
virtual bool OnMouseClick (iEvent &event)
 Invoked by the event handler when a mouse button click event is received.
virtual bool OnMouseDoubleClick (iEvent &event)
 Invoked by the event handler when a mouse button double-click event is received.
virtual bool OnMouseDown (iEvent &event)
 Invoked by the event handler when a mouse down event is received.
virtual bool OnMouseMove (iEvent &event)
 Invoked by the event handler when a mouse move event is received.
virtual bool OnMouseUp (iEvent &event)
 Invoked by the event handler when a mouse up event is received.
virtual bool OnUnhandledEvent (iEvent &event)
 Invoked by the event handler when an unknown event is received.
virtual void PostProcessFrame ()
 Invoked by the handler during a post-process frame broadcast event.
virtual void PreProcessFrame ()
 Invoked by the handler during a pre-process frame broadcast event.
virtual void ProcessFrame ()
 Invoked by the handler during a process frame broadcast event.

Protected Attributes

csRef< EventHandlerImpleventh
csEventID FinalProcess
csEventID FrameEvent
iObjectRegistryobject_registry
csEventID PostProcess
csEventID PreProcess
csEventID Process
csHandlerID self

Classes

class  EventHandlerImpl
 Actual iEventHandler implementation. More...


Detailed Description

Base implementation of a generic event handler.

This class provides a base object which does absolutely nothing with the events that are sent to it. In order to properly use, you must derive a class from this one and override the specific OnFoo() trigger methods you are interested in processing.
Remarks:
Although this class is derived from iEventHandler, you should not attempt to overload the HandleEvent() method. Always override the specific On... trigger function.

Definition at line 57 of file csbaseeventh.h.


Constructor & Destructor Documentation

csBaseEventHandler::csBaseEventHandler (  )  [protected]

Constructor.

Remarks:
When deriving a class from csBaseEventHandler, you must call this constructor in order to initialize reference counting for the interface.
The constructor is declared as protected to prevent a developer from using this class directly.

virtual csBaseEventHandler::~csBaseEventHandler (  )  [virtual]

Destructor.


Member Function Documentation

virtual void csBaseEventHandler::FinishFrame (  )  [protected, virtual]

Invoked by the handler during a finish frame broadcast event.

virtual void csBaseEventHandler::Frame (  )  [protected, virtual]

Invoked by the handler for the crystalspace.frame event.

virtual const char* csBaseEventHandler::GenericName (  )  const [inline, protected, virtual]

Override this if you want to refer to your csBaseEventHandler derived event handler as anything besides "application" for purposes of event subscription scheduling.

Definition at line 224 of file csbaseeventh.h.

Referenced by GenericID().

virtual const csHandlerID* csBaseEventHandler::GenericPrec ( csRef< iEventHandlerRegistry > &  ,
csRef< iEventNameRegistry > &  ,
csEventID   
) const [inline, protected, virtual]

Override this if you want to force some modules to always handle some events before csBaseEventHandler.

Definition at line 237 of file csbaseeventh.h.

virtual const csHandlerID* csBaseEventHandler::GenericSucc ( csRef< iEventHandlerRegistry > &  ,
csRef< iEventNameRegistry > &  ,
csEventID   
) const [inline, protected, virtual]

Override this if you want to force some modules to always handle some events after csBaseEventHandler.

Definition at line 246 of file csbaseeventh.h.

virtual bool csBaseEventHandler::HandleEvent ( iEvent event  )  [protected, virtual]

Implementation of the event handling mechanism.

This low-level method examines the event dispatches it to the appropriate OnFoo() or FooFrame() method.

Remarks:
You should almost never need to override this function. Doing so breaks the message-oriented nature of this utility class. In almost all cases, should should simply override the various OnFoo() and FooFrame() methods which are applicable to your situation. Typically, the only valid reason to override this method is when you need to optionally delegate the event handling to some foreign mechanism. (For instance, iAWS::HandleEvent() expects to be handed the event under all circumstances, regardless of the event's type.) If you do override this method in order to optionally delegate event handling to some other entity, then you must remember to invoke csBaseEventHandler::HandleEvent() if the other entity did not handle the event. (Given the AWS example, this means that if iAWS::HandleEvent() returns false, the event should be passed along to csBaseEventHandler::HandleEvent() so that csBaseEventHandler can dispatch it to the appropriate OnFoo() or FooFrame() method as usual.)

void csBaseEventHandler::Initialize ( iObjectRegistry registry  ) 

Perform basic initialization.

This function MUST be called before invoking any of the RegisterQueue() methods.

virtual const csHandlerID* csBaseEventHandler::InstancePrec ( csRef< iEventHandlerRegistry > &  ,
csRef< iEventNameRegistry > &  ,
csEventID   
) const [inline, protected, virtual]

Override this if you want to force some modules to always handle some events before this instance of csBaseEventHandler.

Definition at line 255 of file csbaseeventh.h.

virtual const csHandlerID* csBaseEventHandler::InstanceSucc ( csRef< iEventHandlerRegistry > &  ,
csRef< iEventNameRegistry > &  ,
csEventID   
) const [inline, protected, virtual]

Override this if you want to force some modules to always handle some events before this instance of csBaseEventHandler.

Definition at line 264 of file csbaseeventh.h.

virtual bool csBaseEventHandler::OnJoystickDown ( iEvent event  )  [protected, virtual]

Invoked by the event handler when a joystick button down event is received.

virtual bool csBaseEventHandler::OnJoystickMove ( iEvent event  )  [protected, virtual]

Invoked by the event handler when a joystick movement event is received.

virtual bool csBaseEventHandler::OnJoystickUp ( iEvent event  )  [protected, virtual]

Invoked by the event handler when a joystick button up event is received.

virtual bool csBaseEventHandler::OnKeyboard ( iEvent event  )  [protected, virtual]

Invoked by the event handler when a keyboard event is received.

virtual bool csBaseEventHandler::OnMouseClick ( iEvent event  )  [protected, virtual]

Invoked by the event handler when a mouse button click event is received.

virtual bool csBaseEventHandler::OnMouseDoubleClick ( iEvent event  )  [protected, virtual]

Invoked by the event handler when a mouse button double-click event is received.

virtual bool csBaseEventHandler::OnMouseDown ( iEvent event  )  [protected, virtual]

Invoked by the event handler when a mouse down event is received.

virtual bool csBaseEventHandler::OnMouseMove ( iEvent event  )  [protected, virtual]

Invoked by the event handler when a mouse move event is received.

virtual bool csBaseEventHandler::OnMouseUp ( iEvent event  )  [protected, virtual]

Invoked by the event handler when a mouse up event is received.

virtual bool csBaseEventHandler::OnUnhandledEvent ( iEvent event  )  [protected, virtual]

Invoked by the event handler when an unknown event is received.

Remarks:
Also, this function will be called when a broadcast event was not processed by OnBroadcast().

virtual void csBaseEventHandler::PostProcessFrame (  )  [protected, virtual]

Invoked by the handler during a post-process frame broadcast event.

virtual void csBaseEventHandler::PreProcessFrame (  )  [protected, virtual]

Invoked by the handler during a pre-process frame broadcast event.

virtual void csBaseEventHandler::ProcessFrame (  )  [protected, virtual]

Invoked by the handler during a process frame broadcast event.

bool csBaseEventHandler::RegisterQueue ( iEventQueue queue,
csEventID  names[] 
)

Register the event handler with an event queue.

Parameters:
queue The event queue to register with
names An array of event name handles. Each may be a tokens from iutil/evdefs.h or the result of a call to csEventNameRegistry::GetID. List must be terminated with CS_EVENTLIST_END.
See also:
iEventQueue::RegisterListener()

bool csBaseEventHandler::RegisterQueue ( iEventQueue queue,
csEventID  name 
)

Register the event handler with an event queue.

Parameters:
queue The event queue to register with
name An event name handle. May be a token from iutil/evdefs.h or the result of a call to csEventNameRegistry::GetID.
See also:
iEventQueue::RegisterListener()

bool csBaseEventHandler::RegisterQueue ( iObjectRegistry registry,
csEventID  names[] 
)

Register the event handler with the event queue registered with the object registry.

Parameters:
registry The application's object registry
names An array of event name handles. Each may be a tokens from iutil/evdefs.h or the result of a call to csEventNameRegistry::GetID. List must be terminated with CS_EVENTLIST_END.
See also:
iEventQueue::RegisterListener()

bool csBaseEventHandler::RegisterQueue ( iObjectRegistry registry,
csEventID  name 
)

Register the event handler with the event queue registered with the object registry.

Parameters:
registry The application's object registry
name An event name handle. May be a token from iutil/evdefs.h or the result of a call to csEventNameRegistry::GetID.
See also:
iEventQueue::RegisterListener()

void csBaseEventHandler::UnregisterQueue (  ) 

Unregister the event handler with the event queue that it is currently registered with.


The documentation for this class was generated from the following file:
Generated for Crystal Space by doxygen 1.4.7