keysym. This function allows an application that overrides the default XtKeyProc to handle Motif's virtual key
bindings. See Section #seventspec in Chapter 2, The Motif Programming Model, for more information on virtual
bindings. The new XmChangeColor() routine changes the foreground color, shadow colors, and select color for a
widget based on a background color. The XmNdarkThreshold, XmN-foregroundThreshold, and
XmNlightThreshold resources of the Screen object allow the application or the user to set values that affect the
default color calculation algorithm. The values for these resources indicate the levels of perceived brightness (between
0 and 100) that distinguish between a light color and a dark color. The XmNforegroundThreshold value is used
in calculating the default foreground and highlight colors, while the other two resources are used in calculating the
default shadow and select colors. See Section #scolor for a discussion of color resources in Motif. An application can
use the new XmWidgetGetBaselines() routine to get the position of the text baseline in a widget, while
XmWidgetGetDisplayRect() can be used to get the size and position of the bounding box for the widget. These
routines provide information that is useful in laying out and aligning components in an interface.
4.5.2 Specific Widget Changes
Motif 1.2 also introduces a number of new features, including resources and callback routines, for individual widget
classes. In Motif 1.2, the Frame widget can have two children: a work area and a title. The Frame draws a border
around its work area child and adds space for a title if one is specified. The XmNchildType constraint resource
specifies whether a child is the work area or the title. This resource can have either the value
XmFRAME_WORKAREA_CHILD or XmFRAME_TITLE_CHILD. The XmNchildHorizontalAlignment,
XmNchildHorizontalSpacing, and XmNchildVerticalAlignment constraint resources control the
positioning of the title child. For more information on these resources, see Section #sframe in Chapter 8, Manager
Widgets. The Label widget functions as a drag source for drag and drop, as described in Chapter 18, Drag and Drop.
The ProcessDrag() action routine, which is bound to the second mouse button, handles this functionality. The
List widget provides the following new functions for managing list items:
XmListAddItemUnselected()
XmListDeletePositions()
XmListGetKbdItemPos()
XmListPosSelected()
XmListPosToBounds()
XmListReplaceItemsPosUnselected()
XmListReplaceItemsUnselected()
XmListReplacePositions()
XmListSetKbdItemPos()
XmListUpdateSelectedList()
XmListYToPos()
For more information on these routines, see Chapter 12, The List Widget, and the appropriate reference pages in
Volume Six B, Motif Reference Manual.
When a List widget is set insensitive, it provides visual indication by greying out all of its items. The default value of
the XmNvisibleItemCount resource is now set dynamically, based on the item count and the height of the List.
The List widget functions as a drag source for drag and drop, as described in Chapter 18, Drag and Drop. The
ListProcessDrag() action routine, which is bound to the second mouse button, handles this functionality. The
List also has a ListCopyToClipboard() action routine for copying the selected items to the clipboard, as well as
a ListScrollCursorVertically() routine for scrolling the cursor vertically based on a y−position. The
MessageBox widget supports the addition of a MenuBar child, a work area child, and multiple PushButton children.
The XmNdialogType resource can also be set to the value XmDIALOG_TEMPLATE to create a MessageBox that
can be used as a template for creating a custom dialog. Section #smoddialog in Chapter 7, Custom Dialogs, describes
the template dialog in more detail. The PanedWindow defines a new constraint resource, XmNpositionIndex, for
4 Overview of the Motif Toolkit 4.5.2 Specific Widget Changes
78
specifying the position of a child widget in the PanedWindow's list of children. The children are positioned vertically
in the PanedWindow according to this list. The list of children does not include the Sashes. A value of 0 indicates the
beginning of the list, while XmLAST_POSITION places the child at the end of the list. The RowColumn widget
provides a new resource for controlling the alignment of its children. The XmNentryVerticalAlignment
resource controls the vertical positioning of children that are subclasses of Label, LabelGadget, and Text, as described
in Section #srowcolumn in Chapter 8, Manager Widgets.
The RowColumn widget also defines the XmNpositionIndex constraint resource for specifying the position of a
child widget in the RowColumn's list of children. The children are positioned in the RowColumn according to this list.
A value of 0 indicates the beginning of the list, while XmLAST_POSITION places the child at the end of the list.
The XmNtearOffModel resource of the RowColumn widget controls tear−off functionality in Motif menus. The
widget also defines the XmNtearOffMenuActivateCallback and
XmNtearOffMenuDeactivateCallback callback routines for performing any special processing that is
necessary for handling tear−off menus. Tear−off functionality is described in detail in Section #stearoff in
Chapter 15, Menus. When a ScrollBar is set insensitive, it provides a visual indication of this state by dimming itself.
The ScrollBar also has new action routine, CancelDrag(), that cancels the current slider drag. When the user
presses the ESCAPE key while the slider is being dragged, the action is invoked. In Motif 1.2, the ScrolledWindow
has a new callback that supports keyboard traversal. The XmNtraverseObscuredCallback is invoked when the
user attempts to traverse to a widget that is not visible in a ScrolledWindow. An application can use this callback to
make a widget visible in a ScrolledWindow so that the widget can receive the input focus. The
XmScrollVisible() routine makes an obscured child of a ScrolledWindow visible, while
XmGetVisibility() determines whether or not a widget is visible. See Section #sswtrav in Chapter 9,
ScrolledWindows and ScrollBars, for more information on keyboard traversal in ScrolledWindows.
The SelectionBox and FileSelectionBox widgets now support the addition of a MenuBar child and multiple
PushButton children in addition to the work area child that was supported in Motif 1.1. The new
XmNchildPlacement resource controls the location of the work area child, as described in Section #smodseldlg in
Chapter 7, Custom Dialogs.
The Text and TextField widgets have a number of new resources and callback routines that support wide−character
strings. These changes have been made for internationalization purposes and are described in Section #stexti18n in
Chapter 14, Text Widgets. The widgets function as drag sources and drop sites for drag and drop, as described in
Chapter 18, Drag and Drop.
The insertion position in the Text and TextField widgets is marked by an I−beam cursor. The destination cursor now
follows the insertion cursor, so it is no longer drawn independently as a caret (^). When a Text or TextField widget is
set insensitive, it provides a visual indication of this state by greying out its text and its insertion cursor. Both the Text
and TextField widgets provide the toggle−overstrike() action routine for switching between insert and
overstrike modes. The Text widget also provides the scroll−cursor−vertically() action to scroll the cursor
based on a y position. When the user moves the pointer outside of a Text widget while selecting text, the widget
continues selecting text by scrolling automatically after a time delay.
The new XmTextDisableRedisplay() and XmTextEnableRedisplay() routines provide a way to control
visual updating in a Text widget. The XmTextFindString(), XmTextGetSubstring(), and
XmTextFieldGetSubstring() functions make string manipulation easier. For more information on these
routines, see the appropriate reference pages in Volume Six B, Motif Reference Manual. The TextField widget also
has an XmNfocusCallback in Motif 1.2. The performance of scrolling in the ScrolledText object has been
improved in Motif 1.2. One unfortunate side−effect of this improvement is that it introduces a new data structure,
which means that subclasses of the Motif 1.1 Text widget may break under Motif 1.2.
If XmNfillOnSelect is explicitly set to True when XmNindicatorOn is False, the background of the
ToggleButton is set to the XmNselectColor when the button is on.
The VendorShell provides the XmNaudibleWarning resource to specify whether or not an audible cue
4 Overview of the Motif Toolkit 4.5.2 Specific Widget Changes
79

Get Volume 6A: Motif Programming Manual now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.