OSDN Git Service

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