First you should decide which CAPI pane(s) and interfaces will support dragging, and which data formats they will support. Data formats are arbitrary keywords that must be interpreted by the pane where the user can drop.
This example returns string data for a tree-view defined below:
There is a further example showing dragging from list-panels in
To implement dragging items around within a single output-pane, include suitable callbacks on these gestures in its input-model :
In this case it is not necessary to call drag-pane-object and you can implement dropping in the same pane by a suitable callback for:
To implement dragging from an output-pane include an appropriate callback on the
(:button-1 :press) gesture in the pane's
. This callback should call drag-pane-object with arguments which provide the data formats and values associated with each format. You will also specify
in the destination pane(s), as described in Dropping.
To implement dragging of text in an editor-pane, use EDITOR functions such as
editor:points-to-string to obtain the value for the
Receives a string, potentially from another application. Is also understood by some other panes that expect text.
Receives an image on Cocoa and GTK+. The value passed should be an image object. See Working with images for more information about images.When supplying an image for dragging (that is, including
in the plist argument of drag-pane-object or in the plist that is returned from the
), the dragging mechanism frees the image (as by free-image) when it finishes with it (which will be at some indeterminate time later). If you need to pass an image which you want to use later, you should make a copy of it by make-sub-image.
When receiving an image (by calling drop-object-get-object with
:image), the received image should also be freed when you finish with it. However, it will be freed automatically when the pane supplied to drop-object-get-object is destroyed, so you do not need to free it explicitly if freeing can wait (which is probably true in most cases).
On Cocoa, if there is a drag image in an interface title bar, then dragging this image will by default return a list containing the interface
:filename-list data. You could override this by providing a
for the interface.
CAPI User Guide and Reference Manual (Macintosh version) - 25 Feb 2015