The Window Tool Kit

8 Reference Pages

This chapter provides a complete syntactic description of all of the functions, macros, variables, and constants defined for the Window Tool Kit. The constructs are presented alphabetically; they are all extensions to Common Lisp.

activate-viewport Function

deactivate-viewport Function

Syntax:activate-viewport viewport&key :activate-children

Syntax:deactivate-viewport viewport

The functionactivate-viewport makes the specified viewport and all of its ancestors active. If the:activate-children keyword argument has a non-nil value, all of the viewport's descendants are also made active.

The functiondeactivate-viewport makes the specified viewport and all of its descendants inactive. The viewport viewport maintains its position in the display stack of its siblings. However, the viewport and its descendants do not appear on the screen until they are reactivated.

If a viewport is active, all of its ancestors are active. If a viewport is inactive, all of its descendants are inactive.

Ifdeactivate-viewport tries to deactivate a viewport that is already inactive, nothing happens.

Ifactivate-viewport tries to activate a viewport that is already active, nothing happens.

active-region-bitmap Function

Syntax:active-region-bitmap active-region

The functionactive-region-bitmap returns the bitmap to which the argument active-region is attached. If active-region is not attached to a bitmap, it returnsnil.

active-region-method Function

Syntax:active-region-method active-region event-name

The functionactive-region-method accesses the method that is called when a mouse event occurs inside an active region or when the mouse enters or leaves an active region. The function returnsnil if no method is associated with the event.

The event-name argument must be one of the following mouse events::mouse-click,:mouse-transition,:mouse-moved,:mouse-enter-region, or:mouse-exit-region.

Thesetf method for this function updates the appropriate method. If you set the value tonil, no method is called when the corresponding mouse event occurs.

The method is called with the following sequence of arguments:

The x- and y-coordinates are given relative to the origin of the active region's bitmap. For all mouse events except:mouse-exit-region, the x-coordinate and y-coordinate arguments specify a position inside the active region. For:mouse-exit-region, the specified position lies outside the active region; it can also lie outside the bitmap.

If the mouse's projected position on the viewport's bitmap falls inside one or more active regions, the following methods are invoked in the order given:

Note: An active region method is called inside the system's interrupt handler; no other user interrupts are permitted while the function is running. If your method has an infinite loop, there is no way to interrupt it.

active-region-mouse-documentation Function

Syntax:active-region-mouse-documentation region

The functionactive-region-mouse-documentation returns a function that takes an active region as a single argument and returns the mouse documentation for a specified active region.

You can use the Common Lisp macrosetf with this function to alter the mouse documentation associated with an active region.

The documentation is printed in the who window.

active-region-p Function

Syntax:active-region-p object

The predicateactive-region-p tests whether its object argument is an active region. It is true if object is an active region.

active-region-user-data Function

Syntax:active-region-user-data active-region

The functionactive-region-user-data returns the information that is specified in the:user-data keyword argument tomake-active-region.

The active-region argument specifies the active region that contains the user data.

You can use the Common Lisp macrosetf with this function to alter the contents of the:user-data argument.

See Also: make-active-region

allocate-color Function

deallocate-color Function

Syntax:allocate-color

Syntax:deallocate-color color-sequence

The functionallocate-color allocates and returns a single entry in the system color map if a free entry exists. The returned entry will be in the range from 0 to(1- (color-map-size)) inclusive. If there are no more free entries in the color map,allocate-color returnsnil.

The functiondeallocate-color deallocates the specified color or color number previously allocated by the functionallocate-color.

The color-sequence argument todeallocate-color can contain a single color or color number, or a sequence of either. If the color number is successfully deallocated, the color number is returned. If the color number has not been previously allocated and thus cannot be deallocated,nil is returned.

It is not an error to deallocate a color number that has not been allocated.

> (allocate-color)
22

> (deallocate-color 22) 22

attach-active-region Function

detach-active-region Function

bitmap-active-regions Function

clear-bitmap-active-regions Function

Syntax:attach-active-region bitmap active-region

Syntax:detach-active-region active-region

Syntax:bitmap-active-regions bitmap

Syntax:clear-bitmap-active-regions bitmap

These functions attach and detach active regions from bitmaps.

When you attempt to attach an active region to a bitmap, the active region must be located in the bitmap.

Ifdetach-active-region is called with an active region that is not attached to a bitmap, nothing happens.

bitblt Function

bitblt-position Function

bitblt-region Function

Syntax:bitblt source-bitmap source-x source-y destination-bitmap destination-x destination-y width height operation&key :clipping-region :foreground :background :pixel-map

Syntax:bitblt-position source-bitmap source-position destination-bitmap destination-position width height operation&key :clipping-region :foreground :background :pixel-map

Syntax:bitblt-region source-bitmap source-region destination-bitmap destination-region operation&key :foreground :background :pixel-map

These functions copy regions in bitmaps.

The source-bitmap and destination-bitmap arguments specify the bitmap from which the copying is performed and the bitmap to which the copying is done respectively. You can specify the same bitmap for both arguments. If both bitmaps are not of equal depth or if source-bitmap is not of depth 1, you must supply the:pixel-map keyword argument.

The source-bitmap region that is copied is specified by the following arguments:

The destination-bitmap region that is to be modified is specified by the following arguments:

Each position in the source bitmap region is combined with the corresponding position in the destination bitmap region, and the result is stored in the destination bitmap. The new value of the destination bitmap is the value returned when the functionboole is applied to these three arguments: the operation argument, the value of the bit at the source bitmap position, and the value of the bit at the destination bitmap position.

The operation argument must either be a single boolean constant or a sequence of boolean constants of length equal to the depth of the bitmap destination-bitmap. If operation is a sequence, the associated operation for each plane of the destination-bitmap is used to copy from the source-bitmap, in ascending order. The default value of the operation argument is the boolean constantboole-1.

You can specify the following keyword arguments to these functions:

This keyword argument specifies a region of the destination bitmap. If this keyword argument is given, only the region of the destination region that is located inside the clipping region is modified. The functionbitblt-region does not use this keyword option.

These keyword arguments specify registered color entries and can be strings, symbols, or color numbers. They are used instead of the:pixel-map keyword argument when source-bitmap has a single plane and destination-bitmap has multiple planes.

This keyword argument is a user-created vector that maps pixel values in the bitmap source-bitmap onto the possible range of pixel values in the bitmap destination-bitmap. This argument is required when you map from a multiplane source-bitmap onto a destination-bitmap of unequal depth, such as from color to monochrome. You can supply this argument for bitmaps of equal depth if you want a color mapping. The vector that you specify for this argument must have(expt 2 (bitmap-depth source-bitmap)) integer entries in the range from 0 to(expt 2 (bitmap-depth destination-bitmap)) inclusive. If possible, it should be an array of typesimple-vector to optimize mapping speed.

When you specify the operation argument with the:pixel-map keyword argument or with the:foreground and:background arguments, the functionbitblt first determines the correct value for each source pixel in source-bitmap by using the mapping described by the:pixel-map keyword argument. It then combines the source pixel and destination pixel using the specified operation to determine the new destination pixel.

Mapping from a multiplane bitmap using the:pixel-map keyword argument requires per-pixel access, so mapping from a multiplane source-bitmap to any destination-bitmap is generally slow.

If the source-region and destination-region arguments ofbitblt-region are different widths, the width of the region that is actually copied is the smaller of the two. Similarly, if the source-region and destination-region arguments have different heights, the height of the region that is copied is the smaller of the two.

bitmap-depth Function

Syntax:bitmap-depth bitmap

The functionbitmap-depth returns the depth, or number of planes, of the specified bitmap.

You cannot change the depth of a bitmap.

> (setq *bitmap1* (make-bitmap :width 10 :height 10))
#<Bitmap 10x10x1 E664EB>

> (bitmap-depth *bitmap1*) 1

> (setq *bitmap2* (make-bitmap :width 10 :height 10 :depth (display-depth))) #<Bitmap 10x10x8 E67D0B>

> (bitmap-depth *bitmap2*) 8

bitmap-height Function

bitmap-width Function

Syntax:bitmap-height bitmap

Syntax:bitmap-width bitmap

The functionbitmap-height returns the height of a bitmap.

The functionbitmap-width returns the width of a bitmap.

You can use the Common Lisp macrosetf with these functions. Increasing the width or height of a bitmap causes new area to appear at its boundaries. Decreasing the width or height can cause loss of data.

These are Liquid Common Lisp extensions.

> (setq my-bitmap (make-bitmap :width 100 :height 200))
#<Bitmap 100x200x1 25F391>

> (bitmap-height my-bitmap) 200

> (bitmap-width my-bitmap) 100

bitmap-foreground-pixel Function

bitmap-background-pixel Function

Syntax:bitmap-foreground-pixel bitmap

Syntax:bitmap-background-pixel bitmap

The functionbitmap-foreground-pixel returns the current foreground pixel value for the given bitmap. Any graphic or text output operations on the bitmap use thebitmap-foreground-pixel value if no other color is specified.

