http://invisible-island.net/athena_widgets/XawPlus

_________________________________________________________XawPlus

The Tree Widget

Application Header file
Class Header file
Class
Class Name
Superclass
<X11/XawPlus/Tree.h>
<X11/XawPlus/TreeP.h>
treeWidgetClass
Tree
Constraint

The Tree widget provides geometry management of arbitrary widgets arranged in a directed, acyclic graph (i.e., a tree). The hierarchy is contructed by attaching a constraint resource called treeParent to each widget indicating which other node in the tree should be treated as the widget's superior. The structure of the tree is shown by laying out the nodes in the standard format for tree diagrams with lines drawn connecting each node with its children.

The Tree sizes itself according to the needs of its children and is not intended to be resized by its parent. Instead, it should be placed inside another composite widget (such as the Porthole or Viewport) that can be used to scroll around in the tree.

Differences between Xaw and XawPlus

None.

Resources

When creating a Tree widget instance, the following resources are retrieved from the argument list of XtSetValues() or XtVaSetValues() or from the resource database:

Name Class Type Default Value
OBJECT:
destroyCallback Callback Pointer NULL
RECTANGLE:
borderWidth
height
sensitive
width
x
y
BorderWidth
Height
Sensitive
Width
Position
Position
Dimension
Dimension
Boolean
Dimension
Position
Position
1
Space for all children
True
Space for all children
0
0
CORE:
border
background
mappedWhenManaged
BorderColor
Background
MappedWhenManaged
Pixel
Pixel
Boolean
XtDefaultForeground
grey75
True
TREE:
autoReconfigure
foreground
gravity
hSpace
lineWidth
vSpace
AutoReconfigure
Foreground
Gravity
HSpace
LineWidth
VSpace
Boolean
Pixel
XtGravity
Dimension
Dimension
Dimension
FALSE
XtDefaultForeground
West
20
0
6
autoReconfigure Whether or not to layout the tree every time a node is added or removed.
gravity Specifies the side of the widget from which the tree should grow. Valid values include WestGravity, NorthGravity, EastGravity, and SouthGravity.
hSpace
vSpace
The amount of space, in pixels, to leave between the children. This resource specifies the amount of space left between the outermost children and the edge of the box.
lineWidth The width of the lines from nodes that do not have a treeGC constraint resource to their children.

Layout Semantics

Each time a child is managed or unmanaged, the Tree widget will attempt to reposition the remaining children to fix the shape of the tree if the autoReconfigure resource is set. Children at the top (most superior) of the tree are drawn at the side specified by the gravity resource.

After positioning all children, the Tree widget attempts to shrink its own size to the minimum dimensions required for the layout.

Convenience Routines

The most efficient way to layout a tree is to set autoReconfigure to False and then use XawTreeForceLayout() to arrange the children:

void XawTreeForceLayout(w)
Widget w;

w Specifies the Tree widget.

XawPlus_________________________________________________________