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

drag & drop w/in same view



First, thanks to Dan Camper for contributing his Lisp interface to the
Macintosh drag manager.

I'm finding it kinda heavy going, though, and wonder if anyone can help me
figure out how to drag something within the same view.  A conceptually
simple example would be dragging a circle from one place to another within
a view.

Here's a simple definition of a view w/ a circle in it if anyone feels like
taking a crack at it.

Thanks!

-Tom

;;; a view that contains a circle
;;; How could we use the drag manager to allow the circle
;;; to be dragged around in the view?

(require :quickdraw)

(defclass circle-view (view)
  ((center :type integer
           :initform #@(50 50))
   (radius :type integer
           :initform #@(30 30))))

;;; draw the circle.

(defmethod view-draw-contents ((self circle-view))
  (with-slots (center radius) self
    (rlet ((r :rect
              :topleft (subtract-points center radius)
              :botright (add-points center radius)))
      (#_paintOval r))))


#|
(make-instance 'window
  :view-subviews (list (make-instance 'circle-view)))

|#