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

Re: setting grow size for an ap



At  5:03 PM 8/18/93 -0600, Lois Mitchell wrote:
>Subject:   setting grow size for an application window
>I've been trying to figure out how to set the minimum and maximum "grow" size
>for individual application windows.
>
>I see that window-grow-rect is a window class slot which contains the minimum
>and maximum sizes within a rectangle.  I also see that the generic function
>window-grow-rect returns the value of this rectangle.  In addition, the method
>window-grow-event-handler documentation says that it calls the _GrowWindow trap
>to perform the resizing, which means it must be passing a limit to the operating
>system as described in Inside Macintosh.
>
>Are there MCL functions available that would allow us to set the min and max
>values programmatically?  Additionally, we would like to be able to set these
>values for each instance of a window, rather than for a class of windows.
>
>Thank you for any help you can provide.

Here's a 10 minute hack that should get you started:

-----------------------------------------------------------------------------------

; window-with-grow-rect.lisp
;
; A window class with the possibility of a different window-grow-rect
; for each instance.

(in-package :ccl)

(export '(window-with-grow-rect set-window-grow-rect))

(eval-when (:compile-toplevel :execute :load-toplevel)
  (require "QUICKDRAW"))                ; for with-rectangle-arg

(defclass window-with-grow-rect (window)
  ((local-grow-rect :accessor local-grow-rect :initform nil)))

; The :GROW-RECT arg should be a list of the form:
; (left &optional top right bottom)
(defmethod initialize-instance ((w window-with-grow-rect) &key grow-rect)
  (prog1
    (call-next-method)
    (when grow-rect
      (apply #'set-window-grow-rect w grow-rect))))

(defmethod window-grow-rect ((w window-with-grow-rect))
  (or (local-grow-rect w) (call-next-method)))

(defmethod set-window-grow-rect ((w window-with-grow-rect) left &optional
                                 top right bottom)
  (with-rectangle-arg (new-rect left top right bottom)
    (let ((grow-rect (local-grow-rect w)))
      (unless grow-rect
        (setq grow-rect
              (setf (local-grow-rect w)
                    (make-record (:rect :storage :pointer)))))
      (copy-record new-rect (:rect :storage :pointer) grow-rect))))