2 .\" Copyright (c) 1999 by The XFree86 Project, Inc.
4 .\" Permission is hereby granted, free of charge, to any person obtaining a
5 .\" copy of this software and associated documentation files (the "Software"),
6 .\" to deal in the Software without restriction, including without limitation
7 .\" the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 .\" and/or sell copies of the Software, and to permit persons to whom the
9 .\" Software is furnished to do so, subject to the following conditions:
11 .\" The above copyright notice and this permission notice shall be included in
12 .\" all copies or substantial portions of the Software.
14 .\" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 .\" IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 .\" FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17 .\" THE XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
18 .\" WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
19 .\" OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 .\" Except as contained in this notice, the name of the XFree86 Project shall
23 .\" not be used in advertising or otherwise to promote the sale, use or other
24 .\" dealings in this Software without prior written authorization from the
27 .\" Author: Paulo César Pereira de Andrade
44 .TH Xaw __libmansuffix__ __vendorversion__
46 Xaw \- X Athena Widgets
49 is a widget set based on the X Toolkit Intrinsics (Xt) Library. This
50 release by the X.Org Foundation includes additions and modifications
51 originally made for The XFree86 Project, Inc. This manual page describes
52 these changes as well as some of the common interfaces between its version
53 and the previous X Consortium release (Xaw6).
55 The bulk of the Xaw documentation is located in the API specification
56 which may be installed in __docdir__, or found on the X.Org website.
58 All of the \fIXaw\fR widgets now have the additional translations
59 .B call-proc, declare, get-values
60 and \fBset-values\fP. The syntax for these actions is:
62 .I action-name \fP(\fIboolean-expression\fP, \fIarguments\fP)
64 \fBAction-name\fP is one of \fIcall-proc\fP, \fIdeclare\fP,
65 \fIget-values\fP or \fIset-values\fP.
67 \fBBoolean-expression\fP is composed with the operators \fI|\fR (or), \fI&\fR
68 (and), \fI^\fR (xor), and \fI~\fR (not). The operands can be a variable name,
69 which starts with a \fI$\fR; a resource name without the bindings \fI.\fP
70 or \fI*\fP; or a constant name, including \fImine\fP (event->xany.window
71 == XtWindow(widget)), \fIfaked\fP (event->xany.send_event != 0), \fItrue\fP (1)
74 \fBArguments\fP are self-explanatory; when starting with a \fI$\fP they name
75 a variable, otherwise, they indicate a resource name.
77 .B call-proc \fP(\fIboolean-expression\fP, \fIprocedure-name\fP)
78 This action allows the evaluation of a boolean expression in the first
79 parameter before calling a action procedure. The procedure is only called
80 if the expression evaluates as true. Example:
82 call-proc("$inside & $pressed", notify)
85 .B declare \fP(\fIboolean-expression\fP, \fIvariable\fP, \fIvalue\fP, ...)
86 This action is used to create new variables or change their values. Any
87 number of variable-value tuples may be specified. Example:
89 declare(1, $pressed, 1)
92 .B get-values \fP(\fIboolean-expression\fP, \fIvariable\fP, \fIvalue\fP, ...)
93 This action reads a widget resource value into a variable. Any number of
94 variable-value tuples may be specified. Example:
96 get-values(1, $fg, foreground, $bg, background)
99 .B set-values \fP(\fIboolean-expression\fP, \fIvariable\fP, \fIvalue\fP, ...)
100 This action sets a widget resource to the given value, which may be a
101 variable. Any number of variable-value tuples may be specified. Example:
103 set-values(1, foreground, $bg, background, $fg)
106 Here is a sample translation to make a label widget behave like a button:
109 <Map>: get-values(1, $fg, foreground, $bg, background)\en\e
110 <Btn1Down>: set-values(1, foreground, yellow, background, gray30)\en\e
111 <Btn1Up>: set-values(1, foreground, $fg, background, $bg)
114 All of the \fBXaw\fP widgets have now the additional resource
115 \fIdisplayList\fP. This resource allows drawing the widget decorations
116 using commands embedded in a resource string. The displayList resource has
119 \fI[class-name:]function-name arguments[[{;\en}]...]\fP
121 \fBClass-name\fP is any registered set of functions to draw in the widget.
122 Currently the only existing class is \fIxlib\fP, which provides access to
123 the Xlib drawing primitives.
125 \fBFunction-name\fP is the drawing or configuration function to be called,
128 \fBArguments\fP may be anything suitable to the displayList function being
129 called. When the function requires a coordinate, the syntax is
130 \fI{+-}<integer>\fP or \fI<integer>/<integer>\fP. Examples:
134 -+10,-+10 bottom+10, right+10
135 +0,1/2 left, vertical-center
139 Sets the arc mode. Accepted \fImode\fPs are "pieslice" and "chord", which
140 set the arc to ArcPieSlice or ArcChord, respectively. Example:
147 .B background \fPcolor-spec
148 Sets the background color. \fIcolor-spec\fP must a valid color
149 specification. Example:
154 .B cap-style \fPstyle
155 Sets the cap style. Accepted \fIstyle\fPs are "notlast", "butt", "round",
156 and "projecting", which set the cap style to CapNotLast, CapBut, CapRound
157 or CapProjecting, respectively. Example:
162 .B clip-mask \fPpixmap-spec
163 Sets the pixmap for the clip mask. Requires a pixmap parameter, as
164 described in the \fBPIXMAPS\fP section below. Example:
169 .B clip-origin \fPx,y
170 Sets the clip x and y origin. Requires two arguments, the x and y
171 coordinates. Example:
176 .B clip-rects \fPx1,y1,x2,y2 [...,xn,yn]
178 .B clip-rectangles \fPx1,y1,x2,y2 [...,xn,yn]
179 Sets a list of rectangles to the clip mask. The number of arguments must
180 be a multiple of four. The arguments are coordinates. The parser
181 calculates the width and height of the rectangles. Example:
183 clip-rects 0,0,10,20, 20,10,30,30
186 .B coord-mode \fPmode
187 Changes the coord mode for \fIfill-polygon\fP, \fIdraw-lines\fP, and
188 \fIdraw-points\fP. Accepted parameters are "modeorigin" and "previous",
189 that sets the coord mode to CoordModeOrigin or CoordModePrevious,
190 respectively. Example:
195 .B copy-area \fP{pixmap-spec|.},dstx,dsty[,x2,y2,srcx,srcy]
196 Calls XCopyArea. The character \fI.\fP means copy the window contents;
197 pixmap-spec is as defined in the \fBPIXMAPS\fP section below. \fIX2\fP and
198 \fIy2\fP are the coordinates of the end copy, not the width and height; if
199 not defined, the parser calculates them. \fIsrc_x\fP and \fIsrc_y\fP
200 default to zero. Example:
205 .B copy-plane \fP{pixmap-spec|.},dstx,dsty[,x2,y2,srcx,srcy,plane]
206 Calls XCopyPlane. The character \fI.\fP means copy the window contents;
207 pixmap-spec is as defined in the \fBPIXMAPS\fP section below. \fIX2\fP and
208 \fIy2\fP are the coordinates of the end copy, not the width and height; if
209 not defined, the parser calculates them. \fIsrc_x\fP and \fIsrc_y\fP
210 default to zero. \fIPlane\fP defaults to one. Example:
212 copy-plane star,10,10
215 .B dashes \fPi1[...,in]
216 Sets the dashes for line drawing. Accepts up to 127 arguments. Example:
221 .B draw-arc \fPx1,y1,x2,y2[,start-angle,end-angle]
222 Draws an arc. The four first arguments are the rectangle enclosing the
223 arc. The two remaining arguments, if specified, are the start and end
224 angle, in degrees. Example:
226 draw-arc +0,+0,-1,-1,0,90
229 .B draw-rect \fPx1,y1,x2,y2
231 .B draw-rectangle \fPx1,y1,x2,y2
232 Draws a rectangle. Requires four arguments, which are the start and end
233 coordinate pairs. Example:
235 draw-rect +1,+1,-5,-5
238 .B draw-string \fPx,y,"string"
239 Draws a text string. Requires three arguments, a x coordinate, a y
240 coordinate, and a string. Strings that have white space can be quoted with
241 the \fI"\fP character; the backslash character \fI\e\fP can also be used,
242 but it will be necessary escape it twice. Example:
244 draw-string 10,10, "Hello world!"\fP
247 .B exposures \fPboolean
248 Sets graphics exposures in the GC. Allowed parameters are a integer or the
249 strings "true", "false", "on" and "off". Example:
254 .B fill-arc \fPx1,y1,x2,y2[,start-angle,end-angle]
255 Like \fIdraw-arc\fP, but fills the contents of the arc with the currently
256 selected foreground. Example:
258 fill-arc +0,+0,-1,-1,0,180
261 .B fill-poly \fPx1,y1 [...,xn,yn]
263 .B fill-polygon \fPx1,y1 [...,xn,yn]
264 Like \fIdraw-lines\fP, but fills the enclosed polygon and joins the first
265 and last point, if they are not at the same position. Example:
267 fill-poly +0,+10, +10,+20, +30,+0
270 .B fill-rect \fPx1,y1,x2,y2
272 .B fill-rectangle \fPx1,y1,x2,y2
273 Like \fIdraw-rect\fP, but fills the contents of the rectangle with the
274 selected foreground color. Example:
276 fill-rect +10,+10,-20,-20
280 Sets the fill rule. Accepted parameters are "evenodd" and "winding", which
281 set the fill rule to EvenOddRule or WindingRule, respectively. Example:
286 .B fill-style \fPstyle
287 Sets the fill style. Allowed parameters are "solid", "tiled", "stippled" and
288 "opaquestippled", which set the fill style to FillSolid, FillTiled,
289 FillStippled or FillOpaqueStippled, respectively. Example:
295 Sets the font for text functions. Example:
297 font -*-*-*-R-*-*-*-120-*-*-*-*-ISO8859-1
302 .B foreground \fPcolor-spec
303 Like \fIbackground\fP, but sets the current foreground color. Example:
309 This command is useful when you want to draw only in the region that really
310 needs to be repainted. Requires no arguments.
312 .B function \fPfunction-spec
313 Sets the specific GC function. Allowed parameters are "set", "clear", "and",
314 "andreverse", "copy", "andinverted", "noop", "xor", "or", "nor", "equiv",
315 "invert", "orreverse", "copyinverted" and "nand", which set the function to
316 GXset, GXclear, GXand, GXandReverse, GXcopy, GXandInverted, GXnoop, GXxor,
317 GXor, GXnor, GXequiv, GXinvert, GXorReverse, GXcopyInverted or GXnand,
318 respectively. Example:
323 .B join-style \fPstyle
324 Sets the join style. Allowed parameters are "miter", "round" and "bevel",
325 which set the join style to JoinMiter, JoinRound and JoinBevel,
326 respectively. Example:
331 .B image \fP{pixmap-spec},xs,ys,[xe,ye]
332 This function is implemented as a way to quickly compose complex
333 decorations in widgets. \fIPixmap-spec\fP is as defined in the
334 \fBPIXMAPS\fP section below. \fIxs\fP and \fIys\fP are the coordinates from
335 where to start copying the pixmap; \fIxe\fP and \fIye\fP are optional (they
336 default to xs + pixmap.width and ys + pixmap.height, respectively). If the
337 pixmap has a mask, the copy is masked accordingly. Example:
339 image pixmap.xpm,0,0,20,20
342 .B line \fPx1,y1,x2,y2
344 .B draw-line \fPx1,y1,x2,y2
345 Draws a line with the current foreground color. Requires four arguments,
346 the starting and ending coordinate pairs. Example:
351 .B line-width \fPinteger
352 Selects a line width for drawing. Example:
357 .B line-style \fPstyle
358 Sets the line style. Accepted parameters are "solid", "onoffdash" and
359 "doubledash", which set the line style to LineSolid, LineOnOffDash or
360 LineDoubleDash, respectively. Example:
365 .B lines \fPx1,y1,x2,y2 [...,xn,yn]
367 .B draw-lines \fPx1,y1,x2,y2 [...,xn,yn]
368 Draws a list of lines. Any number of argument pairs may be supplied.
371 lines +0,-1, -1,-1, -1,+0
374 .B paint-string \fPx,y,"string"
375 Identical to draw-string, but also uses the background color. Example:
377 paint-string 10,20, "Sample text"\fP
383 Draws a point. Requires two arguments, a coordinate pair. Example:
388 .B plane-mask \fPinteger
389 Sets the plane mask. Requires an integer parameter. Example:
394 .B points \fPx1,y1 [...,xn,yn]
396 .B draw-points \fPx1,y1 [...,xn,yn]
397 Draws a list of points at the specified coordinates. Example:
399 points +1,+2, +1,+4, +1,+6
402 .B segments \fPx1,y1,x2,y2 [...,xn,yn]
404 .B draw-segments \fPx1,y1,x2,y2 [...,xn,yn]
405 Draws a list of segment lines. The number of parameters must be multiple
408 segments +1,+2,+1,-3, +2,-2,-3,-2
411 .B shape-mode \fPmode
412 Sets the shape mode used in \fIfill-polygon\fP. Accepted parameters are
413 "complex", "convex" or "nonconvex", which set the shape mode to Complex,
414 Convex or Nonconvex, accordingly. Example:
419 .B stipple \fPpixmap-spec
420 Sets the pixmap for a stipple. Requires a pixmap parameter, as described
421 in the \fBPIXMAPS\fP section below. Example:
426 .B subwindow-mode \fPmode
427 Sets the subwindow mode in the GC. Accepted parameters are
428 "includeinferiors" and "clipbychildren", which set the subwindow mode to
429 IncludeInferiors or ClipByChildren, respectively. Example:
431 subwindow-mode includeinferiors
434 .B tile \fPpixmap-spec
435 Sets the pixmap for a tile. Requires a pixmap parameter, as described
436 in the \fBPIXMAPS\fP section below. Example:
438 tile xlogo11?foreground=red&background=gray80
442 Sets the tile stipple x and y origin. Requires two arguments, a x and y
449 Disables the GC mask, if it has been set with the command \fImask\fP.
450 Requires no arguments.
452 Example for drawing a shadow effect in a widget:
455 draw-lines +1,-1,-1,-1,-1,+1;\e
457 draw-lines -1,+0,+0,+0,+0,-1
460 A String to Pixmap converter has been added to \fBXaw\fP. This converter
461 is meant to be extended, and has enough abstraction to allow loading
462 several image formats. It uses a format that resembles a \fIURL\fP, with
465 .I [type:]name[?arg=val[{&}...]]
467 \fBType\fP can be one of \fIbitmap\fP, \fIgradient\fP or \fIxpm\fP.
469 \fBName\fP may be a file name, or, in the case of type \fIgradient\fP, may be
470 either \fIvertical\fP or \fIhorizontal\fP.
472 \fBArg=val\fP is a list of arguments to the converter. An argument list is
473 preceded by a question mark, and multiple arguments are separated by
474 ampersands. The most common arguments are \fIforeground\fP and
475 \fIbackground\fP. Gradients also support the arguments \fIstart\fP and
476 \fIend\fP (colors with which to start and end the gradient); the
477 \fPsteps\fP argument, to allow using less colors; and the \fIdimension\fP
478 argument to specify the size of the gradient. The \fIxpm\fP converter
479 understands the \fIcloseness\fP argument, which aids in using fewer colors
480 (useful if you have a limited colormap).
482 Most of the changes to this version of the Xaw library were done in the
483 TextWidget, TextSrcObject, TextSinkObject and related files.
485 A couple of highly visible changes in the Text widget are due to many bugs
486 in the Xaw6 implementation involving scrollbars and auto-resizing.
487 Scrollbars being added or removed caused several problems in keeping the
488 text cursor visible, and in Xaw6 it was very easy to have a widget thinking
489 the cursor was visible, when it was not. Also, permitting automatic
490 resizing of the widget to a larger geometry created other problems, making
491 it difficult to have a consistent layout in the application, and, if the
492 window manager did not interfere, windows larger than the screen could
493 result. Therefore, some functionality involving scrollbars and
494 auto-resizing has been disabled; see the section on new and modified
495 Text widget resources below.
497 The Text widget's default key bindings were originally based on the Emacs
498 text editor. In this release, even more operations familiar to Emacs users
499 have been added. New text actions include:
502 Indents text blocks. Not bound by default. The Text widget also does not
503 attempt to perform auto-indentation of its source object by default.
506 Resets the keyboard state. Reverts the action multiplier to 1, and if undo
507 is enabled, toggles between undo and redo. Bound by default to
511 In this version of Xaw, text killed in any text field is kept in memory,
512 allowing cut and paste operations internally to the program between text
513 fields. Bound by default to \fIMeta<Key>Y\fP.
516 Listed here only for purposes of documentation. Called by default when one
517 of the characters \fI1, 2, 3, 4, 5, 6, 7, 8, 9, 0,\fP or \fI-\fP is typed,
518 allowing composition of the multiplication number of text actions.
520 .B set-keyboard-focus
521 Sets the input focus of the top level widget to the text field. Not
522 enabled by default, but bound to the \fI<Btn1Down>\fP event.
525 Toggles overwrite mode. In overwrite mode, any text inserted in a text
526 field will replace existing text. Bound by default to \fI<Key>Insert\fP.
529 Sets the \fIenableUndo\fP resource of the textSrcObject. Not enabled by
530 default, but bound to \fIControl<Key>_\fP.
532 New and modified Text widget resources include:
534 .B justify (\fPClass\fB Justify)
535 Sets the text justification. Can be one of \fIleft, right, center\fP, or
536 \fIfull\fP. Only enabled when the \fIautoFill\fP resource is set, and the
537 resources \fIleftColumn\fP and \fIrightColumn\fP are correctly set.
539 .B leftColumn (\fPClass\fB Column)
540 Specifies the left column at which to break text. Text lines started with
541 an alphanumeric character will automatically start at this column.
543 .B positionCallback (\fPClass\fB Callback)
544 Allows installation of a callback to be called every time the cursor is
545 moved, and/or the file changes its size. The callback is called with a
546 pointer to a structure containing the following data:
551 XawTextPosition insert_position;
552 XawTextPosition last_position;
553 Boolean overwrite_mode;
554 } XawTextPositionInfo;
556 This callback is intended to help programmers write text editors based
557 on the Xaw widget set.
559 .B resize (\fPClass\fB Resize)
560 No longer supported, but recognized for backward compatibility with
561 resource specifications written for the Xaw6 Text widget.
563 .B rightColumn (\fPClass\fB Column)
564 Specifies the right column at which to break text. Text lines started with
565 an alphanumeric character will automatically end at this column.
567 .B scrollHorizontal (\fPClass\fB Scroll)
569 .B scrollVertical (\fPClass\fB Scroll)
570 These resources control the placement of scrollbars on the left and bottom
571 edges of the Text widget. They accept the values \fIXawtextScrollAlways\fP
572 and \fIXawtextScrollNever\fP. A converter is registered for this resource
573 that will convert the following strings: \fIalways\fP and \fInever\fP. The
574 value \fIXawtextScrollWhenNeeded\fP (and \fIwhenNeeded\fP, recognized by
575 the converter), is accepted for backwards compatibility with resource
576 specifications written for the Xaw6 Text widget, but ignored (effectively
577 treated as \fIXawtextScrollNever\fP).
578 .SH TEXT SOURCE OBJECT
579 The textSrcObject allows display of its contents to more than one window,
580 and also stores undo information. The new resources for the textSrcObject
583 .B callback (\fPClass\fB Callback)
584 Previous versions of Xaw had this resource in subclasses of the TextSource
585 object. This was changed to make it possible to tell the callback the
586 state of the text when undo is enabled.
588 .B enableUndo (\fPClass\fB Undo)
589 A boolean resource that enables or disables the undo function. The default
592 .B sourceChanged (\fPClass\fB Changed)
593 Like the callback resource, this resource was previously in subclasses of
594 the TextSource object. It is now in the textSrcObject to control the
595 changed/unchanged state when undo is enabled.
597 The textSinkObject subclasses asciiSinkObject and multiSinkObject have been
598 changed slightly to use a new cursor shape (no longer a caret at the
599 baseline) that indicates the input focus of the text widget, and allow
600 specification of the cursor color. The new resource is:
602 .B cursorColor (\fPClass\fB Color)
603 Sets the cursor color of the text. This color is also used to draw
605 .SH SIMPLE MENU WIDGET
606 The simpleMenuWidget algorithm to lay out menu entries has been changed to
607 enable multiple columns when a single column does not fit on the screen.
608 It was also modified to enable submenus.
610 A new resource has been added to the smeBSBObject to allow binding submenus
611 to it. The new resource is:
613 .B menuName (\fPClass\fB MenuName)
614 Specifies the name of the popup widget to be popped up when the pointer is
615 over the menu entry, or NULL. Note that the named menu must be a child of
616 the popup parent of the smeBSBObject.
618 The original X Consortium version of the Athena Widget Set and its
619 documentation were the work of many people, including Chris D. Peterson,
620 Ralph Swick, Mark Ackerman, Donna Converse, Jim Fulton, Loretta
621 Guarino-Reid, Charles Haynes, Rich Hyde, Mary Larson, Joel McCormack, Ron
622 Newman, Jeanne Rich, Terry Weissman, Mike Gancarz, Phil Karlton, Kathleen
623 Langone, Ram Rao, Smokey Wallace, Al Mento, and Jean Diaz.
625 The additions and modifications to \fIXaw\fR which were
626 originally made for XFree86 were written by Paulo
627 C\('esar Pereira de Andrade.
629 .I Athena Widget Set - C Language Interface