#include <MEvent.h>
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:
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.
Public Types | |
enum | ModifierType { shiftKey = 1<<0, controlKey = 1<<2 } |
Modifier key types. More... | |
enum | MouseButtonType { kLeftMouse = 1<<6, kMiddleMouse = kLeftMouse<<1 } |
Mouse button types. More... | |
Public Member Functions | |
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 |
enum MEvent::ModifierType |
MEvent::MEvent | ( | ) |
Constructor.
MEvent::~MEvent | ( | ) | [virtual] |
Destructor.
MStatus MEvent::getPosition | ( | short & | x_pos, | |
short & | y_pos | |||
) | const |
Get the location of the event in view co-ordinates. The origin is at the lower left corner of the window.
[out] | x_pos | storage for horizonal position |
[out] | y_pos | storage for vertical position |
MStatus MEvent::setPosition | ( | short & | x_pos, | |
short & | y_pos | |||
) |
set the location of the event to the specified location. The origin is at the lower left corner of the window.
[in] | x_pos | horizonal position to set |
[in] | y_pos | vertical position to set |
MStatus MEvent::getWindowPosition | ( | short & | x_pos, | |
short & | y_pos | |||
) | const |
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.
[out] | x_pos | storage for horizonal position |
[out] | y_pos | storage for vertical position |
MEvent::MouseButtonType MEvent::mouseButton | ( | MStatus * | ReturnStatus = NULL |
) | const |
Get the mouse button of the last event.
[out] | ReturnStatus |
bool MEvent::isModifierKeyRelease | ( | MStatus * | ReturnStatus = NULL |
) | const |
Was a modifier key released.
[out] | ReturnStatus |
MEvent::ModifierType MEvent::modifiers | ( | MStatus * | ReturnStatus = NULL |
) | const |
This routine is used by responders to find the state of the modifiers during the event.
[out] | ReturnStatus |
MStatus MEvent::setModifiers | ( | MEvent::ModifierType & | modType | ) |
set the event modifiers.
[in] | modType | Type of modifier to set to. |
bool MEvent::isModifierNone | ( | MStatus * | ReturnStatus = NULL |
) | const |
Determines if there are any modifiers for this event.
[out] | ReturnStatus |
bool MEvent::isModifierShift | ( | MStatus * | ReturnStatus = NULL |
) | const |
return state of shift key.
[out] | ReturnStatus |
bool MEvent::isModifierControl | ( | MStatus * | ReturnStatus = NULL |
) | const |
return state of control key.
[out] | ReturnStatus |
bool MEvent::isModifierLeftMouseButton | ( | MStatus * | ReturnStatus = NULL |
) | const |
Return the state of the left mouse button.
This method is only valid when called in the hold event for another mouse press.
[out] | ReturnStatus |
bool MEvent::isModifierMiddleMouseButton | ( | MStatus * | ReturnStatus = NULL |
) | const |
Return the state of the middle mouse button.
This method is only valid when called in the hold event for another mouse press.
[out] | ReturnStatus |
Autodesk® Maya® 2009 © 1997-2008 Autodesk, Inc. All rights reserved. | Generated with 1.5.6 |