The functionbitmap-background-pixel returns the current background pixel value for the given bitmap. Any graphic or text output operations on the bitmap use thebitmap-background-pixel value if no other color is specified.

You can use the Common Lisp macrosetf with these functions to specify a new default foreground or background pixel for a bitmap.

> (bitmap-foreground-pixel *bitmap*)
0

> (bitmap-background-pixel *bitmap*) 7

> (setf (bitmap-foreground-pixel *bitmap*) 1) 1

> (bitmap-foreground-pixel *bitmap*) 1

bitmap-output-stream-P Function

Syntax:bitmap-output-stream-p object

The predicatebitmap-output-stream-p tests whether its object argument is a bitmap output stream. It is true if object is a bitmap output stream.

> (bitmap-output-stream-p (make-bitmap-output-stream))
T

> (bitmap-output-stream-p 7) NIL

bitmap-p Function

Syntax:bitmap-p object

The predicatebitmap-p tests whether its object argument is a bitmap. It is true if object is a bitmap.

> (bitmap-p (make-bitmap :height 100 :width 200))
T

> (bitmap-p 7) NIL

bitmap-user-data Function

Syntax:bitmap-user-data bitmap

The functionbitmap-user-data returns the information that is specified in the:user-data keyword argument tomake-bitmap andinitialize-bitmap.

The bitmap argument specifies the bitmap that contains the data.

You can use the Common Lisp macrosetf with this function to alter the contents of the:user-data argument.

See Also: initialize-bitmap, make-bitmap

bitmap-value Function

Syntax:bitmap-value bitmap x y

The functionbitmap-value returns the value of a bitmap's point at a given x-y coordinate.

The functionbitmap-value returns the pixel value at the location in the bitmap specified by the x and y arguments. The returned pixel value is an integer in the range from 0 to(1- (expt 2 (bitmap-depth bitmap))) inclusive.

You can use the Common Lisp macrosetf with this function to set the value of a point in a bitmap.

;; Create a 100x200 bitmap.
> (setq bmp (make-bitmap :width 100 :height 200))
#<Bitmap 100x200x1 AEC25B>

;; Look at the value of a point. > (bitmap-value bmp 23 56) 0

;; Set the point to one. > (setf (bitmap-value bmp 23 56) 1) 1

;; Look at the value of that point. > (bitmap-value bmp 23 56) 1

charblt Function

stringblt Function

Syntax:charblt bitmap position font char&key :operation :foreground :background

Syntax:stringblt bitmap position font string&key :operation :foreground :background :start :end

The functioncharblt paints a character image from a font onto a bitmap.

The functionstringblt paints a string of character images from a font onto a bitmap.

The font argument must be a font, a string, or a symbol. If the argument is a string or a symbol, the functionfind-font is called to find the font named by the string or symbol.

The position argument specifies the position at which the character or characters are output. The first character is aligned so that the leftmost point of its baseline is at the point given by the position argument.

You can specify the following keyword arguments for both of these functions:

This keyword argument controls how the font is painted onto the bitmap. The new value of the destination bitmap is the value returned by applying the Common Lisp functionboole to these three arguments: the:operation argument, the value of the font's bit, and the value of the destination bitmap position.

The:operation keyword argument must either be a single boolean constant or a sequence of boolean constants of length equal to the depth of the destination bitmap; the default value is the boolean constantboole-1. This default value causes the bits of the font's bitmap to overwrite whatever was previously on the bitmap. If the value of the:operation argument is a sequence, the associated operation for each plane of the destination bitmap is used to combine the source pixel with the destination pixel.

These keyword arguments specify registered color entries and can be strings, symbols, or color numbers. The default values for these arguments are the foreground and background pixel defaults for the bitmap.

For the functionstringblt, the:start and:end keyword arguments take integer values that specify offsets into the string. These arguments restrict the output operation to a substring of the original string:

These functions use the specified text foreground and text background colors when they draw a character or a string on the specified bitmap. The resulting pixel value is combined with the destination pixel according to the boolean constant or constants specified in the:operation keyword argument.

The functionstringblt cannot handle tabs and other characters that have an ambiguous print representation. It can handle newline and space characters.

See Also: bitblt

char-height Function

char-width Function

max-char-width Function

Syntax:char-height char font

Syntax:char-width char font

Syntax:max-char-width font

The functionschar-height andchar-width return the height and width respectively of the specified character in the given font.

The functionmax-char-width returns the maximum character width that is allowed by the specified font.

clear-bitmap Function

Syntax:clear-bitmap bitmap&optional region background

The functionclear-bitmap clears a bitmap. That is, the value of every point in the bitmap is set to 0.

If a region argument is specified, only that region of the bitmap is cleared. Otherwise, the entire bitmap is cleared.

The background argument is a string, symbol, or color number; the default value is the background pixel of the specified bitmap. If you specify this argument, the function sets all the pixel values in the specified bitmap to the specified color.

;; Create a 10x10 bitmap.
> (setq btmp (make-bitmap :width 10 :height 10))
#<Bitmap 10x10x1 596D5D>

;; Put ones on the diagonal of the bitmap. > (dotimes (i 10) (setf (bitmap-value btmp i i) 1)) NIL

;; A point on the diagonal has a value of one. > (bitmap-value btmp 3 3) 1

;; A point not on the diagonal has a value of zero. > (bitmap-value btmp 3 2) 0

;; Clear a region of the bitmap. > (clear-bitmap btmp (make-region :x 2 :y 2 :height 3 :width 3)) #<Bitmap 10x10x1 596D5D>

;; Look at a diagonal point that was cleared. > (bitmap-value btmp 3 3) 0

;; Look at a diagonal point that was not cleared. > (bitmap-value btmp 9 9) 1

color-available-p Function

Syntax:color-available-p &key :display

The functioncolor-available-p checks whether the current display supports graphics and color functionality. If the display supports both graphics and color, this function returns the display depth and the color-map size respectively. Otherwise, it returns one of two sets of values:

These values indicate that the Window Tool Kit client is unable to connect to the specified X server; thus,color-available-p cannot determine whether the server supports color.

These values indicate that a connection has been made, but the specified X server does not support color.

The:display keyword argument specifies the display used for Window Tool Kit interactions. It must be a string of one of the following forms:

"host"

"host:display-number"

The default value is supplied by the environment variableDISPLAY.

> (color-available-p)
8
256

color-map-size Function

Syntax:color-map-size

The functioncolor-map-size returns the total number of entries in the color map associated with the current system display.

Since some entries might be allocated already, the value returned bycolor-map-size does not necessarily reflect the number of available entries in the system color map.

> (display-depth)
8

> (color-map-size) 255

color-registry-size Function

Syntax:color-registry-size

The functioncolor-registry-size returns the total number of entries that have already been allocated in the color registry.

Since color entries in the color registry can use the same system color map entry, the value returned bycolor-registry-size does not necessarily reflect the number of used or unavailable entries in the system color map.

> (color-registry-size)
22

copy-bitmap Function

Syntax:copy-bitmap bitmap

The functioncopy-bitmap copies a bitmap.

The original bitmap and the copy can be modified without affecting each other.

;; Create a 100x200 bitmap.
> (make-bitmap :height 100 :width 200)
#<Bitmap 200x100x1 5D95EE>

;; Make a copy of the bitmap. > (copy-bitmap *) #<Bitmap 200x100x1 5D9937>

See Also: store-bitmap

copy-font Function

Syntax:copy-font font new-name

The functioncopy-font copies a font and stores the new font in the font registry under the name new-name.

The font argument should be a font, a string, or a symbol. If the argument is a string or a symbol, the functionfind-font is called to find the font named by the string or symbol.

The original font and the copy can be modified without affecting each other.

> *default-font*
#<Fixed-Width-Font ROMAN 4FB3CE>

