NSDraggingSource Protocol Reference
| Conforms to | |
| Framework | /System/Library/Frameworks/AppKit.framework |
| Availability | Available in OS X v10.7 and later. |
| Companion guide | |
| Declared in | NSDragging.h |
Overview
The NSDraggingSource protocol declares methods that are implemented by the source object in a dragging session.
In OS X v10.7 and later NSDraggingSource is now a formal protocol and has an updated interface. The OS X v10.6 behavior has been retained, but will be dropped in a future version of the operating system. The methods that are to be deprecated are marked as such.
Tasks
Dragging Session Operation
-
– draggingSession:sourceOperationMaskForDraggingContext:required method
Dragging Session Locations
-
– draggingSession:endedAtPoint:operation: -
– draggingSession:movedToPoint: -
– draggingSession:willBeginAtPoint:
Dragging Session Modifier Keys
Dragging Options
-
– draggingSourceOperationMaskForLocal:Deprecated in OS X v10.7 -
– ignoreModifierKeysWhileDraggingDeprecated in OS X v10.7 -
– namesOfPromisedFilesDroppedAtDestination:Deprecated in OS X v10.7
Responding to Messages During a Dragging Session
-
– draggedImage:beganAt:Deprecated in OS X v10.7 -
– draggedImage:endedAt:operation:Deprecated in OS X v10.7 -
– draggedImage:movedTo:Deprecated in OS X v10.7 -
– draggedImage:endedAt:deposited:required method Deprecated in OS X v10.1
Instance Methods
draggingSession:endedAtPoint:operation:
Invoked when the dragging session has completed.
Parameters
- session
The dragging session.
- screenPoint
The point where the drag ended, in screen coordinates.
- operation
The drag operation. See
NSDragOperationfor drag operation types.
Availability
- Available in OS X v10.7 and later.
Declared In
NSDragging.hdraggingSession:movedToPoint:
Invoked when the drag moves on the screen.
Parameters
- session
The dragging session.
- screenPoint
The point where the drag moved to, in screen coordinates.
Availability
- Available in OS X v10.7 and later.
Declared In
NSDragging.hdraggingSession:sourceOperationMaskForDraggingContext:
Declares the types of operations the source allows to be performed. (required)
Parameters
- session
The dragging session.
- context
The dragging context. See
NSDraggingContextfor the supported values.
Return Value
The appropriate dragging operation as defined in
Discussion
In the future Apple may provide more specific "within" values in the future. To account for this, for unrecognized localities, return the operation mask for the most specific context that you are concerned with. The following code is an example of how to implement this functionality:
switch(context) { |
case NSDraggingContextOutsideApplication: |
return ... |
break; |
case NSDraggingContextWithinApplication: |
default: |
return ... |
break; |
} |
Availability
- Available in OS X v10.7 and later.
Declared In
NSDragging.hdraggingSession:willBeginAtPoint:
Invoked when the drag will begin.
Parameters
- session
The dragging session.
- screenPoint
The point where the drag will begin, in screen coordinates.
Availability
- Available in OS X v10.7 and later.
Declared In
NSDragging.hignoreModifierKeysForDraggingSession:
Returns whether the modifier keys will be ignored for this dragging session.
Parameters
- session
The dragging session.
Return Value
YES if the modifier keys will be ignored, NO otherwise.
Availability
- Available in OS X v10.7 and later.
Declared In
NSDragging.h© 2011 Apple Inc. All Rights Reserved. (Last updated: 2011-06-06)