Xrb::EventHandler Class Reference

Provides event handling, blocking, and queueing facilities for subclasses. More...

#include <xrb_eventhandler.hpp>

Inheritance diagram for Xrb::EventHandler:

Inheritance graph
[legend]

List of all members.

Public Member Functions

 EventHandler (EventQueue *owner_event_queue)
 Constructs an EventHandler with the given EventQueue.
virtual ~EventHandler ()
 Destructor.
bool ProcessEvent (Event const *e)
 Called to process an event immediately.
void EnqueueEvent (Event const *e)
 Enqueues an event for this EventHandler in the EventQueue pointed to by m_owner_event_queue.
EventQueueOwnerEventQueue () const
 Returns m_owner_event_queue -- the EventQueue which controls asynchronous event handling for this EventHandler.
bool IsBlockingEvents () const
 Returns true iff this EventHandler is blocking all events.
Float MostRecentEventTime () const
 Returns the time of the most-recently processed Event.
Float EventTime () const
 Returns time of the event currently being processed.
Float EventDT () const
 Returns the time delta since the most recently processed event.
void SetIsBlockingEvents (bool const is_blocking_events)
 Sets the event blocking property of this EventHandler.

Protected Member Functions

void SetOwnerEventQueue (EventQueue *const owner_event_queue)
 Sets the owner EventQueue for this EventHandler.
virtual bool HandleEvent (Event const *e)=0
 Subclasses must override this to provide the actual event handling necessary.


Detailed Description

Provides event handling, blocking, and queueing facilities for subclasses.

Classes which require event handling should derive from this class.

Definition at line 26 of file xrb_eventhandler.hpp.


Constructor & Destructor Documentation

Xrb::EventHandler::EventHandler ( EventQueue owner_event_queue  ) 

Constructs an EventHandler with the given EventQueue.

If EventQueue is NULL, then calls to EnqueueEvent will cause a failed assertion.

Parameters:
owner_event_queue The EventQueue which processes asynchronously queued events.

Definition at line 19 of file xrb_eventhandler.cpp.

Xrb::EventHandler::~EventHandler (  )  [virtual]

Destructor.

If m_owner_event_queue is not NULL, then all of this EventHandler's events will be deleted from it.

Definition at line 28 of file xrb_eventhandler.cpp.

References Xrb::EventQueue::DeleteEventsBelongingToHandler().


Member Function Documentation

bool Xrb::EventHandler::ProcessEvent ( Event const *  e  ) 

Called to process an event immediately.

Returns true iff the event was used by this eventhandler. If events are being blocked, it will not call HandleEvent.

Definition at line 39 of file xrb_eventhandler.cpp.

References HandleEvent(), IsBlockingEvents(), Xrb::Event::IsScheduledForDeletion(), and Xrb::Event::Time().

void Xrb::EventHandler::EnqueueEvent ( Event const *  e  ) 

Enqueues an event for this EventHandler in the EventQueue pointed to by m_owner_event_queue.

The event will be processed asynchronously in chronological order, interleaved with all other events queued in m_owner_event_queue.

If m_owner_event_queue is NULL, this function will assert.

Definition at line 78 of file xrb_eventhandler.cpp.

References Xrb::EventQueue::EnqueueEvent().

EventQueue* Xrb::EventHandler::OwnerEventQueue (  )  const [inline]

Returns m_owner_event_queue -- the EventQueue which controls asynchronous event handling for this EventHandler.

If NULL, then there is no associated EventQueue, and events cannot be queued for this EventHandler.

Definition at line 63 of file xrb_eventhandler.hpp.

bool Xrb::EventHandler::IsBlockingEvents (  )  const [inline]

Returns true iff this EventHandler is blocking all events.

When an EventHandler is blocking events, ProcessEvent returns false immediately upon being called.

Definition at line 71 of file xrb_eventhandler.hpp.

Referenced by ProcessEvent().

Float Xrb::EventHandler::MostRecentEventTime (  )  const [inline]

Returns the time of the most-recently processed Event.

Returns 0 if no event has been processed.

Definition at line 78 of file xrb_eventhandler.hpp.

References Xrb::Max().

Referenced by Xrb::EventQueue::EnqueueEvent().

Float Xrb::EventHandler::EventTime (  )  const [inline]

Returns time of the event currently being processed.

This function may only be called from within HandleEvent, since it would be meaningless anywhere else. Calling it elsewhere will cause an assert.

Definition at line 87 of file xrb_eventhandler.hpp.

Float Xrb::EventHandler::EventDT (  )  const [inline]

Returns the time delta since the most recently processed event.

This function may only be called from within HandleEvent, since it would be meaningless anywhere else. Calling it elsewhere will cause an assert.

Definition at line 97 of file xrb_eventhandler.hpp.

void Xrb::EventHandler::SetIsBlockingEvents ( bool const   is_blocking_events  )  [inline]

Sets the event blocking property of this EventHandler.

If true, ProcessEvent will immediately return false, otherwise the normal event handling will be done.

Definition at line 107 of file xrb_eventhandler.hpp.

Referenced by Xrb::ModalWidget::Shutdown().

void Xrb::EventHandler::SetOwnerEventQueue ( EventQueue *const   owner_event_queue  )  [inline, protected]

Sets the owner EventQueue for this EventHandler.

Widget, being an EventHandler itself, is constructed with no owner EventQueue. This function is used to assign the owner EventQueue of its parent when attached. Screen uses this function as well, though its owner EventQueue is passed in through the constructor.

Definition at line 120 of file xrb_eventhandler.hpp.

Referenced by Xrb::Widget::Widget().

virtual bool Xrb::EventHandler::HandleEvent ( Event const *  e  )  [protected, pure virtual]

Subclasses must override this to provide the actual event handling necessary.

ProcessEvent calls this function to do the subclass-specific event handling. Overrides of this function should return true if the event was used, otherwise false.

Implemented in Xrb::Widget, Xrb::InputState, Xrb::Key, and Xrb::KeyRepeater.

Referenced by ProcessEvent().


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

Hosted by SourceForge.net Logo -- Generated on Fri Aug 21 21:46:39 2009 for XuqRijBuh by doxygen 1.5.8