;; Create a copy of the default font. Call it "NEWROMAN". > (copy-font *default-font* 'newroman) #<Fixed-Width-Font NEWROMAN 5DA2C3>

See Also: find-font, store-font

current-mouse-cursor Function

Syntax:current-mouse-cursor

The functioncurrent-mouse-cursor returns the mouse cursor object that is currently tracking the mouse on the display screen.

You can use the Common Lisp macrosetf with this function to modify the mouse cursor object that is tracking the mouse.

See Also: make-mouse-cursor

*current-screen* Variable

Syntax:*current-screen*

For SunOS/Solaris only, the variable*current-screen* contains a Liquid Common Lisp screen structure that holds all of the machine-specific hooks.

*default-font* Variable

Syntax:*default-font*

The value of the variable*default-font* is a font that is used by default by the functionsmake-bitmap-output-stream andmake-window.

The initial value of*default-font* is the font whose name is"ROMAN".

;; Create a bitmap output stream.
;; Do not give an :initial-font keyword argument.
> (make-bitmap-output-stream :width 100 :height 200)
#<Output-Stream to #<Bitmap 100x200x1 1A45D8> 1A49E0>

;; Check to see that the stream's font is *default-font*. > (eq (stream-current-font *) *default-font*) T

See Also: find-font

default-font-baseline Constant

default-font-code-limit Constant

default-font-height Constant

Syntax:default-font-baseline

Syntax:default-font-code-limit

Syntax:default-font-height

These constants provide default values for font characteristics.

*default-pop-up-menu-font* Variable

Syntax:*default-pop-up-menu-font*

The value of the variable*default-pop-up-menu-font* is a font that the Window Tool Kit uses by default to display pop-up menus.

You can use the Common Lisp special formsetq to change the value of this variable, whose initial value is the font returned by the expression(find-font "ITALIC").

delete-color Function

Syntax:delete-color name

The functiondelete-color deletes a previously registered color entry of the specified name from the color registry and returnsnil.

The name argument can be a symbol or a string.

If there are no other registered colors that refer to a system color map entry of the specified name, the color map entry is automatically deallocated.

It is not an error to delete a nonexistent color from the color registry.

> (register-color "PINK" :red max-mic-value
                         :green (round (* max-mic-value .4))
                         :blue (round (* max-mic-value .65)))
"PINK"

> (delete-color "PINK") "PINK" unregistered. NIL

delete-font Function

Syntax:delete-font font

The functiondelete-font deletes a font from the font registry.

The font argument must be a font, a string, or a symbol. If it is a string or a symbol, the functionfind-font is called to convert the argument to a font.

The deleted font continues to exist. However, the functionfind-font no longer recognizes its name.

delete-root-viewport Function

Syntax:delete-root-viewport root-viewport

The functiondelete-root-viewport deletes the specified viewport. It returnsnil.

You cannot use this function to delete the primary root viewport; the primary root viewport can only be deleted when you exit the Window Tool Kit with the functionleave-window-system.

See Also: leave-window-system

delete-viewport Function

display-depth Function

Syntax:display-depth

The functiondisplay-depth returns the number of planes in the current system screen display.

On systems that do not support color, this function always returns a depth of 1.

> (display-depth)
8

draw-circle Function

Syntax:draw-circle bitmap center radius&key :width :operation :foreground :start-theta :angle

This function draws a circle on a bitmap whose center is the position center and whose radius is radius.

The keyword argument:width defines the line width that is used for drawing the line segments and circles. The border is drawn so that its outer edge is at the specified radius; the width must be less than or equal to the radius. If the:width keyword argument is omitted ornil, the default value is 1.

The keyword arguments:operation and:foreground are as fordraw-line.

The keyword arguments:start-theta and:angle correspond to the arguments angle1 and angle2 of the internal CLX functiondraw-arc, whichdraw-circle calls to draw the circle. The angles are signed integers in radians, with positive indicating counterclockwise motion and negative indicating clockwise motion. The start of the arc is specified by:start-theta, and the path and extent of the arc is specified by:angle, relative to the start of the arc. If the magnitude of:angle is greater than 360 degrees, it is truncated to 360 degrees. The default value of:start-theta is 0.0; the default value of:angle is(* 2 pi)).

draw-line Function

draw-polyline Function

draw-polypoint Function

Syntax:draw-line bitmap start end&key :width :operation :foreground

Syntax:draw-polyline bitmap positions&key :width :operation :foreground

Syntax:draw-polypoint bitmap positions&key :width :operation :foreground

These functions draw geometric objects on bitmaps.

You can specify the following keyword arguments to these functions:

This keyword argument defines the line width that is used for drawing the line segments and circles. Fordraw-polypoint, the:width argument specifies the diameter of the dot. If the:width keyword argument is omitted ornil, the default value is 1.

This keyword argument controls how the values that are being written onto the bitmap combine with the values that are already present; it can be a single boolean constant or a list of boolean constants of length equal to the depth of the bitmap. If this keyword argument is omitted, the default value is the value of the constantboole-1; this default value causes the values that are being written onto the bitmap to overwrite whatever was already on the bitmap.

This keyword argument is a string, symbol, or a valid pixel color number for the specified bitmap. If this keyword argument is omitted ornil, the default value is the default foreground of the specified bitmap.

You can specify either the:foreground or the:operation argument, but not both.

draw-rectangle Function

Syntax:draw-rectangle bitmap x y&key :width :height :corner-x :corner-y :operation :foreground

The functiondraw-rectangle draws a rectangle on the specified bitmap.

The x and y arguments specify the x- and y-coordinates respectively of the rectangle's origin.

You can specify the following keyword arguments todraw-rectangle:

These keyword arguments specify the rectangle's width and height respectively. The value of each must be a nonnegative fixnum. If either is omitted ornil, its default value is 0.

These keyword arguments specify the rectangle's right and bottom edges respectively.

You can specify the keyword arguments:width and:height or the keyword arguments:corner-x and:corner-y, but not both pairs.

This keyword argument must be a single boolean constant or a sequence of boolean constants of length equal to the depth of the specified bitmap. If the argument is a sequence of constants, the corresponding operation for each plane of the bitmap in ascending order is used to draw a rectangle on the bitmap. The default value of this argument is the boolean constantboole-1.

This keyword argument can be a pixel value or a registered color name string or symbol. If the argument is a pixel, it must be a valid pixel value for the bitmap in the range from 0 to(1- (expt 2 (bitmap-depth bitmap))) inclusive.

You can specify either the:foreground or the:operation argument, but not both. If you do not specify either keyword argument, the default foreground pixel of bitmap is used.

On systems that do not support color, the functiondraw-rectangle does not accept a foreground color; it does accept a boolean constant for the:operation keyword argument.

> (setq *window*
      (make-window :width 100 :height 100 :depth (display-depth)))
#<Window 100x100x8 at (0,0) E95ED3>

> (draw-rectangle *window* 10 10 :width 20 :height 20 :foreground "RED") NIL

> (draw-rectangle *window* 10 30 :corner-x 30 :corner-y 50 :foreground "GREEN") NIL

See Also: draw-circle, draw-line, draw-polyline, draw-polyline

expose-viewport Function

hide-viewport Function

Syntax:expose-viewport viewport

Syntax:hide-viewport viewport

The functionexpose-viewport moves a viewport to the top of its sibling stack. Nothing happens if the viewport is already at the top of the stack.

The functionhide-viewport moves a viewport to the bottom of its sibling stack. Nothing happens if the viewport is already at the bottom of the stack.

In complex hierarchies,expose-viewport cannot place the viewport on the screen unoccluded because it can be occluded by its children, or because its parent can be occluded.

If two active viewports overlap on the screen, the following rules determine which viewport occludes the other:

See Also: viewport-children

find-color Function

find-color-number Function

Syntax:find-color&key :color :mdc :red :green :blue

Syntax:find-color-number&key :color :mdc :red :green :blue

The functionfind-color returns the color string that is associated with a color.

The functionfind-color-number returns the color number that is associated with a color. If the specified color is not registered,nil is returned.

You can specify any of the following keyword argument sets:

This keyword argument can be a string, a symbol, or a color number.

This keyword argument must be a previously registered machine-dependent color obtained with the functionfind-mdc.

These keyword arguments must be in the range frommin-mic-value tomax-mic-value inclusive.

> (find-color :color "RED")
"RED"

> (find-color :color 1) "RED"

> (find-color-number :color "RED") 1

> (find-color-number :red max-mic-value :blue min-mic-value :green min-mic-value) 1

> (find-color-number :mdc (find-mdc :color "RED")) 1

See Also: find-mdc, min-mic-value, max-mic-value

find-font Function

Syntax:find-font name

The functionfind-font finds and returns the font of the specified name. It returnsnil if it cannot find a font with that name.

The argument must be a string or a symbol. If it is a symbol, its print name is used.

The font registry initially contains three fonts that are named"ROMAN","BOLD-ROMAN", and"ITALIC".

See Also: copy-font, delete-font, load-font, rename-font, store-font

find-mdc Function

find-mic Function

Syntax:find-mdc&key:color :red :green :blue

Syntax:find-mic&key:color :mdc

The functionfind-mdc returns the machine-dependent color that is associated with a color. If the specified color is not registered and the keyword arguments:red,:green, and:blue are given, a new machine-dependent color is generated; otherwise,nil is returned.

The functionfind-mic returns the red, green, and blue values that are associated with a color. If the specified color is not registered,nil is returned.

The:color keyword argument is a string, symbol, or color number.

Forfind-mdc, the:red,:green, and:blue keyword arguments must be in the appropriate range frommin-mic-value tomax-mic-value inclusive.

Forfind-mic, the:mdc keyword argument is a previously registered machine-dependent color obtained with the functionfind-mdc.

> (find-mdc :color "RED")
#(255 0 0) 

> (find-mdc :red max-mic-value :blue min-mic-value :green min-mic-value) #(255 0 0)

> (find-mic :color "RED") 65535 0 0

> (find-mic :mdc (find-mdc :color "RED")) 65535 0 0

See Also: min-mic-value, max-mic-value

find-root-viewport-from-viewport Function

Syntax:find-root-viewport-from-viewport viewport

The functionfind-root-viewport-from-viewport returns the root viewport that is the ancestor of the specified viewport or window.

The viewport argument specifies a viewport or a window.

follow-mouse Function

