[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Mac Drag and Drop



I've posted an MCL module for using the Macintosh Drag and Drop Manager onto
the Cambridge ftp site as well as the necessary interface file.  The paths are:
 
     /pub/mcl/contrib/drag-and-drop.lisp
 
     /pub/mcl/interfaces/Drag.lisp
 
Here is the header from module:
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;
;;;; Macintosh Drag and Drop for MCL
;;;;
;;;; Almost, but quite all of the Macintosh Drag Manager is implemented here.
;;;; There are a couple of bonuses, though, the biggest being that the
;;;; implementation easily supports drag and drop behavior among views in a
;;;; window.
;;;;
;;;; General usage notes:
;;;;
;;;; o In order to drag items from a view or receive drops the view's window
;;;;   must include 'drag-&-drop-window-mixin class its definition.
;;;; o If you want a particular view to be able to receive a drop, make sure
;;;;   you've specialized the 'drag-receive-drag method.
;;;; o If you want be able to drag items out of a particular view, specialize
;;;;   the 'drag-selection-p method.
;;;; o Events from the Drag Manager are piped through a dispatching function
;;;;   and sent to MCL methods, which you should specialize.  The methods
;;;;   are all named 'drag-tracking-xxxx.
;;;;
;;;; Following the Real Code are a couple of examples.  The first is a subclass
;;;; of fred, allowing you to drag selections out as either text data (to other
;;;; text-oriented applications), text clipping files in the Finder or as MCL
;;;; files in the Finder.  The second example is a simple view with two text
;;;; fields that allow dragging and dropping between them.  Both examples allow
;;;; you to drop text data, text clipping files and text documents into their
;;;; respective drop locations.  After evaluating the commented code you can
;;;; bring up the examples via (fred-example) and (text-item-example) in the
;;;; Listener.
 
 
Please let me know if you have any comments or problems with the code.
 
Dan