Appendix C
© 1995, 1996, 1997 Gregg M. Townsend, Ralph E. Griswold, and Clinton
L. Jeffery
Window Attributes
Window attributes describe and control various characteristics of a window.
Some attributes are fixed and can only be read; others can be set only when
the window is opened. Most can be changed at any time.
There are two classes of attributes: canvas attributes and graphics
context attributes. In general, canvas attributes relate to aspects
of the window itself, while graphics context attributes affect drawing operations.
Alternate graphics contexts, each with its own set of graphics context attributes,
are created by Clone()
. Canvas attributes, however, are shared
by all clones of a window.
Initial attribute settings can be passed as arguments to WOpen()
or Window()
. For an existing window, attributes are read or
written by calling WAttrib()
. Specific procedures also exist
for reading or writing certain attributes; these are noted in the See also
sections of the individual attribute descriptions.
In the tables that follow, the letter R
indicates attributes
that can be read by WAttrib()
and the letter W
indicates attributes that can be written -- either initially or by calling
WAttrib()
. Writable graphics context attributes can also be
set by Clone()
.
Canvas Attributes
The following attributes are associated with a canvas and shared by all
windows that reference that canvas.
Usage Canvas Attribute Interpretation
R, W label window label (title)
R, W pos, posx, posy window position on screen
R, W resize user resizing flag
R, W size, height, width window size, in pixels
R, W lines, columns window size, in characters
W image initial canvas contents
R, W canvas window visibility state
W iconpos icon position
R, W iconlabel icon label
R, W iconimage icon image
R, W echo character echoing flag
R, W cursor text cursor visibility flag
R, W x, y cursor location, in pixels
R, W row, col cursor location, in characters
R, W pointer pointer (mouse) shape
R, W pointerx, pointery pointer location, in pixels
R, W pointerrow, pointercol pointer location, in characters
R, W display device on which the window appears
R depth display depth, in bits
R displayheight display height, in pixels
R displaywidth display width, in pixels
Graphics Context Attributes
The following attributes are associated with a graphics context.
Usage Graphics Attribute Interpretation
R, W fg foreground color
R, W bg background color
R, W reverse color reversal flag
R, W drawop drawing operation
R, W gamma color correction factor
R, W font text font
R fheight, fwidth maximum character size
R ascent, descent dimensions from baseline
R, W leading vertical advancement
R, W linewidth line width
R, W linestyle line style
R, W fillstyle fill style
R, W pattern fill pattern
R, W clipx, clipy clipping rectangle position
R, W clipw, cliph clipping rectangle extent
R, W dx, dy output translation
Attribute Descriptions
ascent
-- text font ascent
The read-only graphics context attribute ascent
gives the distance,
in pixels, that the current text font extends above the baseline.
See also: descent and fheight
bg
-- background color
The graphics context attribute bg
specifies current background
color.
Initial value: "white"
See also: fg, drawop, gamma, reverse, and Bg()
canvas
-- window visibility
The canvas attribute canvas
specifies the window visibility.
Values: "hidden", "iconic", "normal", "maximal"
Initial value: "normal"
cliph
-- height of clipping region
The graphics context attribute cliph
specifies the height of
the clipping region.
Initial value: &null (clipping disabled)
See also: clipw, clipx, clipy, and Clip()
clipw
-- width of clipping region
The graphics context attribute clipw
specifies the width of
the clipping region.
Initial value: &null (clipping disabled)
See also: cliph, clipx, clipy, and Clip()
clipx
-- x-coordinate of clipping region
The graphics context attribute clipx
specifies the left edge
of the clipping region.
Initial value: &null (clipping disabled)
See also: cliph, clipw, clipy, and Clip()
clipy
-- y-coordinate of clipping region
The graphics context attribute clipy
specifies the top edge
of the clipping region.
Initial value: &null (clipping disabled)
See also: cliph, clipw, clipx, and Clip()
col
-- text cursor column
The canvas attribute col
specifies the horizontal position
of the text cursor, measured in characters.
See also: cursor, row, x, and y
columns
-- window width in characters
The graphics context attribute columns
specifies the number
of text columns available using the current font.
Initial value: 80
See also: lines and width
cursor
-- text cursor visibility flag
The canvas attribute cursor
specifies whether the text cursor
is actually visible on the screen. The text cursor appears only when the
program is blocked waiting for input.
Values: "on", "off"
Initial value: "off"
See also: col, echo, row, x, and y
depth
-- number of bits per pixel
The read-only canvas attribute depth
gives the number of bits
allocated to each pixel by the graphics system.
descent
-- text font descent
The read-only graphics context attribute descent
gives the
distance, in pixels, that the current text font extends below the baseline.
See also: ascent and fheight
display
-- name of display screen
The canvas attribute display
specifies the particular monitor
on which the window appears. It cannot be changed after the window is opened.
displayheight
-- height of
display screen
The read-only canvas attribute displayheight
gives the height
in pixels of the display screen on which the window is placed.
See also: displaywidth
displaywidth
-- width of display
screen
The read-only canvas attribute displaywidth
gives the width
in pixels of the display screen on which the window is placed.
See also: displayheight
drawop
-- drawing mode
The graphics context attribute drawop
specifies the way in
which newly drawn pixels are combined with the pixels that are already in
a window.
Values: "copy", "reverse"
Initial value: "copy"
See also: bg, fg, and reverse
dx
-- horizontal translation
The graphics context attribute dx
specifies a horizontal offset
that is added to the x value of every coordinate pair before interpretation.
Initial value: 0
See also: dy
dy
-- vertical translation
The graphics context attribute dy
specifies a vertical offset
that is added to the y value of every coordinate pair before interpretation.
Initial value: 0
See also: dx
echo
-- character echoing flag
The canvas attribute echo
specifies whether keyboard characters
read by WRead()
and WReads()
are echoed in the
window. When echoing is enabled, the characters are echoed at the text cursor
position.
Values: "on", "off"
Initial value: "on"
See also: cursor, WRead(), and WReads()
fg
-- foreground color
The graphics context attribute fg
specifies the current foreground
color.
Initial value: "black"
See also: bg, drawop, gamma, reverse, and Fg()
fheight
-- text font height
The read-only graphics context attribute fheight
gives the
overall height of the current text font.
See also: ascent, descent, fwidth, and leading
fillstyle
-- area filling style
The graphics context attribute fillstyle
specifies whether
a pattern is to be used when drawing. The fill style affects lines and text
as well as solid figures. The pattern itself is set by the pattern
attribute.
Values: "solid", "textured", "masked"
Initial value: "solid"
See also: linestyle and pattern
font -- text font name
The graphics context attribute font
specifies the current text
font.
Initial value: "fixed"
See also: Font()
fwidth -- text font width
The read-only graphics context attribute fwidth
gives the width
of the widest character of the current text font.
See also: fheight
gamma
-- color correction factor
The graphics context attribute gamma
specifies the amount of
color correction applied when converting between Icon color specifications
and those of the underlying graphics system. A value of 1.0 results in no
color correction. Larger values produce lighter, less saturated colors.
Values: real values greater than zero
Initial value: system dependent
See also: fg and bg
height
-- window height in pixels
The canvas attribute height
specifies the height of the window.
Initial value: enough for 12 lines of text
See also: lines, size, and width
iconimage
-- window image when
iconified
The canvas attribute iconimage
names a file containing an image
to be used as the representation of the window when iconified.
Initial value: ""
See also: iconlabel, iconpos, and image
iconlabel
-- window label when
iconified
The canvas attribute iconlabel
specifies a label to be used
as the representation of the window when iconified.
Initial value: initial value of label attribute
See also: iconimage, iconpos, and label
iconpos
-- window position when iconified
The write-only canvas attribute iconpos
specifies the location
of the iconified window as a string containing comma-separated x- and y-coordinates.
See also: iconimage and iconlabel
image
-- source of window contents
The write-only canvas attribute image
names a file containing
an image to be used as the initial contents of a window when it is opened.
See also: iconimage
label
-- window label
The canvas attribute label
specifies a title used to identify
the window.
Initial value: ""
See also: iconlabel
leading
-- text line advancement
The graphics context attribute leading
specifies the vertical
spacing of successive lines of text written in a window.
Initial value: font height
See also: fheight
lines
-- window height in characters
The graphics context attribute lines
specifies the number of
text lines available using the current font.
Initial value: 12
See also: columns and height
linestyle
-- line style
The graphics context attribute linestyle
specifies the form
of drawn lines.
Values: "solid", "dashed", "striped"
Initial value: "solid"
See also: fillstyle and linewidth
linewidth
-- line width
The graphics context attribute linewidth
specifies the width
of drawn lines.
Initial value: 1
See also: linestyle
pattern
-- filling pattern specification
The graphics context attribute pattern
specifies the particular
pattern to be used for drawing when the fillstyle
attribute
is set to "textured"
or "masked"
.
Values: "black", "verydark", "darkgray", "gray", "lightgray",
"verylight", "white", "vertical", "diagonal", "horizontal",
"grid", "trellis", "checkers", "grains", "scales", "waves",
"width,#hexdigits"
Initial value: "black"
See also: fillstyle and Pattern()
pointer
-- shape of mouse indicator
The canvas attribute pointer
specifies the shape of the figure
that represents the mouse position.
Values: system dependent
Initial value: system dependent
See also: pointercol, pointerrow, pointerx, and pointery
pointercol
-- mouse location column
The canvas attribute pointercol
gives the horizontal position
of the mouse in terms of text columns.
See also: pointer, pointerrow, pointerx, and pointery
pointerrow
-- mouse location row
The canvas attribute pointerrow
gives the vertical position
of the mouse in terms of text lines.
See also: pointer, pointercol, pointerx, and pointery
pointerx
-- mouse location x-coordinate
The canvas attribute pointerx
specifies the horizontal position
of the mouse in pixels.
See also: pointer, pointercol, pointerrow, and pointery
pointery
-- mouse location y-coordinate
The canvas attribute pointery
specifies the vertical position
of the mouse in pixels.
See also: pointer, pointercol, pointerrow, and pointerx
pos
-- position of window on display
screen
The canvas attribute pos
specifies the window position as a
string containing comma-separated x- and y-coordinates. Attempts to read
or write the position fail if the canvas is hidden.
See also: posx and posy
posx
-- x-coordinate of window position
The canvas attribute posx
specifies the horizontal window position.
Attempts to read or write the position fail if the canvas is hidden.
See also: pos and posy
posy
-- y-coordinate of window position
The canvas attribute posy
specifies the vertical window position.
Attempts to read or write the position fail if the canvas is hidden.
See also: pos and posx
resize
-- user resizing flag
The canvas attribute resize
specifies whether the user is allowed
to resize the window by interaction with the graphics system.
Values: "on", "off"
Initial value: "off"
reverse
-- color reversal flag
The graphics context attribute reverse
interchanges the foreground
and background colors when it is changed from "off"
to "on"
or from "on"
to "off"
.
Values: "on", "off"
Initial value: "off"
See also: bg, fg, and drawop
row
-- text cursor row
The canvas attribute row
specifies the vertical position of
the text cursor, measured in characters.
See also: col, cursor, x, and y
size
-- window size in pixels
The canvas attribute size
specifies the window size as a string
containing comma-separated width and height values.
Initial value: enough for 12 lines of 80-column text
See also: columns, height, lines, and width
width
-- window width in pixels
The canvas attribute width
specifies the width of the window.
Initial value: enough for 80 columns of text
See also: columns, height, and size
x
-- text cursor x-coordinate
The canvas attribute x
specifies the horizontal position of
the text cursor, measured in pixels.
See also: col, cursor, row, and y
y
-- text cursor y-coordinate
The canvas attribute y
specifies the vertical position of the
text cursor, measured in pixels.
See also: col, cursor, row, and x
Back to Contents