CLIM mail archive


Bordering or Outlining in CLIM 2.0

    Date: Mon, 19 Jul 1993 23:25 EDT
    From: Benjamin Renaud <>

You didn't tell us what platform you are using.  I presume Genera?

    I am trying to get a border or an outline on my panes (because of the
    ambiguity of the meaning of these two words, I will define this as a
    larger rectangle surrounding the panes). I have an application frame
    defined with the :panes option. Not all of the panes are present at
    once for a given layout. I have three possible layouts.

    The catch is that I want the borders to be transparent (or white) and
    2 pixel thick. Right now my very unsatisfactory solution has been to
    surround the pane names in the layout definitions in the following

    (bordering (:thickness 2 :color +transparent-ink+) <name-of-the-pane>)


    (outlining (:thickness  2 :color +transparent-ink+) <name-of-the-pane>)

    Not only this is rather cumbersome (3 times 5 panes is 15 of these
    additions in the layouts defs) but more importantly it does not do
    what I want it to be doing, instead it surrounds my panes with thick
    black lines on the left and right sides and thicker even black lines
    on the top and bottom.

Here is a new version of the macro for making CLIM stream pane that
extends the syntax of :BORDERS to allow it to be a list of options used
for the OUTLINING macro.  Does this do what you want?

(in-package :clim-internals)
(defmacro make-clim-stream-pane (&rest options
				 &key (type ''clim-stream-pane) 
				      label (label-alignment #+Genera :bottom #-Genera :top)
				      (scroll-bars ':vertical) (borders t)
				      (display-after-commands nil dac-p)
  (setq options (remove-keywords options '(:type :scroll-bars :borders :label
					   :label-alignment :display-after-commands)))
  (macrolet ((setf-unless (slot-keyword value)
	       `(when (eq (getf options ',slot-keyword #1='#:default) #1#)
		  (setf (getf options ',slot-keyword) ,value))))
    (setf-unless :width 100)
    (setf-unless :min-width 0)
    (setf-unless :max-width +fill+)
    (setf-unless :height 100)
    (setf-unless :min-height 0)
    (setf-unless :max-height +fill+))
  (let* ((stream '#:clim-stream)
	   (and dac-p
		`(:display-time ,(cond ((eq display-after-commands t) :command-loop)
				       ((eq display-after-commands :no-clear) :no-clear)
				       (t nil)))))
	   `(setq ,stream (make-pane ,type 
    (when scroll-bars
      (setq pane `(scrolling (:scroll-bars ,scroll-bars)
    (when label
      (let ((label (if (stringp label)
		       `(make-pane 'label-pane 
			  :label ,label
			  :max-width +fill+)
		       `(make-pane 'label-pane 
			  :label ,(first label)
			  :max-width +fill+ ,@(rest label)))))
	(ecase label-alignment
	    (setq pane `(vertically () ,pane ,label)))
	    (setq pane `(vertically () ,label ,pane))))))
    (when borders 
      (if (listp borders)			;borders is a list of options
	  (setq pane `(outlining ,borders
			#+Allegro ,pane
			#-Allegro (spacing (:thickness 1) ,pane)))
	  (setq pane `(outlining (:thickness 1)
			#+Allegro ,pane
			#-Allegro (spacing (:thickness 1) ,pane)))))
    `(let (,stream)
       (values ,pane ,stream))))

Main Index | Thread Index