DOKK / manpages / debian 10 / libxaw7-dev / Xaw.3.en
Xaw(3) Library Functions Manual Xaw(3)


Xaw - X Athena Widgets

Xaw is a widget set based on the X Toolkit Intrinsics (Xt) Library. This release by the X.Org Foundation includes additions and modifications originally made for The XFree86 Project, Inc. This manual page describes these changes as well as some of the common interfaces between its version and the previous X Consortium release (Xaw6).

The bulk of the Xaw documentation is located in the API specification which may be installed in /usr/share/doc/libxaw7-dev, or found on the X.Org website.

All of the Xaw widgets now have the additional translations call-proc, declare, get-values and set-values. The syntax for these actions is:

action-name (boolean-expression, arguments)

Action-name is one of call-proc, declare, get-values or set-values.

Boolean-expression is composed with the operators | (or), & (and), ^ (xor), and ~ (not). The operands can be a variable name, which starts with a $; a resource name without the bindings . or *; or a constant name, including mine (event->xany.window == XtWindow(widget)), faked (event->xany.send_event != 0), true (1) and false (0).

Arguments are self-explanatory; when starting with a $ they name a variable, otherwise, they indicate a resource name.

This action allows the evaluation of a boolean expression in the first parameter before calling a action procedure. The procedure is only called if the expression evaluates as true. Example:
call-proc("$inside & $pressed", notify)
    
This action is used to create new variables or change their values. Any number of variable-value tuples may be specified. Example:
declare(1, $pressed, 1)
    
This action reads a widget resource value into a variable. Any number of variable-value tuples may be specified. Example:
get-values(1, $fg, foreground, $bg, background)
    
This action sets a widget resource to the given value, which may be a variable. Any number of variable-value tuples may be specified. Example:
set-values(1, foreground, $bg, background, $fg)
    

Here is a sample translation to make a label widget behave like a button:

<Map>:      get-values(1, $fg, foreground, $bg, background)\n\
<Btn1Down>: set-values(1, foreground, yellow, background, gray30)\n\
<Btn1Up>:   set-values(1, foreground, $fg, background, $bg)

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
Sets the arc mode. Accepted modes are "pieslice" and "chord", which set the arc to ArcPieSlice or ArcChord, respectively. Example:
arc-mode chord
    
Sets the background color. color-spec must a valid color specification. Example:
background red
    
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
    
Sets the pixmap for the clip mask. Requires a pixmap parameter, as described in the PIXMAPS section below. Example:
clip-mask xlogo11
    
Sets the clip x and y origin. Requires two arguments, the x and y coordinates. Example:
clip-origin 10,10
    
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
    
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
    
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
    
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
    
Sets the dashes for line drawing. Accepts up to 127 arguments. Example:
dashes 3,7 9,10
    
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
    
Draws a rectangle. Requires four arguments, which are the start and end coordinate pairs. Example:
draw-rect +1,+1,-5,-5
    
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!"
Sets graphics exposures in the GC. Allowed parameters are a integer or the strings "true", "false", "on" and "off". Example:
exposures true
    
Like draw-arc, but fills the contents of the arc with the currently selected foreground. Example:
fill-arc +0,+0,-1,-1,0,180
    
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
    
Like draw-rect, but fills the contents of the rectangle with the selected foreground color. Example:
fill-rect +10,+10,-20,-20
    
Sets the fill rule. Accepted parameters are "evenodd" and "winding", which set the fill rule to EvenOddRule or WindingRule, respectively. Example:
fill-rule winding
    
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
    
Sets the font for text functions. Example:
font -*-*-*-R-*-*-*-120-*-*-*-*-ISO8859-1
    
Like background, but sets the current foreground color. Example:
foreground blue
    
This command is useful when you want to draw only in the region that really needs to be repainted. Requires no arguments.
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
    
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
    
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
    
Draws a line with the current foreground color. Requires four arguments, the starting and ending coordinate pairs. Example:
line +0,+0, -1,-1
    
Selects a line width for drawing. Example:
line-width 2
    
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
    
Draws a list of lines. Any number of argument pairs may be supplied. Example:
lines +0,-1, -1,-1, -1,+0
    
Identical to draw-string, but also uses the background color. Example:

paint-string 10,20, "Sample text"
Draws a point. Requires two arguments, a coordinate pair. Example:
point +10,+10
    
Sets the plane mask. Requires an integer parameter. Example:
plane-mask -1
    
Draws a list of points at the specified coordinates. Example:
points +1,+2, +1,+4, +1,+6
    
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
    
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
    
Sets the pixmap for a stipple. Requires a pixmap parameter, as described in the PIXMAPS section below. Example:
stipple plaid
    
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
    
Sets the pixmap for a tile. Requires a pixmap parameter, as described in the PIXMAPS section below. Example:
tile xlogo11?foreground=red&background=gray80
    
Sets the tile stipple x and y origin. Requires two arguments, a x and y coordinate. Example:
ts-origin 10,10
    
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

A String to Pixmap converter has been added to Xaw. This converter is meant to be extended, and has enough abstraction to allow loading several image formats. It uses a format that resembles a URL, with the syntax:

[type:]name[?arg=val[{&}...]]

Type can be one of bitmap, gradient or xpm.

