In your mouseDown:
if ([event modifierFlags] & NSShiftKeyMask) { constrain = YES; }If you need to check them outside of your mouseDown, and if you're on 10.6 or beyond, you can use+[NSEvent modifierFlags];
If you're stuck in 10.5 or older, you need to do something like this: dip into carbon:
Carbon and AppKit use different constants for the modifiers, however, so you may need to convert between them depending on your situation. (Thanks to Peter Hosey for the Carbon trick)
- GetCurrentEventKeyModifiers returns the modifiers of the last event processed by the event dispatcher. This is usually sufficient.
- GetCurrentKeyModifiers returns the hardware state of the modifiers.
(Thanks to Mike Ash for pointing out the new 10.6 API)