Class: TMouseEvent

Declaration: MouseInput.h

Taxonomy Categories:

Member Functions:


Interface Category:

API.

Inherits From:

TEvent

Inherited By:

TMouseDownEvent TMouseMovedEvent TMouseUpEvent

Purpose:

Derived from TEvent, this class represents mouse events. Classes deriving from TMouseEvent specify specific mouse events such as mouse down or mouse up. This is an abstract class that is multibutton aware. This class also has support for multibutton chording. Through this class, a client can find out the state of all other buttons even though the mouse event is generated for a certain button. Keep in mind that mouse button numbering is one-based and starts with 1, not 0.

Instantiation:

Abstract base class; do not allocate.

Deriving Classes:

Can be derived to create specific mouse events.

Concurrency:

Not multithread safe.

Resource Use:

No special requirements.

Member Function: TMouseEvent::TMouseEvent

  1. TMouseEvent (const TGPoint & position, TMouseInputDevice * device, TStandardEventReceiver * receiver)
  2. TMouseEvent (const TGPoint & position, TMouseInputDevice * device, TStandardEventReceiver * receiver, short button, bool isDown)
  3. TMouseEvent (const TMouseEvent & copy)
  4. TMouseEvent ()

Interface Category:

API.

Purpose:

  1. Constructs an event from the specified position, device, and receiver.
  2. Constructs an event from the specified position, device, receiver and button number. This constructor is for multi-button devices.
  3. Copy constructor.
  4. Default constructor.

Calling Context:

  1. Called to create an event.
  2. Called to create an event for multi-button devices.
  3. Called to copy an object
  4. Called by stream-in operators.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

Classes deriving from TMouseEvent will typically override DispatchToMouseEventHandler instead of Dispatch.

Member Function: TMouseEvent::~TMouseEvent

virtual ~ TMouseEvent ()

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: TMouseEvent::operator=

TMouseEvent & operator =(const TMouseEvent & 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: TMouseEvent::GetMouseInputDevice

TMouseInputDevice * GetMouseInputDevice () const

Interface Category:

API.

Purpose:

Returns this event's mouse device.

Calling Context:

Call this function directly.

Parameters:

Return Value:

Returns this event's mouse device.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TMouseEvent::GetEventPosition

TGPoint GetEventPosition () const

Interface Category:

API.

Purpose:

Returns the local position of this event.

Calling Context:

Call this function directly.

Parameters:

Return Value:

Returns a TGPoint that represents this event's local position. In the case of Enter/Exit events, the 'local' view cannot be correctly determined, so this point may not be accurate. If a point is needed with Enter or Exit, use TMouseEvent::GetGlobalEventPosition().

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TMouseEvent::Dispatch

virtual bool Dispatch (MEventTarget & target)

Interface Category:

API.

Purpose:

Dispatches this event.

Calling Context:

Call this function directly.

Parameters:

Return Value:

Returns true if the event was successfully dispatched; false otherwise.

Exceptions:

Throws an exception if any exception is caught.

Concurrency:

Not multithread safe.

Other Considerations:

Classes deriving from TMouseEvent will typically override DispatchToMouseEventHandler instead of Dispatch.

Member Function: TMouseEvent::DispatchToMouseEventHandler

virtual bool DispatchToMouseEventHandler (MMouseEventHandler & handler)

Interface Category:

API.

Purpose:

Sends this event to the specified handler.

Calling Context:

Derived classes of TMouseEvent can call this function.

Parameters:

Return Value:

Returns true if successfully dispatched to mouse event handler; false otherwise.

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 TMouseEvent.

Member Function: TMouseEvent::GetGlobalEventPosition

TGPoint GetGlobalEventPosition () const

Interface Category:

API.

Purpose:

Returns the global coordinate position of this event.

Calling Context:

Call this function directly.

Parameters:

Return Value:

Returns a TGPoint representing this event's global position.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TMouseEvent::IsButtonDown

bool IsButtonDown(const short button ) const

Interface Category:

API.

Purpose:

Returns the current state of any button on the mouse device.

Calling Context:

Call this function directly.

Parameters:

Return Value:

Returns true if the specified mouse button is down; otherwise, returns false.

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.