Implementing Drag and Drop

Drag and drop on Mac OS X is implemented using a few standard protocols and pasteboards. All drag and drop operations have three major elements, a source, a destination, and the data being dragged. The source and destination are usually NSView objects, but any NSWindow can also be a source or destination. The data being dragged is placed on a pasteboard. A standard pasteboard, NSDragPboard, has been set aside for drag and drop, but it is possible to use a private pasteboard instead if desired.

The term dragging session (or just drag session) is used to describe the whole process from the initiation of a drag at mouse-down until the mouse-up event is received. The source, destination, data, and all mouse-dragged events ...

Get Cocoa® Programming now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.