Return to the Main Index
Return to the Alphabetic Index

Copyright (c) 1994 by NeXT Computer, Inc. All Rights Reserved.


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, an informal protocol of NSObject, for definitions of dragging terms). A view or window first registers dragging types; it may then send NSDraggingInfo protocol messages while dragging occurs to get details about that dragging session.

NSDraggingInfo methods are designed to be invoked from within an object's implementation of the NSDraggingDestination protocol methods. An object that conforms to NSDraggingInfo is passed as the argument to each of the methods defined by NSDraggingDestination; NSDraggingInfo messages should be sent to this conforming object. The Application Kit supplies an NSDraggingInfo object automatically so that you never need to create a class that implements this protocol.

Dragging-Session Information

- (NSWindow *)draggingDestinationWindow Returns the destination's Window.

- (NSPoint)draggingLocation Returns the current location of the cursor's hot spot, reckoned in the base coordinate system of the destination object's Window.

- (NSPasteboard *)draggingPasteboard Returns the Pasteboard that holds the dragged data.

- (int)draggingSequenceNumber Returns a number that uniquely identifies the dragging session.

- (id)draggingSource Returns the source, or owner, of the dragged image. Returns nil if the source isn't in the same application as the destination.

- (NSDragOperation)draggingSourceOperationMask

Returns the operation mask declared by the source.

Image Information

- (NSImage *)draggedImage Returns the image object that's being dragged. Don't invoke this method after the user has released the image, and don't release the object that this method returns.

- (NSPoint)draggedImageLocation Returns the current location of the dragged image's origin. The image moves in lockstep with the cursor (the position of which is given by draggingLocation) but may be positioned at some offset. The point that's returned is reckoned in the base coordinate system of the destination object's Window.

Sliding the Image

- (void)slideDraggedImageTo:(NSPoint)screenPoint

Slides the image to the given location in the screen coordinate system. This method should only be invoked after the user has released the image but before it's removed from the screen.