author | Claus Gittinger <cg@exept.de> |
Wed, 13 Mar 2019 10:30:41 +0100 | |
changeset 6035 | 1f975ac0771e |
parent 5946 | 454fc5b536b1 |
permissions | -rw-r--r-- |
5946 | 1 |
"{ Encoding: utf8 }" |
2 |
||
790 | 3 |
" |
4 |
COPYRIGHT (c) 1998 by Andreas Vogel / eXept Software AG |
|
5 |
All Rights Reserved |
|
6 |
||
7 |
This software is furnished under a license and may be used |
|
8 |
only in accordance with the terms of that license and with the |
|
9 |
inclusion of the above copyright notice. This software may not |
|
10 |
be provided or otherwise made available to, or used by, any |
|
11 |
other person. No title to or ownership of the software is |
|
12 |
hereby transferred. |
|
13 |
" |
|
1877
3b415fa4710f
only access originChanged, extentChanged and cornerChanged
Claus Gittinger <cg@exept.de>
parents:
1519
diff
changeset
|
14 |
"{ Package: 'stx:libwidg2' }" |
3b415fa4710f
only access originChanged, extentChanged and cornerChanged
Claus Gittinger <cg@exept.de>
parents:
1519
diff
changeset
|
15 |
|
5303 | 16 |
"{ NameSpace: Smalltalk }" |
17 |
||
721 | 18 |
PanelView subclass:#GridBagLayoutView |
19 |
instanceVariableNames:'columnWidths rowHeights columnWeights rowWeights layoutInfo' |
|
20 |
classVariableNames:'' |
|
21 |
poolDictionaries:'' |
|
22 |
category:'Views-Layout' |
|
23 |
! |
|
24 |
||
25 |
!GridBagLayoutView class methodsFor:'documentation'! |
|
26 |
||
790 | 27 |
copyright |
28 |
" |
|
29 |
COPYRIGHT (c) 1998 by Andreas Vogel / eXept Software AG |
|
30 |
All Rights Reserved |
|
31 |
||
32 |
This software is furnished under a license and may be used |
|
33 |
only in accordance with the terms of that license and with the |
|
34 |
inclusion of the above copyright notice. This software may not |
|
35 |
be provided or otherwise made available to, or used by, any |
|
36 |
other person. No title to or ownership of the software is |
|
37 |
hereby transferred. |
|
38 |
" |
|
39 |
||
40 |
||
41 |
||
42 |
! |
|
43 |
||
721 | 44 |
documentation |
45 |
" |
|
46 |
GridBagLayout is a flexible layout manager that aligns components vertically and horizontally, |
|
47 |
without requiring that the components be the same size. Each GridBagLayout uses a dynamic rectangular |
|
48 |
grid of cells, with each component occupying one or more cells (called its display area). |
|
49 |
Each component managed by a GridBagLayout is associated with a GridBagConstraints instance that |
|
50 |
specifies how the component is laid out within its display area. How a GridBagLayout places a set of |
|
51 |
components depends on each component's GridBagConstraints and minimum size, as well as the preferred |
|
52 |
size of the components' container. |
|
53 |
||
54 |
To use a GridBagLayout effectively, you must customize one or more of its components' GridBagConstraints. |
|
55 |
You customize a GridBagConstraints object by setting one or more of its instance variables: |
|
56 |
||
57 |
gridX |
|
58 |
gridY |
|
59 |
Specifies the cell at the upper left of the component's display area, where the |
|
60 |
upper-left-most cell has address gridX=0, gridY=0. Use #RELATIVE (the default value) |
|
61 |
to specify that the component be just placed just to the right of (for gridX) |
|
62 |
or just below (for gridY) the component that was added to the container just before |
|
63 |
this component was added. |
|
64 |
||
65 |
gridWidth |
|
66 |
gridHeight |
|
67 |
Specifies the number of cells in a row (for gridWidth) or column (for gridHeight) |
|
68 |
in the component's display area. The default value is 1. Use #REMAINDER to specify |
|
69 |
that the component be the last one in its row (for gridWidth) or column (for gridHeight). |
|
70 |
Use #RELATIVE to specify that the component be the next to last one in its row |
|
71 |
(for gridWidth) or column (for gridHeight). |
|
72 |
||
73 |
fill |
|
74 |
Used when the component's display area is larger than the component's requested size |
|
75 |
to determine whether (and how) to resize the component. |
|
76 |
Valid values are |
|
77 |
#NONE |
|
78 |
(the default), |
|
79 |
#HORIZONTAL |
|
80 |
(make the component wide enough to fill its display area |
|
81 |
horizontally, but don't change its height), |
|
82 |
#VERTICAL |
|
83 |
(make the component tall enough to fill its display area |
|
84 |
vertically, but don't change its width), and |
|
85 |
#BOTH |
|
86 |
(make the component fill its display area entirely). |
|
87 |
||
88 |
ipadX |
|
89 |
ipadY |
|
90 |
Specifies the internal padding: how much to add to the minimum size of the component. |
|
91 |
The width of the component will be at least its minimum width plus ipadX*2 pixels |
|
92 |
(since the padding applies to both sides of the component). Similarly, the height of |
|
93 |
the component will be at least the minimum height plus ipadY*2 pixels. |
|
94 |
||
95 |
insets |
|
96 |
Specifies the external padding of the component -- the minimum amount of space between |
|
97 |
the component and the edges of its display area. |
|
98 |
||
99 |
anchor |
|
100 |
Used when the component is smaller than its display area to determine where (within the area) |
|
101 |
to place the component. |
|
102 |
Valid values are |
|
103 |
#CENTER (the default), |
|
104 |
#NORTH, |
|
105 |
#NORTHEAST, |
|
106 |
#EAST, |
|
107 |
#SOUTHEAST, |
|
108 |
#SOUTH, |
|
109 |
#SOUTHWEST, |
|
110 |
#WEST, |
|
111 |
#NORTHWEST. |
|
112 |
||
113 |
weightX |
|
114 |
weightY |
|
115 |
Used to determine how to distribute space; this is important for specifying resizing |
|
116 |
behavior. Unless you specify a weight for at least one component in a row (weightX) |
|
117 |
and column (weightY), all the components clump together in the center of their container. |
|
118 |
This is because when the weight is zero (the default), the GridBagLayout puts any extra |
|
119 |
space between its grid of cells and the edges of the container. |
|
120 |
||
121 |
||
122 |
[see also:] |
|
123 |
GridBagConstraints |
|
124 |
GridBagLayoutInfo |
|
125 |
Insets |
|
126 |
||
127 |
[author:] |
|
128 |
Andreas Vogel |
|
129 |
" |
|
130 |
! |
|
131 |
||
132 |
examples |
|
133 |
" |
|
134 |
This example is taken from the java source and should produce the same layout. Check the file |
|
135 |
Grid*.gif in the java distribution. |
|
136 |
||
137 |
[exBegin] |
|
138 |
| v p c | |
|
139 |
c := #( |
|
140 |
#( fill: #BOTH weightX: 1.0 ) |
|
141 |
#( fill: #BOTH weightX: 1.0 ) |
|
142 |
#( fill: #BOTH weightX: 1.0 ) |
|
143 |
#( fill: #BOTH weightX: 1.0 gridWidth: #REMAINDER ) |
|
144 |
#( fill: #BOTH gridWidth: #REMAINDER ) |
|
145 |
#( fill: #BOTH gridWidth: #RELATIVE ) |
|
146 |
#( fill: #BOTH gridWidth: #REMAINDER ) |
|
147 |
#( fill: #BOTH weightY: 1.0 gridHeight: 2 ) |
|
148 |
#( fill: #BOTH gridWidth: #REMAINDER ) |
|
149 |
#( fill: #BOTH gridWidth: #REMAINDER ) |
|
150 |
). |
|
151 |
v := StandardSystemView new. v label:'GridBagLayoutView: Example 1'. |
|
152 |
p := GridBagLayoutView in:v. p origin:(0.0 @ 0.0) corner:(1.0 @ 1.0). |
|
153 |
1 to: c size do:[ :i | | b | |
|
154 |
b := Button label:('Button ',(i displayString)) in:p. |
|
155 |
b objectAttributeAt:#GridBagConstraints put:((#(GridBagConstraints) , (c at:i)) decodeAsLiteralArray). |
|
156 |
]. |
|
157 |
v extent:(p preferredExtent). v open. |
|
158 |
[exEnd] |
|
159 |
||
160 |
||
161 |
[exBegin] |
|
162 |
| v p c | |
|
163 |
c := #( |
|
164 |
#( insets: #(Insets 2 2 2 2) fill: #BOTH weightX: 1.0 ) |
|
165 |
#( insets: #(Insets 2 2 2 2) fill: #BOTH weightX: 1.0 ) |
|
166 |
#( insets: #(Insets 2 2 2 2) fill: #BOTH weightX: 1.0 ) |
|
167 |
#( insets: #(Insets 2 2 2 2) fill: #BOTH weightX: 1.0 gridWidth: #REMAINDER ) |
|
168 |
#( insets: #(Insets 2 2 2 2) fill: #BOTH gridWidth: #REMAINDER ) |
|
169 |
#( insets: #(Insets 2 2 2 2) fill: #BOTH gridWidth: #RELATIVE ) |
|
170 |
#( insets: #(Insets 2 2 2 2) fill: #BOTH gridWidth: #REMAINDER ) |
|
171 |
#( insets: #(Insets 2 2 2 2) fill: #BOTH weightY: 1.0 gridHeight: 2 ) |
|
172 |
#( insets: #(Insets 2 2 2 2) fill: #BOTH gridWidth: #REMAINDER ) |
|
173 |
#( insets: #(Insets 2 2 2 2) fill: #BOTH gridWidth: #REMAINDER ) |
|
174 |
). |
|
175 |
v := StandardSystemView new. v label:'GridBagLayoutView: Example 2'. |
|
176 |
p := GridBagLayoutView in:v. p origin:(0.0 @ 0.0) corner:(1.0 @ 1.0). |
|
177 |
1 to: c size do:[ :i | | b | |
|
178 |
b := Button label:('Button ',(i displayString)) in:p. |
|
179 |
b objectAttributeAt:#GridBagConstraints put:((#(GridBagConstraints) , (c at:i)) decodeAsLiteralArray). |
|
180 |
]. |
|
181 |
v extent:(p preferredExtent). v open. |
|
182 |
[exEnd] |
|
183 |
||
184 |
||
185 |
||
186 |
" |
|
187 |
! ! |
|
188 |
||
189 |
!GridBagLayoutView class methodsFor:'instance creation'! |
|
190 |
||
191 |
new |
|
192 |
"Create a new instance of my class and do explizit initialization of it." |
|
193 |
||
2840 | 194 |
^ self basicNew initialize |
721 | 195 |
|
196 |
"Created: / 19.1.1998 / 13:53:11 / av" |
|
197 |
"Modified: / 1.2.1998 / 13:02:59 / av" |
|
198 |
! ! |
|
199 |
||
2840 | 200 |
!GridBagLayoutView methodsFor:'initialization'! |
201 |
||
202 |
initialize |
|
203 |
"Initialize the instance. Mainly set our instance variables to required values." |
|
204 |
||
205 |
super initialize. |
|
206 |
||
207 |
columnWidths := IdentityDictionaryWithDefault newWithDefaultValue:0. |
|
208 |
rowHeights := IdentityDictionaryWithDefault newWithDefaultValue:0. |
|
209 |
||
210 |
columnWeights := IdentityDictionaryWithDefault newWithDefaultValue:0.0. |
|
211 |
rowWeights := IdentityDictionaryWithDefault newWithDefaultValue:0.0. |
|
212 |
||
213 |
layoutInfo := nil. |
|
214 |
||
215 |
"Created: / 19.1.1998 / 13:53:59 / av" |
|
216 |
"Modified: / 1.2.1998 / 12:57:05 / av" |
|
217 |
! ! |
|
218 |
||
721 | 219 |
!GridBagLayoutView methodsFor:'layout'! |
220 |
||
221 |
setChildPositions |
|
5634 | 222 |
"(re)compute position of every child whenever children are added or my size has changed" |
721 | 223 |
|
224 |
self arrangeGrid. |
|
225 |
||
5634 | 226 |
"Modified: / 01-02-1998 / 12:52:22 / av" |
227 |
"Modified (comment): / 09-11-2017 / 10:43:16 / mawalch" |
|
721 | 228 |
! ! |
229 |
||
230 |
!GridBagLayoutView methodsFor:'private'! |
|
231 |
||
232 |
adjustForGravity:c in:r |
|
233 |
||
5303 | 234 |
|insets fill anchor diffx diffy add | |
721 | 235 |
|
5303 | 236 |
insets := c insets. |
237 |
fill := c fill. |
|
238 |
anchor := c anchor. |
|
239 |
||
240 |
r setLeft: ((r left) + (insets left)). |
|
241 |
r width: ((r width) - ((insets left) + (insets right))). |
|
242 |
r setTop: ((r top) + (insets top)). |
|
243 |
r height: ((r height) - ((insets top) + (insets bottom))). |
|
721 | 244 |
|
245 |
diffx := 0. |
|
5303 | 246 |
(fill ~~ #HORIZONTAL and:[(fill ~~ #BOTH) and:[(r width) > (add := (c minWidth) + (c ipadX))]]) ifTrue:[ |
247 |
diffx := (r width) - add. |
|
248 |
r width:add. |
|
721 | 249 |
]. |
250 |
||
251 |
diffy := 0. |
|
5303 | 252 |
(fill ~~ #VERTICAL and:[(fill ~~ #BOTH) and:[(r height) > (add := (c minHeight) + (c ipadY))]]) ifTrue:[ |
253 |
diffy := (r height) - add. |
|
254 |
r height:add. |
|
721 | 255 |
]. |
256 |
||
5303 | 257 |
(anchor == #CENTER) ifTrue:[ |
258 |
r setLeft:((r left) + (diffx / 2)). |
|
259 |
r setTop:((r top) + (diffy / 2)). |
|
721 | 260 |
]. |
5303 | 261 |
(anchor == #NORTH) ifTrue:[ |
262 |
r setLeft:((r left) + (diffx / 2)). |
|
721 | 263 |
]. |
5303 | 264 |
(anchor == #NORTHEAST) ifTrue:[ |
265 |
r setLeft:((r left) + diffx). |
|
721 | 266 |
]. |
5303 | 267 |
(anchor == #EAST) ifTrue:[ |
268 |
r setLeft:((r left) + diffx). |
|
269 |
r setTop:((r top) + (diffy / 2)). |
|
721 | 270 |
]. |
5303 | 271 |
(anchor == #SOUTHEAST) ifTrue:[ |
272 |
r setLeft:((r left) + diffx). |
|
273 |
r setTop:((r top) + diffy). |
|
721 | 274 |
]. |
5303 | 275 |
(anchor == #SOUTH) ifTrue:[ |
276 |
r setLeft:((r left) + (diffx / 2)). |
|
277 |
r setTop:((r top) + diffy). |
|
721 | 278 |
]. |
5303 | 279 |
(anchor == #SOUTHWEST) ifTrue:[ |
280 |
r setTop:((r top) + diffy). |
|
721 | 281 |
]. |
5303 | 282 |
(anchor == #WEST) ifTrue:[ |
283 |
r setTop:((r top) + (diffy / 2)). |
|
721 | 284 |
]. |
5303 | 285 |
(anchor == #NORTHWEST) ifTrue:[ |
721 | 286 |
]. |
287 |
||
288 |
r setLeft: ((r left) asInteger). |
|
289 |
r setTop: ((r top) asInteger). |
|
290 |
r width: ((r width) asInteger). |
|
291 |
r height: ((r height) asInteger). |
|
292 |
||
293 |
^ r |
|
294 |
||
295 |
"Modified: / 22.1.1998 / 09:50:01 / av" |
|
296 |
! |
|
297 |
||
298 |
arrangeGrid |
|
299 |
" Lay out the grid." |
|
300 |
||
301 |
| insets subViews info ext d r c diffw diffh weight | |
|
302 |
||
303 |
insets := Insets new. |
|
304 |
||
305 |
"/ If the parent has no slaves anymore, then don't do anything |
|
306 |
"/ at all: just leave the parent's size as-is. |
|
307 |
(((subViews := self subViews) size) == 0) ifTrue:[^ self]. |
|
308 |
||
3245 | 309 |
"/ self extentChangedFlag ifTrue:[ |
310 |
"/ ext := self computeExtent. |
|
311 |
"/ width := ext x. |
|
312 |
"/ height := ext y. |
|
313 |
"/ ]. |
|
721 | 314 |
|
315 |
"/ Pass #1: scan all the slaves to figure out the total amount |
|
316 |
"/ of space needed. |
|
317 |
||
318 |
info := self getLayoutInfo:#PREFERRED_SIZE. |
|
319 |
d := self getMinSize:info. |
|
320 |
||
321 |
((width < (d width)) or:[(height < (d height))]) ifTrue:[ |
|
1519 | 322 |
info := self getLayoutInfo:#MINIMUM_SIZE. |
323 |
d := self getMinSize:info. |
|
721 | 324 |
]. |
325 |
||
326 |
layoutInfo := info. |
|
327 |
r := Rectangle origin:0@0 extent:((d width) @ (d height)). |
|
328 |
||
329 |
"/ If the current dimensions of the window don't match the desired |
|
330 |
"/ dimensions, then adjust the minWidth and minHeight arrays |
|
331 |
"/ according to the weights. |
|
332 |
||
333 |
diffw := width - (r width). |
|
334 |
(diffw ~~ 0) ifTrue:[ |
|
1519 | 335 |
weight := 0.0. |
336 |
0 to:((info width) - 1) do:[ :i | |
|
337 |
weight := weight + ((info weightX) at:(i + 1)). |
|
338 |
]. |
|
339 |
(weight > 0.0) ifTrue:[ |
|
340 |
0 to:((info width) - 1) do:[ :i | |
|
341 |
| dx | |
|
342 |
dx := ((diffw * ((info weightX) at:(i + 1))) / weight) asInteger. |
|
343 |
(info minWidth) at:(i + 1) put:(((info minWidth) at:(i + 1)) + dx). |
|
344 |
r width:((r width) + dx). |
|
345 |
(((info minWidth) at:(i + 1)) < 0) ifTrue:[ |
|
346 |
r width:((r width) - ((info minWidth) at:(i + 1))). |
|
347 |
(info minWidth) at:(i + 1) put:0. |
|
348 |
]. |
|
349 |
]. |
|
350 |
]. |
|
351 |
diffw := width - (r width). |
|
721 | 352 |
] ifFalse:[ |
1519 | 353 |
diffw := 0. |
721 | 354 |
]. |
355 |
||
356 |
diffh := height - (r height). |
|
357 |
(diffh ~~ 0) ifTrue:[ |
|
1519 | 358 |
weight := 0.0. |
359 |
0 to:((info height) - 1) do:[ :i | |
|
360 |
weight := weight + ((info weightY) at:(i + 1)). |
|
361 |
]. |
|
362 |
(weight > 0.0) ifTrue:[ |
|
363 |
0 to:((info height) - 1) do:[ :i | |
|
364 |
| dy | |
|
365 |
dy := ((diffh * ((info weightY) at:(i + 1))) / weight) asInteger. |
|
366 |
(info minHeight) at:(i + 1) put:(((info minHeight) at:(i + 1)) + dy). |
|
367 |
r height:((r height) + dy). |
|
368 |
(((info minHeight) at:(i + 1)) < 0) ifTrue:[ |
|
369 |
r height:((r height) - ((info minHeight) at:(i + 1))). |
|
370 |
(info minHeight) at:(i + 1) put:0. |
|
371 |
]. |
|
372 |
]. |
|
373 |
]. |
|
374 |
diffh := height - (r height). |
|
721 | 375 |
] ifFalse:[ |
1519 | 376 |
diffh := 0. |
721 | 377 |
]. |
378 |
||
379 |
"/ Now do the actual layout of the slaves using the layout information |
|
380 |
"/ that has been collected. |
|
381 |
||
382 |
info startX:(((diffw / 2) + (insets left)) asInteger). |
|
383 |
info startY:(((diffh / 2) + (insets top)) asInteger). |
|
384 |
||
385 |
subViews do:[ :child | |
|
2955 | 386 |
|rW rH minWidth minHeight| |
721 | 387 |
|
1519 | 388 |
c := self constraints:child. |
2955 | 389 |
minWidth := info minWidth. |
390 |
minHeight := info minHeight. |
|
1519 | 391 |
|
392 |
r setLeft:(info startX). |
|
2955 | 393 |
0 to:((c tempX) - 1) do:[ :i | r setLeft:((r left) + (minWidth at:(i + 1))). ]. |
721 | 394 |
|
1519 | 395 |
r setTop:(info startY). |
2955 | 396 |
0 to:((c tempY) - 1) do:[ :i | r setTop:((r top) + (minHeight at:(i + 1))). ]. |
721 | 397 |
|
1519 | 398 |
r width:0. |
399 |
(c tempX) to:((c tempX) + (c tempWidth) - 1) do:[ :i | |
|
2955 | 400 |
r width:((r width) + (minWidth at:(i + 1))). |
1519 | 401 |
]. |
721 | 402 |
|
1519 | 403 |
r height:0. |
404 |
(c tempY) to:((c tempY) + (c tempHeight) - 1) do:[ :i | |
|
2955 | 405 |
r height:((r height) + (minHeight at:(i + 1))). |
1519 | 406 |
]. |
721 | 407 |
|
1519 | 408 |
self adjustForGravity:c in:r. |
721 | 409 |
|
1519 | 410 |
"/ If the window is too small to be interesting then |
411 |
"/ unmap it. Otherwise configure it and then make sure |
|
412 |
"/ its mapped. |
|
413 |
rW := r width. |
|
414 |
rH := r height. |
|
721 | 415 |
|
1519 | 416 |
((rW <= 0) or:[rH <= 0]) ifTrue:[ |
417 |
child origin:(0@0) ; width:0 height:0. |
|
418 |
] ifFalse:[ |
|
419 |
child origin:((r left) @ (r top)). |
|
420 |
child width:rW. |
|
421 |
child height:rH. |
|
422 |
]. |
|
721 | 423 |
]. |
424 |
||
425 |
"Modified: / 1.2.1998 / 12:53:37 / av" |
|
426 |
! |
|
427 |
||
428 |
constraints:anObject |
|
429 |
" Get the GridBag constraints for an object. As a fallback create new constraints for objects |
|
430 |
which don't have any constraints yet." |
|
431 |
||
432 |
| c | |
|
433 |
||
434 |
c := anObject objectAttributeAt:#GridBagConstraints. |
|
435 |
c isNil ifTrue:[ |
|
436 |
anObject objectAttributeAt:#GridBagConstraints put:(c := GridBagConstraints new) |
|
437 |
]. |
|
438 |
^ c. |
|
439 |
||
440 |
"Created: / 21.1.1998 / 00:24:34 / av" |
|
441 |
"Modified: / 1.2.1998 / 12:55:23 / av" |
|
442 |
! |
|
443 |
||
444 |
getLayoutInfo:which |
|
445 |
"return a good extent, one that makes subviews fit" |
|
446 |
||
447 |
| |
|
3422
01087101a82b
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
448 |
MAX_INT_VAL subViews |
01087101a82b
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
449 |
r i k px py pixelsDiff weightDiff weight nextSize c |
01087101a82b
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
450 |
curX curY curWidth curHeight curRow curCol xMax yMax |
721 | 451 |
| |
452 |
||
453 |
MAX_INT_VAL := 9999999999. |
|
454 |
subViews := (self subViews). |
|
455 |
||
456 |
r := GridBagLayoutInfo new. |
|
457 |
r width:0. |
|
458 |
r height:0. |
|
459 |
||
460 |
xMax := IdentityDictionaryWithDefault newWithDefaultValue:0. |
|
461 |
yMax := IdentityDictionaryWithDefault newWithDefaultValue:0. |
|
462 |
curRow := curCol := -1. |
|
463 |
||
464 |
"/ Pass #1 |
|
465 |
"/ |
|
466 |
"/ Figure out the dimensions of the layout grid (use a value of 1 for |
|
467 |
"/ zero or negative widths and heights). |
|
468 |
||
469 |
subViews do:[ :child | |
|
3422
01087101a82b
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
470 |
c := self constraints:child. |
721 | 471 |
|
3422
01087101a82b
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
472 |
curX := c gridX. |
01087101a82b
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
473 |
curY := c gridY. |
01087101a82b
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
474 |
((curWidth := c gridWidth) <= 0) ifTrue:[ curWidth := 1. ]. |
01087101a82b
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
475 |
((curHeight := c gridHeight) <= 0) ifTrue:[ curHeight := 1. ]. |
721 | 476 |
|
3422
01087101a82b
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
477 |
"/ If x or y is negative, then use relative positioning: |
01087101a82b
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
478 |
((curX < 0) and:[ curY < 0 ]) |
01087101a82b
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
479 |
ifTrue:[ |
01087101a82b
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
480 |
(curRow >= 0) |
01087101a82b
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
481 |
ifTrue: [ curY := curRow. ] |
01087101a82b
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
482 |
ifFalse:[ (curCol >= 0) ifTrue:[ curX := curCol. ] ifFalse: [ curY := 0. ]]. |
01087101a82b
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
483 |
]. |
721 | 484 |
|
3422
01087101a82b
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
485 |
(curX < 0) |
01087101a82b
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
486 |
ifTrue:[ |
01087101a82b
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
487 |
px := 0. |
01087101a82b
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
488 |
curY to:(curY + curHeight - 1) do: [ :i | |
01087101a82b
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
489 |
px := px max:(xMax at:(i + 1)). |
01087101a82b
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
490 |
]. |
01087101a82b
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
491 |
((curX := px - curX - 1) < 0) ifTrue:[ curX := 0. ]. |
01087101a82b
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
492 |
] |
01087101a82b
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
493 |
ifFalse:[ |
01087101a82b
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
494 |
(curY < 0) ifTrue:[ |
01087101a82b
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
495 |
py := 0. |
01087101a82b
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
496 |
curX to: (curX + curWidth - 1) do: [ :i | |
01087101a82b
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
497 |
py := py max: (yMax at:(i + 1)). |
01087101a82b
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
498 |
]. |
01087101a82b
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
499 |
((curY := py - curY - 1) < 0) ifTrue:[ curY := 0. ]. |
01087101a82b
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
500 |
]. |
01087101a82b
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
501 |
]. |
721 | 502 |
|
3422
01087101a82b
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
503 |
"/ Adjust the grid width and height |
01087101a82b
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
504 |
px := curX + curWidth. [ (r width) < px ] whileTrue:[ r width:((r width) + 1). ]. |
01087101a82b
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
505 |
py := curY + curHeight. [ (r height) < py ] whileTrue:[ r height:((r height) + 1). ]. |
721 | 506 |
|
3422
01087101a82b
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
507 |
"/ Adjust the xMax and yMax arrays |
01087101a82b
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
508 |
curX to:(curX + curWidth - 1) do:[ :i | yMax at:(i + 1) put:py. ]. |
01087101a82b
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
509 |
curY to:(curY + curHeight - 1) do:[ :i | xMax at:(i + 1) put:px. ]. |
721 | 510 |
|
3422
01087101a82b
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
511 |
c minWidth:(child preferredWidth). |
01087101a82b
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
512 |
c minHeight:(child preferredHeight). |
721 | 513 |
|
3422
01087101a82b
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
514 |
"/ Zero width and height must mean that this is the last item (or |
01087101a82b
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
515 |
"/ else something is wrong). |
01087101a82b
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
516 |
(((c gridHeight) == 0) and:[ (c gridWidth) == 0 ]) ifTrue:[ |
01087101a82b
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
517 |
curRow := curCol := -1. |
01087101a82b
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
518 |
]. |
721 | 519 |
|
3422
01087101a82b
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
520 |
"/ Zero width starts a new row |
01087101a82b
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
521 |
(((c gridHeight) == 0) and:[ curRow < 0 ]) |
01087101a82b
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
522 |
ifTrue:[ |
01087101a82b
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
523 |
curCol := curX + curWidth. |
01087101a82b
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
524 |
] |
01087101a82b
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
525 |
ifFalse:[ |
01087101a82b
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
526 |
((c gridWidth) == 0 and:[ curCol < 0 ]) ifTrue:[ |
01087101a82b
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
527 |
curRow := curY + curHeight. |
01087101a82b
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
528 |
]. |
01087101a82b
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
529 |
]. |
721 | 530 |
]. |
531 |
||
532 |
"/ |
|
533 |
"/ Apply minimum row/column dimensions |
|
534 |
"/ |
|
535 |
((r width) < (columnWidths size)) ifTrue:[ r width:(columnWidths size). ]. |
|
536 |
((r height) < (rowHeights size)) ifTrue:[ r height:(rowHeights size). ]. |
|
537 |
||
538 |
"/ |
|
539 |
"/ Pass #2 |
|
540 |
"/ |
|
541 |
"/ Negative values for gridX are filled in with the current x value. |
|
542 |
"/ Negative values for gridY are filled in with the current y value. |
|
543 |
"/ Negative or zero values for gridWidth and gridHeight end the current |
|
544 |
"/ row or column, respectively. |
|
545 |
"/ |
|
546 |
||
547 |
curRow := curCol := -1. |
|
548 |
xMax := IdentityDictionaryWithDefault newWithDefaultValue:0. |
|
549 |
yMax := IdentityDictionaryWithDefault newWithDefaultValue:0. |
|
550 |
||
551 |
subViews do:[ :child | |
|
3422
01087101a82b
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
552 |
c := self constraints:child. |
721 | 553 |
|
3422
01087101a82b
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
554 |
curX := c gridX. |
01087101a82b
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
555 |
curY := c gridY. |
01087101a82b
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
556 |
curWidth := c gridWidth. |
01087101a82b
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
557 |
curHeight := c gridHeight. |
721 | 558 |
|
3422
01087101a82b
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
559 |
"/ If x or y is negative, then use relative positioning: |
01087101a82b
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
560 |
((curX < 0) and:[ curY < 0 ]) |
01087101a82b
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
561 |
ifTrue:[ |
01087101a82b
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
562 |
(curRow >= 0) |
01087101a82b
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
563 |
ifTrue: [ curY := curRow. ] |
01087101a82b
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
564 |
ifFalse:[ (curCol >= 0) |
01087101a82b
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
565 |
ifTrue: [ curX := curCol. ] |
01087101a82b
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
566 |
ifFalse: [ curY := 0. ]. |
01087101a82b
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
567 |
]. |
01087101a82b
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
568 |
]. |
721 | 569 |
|
3422
01087101a82b
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
570 |
(curX < 0) |
01087101a82b
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
571 |
ifTrue:[ |
01087101a82b
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
572 |
(curHeight <= 0) ifTrue:[ |
01087101a82b
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
573 |
curHeight := curHeight + (r height) - curY. |
01087101a82b
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
574 |
(curHeight < 1) ifTrue:[ curHeight := 1. ]. |
01087101a82b
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
575 |
]. |
01087101a82b
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
576 |
px := 0. |
01087101a82b
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
577 |
curY to:(curY + curHeight - 1) do: [ :i | px := px max:(xMax at:(i + 1)). ]. |
01087101a82b
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
578 |
((curX := px - curX - 1) < 0) ifTrue:[ curX := 0. ]. |
01087101a82b
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
579 |
] |
01087101a82b
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
580 |
ifFalse:[ |
01087101a82b
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
581 |
(curY < 0) ifTrue:[ |
01087101a82b
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
582 |
(curWidth <= 0) ifTrue:[ |
01087101a82b
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
583 |
curWidth := curWidth + (r width) - curX. |
01087101a82b
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
584 |
(curWidth < 1) ifTrue:[ curWidth := 1. ]. |
01087101a82b
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
585 |
]. |
01087101a82b
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
586 |
py := 0. |
01087101a82b
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
587 |
curX to:(curX + curWidth - 1) do: [ :i | py := py max:(yMax at:(i + 1)). ]. |
01087101a82b
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
588 |
((curY := py - curY - 1) < 0) ifTrue:[ curY := 0. ]. |
01087101a82b
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
589 |
]. |
01087101a82b
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
590 |
]. |
721 | 591 |
|
3422
01087101a82b
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
592 |
(curWidth <= 0) ifTrue:[ |
01087101a82b
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
593 |
curWidth := curWidth + (r width) - curX. |
01087101a82b
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
594 |
(curWidth < 1) ifTrue:[ curWidth := 1. ]. |
01087101a82b
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
595 |
]. |
721 | 596 |
|
3422
01087101a82b
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
597 |
(curHeight <= 0) ifTrue:[ |
01087101a82b
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
598 |
curHeight := curHeight + (r height) - curY. |
01087101a82b
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
599 |
(curHeight < 1) ifTrue:[ curHeight := 1. ]. |
01087101a82b
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
600 |
]. |
721 | 601 |
|
3422
01087101a82b
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
602 |
px := curX + curWidth. |
01087101a82b
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
603 |
py := curY + curHeight. |
721 | 604 |
|
3422
01087101a82b
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
605 |
"/ Adjust the xMax and yMax arrays |
01087101a82b
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
606 |
curX to: (curX + curWidth - 1) do:[ :i | yMax at:(i + 1) put:py. ]. |
01087101a82b
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
607 |
curY to: (curY + curHeight - 1) do:[ :i | xMax at:(i + 1) put:px. ]. |
721 | 608 |
|
3422
01087101a82b
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
609 |
"/ Zero width and height must mean that this is the last item (or |
01087101a82b
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
610 |
"/ else something is wrong). |
01087101a82b
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
611 |
((c gridHeight) == 0 and:[ (c gridWidth) == 0 ]) ifTrue:[ |
01087101a82b
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
612 |
curRow := curCol := -1. |
01087101a82b
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
613 |
]. |
721 | 614 |
|
3422
01087101a82b
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
615 |
"/ Zero width starts a new row |
01087101a82b
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
616 |
((c gridHeight) == 0 and:[ curRow < 0 ]) |
01087101a82b
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
617 |
ifTrue:[ |
01087101a82b
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
618 |
curCol := curX + curWidth. |
01087101a82b
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
619 |
] |
01087101a82b
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
620 |
ifFalse:[ |
01087101a82b
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
621 |
((c gridWidth) == 0 and:[ curCol < 0 ]) ifTrue:[ |
01087101a82b
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
622 |
curRow := curY + curHeight. |
01087101a82b
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
623 |
]. |
01087101a82b
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
624 |
]. |
721 | 625 |
|
3422
01087101a82b
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
626 |
"/ Assign the new values to the gridbag slave */ |
01087101a82b
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
627 |
c tempX:curX. |
01087101a82b
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
628 |
c tempY:curY. |
01087101a82b
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
629 |
c tempWidth:curWidth. |
01087101a82b
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
630 |
c tempHeight:curHeight. |
721 | 631 |
]. |
632 |
||
633 |
"/ |
|
634 |
"/ Apply minimum row/column dimensions and weights |
|
635 |
"/ |
|
636 |
r minWidth: (columnWidths copy). |
|
637 |
r minHeight: (rowHeights copy). |
|
638 |
r weightX: (columnWeights copy). |
|
639 |
r weightY: (rowWeights copy). |
|
640 |
||
641 |
"/ |
|
642 |
"/ Pass #3 |
|
643 |
"/ |
|
644 |
"/ Distribute the minimun widths and weights: |
|
645 |
"/ |
|
646 |
nextSize := MAX_INT_VAL. |
|
647 |
||
648 |
i := 1. [ i ~~ MAX_INT_VAL ] whileTrue:[ |
|
3422
01087101a82b
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
649 |
subViews do:[ :child | |
01087101a82b
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
650 |
c := self constraints:child. |
721 | 651 |
|
3422
01087101a82b
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
652 |
((c tempWidth) == i) ifTrue:[ |
01087101a82b
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
653 |
px := (c tempX) + (c tempWidth). |
721 | 654 |
|
3422
01087101a82b
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
655 |
"/ |
01087101a82b
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
656 |
"/ Figure out if we should use this slaves weight. If the weight |
01087101a82b
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
657 |
"/ is less than the total weight spanned by the width of the cell, |
01087101a82b
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
658 |
"/ then discard the weight. Otherwise split the difference |
01087101a82b
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
659 |
"/ according to the existing weights. |
01087101a82b
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
660 |
"/ |
01087101a82b
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
661 |
weightDiff := (c weightX) asFloat. |
01087101a82b
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
662 |
(c tempX) to:(px - 1) do:[ :k | weightDiff := weightDiff - ((r weightX) at:(k + 1)) ]. |
721 | 663 |
|
3422
01087101a82b
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
664 |
(weightDiff > 0.0) ifTrue:[ |
01087101a82b
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
665 |
weight := 0.0. |
01087101a82b
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
666 |
(c tempX) to:(px - 1) do:[ :k | weight := weight + ((r weightX) at:(k + 1)). ]. |
721 | 667 |
|
3422
01087101a82b
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
668 |
k := c tempX. |
01087101a82b
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
669 |
[ (weight > 0.0) and:[k < px] ] whileTrue:[ |
01087101a82b
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
670 |
| wt dx | |
721 | 671 |
|
3422
01087101a82b
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
672 |
wt := ((r weightX) at:(k + 1)) asFloat. |
01087101a82b
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
673 |
dx := (wt * weightDiff) / weight. |
01087101a82b
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
674 |
wt at:(k + 1) put:(wt + dx). |
01087101a82b
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
675 |
weightDiff := weightDiff - dx. |
01087101a82b
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
676 |
weight := weight - wt. |
01087101a82b
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
677 |
]. |
01087101a82b
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
678 |
(r weightX) at:(px - 1 + 1) put:(((r weightX) at:(px - 1 + 1)) + weightDiff). |
01087101a82b
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
679 |
]. |
721 | 680 |
|
3422
01087101a82b
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
681 |
"/ Calculate the minWidth array values. |
01087101a82b
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
682 |
"/ First, figure out how wide the current slave needs to be. |
01087101a82b
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
683 |
"/ Then, see if it will fit within the current minWidth values. |
01087101a82b
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
684 |
"/ If it will not fit, add the difference according to the |
01087101a82b
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
685 |
"/ weightX array. |
721 | 686 |
|
3422
01087101a82b
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
687 |
pixelsDiff := (c minWidth) + (c ipadX) + (c insets left) + (c insets right). |
01087101a82b
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
688 |
(c tempX) to:(px - 1) do:[ :k | |
01087101a82b
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
689 |
pixelsDiff := pixelsDiff - ((r minWidth) at:(k + 1)). |
01087101a82b
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
690 |
]. |
721 | 691 |
|
3422
01087101a82b
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
692 |
(pixelsDiff > 0) ifTrue:[ |
01087101a82b
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
693 |
weight := 0.0. |
01087101a82b
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
694 |
(c tempX) to:(px - 1) do:[ :k | weight := weight + ((r weightX) at:(k + 1)). ]. |
01087101a82b
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
695 |
k := c tempX. |
01087101a82b
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
696 |
[ (weight > 0.0) and:[k < px] ] whileTrue:[ |
01087101a82b
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
697 |
| wt dx | |
721 | 698 |
|
3422
01087101a82b
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
699 |
wt := ((r weightX) at:(k + 1)) asFloat. |
01087101a82b
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
700 |
dx := ((wt * pixelsDiff) / weight) asInteger. |
01087101a82b
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
701 |
(r minWidth) at:(k + 1) put:(((r minWidth) at:(k + 1)) + dx). |
01087101a82b
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
702 |
pixelsDiff := pixelsDiff - dx. |
01087101a82b
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
703 |
weight := weight - wt. |
01087101a82b
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
704 |
]. |
01087101a82b
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
705 |
(r minWidth) at:(px - 1 + 1) put:(((r minWidth) at:(px - 1 + 1)) + pixelsDiff). |
01087101a82b
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
706 |
]. |
01087101a82b
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
707 |
] ifFalse:[ |
01087101a82b
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
708 |
(((c tempWidth) > i) and:[ (c tempWidth) < nextSize ]) ifTrue:[ |
01087101a82b
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
709 |
nextSize := c tempWidth. |
01087101a82b
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
710 |
]. |
01087101a82b
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
711 |
]. |
721 | 712 |
|
3422
01087101a82b
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
713 |
"/////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
721 | 714 |
|
3422
01087101a82b
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
715 |
((c tempHeight) == i) ifTrue:[ |
01087101a82b
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
716 |
py := (c tempY) + (c tempHeight). |
721 | 717 |
|
3422
01087101a82b
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
718 |
"/ |
01087101a82b
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
719 |
"/ Figure out if we should use this slaves weight. If the weight |
01087101a82b
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
720 |
"/ is less than the total weight spanned by the width of the cell, |
01087101a82b
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
721 |
"/ then discard the weight. Otherwise split the difference |
01087101a82b
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
722 |
"/ according to the existing weights. |
01087101a82b
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
723 |
"/ |
01087101a82b
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
724 |
weightDiff := (c weightY) asFloat. |
01087101a82b
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
725 |
(c tempY) to:(py - 1) do:[ :k | weightDiff := weightDiff - ((r weightY) at:(k + 1)) ]. |
721 | 726 |
|
3422
01087101a82b
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
727 |
(weightDiff > 0.0) ifTrue:[ |
01087101a82b
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
728 |
weight := 0.0. |
01087101a82b
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
729 |
(c tempY) to:(py - 1) do:[ :k | weight := weight + ((r weightY) at:(k + 1)). ]. |
721 | 730 |
|
3422
01087101a82b
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
731 |
k := c tempY. |
01087101a82b
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
732 |
[ (weight > 0.0) and:[k < py] ] whileTrue:[ |
01087101a82b
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
733 |
| wt dy | |
721 | 734 |
|
3422
01087101a82b
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
735 |
wt := ((r weightY) at:(k + 1)) asFloat. |
01087101a82b
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
736 |
dy := (wt * weightDiff) / weight. |
01087101a82b
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
737 |
wt at:(k + 1) put:(wt + dy). |
01087101a82b
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
738 |
weightDiff := weightDiff - dy. |
01087101a82b
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
739 |
weight := weight - wt. |
01087101a82b
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
740 |
]. |
01087101a82b
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
741 |
(r weightY) at:(py - 1 + 1) put:(((r weightY) at:(py - 1 + 1)) + weightDiff). |
01087101a82b
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
742 |
]. |
721 | 743 |
|
3422
01087101a82b
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
744 |
"/ Calculate the minWidth array values. |
01087101a82b
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
745 |
"/ First, figure out how wide the current slave needs to be. |
01087101a82b
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
746 |
"/ Then, see if it will fit within the current minWidth values. |
01087101a82b
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
747 |
"/ If it will not fit, add the difference according to the |
01087101a82b
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
748 |
"/ weightX array. |
721 | 749 |
|
3422
01087101a82b
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
750 |
pixelsDiff := (c minHeight) + (c ipadY) + (c insets top) + (c insets bottom). |
01087101a82b
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
751 |
(c tempY) to:(py - 1) do:[ :k | |
01087101a82b
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
752 |
pixelsDiff := pixelsDiff - ((r minHeight) at:(k + 1)). |
01087101a82b
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
753 |
]. |
721 | 754 |
|
3422
01087101a82b
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
755 |
(pixelsDiff > 0) ifTrue:[ |
01087101a82b
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
756 |
weight := 0.0. |
01087101a82b
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
757 |
(c tempY) to:(py - 1) do:[ :k | |
01087101a82b
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
758 |
weight := weight + ((r weightY) at:(k + 1)). |
01087101a82b
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
759 |
]. |
01087101a82b
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
760 |
k := c tempY. |
01087101a82b
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
761 |
[ (weight > 0.0) and:[k < py] ] whileTrue:[ |
01087101a82b
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
762 |
| wt dy | |
721 | 763 |
|
3422
01087101a82b
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
764 |
wt := ((r weightY) at:(k + 1)) asFloat. |
01087101a82b
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
765 |
dy := ((wt * pixelsDiff) / weight) asInteger. |
01087101a82b
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
766 |
(r minHeight) at:(k + 1) put:(((r minHeight) at:(k + 1)) + dy). |
01087101a82b
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
767 |
pixelsDiff := pixelsDiff - dy. |
01087101a82b
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
768 |
weight := weight - wt. |
01087101a82b
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
769 |
]. |
01087101a82b
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
770 |
(r minHeight) at:(py - 1 + 1) put:(((r minHeight) at:(py - 1 + 1)) + pixelsDiff). |
01087101a82b
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
771 |
]. |
01087101a82b
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
772 |
] ifFalse:[ |
01087101a82b
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
773 |
(((c tempHeight) > i) and:[ (c tempHeight) < nextSize ]) ifTrue:[ |
01087101a82b
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
774 |
nextSize := c tempHeight. |
01087101a82b
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
775 |
]. |
01087101a82b
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
776 |
]. |
01087101a82b
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
777 |
]. |
01087101a82b
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
778 |
i := nextSize. |
01087101a82b
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
779 |
nextSize := MAX_INT_VAL. |
721 | 780 |
]. |
781 |
||
782 |
^ r |
|
783 |
||
784 |
"Modified: / 29.3.1997 / 11:06:45 / cg" |
|
785 |
"Created: / 19.1.1998 / 17:24:26 / av" |
|
786 |
"Modified: / 21.1.1998 / 18:40:38 / av" |
|
787 |
! |
|
788 |
||
789 |
getMinSize:info |
|
790 |
"Figure out the minimum size of the master based on the information from getLayoutInfo. The |
|
791 |
result will be returned as a rectangle with width and height set to the minimum size." |
|
792 |
||
793 |
| d insets t | |
|
794 |
||
795 |
insets := Insets new. |
|
796 |
||
797 |
d := Rectangle origin:0@0 extent:0@0. |
|
798 |
||
799 |
t := 0. |
|
800 |
1 to:(info width) do:[ :i | t := t + ((info minWidth) at:i). ]. |
|
801 |
d width:(t + (insets left) + (insets right)). |
|
802 |
||
803 |
t := 0. |
|
804 |
1 to:(info height) do:[ :i | t := t + ((info minHeight) at:i). ]. |
|
805 |
d height:(t + (insets top) + (insets bottom)). |
|
806 |
||
807 |
^ d |
|
808 |
||
809 |
"Modified: / 1.2.1998 / 12:59:00 / av" |
|
810 |
! |
|
811 |
||
812 |
minimumLayoutSize |
|
813 |
"Return our minimum layout size. The width and height of the returned rectangle gives the minimum |
|
814 |
layout size." |
|
815 |
||
816 |
| info | |
|
817 |
||
818 |
info := self getLayoutInfo:#MINIMUM_SIZE. |
|
819 |
^ self getMinSize:info |
|
820 |
||
821 |
"Created: / 19.1.1998 / 17:25:01 / av" |
|
822 |
"Modified: / 1.2.1998 / 12:59:38 / av" |
|
823 |
! |
|
824 |
||
825 |
preferredLayoutSize |
|
826 |
"Return our preffered layout size. The width and height of the returned rectangle gives the |
|
827 |
preferred layout size." |
|
828 |
||
829 |
| info | |
|
830 |
||
831 |
info := self getLayoutInfo:#PREFFERED_SIZE. |
|
832 |
^ self getMinSize:info |
|
833 |
||
834 |
"Created: / 19.1.1998 / 17:23:37 / av" |
|
835 |
"Modified: / 1.2.1998 / 13:00:04 / av" |
|
836 |
! ! |
|
837 |
||
838 |
!GridBagLayoutView methodsFor:'queries'! |
|
839 |
||
5946 | 840 |
computePreferredExtent |
841 |
"Return a good extent, one that makes subviews fit. |
|
842 |
Return the the preferred extent as a point |
|
843 |
where x and y represents the width and height of the extent." |
|
721 | 844 |
|
5946 | 845 |
self subViews isEmptyOrNil ifTrue:[ |
846 |
^ super computePreferredExtent. |
|
3673 | 847 |
]. |
721 | 848 |
|
3673 | 849 |
^ self preferredLayoutSize extent. |
721 | 850 |
|
5946 | 851 |
"Created: / 09-11-2018 / 19:54:36 / Claus Gittinger" |
721 | 852 |
! ! |
853 |
||
854 |
!GridBagLayoutView class methodsFor:'documentation'! |
|
855 |
||
856 |
version |
|
5303 | 857 |
^ '$Header$' |
721 | 858 |
! ! |
5303 | 859 |