![](../../Home/Icons/Home.gif)
![](../icons/UpCNM.gif)
![](../icons/CNMContext.gif)
![](../../Home/Icons/Search.gif)
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.
- TMouseEvent (const TGPoint & position, TMouseInputDevice * device, TStandardEventReceiver * receiver)
- TMouseEvent (const TGPoint & position, TMouseInputDevice * device, TStandardEventReceiver * receiver, short button, bool isDown)
- TMouseEvent (const TMouseEvent & copy)
- TMouseEvent ()
Interface Category:
API.
Purpose:
- Constructs an event from the specified position, device, and receiver.
- Constructs an event from the specified position, device, receiver and button number. This constructor is for multi-button devices.
- Copy constructor.
- Default constructor.
Calling Context:
- Called to create an event.
- Called to create an event for multi-button devices.
- Called to copy an object
- Called by stream-in operators.
Parameters:
- const TGPoint & position -The location for the new event specified in global coordinates.
- TMouseInputDevice * device -The new event's device.
- TStandardEventReceiver * receiver -The new event's receiver.
- const TGPoint & position -The location for the new event specified in global coordinates.
- TMouseInputDevice * device -The new event's device.
- TStandardEventReceiver * receiver -The new event's receiver.
- short button -The button number. Mouse button numbering is one-based and starts with 1, not 0.
- bool isDown -Indicates if the button is down or not.
- const TMouseEvent & copy -The object to be copied.
- Takes no 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.
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:
- MEventTarget & target -The target to which to dispatch this event.
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:
- const short button -A value that specifies a particular mouse button. Mouse button numbering is one-based and starts with 1, not 0.
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.