author | Claus Gittinger <cg@exept.de> |
Mon, 23 Feb 2015 12:37:42 +0100 | |
changeset 5279 | 3af2da2c44e6 |
parent 4564 | 0a0d41148e11 |
child 6487 | debe1f7cce35 |
permissions | -rw-r--r-- |
3518 | 1 |
" |
2 |
COPYRIGHT (c) 1989 by Claus Gittinger |
|
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 |
" |
|
12 |
"{ Package: 'stx:libwidg' }" |
|
13 |
||
14 |
PanelView subclass:#MultiColumnPanelView |
|
15 |
instanceVariableNames:'columnWidths' |
|
16 |
classVariableNames:'' |
|
17 |
poolDictionaries:'' |
|
18 |
category:'Views-Layout' |
|
19 |
! |
|
20 |
||
21 |
!MultiColumnPanelView class methodsFor:'documentation'! |
|
22 |
||
23 |
copyright |
|
24 |
" |
|
25 |
COPYRIGHT (c) 1989 by Claus Gittinger |
|
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 |
documentation |
|
38 |
" |
|
39 |
a View which arranges its child-views in a vertical column. |
|
40 |
All real work is done in PanelView - except the layout computation is |
|
41 |
redefined here. |
|
42 |
||
43 |
The layout is controlled by the instance variables: |
|
44 |
horizontalLayout and verticalLayout |
|
45 |
in addition to |
|
46 |
horizontalSpace and verticalSpace. |
|
47 |
||
48 |
The vertical layout can be any of: |
|
49 |
||
50 |
#top arrange elements at the top |
|
51 |
#topSpace arrange elements at the top, start with spacing |
|
52 |
#bottom arrange elements at the bottom |
|
53 |
#bottomSpace arrange elements at the bottom, start with spacing |
|
54 |
#center arrange elements in the center; ignore verticalSpace |
|
55 |
#spread spread elements evenly; ignore verticalSpace |
|
56 |
#spreadSpace spread elements evenly with spacing at ends; ignore verticalSpace |
|
57 |
#fit like #spread, but resize elements for tight packing; ignore verticalSpace |
|
58 |
#fitSpace like #fit, with spacing; ignore verticalSpace |
|
59 |
#topFit like #top, but resize the last element to fit |
|
60 |
#topSpaceFit like #topSpace, but resize the last element to fit |
|
61 |
#bottomFit like #bottom, but resize the first element to fit |
|
62 |
#bottomSpaceFit like #bottomSpace, but resize the first element to fit |
|
63 |
||
64 |
the horizontal layout can be: |
|
65 |
||
66 |
#left place element at the left |
|
67 |
#leftSpace place element at the left, offset by horizontalSpace |
|
68 |
#center place elements horizontally centered; ignore horizontalSpace |
|
69 |
#right place it at the right |
|
70 |
#rightSpace place it at the right, offset by horizontalSpace |
|
71 |
#fit resize elements horizontally to fit this panel; ignore horizontalSpace |
|
72 |
#fitSpace like #fit, but add spacing; ignore horizontalSpace |
|
73 |
||
74 |
#leftMax like #left, but resize elements to max of them |
|
75 |
#leftSpaceMax like #leftSpace, but resize elements |
|
76 |
#centerMax like #center, but resize elements |
|
77 |
#rightMax like #right, but resize elements to max of them |
|
78 |
#rightSpaceMax like #rightSpace, but resize elements |
|
79 |
||
80 |
The defaults is #center for both directions. |
|
81 |
||
82 |
The layout is changed by the messages #verticalLayout: and #horizontalLayout:. |
|
83 |
For backward compatibility (to times, where only vLayout existed), the simple |
|
84 |
#layout: does the same as #verticalLayout:. Do not use this old method. |
|
85 |
||
86 |
The panel assumes, that the elements do not resize themselfes, after it |
|
87 |
became visible. This is not true for all widgets (buttons or labels may |
|
88 |
like to change). If you have changing elements, tell this to the panel |
|
89 |
with 'aPanel elementsChangeSize:true'. In that case, the panel will react |
|
90 |
to size changes, and reorganize things. |
|
91 |
||
92 |
If none of these layout/space combinations is exactly what you need in |
|
93 |
your application, create a subclass, and redefine the setChildPositions method. |
|
94 |
||
95 |
CAVEAT: this class started with #top and no horizontal alignments; |
|
96 |
as time went by, more layouts were added and the setup should be changed |
|
97 |
to use different selectors for space, max-resize and alignment |
|
98 |
(i.e. having more and more layout symbols makes things a bit confusing ...) |
|
99 |
||
100 |
[see also:] |
|
101 |
HorizontalPanelView |
|
102 |
VariableVerticalPanel VariableHorizontalPanel |
|
103 |
Label |
|
104 |
||
105 |
[author:] |
|
106 |
Claus Gittinger |
|
107 |
" |
|
108 |
! |
|
109 |
||
110 |
examples |
|
111 |
" |
|
112 |
These examples demonstrate the effect of different layout |
|
113 |
settings. |
|
114 |
You should try more examples, combining spacing and different |
|
115 |
verticalLayout:/horizontalLayout: combinations. |
|
116 |
||
117 |
||
118 |
example: default layout (centered) |
|
119 |
[exBegin] |
|
120 |
|v p b1 b2 b3 l1 l2 l3| |
|
121 |
||
122 |
v := StandardSystemView new. |
|
123 |
v label:'center (default)'. |
|
124 |
p := MultiColumnPanelView in:v. |
|
125 |
p origin:(0.0 @ 0.0) corner:(1.0 @ 1.0). |
|
126 |
p columnWidths:#(0.3 0.7). |
|
127 |
l1 := Label label:'label1' in:p. |
|
128 |
b1 := Button label:'button1' in:p. |
|
129 |
l2 := Label label:'l2' in:p. |
|
130 |
b2 := Button label:'b2' in:p. |
|
131 |
l3 := Label label:'lab3' in:p. |
|
132 |
b3 := Button label:'butt3' in:p. |
|
133 |
v extent:100 @ 300. |
|
134 |
v open |
|
135 |
[exEnd] |
|
136 |
" |
|
137 |
! ! |
|
138 |
||
139 |
!MultiColumnPanelView methodsFor:'accessing'! |
|
140 |
||
141 |
columnWidths:something |
|
142 |
something ~= columnWidths ifTrue:[ |
|
143 |
columnWidths := something. |
|
144 |
self layoutChanged |
|
145 |
]. |
|
146 |
! |
|
147 |
||
148 |
horizontalLayout |
|
149 |
"return the horizontal layout as symbol. |
|
150 |
the returned value is one of |
|
151 |
#left place element at the left |
|
152 |
#leftSpace place element at the left, offset by horizontalSpace |
|
153 |
#center place elements horizontally centered; ignore horizontalSpace |
|
154 |
#right place it at the right |
|
155 |
#rightSpace place it at the right, offset by horizontalSpace |
|
156 |
#fit resize elements horizontally to fit this panel; ignore horizontalSpace |
|
157 |
#fitSpace like #fit, but add spacing; ignore horizontalSpace |
|
158 |
||
159 |
#leftMax like #left, but resize elements to max of them |
|
160 |
#leftSpaceMax like #leftSpace, but resize elements |
|
161 |
#centerMax like #center, but resize elements |
|
162 |
#rightMax like #right, but resize elements to max of them |
|
163 |
#rightSpaceMax like #rightSpace, but resize elements |
|
164 |
the default is #centered |
|
165 |
" |
|
166 |
||
167 |
^ hLayout |
|
168 |
! |
|
169 |
||
170 |
horizontalLayout:aSymbol |
|
171 |
"change the horizontal layout as symbol. |
|
172 |
The argument, aSymbol must be one of: |
|
173 |
#left place element at the left |
|
174 |
#leftSpace place element at the left, offset by horizontalSpace |
|
175 |
#center place elements horizontally centered; ignore horizontalSpace |
|
176 |
#right place it at the right |
|
177 |
#rightSpace place it at the right, offset by horizontalSpace |
|
178 |
#fit resize elements horizontally to fit this panel; ignore horizontalSpace |
|
179 |
#fitSpace like #fit, but add spacing; ignore horizontalSpace |
|
180 |
||
181 |
#leftMax like #left, but resize elements to max of them |
|
182 |
#leftSpaceMax like #leftSpace, but resize elements |
|
183 |
#centerMax like #center, but resize elements |
|
184 |
#rightMax like #right, but resize elements to max of them |
|
185 |
#rightSpaceMax like #rightSpace, but resize elements |
|
186 |
the default (if never changed) is #centered |
|
187 |
" |
|
188 |
||
189 |
(hLayout ~~ aSymbol) ifTrue:[ |
|
190 |
hLayout := aSymbol. |
|
191 |
self layoutChanged |
|
192 |
] |
|
193 |
! |
|
194 |
||
195 |
layout:something |
|
196 |
"OBSOLETE compatibility interface. Will vanish. |
|
197 |
leftover for historic reasons - do not use any more. |
|
198 |
In the meantime, try to figure out what is meant ... a kludge" |
|
199 |
||
200 |
<resource:#obsolete> |
|
201 |
||
202 |
something isLayout ifTrue:[^ super layout:something]. |
|
203 |
||
204 |
self obsoleteMethodWarning:'use #verticalLayout:'. |
|
205 |
^ self verticalLayout:something |
|
206 |
||
207 |
"Modified: 31.8.1995 / 23:08:54 / claus" |
|
208 |
! |
|
209 |
||
210 |
verticalLayout |
|
211 |
"return the vertical layout as a symbol. |
|
212 |
the returned value is one of |
|
213 |
#top arrange elements at the top |
|
214 |
#topSpace arrange elements at the top, start with spacing |
|
215 |
#bottom arrange elements at the bottom |
|
216 |
#bottomSpace arrange elements at the bottom, start with spacing |
|
217 |
#center arrange elements in the center; ignore verticalSpace |
|
218 |
#spread spread elements evenly; ignore verticalSpace |
|
219 |
#spreadSpace spread elements evenly with spacing at ends; ignore verticalSpace |
|
220 |
#fit like #spread, but resize elements for tight packing; ignore verticalSpace |
|
221 |
#fitSpace like #fit, with spacing; ignore verticalSpace |
|
222 |
#topFit like #top, but resize the last element to fit |
|
223 |
#topSpaceFit like #topSpace, but resize the last element to fit |
|
224 |
#bottomFit like #bottom, but resize the first element to fit |
|
225 |
#bottomSpaceFit like #bottomSpace, but extend the first element to fit |
|
226 |
the default is #centered |
|
227 |
" |
|
228 |
||
229 |
^ vLayout |
|
230 |
||
231 |
"Modified: 17.8.1997 / 15:20:13 / cg" |
|
232 |
! |
|
233 |
||
234 |
verticalLayout:aSymbol |
|
235 |
"change the vertical layout as a symbol. |
|
236 |
The argument, aSymbol must be one of: |
|
237 |
#top arrange elements at the top |
|
238 |
#topSpace arrange elements at the top, start with spacing |
|
239 |
#bottom arrange elements at the bottom |
|
240 |
#bottomSpace arrange elements at the bottom, start with spacing |
|
241 |
#center arrange elements in the center; ignore verticalSpace |
|
242 |
#spread spread elements evenly; ignore verticalSpace |
|
243 |
#spreadSpace spread elements evenly with spacing at ends; ignore verticalSpace |
|
244 |
#fit like #spread, but resize elements for tight packing; ignore verticalSpace |
|
245 |
#fitSpace like #fit, with spacing; ignore verticalSpace |
|
246 |
#topFit like #top, but resize the last element to fit |
|
247 |
#topSpaceFit like #topSpace, but resize the last element to fit |
|
248 |
#bottomFit like #bottom, but resize the first element to fit |
|
249 |
#bottomSpaceFit like #bottomSpace, but extend the first element to fit |
|
250 |
the default (if never changed) is #centered |
|
251 |
" |
|
252 |
||
253 |
(vLayout ~~ aSymbol) ifTrue:[ |
|
254 |
vLayout := aSymbol. |
|
255 |
self layoutChanged |
|
256 |
] |
|
257 |
||
258 |
"Modified: 17.8.1997 / 15:19:58 / cg" |
|
259 |
! ! |
|
260 |
||
261 |
!MultiColumnPanelView methodsFor:'initialization'! |
|
262 |
||
263 |
initialize |
|
264 |
super initialize. |
|
265 |
||
266 |
hLayout := #fit. |
|
267 |
vLayout := #top. |
|
268 |
columnWidths := #(0.5 0.5). |
|
269 |
! ! |
|
270 |
||
271 |
!MultiColumnPanelView methodsFor:'layout'! |
|
272 |
||
273 |
setChildPositions |
|
274 |
"(re)compute position of every child" |
|
275 |
||
4564
0a0d41148e11
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4019
diff
changeset
|
276 |
|xpos ypos space numChilds hInside hL vL maxHeight m2 subViews rowsPerCol maxWidthPerCol col numCols cX cY bw| |
3518 | 277 |
|
278 |
subViews := self subViewsToConsider. |
|
279 |
subViews size == 0 ifTrue:[^ self]. |
|
280 |
||
281 |
"/ self extentChangedFlag ifTrue:[ |
|
282 |
"/ ext := self computeExtent. |
|
283 |
"/ width := ext x. |
|
284 |
"/ height := ext y. |
|
285 |
"/ ]. |
|
286 |
||
287 |
space := verticalSpace. |
|
288 |
numChilds := subViews size. |
|
289 |
numCols := columnWidths size max:1. |
|
290 |
||
4019
bf57f58f13a8
no more direct accesses to borderWidth and borderColor
Claus Gittinger <cg@exept.de>
parents:
3760
diff
changeset
|
291 |
bw := self borderWidth. |
3518 | 292 |
m2 := margin * 2. |
4019
bf57f58f13a8
no more direct accesses to borderWidth and borderColor
Claus Gittinger <cg@exept.de>
parents:
3760
diff
changeset
|
293 |
hInside := height - m2 + (bw*2) - subViews last borderWidth. |
3518 | 294 |
|
295 |
hL := hLayout. |
|
296 |
vL := vLayout. |
|
297 |
||
298 |
rowsPerCol := Array new:numCols withAll:0. |
|
299 |
maxWidthPerCol := Array new:numCols withAll:0. |
|
300 |
||
301 |
maxHeight := 0. |
|
302 |
col := 1. |
|
303 |
subViews do:[:child | |
|
304 |
|childsW childsH| |
|
305 |
||
306 |
childsW := child widthIncludingBorder. |
|
307 |
childsH := child heightIncludingBorder. |
|
308 |
maxHeight := maxHeight max:childsH. |
|
309 |
maxWidthPerCol at:col put:((maxWidthPerCol at:col) max:childsW). |
|
310 |
rowsPerCol at:col put:(rowsPerCol at:col)+1. |
|
311 |
col := col + 1. |
|
312 |
col > numCols ifTrue:[ col := 1 ]. |
|
313 |
]. |
|
314 |
"/ new |
|
315 |
xpos := 0. |
|
316 |
ypos := 0. |
|
317 |
col := 1. |
|
318 |
subViews do:[:child | |
|
319 |
col == numCols ifTrue:[ |
|
320 |
cX := width. |
|
321 |
] ifFalse:[ |
|
322 |
cX := xpos + (width // numCols). |
|
323 |
]. |
|
324 |
cY := ypos + maxHeight. |
|
325 |
||
326 |
child origin:(xpos@ypos)"corner:(cX @ cY)". |
|
327 |
hLayout == #fit ifTrue:[ |
|
328 |
child width:(cX - xpos + 1). |
|
329 |
]. |
|
330 |
col := col + 1. |
|
331 |
col > numCols ifTrue:[ |
|
332 |
col := 1. |
|
333 |
xpos := 0. |
|
334 |
ypos := cY + verticalSpace. |
|
335 |
] ifFalse:[ |
|
336 |
xpos := cX + horizontalSpace. |
|
337 |
]. |
|
338 |
]. |
|
339 |
^ self. |
|
340 |
||
341 |
"/ old |
|
342 |
||
4564
0a0d41148e11
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4019
diff
changeset
|
343 |
"/ resizeToMaxV := false. |
0a0d41148e11
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4019
diff
changeset
|
344 |
"/ (vL endsWith:'Max') ifTrue:[ |
0a0d41148e11
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4019
diff
changeset
|
345 |
"/ resizeToMaxV := true. |
0a0d41148e11
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4019
diff
changeset
|
346 |
"/ hEach := maxHeight := subViews inject:0 into:[:maxSoFar :child | maxSoFar max:child heightIncludingBorder]. |
0a0d41148e11
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4019
diff
changeset
|
347 |
"/ vL := (vL copyButLast:3) asSymbol. |
0a0d41148e11
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4019
diff
changeset
|
348 |
"/ ]. |
0a0d41148e11
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4019
diff
changeset
|
349 |
"/ |
0a0d41148e11
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4019
diff
changeset
|
350 |
"/ numChilds == 1 ifTrue:[ |
0a0d41148e11
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4019
diff
changeset
|
351 |
"/ (vL == #topFit or:[vL == #bottomFit]) ifTrue:[ |
0a0d41148e11
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4019
diff
changeset
|
352 |
"/ vL := #fit |
0a0d41148e11
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4019
diff
changeset
|
353 |
"/ ]. |
0a0d41148e11
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4019
diff
changeset
|
354 |
"/ (vL == #topSpaceFit or:[vL == #bottomSpaceFit]) ifTrue:[ |
0a0d41148e11
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4019
diff
changeset
|
355 |
"/ vL := #fitSpace |
0a0d41148e11
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4019
diff
changeset
|
356 |
"/ ]. |
0a0d41148e11
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4019
diff
changeset
|
357 |
"/ ]. |
0a0d41148e11
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4019
diff
changeset
|
358 |
"/ |
0a0d41148e11
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4019
diff
changeset
|
359 |
"/ vL == #fitSpace ifTrue:[ |
0a0d41148e11
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4019
diff
changeset
|
360 |
"/ " |
0a0d41148e11
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4019
diff
changeset
|
361 |
"/ adjust childs extents and set origins. |
0a0d41148e11
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4019
diff
changeset
|
362 |
"/ Be careful to avoid accumulation of rounding errors |
0a0d41148e11
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4019
diff
changeset
|
363 |
"/ " |
0a0d41148e11
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4019
diff
changeset
|
364 |
"/ hEach := (hInside - ((numChilds + 1) * space)) / numChilds. |
0a0d41148e11
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4019
diff
changeset
|
365 |
"/ ypos := space + margin - bw. |
0a0d41148e11
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4019
diff
changeset
|
366 |
"/ ] ifFalse:[ |
0a0d41148e11
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4019
diff
changeset
|
367 |
"/ vL == #fit ifTrue:[ |
0a0d41148e11
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4019
diff
changeset
|
368 |
"/ " |
0a0d41148e11
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4019
diff
changeset
|
369 |
"/ adjust childs extents and set origins. |
0a0d41148e11
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4019
diff
changeset
|
370 |
"/ Be careful to avoid accumulation of rounding errors |
0a0d41148e11
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4019
diff
changeset
|
371 |
"/ " |
0a0d41148e11
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4019
diff
changeset
|
372 |
"/ hEach := (hInside - ((numChilds - 1) * space)) / numChilds. |
0a0d41148e11
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4019
diff
changeset
|
373 |
"/ ypos := margin - bw. |
0a0d41148e11
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4019
diff
changeset
|
374 |
"/ ] ifFalse:[ |
0a0d41148e11
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4019
diff
changeset
|
375 |
"/ l := vL. |
0a0d41148e11
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4019
diff
changeset
|
376 |
"/ |
0a0d41148e11
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4019
diff
changeset
|
377 |
"/ " |
0a0d41148e11
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4019
diff
changeset
|
378 |
"/ compute net height needed |
0a0d41148e11
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4019
diff
changeset
|
379 |
"/ " |
0a0d41148e11
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4019
diff
changeset
|
380 |
"/ resizeToMaxV ifTrue:[ |
0a0d41148e11
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4019
diff
changeset
|
381 |
"/ sumOfHeights := subViews inject:0 into:[:sumSoFar :child | sumSoFar + maxHeight + (child borderWidth*2)]. |
0a0d41148e11
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4019
diff
changeset
|
382 |
"/ ] ifFalse:[ |
0a0d41148e11
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4019
diff
changeset
|
383 |
"/ sumOfHeights := subViews inject:0 into:[:sumSoFar :child | sumSoFar + child heightIncludingBorder]. |
3518 | 384 |
"/ |
4564
0a0d41148e11
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4019
diff
changeset
|
385 |
"/ "/ adjust - do not include height of last(first) element if doing a fit |
0a0d41148e11
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4019
diff
changeset
|
386 |
"/ (vL == #topFit or:[vL == #topSpaceFit]) ifTrue:[ |
0a0d41148e11
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4019
diff
changeset
|
387 |
"/ sumOfHeights := sumOfHeights - subViews last heightIncludingBorder. |
0a0d41148e11
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4019
diff
changeset
|
388 |
"/ ] ifFalse:[ |
0a0d41148e11
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4019
diff
changeset
|
389 |
"/ (vL == #bottomFit or:[vL == #bottomSpaceFit]) ifTrue:[ |
0a0d41148e11
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4019
diff
changeset
|
390 |
"/ sumOfHeights := sumOfHeights - subViews first heightIncludingBorder. |
0a0d41148e11
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4019
diff
changeset
|
391 |
"/ ] |
0a0d41148e11
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4019
diff
changeset
|
392 |
"/ ]. |
0a0d41148e11
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4019
diff
changeset
|
393 |
"/ ]. |
0a0d41148e11
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4019
diff
changeset
|
394 |
"/ |
0a0d41148e11
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4019
diff
changeset
|
395 |
"/ restHeight := height - sumOfHeights - ((numChilds-1)*space). |
0a0d41148e11
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4019
diff
changeset
|
396 |
"/ |
0a0d41148e11
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4019
diff
changeset
|
397 |
"/ ((l == #center) and:[numChilds == 1]) ifTrue:[l := #spread]. |
0a0d41148e11
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4019
diff
changeset
|
398 |
"/ (l == #spread and:[numChilds == 1]) ifTrue:[l := #spreadSpace]. |
0a0d41148e11
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4019
diff
changeset
|
399 |
"/ |
0a0d41148e11
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4019
diff
changeset
|
400 |
"/ " |
0a0d41148e11
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4019
diff
changeset
|
401 |
"/ compute position of topmost subview and space between them; |
0a0d41148e11
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4019
diff
changeset
|
402 |
"/ if they do hardly fit, leave no space between them |
0a0d41148e11
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4019
diff
changeset
|
403 |
"/ " |
0a0d41148e11
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4019
diff
changeset
|
404 |
"/ ((sumOfHeights >= (height - m2)) |
0a0d41148e11
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4019
diff
changeset
|
405 |
"/ and:[l ~~ #fixTopSpace and:[l ~~ #fixTop]]) ifTrue:[ |
0a0d41148e11
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4019
diff
changeset
|
406 |
"/ " |
0a0d41148e11
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4019
diff
changeset
|
407 |
"/ if we have not enough space for all the elements, |
0a0d41148e11
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4019
diff
changeset
|
408 |
"/ fill them tight, and show what can be shown (at least) |
0a0d41148e11
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4019
diff
changeset
|
409 |
"/ " |
0a0d41148e11
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4019
diff
changeset
|
410 |
"/ ypos := margin. |
0a0d41148e11
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4019
diff
changeset
|
411 |
"/ space := 0 |
0a0d41148e11
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4019
diff
changeset
|
412 |
"/ ] ifFalse:[ |
0a0d41148e11
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4019
diff
changeset
|
413 |
"/ l == #fixTopSpace ifTrue:[ |
0a0d41148e11
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4019
diff
changeset
|
414 |
"/ l := #topSpace |
0a0d41148e11
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4019
diff
changeset
|
415 |
"/ ] ifFalse:[ |
0a0d41148e11
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4019
diff
changeset
|
416 |
"/ l == #fixTop ifTrue:[ |
0a0d41148e11
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4019
diff
changeset
|
417 |
"/ l := #top |
0a0d41148e11
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4019
diff
changeset
|
418 |
"/ ] |
0a0d41148e11
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4019
diff
changeset
|
419 |
"/ ]. |
0a0d41148e11
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4019
diff
changeset
|
420 |
"/ ((l == #bottom) or:[l == #bottomSpace |
0a0d41148e11
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4019
diff
changeset
|
421 |
"/ or:[l == #bottomFit or:[l == #bottomSpaceFit]]]) ifTrue:[ |
0a0d41148e11
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4019
diff
changeset
|
422 |
"/ ypos := restHeight - (space * (numChilds - 1)). |
0a0d41148e11
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4019
diff
changeset
|
423 |
"/"/ |
0a0d41148e11
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4019
diff
changeset
|
424 |
"/"/ bw == 0 ifTrue:[ |
0a0d41148e11
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4019
diff
changeset
|
425 |
"/"/ ypos := ypos + space |
0a0d41148e11
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4019
diff
changeset
|
426 |
"/"/ ]. |
0a0d41148e11
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4019
diff
changeset
|
427 |
"/"/ |
0a0d41148e11
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4019
diff
changeset
|
428 |
"/ (l == #bottomSpace |
0a0d41148e11
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4019
diff
changeset
|
429 |
"/ or:[l == #bottomSpaceFit]) ifTrue:[ |
0a0d41148e11
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4019
diff
changeset
|
430 |
"/ ypos >= space ifTrue:[ |
0a0d41148e11
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4019
diff
changeset
|
431 |
"/ ypos := ypos - space |
0a0d41148e11
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4019
diff
changeset
|
432 |
"/ ] |
3518 | 433 |
"/ ]. |
4564
0a0d41148e11
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4019
diff
changeset
|
434 |
"/ ypos := ypos - margin. |
0a0d41148e11
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4019
diff
changeset
|
435 |
"/ |
0a0d41148e11
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4019
diff
changeset
|
436 |
"/ ypos < 0 ifTrue:[ |
0a0d41148e11
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4019
diff
changeset
|
437 |
"/ space := space min:(restHeight // (numChilds + 1)). |
0a0d41148e11
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4019
diff
changeset
|
438 |
"/ ypos := restHeight - (space * numChilds). |
0a0d41148e11
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4019
diff
changeset
|
439 |
"/ ] |
0a0d41148e11
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4019
diff
changeset
|
440 |
"/ ] ifFalse: [ |
0a0d41148e11
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4019
diff
changeset
|
441 |
"/ (l == #spread) ifTrue:[ |
0a0d41148e11
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4019
diff
changeset
|
442 |
"/ space := (restHeight - m2) // (numChilds - 1). |
0a0d41148e11
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4019
diff
changeset
|
443 |
"/ ypos := margin. |
0a0d41148e11
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4019
diff
changeset
|
444 |
"/ (space == 0) ifTrue:[ |
0a0d41148e11
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4019
diff
changeset
|
445 |
"/ ypos := restHeight // 2 |
0a0d41148e11
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4019
diff
changeset
|
446 |
"/ ] |
0a0d41148e11
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4019
diff
changeset
|
447 |
"/ ] ifFalse: [ |
0a0d41148e11
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4019
diff
changeset
|
448 |
"/ (l == #spreadSpace) ifTrue:[ |
0a0d41148e11
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4019
diff
changeset
|
449 |
"/ space := (restHeight - m2) // (numChilds + 1). |
0a0d41148e11
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4019
diff
changeset
|
450 |
"/ ypos := space + margin. |
0a0d41148e11
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4019
diff
changeset
|
451 |
"/ (space == 0) ifTrue:[ |
0a0d41148e11
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4019
diff
changeset
|
452 |
"/ ypos := restHeight // 2 |
0a0d41148e11
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4019
diff
changeset
|
453 |
"/ ] |
0a0d41148e11
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4019
diff
changeset
|
454 |
"/ ] ifFalse: [ |
0a0d41148e11
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4019
diff
changeset
|
455 |
"/ ((l == #top) or:[l == #topSpace |
0a0d41148e11
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4019
diff
changeset
|
456 |
"/ or:[l == #topFit or:[l == #topSpaceFit]]]) ifTrue:[ |
0a0d41148e11
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4019
diff
changeset
|
457 |
"/ space := space min:(restHeight - m2) // (numChilds + 1). |
0a0d41148e11
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4019
diff
changeset
|
458 |
"/ (vL == #fixTop or:[vL == #fixTopSpace]) ifTrue:[ |
0a0d41148e11
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4019
diff
changeset
|
459 |
"/ space := space max:verticalSpace. |
0a0d41148e11
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4019
diff
changeset
|
460 |
"/ ] ifFalse:[ |
0a0d41148e11
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4019
diff
changeset
|
461 |
"/ space := space max:0. |
0a0d41148e11
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4019
diff
changeset
|
462 |
"/ ]. |
0a0d41148e11
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4019
diff
changeset
|
463 |
"/ (l == #topSpace or:[l == #topSpaceFit]) ifTrue:[ |
0a0d41148e11
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4019
diff
changeset
|
464 |
"/ ypos := space + margin. |
0a0d41148e11
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4019
diff
changeset
|
465 |
"/ ] ifFalse:[ |
0a0d41148e11
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4019
diff
changeset
|
466 |
"/ "/ |
0a0d41148e11
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4019
diff
changeset
|
467 |
"/ "/ if the very first view has a 0-level AND |
0a0d41148e11
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4019
diff
changeset
|
468 |
"/ "/ my level is non-zero, begin with margin |
0a0d41148e11
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4019
diff
changeset
|
469 |
"/ "/ |
0a0d41148e11
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4019
diff
changeset
|
470 |
"/ true "(margin ~~ 0 and:[subViews first level == 0])" ifTrue:[ |
0a0d41148e11
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4019
diff
changeset
|
471 |
"/ ypos := margin |
0a0d41148e11
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4019
diff
changeset
|
472 |
"/ ] ifFalse:[ |
0a0d41148e11
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4019
diff
changeset
|
473 |
"/ ypos := 0 |
0a0d41148e11
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4019
diff
changeset
|
474 |
"/ ] |
0a0d41148e11
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4019
diff
changeset
|
475 |
"/ ] |
0a0d41148e11
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4019
diff
changeset
|
476 |
"/ ] ifFalse:[ |
0a0d41148e11
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4019
diff
changeset
|
477 |
"/ "center" |
0a0d41148e11
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4019
diff
changeset
|
478 |
"/ ypos := (restHeight - ((numChilds - 1) * space)) // 2. |
0a0d41148e11
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4019
diff
changeset
|
479 |
"/ ypos < 0 ifTrue:[ |
0a0d41148e11
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4019
diff
changeset
|
480 |
"/ space := restHeight // (numChilds + 1). |
0a0d41148e11
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4019
diff
changeset
|
481 |
"/ ypos := (restHeight - ((numChilds - 1) * space)) // 2. |
0a0d41148e11
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4019
diff
changeset
|
482 |
"/ ] |
0a0d41148e11
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4019
diff
changeset
|
483 |
"/ ] |
0a0d41148e11
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4019
diff
changeset
|
484 |
"/ ] |
0a0d41148e11
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4019
diff
changeset
|
485 |
"/ ] |
0a0d41148e11
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4019
diff
changeset
|
486 |
"/ ] |
0a0d41148e11
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4019
diff
changeset
|
487 |
"/ ]. |
0a0d41148e11
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4019
diff
changeset
|
488 |
"/ ]. |
0a0d41148e11
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4019
diff
changeset
|
489 |
"/ ]. |
0a0d41148e11
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4019
diff
changeset
|
490 |
"/ |
0a0d41148e11
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4019
diff
changeset
|
491 |
"/ resizeToMaxH := false. |
0a0d41148e11
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4019
diff
changeset
|
492 |
"/ (hL endsWith:'Max') ifTrue:[ |
0a0d41148e11
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4019
diff
changeset
|
493 |
"/ resizeToMaxH := true. |
0a0d41148e11
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4019
diff
changeset
|
494 |
"/ maxWidth := subViews inject:0 into:[:maxSoFar :child | maxSoFar max:child widthIncludingBorder]. |
0a0d41148e11
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4019
diff
changeset
|
495 |
"/ hL := (hL copyWithoutLast:3) asSymbol. |
0a0d41148e11
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4019
diff
changeset
|
496 |
"/ ]. |
0a0d41148e11
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4019
diff
changeset
|
497 |
"/ |
0a0d41148e11
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4019
diff
changeset
|
498 |
"/ " |
0a0d41148e11
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4019
diff
changeset
|
499 |
"/ now set positions |
0a0d41148e11
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4019
diff
changeset
|
500 |
"/ " |
0a0d41148e11
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4019
diff
changeset
|
501 |
"/ subViews keysAndValuesDo:[:index :child | |
0a0d41148e11
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4019
diff
changeset
|
502 |
"/ |xpos advance bwChild wChild newWChild x2| |
0a0d41148e11
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4019
diff
changeset
|
503 |
"/ |
0a0d41148e11
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4019
diff
changeset
|
504 |
"/ wChild := child widthIncludingBorder. |
0a0d41148e11
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4019
diff
changeset
|
505 |
"/ bwChild := child borderWidth. |
0a0d41148e11
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4019
diff
changeset
|
506 |
"/ |
0a0d41148e11
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4019
diff
changeset
|
507 |
"/ elementsChangeSize ifTrue:[ |
0a0d41148e11
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4019
diff
changeset
|
508 |
"/ "to avoid a recursion when we change the elements size" |
0a0d41148e11
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4019
diff
changeset
|
509 |
"/ child removeDependent:self. |
0a0d41148e11
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4019
diff
changeset
|
510 |
"/ ]. |
0a0d41148e11
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4019
diff
changeset
|
511 |
"/ resizeToMaxH ifTrue:[ |
0a0d41148e11
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4019
diff
changeset
|
512 |
"/ child width:(wChild := maxWidth - (bwChild * 2)). |
0a0d41148e11
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4019
diff
changeset
|
513 |
"/ ]. |
0a0d41148e11
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4019
diff
changeset
|
514 |
"/ |
0a0d41148e11
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4019
diff
changeset
|
515 |
"/ hL == #left ifTrue:[ |
0a0d41148e11
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4019
diff
changeset
|
516 |
"/ xpos := 0 - bw + margin. |
0a0d41148e11
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4019
diff
changeset
|
517 |
"/ ] ifFalse:[ |
0a0d41148e11
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4019
diff
changeset
|
518 |
"/ hL == #leftSpace ifTrue:[ |
0a0d41148e11
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4019
diff
changeset
|
519 |
"/ xpos := horizontalSpace + margin |
0a0d41148e11
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4019
diff
changeset
|
520 |
"/ ] ifFalse:[ |
0a0d41148e11
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4019
diff
changeset
|
521 |
"/ hL == #right ifTrue:[ |
0a0d41148e11
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4019
diff
changeset
|
522 |
"/ xpos := width - wChild - margin |
0a0d41148e11
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4019
diff
changeset
|
523 |
"/ ] ifFalse:[ |
0a0d41148e11
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4019
diff
changeset
|
524 |
"/ hL == #rightSpace ifTrue:[ |
0a0d41148e11
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4019
diff
changeset
|
525 |
"/ xpos := width - horizontalSpace - wChild - margin. |
0a0d41148e11
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4019
diff
changeset
|
526 |
"/ ] ifFalse:[ |
0a0d41148e11
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4019
diff
changeset
|
527 |
"/ hL == #fitSpace ifTrue:[ |
0a0d41148e11
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4019
diff
changeset
|
528 |
"/ xpos := horizontalSpace + margin. |
0a0d41148e11
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4019
diff
changeset
|
529 |
"/ newWChild := width - m2 - ((horizontalSpace + bwChild) * 2) |
0a0d41148e11
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4019
diff
changeset
|
530 |
"/ ] ifFalse:[ |
0a0d41148e11
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4019
diff
changeset
|
531 |
"/ hL == #fit ifTrue:[ |
0a0d41148e11
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4019
diff
changeset
|
532 |
"/ newWChild := width "- (bwChild * 2)". |
0a0d41148e11
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4019
diff
changeset
|
533 |
"/ bw == 0 ifTrue:[ |
0a0d41148e11
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4019
diff
changeset
|
534 |
"/ newWChild := newWChild - (bwChild * 2) |
0a0d41148e11
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4019
diff
changeset
|
535 |
"/ ]. |
0a0d41148e11
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4019
diff
changeset
|
536 |
"/ true "child level == 0" ifTrue:[ |
0a0d41148e11
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4019
diff
changeset
|
537 |
"/ xpos := margin - bw. |
0a0d41148e11
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4019
diff
changeset
|
538 |
"/ newWChild := newWChild - m2 |
0a0d41148e11
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4019
diff
changeset
|
539 |
"/ ] ifFalse:[ |
0a0d41148e11
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4019
diff
changeset
|
540 |
"/ xpos := 0 - bw. |
0a0d41148e11
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4019
diff
changeset
|
541 |
"/ ]. |
0a0d41148e11
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4019
diff
changeset
|
542 |
"/ ] ifFalse:[ |
0a0d41148e11
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4019
diff
changeset
|
543 |
"/ "centered" |
0a0d41148e11
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4019
diff
changeset
|
544 |
"/ xpos := margin + ((width - m2 - wChild) // 2). |
0a0d41148e11
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4019
diff
changeset
|
545 |
"/ ] |
0a0d41148e11
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4019
diff
changeset
|
546 |
"/ ] |
0a0d41148e11
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4019
diff
changeset
|
547 |
"/ ] |
0a0d41148e11
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4019
diff
changeset
|
548 |
"/ ] |
0a0d41148e11
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4019
diff
changeset
|
549 |
"/ ] |
0a0d41148e11
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4019
diff
changeset
|
550 |
"/ ]. |
0a0d41148e11
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4019
diff
changeset
|
551 |
"/ newWChild notNil ifTrue:[ |
0a0d41148e11
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4019
diff
changeset
|
552 |
"/ child width:newWChild |
0a0d41148e11
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4019
diff
changeset
|
553 |
"/ ]. |
0a0d41148e11
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4019
diff
changeset
|
554 |
"/ |
0a0d41148e11
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4019
diff
changeset
|
555 |
"/"/ (xpos < 0) ifTrue:[ xpos := 0 ]. |
0a0d41148e11
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4019
diff
changeset
|
556 |
"/ |
0a0d41148e11
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4019
diff
changeset
|
557 |
"/ x2 := xpos + child width - 1. |
0a0d41148e11
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4019
diff
changeset
|
558 |
"/ |
0a0d41148e11
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4019
diff
changeset
|
559 |
"/ (vL == #fit |
0a0d41148e11
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4019
diff
changeset
|
560 |
"/ or:[vL == #fitSpace |
0a0d41148e11
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4019
diff
changeset
|
561 |
"/ or:[resizeToMaxV]]) ifTrue:[ |
0a0d41148e11
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4019
diff
changeset
|
562 |
"/ child origin:(xpos @ (ypos rounded)) |
0a0d41148e11
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4019
diff
changeset
|
563 |
"/ corner:(x2 @ (ypos + hEach - bwChild - 1) rounded). |
0a0d41148e11
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4019
diff
changeset
|
564 |
"/ advance := hEach |
0a0d41148e11
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4019
diff
changeset
|
565 |
"/ ] ifFalse:[ |
0a0d41148e11
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4019
diff
changeset
|
566 |
"/ child origin:(xpos@ypos). |
0a0d41148e11
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4019
diff
changeset
|
567 |
"/ advance := child heightIncludingBorder |
0a0d41148e11
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4019
diff
changeset
|
568 |
"/ ]. |
0a0d41148e11
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4019
diff
changeset
|
569 |
"/ |
0a0d41148e11
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4019
diff
changeset
|
570 |
"/ index == numChilds ifTrue:[ |
0a0d41148e11
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4019
diff
changeset
|
571 |
"/ |y| |
0a0d41148e11
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4019
diff
changeset
|
572 |
"/ |
0a0d41148e11
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4019
diff
changeset
|
573 |
"/ (vL == #topFit or:[vL == #topSpaceFit]) ifTrue:[ |
0a0d41148e11
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4019
diff
changeset
|
574 |
"/ y := height - margin - 1. |
0a0d41148e11
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4019
diff
changeset
|
575 |
"/ vL == #topSpaceFit ifTrue:[ |
0a0d41148e11
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4019
diff
changeset
|
576 |
"/ y := y - space |
0a0d41148e11
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4019
diff
changeset
|
577 |
"/ ]. |
0a0d41148e11
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4019
diff
changeset
|
578 |
"/ child corner:x2 @ y |
0a0d41148e11
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4019
diff
changeset
|
579 |
"/ ]. |
0a0d41148e11
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4019
diff
changeset
|
580 |
"/ ]. |
0a0d41148e11
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4019
diff
changeset
|
581 |
"/ index == 1 ifTrue:[ |
0a0d41148e11
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4019
diff
changeset
|
582 |
"/ (vL == #bottomFit or:[vL == #bottomSpaceFit]) ifTrue:[ |
0a0d41148e11
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4019
diff
changeset
|
583 |
"/ ypos := margin + 0 + (child borderWidth * 2) - bw. |
0a0d41148e11
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4019
diff
changeset
|
584 |
"/ vL == #bottomSpaceFit ifTrue:[ |
0a0d41148e11
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4019
diff
changeset
|
585 |
"/ ypos := ypos + space |
0a0d41148e11
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4019
diff
changeset
|
586 |
"/ ]. |
0a0d41148e11
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4019
diff
changeset
|
587 |
"/ advance := restHeight. |
0a0d41148e11
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4019
diff
changeset
|
588 |
"/ child origin:((child origin x) @ ypos) |
0a0d41148e11
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4019
diff
changeset
|
589 |
"/ corner:((child corner x) @ (ypos+advance)) |
0a0d41148e11
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4019
diff
changeset
|
590 |
"/ ]. |
0a0d41148e11
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4019
diff
changeset
|
591 |
"/ ]. |
0a0d41148e11
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4019
diff
changeset
|
592 |
"/ |
0a0d41148e11
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4019
diff
changeset
|
593 |
"/ ypos := ypos + advance + space. |
0a0d41148e11
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4019
diff
changeset
|
594 |
"/ elementsChangeSize ifTrue:[ |
0a0d41148e11
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4019
diff
changeset
|
595 |
"/ "reinstall dependency that we removed above" |
0a0d41148e11
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4019
diff
changeset
|
596 |
"/ child addDependent:self. |
0a0d41148e11
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4019
diff
changeset
|
597 |
"/ ]. |
0a0d41148e11
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4019
diff
changeset
|
598 |
"/ ] |
3518 | 599 |
|
600 |
"Modified: / 04-09-1995 / 18:43:29 / claus" |
|
601 |
"Modified: / 10-10-2007 / 13:47:56 / cg" |
|
602 |
! ! |
|
603 |
||
604 |
!MultiColumnPanelView methodsFor:'queries'! |
|
605 |
||
606 |
preferredExtent |
|
607 |
"return a good extent, one that makes subviews fit" |
|
608 |
||
609 |
|maxHeight maxWidth maxWidthPerCol w m2 subViews col numCols rowsPerCol| |
|
610 |
||
3760
96d214ff4395
changed #preferredExtent - use explicitExtent instvar
Stefan Vogel <sv@exept.de>
parents:
3518
diff
changeset
|
611 |
"/ If I have an explicit preferredExtent.. |
96d214ff4395
changed #preferredExtent - use explicitExtent instvar
Stefan Vogel <sv@exept.de>
parents:
3518
diff
changeset
|
612 |
explicitExtent notNil ifTrue:[ |
96d214ff4395
changed #preferredExtent - use explicitExtent instvar
Stefan Vogel <sv@exept.de>
parents:
3518
diff
changeset
|
613 |
^ explicitExtent |
96d214ff4395
changed #preferredExtent - use explicitExtent instvar
Stefan Vogel <sv@exept.de>
parents:
3518
diff
changeset
|
614 |
]. |
3518 | 615 |
|
3760
96d214ff4395
changed #preferredExtent - use explicitExtent instvar
Stefan Vogel <sv@exept.de>
parents:
3518
diff
changeset
|
616 |
"/ If I have a cached preferredExtent value.. |
3518 | 617 |
preferredExtent notNil ifTrue:[ |
618 |
^ preferredExtent |
|
619 |
]. |
|
620 |
||
621 |
subViews := self subViewsToConsider. |
|
622 |
(subViews size == 0) ifTrue:[ |
|
623 |
^ super preferredExtent. |
|
624 |
]. |
|
625 |
||
626 |
"compute net height needed" |
|
627 |
numCols := columnWidths size. |
|
628 |
rowsPerCol := Array new:numCols withAll:0. |
|
629 |
maxWidthPerCol := Array new:numCols withAll:0. |
|
630 |
||
631 |
maxHeight := 0. |
|
632 |
col := 1. |
|
633 |
subViews do:[:child | |
|
634 |
|childsPreference| |
|
635 |
||
636 |
childsPreference := child preferredExtent. |
|
637 |
maxHeight := maxHeight max:childsPreference y. |
|
638 |
maxWidthPerCol at:col put:((maxWidthPerCol at:col) max:childsPreference y). |
|
639 |
rowsPerCol at:col put:(rowsPerCol at:col)+1. |
|
640 |
col := col + 1. |
|
641 |
col > numCols ifTrue:[ col := 1 ]. |
|
642 |
]. |
|
643 |
||
4019
bf57f58f13a8
no more direct accesses to borderWidth and borderColor
Claus Gittinger <cg@exept.de>
parents:
3760
diff
changeset
|
644 |
self borderWidth ~~ 0 ifTrue:[ |
3518 | 645 |
maxWidth := maxWidth + (horizontalSpace * 2). |
646 |
]. |
|
647 |
||
648 |
"/ sumOfHeights := sumOfHeights + ((subViews size - 1) * verticalSpace). |
|
649 |
"/ ((vLayout == #topSpace) or:[vLayout == #bottomSpace]) ifTrue:[ |
|
650 |
"/ sumOfHeights := sumOfHeights + verticalSpace |
|
651 |
"/ ] ifFalse:[ |
|
652 |
"/ ((vLayout == #center) or:[vLayout == #spread]) ifTrue:[ |
|
653 |
"/ sumOfHeights := sumOfHeights + (verticalSpace * 2) |
|
654 |
"/ ] |
|
655 |
"/ ]. |
|
656 |
||
657 |
"/ ((hLayout == #leftSpace) or:[hLayout == #rightSpace]) ifTrue:[ |
|
658 |
"/ maxWidth := maxWidth + horizontalSpace |
|
659 |
"/ ] ifFalse:[ |
|
660 |
"/ ((hLayout == #fitSpace) or:[hLayout == #center]) ifTrue:[ |
|
661 |
"/ maxWidth := maxWidth + (horizontalSpace * 2) |
|
662 |
"/ ] |
|
663 |
"/ ]. |
|
664 |
m2 := margin * 2. |
|
665 |
"/ ^ (maxWidth + m2) @ (sumOfHeights + m2) |
|
666 |
||
667 |
w := maxWidthPerCol inject:0 into:[:sumSoFar :thisWidth | sumSoFar + thisWidth]. |
|
668 |
||
669 |
^ (w+m2) @ (rowsPerCol max * maxHeight) + m2 |
|
670 |
||
671 |
"Modified: / 17.1.1998 / 00:18:16 / cg" |
|
672 |
! ! |
|
673 |
||
674 |
!MultiColumnPanelView class methodsFor:'documentation'! |
|
675 |
||
676 |
version |
|
4564
0a0d41148e11
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4019
diff
changeset
|
677 |
^ '$Header: /cvs/stx/stx/libwidg/MultiColumnPanelView.st,v 1.4 2013-04-25 13:10:34 stefan Exp $' |
4019
bf57f58f13a8
no more direct accesses to borderWidth and borderColor
Claus Gittinger <cg@exept.de>
parents:
3760
diff
changeset
|
678 |
! |
bf57f58f13a8
no more direct accesses to borderWidth and borderColor
Claus Gittinger <cg@exept.de>
parents:
3760
diff
changeset
|
679 |
|
bf57f58f13a8
no more direct accesses to borderWidth and borderColor
Claus Gittinger <cg@exept.de>
parents:
3760
diff
changeset
|
680 |
version_CVS |
4564
0a0d41148e11
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4019
diff
changeset
|
681 |
^ '$Header: /cvs/stx/stx/libwidg/MultiColumnPanelView.st,v 1.4 2013-04-25 13:10:34 stefan Exp $' |
3518 | 682 |
! ! |
4564
0a0d41148e11
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4019
diff
changeset
|
683 |