Framework | /System/Library/Frameworks/AppKit.framework |
Availability | Available in Mac OS X v10.0 and later. |
Companion guide | |
Declared in | NSDragging.h |
The NSDraggingInfo
protocol declares methods that supply information about a dragging session. 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.
– draggingPasteboard
– draggingSequenceNumber
– draggingSource
– draggingSourceOperationMask
– draggingLocation
– draggingDestinationWindow
– namesOfPromisedFilesDroppedAtDestination:
Returns the image being dragged.
- (NSImage *)draggedImage
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 is ultimately utilized in the dragging operation.
NSDragging.h
Returns the current location of the dragged image’s origin.
- (NSPoint)draggedImageLocation
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.
NSDragging.h
Returns the destination window for the dragging operation.
- (NSWindow *)draggingDestinationWindow
The destination window for the dragging operation.
Either this window is the destination itself, or it contains the view object that is the destination.
NSDragging.h
Returns the current location of the mouse pointer in the base coordinate system of the destination object’s window.
- (NSPoint)draggingLocation
The current location of the mouse pointer in the base coordinate system of the destination object’s window.
NSDragging.h
Returns the pasteboard object that holds the data being dragged.
- (NSPasteboard *)draggingPasteboard
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.
NSDragging.h
Returns a number that uniquely identifies the dragging session.
- (NSInteger)draggingSequenceNumber
A number that uniquely identifies the dragging session.
NSDragging.h
Returns the source, or owner, of the dragged data.
- (id)draggingSource
The source, or owner, of the dragged data.
This method returns nil
if the source is not in the same application as the destination. The dragging source implements methods from the NSDraggingSource informal protocol.
NSDragging.h
Returns the dragging operation mask of the dragging source.
- (NSDragOperation)draggingSourceOperationMask
The dragging operation mask, which is declared by the dragging source through its draggingSourceOperationMaskForLocal:
method. If the source does not permit any dragging operations, this method should return NSDragOperationNone
.
If the source permits dragging operations, the elements in the mask are one or more of the constants described in NSDragOperation
, combined using the C bitwise OR operator.
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 |
NSDragging.h
Sets the drop location for promised files and returns the names of the files that the receiver promises to create there.
- (NSArray *)namesOfPromisedFilesDroppedAtDestination:(NSURL *)dropDestination
A URL object specifying the drop location for promised files.
An array of file names, which are not full paths.
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.
NSDragging.h
Slides the image to a specified location. (Deprecated. Deprecated as of Mac OS X v10.5. There is no alternative method.)
- (void)slideDraggedImageTo:(NSPoint)aPoint
A point that specifies a location in the screen coordinate system.
Calling this method has no effect on the image.
NSDragging.h
Type representing drag operations.
typedef unsigned int NSDragOperation;
See Dragging operations
for values.
NSDragging.h
These constants are used by draggingSourceOperationMask
.
enum { NSDragOperationNone = 0, NSDragOperationCopy = 1, NSDragOperationLink = 2, NSDragOperationGeneric = 4, NSDragOperationPrivate = 8, NSDragOperationAll_Obsolete = 15, NSDragOperationMove = 16, NSDragOperationDelete = 32, NSDragOperationEvery = UINT_MAX };
NSDragOperationCopy
The data represented by the image can be copied.
Available in Mac OS X v10.0 and later.
Declared in NSDragging.h
.
NSDragOperationLink
The data can be shared.
Available in Mac OS X v10.0 and later.
Declared in NSDragging.h
.
NSDragOperationGeneric
The operation can be defined by the destination.
Available in Mac OS X v10.0 and later.
Declared in NSDragging.h
.
NSDragOperationPrivate
The operation is negotiated privately between the source and the destination.
Available in Mac OS X v10.0 and later.
Declared in NSDragging.h
.
NSDragOperationAll_Obsolete
The NSDragOperationAll
constant is deprecated. Use NSDragOperationEvery
instead.
Available in Mac OS X v10.0 and later.
Declared in NSDragging.h
.
NSDragOperationMove
The data can be moved.
Available in Mac OS X v10.0 and later.
Declared in NSDragging.h
.
NSDragOperationDelete
The data can be deleted.
Available in Mac OS X v10.0 and later.
Declared in NSDragging.h
.
NSDragOperationEvery
All of the above.
Available in Mac OS X v10.0 and later.
Declared in NSDragging.h
.
NSDragOperationNone
No drag operations are allowed.
Available in Mac OS X v10.0 and later.
Declared in NSDragging.h
.
NSDragging.h
© 2007 Apple Inc. All Rights Reserved. (Last updated: 2007-03-01)