Adopted By:
no OPENSTEP classes
Declared In:
AppKit/NSDragging.h
Protocol Description
The NSDraggingInfo protocol declares methods that supply information about a dragging session (see the NSDraggingDestination protocol for definitions of dragging terms). NSDraggingInfo methods are designed to be invoked from within a class's implementation of NSDraggingDestination informal protocol methods. The Application Kit automatically passes an object that conforms to the NSDraggingInfo protocol as the argument to each of the methods defined by NSDraggingDestination. NSDraggingInfo messages should be sent to this object; you never need to create a class that implements the NSDraggingInfo protocol.
draggedImage
Returns the image being dragged. This image object visually represents the data put on the pasteboard during the drag operation; however, it is the pasteboard data and not this image that are ultimately utilized in the dragging operation.
See also:
- draggedImageLocation
draggedImageLocation
Returns the current location of the dragged image's origin in the base coordinate system of the destination object's window. The image moves along with the mouse pointer (the position of which is given by draggingLocation
) but may be positioned at some offset.
draggingDestinationWindow
Returns the destination window for the dragging operation. Either this window is the destination itself, or it contains the view object that is the destination.
draggingLocation
Returns the current location of the mouse pointer in the base coordinate system of the destination object's window.
See also:
- draggedImageLocation
draggingPasteboard
Returns the pasteboard object that holds the data being dragged. The dragging operation that is ultimately performed utilizes this pasteboard data and not the image returned by the draggedImage
method.
draggingSequenceNumber
Returns a number that uniquely identifies the dragging session.
draggingSource
Returns the source, or owner, of the dragged data or nil
if the source isn't in the same application as the destination. The dragging source implements methods from the NSDraggingSource informal protocol.
draggingSourceOperationMask
Returns the dragging operation mask declared by the dragging source (through its draggingSourceOperationMaskForLocal:
method). If the source permits dragging operations, the elements in the mask will be one or more of the following, combined using the C bitwise OR operator:
Option | Meaning |
---|---|
NSDragOperationCopy | The data represented by the image can be copied. |
NSDragOperationLink | The data can be shared. |
NSDragOperationGeneric | The operation can be defined by the destination. |
NSDragOperationPrivate | The operation is negotiated privately between the source and the destination. |
NSDragOperationAll | Combines all the above. |
If the source does not permit any dragging operations, then method should return NSDragOperationNone.
If the user is holding down a modifier key during the dragging session and the source doesn't prohibit modifier keys from affecting the drag operation (through its ignoreModifierKeysWhileDragging
method), then the operating system combines the dragging operation value that corresponds to the modifier key (see the descriptions below) with the source's mask using the C bitwise AND operator.
On Mach the modifier keys are associated with the dragging operation options shown below,
Modifier Key | Dragging Option |
---|---|
Control | NSDragOperationLink |
Alternate | NSDragOperationCopy |
Command | NSDragOperationGeneric |
while on Windows the modifier keys are associated with the following dragging operation options.
Modifier Key | Dragging Option |
---|---|
Control | NSDragOperationCopy |
Shift-Control | NSDragOperationLink |
Alternate | NSDragOperationCopy |
slideDraggedImageTo:
(NSPoint)aPoint
Slides the image to aPoint, a specified location in the screen coordinate system. This method can be used to snap the image down to a particular location. It should only be invoked from within the destination's implementation of prepareForDragOperation:
-in other words, after the user has released the image but before it's removed from the screen.