Syntax:follow-mouse min-x min-y max-x max-y function

The functionfollow-mouse tracks the movement of the mouse in the specified area during the execution of the specified function.

The min-x and min-y arguments specify the mininum x- and y- locations of the screen where the mouse is tracked. The max-x and max-y arguments specify the corresponding maximum x- and y- locations.

The function argument specifies the function that is executing while tracking occurs.

font-baseline Function

font-height Function

font-fixed-width Function

Syntax:font-baseline font

Syntax:font-height font

Syntax:font-fixed-width font

These functions return attributes of characters in a font.

The font argument must be a font, a string, or a symbol. If the argument is a string or a symbol, the functionfind-font is called to find the font named by the string or symbol.

See Also: default-font-baseline, default-font-height, find-font

font-bitmap Function

font-code-limit Function

font-name Function

Syntax:font-bitmap font

Syntax:font-code-limit font

Syntax:font-name font

These functions return attributes of a font.

The font argument must be a font, a string, or a symbol. If the argument is a string or a symbol, the functionfind-font is called to find the font named by the string or symbol.

See Also: default-font-code-limit, find-font, rename-font

fontp Function

Syntax:fontp object

The predicatefontp tests whether its object argument is a font. It is true if object is a font.

> (fontp *default-font*)
T

> (fontp 7) NIL

get-screen-point-from-user Function

Syntax:get-screen-point-from-user &key :function :mouse-documentation

The functionget-screen-point-from-user prompts for a screen position. It returns the x- and y-location that is specified by a right click, if any. You can abort the operation by pressing the middle mouse button; in this case, the function returnsnil.

You indicate the position by moving the mouse to the proper screen location and pressing the right mouse button.

The:function keyword argument is a function that gets called with four arguments every time that the user moves the mouse:

The:mouse-documentation keyword argument is a string or a function that takes an active region as a single argument and returns a string. The string is printed in the who window and describes what actions the mouse can perform when in the given active region. If you do not specify a value for this argument, a default documentation string is used.

get-screen-region-from-user Function

Syntax:get-screen-region-from-user &key :minimum-width :minimum-height &allow-other-keys

The functionget-screen-region-from-user prompts for a screen region. It returns the region that was selected, if any. You can abort the operation by pressing the middle mouse button; in this case, the function returnsnil.

You indicate the region by defining it with the mouse.

The:minimum-width and:minimum-height keyword arguments specify the minimum width and height of the region respectively.

You can also specify any keyword options that are valid for the functionmake-region.

See Also: make-region

initialize-bitmap Function

Syntax:initialize-bitmap bitmap&key :width :height :user-data :depth :foreground :background

The functioninitialize-bitmap takes a bitmap structure and initializes or reinitializes it to have the shape and size described by the specified arguments. This function is useful whenever you create a new bitmap type that includes the Window Tool Kit bitmap structure and you wish to initialize the portion of it defined by the Window Tool Kit.

The bitmap argument specifies the bitmap to be initialized.

You can specify the following keyword arguments toinitialize-bitmap:

These keyword arguments specify the width and height of the bitmap respectively. Unspecified dimensions default to 0.

This keyword argument contains any information that you would like to associate with the bitmap. There are no restrictions on the type of information specified in this argument.

This keyword argument must be a legitimate depth for the specific system display. Depths can vary among host systems; the default depth is 1.

These keyword arguments specify the default colors for the bitmap; they must be registered colors and can be strings, symbols, or color numbers. The default value of the:foreground keyword argument is the color number of the registered color"BLACK"; the default value of the:background keyword argument is the color number of the registered color"WHITE".

> (defstruct (my-bitmap (:include bitmap)
                        (:constructor new-my-bitmap))
              my-new-slot                ; This is a new slot.
	)
MY-BITMAP

> (defun make-my-bitmap (&key width height my-new-slot-value) (let ((new-my-bitmap (new-my-bitmap :my-new-slot my-new-slot-value))) (initialize-bitmap new-my-bitmap :width width :height height))) MAKE-MY-BITMAP

See Also: make-bitmap

initialize-viewport Function

Syntax:initialize-viewport viewport &key :x :y :width :height :parent :activate :bitmap :bitmap-x :bitmap-y :depth :user-data :pixel-map :viewport-foreground :viewport-background

The functioninitialize-viewport takes a viewport structure and initializes or reinitializes it to have the shape and size described by the specified arguments. This function is useful whenever you create a new viewport type that includes the Window Tool Kit viewport structure and you wish to initialize the portion of it defined by the Window Tool Kit.

The viewport argument specifies the viewport to be initialized.

You can specify the following keyword arguments toinitialize-viewport:

These keyword arguments specify the coordinates of the viewport's top-left corner relative to the root viewport. The value of each must be a nonnegative fixnum. If either is omitted, its default value is 0.

These keyword arguments specify the width and height of the bitmap to which the viewport is attached. The value of each must be a nonnegative fixnum. If either is omitted ornil, its default value is 0.

You only need to use:width and:height if:bitmap is omitted ornil.

This keyword argument specifies the parent viewport of the new viewport. Its value must be an existing viewport. If the value is a viewport or a window, the viewport or window is used as the parent of the new viewport. Otherwise, the current root viewport is used as the parent of the new viewport.

This keyword argument specifies whether the viewport is active or inactive. If it is omitted or non-nil, the viewport is active. If it is specified andnil, the viewport is inactive.

This keyword argument must be a bitmap; the bitmap output stream is attached to that bitmap. The specified bitmap must have a depth of 1 or(display-depth). If this keyword argument is omitted ornil, a new bitmap is created of depth(display-depth).

These keyword arguments specify the x- and y-coordinates of the specified bitmap. The value of each must be a nonnegative fixnum. If either is omitted ornil, its default value is 0.

This keyword argument must be a legitimate depth for the specific system display. Depths can vary among host systems; the default depth is 1.

This keyword argument contains any information that you would like to associate with the bitmap. There are no restrictions on the type of information specified in this argument.

This keyword argument is a vector that maps pixel values in the specified bitmap onto the possible range of pixel values on the display; it must be of length 2. The first entry of the vector:pixel-map is the value of the foreground pixel, and the second entry is the value of the background pixel. You can use this keyword argument instead of the keyword arguments:viewport-foreground and:viewport-background.

You should supply these keyword arguments if the specified bitmap is of depth 1; the arguments describe how the monochrome bitmap should be mapped onto the multiplane display. Bits with the value 1 show as the viewport foreground color, and bits with the value 0 show as the viewport background color. These arguments must be registered color entries and can be strings, symbols, or color numbers. The default value of the:viewport-foreground keyword argument is the color number of the registered color"BLACK"; the default value of the:viewport-background keyword argument is the color number of the registered color"WHITE".

See Also: make-viewport

initialize-window Function

Syntax:initialize-window window &key :x :y :width :height :inside-x :inside-y :inside-width :inside-height :inner-border-width :outer-border-width :user-data :bitmap :bitmap-x :bitmap-y :depth :parent :scroll :vertical-scroll :horizontal-scroll :calculate-vertical-scroll-ratio :calculate-horizontal-scroll-ratio :initial-font :operation :title :title-font :foreground :background

The functioninitialize-window takes a window structure and initializes or reinitializes it to have the shape and size described by the specified arguments. This function is useful whenever you create a new window type that includes the Window Tool Kit window structure and you wish to initialize the portion of it defined by the Window Tool Kit.

The window argument specifies the window to be initialized.

You can specify the following keyword arguments toinitialize-window:

These keyword arguments specify the position of the origin of the window's entire display (including borders) relative to the root viewport. The value of each must be a fixnum. If either argument is omitted ornil, its default value is 0.

These keyword arguments specify the size of the entire window including all borders. The value of each must be a nonnegative fixnum. If either argument is omitted ornil, its default value is the width or height of the root viewport.

These keyword arguments specify the position of the origin of the window's viewport relative to the root viewport. The value of each must be a fixnum. If either argument is omitted ornil and the default values for:inner-border-width and:outer-border-width are used, its default value is 3.

These keyword arguments specify the size of the window's viewport. The value of each must be a nonnegative fixnum. If either argument is omitted ornil, its default value is the inside width or height of the root viewport minus the combined widths of either the vertical or the horizontal borders of the specified window.

This keyword argument contains any information that you would like to associate with the bitmap. There are no restrictions on the type of information specified in this argument.

These keyword arguments specify the width of the window's inner and outer borders. If:inner-border-width is omitted ornil, its default value is 1. If:outer-border-width is omitted ornil, its default value is 2.

This keyword argument must be a bitmap; the bitmap output stream is attached to that bitmap. The specified bitmap must have a depth of 1 or(display-depth). If this keyword argument is omitted ornil, a new bitmap is created of depth(display-depth).

These keyword arguments specify the position in the window's bitmap that corresponds to the origin of the window's inside region. If either argument is omitted ornil, its default value is 0.

This keyword argument must be a legitimate depth for the specific system display. Depths can vary among host systems; the default depth is 1.

