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