Next Page > Hide TOC

Legacy Documentclose button

Important: The information in this document is obsolete and should not be used for new development.

NSDraggingInfo

Package
com.apple.cocoa.application
Companion guide

Overview

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.

Tasks

Dragging-session Information

Image Information

Sliding the Image

Instance Methods

draggedImage

Returns the image being dragged.

public abstract NSImage draggedImage()

Discussion

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.

See Also

draggedImageLocation

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()

Discussion

The image moves along with the mouse pointer (the position of which is given by draggingLocation) but may be positioned at some offset.

See Also

draggingDestinationWindow

Returns the destination window for the dragging operation.

public abstract NSWindow draggingDestinationWindow()

Discussion

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.

public abstract NSPoint draggingLocation()

See Also

draggingPasteboard

Returns the pasteboard object that holds the data being dragged.

public abstract NSPasteboard draggingPasteboard()

Discussion

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.

public abstract int draggingSequenceNumber()

draggingSource

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()

Discussion

The dragging source implements methods from the NSDraggingSource interface.

draggingSourceOperationMask

Returns the dragging operation mask declared by the dragging source (through its draggingSourceOperationMaskForLocal method).

public abstract int draggingSourceOperationMask()

Discussion

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

DragOperationLink

Option

DragOperationCopy

Command

DragOperationGeneric

namesOfPromisedFilesDroppedAtDestination

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)

Discussion

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.

Availability

slideDraggedImageTo

Slides the image to aPoint, a specified location in the screen coordinate system.

public abstract void slideDraggedImageTo(NSPoint aPoint)

Discussion

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.

Constants

The following constants are defined by NSDraggingInfo and are used by draggingSourceOperationMask:

Constant

Description

DragOperationCopy

The data represented by the image can be copied.

DragOperationLink

The data can be shared.

DragOperationGeneric

The operation can be defined by the destination.

DragOperationPrivate

The operation is negotiated privately between the source and the destination.

DragOperationMove

The data can be moved.

DragOperationDelete

The data can be deleted.

DragOperationEvery

All of the above.

DragOperationAll

Deprecated. Use DragOperationEvery instead.

DragOperationNone

No drag operations are allowed.



Next Page > Hide TOC


© 1997, 2007 Apple Inc. All Rights Reserved. (Last updated: 2007-02-01)


Did this document help you?
Yes: Tell us what works for you.
It’s good, but: Report typos, inaccuracies, and so forth.
It wasn’t helpful: Tell us what would have helped.