This keyword argument specifies the parent of the window. It can take one of three values, with three different consequences:

  • If the argument is a window or a viewport, the new window is a child of the specified parent.

  • If the argument ist, the new window is a child of the current root viewport; this value is the default.

  • If the argument isnil, the new window is a new root viewport.

This keyword argument specifies whether the window can have scroll bars. If the value of this argument ist, the window can have scroll bars when the dimensions of the window's bitmap are greater than those of its viewport. Thus, when the bitmap is wider than the viewport, a scroll bar appears on the window's right border; when the bitmap is longer than the viewport, a scroll bar appears on the window's bottom border. If this argument is omitted ornil, the window is made without scroll bars. Do not give this keyword any value other thant ornil.

These keyword arguments specify the methods for vertical and horizontal scrolling. The value of each keyword must be a function that takes two arguments: the window and the current vertical scroll ratio or horizontal scroll ratio. If either argument is omitted ornil, its default value is the default method for vertical or horizontal scrolling. The default methods move the window's bitmap clipping region over the window's bitmap to a degree that corresponds to the movement of the bubble on the scroll bar.

These keyword arguments specify the methods for calculating vertical and horizontal scroll ratio respectively. The value of each keyword must be a function that takes the window as its argument and returns either a Common Lisp ratio between 0 and 1 ornil. If either keyword argument is omitted ornil, its default value is the default method for calculating the vertical or horizontal scroll ratio. The default method defines the current scroll ratio as that of the degree to which the window has been scrolled to the maximum degree to which it can be scrolled; thus, if a window has been scrolled to one-third of the possible horizontal scrolling distance, the horizontal scroll ratio is 1/3.

Note: You cannot use the Common Lisp macrosetf with these keyword arguments to set the respective scroll ratios.

This keyword argument specifies the initial font used by the window's bitmap output stream. Its value must be a font, a string, or a symbol. If this argument is omitted ornil, its default value is the value of the variable*default-font*.

This keyword argument specifies the boolean operation that the bitmap output stream uses to write onto the bitmap. Its value must be an acceptable first argument to the Common Lisp functionboole. If this argument is omitted ornil, its default value is the value of the constantboole-xor.

This keyword argument specifies the title of the window. Its value must be a string. The title of the window appears near the top-left corner of the window on the border. If this argument is omitted ornil, the window has no title.

This keyword argument specifies the font in which the title is displayed. Its value must be a font, a string, or a symbol. If this argument is omitted ornil, its default value is the value of the:initial-font keyword argument.

These keyword arguments specify the default foreground pixel and background pixel for the bitmap associated with the new window. They must specify registered color entries and can be strings, symbols, or color numbers. Any text or graphic output to the window's bitmap uses the foreground and background pixel values. The default value of the:foreground keyword argument is the color number of the registered color"BLACK"; the default value of the:background keyword argument is the color number of the registered color"WHITE".

If you specify default values for:foreground,:background, and:operation, any drawing function that you invoke will use the window's foreground and background colors, not the values you specified, as defaults, unless you specify a color to the drawing function. In addition, the drawing function will assume a default operation ofboole-1.

See Also: make-window

initialize-windows Function

Syntax:initialize-windows &key :height :width :screen-x :screen-y :label :no-wholine :icon-x :icon-y :icon-image :icon-label :display

The functioninitialize-windows initializes the Window Tool Kit.

The Window Tool Kit is normally initialized when the Editor is first entered. If you are not using the Editor, you must call the functioninitialize-windows to initialize the window system.

You can specify the following keyword arguments toinitialize-windows:

This keyword argument pair specifies the size of the system window that will be the root viewport.

This keyword argument pair indicates the position of the upper left corner of the system window.

This keyword argument names the system window.

If this keyword argument has a non-nil value, the primary root viewport is created without a who window. If the value of this keyword argument isnil, the primary root viewport is created with a who window for displaying information about the state of the mouse; this value is the default.

The functionmake-new-who-window creates a new who window.

This keyword argument pair specifies the position for the icon when the window is closed.

This keyword argument names the file that stores the image that will be used as the Lisp screen icon when an initialized window is closed.

This keyword argument denotes the label displayed on the icon.

This keyword argument specifies the display used for Window Tool Kit interactions. It must be a string of one of the following forms:

"host"

"host:display-number"

The default value is supplied by the environment variableDISPLAY.

Note: Paired keyword arguments must be used together or not at all; when the system receives one of the paired arguments, it expects the other as well.

If you try to initialize the Window Tool Kit but it has already been initialized, the following message appears:

Window system already initialized
If the Window Tool Kit has been initialized and the functiondisksave is invoked, the window environment is temporarily suspended. Once thedisksave function has saved the Lisp image on disk, the windows on the running Lisp image are restored automatically to the state they were in before thedisksave function call. To restore the state of the window environment in the newly saved image, callinitialize-windows ored with no arguments. See Chapter 1, "Restoring windows in a saved image" for more information.

> (initialize-windows :display "applesauce:0")
See Also: leave-window-system, make-new-who-window

keyboard-input Function

Syntax:keyboard-input &optional root-viewport

The functionkeyboard-input returns the stream that receives keyboard input. Any character typed at the keyboard is sent to the mouse input stream that is the value of this function.

Each root viewport has its own keyboard input stream. When you position the mouse over a root viewport, input to that root viewport is queued to that stream.

The optional root-viewport argument specifies the root viewport of the desired stream. If you do not specify this argument, the keyboard input stream of the current root viewport is used.

You can use the Common Lisp macrosetf with this function to change the stream that receives keyboard input; the second argument tosetf must be a mouse input stream. By default,(setf (keyboard-input)) sets the keyboard input stream for the current root viewport. Use the root-viewport argument to change the keyboard input stream for a specific root viewport. However, if the stream that you specify as a second argument tosetf is also a window and you do not supply a root-viewport argument, the window's root viewport is used. You can set the value ofkeyboard-input to any stream or window, even if the root viewport for the stream or window is different from the root-viewport argument.

The default value of this function is the mouse input stream that is returned by the functionmouse-input.

leave-window-system Function

Syntax:leave-window-system

The functionleave-window-system exits the Window Tool Kit.

If you exit the window environment by callingleave-window-system, you cannot return to it. If you wish to use the Window Tool Kit after calling this function, you must set up new windows by invokinged orinitialize-windows.

See Also: initialize-windows

listen-any Predicate

Syntax:listen-any &optional mouse-input-stream

The predicatelisten-any is true if a character or mouse event structure can be read from the given mouse input stream; otherwise, it is false.

The mouse-input-stream argument specifies a mouse input stream. If this argument is omitted ornil, the mouse input stream that is the value of the functionmouse-input is used. If the value of the mouse-input-stream argument is non-nil, the mouse input stream that is the value of the functionkeyboard-input is used.

See Also: keyboard-input, mouse-input, peek-any, read-any, read-any-no-hang

load-bitmap Function

store-bitmap Function

Syntax:load-bitmap file-name

Syntax:store-bitmap bitmap file-name

The functionload-bitmap reads in a bitmap from the specified file and returns the bitmap.

The functionstore-bitmap stores a bitmap in the specified file.

;; Create a 10x10 bitmap with a random value at each point.
> (setq bitmap (make-bitmap :width 10 :height 10))
#<Bitmap 10x10 4B3F2B>

> (dotimes (i 10) (dotimes (j 10) (setf (bitmap-value bitmap i j) (random 2)))) NIL > (progn ;; Store the bitmap in a file named "temp" (store-bitmap bitmap "temp") ;; Read the bitmap back in (setq new-bitmap (load-bitmap "temp"))) #<Bitmap 10x10 4B65BB>

;; Print a message if the two bitmaps differ at any point. > (dotimes (i 10) (dotimes (j 10) (if (/= (bitmap-value bitmap i j) (bitmap-value new-bitmap i j)) (format t "values differ at ~D ~D~%" i j)))) NIL

See Also: copy-bitmap

load-color-registry Function

store-color-registry Function

Syntax:load-color-registry pathname &optional destructive-load-p

Syntax:store-color-registry pathname

The functionload-color-registry loads the color entries from the file specified by the pathname argument. The color entries must have been previously stored by the functionstore-color-registry.

The functionstore-color-registry stores the color registry entries in the file specified by the pathname argument.

The color entries stored in the file pathname are read into the current system color registry in an arbitrary order. If there are more color entries than there are available entries in the system color map, an error is signaled.

If the optional argument destructive-load-p forload-color-registry has a non-nil value, the current system is reinitialized before the color entries in the specified file are loaded.

> (store-color-registry "colreg")
NIL

> (load-color-registry "colreg") NIL

load-font Function

store-font Function

Syntax:load-font font-name&key :foreign-font-type

Syntax:store-font font file-name

The functionload-font loads and returns the specified font. The type of font that is loaded depends on whether the Window Tool Kit has been initialized and on the value of the:foreign-font-type keyword argument.

The functionstore-font stores a font in the specified file.

If the Window Tool Kit has been initialized and the functionload-font is invoked, it looks first for the X11 font specified by the font-name argument. If it cannot find such a font, the function searches for a Window Tool Kit font file. If neither type of font is available, an error is signaled.

