Page: 1 2 3 4 5 6 7 8 9 10

Chapter 3


Simple Widgets

Each of these widgets performs a specific user interface function. They are simple because they cannot have widget children-they may only be used as leaves of the widget tree. These widgets display information or take user input.

CommandA 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.
GripA rectangle that, when selected, will cause an action to take place.
LabelA rectangle that can display a multi-line string or a bitmap or pixmap image.
ListA list of text strings presented in row column format that may be individually selected. When an element is selected an action may take place.
PannerA rectangular area containing a slider that may be moved in two dimensions.
Notification of movement may be continuous or discrete.
RepeaterA push button that triggers an action at an increasing rate when selected. This widget can display a multi-line string or a bitmap or pixmap image.
ScrollbarA rectangular area containing a thumb that when slid along one dimension may cause a specific action to take place. The Scrollbar may be oriented horizontally or vertically.
SimpleThe base class for most of the simple widgets. Provides a rectangular area with a settable mouse cursor and special border.
StripChartA real time data graph that will automatically update and scroll.
ToggleA push button that contains state information. Toggles may also be used as "radio Buttons" to implement a "one of many" or "zero or one of many" group of buttons. This widget can display a multi-line string or a bitmap or pixmap image.

Home


3.1. Command Widget

Application header file<X11/Xaw/Command.h>
Class header file<X11/Xaw/CommandP.h>
ClasscommandWidgetClass
Class NameCommand
SuperclassLabel

The Command widget is an area, often rectangular, that contains text or a graphical image. Command widgets are often referred to as "push buttons." When the pointer is over a Command widget, the widget becomes highlighted by drawing a rectangle around its perimeter. This highlighting indicates that the widget is ready for selection. When mouse button 1 is pressed, the Command widget indicates that it has been selected by reversing its foreground and background colors. When the mouse button is released, the Command widget's notify action is invoked, calling all functions on its callback list. If the pointer is moved off of the widget before the pointer button is released, the widget reverts to its normal foreground and background colors, and releasing the pointer button has no effect. This behavior allows the user to cancel an action.

3.1.1. Resources

When creating a Command widget instance, the following resources are retrieved from the argument list or from the resource database:

NameClassType NotesDefault Value
acceleratorsAccelerators AcceleratorTableNULL
ancestorSensitiveAncestorSensidve BooleanDTrue
backgroundBackground PixelXtDefaultBackground
backgroundPixtmapPixmap PixmapXtUnspecifiedPixmap
bitmapBitmapPixmap None
borderColorBorderColor PixelXtDefaultForeground
borderPixrnapPixmap PixmapXtUnspecifiedPixmap
borderWidthBorderWidth Dirnension1
callbackCallbackXtCallbackList NULL
colormapColormlapColormlap Parent's Colormlap
comerRoundPercentComerRoundPercent Dimension25
cursorCursorCursor None
cursorNarmeCursorString NULL
depthDepthint CParent's Depth
destroyCallbackCallback XtCallbackListNULL
encodingEncodingUnsignedChar XawTextEncoding8bit
fontFontXFontStruct XtDefaultFont
foregroundForeground PixelXtDefaultForeground
heightHeightDimension Agraphic height+ 2 * internalHeight
highlightThicknessThickness DimensionA2(0 if Shaped)
insensitdveBorderInsensitive PixmapGreyPixmap
internalHeightHeight Dimension2
internalWidthWidthDimension 4
internationalInternational BooleanCFalse
justifyJustifyJustify XtJustify Center (center)
labelLabelString name of widget
leftBitmapLeftBitmap BitmapNone
mappedWhenManagedMappedWhenManaged BooleanTrue
pointerColorForeground PixelXtDefaultForeground
pointerColorBackgroundBackground PixelXtDefaultBackground
resizeResizeBoolean True
screenScreenScreen RParent's Screen
sensitiveSensitiveBoolean True
shapeStyleShapeStyle ShapeStyleRectangle
translationsTranslations TransladonTableSee below
widthWidthDimension Agraphic width 2 * internalWidth
xPositionPosition 0
yPositionPosition 0