Name may be a file name, or, in the case of type gradient, may be either vertical or horizontal.

Arg=val is a list of arguments to the converter. An argument list is preceded by a question mark, and multiple arguments are separated by ampersands. The most common arguments are foreground and background. Gradients also support the arguments start and end (colors with which to start and end the gradient); the steps argument, to allow using less colors; and the dimension argument to specify the size of the gradient. The xpm converter understands the closeness argument, which aids in using fewer colors (useful if you have a limited colormap).

Most of the changes to this version of the Xaw library were done in the TextWidget, TextSrcObject, TextSinkObject and related files.

A couple of highly visible changes in the Text widget are due to many bugs in the Xaw6 implementation involving scrollbars and auto-resizing. Scrollbars being added or removed caused several problems in keeping the text cursor visible, and in Xaw6 it was very easy to have a widget thinking the cursor was visible, when it was not. Also, permitting automatic resizing of the widget to a larger geometry created other problems, making it difficult to have a consistent layout in the application, and, if the window manager did not interfere, windows larger than the screen could result. Therefore, some functionality involving scrollbars and auto-resizing has been disabled; see the section on new and modified Text widget resources below.

The Text widget's default key bindings were originally based on the Emacs text editor. In this release, even more operations familiar to Emacs users have been added. New text actions include:

Indents text blocks. Not bound by default. The Text widget also does not attempt to perform auto-indentation of its source object by default.
Resets the keyboard state. Reverts the action multiplier to 1, and if undo is enabled, toggles between undo and redo. Bound by default to Control<Key>G.
In this version of Xaw, text killed in any text field is kept in memory, allowing cut and paste operations internally to the program between text fields. Bound by default to Meta<Key>Y.
Listed here only for purposes of documentation. Called by default when one of the characters 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, or - is typed, allowing composition of the multiplication number of text actions.
Sets the input focus of the top level widget to the text field. Not enabled by default, but bound to the <Btn1Down> event.
Toggles overwrite mode. In overwrite mode, any text inserted in a text field will replace existing text. Bound by default to <Key>Insert.
Sets the enableUndo resource of the textSrcObject. Not enabled by default, but bound to Control<Key>_.

New and modified Text widget resources include:

Sets the text justification. Can be one of left, right, center, or full. Only enabled when the autoFill resource is set, and the resources leftColumn and rightColumn are correctly set.
Specifies the left column at which to break text. Text lines started with an alphanumeric character will automatically start at this column.
Allows installation of a callback to be called every time the cursor is moved, and/or the file changes its size. The callback is called with a pointer to a structure containing the following data:
typedef struct {

int line_number;
int column_number;
XawTextPosition insert_position;
XawTextPosition last_position;
Boolean overwrite_mode; } XawTextPositionInfo;
This callback is intended to help programmers write text editors based on the Xaw widget set.
No longer supported, but recognized for backward compatibility with resource specifications written for the Xaw6 Text widget.
Specifies the right column at which to break text. Text lines started with an alphanumeric character will automatically end at this column.
These resources control the placement of scrollbars on the left and bottom edges of the Text widget. They accept the values XawtextScrollAlways and XawtextScrollNever. A converter is registered for this resource that will convert the following strings: always and never. The value XawtextScrollWhenNeeded (and whenNeeded, recognized by the converter), is accepted for backwards compatibility with resource specifications written for the Xaw6 Text widget, but ignored (effectively treated as XawtextScrollNever).

The textSrcObject allows display of its contents to more than one window, and also stores undo information. The new resources for the textSrcObject are:

Previous versions of Xaw had this resource in subclasses of the TextSource object. This was changed to make it possible to tell the callback the state of the text when undo is enabled.
A boolean resource that enables or disables the undo function. The default value is False.
Like the callback resource, this resource was previously in subclasses of the TextSource object. It is now in the textSrcObject to control the changed/unchanged state when undo is enabled.

The textSinkObject subclasses asciiSinkObject and multiSinkObject have been changed slightly to use a new cursor shape (no longer a caret at the baseline) that indicates the input focus of the text widget, and allow specification of the cursor color. The new resource is:

Sets the cursor color of the text. This color is also used to draw selected text.

The simpleMenuWidget algorithm to lay out menu entries has been changed to enable multiple columns when a single column does not fit on the screen. It was also modified to enable submenus.

A new resource has been added to the smeBSBObject to allow binding submenus to it. The new resource is:

Specifies the name of the popup widget to be popped up when the pointer is over the menu entry, or NULL. Note that the named menu must be a child of the popup parent of the smeBSBObject.

The original X Consortium version of the Athena Widget Set and its documentation were the work of many people, including Chris D. Peterson, Ralph Swick, Mark Ackerman, Donna Converse, Jim Fulton, Loretta Guarino-Reid, Charles Haynes, Rich Hyde, Mary Larson, Joel McCormack, Ron Newman, Jeanne Rich, Terry Weissman, Mike Gancarz, Phil Karlton, Kathleen Langone, Ram Rao, Smokey Wallace, Al Mento, and Jean Diaz.

The additions and modifications to Xaw which were originally made for XFree86 were written by Paulo César Pereira de Andrade.

Athena Widget Set - C Language Interface

libXaw 1.0.13 X Version 11