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