acceleratorsA 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).
ancestorSensitiveThe 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 changed with XtSetValues, although it may be queried.
backgroundA pixel value which indexes the widget's colormap to derive the background color of the widget's window.
backgroundPixmapThe background pixmap of this widget's window. If this resource is set to anything other than XtUnspecifiedPixmap, the pixmap specified will be used instead of the background color.
bitmapA bitmap to display instead of the label. The default size of the widget will be just large enough to contain the bitmap and the widget's internal width and height. The resource converter for this resource constructs bitmaps from the contents of files. (See section 2.5.3, Bitmap Conversion, for details.) If this bitmap is one bit deep then the l's will be rendered in the fore ground color, and the O's in the background color. If bitmap has a depth greater than one, it is copied directly into the window.
borderColorA pixel value which indexes the widget's colormap to derive the border color of the widget's window.
borderPixmapThe border pixmap of this widget's window. If this resource is set to anything other than XtUnspecifiedPixmap, the pixmap specified will be used instead of the border color.
borderWidthThe width of this widget's window border.
callbackA list of routines to be called when the notify action is invoked.
colormapThe colormap that this widget will use.
cornerRoundPercentWhen a ShapeStyle of roundedRectangle is used, this resource controls the radius of the rounded corner. The radius of the rounded corners is specified as a percentage of the length of the shortest side of the widget.
cursorThe image that will be displayed as the pointer cursor whenever it is in this widget. The use of this resource is deprecated in favor of cursorName.
cursorNameThe name of the symbol to use to represent the pointer cursor. This resource will override the cursor resource if both are specified. (See 2.5.1)
depthThe depth of this widget's window.
destroyCallbackAll functions on this list are called when this widget is destroyed.
encodingThe encoding method used by the value of the label resource. The value may be XawTextEncoding8bit or XawTextEncodingChar2b. When international is set to true this resource is not used.
fontThe text font to use when displaying the label, when the international resource is false.
fontSetThe text font set to use when displaying the label, when the international resource is true.
foregroundA pixel value which indexes the widget's colormap to derive the fore ground color of the widget's window. This color is also used to render all l's in a bitmap one plane deep.
height
widthThe height and width of this widget in pixels.
highlightThicknessThe thickness of the rectangle that is used to highlight the internal border of this widget, alerting the user that it is ready to be selected. The default value is 2 pixels if the shapeStyle is rectangle, and O Pixels (no highlighting) otherwise.
insensitiveBorderThis pixmap will be tiled into the widget's border if the widget becomes insensitive.
intemalHeight
intemalWidthThe 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 signals the widget to use pre-R6 internationalization (specifically, the lack thereof), such as using fonts for displaying text, etc. A value of true directs the widget to act in an internationalized manner, such as utilizing font sets for displaying text, etc.
justifySpecifies left, center, or right alignment of graphic within the widget. This resource may be specified with the values XtJustifyLeft, XtJustifyCenter, or XtJustifyRight. A converter is registered for this resource that will convert the following strings: left, right, and center.
This resource only has noticeable effect when the width of the widget is larger than necessary to display the graphic. Note that when the graphic is a multi-line label, the longest line will obey this justification while shorter lines will be left-justified with the longest one.
labelSpecifies the text string to be displayed in the widget's window if no bitmap is specified. The default is the name of this widget. Irregardless of the value of encoding or international, a single newline character (1 byte) will cause a line break.
IeftBitmapSpecifies a bitmap to display to the left of the graphic in the widget's window.
mappedWhenManagedIf this resource is True, then the widget's window will automatically be mapped by the Toolkit when it is realized and managed.
pointerColorA pixel value which indexes the widget's colormap to derive the foreground color of the pointer symbol specified by the cursorName resource.
pointerColorBackgroundA pixel value which indexes the widget's colommap to derive the background color of the pointer symbol specified by the cursor Name resource.
resizeSpecifies whether the widget should attempt to resize to its preferred dimensions whenever its resources are modified with XtSetValues. This attempt to resize may be denied by the parent of this widget. The parent is always free to resize the widget regardless of the state of this resource.
screenThe screen on which this widget is displayed. This is not a settable resource.
sensitiveWhether or not the toolkit should pass user events to this widget. The widget will not get input events if either ancestorSensitive or sensitive is False.
shapeStyleNonrectangular widgets may be created using this resource. Nonrecangular widgets are supported only on a server that supports the Shape Extension. If Nonrectangular widgets are specified for a server lacking this extension, the shape is ignored and the widgets will be rectangular.
The following shapes are currently supported: XmuShapeRectangle, XmuShapeOval, XmuShapeEllipse, and XmuShapeRoundedRectan gle. A converter is registered for this resource that will convert the fool lowing strings: rectangle, oval, ellipse, and roundedRectangle.
translationsThe event bindings associated with this widget.
x
yThe location of the upper left outside corner of this widget in its parent.

3.1.2. Command Actions

The Command widget supports the following actions:

The following are the default translation bindings used by the Command widget:

<EnterWindow>:highlight( )
<LeaveWindow>:reset( )
<BtnlDown>:set( )
<Btn1Up>:notify( ) unset( )

