aboutsummaryrefslogtreecommitdiff
path: root/libXaw/spec/Tree
blob: 5575228fbca1afcb767c2189063d024e7646b75b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
.\" $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.