CLIM mail archive

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

Re: dw:find-program-window




  Date: Tue, 24 Nov 1992 14:30+0200
  From: Vincent Keunen <nrb!keunen@relay.eu.net>
  
  Is there an equivalent of dw:find-program-window in clim?  If not,
  what's the best way to do that?  A method (before? after? around?) on
  run-frame-top-level?...

This is what I use.  In clim 1, I have to keep a list of all the
root windows that I've opened, *sheet-roots*.  In addition, I
keep a list of all the frames that have "finished", *deactivated-frames*.

In clim 2, clim does all the necessary bookkeeping, as you can see.

(In the development version of clim 2, they've added an even
easier way to map over frames, called something like
silica:map-over-frames.)
  
(defmacro for-each-frame ((symbol) &body body)
  "Iteratively bind SYMBOL to all enabled frames."
  #+clim-1.0
    `(dolist (root *sheet-roots*)
       (dolist (child (slot-value root 'clim::children))
	 (let ((,symbol (clim::window-stream-to-frame child)))
	   (when (and ,symbol (not (member ,symbol *deactivated-frames*))) 
	     ,@body))))
  #+clim-2.0
    `(clim:map-over-ports
      #'(lambda (port)
	  (dolist (,symbol (clim:frame-manager-frames
			    (clim:find-frame-manager :port port)))
	    (when (eq (clim:frame-state ,symbol) :enabled)
	      ,@body)))))


(defun find-program-window (name &key
				 (create-p nil))
      (for-each-frame (f)
		      (when (typep f name)
			(return-from find-program-window f)))
      (when create-p
        (let ((frame (make-application-frame name)))
          (run-frame-top-level frame))))

0,,

References:

Main Index | Thread Index