The full list of actions supported by Command is:
highlight(condition)Displays the internal highlight border in the color (foreground or background ) that contrasts with the interior color of the Command widget. The conditions WhenUnset and Always are understood by this action procedure. If no argument is passed, WhenUnset is assumed.
unhighlight( )Displays the internal highlight border in the color (foreground or background) that matches the interior color of the Command widget.
set( )Enters the set state, in which notify is possible. This action causes the button to display its interior in the foreground color. The label or bit map is displayed in the background color.
unset( )Cancels the set state and displays the interior of the button in the background color. The label or bitmap is displayed in the foreground color.
reset( )Cancels any set or highlight and displays the interior of the button in the background color, with the label or bitmap displayed in the foreground color.
notify( )When the button is in the set state this action calls all functions in the callback list named by the callback resource. The value of the call_data argument passed to these functions is undefined.
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 <Btn 1 Down>,<Btn lUp>: Save()

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.

Home


3.2. Grip Widget

Application header file<X1 11/Xaw/Grip.h>
Class header file<X1 1/XawGripP.h>
ClassgripWidgetClass
Class NameGrip
SuperclassSimple

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.

3.2.1. Resources

When creating a Grip widget instance, the following resources are retrieved from the argument list or from the resource database:

NameClassType NotesDefaull Value
acceleratorsAccelerators AcceleratoraTableNULL
ancestorSensitiveancestorSensitive BooleanDTrue
backgroundBackground PixelXtDefaultBackground
backgroundPixmapPixmap PixmapXtUnspecifiedPixmap
borderColorBorderColor PixelXtDefaultForeground
borderPixmapPixmapPixmap XtUnspecifiedPixmap
borderWidthBorderWidth Dimension0
callbackCallbackCallback NULL
colormapColormapColormap Parent's Colormap
cursorCursorCursor None
cursorNarmeCursorString NULL
depthDepthint CParent's Depth
destroyCallbackCallback XtCallbackListNULL
foregroundForeground PixelXtDefaultForeground
heightHeightDimension 8
insensitiveBorderInsensitive PixmapGreyPixmap
internationalInternational BooleanCFalse
mappedWhenManagedMappedWhenManaged BooleanTrue
pointerColorForeground PixelXtDefaultForeground
pointerColorBackgroundBackground PixelXtDefaultBackground
screenScreenScreen RParent's Screen
sensitiveSensitiveBoolean True
translationsTranslations TranslationTableNULL
widthWidthDimension 8
xPositionPosition 0
yPositionPosition 0

acceleratorsA 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).
ancestorSensitiveThe 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 changed with XtSetValues, although it may be queried.
backgroundA pixel value which indexes the widget's colormap to derive the back ground color of the widget's window.
backgroundPixmapThe background pixmap of this widget's window. If this resource is set to anything other than XtUnspecifiedPixmap, the pixmap specified will be used instead of the background color.
borderColorA pixel value which indexes the widget's colormap to derive the border color of the widget's window.
borderPixmapThe border pixmap of this widget's window. If this resource is set to anything other than XtUnspecifiedPixmap, the pixmap specified will be used instead of the border color.
borderWidthThe width of this widget's window border.
callbackAll routines on this list are called whenever the GripAction action routine is invoked. The call_data contains all information passed to the action routine. A detailed description is given below in the Grip Actions section.
colormapThe colormap that this widget will use.
cursorThe image that will be displayed as the pointer cursor whenever it is in this widget. The use of this resource is deprecated in favor of cursorName.
cursorNameThe name of the symbol to use to represent the pointer cursor. This resource will override the cursor resource if both are specified. (See 2.5.l)
depthThe depth of this widget's window.
destroyCallbackAll functions on this list are called when this widget is destroyed.
foregroundA pixel value which indexes the widget's colormap to derive the color used to flood fill the entire Grip widget.
height
widthThe height and width of this widget in pixels.
insensitiveBorderThis pixmap will be tiled into the widget's border if the widget becomes insensitive.
internationalThis is a boolean flag, only settable at widget creation time. While not utilized in this widget, it can and should be checked by any subclasses that have behavior that should vary with locale.
mappedWhenManagedIf this resource is True, then the widget's window will automatically be mapped by the Toolkit when it is realized and managed.
pointerColorA pixel value which indexes the widget's colormap to derive the foreground color of the pointer symbol specified by the cursorName resource.
pointerColorBackgroundA pixel value which indexes the widget's colormap to derive the background color of the pointer symbol specified by the cursorName resource.
screenThe screen on which this widget is displayed. This is not a settable resource.
sensitiveWhether or not the toolkit should pass user events to this widget. The widget will not get input events if either ancestorSensitive or sensitive is False.
translationsThe event bindings associated with this widget.
x
yThe location of the upper left outside corner of this widget in its parent.

