1 |
578 |
markom |
'\"
|
2 |
|
|
'\" Copyright (c) 1990-1994 The Regents of the University of California.
|
3 |
|
|
'\" Copyright (c) 1994-1996 Sun Microsystems, Inc.
|
4 |
|
|
'\"
|
5 |
|
|
'\" See the file "license.terms" for information on usage and redistribution
|
6 |
|
|
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
7 |
|
|
'\"
|
8 |
|
|
'\" RCS: @(#) $Id: pack.n,v 1.1.1.1 2002-01-16 10:25:49 markom Exp $
|
9 |
|
|
'\"
|
10 |
|
|
.so man.macros
|
11 |
|
|
.TH pack n 4.0 Tk "Tk Built-In Commands"
|
12 |
|
|
.BS
|
13 |
|
|
'\" Note: do not modify the .SH NAME line immediately below!
|
14 |
|
|
.SH NAME
|
15 |
|
|
pack \- Geometry manager that packs around edges of cavity
|
16 |
|
|
.SH SYNOPSIS
|
17 |
|
|
\fBpack \fIoption arg \fR?\fIarg ...\fR?
|
18 |
|
|
.BE
|
19 |
|
|
|
20 |
|
|
.SH DESCRIPTION
|
21 |
|
|
.PP
|
22 |
|
|
The \fBpack\fR command is used to communicate with the packer,
|
23 |
|
|
a geometry manager that arranges the children of a parent by
|
24 |
|
|
packing them in order around the edges of the parent.
|
25 |
|
|
The \fBpack\fR command can have any of several forms, depending
|
26 |
|
|
on the \fIoption\fR argument:
|
27 |
|
|
.TP
|
28 |
|
|
\fBpack \fIslave \fR?\fIslave ...\fR? ?\fIoptions\fR?
|
29 |
|
|
If the first argument to \fBpack\fR is a window name (any value
|
30 |
|
|
starting with ``.''), then the command is processed in the same
|
31 |
|
|
way as \fBpack configure\fR.
|
32 |
|
|
.TP
|
33 |
|
|
\fBpack configure \fIslave \fR?\fIslave ...\fR? ?\fIoptions\fR?
|
34 |
|
|
The arguments consist of the names of one or more slave windows
|
35 |
|
|
followed by pairs of arguments that specify how
|
36 |
|
|
to manage the slaves.
|
37 |
|
|
See ``THE PACKER ALGORITHM'' below for details on how the options
|
38 |
|
|
are used by the packer.
|
39 |
|
|
The following options are supported:
|
40 |
|
|
.RS
|
41 |
|
|
.TP
|
42 |
|
|
\fB\-after \fIother\fR
|
43 |
|
|
\fIOther\fR must the name of another window.
|
44 |
|
|
Use its master as the master for the slaves, and insert
|
45 |
|
|
the slaves just after \fIother\fR in the packing order.
|
46 |
|
|
.TP
|
47 |
|
|
\fB\-anchor \fIanchor\fR
|
48 |
|
|
\fIAnchor\fR must be a valid anchor position such as \fBn\fR
|
49 |
|
|
or \fBsw\fR; it specifies where to position each slave in its
|
50 |
|
|
parcel.
|
51 |
|
|
Defaults to \fBcenter\fR.
|
52 |
|
|
.TP
|
53 |
|
|
\fB\-before \fIother\fR
|
54 |
|
|
\fIOther\fR must the name of another window.
|
55 |
|
|
Use its master as the master for the slaves, and insert
|
56 |
|
|
the slaves just before \fIother\fR in the packing order.
|
57 |
|
|
.TP
|
58 |
|
|
\fB\-expand \fIboolean\fR
|
59 |
|
|
Specifies whether the slaves should be expanded to consume
|
60 |
|
|
extra space in their master.
|
61 |
|
|
\fIBoolean\fR may have any proper boolean value, such as \fB1\fR
|
62 |
|
|
or \fBno\fR.
|
63 |
|
|
Defaults to 0.
|
64 |
|
|
.TP
|
65 |
|
|
\fB\-fill \fIstyle\fR
|
66 |
|
|
If a slave's parcel is larger than its requested dimensions, this
|
67 |
|
|
option may be used to stretch the slave.
|
68 |
|
|
\fIStyle\fR must have one of the following values:
|
69 |
|
|
.RS
|
70 |
|
|
.TP
|
71 |
|
|
\fBnone\fR
|
72 |
|
|
Give the slave its requested dimensions plus any internal padding
|
73 |
|
|
requested with \fB\-ipadx\fR or \fB\-ipady\fR. This is the default.
|
74 |
|
|
.TP
|
75 |
|
|
\fBx\fR
|
76 |
|
|
Stretch the slave horizontally to fill the entire width of its
|
77 |
|
|
parcel (except leave external padding as specified by \fB\-padx\fR).
|
78 |
|
|
.TP
|
79 |
|
|
\fBy\fR
|
80 |
|
|
Stretch the slave vertically to fill the entire height of its
|
81 |
|
|
parcel (except leave external padding as specified by \fB\-pady\fR).
|
82 |
|
|
.TP
|
83 |
|
|
\fBboth\fR
|
84 |
|
|
Stretch the slave both horizontally and vertically.
|
85 |
|
|
.RE
|
86 |
|
|
.TP
|
87 |
|
|
\fB\-in \fIother\fR
|
88 |
|
|
Insert the slave(s) at the end of the packing order for the master
|
89 |
|
|
window given by \fIother\fR.
|
90 |
|
|
.TP
|
91 |
|
|
\fB\-ipadx \fIamount\fR
|
92 |
|
|
\fIAmount\fR specifies how much horizontal internal padding to
|
93 |
|
|
leave on each side of the slave(s).
|
94 |
|
|
\fIAmount\fR must be a valid screen distance, such as \fB2\fR or \fB.5c\fR.
|
95 |
|
|
It defaults to 0.
|
96 |
|
|
.TP
|
97 |
|
|
\fB\-ipady \fIamount\fR
|
98 |
|
|
\fIAmount\fR specifies how much vertical internal padding to
|
99 |
|
|
leave on each side of the slave(s).
|
100 |
|
|
\fIAmount\fR defaults to 0.
|
101 |
|
|
.TP
|
102 |
|
|
\fB\-padx \fIamount\fR
|
103 |
|
|
\fIAmount\fR specifies how much horizontal external padding to
|
104 |
|
|
leave on each side of the slave(s).
|
105 |
|
|
\fIAmount\fR defaults to 0.
|
106 |
|
|
.TP
|
107 |
|
|
\fB\-pady \fIamount\fR
|
108 |
|
|
\fIAmount\fR specifies how much vertical external padding to
|
109 |
|
|
leave on each side of the slave(s).
|
110 |
|
|
\fIAmount\fR defaults to 0.
|
111 |
|
|
.TP
|
112 |
|
|
\fB\-side \fIside\fR
|
113 |
|
|
Specifies which side of the master the slave(s) will be packed against.
|
114 |
|
|
Must be \fBleft\fR, \fBright\fR, \fBtop\fR, or \fBbottom\fR.
|
115 |
|
|
Defaults to \fBtop\fR.
|
116 |
|
|
.LP
|
117 |
|
|
If no \fB\-in\fR, \fB\-after\fR or \fB\-before\fR option is specified
|
118 |
|
|
then each of the slaves will be inserted at the end of the packing list
|
119 |
|
|
for its parent unless it is already managed by the packer (in which
|
120 |
|
|
case it will be left where it is).
|
121 |
|
|
If one of these options is specified then all the slaves will be
|
122 |
|
|
inserted at the specified point.
|
123 |
|
|
If any of the slaves are already managed by the geometry manager
|
124 |
|
|
then any unspecified options for them retain their previous values rather
|
125 |
|
|
than receiving default values.
|
126 |
|
|
.RE
|
127 |
|
|
.TP
|
128 |
|
|
\fBpack forget \fIslave \fR?\fIslave ...\fR?
|
129 |
|
|
Removes each of the \fIslave\fRs from the packing order for its
|
130 |
|
|
master and unmaps their windows.
|
131 |
|
|
The slaves will no longer be managed by the packer.
|
132 |
|
|
.TP
|
133 |
|
|
\fBpack info \fIslave\fR
|
134 |
|
|
Returns a list whose elements are the current configuration state of
|
135 |
|
|
the slave given by \fIslave\fR in the same option-value form that
|
136 |
|
|
might be specified to \fBpack configure\fR.
|
137 |
|
|
The first two elements of the list are ``\fB\-in \fImaster\fR'' where
|
138 |
|
|
\fImaster\fR is the slave's master.
|
139 |
|
|
.TP
|
140 |
|
|
\fBpack propagate \fImaster\fR ?\fIboolean\fR?
|
141 |
|
|
If \fIboolean\fR has a true boolean value such as \fB1\fR or \fBon\fR
|
142 |
|
|
then propagation is enabled for \fImaster\fR, which must be a window
|
143 |
|
|
name (see ``GEOMETRY PROPAGATION'' below).
|
144 |
|
|
If \fIboolean\fR has a false boolean value then propagation is
|
145 |
|
|
disabled for \fImaster\fR.
|
146 |
|
|
In either of these cases an empty string is returned.
|
147 |
|
|
If \fIboolean\fR is omitted then the command returns \fB0\fR or
|
148 |
|
|
\fB1\fR to indicate whether propagation is currently enabled
|
149 |
|
|
for \fImaster\fR.
|
150 |
|
|
Propagation is enabled by default.
|
151 |
|
|
.TP
|
152 |
|
|
\fBpack slaves \fImaster\fR
|
153 |
|
|
Returns a list of all of the slaves in the packing order for \fImaster\fR.
|
154 |
|
|
The order of the slaves in the list is the same as their order in
|
155 |
|
|
the packing order.
|
156 |
|
|
If \fImaster\fR has no slaves then an empty string is returned.
|
157 |
|
|
|
158 |
|
|
.SH "THE PACKER ALGORITHM"
|
159 |
|
|
.PP
|
160 |
|
|
For each master the packer maintains an ordered list of slaves
|
161 |
|
|
called the \fIpacking list\fR.
|
162 |
|
|
The \fB\-in\fR, \fB\-after\fR, and \fB\-before\fR configuration
|
163 |
|
|
options are used to specify the master for each slave and the slave's
|
164 |
|
|
position in the packing list.
|
165 |
|
|
If none of these options is given for a slave then the slave
|
166 |
|
|
is added to the end of the packing list for its parent.
|
167 |
|
|
.PP
|
168 |
|
|
The packer arranges the slaves for a master by scanning the
|
169 |
|
|
packing list in order.
|
170 |
|
|
At the time it processes each slave, a rectangular area within
|
171 |
|
|
the master is still unallocated.
|
172 |
|
|
This area is called the \fIcavity\fR; for the first slave it
|
173 |
|
|
is the entire area of the master.
|
174 |
|
|
.PP
|
175 |
|
|
For each slave the packer carries out the following steps:
|
176 |
|
|
.IP [1]
|
177 |
|
|
The packer allocates a rectangular \fIparcel\fR for the slave
|
178 |
|
|
along the side of the cavity given by the slave's \fB\-side\fR option.
|
179 |
|
|
If the side is top or bottom then the width of the parcel is
|
180 |
|
|
the width of the cavity and its height is the requested height
|
181 |
|
|
of the slave plus the \fB\-ipady\fR and \fB\-pady\fR options.
|
182 |
|
|
For the left or right side the height of the parcel is
|
183 |
|
|
the height of the cavity and the width is the requested width
|
184 |
|
|
of the slave plus the \fB\-ipadx\fR and \fB\-padx\fR options.
|
185 |
|
|
The parcel may be enlarged further because of the \fB\-expand\fR
|
186 |
|
|
option (see ``EXPANSION'' below)
|
187 |
|
|
.IP [2]
|
188 |
|
|
The packer chooses the dimensions of the slave.
|
189 |
|
|
The width will normally be the slave's requested width plus
|
190 |
|
|
twice its \fB\-ipadx\fR option and the height will normally be
|
191 |
|
|
the slave's requested height plus twice its \fB\-ipady\fR
|
192 |
|
|
option.
|
193 |
|
|
However, if the \fB\-fill\fR option is \fBx\fR or \fBboth\fR
|
194 |
|
|
then the width of the slave is expanded to fill the width of the parcel,
|
195 |
|
|
minus twice the \fB\-padx\fR option.
|
196 |
|
|
If the \fB\-fill\fR option is \fBy\fR or \fBboth\fR
|
197 |
|
|
then the height of the slave is expanded to fill the width of the parcel,
|
198 |
|
|
minus twice the \fB\-pady\fR option.
|
199 |
|
|
.IP [3]
|
200 |
|
|
The packer positions the slave over its parcel.
|
201 |
|
|
If the slave is smaller than the parcel then the \fB\-anchor\fR
|
202 |
|
|
option determines where in the parcel the slave will be placed.
|
203 |
|
|
If \fB\-padx\fR or \fB\-pady\fR is non-zero, then the given
|
204 |
|
|
amount of external padding will always be left between the
|
205 |
|
|
slave and the edges of the parcel.
|
206 |
|
|
.PP
|
207 |
|
|
Once a given slave has been packed, the area of its parcel
|
208 |
|
|
is subtracted from the cavity, leaving a smaller rectangular
|
209 |
|
|
cavity for the next slave.
|
210 |
|
|
If a slave doesn't use all of its parcel, the unused space
|
211 |
|
|
in the parcel will not be used by subsequent slaves.
|
212 |
|
|
If the cavity should become too small to meet the needs of
|
213 |
|
|
a slave then the slave will be given whatever space is
|
214 |
|
|
left in the cavity.
|
215 |
|
|
If the cavity shrinks to zero size, then all remaining slaves
|
216 |
|
|
on the packing list will be unmapped from the screen until
|
217 |
|
|
the master window becomes large enough to hold them again.
|
218 |
|
|
|
219 |
|
|
.SH "EXPANSION"
|
220 |
|
|
.PP
|
221 |
|
|
If a master window is so large that there will be extra space
|
222 |
|
|
left over after all of its slaves have been packed, then the
|
223 |
|
|
extra space is distributed uniformly among all of the slaves
|
224 |
|
|
for which the \fB\-expand\fR option is set.
|
225 |
|
|
Extra horizontal space is distributed among the expandable
|
226 |
|
|
slaves whose \fB\-side\fR is \fBleft\fR or \fBright\fR,
|
227 |
|
|
and extra vertical space is distributed among the expandable
|
228 |
|
|
slaves whose \fB\-side\fR is \fBtop\fR or \fBbottom\fR.
|
229 |
|
|
|
230 |
|
|
.SH "GEOMETRY PROPAGATION"
|
231 |
|
|
.PP
|
232 |
|
|
The packer normally computes how large a master must be to
|
233 |
|
|
just exactly meet the needs of its slaves, and it sets the
|
234 |
|
|
requested width and height of the master to these dimensions.
|
235 |
|
|
This causes geometry information to propagate up through a
|
236 |
|
|
window hierarchy to a top-level window so that the entire
|
237 |
|
|
sub-tree sizes itself to fit the needs of the leaf windows.
|
238 |
|
|
However, the \fBpack propagate\fR command may be used to
|
239 |
|
|
turn off propagation for one or more masters.
|
240 |
|
|
If propagation is disabled then the packer will not set
|
241 |
|
|
the requested width and height of the packer.
|
242 |
|
|
This may be useful if, for example, you wish for a master
|
243 |
|
|
window to have a fixed size that you specify.
|
244 |
|
|
|
245 |
|
|
.SH "RESTRICTIONS ON MASTER WINDOWS"
|
246 |
|
|
.PP
|
247 |
|
|
The master for each slave must either be the slave's parent
|
248 |
|
|
(the default) or a descendant of the slave's parent.
|
249 |
|
|
This restriction is necessary to guarantee that the
|
250 |
|
|
slave can be placed over any part of its master that is
|
251 |
|
|
visible without danger of the slave being clipped by its parent.
|
252 |
|
|
|
253 |
|
|
.SH "PACKING ORDER"
|
254 |
|
|
.PP
|
255 |
|
|
If the master for a slave is not its parent then you must make sure
|
256 |
|
|
that the slave is higher in the stacking order than the master.
|
257 |
|
|
Otherwise the master will obscure the slave and it will appear as
|
258 |
|
|
if the slave hasn't been packed correctly.
|
259 |
|
|
The easiest way to make sure the slave is higher than the master is
|
260 |
|
|
to create the master window first: the most recently created window
|
261 |
|
|
will be highest in the stacking order.
|
262 |
|
|
Or, you can use the \fBraise\fR and \fBlower\fR commands to change
|
263 |
|
|
the stacking order of either the master or the slave.
|
264 |
|
|
|
265 |
|
|
.SH KEYWORDS
|
266 |
|
|
geometry manager, location, packer, parcel, propagation, size
|