Class: TEvent

Declaration: Input.h

Taxonomy Categories:

Member Functions:


Interface Category:

API.

Inherits From:

None.

Inherited By:

TMouseEvent

Purpose:

TEvents represent the syntactic elements of a userŐs action. They are created by a TInputDevice object in an applicationŐs task in response to a message from the input deviceŐs driver. TEvents provide the glue for an input device writer to call a specific function on a given event handling object. Events also provide the event handling object with the protocol for getting information about the event; this information can guide the event target in its action. Like TInputDevice, input device writers provide specific derived classes for specific types of events. For example, mouse writers or mouse framework developers will likely derive from TEvent to provide a TMouseEvent class. TMouseEvent would know how to find out whether a MEventTarget object can respond to mouse events, and if so, how to invoke the proper protocol. Applications use TEvent derived classes to find out about the event they are handling. Continuing the mouse example, the applicationŐs MEventTarget can ask the TMouseEvent where the mouse click occurred. Applications will probably use the base TEvent protocol only when they need to interact with the TInputDevice that generated the TEvent, or for binding interactors to the source of the TEvent. TEvent is responsible for (1) invoking the proper protocol on a given MEventTarget if that MEventTarget can respond to the TEvent; (2) knowing which input device created and is distributing the event; (3) starting an interactor from the event; and (4) knowing which TStandardEventReceiver is distributing the event.

Instantiation:

Allocate on the heap or the stack.

Deriving Classes:

Classes deriving from TEvent must override the pure virtual function Dispatch.

Concurrency:

Not multithread safe.

Resource Use:

No special requirements.

Member Function: TEvent::TEvent

  1. TEvent (TInputDevice * itsInputDevice, TStandardEventReceiver * receiver)
  2. TEvent (const TEvent & copy)

Interface Category:

API.

Purpose:

  1. Creates an event. The specified input device is the new event's source, and the specified event receiver is the receiver for the event.
  2. Copy constructor.

Calling Context:

  1. Called from the input device to create an event.
  2. Called to copy an object.

Parameters:

Return Value:

None.

Exceptions:

An assertion is caused if you do not specify an input device or event receiver for these constructors.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TEvent::~TEvent

virtual ~ TEvent ()

Interface Category:

API.

Purpose:

Destructor.

Calling Context:

Called to destroy an object.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TEvent::operator=

TEvent & operator =(const TEvent & assign)

Interface Category:

API.

Purpose:

Assignment operator.

Calling Context:

Call this function by using the operator in an assignment statement.

Parameters:

Return Value:

Returns a const reference to the left-hand side object.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TEvent::Dispatch

virtual bool Dispatch (MEventTarget & target)

Interface Category:

API.

Purpose:

Dispatches this event to the specified event target.

Calling Context:

Called by the HandleDistributeEvent function of an MEventDistributor derived class.

Parameters:

Return Value:

Returns true if the event target handled the event; otherwise, returns false.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

This function is a pure virtual function and must be overridden by classes deriving from TEvent.

Member Function: TEvent::GetInputDevice

TInputDevice * GetInputDevice () const

Interface Category:

API.

Purpose:

Returns the input device that created this event. The input device is established for an event when the event is constructed.

Calling Context:

Call this function directly.

Parameters:

Return Value:

Returns the input device that created this event.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TEvent::GetEventReceiver

TStandardEventReceiver * GetEventReceiver () const

Interface Category:

API.

Purpose:

Returns the event receiver for this event. The event receiver is established during construction of the event.

Calling Context:

Call this function directly.

Parameters:

Return Value:

Returns the event receiver for this event.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TEvent::StartInteractor

virtual void StartInteractor (TInteractor * adoptInteractor)

Interface Category:

API.

Purpose:

Starts the specified interactor. After this function is called, the input device adopts the interactor and dispatches the event. When the interactor is done, it is automatically deleted by the input device. StartInteractor is actually a convenience function for the adopt interactor function.

Calling Context:

Called by the application's event target object.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.
Click the icon to mail questions or corrections about this material to Taligent personnel.
Copyright©1995 Taligent,Inc. All rights reserved.