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