Initial commit of OpenSPARC T2 architecture model.
[OpenSPARC-T2-SAM] / sam-t2 / devtools / v8plus / man / mann / pack.n
CommitLineData
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
219See 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
226Command-Line Name: \\fB\\$1\\fR
227Database Name: \\fB\\$2\\fR
228Database 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
250pack \- 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
257The \fBpack\fR command is used to communicate with the packer,
258a geometry manager that arranges the children of a parent by
259packing them in order around the edges of the parent.
260The \fBpack\fR command can have any of several forms, depending
261on the \fIoption\fR argument:
262.TP
263\fBpack \fIslave \fR?\fIslave ...\fR? ?\fIoptions\fR?
264If the first argument to \fBpack\fR is a window name (any value
265starting with ``.''), then the command is processed in the same
266way as \fBpack configure\fR.
267.TP
268\fBpack configure \fIslave \fR?\fIslave ...\fR? ?\fIoptions\fR?
269The arguments consist of the names of one or more slave windows
270followed by pairs of arguments that specify how
271to manage the slaves.
272See ``THE PACKER ALGORITHM'' below for details on how the options
273are used by the packer.
274The following options are supported:
275.RS
276.TP
277\fB\-after \fIother\fR
278\fIOther\fR must the name of another window.
279Use its master as the master for the slaves, and insert
280the 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
284or \fBsw\fR; it specifies where to position each slave in its
285parcel.
286Defaults to \fBcenter\fR.
287.TP
288\fB\-before \fIother\fR
289\fIOther\fR must the name of another window.
290Use its master as the master for the slaves, and insert
291the slaves just before \fIother\fR in the packing order.
292.TP
293\fB\-expand \fIboolean\fR
294Specifies whether the slaves should be expanded to consume
295extra space in their master.
296\fIBoolean\fR may have any proper boolean value, such as \fB1\fR
297or \fBno\fR.
298Defaults to 0.
299.TP
300\fB\-fill \fIstyle\fR
301If a slave's parcel is larger than its requested dimensions, this
302option may be used to stretch the slave.
303\fIStyle\fR must have one of the following values:
304.RS
305.TP
306\fBnone\fR
307Give the slave its requested dimensions plus any internal padding
308requested with \fB\-ipadx\fR or \fB\-ipady\fR. This is the default.
309.TP
310\fBx\fR
311Stretch the slave horizontally to fill the entire width of its
312parcel (except leave external padding as specified by \fB\-padx\fR).
313.TP
314\fBy\fR
315Stretch the slave vertically to fill the entire height of its
316parcel (except leave external padding as specified by \fB\-pady\fR).
317.TP
318\fBboth\fR
319Stretch the slave both horizontally and vertically.
320.RE
321.TP
322\fB\-in \fIother\fR
323Insert the slave(s) at the end of the packing order for the master
324window given by \fIother\fR.
325.TP
326\fB\-ipadx \fIamount\fR
327\fIAmount\fR specifies how much horizontal internal padding to
328leave on each side of the slave(s).
329\fIAmount\fR must be a valid screen distance, such as \fB2\fR or \fB.5c\fR.
330It defaults to 0.
331.TP
332\fB\-ipady \fIamount\fR
333\fIAmount\fR specifies how much vertical internal padding to
334leave 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
339leave on each side of the slave(s). \fIAmount\fR may be a list
340of 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
345leave on each side of the slave(s). \fIAmount\fR may be a list
346of two values to specify padding for top and bottom separately.
347\fIAmount\fR defaults to 0.
348.TP
349\fB\-side \fIside\fR
350Specifies which side of the master the slave(s) will be packed against.
351Must be \fBleft\fR, \fBright\fR, \fBtop\fR, or \fBbottom\fR.
352Defaults to \fBtop\fR.
353.LP
354If no \fB\-in\fR, \fB\-after\fR or \fB\-before\fR option is specified
355then each of the slaves will be inserted at the end of the packing list
356for its parent unless it is already managed by the packer (in which
357case it will be left where it is).
358If one of these options is specified then all the slaves will be
359inserted at the specified point.
360If any of the slaves are already managed by the geometry manager
361then any unspecified options for them retain their previous values rather
362than receiving default values.
363.RE
364.TP
365\fBpack forget \fIslave \fR?\fIslave ...\fR?
366Removes each of the \fIslave\fRs from the packing order for its
367master and unmaps their windows.
368The slaves will no longer be managed by the packer.
369.TP
370\fBpack info \fIslave\fR
371Returns a list whose elements are the current configuration state of
372the slave given by \fIslave\fR in the same option-value form that
373might be specified to \fBpack configure\fR.
374The 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?
378If \fIboolean\fR has a true boolean value such as \fB1\fR or \fBon\fR
379then propagation is enabled for \fImaster\fR, which must be a window
380name (see ``GEOMETRY PROPAGATION'' below).
381If \fIboolean\fR has a false boolean value then propagation is
382disabled for \fImaster\fR.
383In either of these cases an empty string is returned.
384If \fIboolean\fR is omitted then the command returns \fB0\fR or
385\fB1\fR to indicate whether propagation is currently enabled
386for \fImaster\fR.
387Propagation is enabled by default.
388.TP
389\fBpack slaves \fImaster\fR
390Returns a list of all of the slaves in the packing order for \fImaster\fR.
391The order of the slaves in the list is the same as their order in
392the packing order.
393If \fImaster\fR has no slaves then an empty string is returned.
394.SH "THE PACKER ALGORITHM"
395.PP
396For each master the packer maintains an ordered list of slaves
397called the \fIpacking list\fR.
398The \fB\-in\fR, \fB\-after\fR, and \fB\-before\fR configuration
399options are used to specify the master for each slave and the slave's
400position in the packing list.
401If none of these options is given for a slave then the slave
402is added to the end of the packing list for its parent.
403.PP
404The packer arranges the slaves for a master by scanning the
405packing list in order.
406At the time it processes each slave, a rectangular area within
407the master is still unallocated.
408This area is called the \fIcavity\fR; for the first slave it
409is the entire area of the master.
410.PP
411For each slave the packer carries out the following steps:
412.IP [1]
413The packer allocates a rectangular \fIparcel\fR for the slave
414along the side of the cavity given by the slave's \fB\-side\fR option.
415If the side is top or bottom then the width of the parcel is
416the width of the cavity and its height is the requested height
417of the slave plus the \fB\-ipady\fR and \fB\-pady\fR options.
418For the left or right side the height of the parcel is
419the height of the cavity and the width is the requested width
420of the slave plus the \fB\-ipadx\fR and \fB\-padx\fR options.
421The parcel may be enlarged further because of the \fB\-expand\fR
422option (see ``EXPANSION'' below)
423.IP [2]
424The packer chooses the dimensions of the slave.
425The width will normally be the slave's requested width plus
426twice its \fB\-ipadx\fR option and the height will normally be
427the slave's requested height plus twice its \fB\-ipady\fR
428option.
429However, if the \fB\-fill\fR option is \fBx\fR or \fBboth\fR
430then the width of the slave is expanded to fill the width of the parcel,
431minus twice the \fB\-padx\fR option.
432If the \fB\-fill\fR option is \fBy\fR or \fBboth\fR
433then the height of the slave is expanded to fill the width of the parcel,
434minus twice the \fB\-pady\fR option.
435.IP [3]
436The packer positions the slave over its parcel.
437If the slave is smaller than the parcel then the \fB\-anchor\fR
438option determines where in the parcel the slave will be placed.
439If \fB\-padx\fR or \fB\-pady\fR is non-zero, then the given
440amount of external padding will always be left between the
441slave and the edges of the parcel.
442.PP
443Once a given slave has been packed, the area of its parcel
444is subtracted from the cavity, leaving a smaller rectangular
445cavity for the next slave.
446If a slave doesn't use all of its parcel, the unused space
447in the parcel will not be used by subsequent slaves.
448If the cavity should become too small to meet the needs of
449a slave then the slave will be given whatever space is
450left in the cavity.
451If the cavity shrinks to zero size, then all remaining slaves
452on the packing list will be unmapped from the screen until
453the master window becomes large enough to hold them again.
454.SH "EXPANSION"
455.PP
456If a master window is so large that there will be extra space
457left over after all of its slaves have been packed, then the
458extra space is distributed uniformly among all of the slaves
459for which the \fB\-expand\fR option is set.
460Extra horizontal space is distributed among the expandable
461slaves whose \fB\-side\fR is \fBleft\fR or \fBright\fR,
462and extra vertical space is distributed among the expandable
463slaves whose \fB\-side\fR is \fBtop\fR or \fBbottom\fR.
464.SH "GEOMETRY PROPAGATION"
465.PP
466The packer normally computes how large a master must be to
467just exactly meet the needs of its slaves, and it sets the
468requested width and height of the master to these dimensions.
469This causes geometry information to propagate up through a
470window hierarchy to a top-level window so that the entire
471sub-tree sizes itself to fit the needs of the leaf windows.
472However, the \fBpack propagate\fR command may be used to
473turn off propagation for one or more masters.
474If propagation is disabled then the packer will not set
475the requested width and height of the packer.
476This may be useful if, for example, you wish for a master
477window to have a fixed size that you specify.
478.SH "RESTRICTIONS ON MASTER WINDOWS"
479.PP
480The master for each slave must either be the slave's parent
481(the default) or a descendant of the slave's parent.
482This restriction is necessary to guarantee that the
483slave can be placed over any part of its master that is
484visible without danger of the slave being clipped by its parent.
485.SH "PACKING ORDER"
486.PP
487If the master for a slave is not its parent then you must make sure
488that the slave is higher in the stacking order than the master.
489Otherwise the master will obscure the slave and it will appear as
490if the slave hasn't been packed correctly.
491The easiest way to make sure the slave is higher than the master is
492to create the master window first: the most recently created window
493will be highest in the stacking order.
494Or, you can use the \fBraise\fR and \fBlower\fR commands to change
495the stacking order of either the master or the slave.
496.SH EXAMPLE
497.CS
498# Make the widgets
499label .t \-text "This widget is at the top" \-bg red
500label .b \-text "This widget is at the bottom" \-bg green
501label .l \-text "Left\\nHand\\nSide"
502label .r \-text "Right\\nHand\\nSide"
503text .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"
514grid(n), place(n)
515
516.SH KEYWORDS
517geometry manager, location, packer, parcel, propagation, size