]> www.wagner.pp.ru Git - oss/ck.git/blob - doc/grid.n
Ck console graphics toolkit
[oss/ck.git] / doc / grid.n
1 '\"
2 '\" Copyright (c) 1996 Sun Microsystems, Inc.
3 '\" Copyright (c) 1996-1999 Christian Werner
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 '\" 
9 .so man.macros
10 .TH grid 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 grid \- Geometry manager that arranges widgets in a grid
15 .SH SYNOPSIS
16 \fBgrid \fIoption arg \fR?\fIarg ...\fR?
17 .BE
18
19 .SH DESCRIPTION
20 .PP
21 The \fBgrid\fR command is used to communicate with the grid
22 geometry manager that arranges widgets in rows and columns inside
23 of another window, called the geometry master (or master window).
24 The \fBgrid\fR command can have any of several forms, depending
25 on the \fIoption\fR argument:
26 .TP
27 \fBgrid \fIslave \fR?\fIslave ...\fR? ?\fIoptions\fR?
28 If the first argument to \fBgrid\fR is a window name (any value
29 starting with ``.''), then the command is processed in the same
30 way as \fBgrid configure\fR.
31 .TP
32 \fBgrid bbox \fImaster column row\fR
33 The bounding box (in rows or columns) is returned for the space occupied by
34 the grid position indicated by \fIcolumn\fP and \fIrow\fP.  The
35 return value consists of 4 integers.  The first two are the column/row offset
36 from the master window (x then y) of the top-left corner of the grid
37 cell, and the second two are the width and height of the cell.
38 .TP
39 \fBgrid columnconfigure \fImaster index \fR?\fI\-option value...\fR?
40 Query or set the column properties of the \fIindex\fP column of the 
41 geometry master, \fImaster\fP.
42 The valid options are \fB\-minsize\fP and \fB\-weight\fP.
43 The \fB\-minsize\fP option sets the minimum column size,
44 and the \fB\-weight\fP option (a floating point value)
45 sets the relative weight for apportioning
46 any extra spaces among
47 columns.  If no value is specified, the current value is returned.
48 .TP
49 \fBgrid configure \fIslave \fR?\fIslave ...\fR? ?\fIoptions\fR?
50 The arguments consist of the names of one or more slave windows
51 followed by pairs of arguments that specify how
52 to manage the slaves.
53 The characters \fB\-\fP,  \fBx\fP and \fB^\fP, 
54 can be specified instead of a window name to alter the default
55 location of a \fIslave\fP, as described in the ``RELATIVE PLACEMENT''
56 section, below.
57 The following options are supported:
58 .RS
59 .TP
60 \fB\-column \fIn\fR
61 Insert the slave so that it occupies the \fIn\fPth column in the grid.
62 Column numbers start with 0.  If this option is not supplied, then the
63 slave is arranged just to the right of previous slave specified on this
64 call to \fIgrid\fP, or column "0" if it is the first slave.  For each
65 \fBx\fP that immediately precedes the \fIslave\fP, the column position
66 is incremented by one.  Thus the \fBx\fP represents a blank column
67 for this row in the grid.
68 .TP
69 \fB\-columnspan \fIn\fR
70 Insert the slave so that it occupies \fIn\fP columns in the grid.
71 The default is one column, unless the window name is followed by a
72 \fB\-\fP, in which case the columnspan is incremented once for each immediately
73 following \fB\-\fP.
74 .TP
75 \fB\-ipadx \fIamount\fR
76 The \fIamount\fR specifies how much horizontal internal padding to
77 leave on each side of the slave(s).
78 \fIAmount\fR is specified in terminal columns. It defaults to 0.
79 .TP
80 \fB\-ipady \fIamount\fR
81 The \fIamount\fR specifies how much vertical internal padding to
82 leave on on the top and bottom of the slave(s).
83 \fIAmount\fR is specified in terminal rows. It defaults to 0.
84 .TP
85 \fB\-padx \fIamount\fR
86 The \fIamount\fR specifies how much horizontal external padding to
87 leave on each side of the slave(s). The \fIamount\fR defaults to 0.
88 .TP
89 \fB\-pady \fIamount\fR
90 The \fIamount\fR specifies how much vertical external padding to
91 leave on the top and bottom of the slave(s). The \fIamount\fR defaults to 0.
92 .TP
93 \fB\-row \fIn\fR
94 Insert the slave so that it occupies the \fIn\fPth row in the grid.
95 Row numbers start with 0.  If this option is not supplied, then the
96 slave is arranged on the same row as the previous slave specified on this
97 call to \fBgrid\fP, or the first unoccupied row if this is the first slave.
98 .TP
99 \fB\-rowspan \fIn\fR
100 Insert the slave so that it occupies \fIn\fP rows in the grid.
101 The default is one row.  If the next \fBgrid\fP command contains
102 \fB^\fP characters instead of \fIslaves\fP that line up with the columns
103 of this \fIslave\fP, then the \fBrowspan\fP of this \fIslave\fP is
104 extended by one.
105 .TP
106 \fB\-sticky \fIstyle\fR
107 If a slave's parcel is larger than its requested dimensions, this
108 option may be used to position (or stretch) the slave within its cavity.
109 \fIStyle\fR  is a string that contains zero or more of the characters
110 \fBn\fP, \fBs\fP, \fBe\fP or \fBw\fP.
111 The string can optionally contains spaces or
112 commas, but they are ignored.  Each letter refers to a side (north, south,
113 east, or west) that the slave will "stick" to.  If both \fBn\fP and \fBs\fP (or
114 \fBe\fP and \fBw\fP) are specified, the slave will be stretched to fill the entire
115 height (or width) of its cavity.  The \fBsticky\fP option subsumes the
116 combination of \fB\-anchor\fP and \fB\-fill\fP that is used by \fBpack\fP.
117 The default is \fB{}\fP, which causes the slave to be centered in its cavity,
118 at its requested size.
119 .LP
120 If any of the slaves are already managed by the geometry manager
121 then any unspecified options for them retain their previous values rather
122 than receiving default values.
123 .RE
124 .TP
125 \fBgrid forget \fIslave \fR?\fIslave ...\fR?
126 Removes each of the \fIslave\fRs from grid for its
127 master and unmaps their windows.
128 The slaves will no longer be managed by the grid geometry manager.
129 .TP
130 \fBgrid info \fIslave\fR
131 Returns a list whose elements are the current configuration state of
132 the slave given by \fIslave\fR in the same option-value form that
133 might be specified to \fBgrid configure\fR.
134 .TP
135 \fBgrid location \fImaster x y\fR
136 Given \fIx\fP and \fIy\fP values in terminal columns/rows relative to the
137 master window, the column and row number at that \fIx\fP and \fIy\fP
138 location is returned.
139 For locations that are above or to the left of the grid, \fB-1\fP is returned.
140 .TP
141 \fBgrid propagate \fImaster\fR ?\fIboolean\fR?
142 If \fIboolean\fR has a true boolean value such as \fB1\fR or \fBon\fR
143 then propagation is enabled for \fImaster\fR, which must be a window
144 name (see ``GEOMETRY PROPAGATION'' below).
145 If \fIboolean\fR has a false boolean value then propagation is
146 disabled for \fImaster\fR.
147 In either of these cases an empty string is returned.
148 If \fIboolean\fR is omitted then the command returns \fB0\fR or
149 \fB1\fR to indicate whether propagation is currently enabled
150 for \fImaster\fR.
151 Propagation is enabled by default.
152 .TP
153 \fBgrid \fRrowconfigure \fImaster index \fR?\fI\-option value...\fR?
154 Query or set the row properties of the \fIindex\fP row of the 
155 geometry master, \fImaster\fP.
156 The valid options are \fB\-minsize\fP and \fB\-weight\fP.
157 \fBMinsize\fP sets the minimum row size, in screen units, and \fBweight\fP
158 sets the relative weight for apportioning any extra spaces among
159 rows.  If no value is specified, the current value is returned.
160 .TP
161 \fBgrid size \fImaster\fR
162 Returns the size of the grid (in columns then rows) for \fImaster\fP.
163 The size is determined either by the \fIslave\fP occupying the largest
164 row or column, or the largest column or row with a \fBminsize\fP or
165 \fBweight\fP.
166 .TP
167 \fBgrid slaves \fImaster\fR ?\fI\-option value\fR?
168 If no options are supplied, a list of all of the slaves in \fImaster\fR
169 are returned. \fIOption\fP can be either \fB\-row\fP or \fB\-column\fP which
170 causes only the slaves in the row (or column) specified by \fIvalue\fP
171 to be returned.
172 .SH "RELATIVE PLACEMENT"
173 .PP
174 The \fBgrid\fP command contains a limited set of capabilities that
175 permit layouts to be created without specifying the row and column 
176 information for each slave.  This permits slaves to be rearranged, 
177 added, or removed without the need to explicitly specify row and
178 column information.
179 When no column or row information is specified for a \fIslave\fP, 
180 default values are chosen for
181 \fBcolumn\fP, \fBrow\fP, \fPcolumnspan\fP and \fProwspan\fP
182 at the time the \fIslave\fP is managed. The values are chosen
183 based upon the current layout of the grid, the position of the \fIslave\fP
184 relative to other \fIslave\fPs in the same grid command, and the presence
185 of the characters \fB\-\fP, \fB^\fP, and \fB^\fP in \fBgrid\fP
186 command where \fIslave\fP names are normally expected.
187 .RS
188 .TP
189 \fB\-\fP
190 This increases the columnspan of the \fIslave\fP to the left.  Several
191 \fB\-\fP's in a row will successively increase the columnspan. S \fB\-\fP
192 may not follow a \fB^\fP or a \fBx\fP.
193 .TP
194 \fBx\fP
195 This leaves an empty column between the \fIslave\fP on the left and
196 the \fIslave\fP on the right.
197 .TP
198 \fB^\fP
199 This extends the \fBrowspan\fP of the \fIslave\fP above the \fB^\fP's
200 in the grid.  The number of \fB^\fP's in a row must match the number of
201 columns spanned by the \fIslave\fP above it.
202 .RE
203 .SH "GEOMETRY PROPAGATION"
204 .PP
205 Grid normally computes how large a master must be to
206 just exactly meet the needs of its slaves, and it sets the
207 requested width and height of the master to these dimensions.
208 This causes geometry information to propagate up through a
209 window hierarchy to a top-level window so that the entire
210 sub-tree sizes itself to fit the needs of the leaf windows.
211 However, the \fBgrid propagate\fR command may be used to
212 turn off propagation for one or more masters.
213 If propagation is disabled then grid will not set
214 the requested width and height of the master window.
215 This may be useful if, for example, you wish for a master
216 window to have a fixed size that you specify.
217
218 .SH "RESTRICTIONS ON MASTER WINDOWS"
219 .PP
220 The master for each slave must be the slave's parent.
221 This restriction is necessary to guarantee that the
222 slave can be placed over any part of its master that is
223 visible without danger of the slave being clipped by its parent.
224
225 .SH CREDITS
226 .PP
227 The \fBgrid\fP command is based on the \fIGridBag\fP geometry manager
228 written by D. Stein.
229
230 .SH KEYWORDS
231 geometry manager, location, grid, parcel, propagation, size, pack