class MEvent

Jump to documentation

System event information (OpenMayaUI) (OpenMayaUI.py)

public members:

enum ModifierType
shiftKey
controlKey
enum MouseButtonType
kLeftMouse
kMiddleMouse
MEvent ()
virtual ~MEvent ()
MStatus getPosition ( short& x_pos, short& y_pos ) const
MStatus setPosition ( short& x_pos, short& y_pos )
MStatus getWindowPosition ( short& x_pos, short& y_pos ) const
MouseButtonType mouseButton ( MStatus * ReturnStatus = NULL ) const
bool isModifierKeyRelease ( MStatus * ReturnStatus = NULL ) const
ModifierType modifiers ( MStatus * ReturnStatus = NULL ) const
MStatus setModifiers ( ModifierType & modType )
bool isModifierNone ( MStatus * ReturnStatus = NULL ) const
bool isModifierShift ( MStatus * ReturnStatus = NULL ) const
bool isModifierControl ( MStatus * ReturnStatus = NULL ) const
bool isModifierLeftMouseButton ( MStatus * ReturnStatus = NULL ) const
bool isModifierMiddleMouseButton ( MStatus * ReturnStatus = NULL ) const

Documentation

System event information class.

Description

The MEvent class is used for querying system events such as mouse presses.

Events are handled by an MPxContext derived class in which MEvents are passed and can be accessed.

Since Maya has default actions for several events, only a subset are avalaible through the API.
The events that can be accessed are:

Several modifiers for events are also accessible through the API. Modifiers are actions that occur during an event. For example, holding down the shift key while pressing a mouse button causes a button press event to occur with a shift modifier.

A modifier can be used to determine if two mouse events occur simulaneously. The second mouse event is registered as a modifier in the hold event of the first mouse button. So if you wanted to determine if both the left and middle buttons are pressed then you would query the modifier in the hold event of the first mouse button using the isModifierMiddleMouseButton() and isModifierLeftMouseButton() methods.

Functions

MEvent:: MEvent ()

Description

Constructor.

MEvent:: ~MEvent ()

Description

Destructor.

MStatus MEvent:: getPosition ( short& x_pos, short& y_pos ) const

Description

Get the location of the event in view co-ordinates. The origin is at the lower left corner of the window.

Arguments

  • x_pos storage for horizonal position
  • y_pos storage for vertical position

Return Value

  • Status Code

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure Object error.

MStatus MEvent:: setPosition ( short& x_pos, short& y_pos )

Description

set the location of the event to the specified location. The origin is at the lower left corner of the window.

Arguments

  • x_pos horizonal position to set
  • y_pos vertical position to set

Return Value

  • Status Code

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure Object error.

MStatus MEvent:: getWindowPosition ( short& x_pos, short& y_pos ) const

Description

This routine is used by responders to query the position of the pointer when the event occurred. It is given in screen co-ordinates.

The origin is at the upper left corner of the window.

Arguments

  • x_pos storage for horizonal position
  • y_pos storage for vertical position

Return Value

  • Status Code

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure Object error.

MEvent::MouseButtonType MEvent:: mouseButton ( MStatus * ReturnStatus ) const

Description

Get the mouse button of the last event.

Arguments

  • ReturnStatus

Return Value

  • Mouse button from last event.

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure Object error.

bool MEvent:: isModifierKeyRelease ( MStatus * ReturnStatus ) const

Description

Was a modifier key released.

Arguments

  • ReturnStatus

Return Value

  • true A modifier key was released.
  • false No modifier key was released.

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure Object error.

MEvent::ModifierType MEvent:: modifiers ( MStatus * ReturnStatus ) const

Description

This routine is used by responders to find the state of the modifiers during the event.

Arguments

  • ReturnStatus

Return Value

  • Modifier type.

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure Object error.

MStatus MEvent:: setModifiers ( MEvent::ModifierType & modType )

Description

set the event modifiers.

Arguments

  • modType Type of modifier to set to.

Return Value

  • Status Code

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure Object error.

bool MEvent:: isModifierNone ( MStatus * ReturnStatus ) const

Description

Determines if there are any modifiers for this event.

Arguments

  • ReturnStatus

Return Value

  • true There are modifiers for this event.
  • false There are NO modifiers for this event.

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure Object error.

bool MEvent:: isModifierShift ( MStatus * ReturnStatus ) const

Description

return state of shift key.

Arguments

  • ReturnStatus

Return Value

  • true Shift key triggered this event.
  • false The shift key did not cause this event.

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure Object error.

bool MEvent:: isModifierControl ( MStatus * ReturnStatus ) const

Description

return state of control key.

Arguments

  • ReturnStatus

Return Value

  • true Control key triggered this event.
  • false The control key did not cause this event.

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure Object error.

bool MEvent:: isModifierLeftMouseButton ( MStatus * ReturnStatus ) const

Description

Return the state of the left mouse button.

This method is only valid when called in the hold event for another mouse press.

Arguments

  • ReturnStatus

Return Value

  • true Left mouse button triggered this event.
  • false The left moust button did not cause this event.

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure Object error.

bool MEvent:: isModifierMiddleMouseButton ( MStatus * ReturnStatus ) const

Description

Return the state of the middle mouse button.

This method is only valid when called in the hold event for another mouse press.

Arguments

  • ReturnStatus

Return Value

  • true Middle mouse button triggered this event.
  • false The middle moust button did not cause this event.

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure Object error.

This class has no child classes.


Autodesk® Maya® 2008 © 1997-2007 Autodesk, Inc. All rights reserved. doc++ Copyright