| 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.hReturns 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.hReturns 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.hReturns 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.hReturns 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.hReturns a number that uniquely identifies the dragging session.
- (NSInteger)draggingSequenceNumber
A number that uniquely identifies the dragging session.
NSDragging.hReturns 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.hReturns 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.hSets 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.hSlides 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.hType representing drag operations.
typedef unsigned int NSDragOperation;
See Dragging operations for values.
NSDragging.hThese 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
};
NSDragOperationCopyThe data represented by the image can be copied.
Available in Mac OS X v10.0 and later.
Declared in NSDragging.h.
NSDragOperationLinkThe data can be shared.
Available in Mac OS X v10.0 and later.
Declared in NSDragging.h.
NSDragOperationGenericThe operation can be defined by the destination.
Available in Mac OS X v10.0 and later.
Declared in NSDragging.h.
NSDragOperationPrivateThe operation is negotiated privately between the source and the destination.
Available in Mac OS X v10.0 and later.
Declared in NSDragging.h.
NSDragOperationAll_ObsoleteThe NSDragOperationAll constant is deprecated. Use NSDragOperationEvery instead.
Available in Mac OS X v10.0 and later.
Declared in NSDragging.h.
NSDragOperationMoveThe data can be moved.
Available in Mac OS X v10.0 and later.
Declared in NSDragging.h.
NSDragOperationDeleteThe data can be deleted.
Available in Mac OS X v10.0 and later.
Declared in NSDragging.h.
NSDragOperationEveryAll of the above.
Available in Mac OS X v10.0 and later.
Declared in NSDragging.h.
NSDragOperationNoneNo 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)