If the:foreign-font-type keyword argument has a non-nil value,load-font attempts to load an X11 font even when the Window Tool Kit is not initialized.

Though you must initialize the Window Tool Kit before you can use fonts, you can load X11 fonts with the following expression at any time:

(load-font "-X-font" :foreign-font-type t) 
When the Window Tool Kit is initialized, it attempts to load the font specified by existing-X-font. If no such foreign font exists in the X server, an error is signaled.

When the value of the:foreign-font-type keyword argument isnil and the Window Tool Kit is not initialized,load-font interprets the font-name argument as a pathname for a file containing a Window Tool Kit font. It reads the file and returns the font. The default value of this argument isnil.

The font argument tostore-font must be a font, a string, or a symbol. If the argument is a string or a symbol, the functionfind-font is called to find the font named by the string or symbol. The information stored bystore-font includes the font's name.

You can specify the following keyword arguments toload-font:

This keyword argument specifies a font to be loaded that is not a Window Tool Kit font.

This keyword argument specifies the name of a foreign font to be loaded. If you do not specify this argument, the name of the foreign font is constructed by using the file-name argument.

See Also: copy-font, find-font

make-active-region Function

Syntax:make-active-region region&key :bitmap :mouse-click :mouse-transition :mouse-moved :mouse-enter-region :mouse-exit-region :mouse-documentation :user-data

The functionmake-active-region creates an active region for the specified region; as an option it can attach that active region to a bitmap.

The region argument is a region that describes the area of the bitmap in which mouse events can trigger the specified mouse methods. The x and y locations of this region are relative to the bitmap specified as the:bitmap keyword argument.

You can specify the following keyword arguments tomake-active-region:

This keyword argument is the bitmap to which this active region should be attached. If this keyword argument is omitted ornil, the active region is not attached to any bitmap. Later it can be attached to a bitmap by using the functionattach-active-region.

These keyword arguments specify the methods for each of the types of mouse events. The value of each keyword argument must be a function of five arguments. The method is called whenever the corresponding mouse event occurs inside the created active region.

If a mouse event keyword argument is omitted ornil, no method is associated with the mouse event, and no function is called when the mouse event occurs inside the created active region.

The method is called with the following sequence of arguments:

For all mouse events except:mouse-exit-region, the x-coordinate and y-coordinate arguments specify a position inside the active region. For:mouse-exit-region, the specified position lies outside the active region; it can also lie outside the bitmap.

This keyword argument is a string or a function that takes an active region as a single argument and returns a string. The string is printed in the who window and describes what actions the mouse can perform when it is in the given active region.

This keyword argument contains any information that you would like to associate with the bitmap. There are no restrictions on the type of information specified in this argument.

The following keyword options tomake-active-region are supported for compatibility with previous releases of Liquid Common Lisp::mouse-left-down,:mouse-left-up,mouse-middle-down,:mouse-middle-up,:mouse-right-down, and:mouse-right-up.

See Also: attach-active-region

make-bitmap Function

Syntax:make-bitmap&key :width :height :user-data :depth :foreground :background

The functionmake-bitmap creates a bitmap.

You can specify the following keyword arguments tomake-bitmap:

These keyword arguments specify the width and height of the bitmap respectively. Unspecified dimensions default to 0.

This keyword argument contains any information that you would like to associate with the bitmap. There are no restrictions on the type of information specified in this argument.

This keyword argument must be a legitimate depth for the specific system display. Depths can vary among host systems; the default depth is 1.

These keyword arguments specify the default colors for the bitmap; they must be registered colors and can be strings, symbols, or color numbers. The default value of the:foreground keyword argument is the color number of the registered color"BLACK"; the default value of the:background keyword argument is the color number of the registered color"WHITE".

> (make-bitmap :height 100 :width 200)
#<Bitmap 200x100x1 856EE6>

make-bitmap-output-stream Function

Syntax:make-bitmap-output-stream &key :bitmap :width :height :operation :initial-font

The functionmake-bitmap-output-stream creates a bitmap output stream. The bitmap output stream can be attached to an already existing bitmap, or it can be attached to a new bitmap created by this function.

You can specify the following keyword arguments tomake-bitmap-output-stream:

This keyword argument must be a bitmap; the bitmap output stream is attached to that bitmap. The specified bitmap must have a depth of 1 or(display-depth). If this keyword argument is omitted ornil, a new bitmap is created of depth 1.

These keyword arguments specify the size of the new bitmap. An unspecified width or height defaults to 0.

This keyword argument is the boolean operation used by the stream to write onto the bitmap. It can be a single boolean constant or a list of boolean constants of length equal to the depth of the specified bitmap. If the system depth is 1, the default operation isboole-1; otherwise, the default operation isboole-xor.

This keyword argument is the font in which characters are painted onto the bitmap. The value of this keyword argument must be a font, a string, or a symbol. If the argument is a string or a symbol, the functionfind-font is called to find the font named by the string or symbol. The default value is the value of*default-font*.

The stream position of a newly created bitmap output stream is the position whose x-coordinate is 0 and whose y-coordinate is the baseline height of the initial font. Its linefeed distance is the height of the initial font.

Note: Do not attach an output stream to the bitmap that is associated with the root viewport.

;; Create a 100x200 bitmap, and attach a bitmap output stream to 
;; that bitmap.
> (make-bitmap-output-stream :width 100 :height 200)
#<Output-Stream to #<Bitmap 100x200x1 854AF5> 854EFD>

;; Check that the stream's current font is *default-font*. > (eq (stream-current-font *) *default-font*) T

;; Create another 100x200 bitmap. > (setq btmp (make-bitmap :width 100 :height 200)) #<Bitmap 100x200x1 85603A>

;; Create a bitmap output stream that writes onto that bitmap. > (make-bitmap-output-stream :bitmap btmp) #<Output-Stream to #<Bitmap 100x200x1 85603A> 85646A>

See Also: find-font

make-boole-op-sequence Function

Syntax:make-boole-op-sequence planes background foreground&key :mask :op-sequence

The functionmake-boole-op-sequence returns a sequence of boolean constants that are equivalent to the combination of the color arguments background and foreground and either of the keyword arguments:mask or:op-sequence. The sequence that is returned can be given as an operation sequence to other graphics output functions.

The color arguments foreground and background can be strings, symbols, or color numbers.

The planes argument must be the depth of the destination bitmap.

You can specify one of the keyword arguments:mask or:op-sequence, but not both.

This keyword argument is an integer that specifies which planes of the destination bitmap are affected by the resulting sequence of boolean constants. The mask must be in the range from 0 to(1- (expt 2 planes)) inclusive. A 1 in any bit position of the mask indicates that the corresponding plane should be affected; a 0 indicates that the corresponding plane should not be affected.

This keyword argument is a single boolean constant or a sequence of boolean constants. If you specify a sequence of boolean constants, each boolean constant is associated with a plane of the destination bitmap in ascending order. The default value of:op-sequence is the boolean constantboole-1.

The functionmake-boole-op-sequence is useful when graphic or text output is drawn by using a mix of colors and boolean operations or by using a mix of colors and masking.

The use of operation lists in graphic or text output functions can be slower on host systems that are pixel oriented.

> (make-boole-op-sequence (display-depth)
                          (find-color-number :color "BLACK")
                          (find-color-number :color "WHITE")
                          :mask 1)
#(5 3 3 3 3 3 3 3)

> (make-boole-op-sequence (display-depth) (find-color-number :color "BLACK") (find-color-number :color "WHITE") :op-sequence boole-1) #(5 5 5 0 0 0 0 0)

> (setq *op-sequence* (make-boole-op-sequence (display-depth) (find-color-number :color "BLACK") (find-color-number :color "WHITE") :op-sequence (list boole-1 boole-1 boole-xor boole-xor boole-xor boole-xor boole-clr boole-clr))) #(5 5 6 3 3 3 0 0)

> (draw-line *window* (make-position 0 0) (make-position 100 100) :operation *op-sequence*) NIL

make-mouse-cursor Function

maximum-cursor-height Function

maximum-cursor-width Function

Syntax:make-mouse-cursor bitmap&key :x-offset :y-offset :operation

Syntax:maximum-cursor-height

Syntax:maximum-cursor-width

The functionmake-mouse-cursor creates a mouse cursor object.

The constantsmaximum-cursor-height andmaximum-cursor-width are hardware constraints on the maximum height and width respectively of a mouse cursor.

The bitmap argument tomake-mouse-cursor is a bitmap that contains an image of the cursor.

You can specify the following keyword arguments tomake-mouse-cursor:

These keyword arguments specify which point of the bitmap should be placed on the screen at the location to which the mouse is pointing. If either keyword argument is omitted ornil, the default value is 0.

This keyword argument specifies the boolean operation that combines the bits of the mouse cursor's bitmap with the bits already on the screen. In Liquid Common Lisp, mouse cursors always behave as if they were defined with the boolean operationboole-1.

The value of the expression(bitmap-height bitmap) must be less than or equal tomaximum-cursor-height.

