Commit | Line | Data |
---|---|---|
920dae64 AT |
1 | '\" |
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.3.6.1 2004/10/28 12:25:22 dkf Exp $ | |
9 | '\" | |
10 | '\" The definitions below are for supplemental macros used in Tcl/Tk | |
11 | '\" manual entries. | |
12 | '\" | |
13 | '\" .AP type name in/out ?indent? | |
14 | '\" Start paragraph describing an argument to a library procedure. | |
15 | '\" type is type of argument (int, etc.), in/out is either "in", "out", | |
16 | '\" or "in/out" to describe whether procedure reads or modifies arg, | |
17 | '\" and indent is equivalent to second arg of .IP (shouldn't ever be | |
18 | '\" needed; use .AS below instead) | |
19 | '\" | |
20 | '\" .AS ?type? ?name? | |
21 | '\" Give maximum sizes of arguments for setting tab stops. Type and | |
22 | '\" name are examples of largest possible arguments that will be passed | |
23 | '\" to .AP later. If args are omitted, default tab stops are used. | |
24 | '\" | |
25 | '\" .BS | |
26 | '\" Start box enclosure. From here until next .BE, everything will be | |
27 | '\" enclosed in one large box. | |
28 | '\" | |
29 | '\" .BE | |
30 | '\" End of box enclosure. | |
31 | '\" | |
32 | '\" .CS | |
33 | '\" Begin code excerpt. | |
34 | '\" | |
35 | '\" .CE | |
36 | '\" End code excerpt. | |
37 | '\" | |
38 | '\" .VS ?version? ?br? | |
39 | '\" Begin vertical sidebar, for use in marking newly-changed parts | |
40 | '\" of man pages. The first argument is ignored and used for recording | |
41 | '\" the version when the .VS was added, so that the sidebars can be | |
42 | '\" found and removed when they reach a certain age. If another argument | |
43 | '\" is present, then a line break is forced before starting the sidebar. | |
44 | '\" | |
45 | '\" .VE | |
46 | '\" End of vertical sidebar. | |
47 | '\" | |
48 | '\" .DS | |
49 | '\" Begin an indented unfilled display. | |
50 | '\" | |
51 | '\" .DE | |
52 | '\" End of indented unfilled display. | |
53 | '\" | |
54 | '\" .SO | |
55 | '\" Start of list of standard options for a Tk widget. The | |
56 | '\" options follow on successive lines, in four columns separated | |
57 | '\" by tabs. | |
58 | '\" | |
59 | '\" .SE | |
60 | '\" End of list of standard options for a Tk widget. | |
61 | '\" | |
62 | '\" .OP cmdName dbName dbClass | |
63 | '\" Start of description of a specific option. cmdName gives the | |
64 | '\" option's name as specified in the class command, dbName gives | |
65 | '\" the option's name in the option database, and dbClass gives | |
66 | '\" the option's class in the option database. | |
67 | '\" | |
68 | '\" .UL arg1 arg2 | |
69 | '\" Print arg1 underlined, then print arg2 normally. | |
70 | '\" | |
71 | '\" RCS: @(#) $Id: man.macros,v 1.4 2000/08/25 06:18:32 ericm Exp $ | |
72 | '\" | |
73 | '\" # Set up traps and other miscellaneous stuff for Tcl/Tk man pages. | |
74 | .if t .wh -1.3i ^B | |
75 | .nr ^l \n(.l | |
76 | .ad b | |
77 | '\" # Start an argument description | |
78 | .de AP | |
79 | .ie !"\\$4"" .TP \\$4 | |
80 | .el \{\ | |
81 | . ie !"\\$2"" .TP \\n()Cu | |
82 | . el .TP 15 | |
83 | .\} | |
84 | .ta \\n()Au \\n()Bu | |
85 | .ie !"\\$3"" \{\ | |
86 | \&\\$1 \\fI\\$2\\fP (\\$3) | |
87 | .\".b | |
88 | .\} | |
89 | .el \{\ | |
90 | .br | |
91 | .ie !"\\$2"" \{\ | |
92 | \&\\$1 \\fI\\$2\\fP | |
93 | .\} | |
94 | .el \{\ | |
95 | \&\\fI\\$1\\fP | |
96 | .\} | |
97 | .\} | |
98 | .. | |
99 | '\" # define tabbing values for .AP | |
100 | .de AS | |
101 | .nr )A 10n | |
102 | .if !"\\$1"" .nr )A \\w'\\$1'u+3n | |
103 | .nr )B \\n()Au+15n | |
104 | .\" | |
105 | .if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n | |
106 | .nr )C \\n()Bu+\\w'(in/out)'u+2n | |
107 | .. | |
108 | .AS Tcl_Interp Tcl_CreateInterp in/out | |
109 | '\" # BS - start boxed text | |
110 | '\" # ^y = starting y location | |
111 | '\" # ^b = 1 | |
112 | .de BS | |
113 | .br | |
114 | .mk ^y | |
115 | .nr ^b 1u | |
116 | .if n .nf | |
117 | .if n .ti 0 | |
118 | .if n \l'\\n(.lu\(ul' | |
119 | .if n .fi | |
120 | .. | |
121 | '\" # BE - end boxed text (draw box now) | |
122 | .de BE | |
123 | .nf | |
124 | .ti 0 | |
125 | .mk ^t | |
126 | .ie n \l'\\n(^lu\(ul' | |
127 | .el \{\ | |
128 | .\" Draw four-sided box normally, but don't draw top of | |
129 | .\" box if the box started on an earlier page. | |
130 | .ie !\\n(^b-1 \{\ | |
131 | \h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul' | |
132 | .\} | |
133 | .el \}\ | |
134 | \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul' | |
135 | .\} | |
136 | .\} | |
137 | .fi | |
138 | .br | |
139 | .nr ^b 0 | |
140 | .. | |
141 | '\" # VS - start vertical sidebar | |
142 | '\" # ^Y = starting y location | |
143 | '\" # ^v = 1 (for troff; for nroff this doesn't matter) | |
144 | .de VS | |
145 | .if !"\\$2"" .br | |
146 | .mk ^Y | |
147 | .ie n 'mc \s12\(br\s0 | |
148 | .el .nr ^v 1u | |
149 | .. | |
150 | '\" # VE - end of vertical sidebar | |
151 | .de VE | |
152 | .ie n 'mc | |
153 | .el \{\ | |
154 | .ev 2 | |
155 | .nf | |
156 | .ti 0 | |
157 | .mk ^t | |
158 | \h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n' | |
159 | .sp -1 | |
160 | .fi | |
161 | .ev | |
162 | .\} | |
163 | .nr ^v 0 | |
164 | .. | |
165 | '\" # Special macro to handle page bottom: finish off current | |
166 | '\" # box/sidebar if in box/sidebar mode, then invoked standard | |
167 | '\" # page bottom macro. | |
168 | .de ^B | |
169 | .ev 2 | |
170 | 'ti 0 | |
171 | 'nf | |
172 | .mk ^t | |
173 | .if \\n(^b \{\ | |
174 | .\" Draw three-sided box if this is the box's first page, | |
175 | .\" draw two sides but no top otherwise. | |
176 | .ie !\\n(^b-1 \h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c | |
177 | .el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c | |
178 | .\} | |
179 | .if \\n(^v \{\ | |
180 | .nr ^x \\n(^tu+1v-\\n(^Yu | |
181 | \kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c | |
182 | .\} | |
183 | .bp | |
184 | 'fi | |
185 | .ev | |
186 | .if \\n(^b \{\ | |
187 | .mk ^y | |
188 | .nr ^b 2 | |
189 | .\} | |
190 | .if \\n(^v \{\ | |
191 | .mk ^Y | |
192 | .\} | |
193 | .. | |
194 | '\" # DS - begin display | |
195 | .de DS | |
196 | .RS | |
197 | .nf | |
198 | .sp | |
199 | .. | |
200 | '\" # DE - end display | |
201 | .de DE | |
202 | .fi | |
203 | .RE | |
204 | .sp | |
205 | .. | |
206 | '\" # SO - start of list of standard options | |
207 | .de SO | |
208 | .SH "STANDARD OPTIONS" | |
209 | .LP | |
210 | .nf | |
211 | .ta 5.5c 11c | |
212 | .ft B | |
213 | .. | |
214 | '\" # SE - end of list of standard options | |
215 | .de SE | |
216 | .fi | |
217 | .ft R | |
218 | .LP | |
219 | See the \\fBoptions\\fR manual entry for details on the standard options. | |
220 | .. | |
221 | '\" # OP - start of full description for a single option | |
222 | .de OP | |
223 | .LP | |
224 | .nf | |
225 | .ta 4c | |
226 | Command-Line Name: \\fB\\$1\\fR | |
227 | Database Name: \\fB\\$2\\fR | |
228 | Database Class: \\fB\\$3\\fR | |
229 | .fi | |
230 | .IP | |
231 | .. | |
232 | '\" # CS - begin code excerpt | |
233 | .de CS | |
234 | .RS | |
235 | .nf | |
236 | .ta .25i .5i .75i 1i | |
237 | .. | |
238 | '\" # CE - end code excerpt | |
239 | .de CE | |
240 | .fi | |
241 | .RE | |
242 | .. | |
243 | .de UL | |
244 | \\$1\l'|0\(ul'\\$2 | |
245 | .. | |
246 | .TH pack n 4.0 Tk "Tk Built-In Commands" | |
247 | .BS | |
248 | '\" Note: do not modify the .SH NAME line immediately below! | |
249 | .SH NAME | |
250 | pack \- Geometry manager that packs around edges of cavity | |
251 | .SH SYNOPSIS | |
252 | \fBpack \fIoption arg \fR?\fIarg ...\fR? | |
253 | .BE | |
254 | ||
255 | .SH DESCRIPTION | |
256 | .PP | |
257 | The \fBpack\fR command is used to communicate with the packer, | |
258 | a geometry manager that arranges the children of a parent by | |
259 | packing them in order around the edges of the parent. | |
260 | The \fBpack\fR command can have any of several forms, depending | |
261 | on the \fIoption\fR argument: | |
262 | .TP | |
263 | \fBpack \fIslave \fR?\fIslave ...\fR? ?\fIoptions\fR? | |
264 | If the first argument to \fBpack\fR is a window name (any value | |
265 | starting with ``.''), then the command is processed in the same | |
266 | way as \fBpack configure\fR. | |
267 | .TP | |
268 | \fBpack configure \fIslave \fR?\fIslave ...\fR? ?\fIoptions\fR? | |
269 | The arguments consist of the names of one or more slave windows | |
270 | followed by pairs of arguments that specify how | |
271 | to manage the slaves. | |
272 | See ``THE PACKER ALGORITHM'' below for details on how the options | |
273 | are used by the packer. | |
274 | The following options are supported: | |
275 | .RS | |
276 | .TP | |
277 | \fB\-after \fIother\fR | |
278 | \fIOther\fR must the name of another window. | |
279 | Use its master as the master for the slaves, and insert | |
280 | the slaves just after \fIother\fR in the packing order. | |
281 | .TP | |
282 | \fB\-anchor \fIanchor\fR | |
283 | \fIAnchor\fR must be a valid anchor position such as \fBn\fR | |
284 | or \fBsw\fR; it specifies where to position each slave in its | |
285 | parcel. | |
286 | Defaults to \fBcenter\fR. | |
287 | .TP | |
288 | \fB\-before \fIother\fR | |
289 | \fIOther\fR must the name of another window. | |
290 | Use its master as the master for the slaves, and insert | |
291 | the slaves just before \fIother\fR in the packing order. | |
292 | .TP | |
293 | \fB\-expand \fIboolean\fR | |
294 | Specifies whether the slaves should be expanded to consume | |
295 | extra space in their master. | |
296 | \fIBoolean\fR may have any proper boolean value, such as \fB1\fR | |
297 | or \fBno\fR. | |
298 | Defaults to 0. | |
299 | .TP | |
300 | \fB\-fill \fIstyle\fR | |
301 | If a slave's parcel is larger than its requested dimensions, this | |
302 | option may be used to stretch the slave. | |
303 | \fIStyle\fR must have one of the following values: | |
304 | .RS | |
305 | .TP | |
306 | \fBnone\fR | |
307 | Give the slave its requested dimensions plus any internal padding | |
308 | requested with \fB\-ipadx\fR or \fB\-ipady\fR. This is the default. | |
309 | .TP | |
310 | \fBx\fR | |
311 | Stretch the slave horizontally to fill the entire width of its | |
312 | parcel (except leave external padding as specified by \fB\-padx\fR). | |
313 | .TP | |
314 | \fBy\fR | |
315 | Stretch the slave vertically to fill the entire height of its | |
316 | parcel (except leave external padding as specified by \fB\-pady\fR). | |
317 | .TP | |
318 | \fBboth\fR | |
319 | Stretch the slave both horizontally and vertically. | |
320 | .RE | |
321 | .TP | |
322 | \fB\-in \fIother\fR | |
323 | Insert the slave(s) at the end of the packing order for the master | |
324 | window given by \fIother\fR. | |
325 | .TP | |
326 | \fB\-ipadx \fIamount\fR | |
327 | \fIAmount\fR specifies how much horizontal internal padding to | |
328 | leave on each side of the slave(s). | |
329 | \fIAmount\fR must be a valid screen distance, such as \fB2\fR or \fB.5c\fR. | |
330 | It defaults to 0. | |
331 | .TP | |
332 | \fB\-ipady \fIamount\fR | |
333 | \fIAmount\fR specifies how much vertical internal padding to | |
334 | leave on each side of the slave(s). | |
335 | \fIAmount\fR defaults to 0. | |
336 | .TP | |
337 | \fB\-padx \fIamount\fR | |
338 | \fIAmount\fR specifies how much horizontal external padding to | |
339 | leave on each side of the slave(s). \fIAmount\fR may be a list | |
340 | of two values to specify padding for left and right separately. | |
341 | \fIAmount\fR defaults to 0. | |
342 | .TP | |
343 | \fB\-pady \fIamount\fR | |
344 | \fIAmount\fR specifies how much vertical external padding to | |
345 | leave on each side of the slave(s). \fIAmount\fR may be a list | |
346 | of two values to specify padding for top and bottom separately. | |
347 | \fIAmount\fR defaults to 0. | |
348 | .TP | |
349 | \fB\-side \fIside\fR | |
350 | Specifies which side of the master the slave(s) will be packed against. | |
351 | Must be \fBleft\fR, \fBright\fR, \fBtop\fR, or \fBbottom\fR. | |
352 | Defaults to \fBtop\fR. | |
353 | .LP | |
354 | If no \fB\-in\fR, \fB\-after\fR or \fB\-before\fR option is specified | |
355 | then each of the slaves will be inserted at the end of the packing list | |
356 | for its parent unless it is already managed by the packer (in which | |
357 | case it will be left where it is). | |
358 | If one of these options is specified then all the slaves will be | |
359 | inserted at the specified point. | |
360 | If any of the slaves are already managed by the geometry manager | |
361 | then any unspecified options for them retain their previous values rather | |
362 | than receiving default values. | |
363 | .RE | |
364 | .TP | |
365 | \fBpack forget \fIslave \fR?\fIslave ...\fR? | |
366 | Removes each of the \fIslave\fRs from the packing order for its | |
367 | master and unmaps their windows. | |
368 | The slaves will no longer be managed by the packer. | |
369 | .TP | |
370 | \fBpack info \fIslave\fR | |
371 | Returns a list whose elements are the current configuration state of | |
372 | the slave given by \fIslave\fR in the same option-value form that | |
373 | might be specified to \fBpack configure\fR. | |
374 | The first two elements of the list are ``\fB\-in \fImaster\fR'' where | |
375 | \fImaster\fR is the slave's master. | |
376 | .TP | |
377 | \fBpack propagate \fImaster\fR ?\fIboolean\fR? | |
378 | If \fIboolean\fR has a true boolean value such as \fB1\fR or \fBon\fR | |
379 | then propagation is enabled for \fImaster\fR, which must be a window | |
380 | name (see ``GEOMETRY PROPAGATION'' below). | |
381 | If \fIboolean\fR has a false boolean value then propagation is | |
382 | disabled for \fImaster\fR. | |
383 | In either of these cases an empty string is returned. | |
384 | If \fIboolean\fR is omitted then the command returns \fB0\fR or | |
385 | \fB1\fR to indicate whether propagation is currently enabled | |
386 | for \fImaster\fR. | |
387 | Propagation is enabled by default. | |
388 | .TP | |
389 | \fBpack slaves \fImaster\fR | |
390 | Returns a list of all of the slaves in the packing order for \fImaster\fR. | |
391 | The order of the slaves in the list is the same as their order in | |
392 | the packing order. | |
393 | If \fImaster\fR has no slaves then an empty string is returned. | |
394 | .SH "THE PACKER ALGORITHM" | |
395 | .PP | |
396 | For each master the packer maintains an ordered list of slaves | |
397 | called the \fIpacking list\fR. | |
398 | The \fB\-in\fR, \fB\-after\fR, and \fB\-before\fR configuration | |
399 | options are used to specify the master for each slave and the slave's | |
400 | position in the packing list. | |
401 | If none of these options is given for a slave then the slave | |
402 | is added to the end of the packing list for its parent. | |
403 | .PP | |
404 | The packer arranges the slaves for a master by scanning the | |
405 | packing list in order. | |
406 | At the time it processes each slave, a rectangular area within | |
407 | the master is still unallocated. | |
408 | This area is called the \fIcavity\fR; for the first slave it | |
409 | is the entire area of the master. | |
410 | .PP | |
411 | For each slave the packer carries out the following steps: | |
412 | .IP [1] | |
413 | The packer allocates a rectangular \fIparcel\fR for the slave | |
414 | along the side of the cavity given by the slave's \fB\-side\fR option. | |
415 | If the side is top or bottom then the width of the parcel is | |
416 | the width of the cavity and its height is the requested height | |
417 | of the slave plus the \fB\-ipady\fR and \fB\-pady\fR options. | |
418 | For the left or right side the height of the parcel is | |
419 | the height of the cavity and the width is the requested width | |
420 | of the slave plus the \fB\-ipadx\fR and \fB\-padx\fR options. | |
421 | The parcel may be enlarged further because of the \fB\-expand\fR | |
422 | option (see ``EXPANSION'' below) | |
423 | .IP [2] | |
424 | The packer chooses the dimensions of the slave. | |
425 | The width will normally be the slave's requested width plus | |
426 | twice its \fB\-ipadx\fR option and the height will normally be | |
427 | the slave's requested height plus twice its \fB\-ipady\fR | |
428 | option. | |
429 | However, if the \fB\-fill\fR option is \fBx\fR or \fBboth\fR | |
430 | then the width of the slave is expanded to fill the width of the parcel, | |
431 | minus twice the \fB\-padx\fR option. | |
432 | If the \fB\-fill\fR option is \fBy\fR or \fBboth\fR | |
433 | then the height of the slave is expanded to fill the width of the parcel, | |
434 | minus twice the \fB\-pady\fR option. | |
435 | .IP [3] | |
436 | The packer positions the slave over its parcel. | |
437 | If the slave is smaller than the parcel then the \fB\-anchor\fR | |
438 | option determines where in the parcel the slave will be placed. | |
439 | If \fB\-padx\fR or \fB\-pady\fR is non-zero, then the given | |
440 | amount of external padding will always be left between the | |
441 | slave and the edges of the parcel. | |
442 | .PP | |
443 | Once a given slave has been packed, the area of its parcel | |
444 | is subtracted from the cavity, leaving a smaller rectangular | |
445 | cavity for the next slave. | |
446 | If a slave doesn't use all of its parcel, the unused space | |
447 | in the parcel will not be used by subsequent slaves. | |
448 | If the cavity should become too small to meet the needs of | |
449 | a slave then the slave will be given whatever space is | |
450 | left in the cavity. | |
451 | If the cavity shrinks to zero size, then all remaining slaves | |
452 | on the packing list will be unmapped from the screen until | |
453 | the master window becomes large enough to hold them again. | |
454 | .SH "EXPANSION" | |
455 | .PP | |
456 | If a master window is so large that there will be extra space | |
457 | left over after all of its slaves have been packed, then the | |
458 | extra space is distributed uniformly among all of the slaves | |
459 | for which the \fB\-expand\fR option is set. | |
460 | Extra horizontal space is distributed among the expandable | |
461 | slaves whose \fB\-side\fR is \fBleft\fR or \fBright\fR, | |
462 | and extra vertical space is distributed among the expandable | |
463 | slaves whose \fB\-side\fR is \fBtop\fR or \fBbottom\fR. | |
464 | .SH "GEOMETRY PROPAGATION" | |
465 | .PP | |
466 | The packer normally computes how large a master must be to | |
467 | just exactly meet the needs of its slaves, and it sets the | |
468 | requested width and height of the master to these dimensions. | |
469 | This causes geometry information to propagate up through a | |
470 | window hierarchy to a top-level window so that the entire | |
471 | sub-tree sizes itself to fit the needs of the leaf windows. | |
472 | However, the \fBpack propagate\fR command may be used to | |
473 | turn off propagation for one or more masters. | |
474 | If propagation is disabled then the packer will not set | |
475 | the requested width and height of the packer. | |
476 | This may be useful if, for example, you wish for a master | |
477 | window to have a fixed size that you specify. | |
478 | .SH "RESTRICTIONS ON MASTER WINDOWS" | |
479 | .PP | |
480 | The master for each slave must either be the slave's parent | |
481 | (the default) or a descendant of the slave's parent. | |
482 | This restriction is necessary to guarantee that the | |
483 | slave can be placed over any part of its master that is | |
484 | visible without danger of the slave being clipped by its parent. | |
485 | .SH "PACKING ORDER" | |
486 | .PP | |
487 | If the master for a slave is not its parent then you must make sure | |
488 | that the slave is higher in the stacking order than the master. | |
489 | Otherwise the master will obscure the slave and it will appear as | |
490 | if the slave hasn't been packed correctly. | |
491 | The easiest way to make sure the slave is higher than the master is | |
492 | to create the master window first: the most recently created window | |
493 | will be highest in the stacking order. | |
494 | Or, you can use the \fBraise\fR and \fBlower\fR commands to change | |
495 | the stacking order of either the master or the slave. | |
496 | .SH EXAMPLE | |
497 | .CS | |
498 | # Make the widgets | |
499 | label .t \-text "This widget is at the top" \-bg red | |
500 | label .b \-text "This widget is at the bottom" \-bg green | |
501 | label .l \-text "Left\\nHand\\nSide" | |
502 | label .r \-text "Right\\nHand\\nSide" | |
503 | text .mid | |
504 | \.mid insert end "This layout is like Java's BorderLayout" | |
505 | # Lay them out | |
506 | \fBpack\fR .t \-side top \-fill x | |
507 | \fBpack\fR .b \-side bottom \-fill x | |
508 | \fBpack\fR .l \-side left \-fill y | |
509 | \fBpack\fR .r \-side right \-fill y | |
510 | \fBpack\fR .mid \-expand 1 \-fill both | |
511 | .CE | |
512 | ||
513 | .SH "SEE ALSO" | |
514 | grid(n), place(n) | |
515 | ||
516 | .SH KEYWORDS | |
517 | geometry manager, location, packer, parcel, propagation, size |