OSDN Git Service

* cgen-asm.in: Update copyright year.
[pf3gnuchains/pf3gnuchains3x.git] / tk / doc / place.n
1 '\"
2 '\" Copyright (c) 1992 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$
9 '\" 
10 .so man.macros
11 .TH place n "" Tk "Tk Built-In Commands"
12 .BS
13 '\" Note:  do not modify the .SH NAME line immediately below!
14 .SH NAME
15 place \- Geometry manager for fixed or rubber-sheet placement
16 .SH SYNOPSIS
17 \fBplace \fIwindow option value \fR?\fIoption value ...\fR?
18 .sp
19 \fBplace configure \fIwindow \fR?\fIoption\fR? ?\fIvalue option value ...\fR?
20 .sp
21 \fBplace forget \fIwindow\fR
22 .sp
23 \fBplace info \fIwindow\fR
24 .sp
25 \fBplace slaves \fIwindow\fR
26 .BE
27
28 .SH DESCRIPTION
29 .PP
30 The placer is a geometry manager for Tk.
31 It provides simple fixed placement of windows, where you specify
32 the exact size and location of one window, called the \fIslave\fR,
33 within another window, called the \fImaster\fR.
34 The placer also provides rubber-sheet placement, where you specify the
35 size and location of the slave in terms of the dimensions of
36 the master, so that the slave changes size and location
37 in response to changes in the size of the master.
38 Lastly, the placer allows you to mix these styles of placement so
39 that, for example, the slave has a fixed width and height but is
40 centered inside the master.
41 .PP
42 .TP
43 \fBplace \fIwindow option value \fR?\fIoption value ...\fR?
44 Arrange for the placer to manage the geometry of a slave whose
45 pathName is \fIwindow\fR.  The remaining arguments consist of one or
46 more \fIoption\-value\fR pairs that specify the way in which
47 \fIwindow\fR's geometry is managed.  \fIOption\fR may have any of the
48 values accepted by the \fBplace configure\fR command.
49 .TP
50 \fBplace configure \fIwindow \fR?\fIoption\fR? ?\fIvalue option value ...\fR?
51 Query or modify the geometry options of the slave given by
52 \fIwindow\fR.  If no \fIoption\fR is specified, this command returns a
53 list describing the available options (see \fBTk_ConfigureInfo\fR for
54 information on the format of this list).  If \fIoption\fR is specified
55 with no \fIvalue\fR, then the command returns a list describing the
56 one named option (this list will be identical to the corresponding
57 sublist of the value returned if no \fIoption\fR is specified).  If
58 one or more \fIoption\-value\fR pairs are specified, then the command
59 modifies the given option(s) to have the given value(s); in this case
60 the command returns an empty string.
61
62 The following \fIoption\-value\fR pairs are supported:
63 .RS
64 .TP
65 \fB\-anchor \fIwhere\fR
66 \fIWhere\fR specifies which point of \fIwindow\fR is to be positioned
67 at the (x,y) location selected by the \fB\-x\fR, \fB\-y\fR,
68 \fB\-relx\fR, and \fB\-rely\fR options.
69 The anchor point is in terms of the outer area of \fIwindow\fR
70 including its border, if any.
71 Thus if \fIwhere\fR is \fBse\fR then the lower-right corner of
72 \fIwindow\fR's border will appear at the given (x,y) location
73 in the master.
74 The anchor position defaults to \fBnw\fR.
75 .TP
76 \fB\-bordermode \fImode\fR
77 \fIMode\fR determines the degree to which borders within the
78 master are used in determining the placement of the slave.
79 The default and most common value is \fBinside\fR.
80 In this case the placer considers the area of the master to
81 be the innermost area of the master, inside any border:
82 an option of \fB\-x 0\fR corresponds to an x-coordinate just
83 inside the border and an option of \fB\-relwidth 1.0\fR
84 means \fIwindow\fR will fill the area inside the master's
85 border.
86
87 If \fImode\fR is \fBoutside\fR then the placer considers
88 the area of the master to include its border;
89 this mode is typically used when placing \fIwindow\fR
90 outside its master, as with the options \fB\-x 0 \-y 0 \-anchor ne\fR.
91 Lastly, \fImode\fR may be specified as \fBignore\fR, in which
92 case borders are ignored:  the area of the master is considered
93 to be its official X area, which includes any internal border but
94 no external border.  A bordermode of \fBignore\fR is probably
95 not very useful.
96 .TP
97 \fB\-height \fIsize\fR
98 \fISize\fR specifies the height for \fIwindow\fR in screen units
99 (i.e. any of the forms accepted by \fBTk_GetPixels\fR).
100 The height will be the outer dimension of \fIwindow\fR including its
101 border, if any.
102 If \fIsize\fR is an empty string, or if no \fB\-height\fR or
103 \fB\-relheight\fR option is specified, then the height requested
104 internally by the window will be used.
105 .TP
106 \fB\-in \fImaster\fR
107 \fIMaster\fR specifes the path name of the window relative
108 to which \fIwindow\fR is to be placed.
109 \fIMaster\fR must either be \fIwindow\fR's parent or a descendant
110 of \fIwindow\fR's parent.
111 In addition, \fImaster\fR and \fIwindow\fR must both be descendants
112 of the same top-level window.
113 These restrictions are necessary to guarantee
114 that \fIwindow\fR is visible whenever \fImaster\fR is visible.
115 If this option isn't specified then the master defaults to
116 \fIwindow\fR's parent.
117 .TP
118 \fB\-relheight \fIsize\fR
119 \fISize\fR specifies the height for \fIwindow\fR.
120 In this case the height is specified as a floating-point number
121 relative to the height of the master: 0.5 means \fIwindow\fR will
122 be half as high as the master, 1.0 means \fIwindow\fR will have
123 the same height as the master, and so on.
124 If both \fB\-height\fR and \fB\-relheight\fR are specified for a slave,
125 their values are summed.  For example, \fB\-relheight 1.0 \-height \-2\fR
126 makes the slave 2 pixels shorter than the master.
127 .TP
128 \fB\-relwidth \fIsize\fR
129 \fISize\fR specifies the width for \fIwindow\fR.
130 In this case the width is specified as a floating-point number
131 relative to the width of the master: 0.5 means \fIwindow\fR will
132 be half as wide as the master, 1.0 means \fIwindow\fR will have
133 the same width as the master, and so on.
134 If both \fB\-width\fR and \fB\-relwidth\fR are specified for a slave,
135 their values are summed.  For example, \fB\-relwidth 1.0 \-width 5\fR
136 makes the slave 5 pixels wider than the master.
137 .TP
138 \fB\-relx \fIlocation\fR
139 \fILocation\fR specifies the x-coordinate within the master window
140 of the anchor point for \fIwindow\fR.
141 In this case the location is specified in a relative fashion
142 as a floating-point number:  0.0 corresponds to the left edge
143 of the master and 1.0 corresponds to the right edge of the master.
144 \fILocation\fR need not be in the range 0.0\-1.0.
145 If both \fB\-x\fR and \fB\-relx\fR are specified for a slave
146 then their values are summed.  For example, \fB\-relx 0.5 \-x \-2\fR
147 positions the left edge of the slave 2 pixels to the left of the
148 center of its master.
149 .TP
150 \fB\-rely \fIlocation\fR
151 \fILocation\fR specifies the y-coordinate within the master window
152 of the anchor point for \fIwindow\fR.
153 In this case the value is specified in a relative fashion
154 as a floating-point number:  0.0 corresponds to the top edge
155 of the master and 1.0 corresponds to the bottom edge of the master.
156 \fILocation\fR need not be in the range 0.0\-1.0.
157 If both \fB\-y\fR and \fB\-rely\fR are specified for a slave
158 then their values are summed.  For example, \fB\-rely 0.5 \-x 3\fR
159 positions the top edge of the slave 3 pixels below the
160 center of its master.
161 .TP
162 \fB\-width \fIsize\fR
163 \fISize\fR specifies the width for \fIwindow\fR in screen units
164 (i.e. any of the forms accepted by \fBTk_GetPixels\fR).
165 The width will be the outer width of \fIwindow\fR including its
166 border, if any.
167 If \fIsize\fR is an empty string, or if no \fB\-width\fR
168 or \fB\-relwidth\fR option is specified, then the width requested
169 internally by the window will be used.
170 .TP
171 \fB\-x \fIlocation\fR
172 \fILocation\fR specifies the x-coordinate within the master window
173 of the anchor point for \fIwindow\fR.
174 The location is specified in screen units (i.e. any of the forms
175 accepted by \fBTk_GetPixels\fR) and need not lie within the bounds
176 of the master window.
177 .TP
178 \fB\-y \fIlocation\fR
179 \fILocation\fR specifies the y-coordinate within the master window
180 of the anchor point for \fIwindow\fR.
181 The location is specified in screen units (i.e. any of the forms
182 accepted by \fBTk_GetPixels\fR) and need not lie within the bounds
183 of the master window.
184 .PP
185 If the same value is specified separately with
186 two different options, such as \fB\-x\fR and \fB\-relx\fR, then
187 the most recent option is used and the older one is ignored.
188 .RE
189 .TP
190 \fBplace forget \fIwindow\fR
191 Causes the placer to stop managing the geometry of \fIwindow\fR.  As a
192 side effect of this command \fIwindow\fR will be unmapped so that it
193 doesn't appear on the screen.  If \fIwindow\fR isn't currently managed
194 by the placer then the command has no effect.  This command returns an
195 empty string.
196 .TP
197 \fBplace info \fIwindow\fR
198 Returns a list giving the current configuration of \fIwindow\fR.
199 The list consists of \fIoption\-value\fR pairs in exactly the
200 same form as might be specified to the \fBplace configure\fR
201 command.
202 .TP
203 \fBplace slaves \fIwindow\fR
204 Returns a list of all the slave windows for which \fIwindow\fR is the master.
205 If there are no slaves for \fIwindow\fR then an empty string is returned.
206
207 If the configuration of a window has been retrieved with
208 \fBplace info\fR, that configuration can be restored later by
209 first using \fBplace forget\fR to erase any existing information
210 for the window and then invoking \fBplace configure\fR with
211 the saved information.
212
213 .SH "FINE POINTS"
214 .PP
215 It is not necessary for the master window to be the parent
216 of the slave window.
217 This feature is useful in at least two situations.
218 First, for complex window layouts it means you can create a
219 hierarchy of subwindows whose only purpose
220 is to assist in the layout of the parent.
221 The ``real children'' of the parent (i.e. the windows that
222 are significant for the application's user interface) can be
223 children of the parent yet be placed inside the windows
224 of the geometry-management hierarchy.
225 This means that the path names of the ``real children''
226 don't reflect the geometry-management hierarchy and users
227 can specify options for the real children
228 without being aware of the structure of the geometry-management
229 hierarchy.
230 .PP
231 A second reason for having a master different than the slave's
232 parent is to tie two siblings together.
233 For example, the placer can be used to force a window always to
234 be positioned centered just below one of its
235 siblings by specifying the configuration
236 .CS
237 \fB\-in \fIsibling\fB \-relx 0.5 \-rely 1.0 \-anchor n \-bordermode outside\fR
238 .CE
239 Whenever the sibling is repositioned in the future, the slave
240 will be repositioned as well.
241 .PP
242 Unlike many other geometry managers (such as the packer)
243 the placer does not make any attempt to manipulate the geometry of
244 the master windows or the parents of slave windows (i.e. it doesn't
245 set their requested sizes).
246 To control the sizes of these windows, make them windows like
247 frames and canvases that provide configuration options for this purpose.
248
249 .SH KEYWORDS
250 geometry manager, height, location, master, place, rubber sheet, slave, width