The value of the expression(bitmap-width bitmap) must be less than or equal tomaximum-cursor-width.

The functionmake-mouse-cursor and the constantsmaximum-cursor-height andmaximum-cursor-width are Liquid extensions to Common Lisp.

See Also: current-mouse-cursor

make-mouse-input-stream Function

Syntax:make-mouse-input-stream&key :queue-mouse-events-p :viewport

The functionmake-mouse-input-stream creates a mouse input stream. A mouse input stream is identical to a Common Lisp input stream except that a mouse input stream can queue both characters and mouse event structures.

You can specify the following keyword arguments tomake-mouse-input-stream:

This keyword argument determines whether this mouse input stream initially queues mouse event structures. The default value for this keyword argument isnil, which means that only characters are queued on the newly created mouse input stream.

This keyword argument is the viewport associated with the mouse input stream that is being created. If this keyword argument is omitted ornil, the mouse input stream is associated with the root viewport.

See Also: listen-any, mouse-input-stream-queue-mouse-events-p, peek-any, read-any, unread-any

make-new-who-window Function

Syntax:make-new-who-window&key :parent :x :y :width :height :border-width

The functionmake-new-who-window makes a new who window.

You can specify the following keyword arguments tomake-new-who-window:

This keyword argument specifies the parent of the who window. It can have one of the following values:

These keyword arguments specify the position of the origin of the window's display relative to the specified parent. If the value of the:parent keyword argument isnil, the position specified is relative to the screen.

These keyword arguments specify the size of the new window, including borders.

This keyword argument specifies the width of the window's border. The default value is 2, which means that the border is two pixels wide.

make-pop-up-menu Function

Syntax:make-pop-up-menu choice-list&optional default-value font foreground background

The functionmake-pop-up-menu creates a pop-up menu object.

The choice-list argument is a list. Each element of the list is either a symbol or a cons whose car is a string.

If the element is a symbol, the print name of the element is one of the choices when the functionpop-up-menu-choose displays the pop-up menu. If chosen, the element is returned as the value ofpop-up-menu-choose.

If the element is a cons, the car of the element, which must be a string, is displayed as one of the choices. If the element is chosen, the value ofpop-up-menu-choose is the cdr of the cons.

If the mouse is moved off the choice menu, the default-value argument is returned. If this argument is omitted, the default value isnil.

You can specify the optional font argument if you want the menu items to appear in a different font from the default; the variable*default-pop-up-menu-font* specifies the default font.

The optional foreground and background arguments specify alternate colors for the pop-up menu. These arguments must be registered colors and can be strings, symbols, or color numbers. If you do not specify these arguments, the pop-up menu has a black foreground and a white background.

See Also: *default-pop-up-menu-font*, pop-up-menu-choose

make-position Function

Syntax:make-position&optional x y

The functionmake-position creates a position whose coordinates are specified by the x and y arguments.

The arguments must be nonnegative fixnums. If either argument is omitted, the default value is 0.

> (make-position)
#<Position (0,0) 855C2D>

> (make-position 100 200) #<Position (100,200) 855C3E>

make-region Function

Syntax:make-region&key :region :x :y :width :height :corner-x :corner-y

The functionmake-region creates a new region.

To create a region, you must specify two of the following three attributes of a region: its origin, its corner, and its size. A region's origin is its top-left position. A region's size is its height and width. A region's corner is the point just below and to the right of its bottom-right position.

You can use the following keyword arguments to specify these attributes:

This keyword argument is a region that was created with the functionmake-region.

These keyword arguments specify the x- and y-coordinates of the region's origin respectively.

These keyword arguments specify the width and height of the region respectively.

These keyword arguments specify the x- and y-coordinates of the region's corner respectively.

make-viewport Function

Syntax:make-viewport&key :x :y :width :height :parent :activate :bitmap :bitmap-x :bitmap-y :depth :user-data :pixel-map :viewport-foreground :viewport-background

The functionmake-viewport creates a viewport. The viewport is attached to an already existing bitmap or to a newly created bitmap.

The function returns two values: the newly created viewport and the bitmap to which the viewport is attached.

You can specify the following keyword arguments tomake-viewport:

These keyword arguments specify the coordinates of the viewport's top-left corner relative to the root viewport. The value of each must be a nonnegative fixnum. If either is omitted, its default value is 0.

These keyword arguments specify the width and height of the bitmap to which the viewport is attached. The value of each must be a nonnegative fixnum. If either is omitted ornil, its default value is 0.

You only need to use:width and:height if:bitmap is omitted ornil.

This keyword argument specifies the parent viewport of the new viewport. Its value must be an existing viewport. If the value is a viewport or a window, the viewport or window is used as the parent of the new viewport. Otherwise, the current root viewport is used as the parent of the new viewport.

This keyword argument specifies whether the viewport is active or inactive. If it is omitted or non-nil, the viewport is active. If it is specified andnil, the viewport is inactive.

This keyword argument must be a bitmap; the bitmap output stream is attached to that bitmap. The specified bitmap must have a depth of 1 or(display-depth). If this keyword argument is omitted ornil, a new bitmap is created of depth(display-depth).

These keyword arguments specify the x- and y-coordinates of the specified bitmap. The value of each must be a nonnegative fixnum. If either is omitted ornil, its default value is 0.

This keyword argument must be a legitimate depth for the specific system display. Depths can vary among host systems; the default depth is 1.

This keyword argument contains any information that you would like to associate with the bitmap. There are no restrictions on the type of information specified in this argument.

This keyword argument is a user-created vector that maps pixel values in the specified bitmap onto the possible range of pixel values on the display; it must be of length 2. The first entry of the vector:pixel-map is the value of the foreground pixel, and the second entry is the value of the background pixel. You can use this keyword argument instead of the:viewport-foreground and:viewport-background keyword arguments.

You should supply these keyword arguments if the specified bitmap is of depth 1; the arguments describe how the monochrome bitmap should be mapped onto the multiplane display. Bits with the value 1 show as the viewport foreground color, and bits with the value 0 show as the viewport background color. These arguments must be registered color entries and can be strings, symbols, or color numbers. The default value of the:viewport-foreground keyword argument is the color number of the registered color"BLACK"; the default value of the:viewport-background keyword argument is the color number of the registered color"WHITE".

;;; To run this example, you must have already initialized the
;;; Window Tool Kit.
;; Create a bitmap and a viewport onto that bitmap.
> (make-viewport :width 100 :height 200)
#<Viewport 100x200x1 at (0,0) onto #<Bitmap 100x200x1 85516A> 855572>
#<Bitmap 100x200x1 85516A>

;; Create another bitmap. > (setq btmp (make-bitmap :width 100 :height 200)) #<Bitmap 100x200x1 85560C>

;; Create a viewport onto that bitmap. Note that the bitmap ;; is returned as the second value. > (make-viewport :bitmap btmp) #<Viewport 100x200x1 at (0,0) onto #<Bitmap 100x200x1 85560C> 855A2A> #<Bitmap 100x200x1 85560C>

make-window Function

Syntax:make-window&key :x :y :width :height :inside-x :inside-y :inside-width :inside-height :user-data :inner-border-width :outer-border-width :bitmap :bitmap-x :bitmap-y :depth :parent :scroll :vertical-scroll :horizontal-scroll :calculate-vertical-scroll-ratio :calculate-horizontal-scroll-ratio :initial-font :operation :title :title-font :activate:foreground :background

The functionmake-window creates and returns a window.

A window combines the functionality of a viewport, a bitmap, a bitmap output stream, and a mouse input stream. On the display screen, a window appears as a viewport. It can be surrounded by a border and can have a title. A window can also have scroll bars.

You can specify the following keyword arguments tomake-window:

These keyword arguments specify the position of the origin of the window's entire display (including borders) relative to the root viewport. The value of each must be a fixnum. If either argument is omitted ornil, its default value is 0.

These keyword arguments specify the size of the entire window including all borders. The value of each must be a nonnegative fixnum. If either argument is omitted ornil and the value of the:scroll keyword argument isnil, the default size is the size of the root viewport's inside region; if the value of:scroll ist, the default size is the size of the underlying bitmap. Thus, to make a scrollable window fit in the root viewport, you must explicitly specify its dimensions.

These keyword arguments specify the position of the origin of the window's viewport relative to the root viewport. The value of each must be a fixnum. If either argument is omitted ornil and the default values for:inner-border-width and:outer-border-width are used, its default value is 3.

These keyword arguments specify the size of the window's viewport. The value of each must be a nonnegative fixnum. If either argument is omitted ornil, its default value is the inside width or height of the root viewport minus the combined widths of either the vertical or the horizontal borders of the specified window.

This keyword argument contains any information that you would like to associate with the bitmap. There are no restrictions on the type of information specified in this argument.

These keyword arguments specify the width of the window's inner and outer borders. If:inner-border-width is omitted ornil, its default value is 1. If:outer-border-width is omitted ornil, its default value is 2.

