All of the
Xaw widgets have now the additional resource displayList. This resource allows drawing the widget decorations using commands embedded in a resource string. The displayList resource has the syntax:[class-name:]function-name arguments[[{;\n}]...]
Class-name is any registered set of functions to draw in the widget. Currently the only existing class is xlib, which provides access to the Xlib drawing primitives.
Function-name is the drawing or configuration function to be called, described bellow.
Arguments may be anything suitable to the displayList function being called. When the function requires a coordinate, the syntax is {+-}<integer> or <integer>/<integer>. Examples:
+0,+0 top, left
-0,-0 bottom, right
-+10,-+10 bottom+10, right+10
+0,1/2 left, vertical-center
arc-mode mode
Sets the arc mode. Accepted
modes are "pieslice" and "chord", which set the arc to ArcPieSlice or ArcChord, respectively. Example:
arc-mode chord
bg color-spec
background color-spec Sets the background color.
color-spec must a valid color specification. Example:
background red
cap-style style
Sets the cap style. Accepted
styles are "notlast", "butt", "round", and "projecting", which set the cap style to CapNotLast, CapBut, CapRound or CapProjecting, respectively. Example:
cap-style round
clip-mask pixmap-spec
Sets the pixmap for the clip mask. Requires a pixmap parameter, as described in the
PIXMAPS section below. Example:
clip-mask xlogo11
clip-origin x,y
Sets the clip x and y origin. Requires two arguments, the x and y coordinates. Example:
clip-origin 10,10
clip-rects x1,y1,x2,y2 [...,xn,yn]
clip-rectangles x1,y1,x2,y2 [...,xn,yn] Sets a list of rectangles to the clip mask. The number of arguments must be a multiple of four. The arguments are coordinates. The parser calculates the width and height of the rectangles. Example:
clip-rects 0,0,10,20, 20,10,30,30
coord-mode mode
Changes the coord mode for
fill-polygon, draw-lines, and draw-points. Accepted parameters are "modeorigin" and "previous", that sets the coord mode to CoordModeOrigin or CoordModePrevious, respectively. Example:
coord-mode previous
copy-area {pixmap-spec|.},dstx,dsty[,x2,y2,srcx,srcy]
Calls XCopyArea. The character
. means copy the window contents; pixmap-spec is as defined in the PIXMAPS section below. X2 and y2 are the coordinates of the end copy, not the width and height; if not defined, the parser calculates them. src_x and src_y default to zero. Example:
copy-area Term,10,10
copy-plane {pixmap-spec|.},dstx,dsty[,x2,y2,srcx,srcy,plane]
Calls XCopyPlane. The character
. means copy the window contents; pixmap-spec is as defined in the PIXMAPS section below. X2 and y2 are the coordinates of the end copy, not the width and height; if not defined, the parser calculates them. src_x and src_y default to zero. Plane defaults to one. Example:
copy-plane star,10,10
dashes i1[...,in]
Sets the dashes for line drawing. Accepts up to 127 arguments. Example:
dashes 3,7 9,10
draw-arc x1,y1,x2,y2[,start-angle,end-angle]
Draws an arc. The four first arguments are the rectangle enclosing the arc. The two remaining arguments, if specified, are the start and end angle, in degrees. Example:
draw-arc +0,+0,-1,-1,0,90
draw-rect x1,y1,x2,y2
draw-rectangle x1,y1,x2,y2 Draws a rectangle. Requires four arguments, which are the start and end coordinate pairs. Example:
draw-rect +1,+1,-5,-5
draw-string x,y,"string"
Draws a text string. Requires three arguments, a x coordinate, a y coordinate, and a string. Strings that have white space can be quoted with the
" character; the backslash character \ can also be used, but it will be necessary escape it twice. Example:
draw-string 10,10, "Hello world!"
exposures boolean
Sets graphics exposures in the GC. Allowed parameters are a integer or the strings "true", "false", "on" and "off". Example:
exposures true
fill-arc x1,y1,x2,y2[,start-angle,end-angle]
Like
draw-arc, but fills the contents of the arc with the currently selected foreground. Example:
fill-arc +0,+0,-1,-1,0,180
fill-poly x1,y1 [...,xn,yn]
fill-polygon x1,y1 [...,xn,yn] Like
draw-lines, but fills the enclosed polygon and joins the first and last point, if they are not at the same position. Example:
fill-poly +0,+10, +10,+20, +30,+0
fill-rect x1,y1,x2,y2
fill-rectangle x1,y1,x2,y2 Like
draw-rect, but fills the contents of the rectangle with the selected foreground color. Example:
fill-rect +10,+10,-20,-20
fill-rule rule
Sets the fill rule. Accepted parameters are "evenodd" and "winding", which set the fill rule to EvenOddRule or WindingRule, respectively. Example:
fill-rule winding
fill-style style
Sets the fill style. Allowed parameters are "solid", "tiled", "stippled" and "opaquestippled", which set the fill style to FillSolid, FillTiled, FillStippled or FillOpaqueStippled, respectively. Example:
fill-style tiled
font font-spec
Sets the font for text functions. Example:
font -*-*-*-R-*-*-*-120-*-*-*-*-ISO8859-1
fg color-spec
foreground color-spec Like
background, but sets the current foreground color. Example:
foreground blue
mask
This command is useful when you want to draw only in the region that really needs to be repainted. Requires no arguments.
function function-spec
Sets the specific GC function. Allowed parameters are "set", "clear", "and", "andreverse", "copy", "andinverted", "noop", "xor", "or", "nor", "equiv", "invert", "orreverse", "copyinverted" and "nand", which set the function to GXset, GXclear, GXand, GXandReverse, GXcopy, GXandInverted, GXnoop, GXxor, GXor, GXnor, GXequiv, GXinvert, GXorReverse, GXcopyInverted or GXnand, respectively. Example:
function xor
join-style style
Sets the join style. Allowed parameters are "miter", "round" and "bevel", which set the join style to JoinMiter, JoinRound and JoinBevel, respectively. Example:
join-style round
image {pixmap-spec},xs,ys,[xe,ye]
This function is implemented as a way to quickly compose complex decorations in widgets.
Pixmap-spec is as defined in the PIXMAPS section below. xs and ys are the coordinates from where to start copying the pixmap; xe and ye are optional (they default to xs + pixmap.width and ys + pixmap.height, respectively). If the pixmap has a mask, the copy is masked accordingly. Example:
image pixmap.xpm,0,0,20,20
line x1,y1,x2,y2
draw-line x1,y1,x2,y2 Draws a line with the current foreground color. Requires four arguments, the starting and ending coordinate pairs. Example:
line +0,+0, -1,-1
line-width integer
Selects a line width for drawing. Example:
line-width 2
line-style style
Sets the line style. Accepted parameters are "solid", "onoffdash" and "doubledash", which set the line style to LineSolid, LineOnOffDash or LineDoubleDash, respectively. Example:
line-style onoffdash
lines x1,y1,x2,y2 [...,xn,yn]
draw-lines x1,y1,x2,y2 [...,xn,yn] Draws a list of lines. Any number of argument pairs may be supplied. Example:
lines +0,-1, -1,-1, -1,+0
paint-string x,y,"string"
Identical to draw-string, but also uses the background color. Example:
paint-string 10,20, "Sample text"
point x,y
draw-point x,y Draws a point. Requires two arguments, a coordinate pair. Example:
point +10,+10
plane-mask integer
Sets the plane mask. Requires an integer parameter. Example:
plane-mask -1
points x1,y1 [...,xn,yn]
draw-points x1,y1 [...,xn,yn] Draws a list of points at the specified coordinates. Example:
points +1,+2, +1,+4, +1,+6
segments x1,y1,x2,y2 [...,xn,yn]
draw-segments x1,y1,x2,y2 [...,xn,yn] Draws a list of segment lines. The number of parameters must be multiple of 4. Example:
segments +1,+2,+1,-3, +2,-2,-3,-2
shape-mode mode
Sets the shape mode used in
fill-polygon. Accepted parameters are "complex", "convex" or "nonconvex", which set the shape mode to Complex, Convex or Nonconvex, accordingly. Example:
shape-mode convex
stipple pixmap-spec
Sets the pixmap for a stipple. Requires a pixmap parameter, as described in the
PIXMAPS section below. Example:
stipple plaid
subwindow-mode mode
Sets the subwindow mode in the GC. Accepted parameters are "includeinferiors" and "clipbychildren", which set the subwindow mode to IncludeInferiors or ClipByChildren, respectively. Example:
subwindow-mode includeinferiors
tile pixmap-spec
Sets the pixmap for a tile. Requires a pixmap parameter, as described in the
PIXMAPS section below. Example:
tile xlogo11?foreground=red&background=gray80
ts-origin x,y
Sets the tile stipple x and y origin. Requires two arguments, a x and y coordinate. Example:
ts-origin 10,10
umask
Disables the GC mask, if it has been set with the command mask. Requires no arguments.
Example for drawing a shadow effect in a widget:
foreground gray30;\
draw-lines +1,-1,-1,-1,-1,+1;\
foreground gray85;\
draw-lines -1,+0,+0,+0,+0,-1