All Manuals > CLIM 2.0 User Guide > 17 Formatted Output

17.4 Bordered Output in CLIM

CLIM provides a mechanism for surrounding arbitrary output with some kind of a border. The programmer annotates some output-generating code with an advisory macro that describes the type of border to be drawn. The following code produces the output shown in Examples of Bordered Output.

For example, the following produces three pieces of output, which are surrounded by a rectangle, highlighted with a dropshadow, and underlined, respectively.

(defun border-test (stream) 
  (fresh-line stream) 
  (surrounding-output-with-border
   (stream :shape :rectangle) 
   (format stream "This is some output with a rectangular border")) 
  (terpri stream) (terpri stream) 
  (surrounding-output-with-border
   (stream :shape :drop-shadow) 
   (format stream "This has a drop-shadow under it")) 
  (terpri stream) (terpri stream) 
  (surrounding-output-with-border
   (stream :shape :underline) 
   (format stream "And this output is underlined"))) 

Examples of Bordered Output

surrounding-output-with-border Macro

surrounding-output-with-border (&optional stream &key shape (move-cursor t)) &body body

Summary: Binds the local environment in such a way the output of body will be surrounded by a border of the specified shape. Supported shapes are :rectangle (the default), :oval, :drop-shadow, and :underline. :rectangle draws a rectangle around the bounding rectangle of the output. :oval draws an oval around the bounding rectangle of the output. :drop-shadow draws a "drop shadow" around the lower right edge of the bounding rectangle of the output. :underline draws a thin line along the baseline of all of the text in the output, but does not draw anything underneath non-textual output.

If the boolean move-cursor is t (the default), then the text cursor will be moved so that it immediately follows the lower right corner of the bordered output.

stream is an output recording stream to which output will be done. The stream argument is not evaluated, and must be a symbol that is bound to a stream. If stream is t (the default), *standard-output* is used. body may have zero or more declarations as its first forms.

define-border-type Macro

define-border-type shape arglist &body body

Summary: Defines a new kind of border named shape. arglist must be a subset of the "canonical" arglist (using string-equal to do the comparison) (&key stream record left top right bottom). body is the code that actually draws the border. It has lexical access to stream, record, left, top, right, and bottom, which are respectively, the stream being drawn on, the output record being surrounded, and the coordinates of the left, top, right, and bottom edges of the bounding rectangle of the record. body may have zero or more declarations as its first forms.


CLIM 2.0 User Guide - 01 Dec 2021 19:39:01