Tree   [plain text]


.\" $Xorg: Tree,v 1.3 2000/08/17 19:42:29 cpqbld Exp $
.NH 2
Tree Widget
.LP
.XS
	Tree Widget
.XE
.IN "Tree widget" "" "@DEF@"
.Ds 0
.TA 2.0i
.ta 2.0i
.sp
Application Header file	<X11/Xaw/Tree.h>
.IN "Box.h" ""
Class Header file	<X11/Xaw/TreeP.h>
.IN "TreeP.h" ""
Class		treeWidgetClass
.IN "treeWidgetClass" ""
Class Name	Tree
.IN "Tree widget" "class name"
Superclass	Constraint
.sp
.De
.LP
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 \fBtreeParent\fP 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.
.LP
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 \fBPorthole\fP or \fBViewport\fP) 
that can be used to scroll around in the tree.
.NH 3
Resources
.LP
When creating a Tree widget instance, the following resources are
retrieved from the argument list or from the resource database:
.LP
.IN "Box widget" "resources"
.TS H
expand;
lw(1i) lw(1i) lw(1i) lw(.5i) lw(2i).
_
.sp 3p
.TB
Name	Class	Type	Notes	Default Value
.sp 3p
_
.TH
.R
.sp 3p
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 \fBLayout Semantics\fP
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 \fBLayout Semantics\fP
x	Position	Position		0
y	Position	Position		0
.sp 3p
_
.TE
.IP \fBautoReconfigure\fP 1.5i
Whether or not to layout the tree every time a node is added or removed.
.Bg
.Gp
.Bc
.Bp
.Bw
.Ch
.Cm
.Dp
.Dc
.Lg
.IP \fBgravity\fP 1.5i
.IN "conversions" "Gravity"
Specifies the side of the widget from which the tree should grow.  Valid
values include \fBWestGravity\fP, \fBNorthGravity\fP, \fBEastGravity\fP, and
\fBSouthGravity\fP.
.Rs "\fP the legal values\fB"
.Hw
.IP \fBhSpace\fP 1.5i
.br
.ns
.IP \fBvSpace\fP 1.5i
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. 
.IP \fBlineWidth\fP 1.5i
The width of the lines from nodes that do not have a \fBtreeGC\fP
constraint resource to their children.
.Mm
.Nc
.Sc
.Se
.Tr
.Xy
.NH 3
Constraint Resources
.LP
.IN "Tree widget" "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.
.TS H
lw(1i) lw(1i) lw(1i) lw(.5i) lw(2i).
_
.sp 3p
.TB
Name	Class	Type	Notes	Default Value
.sp 3p
_
.TH
.R
.sp 3p
treeGC	TreeGC	GC		NULL
treeParent	TreeParent	Widget		NULL
.sp 3p
_
.TE
.IP \fBtreeGC\fP 1.5i
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
\fBforeground\fP and \fBlineWidth\fP will be used.
.IP \fBtreeParent\fP 1.5i
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).
.NH 3
Layout Semantics
.IN "Tree widget" "layout semantics"
.LP
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
.B autoReconfigure
resource is set.  Children at the top (most superior) of the tree are
drawn at
the side specified by the 
.B gravity
resource.
.LP
After positioning all children, the Tree widget attempts to shrink its
own size to the minimum dimensions required for the layout.
.NH 3
Convenience Routines
.LP
.IN "Tree widget" "convenience routines"
The most efficient way to layout a tree is to set
.B autoReconfigure
to False and then use the 
.B XawTreeForceLayout
routine to arrange the children.
.IN "XawTreeForceLayout" "" "@DEF@"
.FD 0
void XawTreeForceLayout(\fIw\fP)
.br
	Widget \fIw\fP;
.FN
.IP \fIw\fP 1i
Specifies the Tree widget.