X Version 11, Release 7
libXaw 1.0.7
Chris D. Peterson
formerly MIT X Consortium
X Window System is a trademark of The Open Group.
Copyright © 1985, 1986, 1987, 1988, 1989, 1991, 1994 X Consortium
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files
(the ``Software''), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge,
publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do
so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium.
Copyright © 1985, 1986, 1987, 1988, 1989, 1991 Digital Equipment Corporation, Maynard, Massachusetts. Permission to use, copy, modify and distribute this documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appears in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in in advertising or publicity pertaining to distribution of the software without specific, written prior permission. Digital makes no representations about the suitability of the software described herein for any purpose. It is provided ``as is'' without express or implied warranty. |
Acknowledgments
Many thanks go to Ralph Swick (Project Athena / Digital) who has contributed much time and effort to |
Mark Ackerman (formerly Project Athena) While not much remains of the X10 toolkit, many of the ideas for this widget set come from that original |
Mike Gancarz (formerly Digital UEG) I have used the formatting ideas, and some of the words from previous versions of this document. The |
Ralph R. Swick (Project Athena/ Digital)
Terry Weissman (formerly Digital WSL)
Al Mento (Digital UEG)
Putting this manual together was a major task in and of itself. I would like to thank Ralph Swick, Donna
Converse, and Jim Fulton for taking the time to help convert my technical knowledge into legible text. A
special thanks to Jean Diaz (O'Reilly and Associates) for spending nearly a month with me working out
all the annoying little details.
Chris D. Peterson
MIT X Consortium 1989
The R5 edition of this document has been edited by the research staff of the MIT X Consortium, with
significant contributions by Jim Fulton (NCD).
Donna Converse
MIT X Consortium 1991
The R6 edition of this document has been edited to reflect changes brought about by research staff of the
v
Omron Corporation, with special recognition to Li Yuhong, Seiji Kuwari, and Hiroshi Kuribayashi for the X11R5/contrib/lib/Xaw internationalization that inspired this version.
Frank Sheeran
Omron Corporation 1994
vi
The X Toolkit is made up of two distinct pieces, the Xt Intrinsics and a widget set. The Athena widget Because the Intrinsics provide the same basic functionality to all widget sets it may be possible to use The Athena widget set is a library package layered on top of the Intrinsics and Xlib that provides a set of To the extent possible, the Intrinsics are "policy-free". The application environment and widget set, not · Policy · Consistency · Style Each individual widget implementation defines its own policy. The X Toolkit design allows for, but does |
The X Toolkit provides tools that simplify the design of application user interfaces in the X Window
System programming environment. It assists application programmers by providing a set of common
underlying user-interface functions. It also lets widget programmers modify existing widgets, by
subclassing, or add new widgets. By using the X Toolkit in their applications, programmers can present a similar user interface across applications to all workstation users.
The X Toolkit consists of: · A set of Intrinsics functions for building widgets · An architectural model for constructing widgets · A widget set for application programming While the majority of the Intrinsics functions are intended for the widget programmer, a subset of the The remainder of this chapter discusses the X Toolkit and Athena widget set: · Terminology · Model · Conventions used in this manual · Format of the Widget Reference Chapters |
1
Athena Widget Set libXaw 1.0.7 In addition to the terms already defined for X programming (see Xlib -- C Language X Interface), the
following terms are specific to the Intrinsics and Athena widget set and used throughout this document.
A programmer who uses the X Toolkit to produce an application user interface.
A widget that is contained within another "parent" widget.
The general group to which a specific object belongs.
A function that uses a widget in an application or for composing other widgets.
The name of a widget instance appended to the full name of its parent.
A specific widget object as opposed to a general widget class.
A function or procedure implemented by a widget class.
The name that is specific to an instance of a widget for a given client. This name is specified at
creation time and cannot be modified.
A data abstraction consisting of private data and private and public functions that operate on the |
Parent
A widget that contains at least one other ("child") widget. A parent widget is also known as a
composite widget.
A named piece of data in a widget that can be set by a client, by an application, or by user defaults.
A larger class of which a specific class is a member. All members of a class are also members of
the superclass.
A person interacting with a workstation.
An object providing a user-interface abstraction (for example, a Scrollbar widget).
The general group to which a specific widget belongs, otherwise known as the type of the widget.
A programmer who adds new widgets to the X Toolkit.
The underlying architectural model is based on the following premises:
2
Athena Widget Set libXaw 1.0.7 Widgets are X windows
Every user-interface widget is associated with an X window. The X window ID for a widget is Information hiding |
The data for every widget is private to the widget and its subclasses. That is, the data is neither Widget semantics and widget layout geometry |
Widget semantics are clearly separated from widget layout geometry. Widgets are concerned with |
· |
All resources available to the widgets are listed with each widget. Many of these are available to |
|
· |
Global symbols are printed in bold and can be function names, symbols defined in include files, or |
|
· |
Each function is introduced by a general discussion that distinguishes it from other functions. The |
|
· |
To eliminate any ambiguity between those arguments that you pass and those that a function returns |
|
· |
Any pointer to a structure that is used to return a value is designated as such by the _return suffix as |
|
The majority of this document is a reference guide for the Athena widget set. Chapters three through six The first few pages of every chapter give an overview of the widgets in that section. Widgets are Chapter 3 Simple Widgets Chapter 4 Menus Chapter 5 Text Widgets Chapter 6 Composite and Constraint Widget Following the introduction will be a description of each widget in that chapter. When no functional The first section of each widget's description is a table that contains general information about this widget Application Header file <X11/Xaw/Box.h> |
3
Athena Widget Set libXaw 1.0.7 Class boxWidgetClass
Class Name Application Header File |
Box This file must be included when an application uses this widget. It |
||
Class Header File |
This file will only be used by widget programmers. It will need to be |
||
Class |
This is the widget class of this widget. This global symbol is passed to |
||
Class Name |
This is the resource name of this class. This name can be used in a |
||
Superclass |
This is the superclass that this widget class is descended from. If you |
After this table follows a general description of the default behavior of this widget, as seen by the user. In The next section is a table showing the name, class, type and default value of each resource that is A This resource may be automatically adjusted when another resource is changed. C This resource is only settable at widget creation time, and may not be modified with |
XtSetValues. |
|||
D |
Do not modify this resource. While setting this resource will work, it can cause unexpected |
||
R |
This resource is READ-ONLY, and may not be modified. |
After the resource table is a detailed description of every resource available to that widget. Many of For each composite widget there is a section on layout semantics that follows the resource description. Descriptions of default translations and action routines come next, for widgets to which they apply. The |
The Intrinsics define a resource on all Shell widgets that interact with the window manager called input. |
4
Using Widgets
Widgets serve as the primary tools for building a user interface or application environment. The Athena The remaining chapters explain the widgets that are provided by the Athena widget set. These user- This chapter is a brief introduction to widget programming. The examples provided use the Athena |
If it is desirable that the application take advantage of internationalization (i18n), you must establish locale |
XtSetLanguageProc(NULL, NULL, NULL); Most notably, this will affect the Standard C locale, determine which resource files will be loaded, and |
You must call a toolkit initialization function before invoking any other toolkit routines (besides locale Widget XtAppInitialize(app_context_return, application_class, options, num_options, |
argc_in_out, argv_in_out, fallback_resources, args, num_args) app_con_return Returns the application context of this application, if non-NULL. application_class Specifies the class name of this application, which is usually the generic |
name |
for all instances of this application. A useful convention is to form the class |
|||
options |
Specifies how to parse the command line for any application-specific 5 |
Athena Widget Set libXaw 1.0.7
Interface.
num_options argc_in_out argv_in_out fallback_resources |
Specifies the number of entries in the options list. Specifies a pointer to the number of command line parameters. Specifies the command line parameters. Specifies resource values to be used if the site-wide application class defaults |
||
args num_args |
Specifies the argument list to use when creating the Application shell. Specifies the number of arguments in args. |
This function will remove the command line arguments that the toolkit reads from argc_in_out, and
argv_in_out. It will then attempt to open the display. If the display cannot be opened, an error message is issued and XtAppInitialize terminates the application. Once the display is opened, all resources are read
from the locations specified by the Intrinsics. This function returns an ApplicationShell widget to be used
as the root of the application's widget tree.
Creating a widget is a three-step process. First, the widget instance is allocated, and various instance-
specific attributes are set by using XtCreateWidget. Second, the widget's parent is informed of the new
child by using XtManageChild. Finally, X windows are created for the parent and all its children by using XtRealizeWidget and specifying the top-most widget. The first two steps can be combined by using
XtCreateManagedWidget. In addition, XtRealizeWidget is automatically called when the child To allocate, initialize, and manage a widget, use XtCreateManagedWidget . Widget XtCreateManagedWidget(name, widget_class, parent, args, num_args) |
String name; name Specifies the |
instance name for the created widget that is used for retrieving widget |
resources. |
||
widget_class parent args |
Specifies the widget class pointer for the created widget. Specifies the parent widget ID. Specifies the argument list. The argument list is a variable-length list composed of name |
|
num_args |
Specifies the number of arguments in the argument list. If the num_args is zero, the |
When a widget instance is successfully created, the widget identifier is returned to the application. If an
error is encountered, the XtError routine is invoked to inform the user of the error.
For further information, see X Toolkit Intrinsics -- C Language Interface.
Although a widget can have unique arguments that it understands, all widgets have common arguments The following resources are retrieved from the argument list or from the resource database by all of the |
6
The following additional resources are retrieved from the argument list or from the resource database by
many of the Athena widgets:
Most resources in the Athena widget set have a converter registered that will translate the string in a · Cursor · Pixel · Bitmap Many widgets have defined special converters that apply only to that widget. When these occur, the |
The value for the cursorName resource is specified in the resource database as a string, and is of the
following forms:
· |
A standard X cursor name from < X11/cursorfont.h >. The names in cursorfont.h each describe a specific cursor. The resource names for these cursors are exactly like the names in this file except |
||
· |
Glyphs, as in FONT font-name glyph-index [[ font-name ] glyph-index ]. The first font and glyph 7 |
Athena Widget Set libXaw 1.0.7 · A relative or absolute file name. If a relative or absolute file name is specified, that file is used to
create the source pixmap. Then the string "Mask" is appended to locate the cursor mask pixmap.
If the "Mask" file does not exist, the suffix "msk" is tried. If "msk" fails, no cursor mask will be
used. If the filename does not start with '/' or './' the the bitmap file path is used (see section 2.4.3).
The string-to-pixel converter takes any name that is acceptable to XParseColor (see Xlib -- C Language · Any color name for the rgb.txt file (typically in the directory /usr/lib/X11 on POSIX systems). · A numeric specification of the form #<red><green><blue> where these numeric values are |
hexadecimal digits (both upper and lower case).
· The special strings `XtDefaultForeground' and `XtDefaultBackground'
The string-to-bitmap converter attempts to locate a file containing bitmap data whose name is specified |
The XtRealizeWidget function performs two tasks:
· |
Calculates the geometry constraints of all managed descendants of this widget. The actual |
||
· |
Creates an X window for the widget and, if it is a composite widget, realizes each of its managed |
void XtRealizeWidget(w) w Specifies the widget. For further information about this function, see the X Toolkit Intrinsics -- C Language Interface. |
Now that the application has created, managed and realized its widgets, it is ready to process the events void XtAppMainLoop(app_context) |
XtAppContext app_context;
app_context Specifies the application context of this application. The value is normally returned by
XtAppInitialize. This function never returns: it is an infinite loop that processes the X events. User input can be handled |
After a widget has been created, a client can interact with that widget by calling one of the standard
widget manipulation routines provided by the Intrinsics, or a widget class-specific manipulation routine.
8
Athena Widget Set libXaw 1.0.7 The Intrinsics provide generic routines to give the application programmer access to a set of standard
widget functions. The common widget routines let an application or composite widget perform the · Control the mapping of widget windows · Destroy a widget instance · Obtain an argument value · Set an argument value |
By default, widget windows are mapped (made viewable) automatically by XtRealizeWidget. This void XtSetMappedWhenManaged(w, map_when_managed) |
Widget w;
Boolean map_when_managed;
w Specifies the widget. map_when_managed |
child window to be mapped.
The definition for XtMapWidget is:
void XtMapWidget(w) w Specifies the widget. When you are creating several children in sequence for a previously realized common parent it is void XtManageChildren(children, num_children) |
WidgetList children; children Specifies a list of children to add. num_children Specifies the number of children to add. If the parent is already visible on the screen, it is especially important to batch updates so that the For further information about these functions, see the X Toolkit Intrinsics -- C Language Interface. |
To destroy a widget instance of any type, use XtDestroyWidget .
void XtDestroyWidget(w)
Widget w;
w Specifies the widget. XtDestroyWidget destroys the widget and recursively destroys any children that it may have, including |
9
To retrieve the current value of a resource attribute associated with a widget instance, use
XtGetValues .
void XtGetValues(w, args, num_args)
w |
Widget w; Specifies the widget. |
args Specifies a variable-length argument list of name and address pairs that contain the
resource name and the address into which the resource value is stored.
num_args Specifies the number of arguments in the argument list. The arguments and values passed in the argument list are dependent on the widget. Note that the caller is |
To modify the current value of a resource attribute associated with a widget instance, use XtSetValues .
void XtSetValues(w, args, num_args)
w |
Widget w; Specifies the widget. |
args Specifies an array of name and value pairs that contain the arguments to be modified
and their new values.
num_args Specifies the number of arguments in the argument list. The arguments and values that are passed will depend on the widget being modified. Some widgets may For further information about these functions, see the X Toolkit Intrinsics -- C Language Interface. |
Note
The argument list entry for XtGetValues specifies the address to which the caller wants the |
Widgets can communicate changes in their state to their clients by means of a callback facility. The
format for a client's callback handler is:
void CallbackProc(w, client_data, call_data)
w |
Widget w; Specifies widget for which the callback is registered. |
client_data |
Specifies arbitrary client-supplied data that the widget should pass back to the client 10 |
Athena Widget Set libXaw 1.0.7
is also frequently known as the closure.
call_data Specifies any callback-specific data the widget wants to pass to the client. For
example, when Scrollbar executes its jumpProc callback list, it passes the current Callbacks can be registered either by creating an argument containing the callback list described below |
XtCreateWidget . The list is of type XtCallbackList :
typedef struct { The callback list must be allocated and initialized before calling XtCreateWidget . The end of the list is The second method for registering callbacks is to use XtAddCallback after the widget has been created. void XtAddCallback(w, callback_name, callback, client_data) |
w |
Widget w; Specifies the widget to add the callback to. |
callback_name Specifies the callback list within the widget to append to.
callback Specifies the callback procedure to add.
client_data Specifies the data to be passed to the callback when it is invoked. XtAddCallback adds the specified callback to the list for the named widget. All widgets provide a callback list named destroyCallback where clients can register procedures that |
This section provides some guidelines on how to set up an application program that uses the X Toolkit.
When writing an application that uses the X Toolkit, you should make sure that your application performs
the following:
1. |
Include < X11/Intrinsic.h > in your application programs. This header file automatically includes |
||
2. |
Include the widget-specific header files for each widget type that you need to use. For example, |
||
3. |
Call the XtAppInitialize function before invoking any other toolkit or Xlib functions. For further |
||
4. |
To pass attributes to the widget creation routines that will override any site or user customizations, set up argument lists. In this document, a list of valid argument names is provided in the discussion of each widget. The names each have a global symbol defined that begins with XtN to help catch For further information, see Section 2.9.2.2. 11 |
Athena Widget Set libXaw 1.0.7 5. When the argument list is set up, create the widget with the XtCreateManagedWidget function.
For further information, see Section 2.2 and the X Toolkit Intrinsics -- C Language Interface. |
|||
6. |
If the widget has any callback routines, set by the XtNcallback argument or the XtAddCallback |
||
7. |
After creating the initial widget hierarchy, windows must be created for each widget by calling |
||
8. |
Most applications now sit in a loop processing events using XtAppMainLoop , for example: XtCreateManagedWidget(name, class, parent, args, num_args); For information about this function, see the X Toolkit Intrinsics -- C Language Interface. |
||
9. |
Link your application with libXaw (the Athena widgets), libXmu (miscellaneous utilities), libXt cc -o application application.c -lXaw -lXmu -lXt -lSM -lICE -lXext -lX11 |
||
The Intrinsics support two methods of changing the default resource values; the resource manager, and Resource Manager This method picks up resource definitions described in Xlib -- C Language X |
Interface from many different locations at run time. The locations most |
|||
Argument Lists |
The values passed into the widget at creation time via an argument list cannot be modified by the user, and allow no opportunity for customization. It is used to set resources that cannot be specified as strings (e.g. callback lists) or |
||
It is important for all X Toolkit application programmers to understand how to use the X Resource Xrdb The xrdb utility may be used to load a file containing resources into the X |
X |
server. Once the resources are loaded, the resources will affect any new |
|||
Application Defaults |
The application defaults (app-defaults) file (normally in /usr/lib/X11/app- |
The resource specification has two colon-separated parts, a name, and a value. The value is a string The full widget name is a list of the name of every ancestor of the desired widget separated by periods (.). |
12
Athena Widget Set libXaw 1.0.7 Box). Notice that class names, by convention, begin with capital letters and instance names begin with
lower case letters. The class of any widget may be used in place of its name in a resource specification.
Here are a few examples: xman.form.button1 |
This is a fully specified resource name, and will affect only widgets called |
||
button1 that are children of widgets called form that are children of applications |
|||
Xman.Form.Command |
This will match any Command widget that is a child of a Form widget that is |
||
Xman.Form.button1 |
This is a mixed resource name with both widget names and classes specified. |
This syntax allows an application programmer to specify any widget in the widget tree. To match more Xman*Command This matches all Command widgets in the Xman application. Foo*button1 This matches any widget in the Foo application that is named button1. The root of all application widget trees is the widget returned by XtAppInitialize. Even though this is The last step in constructing the resource name is to append the name of the resource with either a period *foreground:Blue Specifies that all widgets in all applications will have a foreground |
color of blue. |
||
Xman*borderWidth:10 |
Specifies that all widgets in an application whose class is Xman |
|
xman.form.button1.label:Testing |
Specifies that a particular widget in the xman application will have |
An exclamation point (!) in the first column of a line indicates that the rest of the line should be treated as
a comment.
The Resource manager is a powerful tool that can be used very effectively to customize X Toolkit
applications at run time by either the application programmer or the user. Some final points to note:
· |
An application programmer may add new resources to their application. These resources are |
||
· |
Be careful when creating resource files. Since widgets will ignore resources that they do not |
||
· |
Only one resource line will match any given resource. There is a set of precedence rules, which · More specific overrides less specific, thus period always overrides asterisk. · Names on the left are more specific and override names on the right. · When resource specifications are exactly the same, user defaults |
For a complete explanation of the rules of precedence, and other specific topics see X Toolkit Intrinsics
-- C Language Interface and Xlib -- C Language X Interface.
13
To set up an argument list for the inline specification of widget attributes, you may use any of the four Argument are specified by using the following structure: typedef struct { |
String name; The first approach is to statically initialize the argument list. For example: static Arg arglist[] = { |
{XtNwidth, (XtArgVal) 400},
{XtNheight, (XtArgVal) 300},
}; This approach is convenient for lists that do not need to be computed at runtime and makes adding or |
XtCreateWidget(name, class, parent, arglist, XtNumber(arglist)); The second approach is to use the XtSetArg macro. For example: Arg arglist[10]; To make it easier to insert and delete entries, you also can use a variable index: Arg arglist[10]; The i variable can then be used as the argument list count in the widget create function. In this example, |
Note
You should not use auto-increment or auto-decrement within the first argument to XtSetArg . The third approach is to individually set the elements of the argument list array: Arg arglist[10]; Note that in this example, as in the previous example, XtNumber would return 10, not 2, and therefore The fourth approach is to use a mixture of the first and third approaches: you can statically define the |
14
Athena Widget Set libXaw 1.0.7 static Arg arglist[] = {
{XtNwidth, (XtArgVal) 400},
{XtNheight, (XtArgVal) NULL},
};
arglist[1].value = (XtArgVal) 300;
In this example, XtNumber can be used, as in the first approach, for easier code maintenance.
The best way to understand how to use any programming library is by trying some simple examples. A |
15
Simple Widgets
Each of these widgets performs a specific user interface function. They are simple because they cannot Command A push button that, when selected, may cause a specific action to take place. This |
widget can display a multi-line string or a bitmap or pixmap image. |
|||
Grip Label List |
A rectangle that, when selected, will cause an action to take place. A rectangle that can display a multi-line string or a bitmap or pixmap image. A list of text strings presented in row column format that may be individually selected. |
||
Panner |
A rectangular area containing a slider that may be moved in two dimensions. |
||
Repeater |
A push button that triggers an action at an increasing rate when selected. This widget |
||
Scrollbar |
A rectangular area containing a thumb that when slid along one dimension may cause a |
||
Simple |
The base class for most of the simple widgets. Provides a rectangular area with a |
||
StripChart Toggle |
A real time data graph that will automatically update and scroll. A push button that contains state information. Toggles may also be used as ``radio |
||
Application header file |
<X11/Xaw/Command.h> |
The Command widget is an area, often rectangular, that contains text or a graphical image. Command |
When creating a Command widget instance, the following resources are retrieved from the argument list
or from the resource database:
16
accelerators |
A list of event to action bindings to be executed by this widget, even though the |
||
ancestorSensitive |
The sensitivity state of the ancestors of this widget. A widget is insensitive if |
||
background |
A pixel value which indexes the widget's colormap to derive the background |
||
backgroundPixmap |
The background pixmap of this widget's window. If this resource is set to |
||
bitmap |
A bitmap to display instead of the label. The default size of the widget will be 17 |
Athena Widget Set libXaw 1.0.7
contents of files. (See Converting Bitmaps for details.) If this bitmap is one
bit deep then the 1's will be rendered in the foreground color, and the 0's in the |
|||
borderColor |
A pixel value which indexes the widget's colormap to derive the border color |
||
borderPixmap |
The border pixmap of this widget's window. If this resource is set to anything |
||
borderWidth callback colormap cornerRoundPercent |
The width of this widget's window border. A list of routines to be called when the notify action is invoked. The colormap that this widget will use. When a ShapeStyle of roundedRectangle is used, this resource controls the |
||
cursor |
The image that will be displayed as the pointer cursor whenever it is in this |
||
cursorName |
The name of the symbol to use to represent the pointer cursor. This resource |
||
depth destroyCallback encoding |
The depth of this widget's window. All functions on this list are called when this widget is destroyed. The encoding method used by the value of the label resource. The value may |
||
font |
The text font to use when displaying the label, when the international |
||
fontSet |
The text font set to use when displaying the label, when the international |
||
foreground |
A pixel value which indexes the widget's colormap to derive the foreground |
||
height |
The height and width of this widget in pixels. |
||
highlightThickness |
The thickness of the rectangle that is used to highlight the internal border of this |
||
insensitiveBorder |
This pixmap will be tiled into the widget's border if the widget becomes |
||
internalHeight |
The minimum amount of space to leave between the graphic and the vertical |
||
and horizontal edges of the window. |
|||
international |
This is a boolean flag, only settable at widget creation time. A value of false |
||
justify |
Specifies left, center, or right alignment of graphic within the widget. This 18 |
Athena Widget Set libXaw 1.0.7
obey this justification while shorter lines will be left-justified with the longest
one. |
|||
label |
Specifies the text string to be displayed in the widget's window if no bitmap is |
||
leftBitmap mappedWhenManaged |
Specifies a bitmap to display to the left of the graphic in the widget's window. If this resource is True, then the widget's window will automatically be |
||
pointerColor |
A pixel value which indexes the widget's colormap to derive the foreground |
||
pointerColorBackground |
A pixel value which indexes the widget's colormap to derive the |
||
resize |
Specifies whether the widget should attempt to resize to its preferred |
||
screen sensitive |
The screen on which this widget is displayed. This is not a settable resource. Whether or not the toolkit should pass user events to this widget. The widget |
||
shapeStyle |
Nonrectangular widgets may be created using this resource. Nonrectangular |
||
translations x |
The event bindings associated with this widget. The location of the upper left outside corner of this widget in its parent. |
||
The Command widget supports the following actions:
· |
Switching the button's interior between the foreground and background colors with set, unset, and |
||
· · |
Processing application callbacks with notify Switching the internal border between highlighted and unhighlighted states with highlight and |
The following are the default translation bindings used by the Command widget:
<EnterWindow>: |
highlight( ) |
The full list of actions supported by Command is:
highlight(condition) |
Displays the internal highlight border in the color (foreground or background ) 19 |
unhighlight( ) |
Displays the internal highlight border in the color (foreground or background ) |
||
set( ) |
Enters the set state, in which notify is possible. This action causes the button |
||
unset( ) |
Cancels the set state and displays the interior of the button in the background |
||
reset( ) |
Cancels any set or highlight and displays the interior of the button in the |
||
notify( ) |
When the button is in the set state this action calls all functions in the callback |
A very common alternative to registering callbacks is to augment a Command's translations with an
action performing the desired function. This often takes the form of:
*Myapp*save.translations: #augment <Btn1Down>,<Btn1Up>: Save()
Note When a bitmap of depth greater that one (1) is specified the set(), unset(), and reset() actions |
Application header file |
<X11/Xaw/Grip.h> |
The Grip widget provides a small rectangular region in which user input events (such as ButtonPress or
ButtonRelease) may be handled. The most common use for the Grip widget is as an attachment point for
visually repositioning an object, such as the pane border in a Paned widget.
When creating a Grip widget instance, the following resources are retrieved from the argument list or
from the resource database:
accelerators |
A list of event to action bindings to be executed by this widget, even though the |
||
ancestorSensitive |
The sensitivity state of the ancestors of this widget. A widget is insensitive if |
||
background |
A pixel value which indexes the widget's colormap to derive the background |
||
backgroundPixmap |
The background pixmap of this widget's window. If this resource is set to |
||
borderColor |
A pixel value which indexes the widget's colormap to derive the border color |
||
borderPixmap |
The border pixmap of this widget's window. If this resource is set to anything |
||
borderWidth callback |
The width of this widget's window border. All routines on this list are called whenever the GripAction action routine is |
||
colormap cursor |
The colormap that this widget will use. The image that will be displayed as the pointer cursor whenever it is in this |
||
cursorName |
The name of the symbol to use to represent the pointer cursor. This resource |
||
depth destroyCallback foreground |
The depth of this widget's window. All functions on this list are called when this widget is destroyed. A pixel value which indexes the widget's colormap to derive the color used to |
||
height |
The height and width of this widget in pixels. |
||
insensitiveBorder |
This pixmap will be tiled into the widget's border if the widget becomes |
||
international |
This is a boolean flag, only settable at widget creation time. While not utilized 21 |
Athena Widget Set libXaw 1.0.7
behavior that should vary with locale.
mappedWhenManaged |
If this resource is True, then the widget's window will automatically be |
||
pointerColor |
A pixel value which indexes the widget's colormap to derive the foreground |
||
pointerColorBackground |
A pixel value which indexes the widget's colormap to derive the |
||
screen sensitive |
The screen on which this widget is displayed. This is not a settable resource. Whether or not the toolkit should pass user events to this widget. The widget |
||
translations x |
The event bindings associated with this widget. The location of the upper left outside corner of this widget in its parent. |
||
The Grip widget does not declare any default event translation bindings, but it does declare a single action routine named GripAction. The client specifies an arbitrary event translation table, optionally giving
parameters to the GripAction routine. The GripAction routine executes the callbacks on the callback list, passing as call_data a pointer to a typedef struct _XawGripCallData { |
XEvent *event; In this structure, the event is a pointer to the input event that triggered the action. params and The following is an example of a translation table that uses the GripAction: |
<Btn1Down>: GripAction(press)
<Btn1Motion>: |
GripAction(move) |
For a complete description of the format of translation tables, see the X Toolkit Intrinsics -- C Language
Interface.
Application header file |
<X11/Xaw/Label.h> |
A Label widget holds a graphic displayed within a rectangular region of the screen. The graphic may be
a text string containing multiple lines of characters in an 8 bit or 16 bit character set (to be displayed with
22
a font), or in a multi-byte encoding (for use with a fontset). The graphic may also be a bitmap or pixmap.
The Label widget will allow its graphic to be left, right, or center justified. Normally, this widget can be
neither selected nor directly edited by the user. It is intended for use as an output device only.
When creating a Label widget instance, the following resources are retrieved from the argument list or
from the resource database:
accelerators |
A list of event to action bindings to be executed by this widget, even though the |
||
ancestorSensitive |
The sensitivity state of the ancestors of this widget. A widget is insensitive if |
||
background |
A pixel value which indexes the widget's colormap to derive the background |
||
backgroundPixmap |
The background pixmap of this widget's window. If this resource is set to 23 |
Athena Widget Set libXaw 1.0.7
instead of the background color.
bitmap |
A bitmap to display instead of the label. The default size of the widget will be |
||
borderColor |
A pixel value which indexes the widget's colormap to derive the border color |
||
borderPixmap |
The border pixmap of this widget's window. If this resource is set to anything |
||
borderWidth colormap cursor |
The width of this widget's window border. The colormap that this widget will use. The image that will be displayed as the pointer cursor whenever it is in this |
||
cursorName |
The name of the symbol to use to represent the pointer cursor. This resource |
||
depth destroyCallback encoding |
The depth of this widget's window. All functions on this list are called when this widget is destroyed. The encoding method used by the value of the label resource. The value may |
||
font |
The text font to use when displaying the label, when the international |
||
fontSet |
The text font set to use when displaying the label, when the international |
||
foreground |
A pixel value which indexes the widget's colormap to derive the foreground |
||
height |
The height and width of this widget in pixels. |
||
insensitiveBorder |
This pixmap will be tiled into the widget's border if the widget becomes |
||
internalWidth |
The minimum amount of space to leave between the graphic and the vertical |
||
international |
This is a boolean flag, only settable at widget creation time. A value of false |
||
justify |
Specifies left, center, or right alignment of graphic within the widget. This 24 |
label |
Specifies the text string to be displayed in the widget's window if no bitmap is |
||
leftBitmap mappedWhenManaged |
Specifies a bitmap to display to the left of the graphic in the widget's window. If this resource is True, then the widget's window will automatically be |
||
pointerColor |
A pixel value which indexes the widget's colormap to derive the foreground |
||
pointerColorBackground |
A pixel value which indexes the widget's colormap to derive the |
||
resize |
Specifies whether the widget should attempt to resize to its preferred |
||
screen sensitive |
The screen on which this widget is displayed. This is not a settable resource. Whether or not the toolkit should pass user events to this widget. The widget |
||
translations x |
The event bindings associated with this widget. The location of the upper left outside corner of this widget in its parent. |
||
Application header file |
<X11/Xaw/List.h> |
The List widget contains a list of strings formatted into rows and columns. When one of the strings is
selected, it is highlighted, and the List widget's Notify action is invoked, calling all routines on its callback
list. Only one string may be selected at a time.
When creating a List widget instance, the following resources are retrieved from the argument list or
from the resource database:
accelerators |
A list of event to action bindings to be executed by this widget, even though the |
||
ancestorSensitive |
The sensitivity state of the ancestors of this widget. A widget is insensitive if |
||
background |
A pixel value which indexes the widget's colormap to derive the background |
||
backgroundPixmap |
The background pixmap of this widget's window. If this resource is set to |
||
borderColor |
A pixel value which indexes the widget's colormap to derive the border color |
||
borderPixmap |
The border pixmap of this widget's window. If this resource is set to anything |
||
borderWidth callback |
The width of this widget's window border. All functions on this list are called whenever the notify action is invoked. The |
||
colormap |
The colormap that this widget will use. 26 |
rowSpacing |
The amount of space, in pixels, between each of the rows and columns in the |
||
cursor |
The image that will be displayed as the pointer cursor whenever it is in this |
||
cursorName |
The name of the symbol to use to represent the pointer cursor. This resource |
||
defaultColumns |
The default number of columns. This value is used when neither the width nor |
||
depth destroyCallback font |
The depth of this widget's window. All functions on this list are called when this widget is destroyed. The text font to use when displaying the list, when the international resource |
||
fontSet |
The text font set to use when displaying the list, when the international |
||
forceColumns |
Forces the default number of columns to be used regardless of the List |
||
foreground |
A pixel value which indexes the widget's colormap to derive the color used to |
||
height |
The height and width of this widget in pixels. |
||
insensitiveBorder |
This pixmap will be tiled into the widget's border if the widget becomes |
||
internalHeight |
The margin, in pixels, between the edges of the list and the corresponding edge |
||
of the List widget's window. |
|||
list |
An array of text strings displayed in the List widget. If numberStrings is zero |
||
international |
This is a boolean flag, only settable at widget creation time. A value of false |
||
longest |
Specifies the width, in pixels, of the longest string in the current list. The List |
||
mappedWhenManaged |
If this resource is True, then the widget's window will automatically be |
||
numberStrings |
The number of strings in the current list. If a value of zero (the default) is |
||
pasteBuffer |
If this resource is set to True then the name of the currently selected list |
||
pointerColor |
A pixel value which indexes the widget's colormap to derive the foreground |
||
pointerColorBackground |
A pixel value which indexes the widget's colormap to derive the 27 |
Athena Widget Set libXaw 1.0.7 screen The screen on which this widget is displayed. This is not a settable resource.
sensitive |
Whether or not the toolkit should pass user events to this widget. The widget |
||
translations verticalList |
The event bindings associated with this widget. If this resource is set to True then the list elements will be presented in column |
||
x |
The location of the upper left outside corner of this widget in its parent. |
||
The List widget supports the following actions: · Highlighting and unhighlighting the list element under the pointer with Set and Unset · Processing application callbacks with Notify The following is the default translation table used by the List Widget: |
<Btn1Down>,<Btn1Up>: Set( ) Notify( )
The full list of actions supported by List widget is:
Set( ) |
Sets the list element that is currently under the pointer. To inform the user that |
||
Unset( ) |
Cancels the set state of the element under the pointer, and redraws it with |
||
Notify( ) |
Calls all callbacks on the List widget's callback list. Information about the |
||
All procedures on the List widget's callback list will have a XawListReturnStruct passed to them as
call_data. The structure is defined in the List widget's application header file.
typedef struct _XawListReturnStruct { |
/* string shown in the list. */ |
||
int list_index; |
/* index of the item selected. */ |
||
Note |
The list_index item used to be called simply index. Unfortunately, this name collided with a
global name defined on some operating systems, and had to be changed.
To change the list that is displayed, use XawListChange .
void XawListChange(w, list, nitems, longest, resize)
w |
Widget w; Specifies the List widget. |
list Specifies the new list for the List widget to display.
28
Athena Widget Set libXaw 1.0.7 nitems Specifies the number of items in the list. If a value less than 1 is specified, list must be
NULL terminated, and the number of items will be calculated by the List widget. |
|||
longest |
Specifies the length of the longest item in the list in pixels. If a value less than 1 is |
||
resize |
Specifies a Boolean value that if True indicates that the List widget should try to resize |
XawListChange will unset all list elements that are currently set before the list is actually changed. The
list is used in place, and must remain usable for the lifetime of the List widget, or until list has been
changed again with this function or with XtSetValues.
To highlight an item in the list, use XawListHighlight .
void XawListHighlight(w, item)
Widget w;
int item;
w item |
Specifies the List widget. Specifies an index into the current list that indicates the item to be highlighted. |
Only one item can be highlighted at a time. If an item is already highlighted when XawListHighlight is
called, the highlighted item is unhighlighted before the new item is highlighted.
To unhighlight the currently highlighted item in the list, use XawListUnhighlight .
void XawListUnhighlight(w)
Widget w;
w Specifies the List widget.
To retrieve the list element that is currently set, use XawListShowCurrent .
XawListReturnStruct *XawListShowCurrent(w)
Widget w;
w Specifies the List widget. XawListShowCurrent returns a pointer to an XawListReturnStruct structure, containing the currently |
Many programmers create a ``scrolled list'' by putting a List widget with many entries as a child of a While this is a useful technique, there is a serious drawback. X does not support windows above 32,767 |
Application header file |
<X11/Xaw/Panner.h> 29 |
A Panner widget is a rectangle, called the ``canvas,'' on which another rectangle, the ``slider,'' moves in The slider may be scrolled around the canvas by pressing, dragging, and releasing Button1; the default |
When creating a Panner widget instance, the following resources are retrieved from the argument list or
from the resource database:
30
Athena Widget Set libXaw 1.0.7 accelerators A list of event to action bindings to be executed by this widget, even though the
event occurred in another widget. (See the X Toolkit Intrinsics -- C Language Interface for details). |
|||
allowOff ancestorSensitive |
Whether to allow the edges of the slider to go off the edges of the canvas. The sensitivity state of the ancestors of this widget. A widget is insensitive if |
||
background |
A pixel value which indexes the widget's colormap to derive the background |
||
backgroundPixmap |
The background pixmap of this widget's window. If this resource is set to |
||
backgroundStipple |
The name of a bitmap pattern to be used as the background for the area |
||
borderColor |
A pixel value which indexes the widget's colormap to derive the border color |
||
borderPixmap |
The border pixmap of this widget's window. If this resource is set to anything |
||
borderWidth |
The width of this widget's window border. |
canvasHeight
canvasWidth colormap cursor |
The size of the canvas. The colormap that this widget will use. The image that will be displayed as the pointer cursor whenever it is in this |
||
cursorName |
The name of the symbol to use to represent the pointer cursor. This resource |
||
defaultScale |
The percentage size that the Panner widget should have relative to the size of |
||
depth destroyCallback foreground |
The depth of this widget's window. All functions on this list are called when this widget is destroyed. A pixel value which indexes the widget's colormap to derive the color used to |
||
height |
The height and width of this widget in pixels. |
||
internalSpace |
The width of internal border in pixels between a slider representing the full size |
||
international |
This is a boolean flag, only settable at widget creation time. While not utilized |
||
lineWidth |
The width of the lines in the rubberbanding rectangle when rubberbanding is in |
||
mappedWhenManaged |
If this resource is True, then the widget's window will automatically be |
||
pointerColor |
A pixel value which indexes the widget's colormap to derive the foreground |
||
pointerColorBackground |
A pixel value which indexes the widget's colormap to derive the |
||
reportCallback |
All functions on this callback list are called when the notify action is invoked. 31 |
Athena Widget Set libXaw 1.0.7 resize Whether or not to resize the panner whenever the canvas size is changed so
that the defaultScale is maintained. |
||
rubberBand |
Whether or not scrolling should be discrete (only moving a rubberbanded |
|
screen sensitive |
The screen on which this widget is displayed. This is not a settable resource. Whether or not the toolkit should pass user events to this widget. The widget |
|
shadowColor shadowThickness |
The color of the shadow underneath the slider. The width of the shadow underneath the slider. |
sliderX
sliderY The location of the slider in the coordinates of the canvas.
sliderWidth translations x |
The size of the slider. The event bindings associated with this widget. The location of the upper left outside corner of this widget in its parent. |
||
The actions supported by the Panner widget are: start() This action begins movement of the slider. stop() This action ends movement of the slider. abort() This action ends movement of the slider and |
restores it to the position it held |
when the start action was invoked. |
|||
move() |
This action moves the outline of the slider (if the rubberBand resource is True) or the slider itself (by invoking the notify action procedure). |
||
page(xamount,yamount) |
This action moves the slider by the specified amounts. The format for the |
||
notify() |
This action informs the application of the slider's current position by invoking |
||
set(what,value) |
This action changes the behavior of the Panner. The what argument must |
The default bindings for Panner are:
<Btn1Down>: |
start( ) 32 |
<Key>Down: |
page(+0,+.5p) |
The functions registered on the reportCallback list are invoked by the notify action as follows:
void ReportProc(panner, client_data, report)
Widget panner; |
*) */ |
||
panner |
Specifies the Panner widget. |
client_data Specifies the client data.
report |
Specifies a pointer to an XawPannerReport structure containing the location and size |
||
Application header file |
<X11/Xaw/Repeater.h> |
The Repeater widget is a subclass of the Command widget; see the Command documentation for details. |
When creating a Repeater widget instance, the following resources are retrieved from the argument list
or from the resource database:
accelerators |
A list of event to action bindings to be executed by this widget, even though the |
||
ancestorSensitive |
The sensitivity state of the ancestors of this widget. A widget is insensitive if |
||
background |
A pixel value which indexes the widget's colormap to derive the background |
||
backgroundPixmap |
The background pixmap of this widget's window. If this resource is set to |
||
bitmap |
A bitmap to display instead of the label. The default size of the widget will be |
||
borderColor |
A pixel value which indexes the widget's colormap to derive the border color |
||
borderPixmap |
The border pixmap of this widget's window. If this resource is set to anything |
||
borderWidth |
The width of this widget's window border. 34 |
Athena Widget Set libXaw 1.0.7 callback A list of routines to be called when the notify action is invoked.
colormap cornerRoundPercent |
The colormap that this widget will use. When a ShapeStyle of roundedRectangle is used, this resource controls the |
||
cursor |
The image that will be displayed as the pointer cursor whenever it is in this |
||
cursorName |
The name of the symbol to use to represent the pointer cursor. This resource |
||
decay |
The number of milliseconds that should be subtracted from each succeeding |
||
depth destroyCallback encoding |
The depth of this widget's window. All functions on this list are called when this widget is destroyed. The encoding method used by the value of the label resource. The value may |
||
flash font |
Whether or not to flash the Repeater button whenever the timer goes off. The text font to use when displaying the label, when the international |
||
fontSet |
The text font set to use when displaying the label, when the international |
||
foreground |
A pixel value which indexes the widget's colormap to derive the foreground |
||
height |
The height and width of this widget in pixels. |
||
highlightThickness |
The thickness of the rectangle that is used to highlight the internal border of this |
||
initialDelay |
The number of milliseconds between the beginning of the Repeater button |
||
insensitiveBorder |
This pixmap will be tiled into the widget's border if the widget becomes |
||
internalHeight |
The minimum amount of space to leave between the graphic and the vertical |
||
and horizontal edges of the window. |
|||
international |
This is a boolean flag, only settable at widget creation time. A value of false |
||
justify |
Specifies left, center, or right alignment of graphic within the widget. This 35 |
Athena Widget Set libXaw 1.0.7 label Specifies the text string to be displayed in the widget's window if no bitmap is
specified. The default is the name of this widget. Regardless of the value of |
|||
leftBitmap mappedWhenManaged |
Specifies a bitmap to display to the left of the graphic in the widget's window. If this resource is True, then the widget's window will automatically be |
||
minimumDelay pointerColor |
The minimum time between callbacks in milliseconds. A pixel value which indexes the widget's colormap to derive the foreground |
||
pointerColorBackground |
A pixel value which indexes the widget's colormap to derive the |
||
repeatDelay |
The number of milliseconds between each callback after the first (minus an |
||
resize |
Specifies whether the widget should attempt to resize to its preferred |
||
screen sensitive |
The screen on which this widget is displayed. This is not a settable resource. Whether or not the toolkit should pass user events to this widget. The widget |
||
shapeStyle |
Nonrectangular widgets may be created using this resource. Nonrectangular |
||
startCallback |
The list of functions to invoke by the start action (typically when the Repeater |
||
stopCallback |
The list of functions to invoke by the stop action (typically when the Repeater |
||
translations x |
The event bindings associated with this widget. The location of the upper left outside corner of this widget in its parent. |
||
The Repeater widget supports the following actions beyond those of the Command button:
start() |
This invokes the functions on the startCallback and callback lists and sets a |
||
stop() |
This invokes the functions on the stopCallback list and prevents any further |
The following are the default translation bindings used by the Repeater widget:
<EnterWindow>: |
highlight( ) 36 |
Application header file |
<X11/Xaw/Scrollbar.h> |
A Scrollbar widget is a rectangle, called the ``canvas,'' on which another rectangle, the ``thumb,'' moves Each pointer button invokes a specific action. Pointer buttons 1 and 3 do not move the thumb The pointer cursor in the scroll region changes depending on the current action. When no pointer button When the user scrolls, the application receives notification through callback procedures. For both |
When creating a Scrollbar widget instance, the following resources are retrieved from the argument list
or from the resource database:
accelerators |
A list of event to action bindings to be executed by this widget, even though the |
||
ancestorSensitive |
The sensitivity state of the ancestors of this widget. A widget is insensitive if |
||
background |
A pixel value which indexes the widget's colormap to derive the background |
||
backgroundPixmap |
The background pixmap of this widget's window. If this resource is set to |
||
borderColor |
A pixel value which indexes the widget's colormap to derive the border color |
||
borderPixmap |
The border pixmap of this widget's window. If this resource is set to anything |
||
borderWidth colormap cursor |
The width of this widget's window border. The colormap that this widget will use. The image that will be displayed as the pointer cursor whenever it is in this |
||
cursorName |
The name of the symbol to use to represent the pointer cursor. This resource |
||
depth destroyCallback foreground |
The depth of this widget's window. All functions on this list are called when this widget is destroyed. A pixel value which indexes the widget's colormap to derive the color used to 38 |
Athena Widget Set libXaw 1.0.7 height
width insensitiveBorder |
The height and width of this widget in pixels. This pixmap will be tiled into the widget's border if the widget becomes |
||
international |
This is a boolean flag, only settable at widget creation time. While not utilized |
||
jumpProc |
All functions on this callback list are called when the NotifyThumb action is |
||
length mappedWhenManaged |
The height of a vertical scrollbar or the width of a horizontal scrollbar. If this resource is True, then the widget's window will automatically be |
||
minimumThumb orientation |
The smallest size, in pixels, to which the thumb can shrink. The orientation is the direction that the thumb will be allowed to move. This |
||
pointerColor |
A pixel value which indexes the widget's colormap to derive the foreground |
||
pointerColorBackground |
A pixel value which indexes the widget's colormap to derive the |
||
screen scrollDCursor scrollHCursor scrollLCursor scrollProc |
The screen on which this widget is displayed. This is not a settable resource. This cursor is used when scrolling backward in a vertical scrollbar. This cursor is used when a horizontal scrollbar is inactive. This cursor is used when scrolling forward in a horizontal scrollbar. All functions on this callback list may be called when the NotifyScroll action is |
||
scrollRCursor |
This cursor is used when scrolling backward in a horizontal scrollbar, or when |
||
scrollUCursor |
This cursor is used when scrolling forward in a vertical scrollbar, or when |
||
scrollVCursor sensitive |
This cursor is used when a vertical scrollbar is inactive. Whether or not the toolkit should pass user events to this widget. The widget |
||
shown |
This is the size of the thumb, expressed as a percentage (0.0 - 1.0) of the length |
||
thickness thumb |
The width of a vertical scrollbar or the height of a horizontal scrollbar. This pixmap is used to tile (or stipple) the thumb of the scrollbar. If no tiling is |
||
topOfThumb |
The location of the top of the thumb, as a percentage (0.0 - 1.0) of the length of |
||
translations x |
The event bindings associated with this widget. The location of the upper left outside corner of this widget in its parent. |
||
39 |
The actions supported by the Scrollbar widget are:
StartScroll(value) |
The possible values are Forward, Backward, or Continuous. This must be the first action to begin a new movement. |
||
NotifyScroll(value) |
The possible values are Proportional or FullLength. If the argument to |
||
EndScroll( ) MoveThumb( ) NotifyThumb( ) |
This must be the last action after a movement is complete. Repositions the Scrollbar's thumb to the current pointer location. Calls the jumpProc callbacks and passes the relative position of the pointer as |
The default bindings for Scrollbar are:
<Btn1Down>: |
StartScroll(Forward) |
Examples of additional bindings a user might wish to specify in a resource file are:
*Scrollbar.Translations: |
\ |
|||
Meta<Key>space: |
StartScroll(Forward) NotifyScroll(FullLength) \n\ |
Meta<Key>space: |
StartScroll(Backward) NotifyScroll(FullLength) \n\ |
There are two callback lists provided by the Scrollbar widget. The procedural interface for these The calling interface to the scrollProc callback procedure is: void ScrollProc(scrollbar, client_data, position) |
Widget scrollbar; scrollbar Specifies the Scrollbar widget. client_data Specifies the client data. position Specifies a pixel position in integer form. The scrollProc callback is used for incremental scrolling and is called by the NotifyScroll action. The The calling interface to the jumpProc callback procedure is: |
40
Athena Widget Set libXaw 1.0.7 void JumpProc(scrollbar, client_data, percent)
Widget scrollbar; scrollbar Specifies the ID of the scroll bar widget. client_data Specifies the client data. percent_ptr Specifies the floating point position of the thumb (0.0 - 1.0). The jumpProc callback is used to implement smooth scrolling and is called by the NotifyThumb action. |
float percent = *(float*)percent_ptr; With the default button bindings, button 2 moves the thumb interactively, and the jumpProc is called on |
To set the position and length of a Scrollbar thumb, use XawScrollbarSetThumb .
void XawScrollbarSetThumb(w, top, shown)
w |
Widget w; |
Specifies the Scrollbar widget. |
top shown |
Specifies the position of the top of the thumb as a fraction of the length of the Scrollbar. Specifies the length of the thumb as a fraction of the total length of the Scrollbar. |
XawScrollbarThumb moves the visible thumb to a new position (0.0 - 1.0) and length (0.0 - 1.0). If called from jumpProc, XawScrollbarSetThumb has no effect. |
The shown and topOfThumb resources are of type float. These resources can be difficult to get into an |
top = 0.5; if (sizeof(float) > sizeof(XtArgVal)) { /* * If a float is larger than an XtArgVal then pass this * resource value by reference. */ XtSetArg(args[0], XtNshown, &top); } else { /* * Convince C not to perform an automatic conversion, which * would truncate 0.5 to 0. */ XtArgVal * l_top = (XtArgVal *) ⊤ XtSetArg(args[0], XtNshown, *l_top); } 41 |
Application Header file |
<Xaw/Simple.h> |
The Simple widget is not very useful by itself, as it has no semantics of its own. It main purpose is to be
used as a common superclass for the other simple Athena widgets. This widget adds six resources to the
resource list provided by the Core widget and its superclasses.
When creating a Simple widget instance, the following resources are retrieved from the argument list or
from the resource database:
accelerators |
A list of event to action bindings to be executed by this widget, even though the |
||
ancestorSensitive |
The sensitivity state of the ancestors of this widget. A widget is insensitive if |
||
background |
A pixel value which indexes the widget's colormap to derive the background |
||
backgroundPixmap |
The background pixmap of this widget's window. If this resource is set to 42 |
Athena Widget Set libXaw 1.0.7 borderColor A pixel value which indexes the widget's colormap to derive the border color
of the widget's window. borderPixmap The border pixmap of this widget's window. If this resource is set to anything borderWidth The width of this widget's window border. colormap The colormap that this widget will use. cursor The image that will be displayed as the pointer cursor whenever it is in this cursorName The name of the symbol to use to represent the pointer cursor. This resource depth The depth of this widget's window. destroyCallback All functions on this list are called when this widget is destroyed. height insensitiveBorder This pixmap will be tiled into the widget's border if the widget becomes international This is a boolean flag, only settable at widget creation time. While not utilized mappedWhenManaged If this resource is True, then the widget's window will automatically be pointerColor A pixel value which indexes the widget's colormap to derive the foreground pointerColorBackground A pixel value which indexes the widget's colormap to derive the |
background color of the pointer symbol specified by the cursorName |
|||
screen sensitive |
The screen on which this widget is displayed. This is not a settable resource. Whether or not the toolkit should pass user events to this widget. The widget |
||
translations x |
The event bindings associated with this widget. The location of the upper left outside corner of this widget in its parent. |
||
Application Header file |
<Xaw/StripChart.h> |
The StripChart widget is used to provide a roughly real time graphical chart of a single value. For
example, it is used by the common client program xload to provide a graph of processor load. The
StripChart reads data from an application, and updates the chart at the update interval specified.
When creating a StripChart widget instance, the following resources are retrieved from the argument list
or from the resource database:
43
accelerators |
A list of event to action bindings to be executed by this widget, even though the |
||
ancestorSensitive |
The sensitivity state of the ancestors of this widget. A widget is insensitive if |
||
background |
A pixel value which indexes the widget's colormap to derive the background |
||
backgroundPixmap |
The background pixmap of this widget's window. If this resource is set to |
||
borderColor |
A pixel value which indexes the widget's colormap to derive the border color |
||
borderPixmap |
The border pixmap of this widget's window. If this resource is set to anything |
||
borderWidth colormap cursor |
The width of this widget's window border. The colormap that this widget will use. The image that will be displayed as the pointer cursor whenever it is in this 44 |
Athena Widget Set libXaw 1.0.7 cursorName The name of the symbol to use to represent the pointer cursor. This resource
will override the cursor resource if both are specified. (See 2.4.1) |
|||
depth destroyCallback foreground |
The depth of this widget's window. All functions on this list are called when this widget is destroyed. A pixel value which indexes the widget's colormap to derive the color that will |
||
getValue |
A list of callback functions to call every update seconds. This list should |
||
height |
The height and width of this widget in pixels. |
||
highlight |
A pixel value which indexes the widget's colormap to derive the color that will |
||
insensitiveBorder |
This pixmap will be tiled into the widget's border if the widget becomes |
||
international |
This is a boolean flag, only settable at widget creation time. While not utilized |
||
jumpScroll |
When the graph reaches the right edge of the window it must be scrolled to the |
||
mappedWhenManaged |
If this resource is True, then the widget's window will automatically be |
||
minScale |
The minimum scale for the graph. The number of divisions on the graph will |
||
pointerColor |
A pixel value which indexes the widget's colormap to derive the foreground |
||
pointerColorBackground |
A pixel value which indexes the widget's colormap to derive the |
||
screen sensitive |
The screen on which this widget is displayed. This is not a settable resource. Whether or not the toolkit should pass user events to this widget. The widget |
||
translations update |
The event bindings associated with this widget. The number of seconds between graph updates. Each update is represented |
||
x |
The location of the upper left outside corner of this widget in its parent. |
||
The StripChart widget will call the application routine passed to it as the getValue callback function every The calling interface for the getValue callback is: void (*getValueProc)(w, client_data, value) |
Widget w;
XtPointer client_data;
XtPointer value; /* double * */
45
w client_data value |
Specifies the StripChart widget. Specifies the client data. Returns a pointer to a double. The application should set the address pointed to by this |
This function is used by the StripChart to call an application routine. The routine will pass the value to be
graphed back to the the StripChart in the value field of this routine.
Application Header file |
<Xaw/Toggle.h> |
The Toggle widget is an area, often rectangular, that displays a graphic. The graphic may be a text string This widget maintains a Boolean state (e.g. True/False or On/Off) and changes state whenever it is Toggle widgets may also be part of a ``radio group.'' A radio group is a list of at least two Toggle widgets Toggle widget state is preserved across changes in sensitivity. |
When creating a Toggle widget instance, the following resources are retrieved from the argument list or
from the resource database:
accelerators |
A list of event to action bindings to be executed by this widget, even though the |
||
ancestorSensitive |
The sensitivity state of the ancestors of this widget. A widget is insensitive if |
||
background |
A pixel value which indexes the widget's colormap to derive the background |
||
backgroundPixmap |
The background pixmap of this widget's window. If this resource is set to |
||
bitmap |
A bitmap to display instead of the label. The default size of the widget will be |
||
borderColor |
A pixel value which indexes the widget's colormap to derive the border color |
||
borderPixmap |
The border pixmap of this widget's window. If this resource is set to anything 47 |
Athena Widget Set libXaw 1.0.7 borderWidth The width of this widget's window border.
callback colormap cornerRoundPercent |
A list of routines to be called when the notify action is invoked. The colormap that this widget will use. When a ShapeStyle of roundedRectangle is used, this resource controls the |
||
cursor |
The image that will be displayed as the pointer cursor whenever it is in this |
||
cursorName |
The name of the symbol to use to represent the pointer cursor. This resource |
||
depth destroyCallback encoding |
The depth of this widget's window. All functions on this list are called when this widget is destroyed. The encoding method used by the value of the label resource. The value may |
||
font |
The text font to use when displaying the label, when the international |
||
fontSet |
The text font set to use when displaying the label, when the international |
||
foreground |
A pixel value which indexes the widget's colormap to derive the foreground |
||
height |
The height and width of this widget in pixels. |
||
highlightThickness |
The thickness of the rectangle that is used to highlight the internal border of this |
||
insensitiveBorder |
This pixmap will be tiled into the widget's border if the widget becomes |
||
internalHeight |
The minimum amount of space to leave between the graphic and the vertical |
||
and horizontal edges of the window. |
|||
international |
This is a boolean flag, only settable at widget creation time. A value of false |
||
justify |
Specifies left, center, or right alignment of graphic within the widget. This |
||
label |
Specifies the text string to be displayed in the widget's window if no bitmap is |
||
leftBitmap |
Specifies a bitmap to display to the left of the graphic in the widget's window. 48 |
Athena Widget Set libXaw 1.0.7 mappedWhenManaged If this resource is True, then the widget's window will automatically be
mapped by the Toolkit when it is realized and managed. |
|||
pointerColor |
A pixel value which indexes the widget's colormap to derive the foreground |
||
pointerColorBackground |
A pixel value which indexes the widget's colormap to derive the |
||
radioData |
Specifies the data that will be returned by XawToggleGetCurrent when this is |
||
radioGroup |
Specifies another Toggle widget that is in the radio group to which this Toggle |
||
resize |
Specifies whether the widget should attempt to resize to its preferred |
||
screen sensitive |
The screen on which this widget is displayed. This is not a settable resource. Whether or not the toolkit should pass user events to this widget. The widget |
||
shapeStyle |
Nonrectangular widgets may be created using this resource. Nonrectangular |
||
state translations x |
Specifies whether the Toggle widget is set (True) or unset (False). The event bindings associated with this widget. The location of the upper left outside corner of this widget in its parent. |
||
The Toggle widget supports the following actions:
· |
Switching the Toggle widget between the foreground and background colors with set and unset and |
||
· · |
Processing application callbacks with notify Switching the internal border between highlighted and unhighlighted states with highlight and |
The following are the default translation bindings used by the Toggle widget:
<EnterWindow>: highlight(Always)
49
Athena Widget Set libXaw 1.0.7
<LeaveWindow>: unhighlight( )
<Btn1Down>,<Btn1Up>: toggle( ) notify( )
The full list of actions supported by Toggle is:
highlight(condition) |
Displays the internal highlight border in the color (foreground or background ) |
||
unhighlight( ) |
Displays the internal highlight border in the color (foreground or background ) |
||
set( ) |
Enters the set state, in which notify is possible. This action causes the Toggle |
||
unset( ) |
Cancels the set state and displays the interior of the Toggle widget in the |
||
toggle( ) |
Changes the current state of the Toggle widget, causing to be set if it was |
||
reset( ) |
Cancels any set or highlight and displays the interior of the Toggle widget in |
||
notify( ) |
When the Toggle widget is in the set state this action calls all functions in the Note |
When a bitmap of depth greater that one (1) is specified the set(), unset(), and reset() actions
have no effect, since there are no foreground and background colors used in a multi-plane
pixmap.
There are typically two types of radio groups desired by applications. The default translations for the The other type of radio group is "one of many" and has the more strict policy that there will always be |
<EnterWindow>: highlight(Always)
<LeaveWindow>: |
unhighlight( ) |
This translation table will not allow any Toggle to be unset except as a result of another Toggle becoming
set. It is the application programmer's responsibility to choose an initial state for the radio group by
setting the state resource of one of its member widgets to True.
The following functions allow easy access to the Toggle widget's radio group functionality.
50
To enable an application to change the Toggle's radio group, add the Toggle to a radio group, or remove
the Toggle from a radio group, use XawToggleChangeRadioGroup.
void XawToggleChangeRadioGroup(w, radio_group) w Specifies the Toggle widget. radio_group Specifies any Toggle in the new radio |
group. If NULL then the Toggle will be removed |
from any radio group of which it is a member.
If a Toggle is already set in the new radio group, and the Toggle to be added is also set then the
previously set Toggle in the radio group is unset and its callback procedures are invoked.
To find the currently selected Toggle in a radio group of Toggle widgets use XawToggleGetCurrent.
XtPointer XawToggleGetCurrent(radio_group); radio_group Specifies any Toggle widget in the radio group. The value returned by this function is the radioData of the Toggle in this radio group that is currently set. |
To change the Toggle that is currently set in a radio group use XawToggleSetCurrent.
void XawToggleSetCurrent(radio_group, radio_data);
Widget radio_group; radio_group Specifies |
any Toggle widget in the radio group. |
radio_data Specifies |
the radioData identifying the Toggle that should be set in the radio group |
specified by the radio_group argument. XawToggleSetCurrent locates the Toggle widget to be set by matching radio_data against the |
To unset all Toggle widgets in a radio group use XawToggleUnsetCurrent.
void XawToggleUnsetCurrent(radio_group); radio_group Specifies any Toggle widget in the radio group. If this causes a Toggle widget to change state, all routines on its callback list will be invoked. 51 |
Menus
The Athena widget set provides support for single paned non-hierarchical popup and pulldown menus. Menus in the Athena widget set are implemented as a menu container (the SimpleMenu widget) and a The Athena widget set provides three classes of Sme objects that may be used to build menus. Sme The base class of all menu entries. It may be used as a menu entry itself to provide |
blank space in a menu. ``Sme'' means ``Simple Menu Entry.'' |
|||
SmeBSB |
This menu entry provides a selectable entry containing a text string. A bitmap may also |
||
SmeLine |
This menu entry provides an unselectable entry containing a separator line. |
The SimpleMenu widget informs the window manager that it should ignore its window by setting the To allow easy creation of pulldown menus, a MenuButton widget is also provided as part of the Athena |
The default configuration for the menus is press-drag-release. The menus will typically be activated by The menu remains on the screen as long as the pointer button is held down. Moving the pointer will |
Application Header file |
<X11/Xaw/SimpleMenu.h> |
The SimpleMenu widget is a container for the menu entries. It is a direct subclass of shell, and is should
be created with XtCreatePopupShell, not XtCreateManagedWidget. This is the only part of the menu
52
that actually is associated with a window. The SimpleMenu serves as the glue to bind the individual
menu entries together into a menu.
The resources associated with the SimpleMenu widget control aspects that will affect the entire menu.
accelerators |
A list of event to action bindings to be executed by this widget, even though the |
||
ancestorSensitive |
The sensitivity state of the ancestors of this widget. A widget is insensitive if |
||
backingStore |
Determines what type of backing store will be used for the menu. Legal values for this resource are NotUseful, WhenMapped, and Always. These values 53 |
Athena Widget Set libXaw 1.0.7
whenMapped, always, and default. If default is specified (the default
behavior) the server will use whatever it thinks is appropriate. |
|||
background |
A pixel value which indexes the widget's colormap to derive the background |
||
backgroundPixmap |
The background pixmap of this widget's window. If this resource is set to |
||
borderColor |
A pixel value which indexes the widget's colormap to derive the border color |
||
borderPixmap |
The border pixmap of this widget's window. If this resource is set to anything |
||
borderWidth |
The width of this widget's window border. |
bottomMargin
topMargin |
The amount of space between the top or bottom of the menu and the menu |
|
children colormap cursor depth destroyCallback geometry |
A list of all this composite widget's current children. The colormap that this widget will use. The shape of the mouse pointer whenever it is in this widget. The depth of this widget's window. All functions on this list are called when this widget is destroyed. If this resource is specified it will override the x, y, width and height of this |
|
height |
The height and width of this widget in pixels. |
|
label |
This label will be placed at the top of the SimpleMenu, and may not be |
|
labelClass mappedWhenManaged |
Specifies the type of Sme object created as the menu label. If this resource is True, then the widget's window will automatically be |
|
menuOnScreen |
If the menu is automatically positioned under the cursor with the |
|
numChildren overrideRedirect |
The number of children in this composite widget. Determines the value of the override_redirect attribute of the SimpleMenu's |
|
popdownCallback |
These callback functions are called by the Xt Intrinsics whenever the shell is |
|
popped up or down (See X Toolkit Intrinsics -- C Language Interface for |
||
popupOnEntry |
The XawPositionSimpleMenu action will, by default, popup the SimpleMenu 54 |
Athena Widget Set libXaw 1.0.7
the user a default menu entry that can be selected with out moving the pointer.
rowHeight |
If this resources is zero (the default) then each menu entry will be given its |
||
saveUnder screen sensitive |
If this is True then save unders will be active on the menu's window. The screen on which this widget is displayed. This is not a settable resource. Whether or not the toolkit should pass user events to this widget. The widget |
||
translations x |
The event bindings associated with this widget. The location of the upper left outside corner of this widget in its parent. |
||
The SimpleMenu widget supports the following actions:
· Switching the entry under the mouse pointer between the foreground and background colors with
highlight and unhighlight
· Processing menu entry callbacks with notify
The following are the default translation bindings used by the SimpleMenu widget:
<EnterWindow>: |
highlight( ) |
The user can pop down the menu without activating any of the callback functions by releasing the pointer The full list of actions supported by SimpleMenu is: highlight() Highlight the menu entry that is currently under the pointer. Only a item that is |
highlighted will be notified when the notify action is invoked. The look of a |
|||
unhighlight( ) |
Unhighlights the currently highlighted menu item, and returns it to its normal |
||
notify( ) |
Notifies the menu entry that is currently highlighted that is has been selected. |
||
MenuPopdown(menu) |
This action is defined in X Toolkit Intrinsics -- C Language Interface. |
If the SimpleMenu widget is to be used as a pulldown menu then the MenuButton widget, or some other If popup menus are desired it will be necessary to add the XawPositionSimpleMenu and MenuPopup Translation writers should be aware that Xt does not register grabs on ``don't care'' modifiers, and |
55
Athena Widget Set libXaw 1.0.7
!Ctrl<Btn1Down>: XawPositionSimpleMenu(xterm) MenuPopup(xterm)
!Ctrl<Btn2Down>: XawPositionSimpleMenu(modes) MenuPopup(modes)
XawPositionSimpleMenu(menu) |
The XawPositionSimpleMenu routine will search for the menu |
||
The XawPositionSimpleMenu action routine may often be invoked before any menus have been void XawSimpleMenuAddGlobalActions(app_con) |
XtAppContext app_con; app_con Specifies the application context in which this action should be registered. This function need only be called once per application and must be called before any widget that uses |
To get the currently highlighted menu entry use XawSimpleMenuGetActiveEntry:
Widget XawSimpleMenuGetActiveEntry(w) w Specifies the SimpleMenu widget. This function returns the menu entry that is currently highlighted, or NULL if no entry is highlighted. To clear the SimpleMenu widget's internal information about the currently highlighted menu entry use Widget XawSimpleMenuClearActiveEntry(w) |
Widget w;
w Specifies the SimpleMenu widget. This function unsets all internal references to the currently highlighted menu entry. It does not |
Application Header file |
<X11/Xaw/SmeBSB.h> 56 |
The SmeBSB object is used to create a menu entry that contains a string, and optional bitmaps in its left |
The resources associated with the SmeBSB object are defined in this section, and affect only the single
menu entry specified by this object.
ancestorSensitive |
The sensitivity state of the ancestors of this widget. A widget is insensitive if |
||
callback |
All callback functions on this list are called when the SimpleMenu notifies this |
||
destroyCallback font |
All functions on this list are called when this widget is destroyed. The text font to use when displaying the label, when the international |
||
fontSet |
The text font set to use when displaying the label, when the international |
||
foreground |
A pixel value which indexes the SimpleMenu's colormap to derive the |
||
height |
The height and width of this widget in pixels. Keep in mind that the |
||
SimpleMenu widget will force the width of all menu entries to be the width of |
|||
international |
This is a boolean flag, only settable at widget creation time. A value of false |
||
justify |
How the label is to be rendered between the left and right margins when the 57 |
values XtJustifyLeft, XtJustifyCenter, or XtJustifyRight. When specifying |
|||
label |
This is a the string that will be displayed in the menu entry. The exact location |
||
leftBitmap
rightBitmap |
This is a name of a bitmap to display in the left or right margin of the menu |
||
leftMargin
rightMargin |
This is the amount of space (in pixels) that will be left between the edge of the |
||
sensitive |
Whether or not the toolkit should pass user events to this widget. The widget |
||
vertSpace |
This is the amount of vertical padding, expressed as a percentage of the height |
||
Application Header file The SmeLine object is used to add |
<X11/Xaw/SmeLine.h> a horizontal line or menu separator to a menu. Since each SmeLine is |
an independent object, the application is able to change the color, height, and other attributes of the
SmeLine objects on an entry by entry basis. This object is not selectable, and will not highlight when the
pointer cursor is over it.
The resources associated with the SmeLine object are defined in this section, and affect only the single
menu entry specified by this object.
destroyCallback All functions on this list are called when this widget is destroyed.
58
foreground |
A pixel value which indexes the SimpleMenu's colormap to derive the |
||
height |
The height and width of this widget in pixels. Keep in mind that the |
||
SimpleMenu widget will force all menu items to be the width of the widest |
|||
international |
This is a boolean flag, only settable at widget creation time. While not utilized |
||
lineWidth stipple |
The width of the horizontal line that is to be displayed. If a bitmap is specified for this resource, the line will be stippled through it. This |
||
Application Header file |
<X11/Xaw/Sme.h> |
The Sme object is the base class for all menu entries. While this object is mainly intended to be
subclassed, it may be used in a menu to add blank space between menu entries.
The resources associated with the SmeLine object are defined in this section, and affect only the single
menu entry specified by this object. There are no new resources added for this class, as it picks up all its
resources from the RectObj class.
ancestorSensitive |
The sensitivity state of the ancestors of this widget. A widget is insensitive if |
||
destroyCallback height |
All functions on this list are called when this widget is destroyed. The height and width of this widget in pixels. Keep in mind that the |
||
SimpleMenu widget will force all menu items to be the width of the widest |
|||
international |
This is a boolean flag, only settable at widget creation time. While not utilized 59 |
sensitive |
Whether or not the toolkit should pass user events to this widget. The widget |
||
To Create a new Sme object class you will need to define three class methods. These methods allow the Highlight( ) Called to put the menu entry into the highlighted state. Unhighlight( ) Called to return the widget to its normal (unhighlighted) state. Notify( ) Called when the user selects this menu entry. Other then these methods, creating a new object is straight forward. Here is some information that may 1) Objects can be zero pixels high. 2) Objects draw on their parent's window, therefore the Drawing dimensions are different from those of |
widgets. For instance, y locations vary from y to y + height, not 0 to height. |
|||
3) |
XtSetValues calls may come from the application while the Sme is highlighted, and if the SetValues |
||
4) |
Remember that your subclass of the Sme does not own the window. Share the space with other menu |
||
Application Header file |
<X11/Xaw/MenuButton.h> |
The MenuButton widget is an area, often rectangular, that displays a graphic. The graphic may be a text When the pointer cursor is on a MenuButton widget, the MenuButton becomes highlighted by drawing a |
When creating a MenuButton widget instance, the following resources are retrieved from the argument
list or from the resource database:
accelerators |
A list of event to action bindings to be executed by this widget, even though the |
||
ancestorSensitive |
The sensitivity state of the ancestors of this widget. A widget is insensitive if |
||
background |
A pixel value which indexes the widget's colormap to derive the background |
||
backgroundPixmap |
The background pixmap of this widget's window. If this resource is set to |
||
bitmap |
A bitmap to display instead of the label. The default size of the widget will be 61 |
Athena Widget Set libXaw 1.0.7
background color. If bitmap has a depth greater than one, it is copied directly
into the window. |
|||
borderColor |
A pixel value which indexes the widget's colormap to derive the border color |
||
borderPixmap |
The border pixmap of this widget's window. If this resource is set to anything |
||
borderWidth callback colormap cornerRoundPercent |
The width of this widget's window border. A list of routines to be called when the notify action is invoked. The colormap that this widget will use. When a ShapeStyle of roundedRectangle is used, this resource controls the |
||
cursor |
The image that will be displayed as the pointer cursor whenever it is in this |
||
cursorName |
The name of the symbol to use to represent the pointer cursor. This resource |
||
depth destroyCallback font |
The depth of this widget's window. All functions on this list are called when this widget is destroyed. The text font to use when displaying the label, when the international |
||
fontSet |
The text font set to use when displaying the label, when the international |
||
foreground |
A pixel value which indexes the widget's colormap to derive the foreground |
||
height |
The height and width of this widget in pixels. |
||
highlightThickness |
The thickness of the rectangle that is used to highlight the internal border of this |
||
insensitiveBorder |
This pixmap will be tiled into the widget's border if the widget becomes |
||
internalHeight |
The minimum amount of space to leave between the graphic and the vertical |
||
and horizontal edges of the window. |
|||
international |
This is a boolean flag, only settable at widget creation time. A value of false |
||
justify |
Specifies left, center, or right alignment of graphic within the widget. This |
||
label |
Specifies the text string to be displayed in the widget's window if no bitmap is 62 |
Athena Widget Set libXaw 1.0.7
encoding or international, a single newline character (1 byte) will cause a line
break. |
|||
mappedWhenManaged |
If this resource is True, then the widget's window will automatically be |
||
menuName |
The name of a popup shell to popup as a menu. The MenuButton will search |
||
pointerColor |
A pixel value which indexes the widget's colormap to derive the foreground |
||
pointerColorBackground |
A pixel value which indexes the widget's colormap to derive the |
||
resize |
Specifies whether the widget should attempt to resize to its preferred |
||
screen sensitive |
The screen on which this widget is displayed. This is not a settable resource. Whether or not the toolkit should pass user events to this widget. The widget |
||
shapeStyle |
Nonrectangular widgets may be created using this resource. Nonrectangular |
||
translations x |
The event bindings associated with this widget. The location of the upper left outside corner of this widget in its parent. |
||
The MenuButton widget supports the following actions: · Switching the button between the foreground and background colors with set and unset · Processing application callbacks with notify · Switching the internal border between highlighted and unhighlighted states with highlight |
and |
unhighlight
· Popping up a menu with PopupMenu
The following are the default translation bindings used by the MenuButton widget:
<EnterWindow>: highlight( )
<LeaveWindow>: |
reset( ) 63 |
The full list of actions supported by MenuButton is:
highlight(condition) |
Displays the internal highlight border in the color (foreground or background ) |
||
unhighlight( ) |
Displays the internal highlight border in the color (XtNforeground or |
||
set( ) |
Enters the set state, in which notify is possible. This action causes the button |
||
unset( ) |
Cancels the set state and displays the interior of the button in the background |
||
reset( ) |
Cancels any set or highlight and displays the interior of the button in the |
||
notify( ) |
When the button is in the set state this action calls all functions in the callback |
||
PopupMenu( ) |
Pops up the menu specified by the menuName resource. |
The MenuButton widget does not place a server grab on itself. Instead, PopupMenu is registered as a |
64
Text Widgets
The Text widget provides a window that will allow an application to display and edit one or more lines of The Text widget is made up of a number of pieces; it was modularized to ease customization. The The words insertion point are used in this chapter to refer to the text caret. This is the symbol that is The text widget supports three edit modes, controlling the types of modifications a user is allowed to · Append-only · Editable · Read-only Read-only mode does not allow the user or the programmer to modify the text in the widget. While the |
The Text widget provides many of the common keyboard editing commands. These commands allow
users to move around and edit the buffer. If an illegal operation is attempted, (such as deleting characters
in a read-only text widget), the X server will beep.
The default key bindings are patterned after those in the EMACS text editor: Ctrl-a Beginning Of Line Meta-b |
Backward Word |
||
Ctrl-b Backward Character Meta-f 65 |
Forward Word |
Athena Widget Set libXaw 1.0.7 Ctrl-s Search/Replace Forward Meta-[ Backward Paragraph
Ctrl-t |
Transpose Characters |
Meta-Delete |
Delete Previous Word |
||||
Ctrl-v |
Next Page |
Meta-Shift Delete |
Kill Previous Word |
In addition, the pointer may be used to cut and paste text:
Button 1 Down Button 2 Down Button 3 Down |
Start Selection Insert Current Selection (paste) Extend Current Selection |
Since all of these key and pointer bindings are set through the translations and resource manager, the
user and the application programmer can modify them by changing the Text widget's translations
resource.
The Text widget provides a search popup that can be used to search for a string within the current Text
widget. The popup can be activated by typing either Control-r or Control-s. If Control-s is used the
search will be forward in the file from the current location of the insertion point; if Control-r is used the
search will be backward. The activated popup is placed under the pointer. It has a number of buttons
that allow both text searches and text replacements to be performed.
At the top of the search popup are two toggle buttons labeled backward and forward. One of these
buttons will always be highlighted; this is the direction in which the search will be performed. The user
can change the direction at any time by clicking on the appropriate button.
Directly under the buttons there are two text areas, one labeled Search for: and the other labeled Replace
with:. If this is a read-only Text widget the Replace with: field will be insensitive and no replacements will be allowed. After each of these labels will be a text field. This field will allow the user to enter a string to
search for and the string to replace it with. Only one of these text fields will have a window border around it; this is the active text field. Any key presses that occur when the focus in in the search popup will be
directed to the active text field. There are also a few special key sequences:
Carriage Return: |
Execute the action, and pop down the search widget. |
Using these special key sequences should allow simple searches without ever removing one's hands from the keyboard.
Near the bottom of the search popup is a row of buttons. These buttons allow the same actions to to be |
66
Athena Widget Set libXaw 1.0.7 Search Search for the specified string.
Replace |
Replace the currently highlighted string with the string in the Replace with text field, and |
||
Replace-All |
Replace all occurrences of the search string with the replace string from the current |
||
Cancel |
Remove the search popup from the screen. |
Finally, when international resource is true, there may be a pre-edit buffer below the button row, for The widget hierarchy for the search popup is show below, all widgets are listed by class and instance Text <name of Text widget> |
TransientShell search |
To insert a file into a text widget, type the key sequence Meta-i, which will activate the file insert popup. The widget hierarchy for the file insert popup is show below; all widgets are listed by class and instance Text <name of Text widget> |
TransientShell insertFile |
The text widgets have a text selection mechanism that allows the user to copy pieces of the text into the
PRIMARY selection, and paste into the text widget some text that another application (or text widget)
has put in the PRIMARY selection.
67
Athena Widget Set libXaw 1.0.7 One method of selecting text is to press pointer button 1 on the beginning of the text to be selected, drag
the pointer until all of the desired text is highlighted, and then release the button to activate the selection.
Another method is to click pointer button 1 at one end of the text to be selected, then click pointer button 3 at the other end.
To modify a currently active selection, press pointer button 3 near either the end of the selection that you The selected text may now be pasted into another application, and will remain active until some other Rapidly clicking pointer button 1 the following number of times will adjust the selection as described. Two Select the word under the pointer. A word boundary is defined by the Text widget to be Three Select the line under the pointer. Four Select the paragraph under the pointer. A paragraph boundary is defined by the text |
Five |
widget as two Carriage Returns in a row with only Spaces or Tabs between them. Select the entire text buffer. |
To unset the text selection, click pointer button 1 without moving it.
All editing functions are performed by translation manager actions that may be specified through the
translations resource in the Text widget. Insert Point Movement |
Delete |
||
forward-character |
delete-next-character Selection |
||
next-line |
select-word |
||
Miscellaneous |
New Line Kill |
||
focus-in |
kill-word 68 |
Athena Widget Set libXaw 1.0.7
multiply kill-selection
form-paragraph |
kill-to-end-of-line |
Most of the actions take no arguments, and unless otherwise noted you may assume this to be the case.
forward-character( ) |
These actions move the insert point forward or backward one |
||
character in the buffer. If the insert point is at the end or beginning of |
|||
forward-word( ) |
These actions move the insert point to the next or previous word |
||
boundary. A word boundary is defined as a Space, Tab or Carriage |
|||
forward-paragraph( ) |
These actions move the insert point to the next or previous paragraph |
||
boundary. A paragraph boundary is defined as two Carriage Returns |
|||
beginning-of-line( ) |
These actions move to the beginning or end of the current line. If the |
||
insert point is already at the end or beginning of the line then no action |
|||
next-line( ) |
These actions move the insert point up or down one line. If the insert |
||
point is currently N characters from the beginning of the line then it |
|||
next-page( ) |
These actions move the insert point up or down one page in the file. |
||
One page is defined as the current height of the text widget. The |
|||
beginning-of-file( ) |
These actions place the insert point at the beginning or end of the |
||
current text buffer. The text widget is then scrolled the minimum |
|||
scroll-one-line-up( ) |
These actions scroll the current text field up or down by one line. |
||
They do not move the insert point. Other than the scrollbars this is the |
|||
69
Athena Widget Set libXaw 1.0.7 delete-next-character( )
delete-previous-character( ) |
These actions remove the character immediately before or after the |
||
delete-next-word( ) |
These actions remove all characters between the insert point location |
||
and the next word boundary. A word boundary is defined as a Space, |
|||
delete-selection( ) |
This action removes all characters in the current selection. The |
||
select-word( ) |
This action selects the word in which the insert point is currently |
|
select-all( ) select-start( ) |
This action selects the entire text buffer. This action sets the insert point to the current pointer location (if |
|
select-adjust( ) |
This action allows a selection started with the select-start action to be |
|
select-end(name[,name,...]) |
This action ends a text selection that began with the select-start |
|
extend-start( ) |
This action finds the nearest end of the current selection, and moves it |
|
extend-adjust( ) |
This action allows a selection started with an extend-start action to be |
|
extend-end(name[,name,...]) |
This action ends a text selection that began with the extend-start |
|
insert-selection(name[,name,...]) |
This action retrieves the value of the first (left-most) named selection |
|
newline-and-indent( ) |
This action inserts a newline into the text and adds spaces to that line |
||
newline-and-backup( ) newline( ) |
This action inserts a newline into the text after the insert point. This action inserts a newline into the text before the insert point. 70 |
kill-word( ) |
These actions act exactly like the delete-next-word and delete- |
|
previous-word actions, but they stuff the word that was killed into the |
||
kill-selection( ) |
This action deletes the current selection and stuffs the deleted text into |
|
kill-to-end-of-line( ) |
This action deletes the entire line to the right of the insert point |
|
kill-paragraph( ) |
This action deletes the current paragraph, if between paragraphs it |
|
kill-to-end-of-paragraph( ) |
This action deletes everything between the current insert point |
|
redraw-display( ) |
This action recomputes the location of all the text lines on the display, |
|
insert-file([filename]) |
This action activates the insert file popup. The filename option |
|
insert-char( ) |
This action may only be attached to a key event. When the |
|
insert-string(string[,string,...]) |
This action inserts each string into the text at the insert point location. |
|
display-caret(state,when) |
This action allows the insert point to be turned on and off. The state 71 |
Athena Widget Set libXaw 1.0.7
*Text.Translations: #override \
<FocusIn>: display-caret(on) \n\
focus-in( ) |
<FocusOut>: |
display-caret(off) |
focus-out( ) search(direction,[string]) |
These actions do not currently do anything. This action activates the search popup. The direction must be |
||
multiply(value) |
The multiply action allows the user to multiply the effects of many of |
||
form-paragraph( ) |
This action removes all the Carriage Returns from the current |
||
transpose-characters( ) |
This action will swap the position of the character to the left of the |
||
no-op([action]) |
The no-op action makes no change to the text widget, and is mainly |
XawWMProtocols([wm_protocol_name])
This action is written specifically for the file insertion and the search |
reconnect-im() |
When the international resource is true, input is usually passed to an 72 |
The default behavior of the text selection array is described in the section called Text Selections for The array contains a list of entries that will be called when the user attempts to select text in rapid |
array is recycled beginning with the first element.
The default selectType array is:
{XawselectPosition, XawselectWord, XawselectLine, XawselectParagraph, XawselectAll, XawselectNull} The selection array is not copied by the text widgets. The application must allocate space for the array
and cannot deallocate or change it until the text widget is destroyed or until a new selection array is set.
The following translations are defaults built into every Text widget. They can be overridden, or replaced
by specifying a new value for the Text widget's translations resource.
Ctrl<Key>A: |
beginning-of-line( ) \n\ 73 |
Athena Widget Set libXaw 1.0.7
Ctrl<Key>T: transpose-characters( ) \n\
Ctrl<Key>U: |
multiply(4) \n\ |
|||
Shift Meta<Key>Delete: ~Shift Meta<Key>Delete: |
delete-previous-word( ) \n\ |
|||
Shift Meta<Key>Backspace: |
delete-previous-word( ) \n\ |
The following functions are provided as convenience routines for use with the Text widget. Although These data structures are defined in the Text widget's public header file, <X11/Xaw/Text.h>. typedef long XawTextPosition; |
74
Athena Widget Set libXaw 1.0.7 Character positions in the Text widget begin at 0 and end at n, where n is the number of characters in the
Text source widget.
typedef struct {
int firstPos; firstPos The first position, or index, |
to use within the ptr field. The value is commonly zero. |
length The number of characters |
to be used from the ptr field. The number of characters used |
is commonly the number of characters in ptr, and must not be greater than the length of |
|||
ptr format |
Contains the string to be referenced by the Text widget. This flag indicates whether the data pointed to by ptr is char or wchar_t. When the |
Note: Previous versions of Xaw used FMT8BIT , which has been retained for backwards compatibility.
FMT8BIT is deprecated and will eventually be removed from the implementation.
To select a piece of text, use XawTextSetSelection :
void XawTextSetSelection(w, left, right)
Widget w;
XawTextPosition left, right;
w Specifies the Text widget.
left right |
Specifies the character position at which the selection begins. Specifies the character position at which the selection ends. |
See section 5.4 for a description of XawTextPosition. If redisplay is enabled, this function highlights the
text and makes it the PRIMARY selection. This function does not have any effect on CUT_BUFFER0.
To unhighlight previously highlighted text in a widget, use XawTextUnsetSelection:
void XawTextUnsetSelection(w)
Widget w;
w Specifies the Text widget.
To retrieve the text that has been selected by this text widget use XawTextGetSelectionPos:
void XawTextGetSelectionPos(w, begin_return, end_return)
Widget w;
XawTextPosition *begin_return, *end_return;
w Specifies the Text widget.
begin_return Returns the beginning of the text selection.
end_return Returns the end of the text selection.
See section 5.4 for a description of XawTextPosition. If the returned values are equal, no text is
currently selected.
75
To modify the text in an editable Text widget use XawTextReplace:
int XawTextReplace(w, start, end, text)
w |
Widget w; Specifies the Text widget. |
start end text This function will |
Specifies the starting character position of the text replacement. Specifies the ending character position of the text replacement. Specifies the text to be inserted into the file. not be able to replace text in read-only text widgets. It will also only be able to append |
text to an append-only text widget. See section 5.4 for a description of XawTextPosition and XawTextBlock. This function may return the following values: XawEditDone The text replacement was successful. XawPositionError The edit mode is XawtextAppend and start is not the |
position of the last character |
of the source.
XawEditError Either the Source was read-only or the range to be deleted is larger than the length
of the Source. The XawTextReplace arguments start and end represent the text source character positions for the |
To search for a string in the Text widget, use XawTextSearch:
XawTextPosition XawTextSearch(w, dir, text)
Widget w; |
|||
w dir |
Specifies the Text widget. Specifies the direction to search in. Legal values are XawsdLeft and XawsdRight. |
text Specifies a text block structure that contains the text to search for. See section 5.4 for a description of XawTextPosition and XawTextBlock. The XawTextSearch function will begin at the insertion point and search in the direction specified for a string that matches the one |
To redisplay a range of characters, use XawTextInvalidate:
void XawTextInvalidate(w, from, to)
Widget w;
XawTextPosition from, to;
w Specifies the Text widget.
from to |
Specifies the start of the text to redisplay. Specifies the end of the text to redisplay. |
See section 5.4 for a description of XawTextPosition. The XawTextInvalidate function causes the
specified range of characters to be redisplayed immediately if redisplay is enabled or the next time that
redisplay is enabled.
76
Athena Widget Set libXaw 1.0.7 To enable redisplay, use XawTextEnableRedisplay:
void XawTextEnableRedisplay(w) w Specifies the Text widget. The XawTextEnableRedisplay function flushes any changes due to batched updates when To disable redisplay while making several changes, use XawTextDisableRedisplay. void XawTextDisableRedisplay(w) |
Widget w;
w Specifies the Text widget. The XawTextDisableRedisplay function causes all changes to be batched until either XawTextDisplay To display batched updates, use XawTextDisplay: void XawTextDisplay(w) |
Widget w;
w Specifies the Text widget.
The XawTextDisplay function forces any accumulated updates to be displayed.
To obtain the character position of the left-most character on the first line displayed in the widget (the
value of the displayPosition resource), use XawTextTopPosition.
XawTextPosition XawTextTopPosition(w) w Specifies the Text widget. To assign a new selection array to a text widget use XawTextSetSelectionArray: void XawTextSetSelectionArray(w, sarray) |
Widget w;
XawTextSelectType * sarray;
w Specifies the Text widget.
sarray |
Specifies a selection array as defined in the section called Text Selections for |
Calling this function is equivalent to setting the value of the selectionTypes resource.
To move the insertion point to the specified source position, use XawTextSetInsertionPoint:
void XawTextSetInsertionPoint(w, position)
Widget w;
XawTextPosition position;
w position |
Specifies the Text widget. Specifies the new position for the insertion point. |
See section 5.4 for a description of XawTextPosition. The text will be scrolled vertically if necessary to To obtain the current position of the insertion point, use XawTextGetInsertionPoint: |
77
Athena Widget Set libXaw 1.0.7 XawTextPosition XawTextGetInsertionPoint(w)
Widget w;
w Specifies the Text widget. See section 5.4 for a description of XawTextPosition. The result is equivalent to retrieving the value of To replace the text source in the specified widget, use XawTextSetSource: void XawTextSetSource(w, source, position) |
w |
Widget w; Specifies the Text widget. |
source Specifies the text source object.
position |
Specifies character position that will become the upper left hand corner of the displayed |
See section 5.4 for a description of XawTextPosition. A display update will be performed if redisplay is To obtain the current text source for the specified widget, use XawTextGetSource: Widget XawTextGetSource(w) |
Widget w;
w Specifies the Text widget. This function returns the text source that this Text widget is currently using. To enable and disable the insertion point, use XawTextDisplayCaret: void XawTextDisplayCaret(w, visible) |
Widget w;
Boolean visible;
w visible |
Specifies the Text widget. Specifies whether or not the caret should be displayed. |
If visible is False the insertion point will be disabled. The marker is re-enabled either by setting visible to
True, by calling XtSetValues, or by executing the display-caret action routine.
Application Header file |
<X11/Xaw/AsciiText.h> |
For the ease of internationalization, the AsciiText widget class name has not been changed, although it is |
78
children of the AsciiText widget, and not the AsciiText widget itself. However, these resources may be
set directly on the AsciiText widget at widget creation time, or via XtSetValues.
When creating an AsciiText widget instance, the following resources are retrieved from the argument list
or from the resource database:
accelerators |
A list of event to action bindings to be executed by this widget, even though the |
||
ancestorSensitive |
The sensitivity state of the ancestors of this widget. A widget is insensitive if |
||
autoFill |
If this resource is True the text widget will automatically break a line when the |
||
background |
A pixel value which indexes the widget's colormap to derive the background |
||
backgroundPixmap |
The background pixmap of this widget's window. If this resource is set to |
||
borderColor |
A pixel value which indexes the widget's colormap to derive the border color |
||
borderPixmap |
The border pixmap of this widget's window. If this resource is set to anything |
||
borderWidth bottomMargin |
The width of this widget's window border. The amount of space, in pixels, between the edge of the window and the |
||
corresponding edge of the text within the window. If there is a scrollbar active |
|||
callback |
The callbacks registered on this resource will be called every time the text |
||
colormap cursor |
The colormap that this widget will use. The image that will be displayed as the pointer cursor whenever it is in this |
||
cursorName |
The name of the symbol to use to represent the pointer cursor. This resource |
||
dataCompression |
The AsciiSrc uses an algorithm that may cause the text buffer to grow to about |
||
depth destroyCallback |
The depth of this widget's window. All functions on this list are called when this widget is destroyed. 80 |
Athena Widget Set libXaw 1.0.7 displayCaret Whether or not to display the text insert point.
displayNonprinting |
If this resource is True, the Text widget will display all non-printable |
||
space where a non-printable character exists in the text buffer. This is a |
|||
displayPosition |
The position in the text buffer of the character that is currently displayed in the |
||
editType |
This is the type of editing that will be allowed in this text widget. Legal values |
||
echo |
Whether or not to echo characters to the screen. The buffer can still be edited, but nothing is displayed. This mode can be useful for entering passwords and |
||
font |
The text font to use when displaying the string, when the international |
||
font |
The text font set to use when displaying the string, when the international |
||
foreground |
A pixel value which indexes the Text widget's colormap to derive the |
||
height |
The height and width of this widget in pixels. |
||
insensitiveBorder |
This pixmap will be tiled into the widget's border if the widget becomes |
||
insertPosition |
This is the location of the insert point. It is expressed in characters from the |
||
length |
If the useStringInPlace resource is False this attribute has no effect. If that |
||
mappedWhenManaged |
If this resource is True, then the widget's window will automatically be |
||
pointerColor |
A pixel value which indexes the widget's colormap to derive the foreground |
||
pointerColorBackground |
A pixel value which indexes the widget's colormap to derive the |
||
pieceSize |
This is the size of the internal chunks into which the text buffer is broken down |
||
resize |
Controls whether or not the Text widget attempts to resize itself when it is no 81 |
Athena Widget Set libXaw 1.0.7
will convert the following strings: never, height, width, and both.
screen scrollHorizontal |
The screen on which this widget is displayed. This is not a settable resource. These resources control the placement of scrollbars on the left and bottom |
|
edge of the text widget. These resources accept the values |
||
selectTypes |
Specifies the selection type array that is used when multi-click is activated (see |
|
sensitive |
Whether or not the toolkit should pass user events to this widget. The widget |
|
string |
If type is XawAsciiString then this string contains the buffer to be displayed in |
|
textSink |
These are the TextSink or TextSource objects used by this widget. When |
|
international is set to true the AsciiText widget initializes these resources to |
||
translations type |
The event bindings associated with this widget. This resource may be either XawAsciiString or XawAsciiFile. The value of |
|
useStringInPlace |
Setting this resource to True will disable the memory management provided by |
|
wrap |
When the text in any one line is wider than the window there are several 82 |
Athena Widget Set libXaw 1.0.7
The accepted values for this resource are XawtextWrapNever,
XawtextWrapLine, and XawtextWrapWord. With XawtextWrapLine all |
||
x |
The location of the upper left outside corner of this widget in its parent. |
|
Application Header file |
<X11/Xaw/AsciiSrc.h> or <X11/Xaw/MultiSrc.h> |
The AsciiSrc or MultiSrc object is used by a text widget to read the text from a file or string in memory. The AsciiSrc understands all Latin1 characters plus Tab and Carriage Return. The MultiSrc The AsciiSrc can be either of two types: XawAsciiFile or XawAsciiString. AsciiSrc objects of type XawAsciiFile read the text from a file and store it into an internal buffer. This AsciiSrc objects of type XawAsciiString have the text buffer implemented as a string. MultiSrc objects |
is responsible for allocating and managing storage for the string.
In the default case for AsciiSrc objects of type XawAsciiString, the resource useStringInPlace is false,
and the widget owns the string. The initial value of the string resource, and any update made by the
application programmer to the string resource with XtSetValues, is copied into memory private to the
widget, and managed internally by the widget. The application writer does not need to worry about
running out of buffer space (subject to the total memory available to the application). The performance
does not decay linearly as the buffer grows large, as is necessarily the case when the text buffer is used in place. The application writer must use XtGetValues to determine the contents of the text buffer, which
will return a copy of the widget's text buffer as it existed at the time of the XtGetValues call. This copy is not affected by subsequent updates to the text buffer, i.e., it is not updated as the user types input into the
text buffer. This copy is freed upon the next call to XtGetValues to retrieve the string resource; however, When the resource useStringInPlace is true and the AsciiSrc object is of type XawAsciiString, the |
83
When creating an AsciiSrc object instance, the following resources are retrieved from the argument list
or from the resource database:
callback |
The callbacks registered on this resource will be called every time the text |
||
destroyCallback dataCompression |
All functions on this list are called when this widget is destroyed. The AsciiSrc uses an algorithm that may cause the text buffer to grow to about |
||
editType |
This is the type of editing that will be allowed in this text widget. Legal values |
||
length |
If the useStringInPlace resource is False this attribute has no effect. If that |
||
pieceSize |
This is the size of the internal chunks into which the text buffer is broken down |
||
string |
If type is XawAsciiString then this string contains the buffer to be displayed in |
||
type |
This resource may be either XawAsciiString or XawAsciiFile. The value of |
||
useStringInPlace |
Setting this resource to True will disable the memory management provided by 84 |
Athena Widget Set libXaw 1.0.7
place can be much more efficient for text widgets that display static data, or
where the programmer wishes to impose strict constraints on the contents of |
The AsciiSrc has a few convenience routines that allow the application programmer quicker or easier
access to some of the commonly used functionality of the AsciiSrc.
When the AsciiSrc widget is not in useStringInPlace mode space must be allocated whenever the file is void XawAsciiSourceFreeString(w) w Specifies the AsciiSrc object. This function will free the memory that contains the string pointer returned by XtGetValues. This will |
To save the changes made in the current text source into a file use XawAsciiSave. Boolean XawAsciiSave(w) w Specifies the AsciiSrc object. XawAsciiSave returns True if the save was successful. It will update the file named in the string To save the contents of the current text buffer into a named file use XawAsciiSaveAsFile. Boolean XawAsciiSaveAsFile(w, name) w Specifies the AsciiSrc object. name The name of the file to save the current buffer into. This function returns True if the save was successful. XawAsciiSaveAsFile will work with a buffer of |
To find out if the text buffer in an AsciiSrc object has changed since the last time it was saved with Boolean XawAsciiSourceChanged(w) w Specifies the AsciiSrc object. |
85
This function will return True if the source has changed since the last time it was saved or queried. The
internal change flag is reset whenever the string is queried via XtGetValues or the buffer is saved via
XawAsciiSave.
Application Header file |
<X11/Xaw/AsciiSink.h> |
The AsciiSink or MultiSink object is used by a text widget to render the text. Depending on its |
When creating an AsciiSink object instance, the following resources are retrieved from the argument list
or from the resource database:
background |
A pixel value which indexes the widget's colormap to derive the background |
||
destroyCallback displayNonprinting |
All functions on this list are called when this widget is destroyed. If this resource is True, the Text widget will display all non-printable |
||
space where a non-printable character exists in the text buffer. |
|||
echo |
Whether or not to echo characters to the screen. The buffer can still be edited, |
||
font |
The text font to use when displaying the string. (This resource is present in |
||
fontSet |
The text font set to use when displaying the string. (This resource is present in |
||
The remainder of this chapter will describe customizing the Text widget. The Text widget may be
customized by subclassing, or by creating new sources and sinks. Subclassing is described in detail in
86
Chapter 7; this section will describe only those things that are specific to the Text widget. Attributes of The Text widget is made up of a number of different pieces, with the Text widget as the base widget Each of the following pieces of the Text widget has a specific purpose, and will be, or has been, discussed Text This is the glue that binds everything else together. This widget reads the text data from |
the source, and displays the information in the sink. All translations and actions are |
|||
TextSink |
This object is responsible for displaying and clearing the drawing area. It also reports the |
||
TextSrc AsciiSink |
This object is responsible for reading, editing and searching through the text buffer. This object is a subclass of the TextSink and knows how to display ASCII text. Support |
||
MultiSink AsciiSrc MultiSrc |
This object is a subclass of the TextSink and knows how to display font sets. This object is a subclass of the TextSrc and knows how to read strings and files. This object is a subclass of the TextSrc and knows how to read strings and multibyte files, |
||
AsciiText |
This widget is a subclass of the Text widget. When created, the AsciiText automatically |
||
Application Header file |
<X11/Xaw/Text.h> |
The Text widget is the glue that binds all the other pieces together, it maintains the internal state of the This section lists the resources that are actually part of the Text widget, and explains the functionality |
When creating a Text widget instance, the following resources are retrieved from the argument list or
from the resource database:
accelerators |
A list of event to action bindings to be executed by this widget, even though the |
||
ancestorSensitive |
The sensitivity state of the ancestors of this widget. A widget is insensitive if |
||
autoFill |
If this resource is True the text widget will automatically break a line when the user attempts to type into the right margin. The attribute has no effect on files |
||
background |
A pixel value which indexes the widget's colormap to derive the background |
||
backgroundPixmap |
The background pixmap of this widget's window. If this resource is set to |
||
borderColor |
A pixel value which indexes the widget's colormap to derive the border color |
||
borderPixmap |
The border pixmap of this widget's window. If this resource is set to anything 88 |
Athena Widget Set libXaw 1.0.7 borderWidth The width of this widget's window border.
topMargin |
The amount of space, in pixels, between the edge of the window and the |
||
colormap cursor |
The colormap that this widget will use. The image that will be displayed as the pointer cursor whenever it is in this |
||
cursorName |
The name of the symbol to use to represent the pointer cursor. This resource |
||
depth destroyCallback displayCaret displayPosition |
The depth of this widget's window. All functions on this list are called when this widget is destroyed. Whether or not to display the text insert point. The position in the text buffer of the character that is currently displayed in the |
||
height |
The height and width of this widget in pixels. |
||
insensitiveBorder |
This pixmap will be tiled into the widget's border if the widget becomes |
||
insertPosition |
This is the location of the insert point. It is expressed in characters from the |
||
mappedWhenManaged |
If this resource is True, then the widget's window will automatically be |
||
pointerColor |
A pixel value which indexes the widget's colormap to derive the foreground |
||
pointerColorBackground |
A pixel value which indexes the widget's colormap to derive the |
||
resize |
Controls whether or not the Text widget attempts to resize itself when it is no |
||
screen |
The screen on which this widget is displayed. This is not a settable resource. |
scrollHorizontal
scrollVertical |
These resources control the placement of scrollbars on the left and bottom |
||
selectTypes |
Specifies the selection type array that is used when multi-click is activated (see 89 |
used in place, and must not be freed until the widget is destroyed. There is no |
|||
sensitive |
Whether or not the toolkit should pass user events to this widget. The widget |
||
textSink
textSource |
These are the TextSink or TextSource objects used by this widget. When |
||
translations wrap |
The event bindings associated with this widget. When the text in any one line is wider than the window there are several |
||
unrealizeCallback |
A list of callback functions which will be executed when the Text widget is |
||
x |
The location of the upper left outside corner of this widget in its parent. |
||
Application Header file |
<X11/Xaw/TextSrc.h> |
The TextSrc object is the root object for all text sources. Any new text source objects should be Since all text sources will have some resources in common the TextSrc defines a few new resources. |
When creating an TextSrc object instance, the following resources are retrieved from the argument list
or from the resource database:
destroyCallback editType |
All functions on this list are called when this widget is destroyed. This is the type of editing that will be allowed in this text widget. Legal values 90 |
The only purpose of the TextSrc Object is to be subclassed. It contains the minimum set of class methods |
things will probably happen.
To read the text in a text source use the Read function: XawTextPosition Read(w, pos, text_return, length) w Specifies the TextSrc object. pos Specifies the position of the first character to be |
to be read from the text buffer. |
text Returns the text read from the source. length Specifies the maximum number of characters |
the TextSrc should return to the |
application in text_return. This function returns the text position immediately after the characters read from the text buffer. The |
To replace or edit the text in a text buffer use the Replace function: XawTextPosition Replace(w, start, end, text) w Specifies the TextSrc object. start Specifies the position of the first character to be removed |
from the text buffer. This is |
also the location to begin inserting the new text. |
|||
end |
Specifies the position immediately after the last character to be removed from the text |
||
text |
Specifies the text to be added to the text source. |
This function can return any of the following values:
XawEditDone The text replacement was successful.
XawPositionError The edit mode is XawtextAppend and start is not the last character of the source.
91
Athena Widget Set libXaw 1.0.7 XawEditError Either the Source was read-only or the range to be deleted is larger than the length
of the Source. The Replace arguments start and end represent the text source character positions for the existing text |
To search the text source for one of the predefined boundary types use the Scan function: XawTextPosition Scan(w, position, type, dir, count, include) w Specifies the TextSrc object. position Specifies the position to begin scanning the source. type Specifies the type of boundary to scan for, may be one of: XawstPosition, |
, |
XawstWhiteSpace, XawstEOL, XawstParagraph, XawstAll. The exact meaning of |
|||
dir |
Specifies the direction to scan, may be either XawsdLeft to search backward, or |
||
count include |
Specifies the number of boundaries to scan for. Specifies whether the boundary itself should be included in the scan. |
The Scan function returns the position in the text source of the desired boundary. It is expected to return
a valid address for all calls made to it, thus if a particular request is made that would take the text widget
beyond the end of the source it must return the position of that end.
To search for a particular string use the Search function. XawTextPosition Search(w, position, dir, text) w Specifies the TextSrc object. position Specifies the position to begin the search. dir Specifies the direction to search, may be either |
either XawsdLeft to search backward, or |
XawsdRight to search forward.
text Specifies a text block containing the text to search for.
This function will search through the text buffer attempting to find a match for the string in the text block.
If a match is found in the direction specified, then the character location of the first character in the string
is returned. If no text was found then XawTextSearchError is returned.
While many selection types are handled by the Text widget, text sources may have selection types
unknown to the Text widget. When a selection conversion is requested by the X server the Text widget
will first call the ConvertSelection function, to attempt the selection conversion.
92
Athena Widget Set libXaw 1.0.7 Boolean ConvertSelections(w, selection, target, type, value_return, length_return, format_return)
Widget w; w Specifies the TextSrc |
object. |
selection Specifies the type target Specifies the type |
of selection that was requested (e.g. PRIMARY). of the selection that has been requested, which indicates the desired |
information about the selection (e.g. Filename, Text, Window). |
||
type |
Specifies a pointer to the atom into which the property type of the converted value of the |
|
value_return |
Returns a pointer into which a pointer to the converted value of the selection is to be |
|
length_return |
Returns a pointer into which the number of elements in value is to be stored. The size of |
|
format_return |
Returns a pointer into which the size in bits of the data elements of the selection value is |
If this function returns True then the Text widget will assume that the source has taken care of converting the selection, Otherwise the Text widget will attempt to convert the selection itself.
If the source needs to know when the text selection is modified it should define a SetSelection procedure: void SetSelection(w, start, end, selection) w Specifies the TextSrc object. start Specifies the character position of the beginning of the new text selection. end Specifies the character position of the end of the new text selection. selection Specifies the type of selection that was requested (e.g. PRIMARY). |
Application Header file |
<X11/Xaw/TextSink.h> |
The TextSink object is the root object for all text sinks. Any new text sink objects should be subclasses Since all text sinks will have some resources in common, the TextSink defines a few new resources. |
When creating an TextSink object instance, the following resources are retrieved from the argument list
or from the resource database:
93
background |
A pixel value which indexes the widget's colormap to derive the background |
||
destroyCallback foreground |
All functions on this list are called when this widget is destroyed. A pixel value which indexes the Text widget's colormap to derive the |
||
The only purpose of the TextSink Object is to be subclassed. It contains the minimum set of class
methods that all text sinks must have. While all may be inherited, the direct descendant of TextSink must
specify some of them as TextSink does contain enough information to be a valid text sink by itself. Do not
try to use the TextSink as a valid sink for the Text widget; it is not intended to be used as a sink by itself.
To display a section of the text buffer contained in the text source use the function DisplayText:
void DisplayText(w, x, y, pos1, pos2, highlight)
Widget w; |
|||
w x y |
Specifies the TextSink object. Specifies the x location to start drawing the text. Specifies the y location to start drawing text. |
pos1 Specifies the location within the text source of the first character to be printed.
pos2 highlight |
Specifies the location within the text source of the last character to be printed. Specifies whether or not to paint the text region highlighted. |
The Text widget will only pass one line at a time to the text sink, so this function does not need to know
how to line feed the text. It is acceptable for this function to just ignore Carriage Returns. x and y denote
the upper left hand corner of the first character to be displayed.
94
The function that controls the display of the text cursor is InsertCursor. This function will be called
whenever the text widget desires to change the state of, or move the insert point.
void InsertCursor(w, x, y, state)
Widget w; |
|||
w x y |
Specifies the TextSink object. Specifies the x location of the cursor in Pixels. Specifies the y location of the cursor in Pixels. |
state Specifies the state of the cursor, may be one of XawisOn or XawisOff.
X and y denote the upper left hand corner of the insert point.
To clear a portion of the Text window to its background color, the Text widget will call void ClearToBackground(w, x, y, width, height) |
Widget w; |
|||
w x y |
Specifies the TextSink object. Specifies the x location, in pixels, of the Region to clear. Specifies the y location, in pixels, of the Region to clear. |
width height |
Specifies the width, in pixels, of the Region to clear. Specifies the height, in pixels, of the Region to clear. |
X and y denote the upper left hand corner of region to clear.
To find the text character position that will be rendered at a given x location the Text widget uses the
function FindPosition:
void FindPosition(w, fromPos, fromX, width, stopAtWordBreak, pos_return, width_return, height_return)
Widget w;
w |
XawTextPosition fromPos; Specifies the TextSink object. |
fromPos |
Specifies a reference position, usually the first character in this line. This character |
||
fromX |
Specifies the distance that the left edge of fromPos is from the left edge of the |
||
width |
Specifies the distance, in pixels, from the reference position to the desired |
||
stopAtWordBreak |
Specifies whether or not the position that is returned should be forced to be on a |
||
pos_return |
Returns the character position that corresponds to the location that has been 95 |
Athena Widget Set libXaw 1.0.7 width_return Returns the actual distance between fromPos and pos_return.
height_return Returns the maximum height of the text between fromPos and pos_return. This function need make no attempt to deal with line feeds. The text widget will only call it one line at a Another means of finding a text position is provided by the Resolve function: void Resolve(w, fromPos, fromX, width, pos_return) |
w |
Widget w; Specifies the TextSink object. |
fromPos |
Specifies a reference position, usually the first character in this line. This character is |
||
fromX |
Specifies the distance that the left edge of fromPos is from the left edge of the window. This is the reference x location for the reference position. |
||
width |
Specifies the distance, in pixels, from the reference position to the desired character |
||
pos_return |
Returns the character position that corresponds to the location that has been specified, |
This function need make no attempt to deal with line feeds. The text widget will only call it one line at a
time. This is a more convenient interface to the FindPosition function, and provides a subset of its
functionality.
To find the distance in pixels between two text positions on the same line use the function FindDistance.
void FindDistance(w, fromPos, fromX, toPos, width_return, pos_return, height_return)
w |
Widget w; Specifies the TextSink object. |
fromPos fromX |
Specifies the text buffer position, in characters, of the first position. Specifies the distance that the left edge of fromPos is from the left edge of the window. |
||
toPos resWidth resPos |
Specifies the text buffer position, in characters, of the second position. Return the actual distance between fromPos and pos_return. Returns the character position that corresponds to the actual character position used for |
||
height_return |
Returns the maximum height of the text between fromPos and pos_return. |
This function need make no attempt to deal with line feeds. The Text widget will only call it one line at a
time.
To find the maximum number of lines that will fit into the current Text widget, use the function MaxLines.
The TextSink already defines this function to compute the maximum number of lines by using the height
of font.
96
Athena Widget Set libXaw 1.0.7 int MaxLines(w, height)
Widget w;
Dimension height;
w height |
Specifies the TextSink object. Specifies the height of the current drawing area. |
Returns the maximum number of lines that will fit in height. To find the height required for a given number of text lines, use the function MaxHeight. The TextSink already defines this function to compute the maximum height of the window by using the height of font. int MaxHeight(w, lines) |
Widget w;
int lines;
w height |
Specifies the TextSink object. Specifies the height of the current drawing area. |
Returns the height that will be taken up by the number of lines passed.
To set the tab stops for a text sink use the SetTabs function. The TextSink already defines this function to set the tab x location in pixels to be the number of characters times the figure width of font.
void SetTabs(w, tab_count, tabs)
Widget w;
int tab_count, *tabs;
w Specifies the TextSink object.
tab_count Specifies the number of tabs passed in tabs.
tabs Specifies the position, in characters, of the tab stops.
This function is responsible for the converting character positions passed to it into whatever internal
positions the TextSink uses for tab placement.
To get the size and location of the insert point use the GetCursorBounds function. void GetCursorBounds(w, rect_return) w Specifies the TextSinkObject. rect_return Returns the location and size of the insert point. Rect will be filled with the current size and location of the insert point. |
97
Composite and Constraint Widgets
These widgets may contain arbitrary widget children. They implement a policy for the size and location Box This widget will pack its children as tightly as possible in non-overlapping rows. Dialog An implementation of a commonly used interaction semantic to prompt for auxiliary |
input from the user, such as a filename. |
|||
Form |
A more sophisticated layout widget that allows the children to specify their positions |
||
Paned |
Allows children to be tiled vertically or horizontally. Controls are also provided to allow |
||
Porthole |
Allows viewing of a managed child which is as large as, or larger than its parent, |
||
Tree Viewport |
Provides geometry management of widgets arranged in a directed, acyclic graph. Consists of a frame, one or two scrollbars, and an inner window. The inner window |
||
The geometry management semantics provided by the X Toolkit give full control of the size and position If the application wishes to change the size or location of any widget it should make a call to XtSetValues. For more information on geometry management consult the X Toolkit Intrinsics -- C Language Interface. |
Application Header file |
<X11/Xaw/Box.h> |
The Box widget provides geometry management of arbitrary widgets in a box of a specified dimension.
The children are rearranged when resizing events occur either on the Box or its children, or when
children are managed or unmanaged. The Box widget always attempts to pack its children as tightly as
98
possible within the geometry allowed by its parent. Box widgets are commonly used to manage a related set of buttons and are often called ButtonBox |
When creating a Box widget instance, the following resources are retrieved from the argument list or
from the resource database:
accelerators |
A list of event to action bindings to be executed by this widget, even though the |
||
ancestorSensitive |
The sensitivity state of the ancestors of this widget. A widget is insensitive if |
||
background |
A pixel value which indexes the widget's colormap to derive the background |
||
backgroundPixmap |
The background pixmap of this widget's window. If this resource is set to |
||
borderColor |
A pixel value which indexes the widget's colormap to derive the border color |
||
borderPixmap |
The border pixmap of this widget's window. If this resource is set to anything |
||
borderWidth children |
The width of this widget's window border. A list of all this composite widget's current children. 99 |
Athena Widget Set libXaw 1.0.7 colormap The colormap that this widget will use.
depth destroyCallback height |
The depth of this widget's window. All functions on this list are called when this widget is destroyed. The height and width of this widget in pixels. |
||
hSpace
vSpace |
The amount of space, in pixels, to leave between the children. This resource |
||
mappedWhenManaged |
If this resource is True, then the widget's window will automatically be |
||
numChildren orientation |
The number of children in this composite widget. Specifies whether the preferred shape of the box (i.e. the result returned by the |
||
screen sensitive |
The screen on which this widget is displayed. This is not a settable resource. Whether or not the toolkit should pass user events to this widget. The widget |
||
translations x |
The event bindings associated with this widget. The location of the upper left outside corner of this widget in its parent. |
||
Each time a child is managed or unmanaged, the Box widget will attempt to reposition the remaining XtorientVertical When the next child does not fit on the current row, a new row is started. If |
a |
child is wider than the width of the box, the box will request a larger width from |
|||
XtorientHorizontal |
When the next child does not fit on the current row, the Box widens if possible |
After positioning all children, the Box widget attempts to shrink its own size to the minimum dimensions
required for the layout.
Application Header file |
<X11/Xaw/Dialog.h> |
The Dialog widget implements a commonly used interaction semantic to prompt for auxiliary input from a |
100
The typical Dialog widget contains three areas. The first line contains a description of the function of the |
When creating a Dialog widget instance, the following resources are retrieved from the argument list or
the resource database:
accelerators |
A list of event to action bindings to be executed by this widget, even though the |
||
ancestorSensitive |
The sensitivity state of the ancestors of this widget. A widget is insensitive if |
||
background |
A pixel value which indexes the widget's colormap to derive the background |
||
backgroundPixmap |
The background pixmap of this widget's window. If this resource is set to |
||
borderColor |
A pixel value which indexes the widget's colormap to derive the border color |
||
borderPixmap |
The border pixmap of this widget's window. If this resource is set to anything |
||
borderWidth children |
The width of this widget's window border. A list of all this composite widget's current children. 101 |
colormap defaultDistance |
The colormap that this widget will use. The default internal spacing for the children. This is the default value for the |
||
depth destroyCallback height |
The depth of this widget's window. All functions on this list are called when this widget is destroyed. The height and width of this widget in pixels. |
||
icon |
A pixmap image to be displayed immediately to the left of the Dialog widget's label. |
||
label mappedWhenManaged |
A string to be displayed at the top of the Dialog widget. If this resource is True, then the widget's window will automatically be |
||
numChildren screen sensitive |
The number of children in this composite widget. The screen on which this widget is displayed. This is not a settable resource. Whether or not the toolkit should pass user events to this widget. The widget |
||
translations value |
The event bindings associated with this widget. An initial value for the string field that the user will enter text into. By default, |
||
x |
The location of the upper left outside corner of this widget in its parent. |
||
Each child of the Dialog widget may request special layout resources be applied to it. These constraint
resources allow the Dialog widget's children to specify individual layout requirements.
bottom |
What to do with this edge of the child when the parent is resized. This resource |
may be any edgeType. See Layout Semantics for details. |
|||
fromHoriz |
Which widget this child should be placed underneath (or to the right of). If a |
||
value of NULL is specified then this widget will be positioned relative to the |
|||
horizDistance |
|||
102 |
Athena Widget Set libXaw 1.0.7 vertDistance The amount of space, in pixels, between this child and its left or upper
neighbor.
resizable |
If this resource is False then the parent widget will ignore all geometry request |
||
The Dialog widget uses two different sets of layout semantics. One is used when initially laying out the The first layout method uses the fromVert and fromHoriz resources to place the children of the Dialog. The second layout method is used when the Dialog is resized. It does not matter what causes this resize, |
Dialog widget is resized.
If you wish to force the Dialog to never resize one or more of its children then set left and right to
XawChainLeft and top and bottom to XawChainTop. This will cause the child to remain a fixed
distance from the top and left edges of the Dialog, and to never resize.
The Dialog widget automatically sets the top and bottom resources for all Children that are subclasses of The Dialog will also set fromLeft to the last button in the Dialog for each new button added to the Dialog The automatically added constraints cannot be overridden, as they are policy decisions of the Dialog |
103
The Dialog uses Label widgets to contain the label and icon. These widgets are named label and icon |
To return the character string in the text field, use XawDialogGetValueString .
String XawDialogGetValueString(w) w Specifies the Dialog widget. This function returns a copy of the value string of the Dialog widget. This string is allocated by the To add a new button to the Dialog widget use XawDialogAddButton. void XawDialogAddButton(w, name, func, client_data) |
Widget w; |
|||
w name func |
Specifies the Dialog widget. Specifies the name of the new Command button to be added to the Dialog. Specifies a callback function to be called when this button is activated. If NULL is |
client_data Specifies the client_data to be passed to the func.
This function is merely a shorthand for the code sequence:
{ |
|||
Widget button = XtCreateManagedWidget(name, commandWidgetClass, w, NULL, ZERO); XtAddCallback(button, XtNcallback, func, client_data); |
|||
} |
Application Header file |
<X11/Xaw/Form.h> |
The Form widget can contain an arbitrary number of children or subwidgets. The Form provides |
104
The default width of the Form is the minimum width needed to enclose the children after computing their |
When creating a Form widget instance, the following resources are retrieved from the argument list or
from the resource database:
accelerators |
A list of event to action bindings to be executed by this widget, even though the |
||
ancestorSensitive |
The sensitivity state of the ancestors of this widget. A widget is insensitive if |
||
background |
A pixel value which indexes the widget's colormap to derive the background |
||
backgroundPixmap |
The background pixmap of this widget's window. If this resource is set to |
||
borderColor |
A pixel value which indexes the widget's colormap to derive the border color |
||
borderPixmap |
The border pixmap of this widget's window. If this resource is set to anything |
||
borderWidth children colormap defaultDistance |
The width of this widget's window border. A list of all this composite widget's current children. The colormap that this widget will use. The default internal spacing for the children. This is the default value for the 105 |
depth destroyCallback height |
The depth of this widget's window. All functions on this list are called when this widget is destroyed. The height and width of this widget in pixels. |
||
mappedWhenManaged |
If this resource is True, then the widget's window will automatically be |
||
numChildren screen sensitive |
The number of children in this composite widget. The screen on which this widget is displayed. This is not a settable resource. Whether or not the toolkit should pass user events to this widget. The widget |
||
translations x |
The event bindings associated with this widget. The location of the upper left outside corner of this widget in its parent. |
||
Each child of the Form widget may request special layout resources be applied to it. These constraint
resources allow the Form widget's children to specify individual layout requirements.
top |
What to do with this edge of the child when the parent is resized. This resource |
||
fromHoriz
fromVert Which widget this child should be placed underneath (or to the right of). If a
value of NULL is specified then this widget will be positioned relative to the |
horizDistance
vertDistance |
The amount of space, in pixels, between this child and its left or upper |
||
resizable |
If this resource is False then the parent widget will ignore all geometry request |
||
The Form widget uses two different sets of layout semantics. One is used when initially laying out the The first layout method uses the fromVert and fromHoriz resources to place the children of the Form. |
106
Athena Widget Set libXaw 1.0.7 by the horizDistance and vertDistance resources. This implies some things about how the order of
creation affects the possible placement of the children. The Form widget registers a string to widget
converter which does not postpone conversion and does not cache conversion results.
The second layout method is used when the Form is resized. It does not matter what causes this resize,
and it is possible for a resize to happen before the widget becomes visible (due to constraints imposed by
the parent of the Form). This layout method uses the bottom, top, left, and right resources. These
resources are used to determine what will happen to each edge of the child when the Form is resized. If a value of XawChain<something> is specified, the the edge of the child will remain a fixed distance from
the chain edge of the Form. For example if XawChainLeft is specified for the right resource of a child |
Form widget is resized.
If you wish to force the Form to never resize one or more of its children, then set left and right to
XawChainLeft and top and bottom to XawChainTop. This will cause the child to remain a fixed
distance from the top and left edges of the Form, and never to resize.
To force or defer a re-layout of the Form, use XawFormDoLayout .
void XawFormDoLayout(w, do_layout)
Widget w;
Boolean do_layout;
w Specifies the Form widget.
do_layout Specifies whether the layout of the Form widget is enabled (True) or disabled (False).
When making several changes to the children of a Form widget after the Form has been realized, it is a
good idea to disable relayout until after all changes have been made.
Application Header file |
<X11/Xaw/Paned.h> |
The Paned widget manages children in a vertically or horizontally tiled fashion. The panes may be
dynamically resized by the user by using the grips that appear near the right or bottom edge of the border
between two panes.
107
The Paned widget may accept any widget class as a pane except Grip. Grip widgets have a special
meaning for the Paned widget, and adding a Grip as its own pane will confuse the Paned widget.
The grips allow the panes to be resized by the user. The semantics of how these panes resize is One pointer binding allows the border between two panes to be moved, without affecting any of the other |
The default bindings for the Paned widget's grips are:
When creating a Paned widget instance, the following resources are retrieved from the argument list or
the resource database:
accelerators |
A list of event to action bindings to be executed by this widget, even though the |
||
ancestorSensitive |
The sensitivity state of the ancestors of this widget. A widget is insensitive if |
||
background |
A pixel value which indexes the widget's colormap to derive the background |
||
backgroundPixmap |
The background pixmap of this widget's window. If this resource is set to |
||
borderColor |
A pixel value which indexes the widget's colormap to derive the border color |
||
borderPixmap |
The border pixmap of this widget's window. If this resource is set to anything |
||
borderWidth children colormap cursor |
The width of this widget's window border. A list of all this composite widget's current children. The colormap that this widget will use. The cursor to use when the mouse pointer is over the Paned widget, but not in |
||
depth destroyCallback gripCursor |
The depth of this widget's window. All functions on this list are called when this widget is destroyed. The cursor to use when the grips are not active. The default value is |
||
gripIndent |
The amount of space left between the right (or bottom) edge of the Paned |
||
gripTranslation height |
Translation table that will be applied to all grips. The height and width of this widget in pixels. |
||
horizontalBetweenCursor
verticalBetweenCursor The cursor to be used for the grip when changing the boundary between two
panes. These resources allow the cursors to be different depending on the |
horizontalGripCursor
verticalGripCursor The cursor to be used for the grips when they are not active. These resources
allow the cursors to be different depending on the orientation of the Paned
109
widget. |
|||
internalBorderColor |
A pixel value which indexes the widget's colormap to derive the internal |
||
internalBorderWidth |
The width of the internal borders. This is the amount of space left between the |
||
leftCursor
rightCursor |
The cursor used to indicate which is the important pane to resize when the |
||
lowerCursor
upperCursor |
The cursor used to indicate which is the important pane to resize when the |
||
mappedWhenManaged |
If this resource is True, then the widget's window will automatically be |
||
numChildren |
The number of children in this composite widget. This is not the same as the |
||
orientation |
The orientation to stack the panes. This value can be either XtorientVertical |
||
refigureMode |
This resource allows pane layout to be suspended. If this value is False, then |
||
screen sensitive |
The screen on which this widget is displayed. This is not a settable resource. Whether or not the toolkit should pass user events to this widget. The widget |
||
translations x |
The event bindings associated with this widget. The location of the upper left outside corner of this widget in its parent. |
||
Each child of the Paned widget may request special layout resources be applied to it. These constraint
resources allow the Paned widget's children to specify individual layout requirements.
allowResize |
If this value is False the the Paned widget will disallow all geometry requests |
||
max
110
Athena Widget Set libXaw 1.0.7 min The absolute maximum or minimum size for this pane. These values will never
be overridden by the Paned widget. This may cause some panes to be pushed |
|||
preferredPaneSize |
Normally the paned widget makes a QueryGeometry call on a child to |
||
resizeToPreferred |
Determines whether or not to resize each pane to its preferred size when the |
||
showGrip |
If True then a grip will be shown for this pane. The grip associated with a pane |
||
skipAdjust |
This resource is used to determine which pane is forced to be resized. Setting |
||
In order to make effective use of the Paned widget it is helpful to know the rules it uses to determine |
1 2 3 |
Do not let a pane grow larger than its max or smaller than its min. Do not adjust panes with skipAdjust set. Do not adjust panes away from their preferred size, although moving one closer to its preferred |
When searching the children the Paned widget looks for panes that satisfy all the rules, and if If the relayout is due to a resize or change in management then the panes are searched from bottom to |
The pane above the grip is resized by invoking the GripAction with UpLeftPane specified. The panes
below the grip are each checked against all rules, then rules 2 and 1 and finally against rule 1 only. No
pane above the chosen pane will ever be resized.
The pane below the grip is resized by invoking the GripAction with LowRightPane specified. The panes
above the grip are each checked in this case. No pane below the chosen pane will ever be resized.
Invoking GripAction with ThisBorderOnly specified just moves the border between the panes. No other panes are ever resized.
When the Pane widget is resized it must determine a new size for each pane. There are two methods of There is one special case. All panes assume they should resize to their preferred size until the Paned |
111
The Paned widget always resizes its children to their preferred sizes when a new child is managed, or a |
When a user resizes a pane with the grips, the Paned widget assumes that this new size is the preferred
size of the pane.
The Paned widget has no action routines of its own, as all actions are handled through the grips. The
grips are each assigned a default Translation table.
<Btn1Down>: |
GripAction(Start, UpLeftPane) |
The Paned widget interprets the GripAction as taking two arguments. The first argument may be any of
the following: Start |
Sets up the Paned widget for resizing and changes the cursor of the grip. The second |
||
argument determines which pane will be resized, and can take on any of the three |
|||
Move |
The internal borders are drawn over the current pane locations to animate where the |
||
Commit |
This argument causes the Paned widget to commit the changes selected by the |
||
To enable or disable a child's request for pane resizing, use XawPanedAllowResize :
void XawPanedAllowResize(w, allow_resize)
Widget w;
Boolean allow_resize;
w Specifies the child pane.
allow_resize Specifies whether or not resizing requests for this child will be granted by the Paned
widget. If allow_resize is True, the Paned widget allows geometry requests from the child to change the pane's To change the minimum and maximum height settings for a pane, use XawPanedSetMinMax : |
112
Athena Widget Set libXaw 1.0.7 void XawPanedSetMinMax(w, min, max)
Widget w;
int min, max;
w Specifies the child pane.
min max |
Specifies the new minimum height of the child, expressed in pixels. Specifies new maximum height of the child, expressed in pixels. |
This procedure is equivalent to setting the min and max constraint resources for the child.
To retrieve the minimum and maximum height settings for a pane, use XawPanedGetMinMax :
void XawPanedGetMinMax(w, min_return, max_return)
Widget w;
int *min_return, *max_return;
w Specifies the child pane.
min_return Returns the minimum height of the child, expressed in pixels.
max_return Returns the maximum height of the child, expressed in pixels.
This procedure is equivalent to getting the min and max resources for this child child.
To enable or disable automatic recalculation of pane sizes and positions, use
XawPanedSetRefigureMode :
void XawPanedSetRefigureMode(w, mode)
Widget w;
Boolean mode;
w mode |
Specifies the Paned widget. Specifies whether the layout of the Paned widget is enabled (True) or disabled (False). |
When making several changes to the children of a Paned widget after the Paned has been realized, it is a To retrieve the number of panes in a paned widget use XawPanedGetNumSub: int XawPanedGetNumSub(w) |
Widget w;
w Specifies the Paned widget.
This function returns the number of panes in the Paned widget. This is not the same as the number of
children, since the grips are also children of the Paned widget.
Application Header file |
<X11/Xaw/Porthole.h> |
The Porthole widget provides geometry management of a list of arbitrary widgets, only one of which may
be managed at any particular time. The managed child widget is reparented within the porthole and is
moved around by the application (typically under the control of a Panner widget).
When creating a Porthole widget instance, the following resources are retrieved from the argument list or
from the resource database:
113
accelerators |
A list of event to action bindings to be executed by this widget, even though the |
||
ancestorSensitive |
The sensitivity state of the ancestors of this widget. A widget is insensitive if |
||
background |
A pixel value which indexes the widget's colormap to derive the background |
||
backgroundPixmap |
The background pixmap of this widget's window. If this resource is set to |
||
borderColor |
A pixel value which indexes the widget's colormap to derive the border color |
||
borderPixmap |
The border pixmap of this widget's window. If this resource is set to anything |
||
borderWidth children colormap depth destroyCallback height |
The width of this widget's window border. A list of all this composite widget's current children. The colormap that this widget will use. The depth of this widget's window. All functions on this list are called when this widget is destroyed. The height and width of this widget in pixels. |
||
mappedWhenManaged |
If this resource is True, then the widget's window will automatically be |
||
numChildren reportCallback |
The number of children in this composite widget. A list of functions to invoke whenever the managed child widget changes size 114 |
screen sensitive |
The screen on which this widget is displayed. This is not a settable resource. Whether or not the toolkit should pass user events to this widget. The widget |
||
translations x |
The event bindings associated with this widget. The location of the upper left outside corner of this widget in its parent. |
||
The Porthole widget allows its managed child to request any size that is as large or larger than the
Porthole itself and any location so long as the child still obscures all of the Porthole. This widget typically
is used with a Panner widget.
The functions registered on the reportCallback list are invoked whenever the managed child changes
size or position:
void ReportProc(porthole, client_data, report)
Widget porthole; |
*) */ |
||
porthole |
Specifies the Porthole widget. |
client_data Specifies the client data.
report |
Specifies a pointer to an XawPannerReport structure containing the location and size |
||
Application Header file |
<X11/Xaw/Tree.h> |
The Tree widget provides geometry management of arbitrary widgets arranged in a directed, acyclic The Tree sizes itself according to the needs of its children and is not intended to be resized by its parent. |
When creating a Tree widget instance, the following resources are retrieved from the argument list or
from the resource database:
autoReconfigure background |
Whether or not to layout the tree every time a node is added or removed. A pixel value which indexes the widget's colormap to derive the background |
||
backgroundPixmap |
The background pixmap of this widget's window. If this resource is set to |
||
borderColor |
A pixel value which indexes the widget's colormap to derive the border color |
||
borderPixmap |
The border pixmap of this widget's window. If this resource is set to anything |
||
borderWidth children colormap depth destroyCallback foreground |
The width of this widget's window border. A list of all this composite widget's current children. The colormap that this widget will use. The depth of this widget's window. All functions on this list are called when this widget is destroyed. A pixel value which indexes the widget's colormap to derive the foreground |
||
gravity |
Specifies the side of the widget from which the tree should grow. Valid values |
||
height |
The height and width of this widget in pixels. |
||
hSpace
116
vSpace |
The amount of space, in pixels, to leave between the children. This resource |
||
lineWidth |
The width of the lines from nodes that do not have a treeGC constraint |
||
mappedWhenManaged |
If this resource is True, then the widget's window will automatically be |
||
numChildren screen sensitive |
The number of children in this composite widget. The screen on which this widget is displayed. This is not a settable resource. Whether or not the toolkit should pass user events to this widget. The widget |
||
translations x |
The event bindings associated with this widget. The location of the upper left outside corner of this widget in its parent. |
||
Each child of the Tree widget must specify its superior node in the tree. In addition, it may specify a GC
to use when drawing a line between it and its inferior nodes.
treeGC |
This specifies the GC to use when drawing lines between this widget and its |
||
treeParent |
This specifies the superior node in the tree for this widget. The default is for |
||
Each time a child is managed or unmanaged, the Tree widget will attempt to reposition the remaining After positioning all children, the Tree widget attempts to shrink its own size to the minimum dimensions |
The most efficient way to layout a tree is to set autoReconfigure to False and then use the
XawTreeForceLayout routine to arrange the children.
void XawTreeForceLayout(w)
Widget w;
w Specifies the Tree widget.
Application Header file |
<X11/Xaw/Viewport.h> 117 |
The Viewport widget consists of a frame window, one or two Scrollbars, and an inner window. The size When the geometry of the frame window is equal in size to the inner window, or when the data does not |
When creating a Viewport widget instance, the following resources are retrieved from the argument list
or the resource database:
accelerators A list of event to action bindings to be executed by this widget, even though the
event occurred in another widget. (See the X Toolkit Intrinsics -- C Language |
allowHoriz
allowVert |
If these resources are False then the Viewport will never create a scrollbar in |
||
ancestorSensitive |
The sensitivity state of the ancestors of this widget. A widget is insensitive if either it or any of its ancestors is insensitive. This resource should not be |
||
background |
A pixel value which indexes the widget's colormap to derive the background 118 |
Athena Widget Set libXaw 1.0.7 backgroundPixmap The background pixmap of this widget's window. If this resource is set to
anything other than XtUnspecifiedPixmap, the pixmap specified will be used |
|||
borderColor |
A pixel value which indexes the widget's colormap to derive the border color |
||
borderPixmap |
The border pixmap of this widget's window. If this resource is set to anything |
||
borderWidth children colormap depth destroyCallback forceBars |
The width of this widget's window border. A list of all this composite widget's current children. The colormap that this widget will use. The depth of this widget's window. All functions on this list are called when this widget is destroyed. When True the scrollbars that have been allowed will always be visible on the |
||
height |
The height and width of this widget in pixels. |
||
mappedWhenManaged |
If this resource is True, then the widget's window will automatically be |
||
numChildren reportCallback |
The number of children in this composite widget. These callbacks will be executed whenever the Viewport adjusts the viewed |
||
screen sensitive |
The screen on which this widget is displayed. This is not a settable resource. Whether or not the toolkit should pass user events to this widget. The widget |
||
translations |
The event bindings associated with this widget. |
useBottom
useRight |
By default the scrollbars appear on the left and top of the screen. These |
||
x |
The location of the upper left outside corner of this widget in its parent. |
||
The Viewport widget manages a single child widget. When the size of the child is larger than the size of
the Viewport, the user can interactively move the child within the Viewport by repositioning the
scrollbars.
The default size of the Viewport before it is realized is the width and/or height of the child. After it is
realized, the Viewport will allow its child to grow vertically or horizontally if allowVert or allowHoriz are
set, respectively. If the corresponding vertical or horizontal scrollbar is not enabled, the Viewport will
propagate the geometry request to its own parent and the child will be allowed to change size only if the
Viewport's parent allows it. Regardless of whether or not scrollbars are enabled in the corresponding
direction, if the child requests a new size smaller than the Viewport size, the change will be allowed only if the parent of the Viewport allows the Viewport to shrink to the appropriate dimension.
The scrollbar children of the Viewport are named horizontal and vertical. By using these names the
programmer can specify resources for the individual scrollbars. XtSetValues can be used to modify the
resources dynamically once the widget ID has been obtained with XtNameToWidget.
119
Athena Widget Set libXaw 1.0.7
Note
Although the Viewport is a Subclass of the Form, no resources for the Form may be supplied
for any of the children of the Viewport. These constraints are managed internally and are not
meant for public consumption.
120
Creating New Widgets (Subclassing)
Written By: Ralph Swick
Although the task of creating a new widget may at first appear a little daunting, there is a basic simple Reasons for wishing to write a custom widget include: · Providing a graphical interface not currently supported by any existing widget set. · Convenient access to resource management procedures to obtain fonts, colors, etc., even if user |
customization is not desired. |
|||
· · · · |
Convenient access to user input dispatch and translation management procedures. Access to callback mechanism for building higher-level application libraries. Customizing the interface or behavior of an existing widget to suit a special application need. Desire to allow user customization of resources such as fonts, colors, etc., or to allow convenient re- |
||
· |
Converting a non-Toolkit application to use the Toolkit. |
In each of these cases, the operation needed to create a new widget is to "subclass" an existing one. If Note that some trivial uses of a ``bare-bones'' widget may be achieved by simply creating an instance of It is very often the case than an application will have a special need for a certain set of functions and that · Allocate 2 drawing colors in addition to a background color. · Allocate a text font. · Execute an application-supplied function to handle exposure events. · Execute an application-supplied function to handle user input events. It is obvious that a completely general-purpose WindowWidgetClass could be constructed that would In this section, an outline will be given of the procedure to follow to construct a special-purpose widget to All Athena widgets have three separate files associated with them: · A ``public'' header file containing declarations needed by applications programmers · A ``private'' header file containing additional declarations needed by the widget and any subclasses |
121
Athena Widget Set libXaw 1.0.7 · A source code file containing the implementation of the widget
This separation of functions into three files is suggested for all widgets, but nothing in the Toolkit actually In the following example, the public header file < X11/Xaw/Template.h >, the private header file |
The public header file contains declarations that will be required by any application module that needs to The contents of the Template public header file, < X11/Xaw/Template.h >, are: |
/* XConsortium: Template.h,v 1.2 88/10/25 17:22:09 swick Exp $ */ #ifndef _Template_h /**************************************************************** /* Resources: Name Class RepType Default Value */ /* define any special resource names here that are not in <X11/StringDefs.h> */ #define XtNtemplateResource "templateResource" #define XtCTemplateResource "TemplateResource" /* declare specific TemplateWidget class and instance datatypes */ typedef struct _TemplateClassRec* TemplateWidgetClass; /* declare the class constant */ extern WidgetClass templateWidgetClass; #endif /* _Template_h */ 122 |
Athena Widget Set libXaw 1.0.7 You will notice that most of this file is documentation. The crucial parts are the last 8 lines where macros
for any private resource names and classes are defined and where the widget class datatypes and class For the ``WindowWidget'', we want 2 drawing colors, a callback list for user input and an |
/* Resources: #define XtNdrawingColor1 "drawingColor1" extern Pixel WindowColor1( /* Widget */ ); Note that we have chosen to call the input callback list by the generic name, callback, rather than a |
The private header file contains the complete declaration of the class and instance structures for the The contents of the Template private header file, < X11/Xaw/TemplateP.h >, are: |
/* XConsortium: TemplateP.h,v 1.2 88/10/25 17:31:47 swick Exp $ */ /* Copyright (c) X Consortium 1987, 1988 #ifndef _TemplateP_h #include <X11/Xaw/Template.h> /* define unique representation types not found in <X11/StringDefs.h> */ #define XtRTemplateResource "TemplateResource" typedef struct { typedef struct _TemplateClassRec { extern TemplateClassRec templateClassRec; 123 |
Athena Widget Set libXaw 1.0.7
typedef struct {
/* resources */ typedef struct _TemplateRec { #endif /* _TemplateP_h */ The private header file includes the private header file of its superclass, thereby exposing the entire The ``WindowWidget'' needs to declare two fields in its instance structure to hold the drawing colors, a |
typedef struct { |
The source code file implements the widget class itself. The unique part of this file is the declaration and The contents of the Template implementation file, < X11/Xaw/Template.c >, are: |
/* XConsortium: Template.c,v 1.2 88/10/25 17:40:25 swick Exp $ */ /* Copyright (c) X Consortium 1987, 1988 #include <X11/IntrinsicP.h> static XtResource resources[] = { static void TemplateAction(/* Widget, XEvent*, String*, Cardinal* */); static XtActionsRec actions[] = static char translations[] = 124 |
Athena Widget Set libXaw 1.0.7
";
TemplateClassRec templateClassRec = { WidgetClass templateWidgetClass = (WidgetClass)&templateClassRec; The resource list for the ``WindowWidget'' might look like the following: static XtResource resources[] = { |
#define offset(field) XtOffsetOf(WindowWidgetRec, window.field) The user input callback will be implemented by an action procedure which passes the event pointer as |
/* ARGSUSED */
static void InputAction(w, event, params, num_params)
125
Athena Widget Set libXaw 1.0.7
Widget w;
XEvent *event; |
/* unused */ |
|||||
{ |
Cardinal *num_params; /* unused */ |
XtCallCallbacks(w, XtNcallback, (XtPointer)event);
} static XtActionsRec actions[] = and the default input binding will be to execute the input callbacks on KeyPress and ButtonPress : static char translations[] = |
" <Key>: input( ) \n\
"; |
<BtnDown>: |
input( ) \ |
In the class record declaration and initialization, the only field that is different from the Template is the
expose procedure: /* ARGSUSED */ |
XEvent *event; /* unused */
Region region; |
||||
{ |
||||
XtCallCallbacks(w, XtNexposeCallback, (XtPointer)region); |
||||
} |
WindowClassRec windowClassRec = { ... /* expose */ Redisplay, The ``WindowWidget'' will also declare three public procedures to return the drawing colors and the font |
Pixel WindowColor1(w) Pixel WindowColor2(w) Font WindowFont(w) The ``WindowWidget'' is now complete. The application can retrieve the two drawing colors from the |
126
Table of Contents
Acknowledgments . . . . . . . . . |
. . |
. |
. |
. |
. |
. |
. |
. |
. |
. |
. |
. |
. |
. |
. |
. |
. |
. |
v |
|||||||||||||||||||
Terminology . . . . . . . . . |
. |
. |
iii |
. |
. |
. |
. |
. |
. |
. |
. |
. |
. |
. |
. |
. |
. |
. |
. |
1 |
Tree Widget . . . . . . . . . . . . . . . . . . . . . . . . . . . 115
Viewport Widget . . . . . . . . . . . . . . . . . . . . . . . . . . 117 Chapter 7 - Creating New Widgets (Subclassing) . . . . . . . . . . . . . . . . . 121 Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 127
iv