Important: The information in this document is obsolete and should not be used for new development.
Package | com.apple.cocoa.application |
Companion guide |
The NSDraggingInfo interface declares methods that supply information about a dragging session. NSDraggingInfo methods are designed to be invoked from within a class’s implementation of NSDraggingDestination interface methods. The Application Kit automatically passes an object that conforms to the NSDraggingInfo interface 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 interface.
draggingSource
draggingSourceOperationMask
draggingDestinationWindow
draggingPasteboard
draggingSequenceNumber
draggingLocation
namesOfPromisedFilesDroppedAtDestination
Returns the image being dragged.
public abstract NSImage draggedImage
()
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 is ultimately utilized in the dragging operation.
Returns the current location of the dragged image’s origin in the base coordinate system of the destination object’s window.
public abstract NSPoint draggedImageLocation
()
The image moves along with the mouse pointer (the position of which is given by draggingLocation
) but may be positioned at some offset.
Returns the destination window for the dragging operation.
public abstract NSWindow draggingDestinationWindow
()
Either this window is the destination itself, or it contains the view object that is the destination.
Returns the current location of the mouse pointer in the base coordinate system of the destination object’s window.
public abstract NSPoint draggingLocation
()
Returns the pasteboard object that holds the data being dragged.
public abstract NSPasteboard draggingPasteboard
()
The dragging operation that is ultimately performed utilizes this pasteboard data and not the image returned by the draggedImage
method.
Returns a number that uniquely identifies the dragging session.
public abstract int draggingSequenceNumber
()
Returns the source, or owner, of the dragged data or null
if the source is not in the same application as the destination.
public abstract Object draggingSource
()
The dragging source implements methods from the NSDraggingSource interface.
Returns the dragging operation mask declared by the dragging source (through its draggingSourceOperationMaskForLocal
method).
public abstract int draggingSourceOperationMask
()
If the source permits dragging operations, the elements in the mask are one or more of the constants described in the "Constants" section, combined using the C bitwise OR operator.
If the source does not permit any dragging operations, this method should return DragOperationNone
.
If the user is holding down a modifier key during the dragging session and the source does not 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.
The modifier keys are associated with the dragging operation options shown below:
Modifier Key | Dragging Operation |
---|---|
Control |
|
Option |
|
Command |
|
Sets the drop location for promised files to dropDestination and returns the names (not full paths) of the files that the receiver promises to create there.
public abstract NSArray namesOfPromisedFilesDroppedAtDestination
(java.net.URL dropDestination)
Drag destinations should invoke this method within their performDragOperation
method. The source may or may not have created the files by the time this method returns.
Slides the image to aPoint, a specified location in the screen coordinate system.
public abstract void slideDraggedImageTo
(NSPoint aPoint)
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 is removed from the screen.
The following constants are defined by NSDraggingInfo and are used by draggingSourceOperationMask
:
© 1997, 2007 Apple Inc. All Rights Reserved. (Last updated: 2007-02-01)