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