Tree Widget Application Header file <X11/Xaw/Tree.h> Class Header file <X11/Xaw/TreeP.h> Class treeWidgetClass Class Name Tree Superclass Constraint The Tree widget provides geometry management of arbitrary widgets arranged in a directed, acyclic graph (i.e., a tree). The hierarchy is constructed 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. Resources When creating a Tree widget instance, the following resources are retrieved from the argument list or from the resource database: Name Class Type Notes Default Value accelerators Accelerators AcceleratorTable NULL ancestorSensitive AncestorSensitive Boolean D True autoReconfigure AutoReconfigure Boolean False background Background Pixel XtDefaultBackground backgroundPixmap Pixmap Pixmap XtUnspecifiedPixmap borderColor BorderColor Pixel XtDefaultForeground borderPixmap Pixmap Pixmap XtUnspecifiedPixmap borderWidth BorderWidth Dimension 1 children ReadOnly WidgetList R NULL colormap Colormap Colormap Parent's Colormap depth Depth int C Parent's Depth destroyCallback Callback XtCallbackList NULL foreground Foreground Pixel XtDefaultForeground gravity Gravity XtGravity WestGravity height Height Dimension A see Layout Semantics hSpace HSpace Dimension 4 lineWidth LineWidth Dimension 0 mappedWhenManaged MappedWhenManaged Boolean True numChildren ReadOnly Cardinal R 0 screen Screen Screen R Parent's Screen sensitive Sensitive Boolean True vSpace VSpace Dimension 4 translations Translations TranslationTable NULL width Width Dimension A see Layout Semantics x Position Position 0 y Position Position 0 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 autoReconfigure to False and then use the XawTreeForceLayout routine to arrange the children. void XawTreeForceLayout Widget w w Specifies the Tree widget.