CrystalSpace

Public API Reference

Main Page | Modules | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members | Related Pages

csBaseEventHandler Class Reference
[Event handling]

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

#include <csutil/csbaseeventh.h>

Inheritance diagram for csBaseEventHandler:

iEventHandler iBase List of all members.

Public Member Functions

virtual ~csBaseEventHandler ()
 Destructor.
bool RegisterQueue (iObjectRegistry *registry, unsigned int trigger=UINT_MAX)
 Register the event handler with the event queue registered with the object registry.
bool RegisterQueue (iEventQueue *queue, unsigned int trigger=UINT_MAX)
 Register the event handler with an event queue.

Protected Member Functions

 csBaseEventHandler ()
 Constructor.
virtual bool HandleEvent (iEvent &event)
 Implementation of the event handling mechanism.
virtual bool OnBroadcast (iEvent &event)
 Invoked by the event handler when a broadcast event is received.
virtual bool OnCommand (iEvent &event)
 Invoked by the event handler when a command event is received.
virtual bool OnJoystickMove (iEvent &event)
 Invoked by the event handler when a joystick movement event is received.
virtual bool OnJoystickDown (iEvent &event)
 Invoked by the event handler when a joystick button down 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 OnMouseMove (iEvent &event)
 Invoked by the event handler when a mouse move event is received.
virtual bool OnMouseDown (iEvent &event)
 Invoked by the event handler when a mouse down event is received.
virtual bool OnMouseUp (iEvent &event)
 Invoked by the event handler when a mouse up 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 OnUnhandledEvent (iEvent &event)
 Invoked by the event handler when an unknown event is received.
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.
virtual void PostProcessFrame ()
 Invoked by the handler during a post-process frame broadcast event.
virtual void FinishFrame ()
 Invoked by the handler during a finish frame broadcast event.

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 52 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 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.)

Implements iEventHandler.

virtual bool csBaseEventHandler::OnBroadcast iEvent event  )  [protected, virtual]
 

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

Remarks:
Ordinarily a developer should not override this funtion, as the default implementation will call PreProcessFrame(), ProcessFrame(), PostProcessFrame(), or FinishFrame() as appropriate. If you do override this function, either call the base implementation to invoke the aforementioned trigger functions or provide your own implementation.
If you are expecting to handle a broadcast event which is not one of the standard four used for frame rendering, override OnUnhandledEvent(), which is called by the implementaion of OnBroadcast() for any broadcast event which is not processed by one of the 4 frame rendering trigger functions. If you don't plan on responding to the standard 4 broadcast functions, then overriding OnBroadcast() is appropriate.

virtual bool csBaseEventHandler::OnCommand iEvent event  )  [protected, virtual]
 

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

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,
unsigned int  trigger = UINT_MAX
 

Register the event handler with an event queue.

Parameters:
queue The event queue to register with
trigger Combination of the CSMASK_XXX event triggers defined in iutil/evdefs.h. Multiple triggers may be specified by combining them with the bitwise "or" operator (`|').
See also:
iEventQueue::RegisterListener()

bool csBaseEventHandler::RegisterQueue iObjectRegistry registry,
unsigned int  trigger = UINT_MAX
 

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

Parameters:
registry The application's object registry
trigger Combination of the CSMASK_XXX event triggers defined in iutil/evdefs.h. Multiple triggers may be specified by combining them with the bitwise "or" operator (`|').
See also:
iEventQueue::RegisterListener()


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