3.2.2. Grip Actions

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 XawGripCallData structure, defined in the Grip widget's application header file.

typedef struct_XawGripCallData {
        XEvent *event;
        String *params;
        Cardinal num_params;
} XawGripCallDataRec, *XawGripCallData,
GripCallDataRec, *GripCallData; /* supported for R4 compatibility */

In this structure, the evenl is a pointer to the input event that triggered the action. params and num_params give the string parameters specified in the translation table for the particular event binding.

The following is an example of a translation table that uses the GripAction:

<Btn l Down>:GripAction(Press)
<Btn l Motion>:GripAction(move)
<Btn 1 Up>:GripAction(Release)

For a complete description of the format of translation tables, see the X Toolkit Intrinsics-C Language Interface.

Home


3.3. Label Widget

Application header file<Xl l/Xaw/Label.h>
Class header file<Xl l/Xaw/LabelP.h>
ClasslabelWidgetClass
Class NameLabel
SuperclassSimple

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 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.

3.3.1. Resources

When creating a Label widget instance, the following resources are retrieved from the argument list or from the resource database:

NameClassType NotesDefaull Value
acceleratorsAccelerators AceeleralorTableNULL
ancestorSensitiveancestorSensitive BooleanDTrue
baekgroundBackground PixelXtDefaultBackground
baekgroundPixmapPixmap PixmapXtUnspeeifiedPixmap
bitmapBitmapPixmap None
borderColorBorderColor PixelXtDefaultForeground
borderPixmapPixmapPixmap XlUnspecifiedpixrnap
borderWidthBorderWidth Dimension1
colormapColormapColormap Parent's Colorrnap
cursorCursorCursor None
cursorNameCursorString NULL
depthDeplhint CParent's Depth
destroyCallbackCallback XlCallbackLislNULL
encodingEncodingUnsignedChar XawTextEncoding8bil
fontFontXFontStruct XtDefaultFont
fontsetFontSetXfontSet XtDefaultFontSet
foregroundForeground PixelXtDefaultForeground
heightHeighlDimension Agraphic height + 2 * internalHeight
insensitiveBorderInsensitive PixmapGreyPixmap
internalHeightHeight Dimension2
internalWidthWidthDimension 4
inlernaionalinlernaional BooleanCFalse
justifyJuslifyJuslify XLluslifyCenter (center)
labelLabelSlring name of widget
leflBitmapLeflBitrnap BitmapNone
mappedWhenManagedMappedWhenManaged BooleanTrue
poimerColorForeground PixelXtDefaullForeground
poinlerColorBaekgroundBackground PixelXtDefaultBackground
resizeResizeBoolean True
screenScreenScreen RParent's Screen
sensitiveSensitiveBoolean True
translationsTranslations TranslationTableSee above
widthWidthDimension Agraphic width + 2 * internalWidth
xPositionPosition 0
yPositionPosition 0