This keyword argument must be a bitmap; the bitmap output stream is attached to that bitmap. The specified bitmap must have a depth of 1 or(display-depth). If this keyword argument is omitted ornil, a new bitmap is created of depth(display-depth).

These keyword arguments specify the position in the window's bitmap that corresponds to the origin of the window's inside region. If either argument is omitted ornil, its default value is 0.

This keyword argument must be a legitimate depth for the specific system display. Depths can vary among host systems; the default depth is 1.

This keyword argument specifies the parent of the window. It can take one of three values:

  • If the argument is a window or a viewport, the new window is a child of the specified parent.

  • If the argument ist, the new window is a child of the current root viewport; this value is the default.

  • If the argument isnil, the new window is a new root viewport.

This keyword argument specifies whether the window can have scroll bars. If the value of this argument ist, the window can have scroll bars when the dimensions of the window's bitmap are greater than those of its viewport. Thus, when the bitmap is wider than the viewport, a scroll bar appears on the window's right border; when the bitmap is longer than the viewport, a scroll bar appears on the window's bottom border. If this argument is omitted ornil, the window is made without scroll bars. Do not give this keyword argument any value other thant ornil.

The keyword arguments specify the methods for vertical and horizontal scrolling. The value of each keyword must be a function that takes two arguments: the window and the current vertical or horizontal scroll ratio. If either argument is omitted ornil, its default value is the default method for vertical or horizontal scrolling. The default methods move the window's bitmap clipping region over the window's bitmap to a degree that corresponds to the movement of the bubble on the scroll bar.

These keyword arguments specify the methods for calculating vertical and horizontal scroll ratio respectively. The value of each keyword must be a function that takes the window as its argument and returns either a Common Lisp ratio between 0 and 1 ornil. If either keyword argument is omitted ornil, its default value is the default method for calculating the vertical or horizontal scroll ratio. The default method defines the current scroll ratio as that of the degree to which the window has been scrolled to the maximum degree to which it can be scrolled; thus, if a window has been scrolled to one-third of the possible horizontal scrolling distance, the horizontal scroll ratio is 1/3.

Note: You cannot use the Common Lisp macrosetf with these keyword arguments to set the respective scroll ratios.

This keyword argument specifies the initial font used by the window's bitmap output stream. Its value must be a font, a string, or a symbol. If this argument is omitted ornil, its default value is the value of the variable*default-font*.

This keyword argument specifies the boolean operation that the bitmap output stream uses to write onto the bitmap. Its value must be an acceptable first argument to the Common Lisp functionboole. If this argument is omitted ornil, its default value is the value of the constantboole-1.

This keyword argument specifies the title of the window. Its value must be a string. The title of the window appears near the top-left corner of the window on the border. If this argument is omitted ornil, the window has no title.

This keyword argument specifies the font in which the title is displayed. Its value must be a font, a string, or a symbol. If this argument is omitted ornil, its default value is the value of the:initial-font keyword argument.

This keyword argument specifies whether the viewport is active or inactive. If this argument is omitted or non-nil, the viewport is active; if it isnil, the viewport is inactive.

These keyword arguments specify the default foreground pixel and background pixel for the bitmap associated with the new window. They must specify registered color entries and can be strings, symbols, or color numbers. Any text or graphic output to the window's bitmap uses the foreground and background pixel values. The default value of the:foreground keyword argument is the color number of the registered color"BLACK"; the default value of the:background keyword argument is the color number of the registered color"WHITE".

If you specify default values for:foreground,:background, and:operation, any drawing function that you invoke will use the window's foreground and background colors, not the values you specified, as defaults, unless you specify a color to the drawing function. In addition, the drawing function will assume a default operation ofboole-1.

;;; To run this example, you must have already initialized the 
;;; Window Tool Kit.
> (setq w (make-window :width 100 :height 200 :title "hello"))
#<Window 100x200x1 at (0,0) 8D1FF3>

> (windowp w) T

See Also: window-vertical-scroll-ratio, window-horizontal-scroll, window-calculate-vertical-scroll-ratio, window-calculate-horizontal-scroll-ratio

map-color-registry Function

Syntax:map-color-registry function

The functionmap-color-registry iterates over the color entries in the color registry and applies the specified function to each entry.

The function argument must take five arguments: color-name, color-number, red, green, and blue.

> (map-color-registry
  #'(lambda (color-name color-number red green blue)
      (format t "~S~20T~A  red: ~A, green: ~A, blue: ~A~%"
	      color-name color-number red green blue)))
"YELLOW"            5  red: 65535, green: 65535, blue: 0
"BLACK"             0  red: 0, green: 0, blue: 0
"WHITE"             7  red: 65535, green: 65535, blue: 65535
"CYAN"              4  red: 0, green: 65535, blue: 65535
"BLUE"              3  red: 0, green: 0, blue: 65535
"RED"               1  red: 65535, green: 0, blue: 0
"MAGENTA"           6  red: 65535, green: 0, blue: 65535
"GREEN"             2  red: 0, green: 65535, blue: 0
NIL

map-fonts Function

Syntax:map-fonts function

The functionmap-fonts iterates over the fonts in the font registry and applies the specified function to each entry.

The function argument specifies a function of two arguments, a font name and a font.

> (map-fonts #'(lambda (fontname font) 
                 (format t "~S~20T~A~%" fontname font)))
"ROMAN"             #<Fixed-Width-Font ROMAN C00E3A46>
"ITALIC"            #<Fixed-Width-Font ITALIC C00E679E>
"BOLD-ROMAN"        #<Fixed-Width-Font BOLD-ROMAN C00E517E>
NIL

max-mic-value Constant

min-mic-value Constant

Syntax:max-mic-value

Syntax:min-mic-value

The value of the constantmax-mic-value is the maximum value for specifying the color intensity of red, green, or blue when registering a color or setting a color in the color map.

The value of the constantmin-mic-value is the minimum value for specifying the color intensity of red, green, or blue when registering a color or setting a color in the color map.

If red, green, and blue are each set tomax-mic-value, the resulting color is white. If red, green, and blue are each set tomin-mic-value, the resulting color is black. The value ofmin-mic-value is 0, and the value ofmax-mic-value is 65535.

> max-mic-value
65535

> min-mic-value 0

menu-mouse-buttons Function

Syntax:menu-mouse-buttons

The functionmenu-mouse-buttons returns a list of keywords that indicate which mouse buttons select menu items.

The default list returned bymenu-mouse-buttons is(:left :middle :right).

When you press a mouse button that is included in the list returned by this function, a menu item is selected. If the mouse button is not listed, no selection is made.

You can use the Common Lisp macrosetf with this function to set the mouse buttons that select menu items.

mouse-buttons Function

mouse-x Function

mouse-y Function

Syntax:mouse-buttons

Syntax:mouse-x

Syntax:mouse-y

The functionmouse-buttons returns an integer in the range 0 to 7. This integer encodes the mouse buttons that are currently depressed.

The functionsmouse-x andmouse-y return the current x- and y-coordinates of the mouse. These positions are relative to the root viewport.

The functionsmouse-x andmouse-y return coordinates of the mouse relative to the current root viewport.

See the table in Chapter 3, "Interpretation of mouse buttons" for the possible values returned bymouse-buttons.

See Also: mouse-buttons, *mouse-x*, *mouse-y*, mouse-event-buttons, mouse-event-x, mouse-event-y, move-mouse

*mouse-buttons* Variable

*mouse-x* Variable

*mouse-y* Variable

Syntax:*mouse-buttons*

Syntax:*mouse-x*

Syntax: *mouse-y*

The variable*mouse-buttons* contains an integer in the range 0 to 7. This integer encodes the mouse buttons that are currently depressed.

The variables*mouse-x* and*mouse-y* contain the current x- and y-coordinates of the mouse. These positions are relative to the root viewport.

These variables are provided for backward compatibility; you should use the functionsmouse-buttons,mouse-x, andmouse-y in most instances.

See Also: mouse-buttons, mouse-event-buttons, mouse-event-x, mouse-event-y, mouse-x, mouse-y, move-mouse

mouse-cursor-bitmap Function

mouse-cursor-x-offset Function

mouse-cursor-y-offset Function

mouse-cursor-operation Function

Syntax:mouse-cursor-bitmap mouse-cursor-object

Syntax:mouse-cursor-x-offset mouse-cursor-object

Syntax:mouse-cursor-y-offset mouse-cursor-object

Syntax:mouse-cursor-operation mouse-cursor-object

These functions return components of a mouse cursor object.

You can use Common Lisp macrosetf with these functions to modify a mouse cursor object.

mouse-cursor-p

Syntax:mouse-cursor-p object

The predicatemouse-cursor-p tests whether its object argument is a mouse cursor object. It is true if object is a mouse cursor object.

*mouse-enters-window-system* Variable

*mouse-leaves-window-system* Variable

Syntax:*mouse-enters-window-system*

Syntax:*mouse-leaves-window-system*

The variable*mouse-enters-window-system* contains a list of functions to be called whenever the mouse enters the root viewport.

The variable*mouse-leaves-window-system* contains a list of functions to be called whenever the mouse leaves the root viewport.