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

growing modal-dialogs...



I need a modal dialog that has a grow-icon.

:grow-icon-p t   has no discernible effect.

Don't know if this qualifies as a bug or not, as I've never seen a
modal-dialog that could grow.

No reason why not, though...Spare me the flames if it's against Mac GUI
Guidelines.  It makes sense in this instance.

I got it working through nefarious means, which I give below FYI.

Drawing the damn grow-icon should probably be replaced with a nifty trap
call and such-like, but I was in a hurry.  [No, window-draw-grow-icon don't
work]

(defclass growable-modal (dialog)
  ()
  (:default-initargs
    :window-type :double-edge-box
    :view-position :centered
    :grow-icon-p t ;It's here for good luck, even though it don't do
nuttin'
) )

(defmethod view-draw-contents :after ((view growable-modal))
   (let* ((br (view-size view))
         (tl1 (subtract-points br #@(15 15)))
         ;change to (br1 br) if you like to see the whole rectangle...
         (br1 (add-points br #@(4 4)))
         (tl2 (subtract-points br #@(12 12)))
         (br2 (add-points tl2 #@(6 6)))
         (tl3 (subtract-points br #@(10 9)))
         (br3 (add-points tl3 #@(8 7))))
    (rlet ((r1 :rect :topleft tl1 :bottomright br1)
           (r2 :rect :topleft tl2 :bottomright br2)
           (r3 :rect :topleft tl3 :bottomright br3))
      (#_EraseRect r1)
      (#_FrameRect r1)
      (#_EraseRect r3)
      (#_FrameRect r3)
      (#_EraseRect r2)
      (#_FrameRect r2))))


(defmethod view-click-event-handler :around ((view growable-modal) where)
  (let ((size (view-size view)))
    (if (and (< (- (point-h size) (point-h where)) 15)
             (< (- (point-v size) (point-v where)) 15))
      (progn
        (invalidate-view view t)
        ;Thank <deity> window-grow-event-handler works...
        (window-grow-event-handler view (local-to-global view where)))
      (call-next-method))))

(modal-dialog (make-instance 'growable-modal))
"TANSTAAFL" Rich lynch@ils.nwu.edu