acceleratorsA 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).
ancestorSensitiveThe 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 changed with XtSetValues, although it may be queried.
backgroundA pixel value which indexes the widget's colormap to derive the back ground color of the widget's window.
backgroundPixmapThe background pixmap of this widget's window. If this resource is set to anything other than XtUnspecifiedPixmap, the pixmap specified will be used instead of the background color.
bitmapA bitmap to display instead of the label. The default size of the widget will be just large enough to contain the bitmap and the widget's internal width and height. The resource converter for this resource constructs bit maps from the contents of files. (See section 2.5.3, Bitmap Conversion, 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 background color. If bitmap has a depth greater than one, it is copied directly into the window.
borderColorA pixel value which indexes the widget's colormap to derive the border color of the widget's window.
borderPixmapThe border pixmap of this widget's window. If this resource is set to anything other than XtUnspecifiedPixmap, the pixmap specified will be used instead of the border color.
borderWidthThe width of this widget's window border.
colormapThe colormap that this widget will use.
cursorThe image that will be displayed as the pointer cursor whenever it is in this widget. The use of this resource is deprecated in favor of cursor Name.
cursorNameThe name of the symbol to use to represent the pointer cursor. This resource will override the cursor resource if both are specified. (See 2.5.1)
depthThe depth of this widget's window.
destroyCallbackAll functions on this list are called when this widget is destroyed.
encodingThe encoding method used by the value of the label resource. The value may be XawTextEncoding8bit or XawTextEncodingChar2b. When international is set to true this resource is not used.
fontThe text font to use when displaying the label, when the international resource is false.
fontSetThe text font set to use when displaying the label, when the international resource is true.
foregroundA pixel value which indexes the widget's colormap to derive the fore ground color of the widget's window. This color is also used to render all l's in a bitmap one plane deep.
height
widthThe height and width of this widget in pixels.
insensitiveBorderThis pixmap will be tiled into the widget's border if the widget becomes insensitive.
internalHeight
internalWidthThe minimum amount of space to leave between the graphic and the vertical and horizontal edges of the window.
internationalThis is a boolean flag, only settable at widget creation time. A value of false signals the widget to use pre-R6 internationalization (specifically, the lack thereof), such as using fonts for displaying text, etc. A value of true directs the widget to act in an internationalized manner, such as utilizing font sets for displaying text, etc.
justifySpecifies left, center, or right alignment of graphic within the widget. This resource may be specified with the values XtJustifyLeft, XtJustifyCenter, or XtJustifyRight. A converter is registered for this resource that will convert the following strings: left, right, and center. This resource only has noticeable effect when the width of the widget is larger than necessary to display the graphic. Note that when the graphic is a multi-line label, the longest line will obey this justification while shorter lines will be left-justified with the longest one.
labelSpecifies the text string to be displayed in the widget's window if no bit map is specified. The default is the name of this widget. Irregardless of the value of encoding or international, a single newline character ( 1 byte) will cause a line break.
ieftBitmapSpecifies a bitmap to display to the left of the graphic in the widget's window.
mappedWhenManagedIf this resource is True, then the widget's window will automatically be mapped by the Toolkit when it is realized and managed.
pointerColorA pixel value which indexes the widget's colormap to derive the foreground color of the pointer symbol specified by the cursorName resource.
pointerColorBackgroundA pixel value which indexes the widget's colormap to derive the background color of the pointer symbol specified by the cursorName resource.
resizeSpecifies whether the widget should attempt to resize to its preferred dimensions whenever its resources are modified with XtSetValues. This attempt to resize may be denied by the parent of this widget. The parent is always free to resize the widget regardless of the state of this resource.
screenThe screen on which this widget is displayed. This is not a settable resource.
sensitiveWhether or not the toolkit should pass user events to this widget. The widget will not get input events if either ancestorSensitive or sensitive is False.
shapeStyleNonrectangular widgets may be created using this resource. Nonrectangular widgets are supported only on a server that supports the ShapeExtension.If nonrectangular widgets are specified for a server lacking this extension, the shape is ignored and the widgets will be rectangular. The following shapes are currently supported: XmuShapeRectangle, XmuShapeOval,XmuShapeEllipse, and XmuShapeRoundRectangle. A converter is registered for this resource that will convert the following string: rectangle, oval, ellipse, and roundedRectangle.
translationsThe event bindings associated with this widget.
x
yThe location of the upper left outside corner of this widget in its parent.

Home


3.4. List Widget

Application header file<Xl l/Xaw/List.h>
Class header file<X l l/Xaw/ListP.h>
ClasslistWidgetClass
Class NameList
SuperclassSimple

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.

3.4.1. Resources

When creating a List widget instance, the following resources are retrieved from the argument list or from the resource database:

NameClassType NotesDefault Value
acceleratorsAccelerators AcceleratorTableNULL
ancestorSensitiveAncestorSensitive BooleanDTrue
backgroundBackground PixelXtDefaultBackground
backgroundPixmapPixrnap PixmapXtUnspecifiedPixrnap
borderColorBorderColor PixelXtDefaultForeground
borderPixmapPixmapPixmap XtUnspecifiedPixrnap
borderWidthBorderWidth Dimension1
callbackCallbackCallback NULL
colormapColormapColormap Parent's Colormap
columnSpecifySpacing Dimension6
cursorCursorCursor XC_lefl_ptr
cursorNameCursorString NULL
defaultColumnsColumns int2
depthDepthint CParent's Depth
destroyCallbackCallback XtCallbackListNULL
fontFontFontStruct XtDefaultFont
fontSetFontSetXFontSet XtDefaultFontSet
forceColumnsColumns BooleanFalse
foregroundForeground PixelXtDefaultForeground
heightHeightDimension AEnough space to contain the list
insensitiveBorderInsensitive PixmapGreyPixmap
internalHeightHeight Dimension2
internalWidthWidthDimension 4
internationalInternational BooleanCFalse
listListPointer name of widget
longestLongestint A 0
rnappedWhenManagedMappedWhenManaged BooleanTrue
numberStringsNumberStrings intAcomputed for NULL terminated list
pasteBufferBooleanBoolean False
pointerColorForeground PixelXtDefaultForeground
pointerColorBackgroundBackground PixelXtDefaultBackground
rowSpacingSpacingDimension 2
screenScreenScreen RParent's Screen
sensitiveSensitiveBoolean True
translationsTranslations TransladonTableSee below
verticalListBoolean BooleanFalse
widthWidthDimension AEnough space to contain the list
xPositionPosition 0
yPositionPosition 0

