Table of Contents

NAME

XfwfCommon

DESCRIPTION

The Common class is not meant to be instantiated. It only serves as the common superclass for a family of widgets, to ensure that these widgets have some common methods and resources. The Common class defines common types, symbolic constants, and type converters and it also provides the basis for keyboard traversal. The code for keyboard traver­ sal is roughly based on that in the Xw widget set (created by Hewlett Packard), but it uses the accept_focus method.

When the resource traversalOn is set to True (either at cre­ ation time, or via a XtSetValues later), a set of transla­ tions is added to the widget. If the widget's parent is also a subclass of Common, these translations will then implement keyboard traversal, using the cursor keys (up, down, prev, etc.) Of course, when the widget already uses these keys for other purposes, the keyboard traversal will not work.

Public variables
___________________________________________________________________________________

|
XfwfCommon | Name | Class | Type | Default | XtNtraversalOn | XtCTraversalOn | Boolean | True | XtNhighlightThickness| XtCHighlightThickness| Dimension | 2 | XtNhighlightColor | XtCHighlightColor | Pixel | XtDefaultForeground | XtNhighlightPixmap | XtCHighlightPixmap | Pixmap | None | XtNnextTop | XtCNextTop | Callback | NULL | XtNuserData | XtCUserData | Pointer | NULL | | | | |______________________|_______________________|____________|______________________

XtNtraversalOn
The resource traversalOn determines whether keyboard traversal is used. If it is True initially, or if it is set to True later, a set of translations will be added to the widget.

XtNhighlightThickness
Keyboard focus is indicated by border highlighting. When keyboard traversal is on and the widget receives the focus, the highlight border is filled with the highlight color or tile. If the widget does not have the focus, the area is left in the default background.

XtNhighlightColor
The highlight border can have a color or it can be tiled with a pixmap. Whichever of the resources high­ lightColor or highlightPixmap is set latest, is used. When both are set, the pixmap is used.

XtNhighlightPixmap
The highlightPixmap can be set to a pixmap with which the highlight border will be tiled. Only one of high­ lightPixmap and highlightColor can be set, see above.

XtNnextTop
When an application has several top level windows, it should have a way of setting the focus between windows. The Enter key in any widget with keyboard traversal on normally invokes the traverseNextTop action, that will call the callbacks of the topmost Common (or subclass) widget in the hierarchy. The callback may set the focus to another top level widget, with XtCallAcceptFocus.

XtNuserData
The resource userData is provided for applications that want to attach their own data to a widget. It is not used by the widget itself in any way.

_____________________________________________________________
Composite Name Class Type Default XtNchildren XtCChildren WidgetList NULL insertPosition XtCInsertPosition XTOrderProc NULL numChildren XtCNumChildren Cardinal 0

_____________________________________________________________

| | | | ___|_______________|___________________|______________|_________|_____ | | | Core | | |
| Na|me || Class | | Type | | De|fault
| Xt|Nx
|| XtCX | | Position | | 0 |
| Xt|Ny
|| XtCY | | Position | | 0 |
| Xt|Nwidth
|| XtCWidth | | Dimension | | 0 |
| Xt|Nheight
|| XtCHeight | | Dimension | | 0 |
| bo|rderWidth
|| XtCBorderWidth | | Dimension | | 0 |
| Xt|Ncolormap
|| XtCColormap | | Colormap | | NU|LL
| Xt|Ndepth
|| XtCDepth | | Int | | 0 | | de|stroyCallback || XtCDestroyCallback| | XTCallback|List | NU|LL | Xt|Nsensitive || XtCSensitive | | Boolean | | Tr|ue
| Xt|Ntm
|| XtCTm | | XTTMRec | | NU|LL | an|cestorSensitive|| XtCAncestorSensiti|ve| Boolean | | Fa|lse | ac|celerators || XtCAccelerators | | XTTranslat|ions | NU|LL
| bo|rderColor
|| XtCBorderColor | | Pixel | | 0 | | bo|rderPixmap || XtCBorderPixmap | | Pixmap | | NU|LL
| ba|ckground
|| XtCBackground | | Pixel | | 0 | | ba|ckgroundPixmap || XtCBackgroundPixma|p | Pixmap | | NU|LL | ma|ppedWhenManaged|| XtCMappedWhenManag|ed| Boolean | | Tr|ue
| Xt|Nscreen
|| XtCScreen | | Screen * | | NU|LL | | || | | | | | |___|______________||___________________|_|____________|____|____|____ | | | | | | | | Expo|rts | | | T|he type Alignmen|t is actually an int|eger, but it is|given a d|ifferent name to|allow a type conver|ter to be insta|lled for i|t. | | | | | | | | | | | | | | | | | | | t|ype | | |
|Alignment = int |
| | | | | | T|he symbolic co|nstants can be ad|ded together to|form an a|lignment. Vario|us widgets use this| to position |labels, o|ther widgets, et|cetera. | | | | | | | | | | | | | |
d|ef XfwfCenter = |0
| |
|
| def XfwfLeft = 1

def XfwfRight = 2

def XfwfTop = 4 def XfwfBottom = 8

For convenience, the eight possible combinations also have symbolic names.

def XfwfTopLeft = (XfwfTop +XfwfLeft )

def XfwfTopRight = (XfwfTop +XfwfRight )

def XfwfBottomLeft = (XfwfBottom +XfwfLeft )

def XfwfBottomRight = (XfwfBottom +XfwfRight )

The directions of traversal are used as arguments to the traverse method. They are probably only useful to sub­ classes.

type
TraversalDirection = enum {
TraverseLeft, TraverseRight, TraverseUp, TraverseDown, TraverseNext, TraversePrev, TraverseHome, TraverseNextTop }

To know the inside area of a Common widget might be useful to other widgets than subclasses alone. Calling XfwfCallCom­ puteInside will call the compute_inside method, if avail­ able.

XfwfCallComputeInside( $, Position * x, Position * y, Dimension * w, Dimension * h)

Another convenience function is XfwfCallFrameWidth, which uses the method total_frame_width to compute the thickness of the frame that the widget will draw.

Dimension XfwfCallFrameWidth( $)

focusIn

focusOut

This action removes the highlight border.

traverseDown

This and the following actions all call the traverse method of the widget's parent, with the appropiate direction arguments. traverseDown tries to set the focus to a widget that is located roughly below the current one.

traverseUp

The action tries to set the focus to a widget that is above the this one.

traverseLeft

traverseLeft looks for a widget to the left of the cur­ rent one and sets the keyboard focus to that.

traverseRight

The action looks for a widget that will aceept the focus to the right of the current one.

traverseNext

The next sibling gets the focus. The precise order is determined by the parent, but usually is will be the order in which the widgets were created. If there is no suitable sibling, the request is passed to the grand­ parent, so that an `aunt widget' or other relation can get the focus.

traversePrev

The previous widget gets the focus. See also the description of traverseNext above.

traverseNextTop

traverseNextTop finds the topmost ancestor that is a subclass of Common and lets it call the nextTop call­ backs that have been registered there. These callbacks can be used by an application that has multiple top level windows to set the focus to another window.

traverseHome

The action sets the focus to the sibling widget that is closest to the upper left corner of the parent.

traverseCurrent

The traverseCurrent action can be used by widgets to set the focus to themselves. It is not used in the set of translations that is added when traversalOn is set to True.


Table of Contents