Tree widget


Application Header file <Xraw/Tree.h>
Class Header file <Xraw/TreeP.h>
Class treeWidgetClass
Class Name Tree
Superclass Container --> Constraint --> Composit --> Core

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.


New Resources

Name Class Type Notes Default Value
autoReconfigure AutoReconfigure Boolean False
gravity Gravity XtGravity WestGravity
hSpace HSpace Dimension 4
lineWidth LineWidth Dimension 0
vSpace VSpace Dimension 4
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.


Constraint Resources

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.

Name Class Type Notes Default Value
treeGC TreeGC GC NULL
treeParent TreeParent Widget NULL
treeGC This specifies the GC to use when drawing lines between this widget and its inferiors in the tree. If this resource is not specified, the Tree's foreground and lineWidth will be used.
treeParent This specifies the superior node in the tree for this widget. The default is for the node to have no superior (and to therefore be at the top of the tree).


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 resource is set. Children at the top (most superior) of the tree are drawn at the side specified by the 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 to False and then use the routine to arrange the children.

void XawTreeForceLayout(w)
	Widget w;
w Specifies the Tree widget.

[Xraw home] [Xraw widget class hierarchy]
Vladimir T. Romanovski
romsky@hp1.oea.ihep.su