acceleratorsA 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).
ancestorSensitiveThe 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 changed with XtSetValues, although it may be queried.
backgroundA pixel value which indexes the widget's colormap to derive the background color of the widget's window.
backgroundPixmapThe background pixmap of this widget's window. If this resource is set to anything other than XtUnspecifiedPixmap, the pixmap specified will be used instead of the background color.
borderColorA pixel value which indexes the widget's colormap to derive the border color of the widget's window.
borderPixmapThe border pixmap of this widget's window. If this resource is set to anything other than XtUnspecifiedPixmap, the pixmap specified will be used instead of the border color.
borderWidthThe width of this widget's window border.
callbackAll functions on this list are called whenever the notify action is invoked. The call_data argument contains information about the element selected and is described in detail in the List Callbacks section.
colormapThe colormap that this widget will use.
columnSpacing
rowSpacingThe amount of space, in pixels, between each of the rows and columns in the list.
cursorThe image that will be displayed as the pointer cursor whenever it is in this widget. The use of this resource is deprecated in favor of cursorName.
cursorNameThe name of the symbol to use to represent the pointer cursor. This resource will override the cursor resource if both are specified. (See 2.5.1)
defaultColumnsThe default number of columns. This value is used when neither the width nor the height of the List widget is specified or when forceColumns is True.
depthThe depth of this widget's window.
destroyCallbackAll functions on this list are called when this widget is destroyed.
fontThe text font to use when displaying the list, when the international resource is false.
fontSetThe text font set to use when displaying the list, when the international resource is true.
forceColumns Forces the default number of columns to be used regardless of the List widget's current size.
foregroundA pixel value which indexes the widget's colormap to derive the color used to paint the text of the list elements.
height
widthThe height and width of this widget in pixels.
insensitiveBorderThis pixmap will be tiled into the widget's border if the widget becomes insensitive.
internal Height
internalWidthThe margin, in pixels, between the edges of the list and the corresponding edge of the List widget's window.
listAn array of text strings displayed in the List widget. If numberStrings is zero (the default) then the list must be NULL terminated. If a value is not specified for the list, then numberStrings is set to 1, and the name of the widget is used as the list, and longest is set to the length of the name of the widget. The list is used in place, and must be available to the List widget for the lifetime of this widget, or until it is changed with XtSetValues or XawListChange.
InternationalThis is a boolean flag, only settable at widget creation time. A value of false signals the widget to use pre-R6 internationalization (specifically, the lack thereof), such as using fonts for displaying text, etc. A value of true directs the widget to act in an internationalized manner, such as utilizing font sets for displaying text, etc.
longestSpecifies the width, in pixels, of the longest string in the current list. The List widget will compute this value if zero (the default) is specified. If this resource is set by hand, entries longer than this will be clipped to fit.
mappedWhenManagedIf this resource is True, then the widget's window will automatically be mapped by the Toolkit when it is realized and managed.
numberStringsThe number of strings in the current list. If a value of zero (the default) is specified, the List widget will compute it. When computing the number of strings the List widget assumes that the list is NULL terminated.
pasteBufferIf this resource is set to True then the name of the currently selected list element will be put into CUT_BUFFER_0.
pointerColorA pixel value which indexes the widget's colormap to derive the foreground color of the pointer symbol specified by the cursorName resource.
pointerColorBackgroundA pixel value which indexes the widget's colormap to derive the background color of the pointer symbol specified by the cursorName resource.
screenThe screen on which this widget is displayed. This is not a settable resource.
sensitiveWhether or not the toolkit should pass user events to this widget. The widget will not get input events if either ancestorSensitive or sensitive is False.
translationsThe event bindings associated with this widget.
verticalListIf this resource is set to True then the list elements will be presented in column major order.
x
yThe location of the upper left outside corner of this widget in its parent.

3.4.2. List Actions

The List widget supports the following actions:



The following is the default translation table used by the List Widget:

<BtnlDown>,<BtnlUp>: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 this element is currently set, it is drawn with foreground and background colors reversed. If this action is called when there is no list element under the cursor, the currently set element will be unset.
Unset( )Cancels the set state of the element under the pointer, and redraws it with normal foreground and background colors.
Notify( )Calls all callbacks on the List widget's callback list. Information about the currently selected list element is passed in the call data argument (see List Callbacks below).

3.4.3. List Callbacks

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 string;             /* string shown in the list. */
        int list_index;            /* index of the item selected. */
} XawListReturnStruct;

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.

3.4.4. Changing the List

To change the list that is displayed, use XawListChange.
void XawListChange(w, list, nitems, longest, resize)
Widget w;
String * list;
int niterns, longest;
Boolean resize;

