To implement dropping in
list-panel
or
tree-view
or
output-pane
, supply the
:drop-callback
initarg.
You can also supply
:drop-callback
for an
interface
. When the user drags an object over a window, the system first tries to call the
drop-callback
of any pane under the mouse and otherwise calls the
drop-callback
of the top-level interface, if supplied.
The drop-callback receives as arguments a drop-object which is used to communicate information about the dropping operation and stage which is a keyword. The drop-callback is called at several stages: when the pane is displayed; when the user drags over the pane; and when the user drops over the pane. Various functions are provided which you can use to query the drop-object and set attributes appropriately.
You will use
set-drop-object-supported-formats
to specify the data formats that it wants to receive. The
:string
format can be used to receive a string from another application and the
:filename-list
format can be used to receive a list of filenames from another application such as the Macintosh Finder or the Windows Explorer. Any other keyword in formats is assumed to be a private format that can only be used to receive objects from with the same Lisp image.
You can use
drop-object-provides-format
to query whether a given data format is actually available, and then you can call
(setf drop-object-drop-effect)
to modify the effect of the dropping operation .
Finally, at the
:drop
stage, you will use
drop-object-get-object
to retrieve (for each data format) the object which was returned by the
drag-callback
, and then do something with this object, typically copying or moving it to the pane in some way.
CAPI User Guide (Unix version) - 30 Aug 2011