
The Window Tool Kit
activate-viewport viewport&key :activate-children
deactivate-viewport viewport
activate-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.
deactivate-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.
deactivate-viewport tries to deactivate a viewport that is already inactive, nothing happens.
activate-viewport tries to activate a viewport that is already active, nothing happens.
active-region-bitmap active-region
active-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 active-region event-name
active-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.
:mouse-click,:mouse-transition,:mouse-moved,:mouse-enter-region, or:mouse-exit-region.
setf method for this function updates the appropriate method. If you set the value tonil, no method is called when the corresponding mouse event occurs.
: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.
active-region-mouse-documentation region
active-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.
setf with this function to alter the mouse documentation associated with an active region.
active-region-p object
active-region-p tests whether its object argument is an active region. It is true if object is an active region.
active-region-user-data active-region
active-region-user-data returns the information that is specified in the:user-data keyword argument tomake-active-region.
setf with this function to alter the contents of the:user-data argument.
make-active-region
allocate-color
deallocate-color color-sequence
allocate-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.
deallocate-color deallocates the specified color or color number previously allocated by the functionallocate-color.
deallocate-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.
> (allocate-color) 22attach-active-region Function> (deallocate-color 22) 22
bitmap-active-regions Function
clear-bitmap-active-regions Function
attach-active-region bitmap active-region
detach-active-region active-region
bitmap-active-regions bitmap
clear-bitmap-active-regions bitmap
attach-active-region attaches an active region to a bitmap.detach-active-region detaches an active region from its bitmap.bitmap-active-regions returns a list of all the active regions that are attached to a bitmap.clear-bitmap-active-regions detaches all active regions that are attached to a bitmap.
detach-active-region is called with an active region that is not attached to a bitmap, nothing happens.
bitblt source-bitmap source-x source-y destination-bitmap destination-x destination-y width height operation&key :clipping-region :foreground :background :pixel-map
bitblt-position source-bitmap source-position destination-bitmap destination-position width height operation&key :clipping-region :foreground :background :pixel-map
bitblt-region source-bitmap source-region destination-bitmap destination-region operation&key :foreground :background :pixel-map
bitblt copies regions from one bitmap to another.bitblt-position is similar tobitblt, except that the locations in each bitmap are expressed as positions rather than as x- and y-coordinates.bitblt-region is similar tobitblt, except that the arguments explicitly specify the source and destination regions.:pixel-map keyword argument.
bitblt. The source-x and source-y arguments specify the x- and y-coordinates respectively of the region's origin. The width and height arguments specify the region's width and height respectively.bitblt-position. The source-position argument specifies the position of the region's origin. The width and height arguments specify the region's width and height respectively.bitblt-region.
bitblt. The destination-x and destination-y arguments specify the x- and y-coordinates respectively of the region's origin. The width and height arguments specify the region's width and height respectively.bitblt-position. The destination-position argument specifies the position of the region's origin. The width and height arguments specify the region's width and height respectively.bitblt-region.boole 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.
boole-1.
:clipping-regionbitblt-region does not use this keyword option.
:foreground,:background:pixel-map keyword argument when source-bitmap has a single plane and destination-bitmap has multiple planes.
:pixel-map(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.
: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.
:pixel-map keyword argument requires per-pixel access, so mapping from a multiplane source-bitmap to any destination-bitmap is generally slow.
bitblt-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 bitmap
bitmap-depth returns the depth, or number of planes, of the specified bitmap.
> (setq *bitmap1* (make-bitmap :width 10 :height 10)) #<Bitmap 10x10x1 E664EB>bitmap-height Function> (bitmap-depth *bitmap1*) 1
> (setq *bitmap2* (make-bitmap :width 10 :height 10 :depth (display-depth))) #<Bitmap 10x10x8 E67D0B>
> (bitmap-depth *bitmap2*) 8
bitmap-height bitmap
bitmap-width bitmap
bitmap-height returns the height of a bitmap.
bitmap-width returns the width of a bitmap.
setf 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.
> (setq my-bitmap (make-bitmap :width 100 :height 200)) #<Bitmap 100x200x1 25F391>bitmap-foreground-pixel Function> (bitmap-height my-bitmap) 200
> (bitmap-width my-bitmap) 100
bitmap-background-pixel Function
bitmap-foreground-pixel bitmap
bitmap-background-pixel bitmap
bitmap-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.
bitmap-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.
setf with these functions to specify a new default foreground or background pixel for a bitmap.
> (bitmap-foreground-pixel *bitmap*) 0bitmap-output-stream-P Function> (bitmap-background-pixel *bitmap*) 7
> (setf (bitmap-foreground-pixel *bitmap*) 1) 1
> (bitmap-foreground-pixel *bitmap*) 1
bitmap-output-stream-p object
bitmap-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)) Tbitmap-p Function> (bitmap-output-stream-p 7) NIL
bitmap-p object
bitmap-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)) Tbitmap-user-data Function> (bitmap-p 7) NIL
bitmap-user-data bitmap
bitmap-user-data returns the information that is specified in the:user-data keyword argument tomake-bitmap andinitialize-bitmap.
setf with this function to alter the contents of the:user-data argument.
initialize-bitmap, make-bitmap
bitmap-value bitmap x y
bitmap-value returns the value of a bitmap's point at a given x-y coordinate.
bitmap-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.
setf 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>charblt Function;; 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 bitmap position font char&key :operation :foreground :background
stringblt bitmap position font string&key :operation :foreground :background :start :end
charblt paints a character image from a font onto a bitmap.
stringblt paints a string of character images from a font onto a bitmap.
find-font is called to find the font named by the string or symbol.
:operationboole to these three arguments: the:operation argument, the value of the font's bit, and the value of the destination bitmap position.
: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.
:foreground,:background
stringblt, 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:
:start keyword argument marks the beginning position of the substring. The default value is 0.:end keyword argument marks the position following the last element of the substring. The default value is the length of the string.:operation keyword argument.
stringblt cannot handle tabs and other characters that have an ambiguous print representation. It can handle newline and space characters.
bitblt
char-height char font
char-width char font
max-char-width font
char-height andchar-width return the height and width respectively of the specified character in the given font.
max-char-width returns the maximum character width that is allowed by the specified font.
clear-bitmap bitmap&optional region background
clear-bitmap clears a bitmap. That is, the value of every point in the bitmap is set to 0.
;; Create a 10x10 bitmap. > (setq btmp (make-bitmap :width 10 :height 10)) #<Bitmap 10x10x1 596D5D>color-available-p Function;; 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 &key :display
color-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:nil nilcolor-available-p cannot determine whether the server supports color.
: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"
DISPLAY.
> (color-available-p) 8 256color-map-size Function
color-map-size
color-map-size returns the total number of entries in the color map associated with the current system display.
color-map-size does not necessarily reflect the number of available entries in the system color map.
> (display-depth) 8color-registry-size Function> (color-map-size) 255
color-registry-size
color-registry-size returns the total number of entries that have already been allocated in the color registry.
color-registry-size does not necessarily reflect the number of used or unavailable entries in the system color map.
> (color-registry-size) 22copy-bitmap Function
copy-bitmap bitmap
copy-bitmap copies a bitmap.
;; Create a 100x200 bitmap. > (make-bitmap :height 100 :width 200) #<Bitmap 200x100x1 5D95EE>;; Make a copy of the bitmap. > (copy-bitmap *) #<Bitmap 200x100x1 5D9937>
store-bitmap
copy-font font new-name
copy-font copies a font and stores the new font in the font registry under the name new-name.
find-font is called to find the font named by the string or symbol.
> *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>
find-font, store-font
current-mouse-cursor
current-mouse-cursor returns the mouse cursor object that is currently tracking the mouse on the display screen.
setf with this function to modify the mouse cursor object that is tracking the mouse.
make-mouse-cursor
*current-screen*
*current-screen* contains a Liquid Common Lisp screen structure that holds all of the machine-specific hooks.
*default-font*
*default-font* is a font that is used by default by the functionsmake-bitmap-output-stream andmake-window.
*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
find-font
default-font-code-limit Constant
default-font-baseline
default-font-code-limit
default-font-height
default-font-baseline is the default value for the baseline height of every character in a font.default-font-height is the default value for the height of every character in a font.default-code-limit is the default value for the number of characters in a font.
*default-pop-up-menu-font*
*default-pop-up-menu-font* is a font that the Window Tool Kit uses by default to display pop-up menus.
setq to change the value of this variable, whose initial value is the font returned by the expression(find-font "ITALIC").
delete-color name
delete-color deletes a previously registered color entry of the specified name from the color registry and returnsnil.
> (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
delete-font font
delete-font deletes a font from the font registry.
find-font is called to convert the argument to a font.
find-font no longer recognizes its name.
delete-root-viewport root-viewport
delete-root-viewport deletes the specified viewport. It returnsnil.
leave-window-system.
leave-window-system
display-depth
display-depth returns the number of planes in the current system screen display.
> (display-depth) 8draw-circle Function
draw-circle bitmap center radius&key :width :operation :foreground :start-theta :angle
: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.
:operation and:foreground are as fordraw-line.
: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 bitmap start end&key :width :operation :foreground
draw-polyline bitmap positions&key :width :operation :foreground
draw-polypoint bitmap positions&key :width :operation :foreground
draw-line draws a line segment from the position start to the position end.draw-polyline takes the sequence of positions positions and connects each adjacent pair.draw-polypoint takes the sequence of positions positions and draws a dot at each one.:widthdraw-polypoint, the:width argument specifies the diameter of the dot. If the:width keyword argument is omitted ornil, the default value is 1.
:operationboole-1; this default value causes the values that are being written onto the bitmap to overwrite whatever was already on the bitmap.
:foregroundnil, the default value is the default foreground of the specified bitmap.
:foreground or the:operation argument, but not both.
draw-rectangle bitmap x y&key :width :height :corner-x :corner-y :operation :foreground
draw-rectangle draws a rectangle on the specified bitmap.
draw-rectangle::width,:heightnil, its default value is 0.
:corner-x,:corner-y
:width and:height or the keyword arguments:corner-x and:corner-y, but not both pairs.
:operationboole-1.
:foreground(1- (expt 2 (bitmap-depth bitmap))) inclusive.
:foreground or the:operation argument, but not both. If you do not specify either keyword argument, the default foreground pixel of bitmap is used.
draw-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
draw-circle, draw-line, draw-polyline, draw-polyline
expose-viewport viewport
hide-viewport viewport
expose-viewport moves a viewport to the top of its sibling stack. Nothing happens if the viewport is already at the top of the stack.
hide-viewport moves a viewport to the bottom of its sibling stack. Nothing happens if the viewport is already at the bottom of the stack.
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.
viewport-children
find-color&key :color :mdc :red :green :blue
find-color-number&key :color :mdc :red :green :blue
find-color returns the color string that is associated with a color.
find-color-number returns the color number that is associated with a color. If the specified color is not registered,nil is returned.
:color
:mdcfind-mdc.
:red,:green,:bluemin-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
find-mdc, min-mic-value, max-mic-value
find-font name
find-font finds and returns the font of the specified name. It returnsnil if it cannot find a font with that name.
"ROMAN","BOLD-ROMAN", and"ITALIC".
copy-font, delete-font, load-font, rename-font, store-font
find-mdc&key:color :red :green :blue
find-mic&key:color :mdc
find-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.
find-mic returns the red, green, and blue values that are associated with a color. If the specified color is not registered,nil is returned.
:color keyword argument is a string, symbol, or color number.
find-mdc, the:red,:green, and:blue keyword arguments must be in the appropriate range frommin-mic-value tomax-mic-value inclusive.
find-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
min-mic-value, max-mic-value
find-root-viewport-from-viewport viewport
find-root-viewport-from-viewport returns the root viewport that is the ancestor of the specified viewport or window.
follow-mouse min-x min-y max-x max-y function
follow-mouse tracks the movement of the mouse in the specified area during the execution of the specified function.
font-baseline font
font-height font
font-fixed-width font
font-baseline returns the baseline height of a font, which is the baseline height of every character in the font.font-height returns the height of a font, which is the height of every character in the font.font-fixed-width returns the width of every character in a font if the font is a fixed-width font; otherwise, it returnsnil.find-font is called to find the font named by the string or symbol.
default-font-baseline, default-font-height, find-font
font-bitmap font
font-code-limit font
font-name font
font-bitmap returns the underlying bitmap in which a font stores its character images.font-code-limit returns the number of character images that can be stored in a font.font-name returns the name of a font.find-font is called to find the font named by the string or symbol.
default-font-code-limit, find-font, rename-font
fontp object
fontp tests whether its object argument is a font. It is true if object is a font.
> (fontp *default-font*) Tget-screen-point-from-user Function> (fontp 7) NIL
get-screen-point-from-user &key :function :mouse-documentation
get-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.
:function keyword argument is a function that gets called with four arguments every time that the user moves the mouse::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 &key :minimum-width :minimum-height &allow-other-keys
get-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.
:minimum-width and:minimum-height keyword arguments specify the minimum width and height of the region respectively.
make-region.
make-region
initialize-bitmap bitmap&key :width :height :user-data :depth :foreground :background
initialize-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.
initialize-bitmap::width,:height
:user-data
:depth
:foreground,:background: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
make-bitmap
initialize-viewport viewport &key :x :y :width :height :parent :activate :bitmap :bitmap-x :bitmap-y :depth :user-data :pixel-map :viewport-foreground :viewport-background
initialize-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.
initialize-viewport::x,:y
:width,:heightnil, its default value is 0.
:width and:height if:bitmap is omitted ornil.
:parent
:activatenil, the viewport is active. If it is specified andnil, the viewport is inactive.
:bitmap(display-depth). If this keyword argument is omitted ornil, a new bitmap is created of depth(display-depth).
:bitmap-x,:bitmap-ynil, its default value is 0.
:depth
:user-data
:pixel-map: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.
:viewport-foreground,:viewport-background: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".
make-viewport
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
initialize-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.
initialize-window::x,:ynil, its default value is 0.
:width,:heightnil, its default value is the width or height of the root viewport.
:inside-x,:inside-ynil and the default values for:inner-border-width and:outer-border-width are used, its default value is 3.
:inside-width,:inside-heightnil, 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.
:user-data
:inner-border-width,:outer-border-width:inner-border-width is omitted ornil, its default value is 1. If:outer-border-width is omitted ornil, its default value is 2.
:bitmap(display-depth). If this keyword argument is omitted ornil, a new bitmap is created of depth(display-depth).
:bitmap-x,:bitmap-ynil, its default value is 0.
:depth
:parentt, the new window is a child of the current root viewport; this value is the default.nil, the new window is a new root viewport.:scrollt, 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.
:vertical-scroll,:horizontal-scrollnil, 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.
:calculate-vertical-scroll-ratio,:calculate-horizontal-scroll-rationil. 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.
setf with these keyword arguments to set the respective scroll ratios.
:initial-fontnil, its default value is the value of the variable*default-font*.
:operationboole. If this argument is omitted ornil, its default value is the value of the constantboole-xor.
:titlenil, the window has no title.
:title-fontnil, its default value is the value of the:initial-font keyword argument.
:foreground,:background: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".
: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.
make-window
initialize-windows &key :height :width :screen-x :screen-y :label :no-wholine :icon-x :icon-y :icon-image :icon-label :display
initialize-windows initializes the Window Tool Kit.
initialize-windows to initialize the window system.
initialize-windows::height,:width
:screen-x,:screen-y
:label
:no-wholinenil 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.
make-new-who-window creates a new who window.
:icon-x,:icon-y
:icon-image
:icon-label
:display
"host"
"host:display-number"
DISPLAY.
Window system already initialized
disksave 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")
leave-window-system, make-new-who-window
keyboard-input &optional root-viewport
keyboard-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.
setf 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.
mouse-input.
leave-window-system
leave-window-system exits the Window Tool Kit.
leave-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.
initialize-windows
listen-any &optional mouse-input-stream
listen-any is true if a character or mouse event structure can be read from the given mouse input stream; otherwise, it is false.
nil, 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.
keyboard-input, mouse-input, peek-any, read-any, read-any-no-hang
load-bitmap file-name
store-bitmap bitmap file-name
load-bitmap reads in a bitmap from the specified file and returns the bitmap.
store-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
copy-bitmap
load-color-registry pathname &optional destructive-load-p
store-color-registry pathname
load-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.
store-color-registry stores the color registry entries in the file specified by the pathname argument.
load-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") NILload-font Function> (load-color-registry "colreg") NIL
load-font font-name&key :foreign-font-type
store-font font file-name
load-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.
store-font stores a font in the specified file.
load-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.
: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.
(load-font "-X-font" :foreign-font-type t)
: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.
store-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.
load-font::foreign-font-type
:foreign-font-name
copy-font, find-font
make-active-region region&key :bitmap :mouse-click :mouse-transition :mouse-moved :mouse-enter-region :mouse-exit-region :mouse-documentation :user-data
make-active-region creates an active region for the specified region; as an option it can attach that active region to a bitmap.
:bitmap keyword argument.
make-active-region::bitmapnil, the active region is not attached to any bitmap. Later it can be attached to a bitmap by using the functionattach-active-region.
:mouse-click,:mouse-transition,:mouse-moved,:mouse-still,:mouse-enter-region,:mouse-exit-region
nil, no method is associated with the mouse event, and no function is called when the mouse event occurs inside the created active region.
: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.
:mouse-documentation
:user-data
make-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.
attach-active-region
make-bitmap&key :width :height :user-data :depth :foreground :background
make-bitmap creates a bitmap.
make-bitmap::width,:height
:user-data
:depth
: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
make-bitmap-output-stream &key :bitmap :width :height :operation :initial-font
make-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.
make-bitmap-output-stream::bitmap(display-depth). If this keyword argument is omitted ornil, a new bitmap is created of depth 1.
:width,:height
:operationboole-1; otherwise, the default operation isboole-xor.
:initial-fontfind-font is called to find the font named by the string or symbol. The default value is the value of*default-font*.
;; 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>
find-font
make-boole-op-sequence planes background foreground&key :mask :op-sequence
make-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.
:mask or:op-sequence, but not both.:mask(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.
:op-sequence:op-sequence is the boolean constantboole-1.
make-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.
> (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 Functionmaximum-cursor-height Function
make-mouse-cursor bitmap&key :x-offset :y-offset :operation
maximum-cursor-height
maximum-cursor-width
make-mouse-cursor creates a mouse cursor object.
maximum-cursor-height andmaximum-cursor-width are hardware constraints on the maximum height and width respectively of a mouse cursor.
make-mouse-cursor is a bitmap that contains an image of the cursor.
make-mouse-cursor::x-offset,:y-offsetnil, the default value is 0.
:operationboole-1.
(bitmap-height bitmap) must be less than or equal tomaximum-cursor-height.
(bitmap-width bitmap) must be less than or equal tomaximum-cursor-width.
make-mouse-cursor and the constantsmaximum-cursor-height andmaximum-cursor-width are Liquid extensions to Common Lisp.
current-mouse-cursor
make-mouse-input-stream&key :queue-mouse-events-p :viewport
make-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.
make-mouse-input-stream::queue-mouse-events-pnil, which means that only characters are queued on the newly created mouse input stream.
:viewportnil, the mouse input stream is associated with the root viewport.
listen-any, mouse-input-stream-queue-mouse-events-p, peek-any, read-any, unread-any
make-new-who-window&key :parent :x :y :width :height :border-width
make-new-who-window makes a new who window.
make-new-who-window::parent
t, the new window is the child of the current root viewport. This value is the default.nil, the new who window has no parent and is a top-level window on the screen.:x,:y:parent keyword argument isnil, the position specified is relative to the screen.
:width,:height
:border-width
make-pop-up-menu choice-list&optional default-value font foreground background
make-pop-up-menu creates a pop-up menu object.
pop-up-menu-choose displays the pop-up menu. If chosen, the element is returned as the value ofpop-up-menu-choose.
pop-up-menu-choose is the cdr of the cons.
nil.
*default-pop-up-menu-font* specifies the default font.
*default-pop-up-menu-font*, pop-up-menu-choose
make-position&optional x y
make-position creates a position whose coordinates are specified by the x and y arguments.
> (make-position) #<Position (0,0) 855C2D>make-region Function> (make-position 100 200) #<Position (100,200) 855C3E>
make-region&key :region :x :y :width :height :corner-x :corner-y
make-region creates a new region.
:regionmake-region.
:x,:y
:width,:height
:corner-x,:corner-y
make-viewport&key :x :y :width :height :parent :activate :bitmap :bitmap-x :bitmap-y :depth :user-data :pixel-map :viewport-foreground :viewport-background
make-viewport creates a viewport. The viewport is attached to an already existing bitmap or to a newly created bitmap.
make-viewport::x,:y
:width,:heightnil, its default value is 0.
:width and:height if:bitmap is omitted ornil.
:parent
:activatenil, the viewport is active. If it is specified andnil, the viewport is inactive.
:bitmap(display-depth). If this keyword argument is omitted ornil, a new bitmap is created of depth(display-depth).
:bitmap-x,:bitmap-ynil, its default value is 0.
:depth
:user-data
:pixel-map: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.
:viewport-foreground,:viewport-background: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>make-window Function;; 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&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
make-window creates and returns a window.
make-window::x,:ynil, its default value is 0.
:width,:heightnil 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.
:inside-x,:inside-ynil and the default values for:inner-border-width and:outer-border-width are used, its default value is 3.
:inside-width,:inside-heightnil, 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.
:user-data
:inner-border-width,:outer-border-width:inner-border-width is omitted ornil, its default value is 1. If:outer-border-width is omitted ornil, its default value is 2.
:bitmap(display-depth). If this keyword argument is omitted ornil, a new bitmap is created of depth(display-depth).
:bitmap-x,:bitmap-ynil, its default value is 0.
:depth
:parentt, the new window is a child of the current root viewport; this value is the default.nil, the new window is a new root viewport.:scrollt, 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.
nil, 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.
:calculate-vertical-scroll-ratio,:calculate-horizontal-scroll-rationil. 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.
setf with these keyword arguments to set the respective scroll ratios.
:initial-fontnil, its default value is the value of the variable*default-font*.
:operationboole. If this argument is omitted ornil, its default value is the value of the constantboole-1.
:titlenil, the window has no title.
nil, its default value is the value of the:initial-font keyword argument.
:activatenil, the viewport is active; if it isnil, the viewport is inactive.
:foreground,:background: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".
: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
window-vertical-scroll-ratio, window-horizontal-scroll, window-calculate-vertical-scroll-ratio, window-calculate-horizontal-scroll-ratio
map-color-registry function
map-color-registry iterates over the color entries in the color registry and applies the specified function to each entry.
> (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
map-fonts function
map-fonts iterates over the fonts in the font registry and applies the specified function to each entry.
> (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
max-mic-value
min-mic-value
max-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.
min-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.
max-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 65535menu-mouse-buttons Function> min-mic-value 0
menu-mouse-buttons
menu-mouse-buttons returns a list of keywords that indicate which mouse buttons select menu items.
menu-mouse-buttons is(:left :middle :right).
setf with this function to set the mouse buttons that select menu items.
mouse-buttons
mouse-x
mouse-y
mouse-buttons returns an integer in the range 0 to 7. This integer encodes the mouse buttons that are currently depressed.
mouse-x andmouse-y return the current x- and y-coordinates of the mouse. These positions are relative to the root viewport.
mouse-x andmouse-y return coordinates of the mouse relative to the current root viewport.
mouse-buttons.
mouse-buttons, *mouse-x*, *mouse-y*, mouse-event-buttons, mouse-event-x, mouse-event-y, move-mouse
*mouse-buttons*
*mouse-x*
*mouse-buttons* contains an integer in the range 0 to 7. This integer encodes the mouse buttons that are currently depressed.
*mouse-x* and*mouse-y* contain the current x- and y-coordinates of the mouse. These positions are relative to the root viewport.
mouse-buttons,mouse-x, andmouse-y in most instances.
mouse-buttons, mouse-event-buttons, mouse-event-x, mouse-event-y, mouse-x, mouse-y, move-mouse
mouse-cursor-x-offset Function
mouse-cursor-y-offset Function
mouse-cursor-operation Function
mouse-cursor-bitmap mouse-cursor-object
mouse-cursor-x-offset mouse-cursor-object
mouse-cursor-y-offset mouse-cursor-object
mouse-cursor-operation mouse-cursor-object
mouse-cursor-bitmap returns a mouse cursor object's bitmap.mouse-cursor-x-offset returns a mouse cursor object's x-offset.mouse-cursor-y-offset returns a mouse cursor object's y-offset.mouse-cursor-operation returns the boolean constant that is used to write the mouse cursor object onto the display screen.setf with these functions to modify a mouse cursor object.
mouse-cursor-p object
mouse-cursor-p tests whether its object argument is a mouse cursor object. It is true if object is a mouse cursor object.
*mouse-leaves-window-system* Variable
*mouse-enters-window-system*
*mouse-leaves-window-system*
*mouse-enters-window-system* contains a list of functions to be called whenever the mouse enters the root viewport.
*mouse-leaves-window-system* contains a list of functions to be called whenever the mouse leaves the root viewport.