wSpecifies the List widget.
listSpecifies the new list for the List widget to display.
niternsSpecifies 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.
longestSpecifies the length of the longest item in the list in pixels. If a value less than l is specified, the List widget will calculate the value.
resizeSpecifies a Boolean value that if True indicates that the List widget should try to resize itself after making the change. The constraints of the List widget's parent are always enforced, regardless of the value specified here.

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.

3.4.5. Highlighting an Item

To highlight an item in the list, use XawListHighlight.
void XawListHighlight(w, item)
Widget w;
int item;
wSpecifies the List widget.
itemSpecifies 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.

3.4.6. Unhighlighting an Item

To unhighlight the currently highlighted item in the list, use XawListUnhighlight.
void XawListUnhighlight(w)
Widget w;
wSpecifies the List widget.

3.4.7. Retrieving the Currently Selected Item

To retrieve the list element that is currently set, use XawListShowCurrent.
XawListReturnStruct *XawListShowCurrent(w)
Widget w;
wSpecifies the List widget.
XawListShowCurrent returns a pointer to an XawListReturnStruct structure, containing the currently highlighted item. If the value of the index member is XAW_LIST_NONE, the string member is undefined, and no item is currently selected.

3.4.8. Restrictions

Many programmers create a "scrolled list" by putting a List widget with many entries as a child of a Viewport widget. The List continues to create a window as big as its contents, but that big window is only visible where it intersects the parent Viewport's window. (I.e., it is "clipped.")
While this is a useful technique, there is a serious drawback. X does not support windows above 32,767 pixels in width or height, but this height limit will be exceeded by a List's window when the List has many entries (i.e., with a 12 point font, about 3000 entries would be too many.)

Home


3.5. Panner Widget

Application header file<X11/Xaw/Panner.h>
Class header file<X11/Xaw/PannerP.h>
ClasspannerWidgetClass
Class NamePanner
SuperclassSimple

A Panner widget is a rectangle, called the "canvas," on which another rectangle, the "slider," moves in two dimensions. It is often used with a Porthole widget to move, or "scroll," a third widget in two dimensions, in which case the slider's size and position gives feedback as to what portion of the third widget is visible.

The slider may be scrolled around the canvas by pressing, dragging, and releasing Buttonl; the default translation also enables scrolling via arrow keys and some other keys. While scrolling is in progress, the application receives notification through callback procedures. Notification may be done either continuously whenever the slider moves or discretely whenever the slider has been given a new location.

3.5.1. Resources

When creating a Panner widget instance, the following resources are retrieved from the argument list or from the resource database:

NameClassType NotesDefaull Value
acceleratorsAccelerators AcceleralorTableNULL
allowOffallowOffBoolean False
ancestorSensitiveAnsestorSensitive BooleanDTrue
backgroundBackground PixelXtDefaultBackground
backgroundPixmapPixmap PixmapXtUnspecifiedPixmap
backgroundStippleBackgroundStipple StringNULL
borderColorBorderColor PixelXtDefaultForeground
borderPixmapPixmapPixmap XtUnspecifiedPixmap
borderWidthBorderWidth Dimension1
canvasHeightCanvasHeight Dimension0
canvasWidthCanvasWidth Dimension0
colormapColormapColormap Parent's Colormap
cursorCursorCursor None
cursorNameCursorString NULL
defaultScaleDeafaultScale Dimension8
depthDepthint CParent's Depth
destroyCallbackCallback XlCallbackLislNULL
foregroundForeground PixelXtDefaultForeground
heightHeightDimension Adepends on orientation
internalSpaceInternal Space Dimension4
internationalInternational BooleanCFalse
lineWidthLineWidthDimension 0
mappedWhenManagedMappedWhenManaged BooleanTrue
pointerColorForeground PixelXtDefaultForeground
pointerColorBackgroundBackground PixelXtDefaultBackground
reportCallbackReponCallback CallbackNULL
resizeResizeBoolean True
rubberBandRubberBand BooleanFalse
screenScreenScreen RParent's Screen
sensitiveSensitiveBoolean True
shadowColorShadowColor PixelXtDefaultForeground
shadowThicknessshadowThickness Dimension2
sliderXSlidorXPosition 0
sliderYSliderYPosition 0
sliderHeightSliderHeight Dimension0
sliderWidthSliderWidth Dimension0
translationsTranslations TranslationTableSee below
widthWidthDimension Adepends on orientation
xPositionPosition 0
yPositionPosition 0

acceleratorsA 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).
allowOffWhether to allow the edges of the slider to go off the edges of the canvas.
ancestorSensitiveThe 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 changed with XtSetValues, although it may be queried.
backgroundA pixel value which indexes the widget's colormap to derive the background color of the widget's window.
backgroundPixmapThe background pixmap of this widget's window. If this resource is set to anything other than XtUnspecifiedPixmap, the pixmap specified will be used instead of the background color.
backgroundStippleThe name of a bitmap pattern to be used as the background for the area representing the canvas.
borderColorA pixel value which indexes the widget's colormap to derive the border color of the widget's window.
borderPixmapThe border pixmap of this widget's window. If this resource is set to anything other than XtUnspecifiedPixmap, the pixmap specified will be used instead of the border color.
borderWidthThe width of this widget's window border.
canvasHeight
canvasWidthThe size of the canvas.
colormapThe colormap that this widget will use.
cursorThe image that will be displayed as the pointer cursor whenever it is in this widget. The use of this resource is deprecated in favor of cursorName.
cursorNameThe name of the symbol to use to represent the pointer cursor. This resource will override the cursor resource if both are specified. (See 2.5.1)
defaultScaleThe percentage size that the Panner widget should have relative to the size of the canvas.
depthThe depth of this widget's window.
destroyCallbackAll functions on this list are called when this widget is destroyed.
foregroundA pixel value which indexes the widget's colormap to derive the color used to draw the slider.
height
widthThe height and width of this widget in pixels.
internalSpaceThe width of internal border in pixels between a slider representing the full size of the canvas and the edge of the Panner widget.
internationalThis is a boolean flag, only settable at widget creation time. While not utilized in this widget, it can and should be checked by any subclasses that have behavior that should vary with locale.
lineWidthThe width of the lines in the rubberbanding rectangle when rubberbanding is in effect instead of continuous scrolling. The default is 0.
mappedWhenManagedIf this resource is True, then the widget's window will automatically be mapped by the Toolkit when it is realized and managed.
pointerColorA pixel value which indexes the widget's colormap to derive the foreground color of the pointer symbol specified by the cursorName resource.
pointerColorBackgroundA pixel value which indexes the widget's colormap to derive the background color of the pointer symbol specified by the cursorName resource.
reportCallbackAll functions on this callback list are called when the notify action is invoked. See the Panner Actions section for details.
resizeWhether or not to resize the panner whenever the canvas size is changed so that the defaultScale is maintained.
rubberBandWhether or not scrolling should be discrete (only moving a rubberbanded rectangle until the scrolling is done) or continuous (moving the slider itself). This controls whether or not the move action procedure also invokes the notify action procedure.
screenThe screen on which this widget is displayed. This is not a settable resource.
sensitiveWhether or not the toolkit should pass user events to this widget. The widget will not get input events if either ancestorSensitive or sensilive is False.
shadowColorThe color of the shadow underneath the slider.
shadowThicknessThe width of the shadow underneath the slider.
sliderX
sliderYThe location of the slider in the coordinates of the canvas.
sliderHeight
sliderWidthThe size of the slider.
translationsThe event bindings associated with this widget.
x
yThe location of the upper left outside corner of this widget in its parent.

3.5.2. Panner Actions

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 amounts is a signed or unsigned floating-point number (e.g., +l.0 or -.5) followed by either p indicating pages (slider sizes), or c indicating canvas sizes. Thus, page(+0,+.5p) represents vertical movement down one-half the height of the slider and page(0,0) represents moving to the upper left corner of the canvas.
notify()This action informs the application of the slider's current position by invoking the reportCallback functions registered by the application.
set(what, value) This action changes the behavior of the Panner. The what argument must currently be the string rubberband and controls the value of the rubberBand resource. The value argument may have one of the values on, off, or toggle.
The default bindings for Panner are:

<BtnlDown>:start( )
<BtnlMotion>:move( )
<Btn1Up>:notify( ) stop( )
<Btn2Down>:abort( )
<Key> KP_Enter :set(rubberband, toggle)
<Key>space:page(+lp,+lp)
<Key>Delete:page(-lp,-lp)
<Key>BackSpace:page(-lp,-lp)
<Key>Left:page(-.5p,+0)
<Key>Right:page(+.5p,+0)
<Key>Up:page(+0,-.5p)
<Key>Down:page(+0,+.5p)
<Key>Home:page(0,0)

3.5.3. Panner Callbacks

The functions registered on the reportCallback list are invoked by the notify action as follows:
void ReportProc(panner, client_dam, report)
Widget panner;
XtPointer client_data;
XtPointer report; /* (XawPannerReport *) */

pannerSpecifies the Panner widget.
client_dataSpecifies the client data.
reportSpecifies a pointer to an XawPannerReport structure containing the location and size of the slider and the size of the canvas.

Home

Contents Previous Chapter Part 2/Chapter 3