author | Claus Gittinger <cg@exept.de> |
Mon, 23 Oct 2017 19:04:44 +0200 | |
changeset 6222 | b5ed5993de3e |
parent 6173 | f088c49c7389 |
child 6495 | 27d97d8e5ae1 |
permissions | -rw-r--r-- |
0 | 1 |
" |
5 | 2 |
COPYRIGHT (c) 1989 by Claus Gittinger |
59 | 3 |
All Rights Reserved |
0 | 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 |
" |
|
2305
f2850e54b0ab
only access originChanged, extentChanged and cornerChanged
Claus Gittinger <cg@exept.de>
parents:
2033
diff
changeset
|
12 |
"{ Package: 'stx:libwidg' }" |
f2850e54b0ab
only access originChanged, extentChanged and cornerChanged
Claus Gittinger <cg@exept.de>
parents:
2033
diff
changeset
|
13 |
|
5425 | 14 |
"{ NameSpace: Smalltalk }" |
15 |
||
0 | 16 |
PanelView subclass:#VerticalPanelView |
3529 | 17 |
instanceVariableNames:'rowHeight' |
321
00c17944cb00
preferredExtent computation used hSpace instead of vSpace
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
18 |
classVariableNames:'' |
00c17944cb00
preferredExtent computation used hSpace instead of vSpace
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
19 |
poolDictionaries:'' |
00c17944cb00
preferredExtent computation used hSpace instead of vSpace
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
20 |
category:'Views-Layout' |
0 | 21 |
! |
22 |
||
980
6079922a5519
eliminated references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents:
797
diff
changeset
|
23 |
!VerticalPanelView class methodsFor:'documentation'! |
38 | 24 |
|
25 |
copyright |
|
26 |
" |
|
27 |
COPYRIGHT (c) 1989 by Claus Gittinger |
|
59 | 28 |
All Rights Reserved |
38 | 29 |
|
30 |
This software is furnished under a license and may be used |
|
31 |
only in accordance with the terms of that license and with the |
|
32 |
inclusion of the above copyright notice. This software may not |
|
33 |
be provided or otherwise made available to, or used by, any |
|
34 |
other person. No title to or ownership of the software is |
|
35 |
hereby transferred. |
|
36 |
" |
|
37 |
! |
|
38 |
||
39 |
documentation |
|
40 |
" |
|
41 |
a View which arranges its child-views in a vertical column. |
|
63 | 42 |
All real work is done in PanelView - except the layout computation is |
38 | 43 |
redefined here. |
44 |
||
127 | 45 |
The layout is controlled by the instance variables: |
1417
e9dffd6767a6
added ignoreInvisibleComponents support
Claus Gittinger <cg@exept.de>
parents:
1307
diff
changeset
|
46 |
horizontalLayout and verticalLayout |
127 | 47 |
in addition to |
1417
e9dffd6767a6
added ignoreInvisibleComponents support
Claus Gittinger <cg@exept.de>
parents:
1307
diff
changeset
|
48 |
horizontalSpace and verticalSpace. |
77 | 49 |
|
63 | 50 |
The vertical layout can be any of: |
51 |
||
1417
e9dffd6767a6
added ignoreInvisibleComponents support
Claus Gittinger <cg@exept.de>
parents:
1307
diff
changeset
|
52 |
#top arrange elements at the top |
e9dffd6767a6
added ignoreInvisibleComponents support
Claus Gittinger <cg@exept.de>
parents:
1307
diff
changeset
|
53 |
#topSpace arrange elements at the top, start with spacing |
e9dffd6767a6
added ignoreInvisibleComponents support
Claus Gittinger <cg@exept.de>
parents:
1307
diff
changeset
|
54 |
#bottom arrange elements at the bottom |
e9dffd6767a6
added ignoreInvisibleComponents support
Claus Gittinger <cg@exept.de>
parents:
1307
diff
changeset
|
55 |
#bottomSpace arrange elements at the bottom, start with spacing |
e9dffd6767a6
added ignoreInvisibleComponents support
Claus Gittinger <cg@exept.de>
parents:
1307
diff
changeset
|
56 |
#center arrange elements in the center; ignore verticalSpace |
e9dffd6767a6
added ignoreInvisibleComponents support
Claus Gittinger <cg@exept.de>
parents:
1307
diff
changeset
|
57 |
#spread spread elements evenly; ignore verticalSpace |
e9dffd6767a6
added ignoreInvisibleComponents support
Claus Gittinger <cg@exept.de>
parents:
1307
diff
changeset
|
58 |
#spreadSpace spread elements evenly with spacing at ends; ignore verticalSpace |
e9dffd6767a6
added ignoreInvisibleComponents support
Claus Gittinger <cg@exept.de>
parents:
1307
diff
changeset
|
59 |
#fit like #spread, but resize elements for tight packing; ignore verticalSpace |
e9dffd6767a6
added ignoreInvisibleComponents support
Claus Gittinger <cg@exept.de>
parents:
1307
diff
changeset
|
60 |
#fitSpace like #fit, with spacing; ignore verticalSpace |
e9dffd6767a6
added ignoreInvisibleComponents support
Claus Gittinger <cg@exept.de>
parents:
1307
diff
changeset
|
61 |
#topFit like #top, but resize the last element to fit |
e9dffd6767a6
added ignoreInvisibleComponents support
Claus Gittinger <cg@exept.de>
parents:
1307
diff
changeset
|
62 |
#topSpaceFit like #topSpace, but resize the last element to fit |
e9dffd6767a6
added ignoreInvisibleComponents support
Claus Gittinger <cg@exept.de>
parents:
1307
diff
changeset
|
63 |
#bottomFit like #bottom, but resize the first element to fit |
e9dffd6767a6
added ignoreInvisibleComponents support
Claus Gittinger <cg@exept.de>
parents:
1307
diff
changeset
|
64 |
#bottomSpaceFit like #bottomSpace, but resize the first element to fit |
63 | 65 |
|
66 |
the horizontal layout can be: |
|
67 |
||
1417
e9dffd6767a6
added ignoreInvisibleComponents support
Claus Gittinger <cg@exept.de>
parents:
1307
diff
changeset
|
68 |
#left place element at the left |
e9dffd6767a6
added ignoreInvisibleComponents support
Claus Gittinger <cg@exept.de>
parents:
1307
diff
changeset
|
69 |
#leftSpace place element at the left, offset by horizontalSpace |
e9dffd6767a6
added ignoreInvisibleComponents support
Claus Gittinger <cg@exept.de>
parents:
1307
diff
changeset
|
70 |
#center place elements horizontally centered; ignore horizontalSpace |
e9dffd6767a6
added ignoreInvisibleComponents support
Claus Gittinger <cg@exept.de>
parents:
1307
diff
changeset
|
71 |
#right place it at the right |
e9dffd6767a6
added ignoreInvisibleComponents support
Claus Gittinger <cg@exept.de>
parents:
1307
diff
changeset
|
72 |
#rightSpace place it at the right, offset by horizontalSpace |
e9dffd6767a6
added ignoreInvisibleComponents support
Claus Gittinger <cg@exept.de>
parents:
1307
diff
changeset
|
73 |
#fit resize elements horizontally to fit this panel; ignore horizontalSpace |
e9dffd6767a6
added ignoreInvisibleComponents support
Claus Gittinger <cg@exept.de>
parents:
1307
diff
changeset
|
74 |
#fitSpace like #fit, but add spacing; ignore horizontalSpace |
127 | 75 |
|
1417
e9dffd6767a6
added ignoreInvisibleComponents support
Claus Gittinger <cg@exept.de>
parents:
1307
diff
changeset
|
76 |
#leftMax like #left, but resize elements to max of them |
e9dffd6767a6
added ignoreInvisibleComponents support
Claus Gittinger <cg@exept.de>
parents:
1307
diff
changeset
|
77 |
#leftSpaceMax like #leftSpace, but resize elements |
e9dffd6767a6
added ignoreInvisibleComponents support
Claus Gittinger <cg@exept.de>
parents:
1307
diff
changeset
|
78 |
#centerMax like #center, but resize elements |
e9dffd6767a6
added ignoreInvisibleComponents support
Claus Gittinger <cg@exept.de>
parents:
1307
diff
changeset
|
79 |
#rightMax like #right, but resize elements to max of them |
e9dffd6767a6
added ignoreInvisibleComponents support
Claus Gittinger <cg@exept.de>
parents:
1307
diff
changeset
|
80 |
#rightSpaceMax like #rightSpace, but resize elements |
63 | 81 |
|
77 | 82 |
The defaults is #center for both directions. |
127 | 83 |
|
63 | 84 |
The layout is changed by the messages #verticalLayout: and #horizontalLayout:. |
85 |
For backward compatibility (to times, where only vLayout existed), the simple |
|
86 |
#layout: does the same as #verticalLayout:. Do not use this old method. |
|
77 | 87 |
|
127 | 88 |
The panel assumes, that the elements do not resize themselfes, after it |
89 |
became visible. This is not true for all widgets (buttons or labels may |
|
90 |
like to change). If you have changing elements, tell this to the panel |
|
91 |
with 'aPanel elementsChangeSize:true'. In that case, the panel will react |
|
92 |
to size changes, and reorganize things. |
|
93 |
||
77 | 94 |
If none of these layout/space combinations is exactly what you need in |
95 |
your application, create a subclass, and redefine the setChildPositions method. |
|
127 | 96 |
|
97 |
CAVEAT: this class started with #top and no horizontal alignments; |
|
98 |
as time went by, more layouts were added and the setup should be changed |
|
99 |
to use different selectors for space, max-resize and alignment |
|
100 |
(i.e. having more and more layout symbols makes things a bit confusing ...) |
|
585 | 101 |
|
102 |
[see also:] |
|
1417
e9dffd6767a6
added ignoreInvisibleComponents support
Claus Gittinger <cg@exept.de>
parents:
1307
diff
changeset
|
103 |
HorizontalPanelView |
e9dffd6767a6
added ignoreInvisibleComponents support
Claus Gittinger <cg@exept.de>
parents:
1307
diff
changeset
|
104 |
VariableVerticalPanel VariableHorizontalPanel |
e9dffd6767a6
added ignoreInvisibleComponents support
Claus Gittinger <cg@exept.de>
parents:
1307
diff
changeset
|
105 |
Label |
585 | 106 |
|
107 |
[author:] |
|
1417
e9dffd6767a6
added ignoreInvisibleComponents support
Claus Gittinger <cg@exept.de>
parents:
1307
diff
changeset
|
108 |
Claus Gittinger |
63 | 109 |
" |
110 |
! |
|
111 |
||
112 |
examples |
|
113 |
" |
|
77 | 114 |
These examples demonstrate the effect of different layout |
115 |
settings. |
|
116 |
You should try more examples, combining spacing and different |
|
117 |
verticalLayout:/horizontalLayout: combinations. |
|
118 |
||
119 |
||
38 | 120 |
example: default layout (centered) |
3529 | 121 |
[exBegin] |
122 |
|v p b1 b2 b3| |
|
123 |
||
124 |
v := StandardSystemView new. |
|
125 |
v label:'center (default)'. |
|
126 |
p := VerticalPanelView in:v. |
|
127 |
p origin:(0.0 @ 0.0) corner:(1.0 @ 1.0). |
|
128 |
b1 := Button label:'button1' in:p. |
|
129 |
b2 := Button label:'b2' in:p. |
|
130 |
b3 := Button label:'butt3' in:p. |
|
131 |
v extent:100 @ 300. |
|
132 |
v open |
|
133 |
[exEnd] |
|
134 |
||
127 | 135 |
|
3529 | 136 |
example: rows |
137 |
[exBegin] |
|
138 |
|v p b1 b2 b3| |
|
139 |
||
140 |
v := StandardSystemView new. |
|
141 |
v label:'center (default)'. |
|
142 |
p := VerticalPanelView in:v. |
|
143 |
p rowHeight:50. |
|
144 |
p origin:(0.0 @ 0.0) corner:(1.0 @ 1.0). |
|
145 |
b1 := Button label:'button1' in:p. |
|
146 |
b2 := Button label:'b2' in:p. |
|
147 |
b3 := Button label:'butt3' in:p. |
|
148 |
v extent:100 @ 300. |
|
149 |
v open |
|
150 |
[exEnd] |
|
127 | 151 |
|
152 |
||
153 |
example: horizontal centerMax |
|
3529 | 154 |
[exBegin] |
155 |
|v p b1 b2 b3| |
|
127 | 156 |
|
3529 | 157 |
v := StandardSystemView new. |
158 |
v label:'hL=centerMax'. |
|
159 |
p := VerticalPanelView in:v. |
|
160 |
p horizontalLayout:#centerMax. |
|
161 |
p origin:(0.0 @ 0.0) corner:(1.0 @ 1.0). |
|
162 |
b1 := Button label:'button1' in:p. |
|
163 |
b2 := Button label:'b2' in:p. |
|
164 |
b3 := Button label:'butt3' in:p. |
|
165 |
v extent:100 @ 300. |
|
166 |
v open |
|
167 |
[exEnd] |
|
127 | 168 |
|
169 |
||
170 |
example: horizontal leftMax |
|
3529 | 171 |
[exBegin] |
172 |
|v p b1 b2 b3| |
|
127 | 173 |
|
3529 | 174 |
v := StandardSystemView new. |
175 |
v label:'hL=leftMax'. |
|
176 |
p := VerticalPanelView in:v. |
|
177 |
p horizontalLayout:#leftMax. |
|
178 |
p origin:(0.0 @ 0.0) corner:(1.0 @ 1.0). |
|
179 |
b1 := Button label:'button1' in:p. |
|
180 |
b2 := Button label:'b2' in:p. |
|
181 |
b3 := Button label:'butt3' in:p. |
|
182 |
v extent:100 @ 300. |
|
183 |
v open |
|
184 |
[exEnd] |
|
38 | 185 |
|
127 | 186 |
example: horizontal leftSpaceMax |
3529 | 187 |
[exBegin] |
188 |
|v p b1 b2 b3| |
|
127 | 189 |
|
3529 | 190 |
v := StandardSystemView new. |
191 |
v label:'hL=leftMax'. |
|
192 |
p := VerticalPanelView in:v. |
|
193 |
p horizontalLayout:#leftSpaceMax. |
|
194 |
p origin:(0.0 @ 0.0) corner:(1.0 @ 1.0). |
|
195 |
b1 := Button label:'button1' in:p. |
|
196 |
b2 := Button label:'b2' in:p. |
|
197 |
b3 := Button label:'butt3' in:p. |
|
198 |
v extent:100 @ 300. |
|
199 |
v open |
|
200 |
[exEnd] |
|
127 | 201 |
|
202 |
example: horizontal rightMax |
|
3529 | 203 |
[exBegin] |
204 |
|v p b1 b2 b3| |
|
127 | 205 |
|
3529 | 206 |
v := StandardSystemView new. |
207 |
v label:'hL=rightMax'. |
|
208 |
p := VerticalPanelView in:v. |
|
209 |
p horizontalLayout:#rightMax. |
|
210 |
p origin:(0.0 @ 0.0) corner:(1.0 @ 1.0). |
|
211 |
b1 := Button label:'button1' in:p. |
|
212 |
b2 := Button label:'b2' in:p. |
|
213 |
b3 := Button label:'butt3' in:p. |
|
214 |
v extent:100 @ 300. |
|
215 |
v open |
|
216 |
[exEnd] |
|
127 | 217 |
|
218 |
example: horizontal rightSpaceMax |
|
3529 | 219 |
[exBegin] |
220 |
|v p b1 b2 b3| |
|
127 | 221 |
|
3529 | 222 |
v := StandardSystemView new. |
223 |
v label:'hL=rightMaxSpace'. |
|
224 |
p := VerticalPanelView in:v. |
|
225 |
p horizontalLayout:#rightSpaceMax. |
|
226 |
p origin:(0.0 @ 0.0) corner:(1.0 @ 1.0). |
|
227 |
b1 := Button label:'button1' in:p. |
|
228 |
b2 := Button label:'b2' in:p. |
|
229 |
b3 := Button label:'butt3' in:p. |
|
230 |
v extent:100 @ 300. |
|
231 |
v open |
|
232 |
[exEnd] |
|
0 | 233 |
|
63 | 234 |
example: top-layout |
3529 | 235 |
[exBegin] |
236 |
|v p b1 b2 b3| |
|
127 | 237 |
|
3529 | 238 |
v := StandardSystemView new. |
239 |
v label:'vL=top; hL=center (default)'. |
|
240 |
p := VerticalPanelView in:v. |
|
241 |
p verticalLayout:#top. |
|
242 |
p origin:(0.0 @ 0.0) corner:(1.0 @ 1.0). |
|
243 |
b1 := Button label:'button1' in:p. |
|
244 |
b2 := Button label:'butt2' in:p. |
|
245 |
b3 := Button label:'button3' in:p. |
|
246 |
v extent:100 @ 300. |
|
247 |
v open |
|
248 |
[exEnd] |
|
38 | 249 |
|
127 | 250 |
example: topSpace-layout |
3529 | 251 |
[exBegin] |
252 |
|v p b1 b2 b3| |
|
127 | 253 |
|
3529 | 254 |
v := StandardSystemView new. |
255 |
v label:'vL=topSpace; hL=center (default)'. |
|
256 |
p := VerticalPanelView in:v. |
|
257 |
p verticalLayout:#topSpace. |
|
258 |
p origin:(0.0 @ 0.0) corner:(1.0 @ 1.0). |
|
259 |
b1 := Button label:'button1' in:p. |
|
260 |
b2 := Button label:'butt2' in:p. |
|
261 |
b3 := Button label:'button3' in:p. |
|
262 |
v extent:100 @ 300. |
|
263 |
v open |
|
264 |
[exEnd] |
|
38 | 265 |
|
77 | 266 |
example: top-layout; horizontal fit |
3529 | 267 |
[exBegin] |
268 |
|v p b1 b2 b3| |
|
77 | 269 |
|
3529 | 270 |
v := StandardSystemView new. |
271 |
p := VerticalPanelView in:v. |
|
272 |
v label:'vL=top; hL=fit'. |
|
273 |
p verticalLayout:#top. |
|
274 |
p horizontalLayout:#fit. |
|
275 |
p origin:(0.0 @ 0.0) corner:(1.0 @ 1.0). |
|
276 |
b1 := Button label:'button1' in:p. |
|
277 |
b2 := Button label:'butt2' in:p. |
|
278 |
b3 := Button label:'button3' in:p. |
|
279 |
v extent:100 @ 300. |
|
280 |
v open |
|
281 |
[exEnd] |
|
77 | 282 |
|
283 |
example: top-layout; horizontal fit with space |
|
3529 | 284 |
[exBegin] |
285 |
|v p b1 b2 b3| |
|
77 | 286 |
|
3529 | 287 |
v := StandardSystemView new. |
288 |
v label:'vL=top; hL=fitSpace'. |
|
289 |
p := VerticalPanelView in:v. |
|
290 |
p verticalLayout:#top. |
|
291 |
p horizontalLayout:#fitSpace. |
|
292 |
p origin:(0.0 @ 0.0) corner:(1.0 @ 1.0). |
|
293 |
b1 := Button label:'button1' in:p. |
|
294 |
b2 := Button label:'butt2' in:p. |
|
295 |
b3 := Button label:'button3' in:p. |
|
296 |
v extent:100 @ 300. |
|
297 |
v open |
|
298 |
[exEnd] |
|
77 | 299 |
|
127 | 300 |
example: topSpace-layout; horizontal fit with space |
3529 | 301 |
[exBegin] |
302 |
|v p b1 b2 b3| |
|
77 | 303 |
|
3529 | 304 |
v := StandardSystemView new. |
305 |
v label:'vL=topSpace; hL=fitSpace'. |
|
306 |
p := VerticalPanelView in:v. |
|
307 |
p verticalLayout:#topSpace. |
|
308 |
p horizontalLayout:#fitSpace. |
|
309 |
p origin:(0.0 @ 0.0) corner:(1.0 @ 1.0). |
|
310 |
b1 := Button label:'button1' in:p. |
|
311 |
b2 := Button label:'butt2' in:p. |
|
312 |
b3 := Button label:'button3' in:p. |
|
313 |
v extent:100 @ 300. |
|
314 |
v open |
|
315 |
[exEnd] |
|
77 | 316 |
|
63 | 317 |
example: bottom-layout |
3529 | 318 |
[exBegin] |
319 |
|v p b1 b2 b3| |
|
0 | 320 |
|
3529 | 321 |
v := StandardSystemView new. |
322 |
v label:'vL=bottom; hL=center (default)'. |
|
323 |
p := VerticalPanelView in:v. |
|
324 |
p verticalLayout:#bottom. |
|
325 |
p origin:(0.0 @ 0.0) corner:(1.0 @ 1.0). |
|
326 |
b1 := Button label:'button1' in:p. |
|
327 |
b2 := Button label:'butt2' in:p. |
|
328 |
b3 := Button label:'button3' in:p. |
|
329 |
v extent:100 @ 300. |
|
330 |
v open |
|
331 |
[exEnd] |
|
38 | 332 |
|
77 | 333 |
example: bottomSpace-layout |
3529 | 334 |
[exBegin] |
335 |
|v p b1 b2 b3| |
|
77 | 336 |
|
3529 | 337 |
v := StandardSystemView new. |
338 |
v label:'vL=bottomSpace; hL=center (default)'. |
|
339 |
p := VerticalPanelView in:v. |
|
340 |
p verticalLayout:#bottomSpace. |
|
341 |
p origin:(0.0 @ 0.0) corner:(1.0 @ 1.0). |
|
342 |
b1 := Button label:'button1' in:p. |
|
343 |
b2 := Button label:'butt2' in:p. |
|
344 |
b3 := Button label:'button3' in:p. |
|
345 |
v extent:100 @ 300. |
|
346 |
v open |
|
347 |
[exEnd] |
|
77 | 348 |
|
133 | 349 |
example: topFit-layout |
3529 | 350 |
[exBegin] |
351 |
|v p b1 b2 b3| |
|
133 | 352 |
|
3529 | 353 |
v := StandardSystemView new. |
354 |
v label:'vL=topFit; hL=center (default)'. |
|
355 |
p := VerticalPanelView in:v. |
|
356 |
p verticalLayout:#topFit. |
|
357 |
p origin:(0.0 @ 0.0) corner:(1.0 @ 1.0). |
|
358 |
b1 := Button label:'button1' in:p. |
|
359 |
b2 := Button label:'butt2' in:p. |
|
360 |
b3 := Button label:'button3' in:p. |
|
361 |
v extent:100 @ 300. |
|
362 |
v open |
|
363 |
[exEnd] |
|
133 | 364 |
|
365 |
example: topSpaceFit-layout; combined with horizontal #fitSpace |
|
3529 | 366 |
[exBegin] |
367 |
|v p b1 b2 b3| |
|
133 | 368 |
|
3529 | 369 |
v := StandardSystemView new. |
370 |
v label:'vL=topFit; hL=center (default)'. |
|
371 |
p := VerticalPanelView in:v. |
|
372 |
p verticalLayout:#topSpaceFit. |
|
373 |
p horizontalLayout:#fitSpace. |
|
374 |
p origin:(0.0 @ 0.0) corner:(1.0 @ 1.0). |
|
375 |
b1 := Button label:'button1' in:p. |
|
376 |
b2 := Button label:'butt2' in:p. |
|
377 |
b3 := Button label:'button3' in:p. |
|
378 |
v extent:100 @ 300. |
|
379 |
v open |
|
380 |
[exEnd] |
|
133 | 381 |
|
1307
f2ce08878d5e
added #bottomFit & #bottomSpaceFit layouts
Claus Gittinger <cg@exept.de>
parents:
1291
diff
changeset
|
382 |
example: bottomFit-layout (arrange at bottom; resize first to fit) |
3529 | 383 |
[exBegin] |
384 |
|v p b1 b2 b3| |
|
1307
f2ce08878d5e
added #bottomFit & #bottomSpaceFit layouts
Claus Gittinger <cg@exept.de>
parents:
1291
diff
changeset
|
385 |
|
3529 | 386 |
v := StandardSystemView new. |
387 |
v label:'vL=bottomFit; hL=center (default)'. |
|
388 |
p := VerticalPanelView in:v. |
|
389 |
p verticalLayout:#bottomFit. |
|
390 |
p origin:(0.0 @ 0.0) corner:(1.0 @ 1.0). |
|
391 |
b1 := Button label:'button1' in:p. |
|
392 |
b2 := Button label:'butt2' in:p. |
|
393 |
b3 := Button label:'button3' in:p. |
|
394 |
v extent:100 @ 300. |
|
395 |
v open |
|
396 |
[exEnd] |
|
1307
f2ce08878d5e
added #bottomFit & #bottomSpaceFit layouts
Claus Gittinger <cg@exept.de>
parents:
1291
diff
changeset
|
397 |
|
f2ce08878d5e
added #bottomFit & #bottomSpaceFit layouts
Claus Gittinger <cg@exept.de>
parents:
1291
diff
changeset
|
398 |
example: bottomSpaceFit-layout (arrange at bottom; resize first to fit; with spacing |
3529 | 399 |
[exBegin] |
400 |
|v p b1 b2 b3| |
|
1307
f2ce08878d5e
added #bottomFit & #bottomSpaceFit layouts
Claus Gittinger <cg@exept.de>
parents:
1291
diff
changeset
|
401 |
|
3529 | 402 |
v := StandardSystemView new. |
403 |
v label:'vL=bottomSpaceFit; hL=center (default)'. |
|
404 |
p := VerticalPanelView in:v. |
|
405 |
p verticalLayout:#bottomSpaceFit. |
|
406 |
p origin:(0.0 @ 0.0) corner:(1.0 @ 1.0). |
|
407 |
b1 := Button label:'button1' in:p. |
|
408 |
b2 := Button label:'butt2' in:p. |
|
409 |
b3 := Button label:'button3' in:p. |
|
410 |
v extent:100 @ 300. |
|
411 |
v open |
|
412 |
[exEnd] |
|
1307
f2ce08878d5e
added #bottomFit & #bottomSpaceFit layouts
Claus Gittinger <cg@exept.de>
parents:
1291
diff
changeset
|
413 |
|
38 | 414 |
example: spread-layout |
3529 | 415 |
[exBegin] |
416 |
|v p b1 b2 b3| |
|
38 | 417 |
|
3529 | 418 |
v := StandardSystemView new. |
419 |
v label:'vL=spread; hL=center (default)'. |
|
420 |
p := VerticalPanelView in:v. |
|
421 |
p verticalLayout:#spread. |
|
422 |
p origin:(0.0 @ 0.0) corner:(1.0 @ 1.0). |
|
423 |
b1 := Button label:'button1' in:p. |
|
424 |
b2 := Button label:'butt2' in:p. |
|
425 |
b3 := Button label:'button3' in:p. |
|
426 |
v extent:100 @ 300. |
|
427 |
v open |
|
428 |
[exEnd] |
|
77 | 429 |
|
430 |
example: spreadSpace-layout |
|
3529 | 431 |
[exBegin] |
432 |
|v p b1 b2 b3| |
|
77 | 433 |
|
3529 | 434 |
v := StandardSystemView new. |
435 |
v label:'vL=spreadSpace; hL=center (default)'. |
|
436 |
p := VerticalPanelView in:v. |
|
437 |
p verticalLayout:#spreadSpace. |
|
438 |
p origin:(0.0 @ 0.0) corner:(1.0 @ 1.0). |
|
439 |
b1 := Button label:'button1' in:p. |
|
440 |
b2 := Button label:'butt2' in:p. |
|
441 |
b3 := Button label:'button3' in:p. |
|
442 |
v extent:100 @ 300. |
|
443 |
v open |
|
444 |
[exEnd] |
|
77 | 445 |
|
446 |
example: fit-layout |
|
3529 | 447 |
[exBegin] |
448 |
|v p b1 b2 b3| |
|
77 | 449 |
|
3529 | 450 |
v := StandardSystemView new. |
451 |
v label:'vL=fit; hL=center (default)'. |
|
452 |
p := VerticalPanelView in:v. |
|
453 |
p verticalLayout:#fit. |
|
454 |
p origin:(0.0 @ 0.0) corner:(1.0 @ 1.0). |
|
455 |
b1 := Button label:'button1' in:p. |
|
456 |
b2 := Button label:'butt2' in:p. |
|
457 |
b3 := Button label:'button3' in:p. |
|
458 |
v extent:100 @ 300. |
|
459 |
v open |
|
460 |
[exEnd] |
|
77 | 461 |
|
462 |
example: fitSpace-layout |
|
3529 | 463 |
[exBegin] |
464 |
|v p b1 b2 b3| |
|
77 | 465 |
|
3529 | 466 |
v := StandardSystemView new. |
467 |
v label:'vL=fitSpace; hL=center (default)'. |
|
468 |
p := VerticalPanelView in:v. |
|
469 |
p verticalLayout:#fitSpace. |
|
470 |
p origin:(0.0 @ 0.0) corner:(1.0 @ 1.0). |
|
471 |
b1 := Button label:'button1' in:p. |
|
472 |
b2 := Button label:'butt2' in:p. |
|
473 |
b3 := Button label:'button3' in:p. |
|
474 |
v extent:100 @ 300. |
|
475 |
v open |
|
476 |
[exEnd] |
|
77 | 477 |
|
478 |
example: fully fitSpace |
|
3529 | 479 |
[exBegin] |
480 |
|v p b1 b2 b3| |
|
77 | 481 |
|
3529 | 482 |
v := StandardSystemView new. |
483 |
v label:'vL=fitSpace; hL=fitSpace'. |
|
484 |
p := VerticalPanelView in:v. |
|
485 |
p verticalLayout:#fitSpace. |
|
486 |
p horizontalLayout:#fitSpace. |
|
487 |
p origin:(0.0 @ 0.0) corner:(1.0 @ 1.0). |
|
488 |
b1 := Button label:'button1' in:p. |
|
489 |
b2 := Button label:'butt2' in:p. |
|
490 |
b3 := Button label:'button3' in:p. |
|
491 |
v extent:100 @ 300. |
|
492 |
v open |
|
493 |
[exEnd] |
|
77 | 494 |
|
131 | 495 |
example: combine fully fitSpace with scaling button labels |
3529 | 496 |
[exBegin] |
497 |
|v p b1 b2 b3| |
|
131 | 498 |
|
3529 | 499 |
v := StandardSystemView new. |
500 |
v label:'vL=fitSpace; hL=fitSpace'. |
|
501 |
p := VerticalPanelView in:v. |
|
502 |
p verticalLayout:#fitSpace. |
|
503 |
p horizontalLayout:#fitSpace. |
|
504 |
p origin:(0.0 @ 0.0) corner:(1.0 @ 1.0). |
|
505 |
b1 := Button label:'button1' in:p. |
|
506 |
b1 adjust:#fit. |
|
507 |
b2 := Button label:'butt2' in:p. |
|
508 |
b2 adjust:#fit. |
|
509 |
b3 := Button label:'button3' in:p. |
|
510 |
b3 adjust:#fit. |
|
511 |
v extent:100 @ 300. |
|
512 |
v open |
|
513 |
[exEnd] |
|
131 | 514 |
|
63 | 515 |
example: from top, each at left: |
3529 | 516 |
[exBegin] |
517 |
|v p b1 b2 b3| |
|
63 | 518 |
|
3529 | 519 |
v := StandardSystemView new. |
520 |
v label:'vL=top; hL=left'. |
|
521 |
p := VerticalPanelView in:v. |
|
522 |
p verticalLayout:#top. |
|
523 |
p horizontalLayout:#left. |
|
524 |
p origin:(0.0 @ 0.0) corner:(1.0 @ 1.0). |
|
525 |
b1 := Button label:'button1' in:p. |
|
526 |
b2 := Button label:'butt2' in:p. |
|
527 |
b3 := Button label:'button3' in:p. |
|
528 |
v extent:100 @ 300. |
|
529 |
v open |
|
530 |
[exEnd] |
|
77 | 531 |
|
127 | 532 |
example: center, right: |
3529 | 533 |
[exBegin] |
534 |
|v p b1 b2 b3| |
|
63 | 535 |
|
3529 | 536 |
v := StandardSystemView new. |
537 |
v label:'vL=center; hL=right'. |
|
538 |
p := VerticalPanelView in:v. |
|
539 |
p verticalLayout:#center. |
|
540 |
p horizontalLayout:#right. |
|
541 |
p origin:(0.0 @ 0.0) corner:(1.0 @ 1.0). |
|
542 |
b1 := Button label:'button1' in:p. |
|
543 |
b2 := Button label:'butt2' in:p. |
|
544 |
b3 := Button label:'button3' in:p. |
|
545 |
v extent:100 @ 300. |
|
546 |
v open |
|
547 |
[exEnd] |
|
77 | 548 |
|
549 |
example: a panel in a panel |
|
3529 | 550 |
[exBegin] |
551 |
|v hp p b1 b2 b3| |
|
77 | 552 |
|
3529 | 553 |
v := StandardSystemView new. |
63 | 554 |
|
3529 | 555 |
hp := HorizontalPanelView in:v. |
556 |
hp verticalLayout:#fit. |
|
557 |
hp horizontalLayout:#fitSpace. |
|
558 |
hp origin:(0.0 @ 0.0) corner:(1.0 @ 1.0). |
|
63 | 559 |
|
3529 | 560 |
1 to:3 do:[:i | |
561 |
p := VerticalPanelView in:hp. |
|
562 |
p borderWidth:0. |
|
563 |
p verticalLayout:#fitSpace. |
|
564 |
p horizontalLayout:#fit. |
|
565 |
b1 := Button label:('button1-' , i printString) in:p. |
|
566 |
b2 := Button label:('butt2-' , i printString) in:p. |
|
567 |
b3 := Button label:('button3-' , i printString) in:p. |
|
568 |
]. |
|
63 | 569 |
|
3529 | 570 |
v extent:300 @ 100. |
571 |
v open |
|
572 |
[exEnd] |
|
0 | 573 |
|
125 | 574 |
example: checkToggles in a panel |
3529 | 575 |
[exBegin] |
576 |
|panel| |
|
63 | 577 |
|
3529 | 578 |
panel := VerticalPanelView new. |
579 |
panel horizontalLayout:#left. |
|
63 | 580 |
|
3529 | 581 |
panel add:((CheckBox on:true asValue) label:'this is toggle number 1'; resize). |
582 |
panel add:((CheckBox on:false asValue) label:'nr 2 '; resize). |
|
583 |
panel add:((CheckBox on:true asValue) label:'number 3 '; resize). |
|
0 | 584 |
|
3529 | 585 |
panel extent:(panel preferredExtent). |
586 |
panel open |
|
587 |
[exEnd] |
|
1307
f2ce08878d5e
added #bottomFit & #bottomSpaceFit layouts
Claus Gittinger <cg@exept.de>
parents:
1291
diff
changeset
|
588 |
example: the topFit & bottomFit layouts are great to combine |
3529 | 589 |
labels or enterFields with a selectionInList or textView: |
590 |
[exBegin] |
|
591 |
|panel| |
|
1307
f2ce08878d5e
added #bottomFit & #bottomSpaceFit layouts
Claus Gittinger <cg@exept.de>
parents:
1291
diff
changeset
|
592 |
|
3529 | 593 |
panel := VerticalPanelView new. |
594 |
panel horizontalLayout:#fit. |
|
595 |
panel verticalLayout:#topFit. |
|
1307
f2ce08878d5e
added #bottomFit & #bottomSpaceFit layouts
Claus Gittinger <cg@exept.de>
parents:
1291
diff
changeset
|
596 |
|
3529 | 597 |
panel add:(Label new label:'this is label number 1'; font:(Font family:'courier' size:16)). |
598 |
panel add:(EditField new). |
|
599 |
panel add:(Label new label:'this is label number 1'). |
|
600 |
panel add:(ScrollableView for:SelectionInListView). |
|
1307
f2ce08878d5e
added #bottomFit & #bottomSpaceFit layouts
Claus Gittinger <cg@exept.de>
parents:
1291
diff
changeset
|
601 |
|
3529 | 602 |
panel extent:(panel preferredExtent). |
603 |
panel open |
|
604 |
[exEnd] |
|
125 | 605 |
" |
202 | 606 |
! ! |
607 |
||
5228 | 608 |
!VerticalPanelView class methodsFor:'queries'! |
609 |
||
610 |
possibleHorizontalLayouts |
|
611 |
^ #( |
|
612 |
#left |
|
613 |
#leftSpace |
|
614 |
#center |
|
615 |
#right |
|
616 |
#rightSpace |
|
617 |
#fit |
|
618 |
#fitSpace |
|
619 |
#leftMax |
|
620 |
#leftSpaceMax |
|
621 |
#centerMax |
|
622 |
#rightMax |
|
623 |
#rightSpaceMax |
|
624 |
) |
|
625 |
! |
|
626 |
||
627 |
possibleVerticalLayouts |
|
628 |
^ #( |
|
629 |
#top |
|
630 |
#topSpace |
|
631 |
#bottom |
|
632 |
#bottomSpace |
|
633 |
#center |
|
634 |
#spread |
|
635 |
#spreadSpace |
|
636 |
#fit |
|
637 |
#fitSpace |
|
638 |
#topFit |
|
639 |
#topSpaceFit |
|
640 |
#bottomFit |
|
641 |
#bottomSpaceFit |
|
642 |
) |
|
643 |
! ! |
|
644 |
||
202 | 645 |
!VerticalPanelView methodsFor:'accessing'! |
646 |
||
647 |
horizontalLayout |
|
648 |
"return the horizontal layout as symbol. |
|
649 |
the returned value is one of |
|
650 |
#left place element at the left |
|
651 |
#leftSpace place element at the left, offset by horizontalSpace |
|
652 |
#center place elements horizontally centered; ignore horizontalSpace |
|
653 |
#right place it at the right |
|
654 |
#rightSpace place it at the right, offset by horizontalSpace |
|
655 |
#fit resize elements horizontally to fit this panel; ignore horizontalSpace |
|
656 |
#fitSpace like #fit, but add spacing; ignore horizontalSpace |
|
657 |
||
658 |
#leftMax like #left, but resize elements to max of them |
|
659 |
#leftSpaceMax like #leftSpace, but resize elements |
|
660 |
#centerMax like #center, but resize elements |
|
661 |
#rightMax like #right, but resize elements to max of them |
|
662 |
#rightSpaceMax like #rightSpace, but resize elements |
|
663 |
the default is #centered |
|
664 |
" |
|
665 |
||
666 |
^ hLayout |
|
667 |
! |
|
668 |
||
669 |
horizontalLayout:aSymbol |
|
670 |
"change the horizontal layout as symbol. |
|
671 |
The argument, aSymbol must be one of: |
|
672 |
#left place element at the left |
|
673 |
#leftSpace place element at the left, offset by horizontalSpace |
|
674 |
#center place elements horizontally centered; ignore horizontalSpace |
|
675 |
#right place it at the right |
|
676 |
#rightSpace place it at the right, offset by horizontalSpace |
|
677 |
#fit resize elements horizontally to fit this panel; ignore horizontalSpace |
|
678 |
#fitSpace like #fit, but add spacing; ignore horizontalSpace |
|
679 |
||
680 |
#leftMax like #left, but resize elements to max of them |
|
681 |
#leftSpaceMax like #leftSpace, but resize elements |
|
682 |
#centerMax like #center, but resize elements |
|
683 |
#rightMax like #right, but resize elements to max of them |
|
684 |
#rightSpaceMax like #rightSpace, but resize elements |
|
685 |
the default (if never changed) is #centered |
|
686 |
" |
|
687 |
||
688 |
(hLayout ~~ aSymbol) ifTrue:[ |
|
689 |
hLayout := aSymbol. |
|
690 |
self layoutChanged |
|
691 |
] |
|
692 |
! |
|
693 |
||
694 |
layout:something |
|
695 |
"OBSOLETE compatibility interface. Will vanish. |
|
696 |
leftover for historic reasons - do not use any more. |
|
697 |
In the meantime, try to figure out what is meant ... a kludge" |
|
698 |
||
2370 | 699 |
<resource:#obsolete> |
700 |
||
202 | 701 |
something isLayout ifTrue:[^ super layout:something]. |
702 |
||
703 |
self obsoleteMethodWarning:'use #verticalLayout:'. |
|
704 |
^ self verticalLayout:something |
|
705 |
||
706 |
"Modified: 31.8.1995 / 23:08:54 / claus" |
|
707 |
! |
|
708 |
||
3529 | 709 |
rowHeight:something |
710 |
rowHeight := something. |
|
711 |
! |
|
712 |
||
202 | 713 |
verticalLayout |
714 |
"return the vertical layout as a symbol. |
|
715 |
the returned value is one of |
|
1417
e9dffd6767a6
added ignoreInvisibleComponents support
Claus Gittinger <cg@exept.de>
parents:
1307
diff
changeset
|
716 |
#top arrange elements at the top |
e9dffd6767a6
added ignoreInvisibleComponents support
Claus Gittinger <cg@exept.de>
parents:
1307
diff
changeset
|
717 |
#topSpace arrange elements at the top, start with spacing |
e9dffd6767a6
added ignoreInvisibleComponents support
Claus Gittinger <cg@exept.de>
parents:
1307
diff
changeset
|
718 |
#bottom arrange elements at the bottom |
e9dffd6767a6
added ignoreInvisibleComponents support
Claus Gittinger <cg@exept.de>
parents:
1307
diff
changeset
|
719 |
#bottomSpace arrange elements at the bottom, start with spacing |
e9dffd6767a6
added ignoreInvisibleComponents support
Claus Gittinger <cg@exept.de>
parents:
1307
diff
changeset
|
720 |
#center arrange elements in the center; ignore verticalSpace |
e9dffd6767a6
added ignoreInvisibleComponents support
Claus Gittinger <cg@exept.de>
parents:
1307
diff
changeset
|
721 |
#spread spread elements evenly; ignore verticalSpace |
e9dffd6767a6
added ignoreInvisibleComponents support
Claus Gittinger <cg@exept.de>
parents:
1307
diff
changeset
|
722 |
#spreadSpace spread elements evenly with spacing at ends; ignore verticalSpace |
e9dffd6767a6
added ignoreInvisibleComponents support
Claus Gittinger <cg@exept.de>
parents:
1307
diff
changeset
|
723 |
#fit like #spread, but resize elements for tight packing; ignore verticalSpace |
e9dffd6767a6
added ignoreInvisibleComponents support
Claus Gittinger <cg@exept.de>
parents:
1307
diff
changeset
|
724 |
#fitSpace like #fit, with spacing; ignore verticalSpace |
e9dffd6767a6
added ignoreInvisibleComponents support
Claus Gittinger <cg@exept.de>
parents:
1307
diff
changeset
|
725 |
#topFit like #top, but resize the last element to fit |
e9dffd6767a6
added ignoreInvisibleComponents support
Claus Gittinger <cg@exept.de>
parents:
1307
diff
changeset
|
726 |
#topSpaceFit like #topSpace, but resize the last element to fit |
e9dffd6767a6
added ignoreInvisibleComponents support
Claus Gittinger <cg@exept.de>
parents:
1307
diff
changeset
|
727 |
#bottomFit like #bottom, but resize the first element to fit |
e9dffd6767a6
added ignoreInvisibleComponents support
Claus Gittinger <cg@exept.de>
parents:
1307
diff
changeset
|
728 |
#bottomSpaceFit like #bottomSpace, but extend the first element to fit |
202 | 729 |
the default is #centered |
730 |
" |
|
731 |
||
732 |
^ vLayout |
|
1307
f2ce08878d5e
added #bottomFit & #bottomSpaceFit layouts
Claus Gittinger <cg@exept.de>
parents:
1291
diff
changeset
|
733 |
|
f2ce08878d5e
added #bottomFit & #bottomSpaceFit layouts
Claus Gittinger <cg@exept.de>
parents:
1291
diff
changeset
|
734 |
"Modified: 17.8.1997 / 15:20:13 / cg" |
202 | 735 |
! |
736 |
||
737 |
verticalLayout:aSymbol |
|
738 |
"change the vertical layout as a symbol. |
|
739 |
The argument, aSymbol must be one of: |
|
1417
e9dffd6767a6
added ignoreInvisibleComponents support
Claus Gittinger <cg@exept.de>
parents:
1307
diff
changeset
|
740 |
#top arrange elements at the top |
e9dffd6767a6
added ignoreInvisibleComponents support
Claus Gittinger <cg@exept.de>
parents:
1307
diff
changeset
|
741 |
#topSpace arrange elements at the top, start with spacing |
e9dffd6767a6
added ignoreInvisibleComponents support
Claus Gittinger <cg@exept.de>
parents:
1307
diff
changeset
|
742 |
#bottom arrange elements at the bottom |
e9dffd6767a6
added ignoreInvisibleComponents support
Claus Gittinger <cg@exept.de>
parents:
1307
diff
changeset
|
743 |
#bottomSpace arrange elements at the bottom, start with spacing |
e9dffd6767a6
added ignoreInvisibleComponents support
Claus Gittinger <cg@exept.de>
parents:
1307
diff
changeset
|
744 |
#center arrange elements in the center; ignore verticalSpace |
e9dffd6767a6
added ignoreInvisibleComponents support
Claus Gittinger <cg@exept.de>
parents:
1307
diff
changeset
|
745 |
#spread spread elements evenly; ignore verticalSpace |
e9dffd6767a6
added ignoreInvisibleComponents support
Claus Gittinger <cg@exept.de>
parents:
1307
diff
changeset
|
746 |
#spreadSpace spread elements evenly with spacing at ends; ignore verticalSpace |
e9dffd6767a6
added ignoreInvisibleComponents support
Claus Gittinger <cg@exept.de>
parents:
1307
diff
changeset
|
747 |
#fit like #spread, but resize elements for tight packing; ignore verticalSpace |
e9dffd6767a6
added ignoreInvisibleComponents support
Claus Gittinger <cg@exept.de>
parents:
1307
diff
changeset
|
748 |
#fitSpace like #fit, with spacing; ignore verticalSpace |
e9dffd6767a6
added ignoreInvisibleComponents support
Claus Gittinger <cg@exept.de>
parents:
1307
diff
changeset
|
749 |
#topFit like #top, but resize the last element to fit |
e9dffd6767a6
added ignoreInvisibleComponents support
Claus Gittinger <cg@exept.de>
parents:
1307
diff
changeset
|
750 |
#topSpaceFit like #topSpace, but resize the last element to fit |
e9dffd6767a6
added ignoreInvisibleComponents support
Claus Gittinger <cg@exept.de>
parents:
1307
diff
changeset
|
751 |
#bottomFit like #bottom, but resize the first element to fit |
e9dffd6767a6
added ignoreInvisibleComponents support
Claus Gittinger <cg@exept.de>
parents:
1307
diff
changeset
|
752 |
#bottomSpaceFit like #bottomSpace, but extend the first element to fit |
202 | 753 |
the default (if never changed) is #centered |
754 |
" |
|
755 |
||
756 |
(vLayout ~~ aSymbol) ifTrue:[ |
|
1417
e9dffd6767a6
added ignoreInvisibleComponents support
Claus Gittinger <cg@exept.de>
parents:
1307
diff
changeset
|
757 |
vLayout := aSymbol. |
e9dffd6767a6
added ignoreInvisibleComponents support
Claus Gittinger <cg@exept.de>
parents:
1307
diff
changeset
|
758 |
self layoutChanged |
202 | 759 |
] |
1307
f2ce08878d5e
added #bottomFit & #bottomSpaceFit layouts
Claus Gittinger <cg@exept.de>
parents:
1291
diff
changeset
|
760 |
|
f2ce08878d5e
added #bottomFit & #bottomSpaceFit layouts
Claus Gittinger <cg@exept.de>
parents:
1291
diff
changeset
|
761 |
"Modified: 17.8.1997 / 15:19:58 / cg" |
0 | 762 |
! ! |
763 |
||
764 |
!VerticalPanelView methodsFor:'layout'! |
|
765 |
||
766 |
setChildPositions |
|
767 |
"(re)compute position of every child" |
|
768 |
||
1307
f2ce08878d5e
added #bottomFit & #bottomSpaceFit layouts
Claus Gittinger <cg@exept.de>
parents:
1291
diff
changeset
|
769 |
|ypos space sumOfHeights numChilds l hEach hInside hL vL |
4562
45ac476a6250
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4021
diff
changeset
|
770 |
maxWidth maxHeight resizeToMaxV resizeToMaxH m2 subViews restHeight y2 bw| |
0 | 771 |
|
1417
e9dffd6767a6
added ignoreInvisibleComponents support
Claus Gittinger <cg@exept.de>
parents:
1307
diff
changeset
|
772 |
subViews := self subViewsToConsider. |
1042 | 773 |
subViews size == 0 ifTrue:[^ self]. |
774 |
||
4021
48c8526db338
no more direct accesses to borderWidth and borderColor
Claus Gittinger <cg@exept.de>
parents:
3931
diff
changeset
|
775 |
bw := self borderWidth. |
48c8526db338
no more direct accesses to borderWidth and borderColor
Claus Gittinger <cg@exept.de>
parents:
3931
diff
changeset
|
776 |
|
3502 | 777 |
"/ self extentChangedFlag ifTrue:[ |
778 |
"/ ext := self computeExtent. |
|
779 |
"/ width := ext x. |
|
780 |
"/ height := ext y. |
|
781 |
"/ ]. |
|
0 | 782 |
|
783 |
space := verticalSpace. |
|
63 | 784 |
numChilds := subViews size. |
1307
f2ce08878d5e
added #bottomFit & #bottomSpaceFit layouts
Claus Gittinger <cg@exept.de>
parents:
1291
diff
changeset
|
785 |
|
380
6eb402d01ae0
looks better if panels level is ~~ 0 AND subview has 0 level
Claus Gittinger <cg@exept.de>
parents:
341
diff
changeset
|
786 |
m2 := margin * 2. |
4021
48c8526db338
no more direct accesses to borderWidth and borderColor
Claus Gittinger <cg@exept.de>
parents:
3931
diff
changeset
|
787 |
hInside := height - m2 + (bw*2) - subViews last borderWidth. |
0 | 788 |
|
1307
f2ce08878d5e
added #bottomFit & #bottomSpaceFit layouts
Claus Gittinger <cg@exept.de>
parents:
1291
diff
changeset
|
789 |
hL := hLayout. |
f2ce08878d5e
added #bottomFit & #bottomSpaceFit layouts
Claus Gittinger <cg@exept.de>
parents:
1291
diff
changeset
|
790 |
vL := vLayout. |
f2ce08878d5e
added #bottomFit & #bottomSpaceFit layouts
Claus Gittinger <cg@exept.de>
parents:
1291
diff
changeset
|
791 |
|
f2ce08878d5e
added #bottomFit & #bottomSpaceFit layouts
Claus Gittinger <cg@exept.de>
parents:
1291
diff
changeset
|
792 |
resizeToMaxV := false. |
f2ce08878d5e
added #bottomFit & #bottomSpaceFit layouts
Claus Gittinger <cg@exept.de>
parents:
1291
diff
changeset
|
793 |
(vL endsWith:'Max') ifTrue:[ |
1431
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1417
diff
changeset
|
794 |
resizeToMaxV := true. |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1417
diff
changeset
|
795 |
hEach := maxHeight := subViews inject:0 into:[:maxSoFar :child | maxSoFar max:child heightIncludingBorder]. |
4562
45ac476a6250
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4021
diff
changeset
|
796 |
vL := (vL copyButLast:3) asSymbol. |
1307
f2ce08878d5e
added #bottomFit & #bottomSpaceFit layouts
Claus Gittinger <cg@exept.de>
parents:
1291
diff
changeset
|
797 |
]. |
f2ce08878d5e
added #bottomFit & #bottomSpaceFit layouts
Claus Gittinger <cg@exept.de>
parents:
1291
diff
changeset
|
798 |
|
f2ce08878d5e
added #bottomFit & #bottomSpaceFit layouts
Claus Gittinger <cg@exept.de>
parents:
1291
diff
changeset
|
799 |
numChilds == 1 ifTrue:[ |
1431
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1417
diff
changeset
|
800 |
(vL == #topFit or:[vL == #bottomFit]) ifTrue:[ |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1417
diff
changeset
|
801 |
vL := #fit |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1417
diff
changeset
|
802 |
]. |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1417
diff
changeset
|
803 |
(vL == #topSpaceFit or:[vL == #bottomSpaceFit]) ifTrue:[ |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1417
diff
changeset
|
804 |
vL := #fitSpace |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1417
diff
changeset
|
805 |
]. |
1307
f2ce08878d5e
added #bottomFit & #bottomSpaceFit layouts
Claus Gittinger <cg@exept.de>
parents:
1291
diff
changeset
|
806 |
]. |
f2ce08878d5e
added #bottomFit & #bottomSpaceFit layouts
Claus Gittinger <cg@exept.de>
parents:
1291
diff
changeset
|
807 |
|
f2ce08878d5e
added #bottomFit & #bottomSpaceFit layouts
Claus Gittinger <cg@exept.de>
parents:
1291
diff
changeset
|
808 |
vL == #fitSpace ifTrue:[ |
1431
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1417
diff
changeset
|
809 |
" |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1417
diff
changeset
|
810 |
adjust childs extents and set origins. |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1417
diff
changeset
|
811 |
Be careful to avoid accumulation of rounding errors |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1417
diff
changeset
|
812 |
" |
6173 | 813 |
hEach := (hInside - ((numChilds + 1) * space)) / numChilds. |
4021
48c8526db338
no more direct accesses to borderWidth and borderColor
Claus Gittinger <cg@exept.de>
parents:
3931
diff
changeset
|
814 |
ypos := space + margin - bw. |
63 | 815 |
] ifFalse:[ |
1431
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1417
diff
changeset
|
816 |
vL == #fit ifTrue:[ |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1417
diff
changeset
|
817 |
" |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1417
diff
changeset
|
818 |
adjust childs extents and set origins. |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1417
diff
changeset
|
819 |
Be careful to avoid accumulation of rounding errors |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1417
diff
changeset
|
820 |
" |
6173 | 821 |
hEach := (hInside - ((numChilds - 1) * space)) / numChilds. |
4021
48c8526db338
no more direct accesses to borderWidth and borderColor
Claus Gittinger <cg@exept.de>
parents:
3931
diff
changeset
|
822 |
ypos := margin - bw. |
1431
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1417
diff
changeset
|
823 |
] ifFalse:[ |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1417
diff
changeset
|
824 |
l := vL. |
1307
f2ce08878d5e
added #bottomFit & #bottomSpaceFit layouts
Claus Gittinger <cg@exept.de>
parents:
1291
diff
changeset
|
825 |
|
1431
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1417
diff
changeset
|
826 |
" |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1417
diff
changeset
|
827 |
compute net height needed |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1417
diff
changeset
|
828 |
" |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1417
diff
changeset
|
829 |
resizeToMaxV ifTrue:[ |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1417
diff
changeset
|
830 |
sumOfHeights := subViews inject:0 into:[:sumSoFar :child | sumSoFar + maxHeight + (child borderWidth*2)]. |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1417
diff
changeset
|
831 |
] ifFalse:[ |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1417
diff
changeset
|
832 |
sumOfHeights := subViews inject:0 into:[:sumSoFar :child | sumSoFar + child heightIncludingBorder]. |
2031
6f28b9951713
oops - bug in setChildPositions leading to recursion
Claus Gittinger <cg@exept.de>
parents:
1431
diff
changeset
|
833 |
|
6f28b9951713
oops - bug in setChildPositions leading to recursion
Claus Gittinger <cg@exept.de>
parents:
1431
diff
changeset
|
834 |
"/ adjust - do not include height of last(first) element if doing a fit |
6f28b9951713
oops - bug in setChildPositions leading to recursion
Claus Gittinger <cg@exept.de>
parents:
1431
diff
changeset
|
835 |
(vL == #topFit or:[vL == #topSpaceFit]) ifTrue:[ |
6f28b9951713
oops - bug in setChildPositions leading to recursion
Claus Gittinger <cg@exept.de>
parents:
1431
diff
changeset
|
836 |
sumOfHeights := sumOfHeights - subViews last heightIncludingBorder. |
6f28b9951713
oops - bug in setChildPositions leading to recursion
Claus Gittinger <cg@exept.de>
parents:
1431
diff
changeset
|
837 |
] ifFalse:[ |
6f28b9951713
oops - bug in setChildPositions leading to recursion
Claus Gittinger <cg@exept.de>
parents:
1431
diff
changeset
|
838 |
(vL == #bottomFit or:[vL == #bottomSpaceFit]) ifTrue:[ |
6f28b9951713
oops - bug in setChildPositions leading to recursion
Claus Gittinger <cg@exept.de>
parents:
1431
diff
changeset
|
839 |
sumOfHeights := sumOfHeights - subViews first heightIncludingBorder. |
6f28b9951713
oops - bug in setChildPositions leading to recursion
Claus Gittinger <cg@exept.de>
parents:
1431
diff
changeset
|
840 |
] |
6f28b9951713
oops - bug in setChildPositions leading to recursion
Claus Gittinger <cg@exept.de>
parents:
1431
diff
changeset
|
841 |
]. |
1431
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1417
diff
changeset
|
842 |
]. |
1307
f2ce08878d5e
added #bottomFit & #bottomSpaceFit layouts
Claus Gittinger <cg@exept.de>
parents:
1291
diff
changeset
|
843 |
|
5425 | 844 |
restHeight := hInside - sumOfHeights "- (numChilds-1*space)". |
1431
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1417
diff
changeset
|
845 |
((l == #center) and:[numChilds == 1]) ifTrue:[l := #spread]. |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1417
diff
changeset
|
846 |
(l == #spread and:[numChilds == 1]) ifTrue:[l := #spreadSpace]. |
59 | 847 |
|
1431
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1417
diff
changeset
|
848 |
" |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1417
diff
changeset
|
849 |
compute position of topmost subview and space between them; |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1417
diff
changeset
|
850 |
if they do hardly fit, leave no space between them |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1417
diff
changeset
|
851 |
" |
3675
dc94ab5c7abb
spacing computation fixed (boundary condition, spacing reduction)
Claus Gittinger <cg@exept.de>
parents:
3529
diff
changeset
|
852 |
((sumOfHeights > (height - m2)) |
1431
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1417
diff
changeset
|
853 |
and:[l ~~ #fixTopSpace and:[l ~~ #fixTop]]) ifTrue:[ |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1417
diff
changeset
|
854 |
" |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1417
diff
changeset
|
855 |
if we have not enough space for all the elements, |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1417
diff
changeset
|
856 |
fill them tight, and show what can be shown (at least) |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1417
diff
changeset
|
857 |
" |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1417
diff
changeset
|
858 |
ypos := margin. |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1417
diff
changeset
|
859 |
space := 0 |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1417
diff
changeset
|
860 |
] ifFalse:[ |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1417
diff
changeset
|
861 |
l == #fixTopSpace ifTrue:[ |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1417
diff
changeset
|
862 |
l := #topSpace |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1417
diff
changeset
|
863 |
] ifFalse:[ |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1417
diff
changeset
|
864 |
l == #fixTop ifTrue:[ |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1417
diff
changeset
|
865 |
l := #top |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1417
diff
changeset
|
866 |
] |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1417
diff
changeset
|
867 |
]. |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1417
diff
changeset
|
868 |
((l == #bottom) or:[l == #bottomSpace |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1417
diff
changeset
|
869 |
or:[l == #bottomFit or:[l == #bottomSpaceFit]]]) ifTrue:[ |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1417
diff
changeset
|
870 |
ypos := restHeight - (space * (numChilds - 1)). |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1417
diff
changeset
|
871 |
"/ |
4021
48c8526db338
no more direct accesses to borderWidth and borderColor
Claus Gittinger <cg@exept.de>
parents:
3931
diff
changeset
|
872 |
"/ bw == 0 ifTrue:[ |
1431
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1417
diff
changeset
|
873 |
"/ ypos := ypos + space |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1417
diff
changeset
|
874 |
"/ ]. |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1417
diff
changeset
|
875 |
"/ |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1417
diff
changeset
|
876 |
(l == #bottomSpace |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1417
diff
changeset
|
877 |
or:[l == #bottomSpaceFit]) ifTrue:[ |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1417
diff
changeset
|
878 |
ypos >= space ifTrue:[ |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1417
diff
changeset
|
879 |
ypos := ypos - space |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1417
diff
changeset
|
880 |
] |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1417
diff
changeset
|
881 |
]. |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1417
diff
changeset
|
882 |
ypos := ypos - margin. |
77 | 883 |
|
1431
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1417
diff
changeset
|
884 |
ypos < 0 ifTrue:[ |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1417
diff
changeset
|
885 |
space := space min:(restHeight // (numChilds + 1)). |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1417
diff
changeset
|
886 |
ypos := restHeight - (space * numChilds). |
3867 | 887 |
]. |
888 |
y2 := ypos. |
|
1431
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1417
diff
changeset
|
889 |
] ifFalse: [ |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1417
diff
changeset
|
890 |
(l == #spread) ifTrue:[ |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1417
diff
changeset
|
891 |
space := (restHeight - m2) // (numChilds - 1). |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1417
diff
changeset
|
892 |
ypos := margin. |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1417
diff
changeset
|
893 |
(space == 0) ifTrue:[ |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1417
diff
changeset
|
894 |
ypos := restHeight // 2 |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1417
diff
changeset
|
895 |
] |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1417
diff
changeset
|
896 |
] ifFalse: [ |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1417
diff
changeset
|
897 |
(l == #spreadSpace) ifTrue:[ |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1417
diff
changeset
|
898 |
space := (restHeight - m2) // (numChilds + 1). |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1417
diff
changeset
|
899 |
ypos := space + margin. |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1417
diff
changeset
|
900 |
(space == 0) ifTrue:[ |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1417
diff
changeset
|
901 |
ypos := restHeight // 2 |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1417
diff
changeset
|
902 |
] |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1417
diff
changeset
|
903 |
] ifFalse: [ |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1417
diff
changeset
|
904 |
((l == #top) or:[l == #topSpace |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1417
diff
changeset
|
905 |
or:[l == #topFit or:[l == #topSpaceFit]]]) ifTrue:[ |
3675
dc94ab5c7abb
spacing computation fixed (boundary condition, spacing reduction)
Claus Gittinger <cg@exept.de>
parents:
3529
diff
changeset
|
906 |
(l == #top or:[l == #topFit]) ifTrue:[ |
3679 | 907 |
space := space min:((restHeight - m2) // numChilds). |
3675
dc94ab5c7abb
spacing computation fixed (boundary condition, spacing reduction)
Claus Gittinger <cg@exept.de>
parents:
3529
diff
changeset
|
908 |
] ifFalse:[ |
3679 | 909 |
space := space min:((restHeight - m2) // (numChilds + 1)). |
3675
dc94ab5c7abb
spacing computation fixed (boundary condition, spacing reduction)
Claus Gittinger <cg@exept.de>
parents:
3529
diff
changeset
|
910 |
]. |
1431
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1417
diff
changeset
|
911 |
(vL == #fixTop or:[vL == #fixTopSpace]) ifTrue:[ |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1417
diff
changeset
|
912 |
space := space max:verticalSpace. |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1417
diff
changeset
|
913 |
] ifFalse:[ |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1417
diff
changeset
|
914 |
space := space max:0. |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1417
diff
changeset
|
915 |
]. |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1417
diff
changeset
|
916 |
(l == #topSpace or:[l == #topSpaceFit]) ifTrue:[ |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1417
diff
changeset
|
917 |
ypos := space + margin. |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1417
diff
changeset
|
918 |
] ifFalse:[ |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1417
diff
changeset
|
919 |
"/ |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1417
diff
changeset
|
920 |
"/ if the very first view has a 0-level AND |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1417
diff
changeset
|
921 |
"/ my level is non-zero, begin with margin |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1417
diff
changeset
|
922 |
"/ |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1417
diff
changeset
|
923 |
true "(margin ~~ 0 and:[subViews first level == 0])" ifTrue:[ |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1417
diff
changeset
|
924 |
ypos := margin |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1417
diff
changeset
|
925 |
] ifFalse:[ |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1417
diff
changeset
|
926 |
ypos := 0 |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1417
diff
changeset
|
927 |
] |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1417
diff
changeset
|
928 |
] |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1417
diff
changeset
|
929 |
] ifFalse:[ |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1417
diff
changeset
|
930 |
"center" |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1417
diff
changeset
|
931 |
ypos := (restHeight - ((numChilds - 1) * space)) // 2. |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1417
diff
changeset
|
932 |
ypos < 0 ifTrue:[ |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1417
diff
changeset
|
933 |
space := restHeight // (numChilds + 1). |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1417
diff
changeset
|
934 |
ypos := (restHeight - ((numChilds - 1) * space)) // 2. |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1417
diff
changeset
|
935 |
] |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1417
diff
changeset
|
936 |
] |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1417
diff
changeset
|
937 |
] |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1417
diff
changeset
|
938 |
] |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1417
diff
changeset
|
939 |
] |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1417
diff
changeset
|
940 |
]. |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1417
diff
changeset
|
941 |
]. |
63 | 942 |
]. |
943 |
||
1307
f2ce08878d5e
added #bottomFit & #bottomSpaceFit layouts
Claus Gittinger <cg@exept.de>
parents:
1291
diff
changeset
|
944 |
resizeToMaxH := false. |
f2ce08878d5e
added #bottomFit & #bottomSpaceFit layouts
Claus Gittinger <cg@exept.de>
parents:
1291
diff
changeset
|
945 |
(hL endsWith:'Max') ifTrue:[ |
1431
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1417
diff
changeset
|
946 |
resizeToMaxH := true. |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1417
diff
changeset
|
947 |
maxWidth := subViews inject:0 into:[:maxSoFar :child | maxSoFar max:child widthIncludingBorder]. |
4562
45ac476a6250
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4021
diff
changeset
|
948 |
hL := (hL copyButLast:3) asSymbol. |
127 | 949 |
]. |
950 |
||
63 | 951 |
" |
952 |
now set positions |
|
953 |
" |
|
133 | 954 |
subViews keysAndValuesDo:[:index :child | |
1431
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1417
diff
changeset
|
955 |
|xpos advance bwChild wChild newWChild x2| |
125 | 956 |
|
1431
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1417
diff
changeset
|
957 |
wChild := child widthIncludingBorder. |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1417
diff
changeset
|
958 |
bwChild := child borderWidth. |
63 | 959 |
|
3118
996b7fc6dee7
1. Avoid endless recursion with #elementsChangesSize.
Stefan Vogel <sv@exept.de>
parents:
2387
diff
changeset
|
960 |
elementsChangeSize ifTrue:[ |
996b7fc6dee7
1. Avoid endless recursion with #elementsChangesSize.
Stefan Vogel <sv@exept.de>
parents:
2387
diff
changeset
|
961 |
"to avoid a recursion when we change the elements size" |
996b7fc6dee7
1. Avoid endless recursion with #elementsChangesSize.
Stefan Vogel <sv@exept.de>
parents:
2387
diff
changeset
|
962 |
child removeDependent:self. |
996b7fc6dee7
1. Avoid endless recursion with #elementsChangesSize.
Stefan Vogel <sv@exept.de>
parents:
2387
diff
changeset
|
963 |
]. |
1431
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1417
diff
changeset
|
964 |
resizeToMaxH ifTrue:[ |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1417
diff
changeset
|
965 |
child width:(wChild := maxWidth - (bwChild * 2)). |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1417
diff
changeset
|
966 |
]. |
127 | 967 |
|
1431
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1417
diff
changeset
|
968 |
hL == #left ifTrue:[ |
4021
48c8526db338
no more direct accesses to borderWidth and borderColor
Claus Gittinger <cg@exept.de>
parents:
3931
diff
changeset
|
969 |
xpos := 0 - bw + margin. |
1431
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1417
diff
changeset
|
970 |
] ifFalse:[ |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1417
diff
changeset
|
971 |
hL == #leftSpace ifTrue:[ |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1417
diff
changeset
|
972 |
xpos := horizontalSpace + margin |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1417
diff
changeset
|
973 |
] ifFalse:[ |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1417
diff
changeset
|
974 |
hL == #right ifTrue:[ |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1417
diff
changeset
|
975 |
xpos := width - wChild - margin |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1417
diff
changeset
|
976 |
] ifFalse:[ |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1417
diff
changeset
|
977 |
hL == #rightSpace ifTrue:[ |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1417
diff
changeset
|
978 |
xpos := width - horizontalSpace - wChild - margin. |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1417
diff
changeset
|
979 |
] ifFalse:[ |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1417
diff
changeset
|
980 |
hL == #fitSpace ifTrue:[ |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1417
diff
changeset
|
981 |
xpos := horizontalSpace + margin. |
6173 | 982 |
newWChild := width - m2 - ((horizontalSpace + bwChild) * 2) |
1431
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1417
diff
changeset
|
983 |
] ifFalse:[ |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1417
diff
changeset
|
984 |
hL == #fit ifTrue:[ |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1417
diff
changeset
|
985 |
newWChild := width "- (bwChild * 2)". |
4021
48c8526db338
no more direct accesses to borderWidth and borderColor
Claus Gittinger <cg@exept.de>
parents:
3931
diff
changeset
|
986 |
bw == 0 ifTrue:[ |
1431
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1417
diff
changeset
|
987 |
newWChild := newWChild - (bwChild * 2) |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1417
diff
changeset
|
988 |
]. |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1417
diff
changeset
|
989 |
true "child level == 0" ifTrue:[ |
4021
48c8526db338
no more direct accesses to borderWidth and borderColor
Claus Gittinger <cg@exept.de>
parents:
3931
diff
changeset
|
990 |
xpos := margin - bw. |
1431
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1417
diff
changeset
|
991 |
newWChild := newWChild - m2 |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1417
diff
changeset
|
992 |
] ifFalse:[ |
4021
48c8526db338
no more direct accesses to borderWidth and borderColor
Claus Gittinger <cg@exept.de>
parents:
3931
diff
changeset
|
993 |
xpos := 0 - bw. |
1431
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1417
diff
changeset
|
994 |
]. |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1417
diff
changeset
|
995 |
] ifFalse:[ |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1417
diff
changeset
|
996 |
"centered" |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1417
diff
changeset
|
997 |
xpos := margin + ((width - m2 - wChild) // 2). |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1417
diff
changeset
|
998 |
] |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1417
diff
changeset
|
999 |
] |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1417
diff
changeset
|
1000 |
] |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1417
diff
changeset
|
1001 |
] |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1417
diff
changeset
|
1002 |
] |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1417
diff
changeset
|
1003 |
]. |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1417
diff
changeset
|
1004 |
newWChild notNil ifTrue:[ |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1417
diff
changeset
|
1005 |
child width:newWChild |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1417
diff
changeset
|
1006 |
]. |
63 | 1007 |
|
793 | 1008 |
"/ (xpos < 0) ifTrue:[ xpos := 0 ]. |
1009 |
||
2033
fc16e79f649b
size computation with bordered components
Claus Gittinger <cg@exept.de>
parents:
2031
diff
changeset
|
1010 |
x2 := xpos + child width - 1. |
380
6eb402d01ae0
looks better if panels level is ~~ 0 AND subview has 0 level
Claus Gittinger <cg@exept.de>
parents:
341
diff
changeset
|
1011 |
|
3529 | 1012 |
rowHeight notNil ifTrue:[ |
1013 |
child origin:(xpos@ypos). |
|
1014 |
advance := rowHeight |
|
1431
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1417
diff
changeset
|
1015 |
] ifFalse:[ |
3529 | 1016 |
(vL == #fit |
1017 |
or:[vL == #fitSpace |
|
1018 |
or:[resizeToMaxV]]) ifTrue:[ |
|
1019 |
child origin:(xpos @ (ypos rounded)) |
|
1020 |
corner:(x2 @ (ypos + hEach - bwChild - 1) rounded). |
|
1021 |
advance := hEach |
|
1022 |
] ifFalse:[ |
|
1023 |
child origin:(xpos@ypos). |
|
1024 |
advance := child heightIncludingBorder |
|
1025 |
]. |
|
1431
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1417
diff
changeset
|
1026 |
]. |
133 | 1027 |
|
1431
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1417
diff
changeset
|
1028 |
index == numChilds ifTrue:[ |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1417
diff
changeset
|
1029 |
|y| |
133 | 1030 |
|
1431
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1417
diff
changeset
|
1031 |
(vL == #topFit or:[vL == #topSpaceFit]) ifTrue:[ |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1417
diff
changeset
|
1032 |
y := height - margin - 1. |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1417
diff
changeset
|
1033 |
vL == #topSpaceFit ifTrue:[ |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1417
diff
changeset
|
1034 |
y := y - space |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1417
diff
changeset
|
1035 |
]. |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1417
diff
changeset
|
1036 |
child corner:x2 @ y |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1417
diff
changeset
|
1037 |
]. |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1417
diff
changeset
|
1038 |
]. |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1417
diff
changeset
|
1039 |
index == 1 ifTrue:[ |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1417
diff
changeset
|
1040 |
(vL == #bottomFit or:[vL == #bottomSpaceFit]) ifTrue:[ |
4021
48c8526db338
no more direct accesses to borderWidth and borderColor
Claus Gittinger <cg@exept.de>
parents:
3931
diff
changeset
|
1041 |
ypos := margin + 0 + (child borderWidth * 2) - bw. |
1431
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1417
diff
changeset
|
1042 |
vL == #bottomSpaceFit ifTrue:[ |
3118
996b7fc6dee7
1. Avoid endless recursion with #elementsChangesSize.
Stefan Vogel <sv@exept.de>
parents:
2387
diff
changeset
|
1043 |
ypos := ypos + space |
1431
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1417
diff
changeset
|
1044 |
]. |
3931 | 1045 |
advance := y2 ? 0. |
3118
996b7fc6dee7
1. Avoid endless recursion with #elementsChangesSize.
Stefan Vogel <sv@exept.de>
parents:
2387
diff
changeset
|
1046 |
child origin:((child origin x) @ ypos) |
996b7fc6dee7
1. Avoid endless recursion with #elementsChangesSize.
Stefan Vogel <sv@exept.de>
parents:
2387
diff
changeset
|
1047 |
corner:((child corner x) @ (ypos+advance)) |
1431
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1417
diff
changeset
|
1048 |
]. |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1417
diff
changeset
|
1049 |
]. |
1307
f2ce08878d5e
added #bottomFit & #bottomSpaceFit layouts
Claus Gittinger <cg@exept.de>
parents:
1291
diff
changeset
|
1050 |
|
1431
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1417
diff
changeset
|
1051 |
ypos := ypos + advance + space. |
3118
996b7fc6dee7
1. Avoid endless recursion with #elementsChangesSize.
Stefan Vogel <sv@exept.de>
parents:
2387
diff
changeset
|
1052 |
elementsChangeSize ifTrue:[ |
996b7fc6dee7
1. Avoid endless recursion with #elementsChangesSize.
Stefan Vogel <sv@exept.de>
parents:
2387
diff
changeset
|
1053 |
"reinstall dependency that we removed above" |
996b7fc6dee7
1. Avoid endless recursion with #elementsChangesSize.
Stefan Vogel <sv@exept.de>
parents:
2387
diff
changeset
|
1054 |
child addDependent:self. |
996b7fc6dee7
1. Avoid endless recursion with #elementsChangesSize.
Stefan Vogel <sv@exept.de>
parents:
2387
diff
changeset
|
1055 |
]. |
0 | 1056 |
] |
155 | 1057 |
|
3504
2395db2daa9e
setChildPositions fix with bottomFit
Claus Gittinger <cg@exept.de>
parents:
3502
diff
changeset
|
1058 |
"Modified: / 04-09-1995 / 18:43:29 / claus" |
2395db2daa9e
setChildPositions fix with bottomFit
Claus Gittinger <cg@exept.de>
parents:
3502
diff
changeset
|
1059 |
"Modified: / 10-10-2007 / 13:47:56 / cg" |
6173 | 1060 |
"Modified (format): / 20-06-2017 / 10:46:08 / cg" |
0 | 1061 |
! ! |
125 | 1062 |
|
1063 |
!VerticalPanelView methodsFor:'queries'! |
|
1064 |
||
130 | 1065 |
preferredExtent |
125 | 1066 |
"return a good extent, one that makes subviews fit" |
1067 |
||
4021
48c8526db338
no more direct accesses to borderWidth and borderColor
Claus Gittinger <cg@exept.de>
parents:
3931
diff
changeset
|
1068 |
|sumOfHeights maxWidth maxHeight m2 subViews bw| |
125 | 1069 |
|
3771
4233b9ff2cb6
changed #preferredExtent - use explicitExtent instvar
Stefan Vogel <sv@exept.de>
parents:
3679
diff
changeset
|
1070 |
"/ If I have an explicit preferredExtent.. |
4233b9ff2cb6
changed #preferredExtent - use explicitExtent instvar
Stefan Vogel <sv@exept.de>
parents:
3679
diff
changeset
|
1071 |
explicitExtent notNil ifTrue:[ |
4233b9ff2cb6
changed #preferredExtent - use explicitExtent instvar
Stefan Vogel <sv@exept.de>
parents:
3679
diff
changeset
|
1072 |
^ explicitExtent |
4233b9ff2cb6
changed #preferredExtent - use explicitExtent instvar
Stefan Vogel <sv@exept.de>
parents:
3679
diff
changeset
|
1073 |
]. |
797 | 1074 |
|
3771
4233b9ff2cb6
changed #preferredExtent - use explicitExtent instvar
Stefan Vogel <sv@exept.de>
parents:
3679
diff
changeset
|
1075 |
"/ If I have a cached preferredExtent value.. |
713
0c38ad51016d
care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents:
593
diff
changeset
|
1076 |
preferredExtent notNil ifTrue:[ |
2387
c589e85a4f43
prefExtent computation was wrong for fitSpace
Claus Gittinger <cg@exept.de>
parents:
2370
diff
changeset
|
1077 |
^ preferredExtent |
713
0c38ad51016d
care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents:
593
diff
changeset
|
1078 |
]. |
0c38ad51016d
care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents:
593
diff
changeset
|
1079 |
|
1417
e9dffd6767a6
added ignoreInvisibleComponents support
Claus Gittinger <cg@exept.de>
parents:
1307
diff
changeset
|
1080 |
subViews := self subViewsToConsider. |
e9dffd6767a6
added ignoreInvisibleComponents support
Claus Gittinger <cg@exept.de>
parents:
1307
diff
changeset
|
1081 |
(subViews size == 0) ifTrue:[ |
2387
c589e85a4f43
prefExtent computation was wrong for fitSpace
Claus Gittinger <cg@exept.de>
parents:
2370
diff
changeset
|
1082 |
^ super preferredExtent. |
c589e85a4f43
prefExtent computation was wrong for fitSpace
Claus Gittinger <cg@exept.de>
parents:
2370
diff
changeset
|
1083 |
"/ ^ horizontalSpace @ verticalSpace]. |
1038 | 1084 |
]. |
1085 |
||
4021
48c8526db338
no more direct accesses to borderWidth and borderColor
Claus Gittinger <cg@exept.de>
parents:
3931
diff
changeset
|
1086 |
bw := self borderWidth. |
125 | 1087 |
|
1088 |
"compute net height needed" |
|
1089 |
||
1090 |
sumOfHeights := 0. |
|
1091 |
maxWidth := 0. |
|
1092 |
maxHeight := 0. |
|
1093 |
||
1094 |
subViews do:[:child | |
|
2387
c589e85a4f43
prefExtent computation was wrong for fitSpace
Claus Gittinger <cg@exept.de>
parents:
2370
diff
changeset
|
1095 |
|childsPreference| |
125 | 1096 |
|
5931 | 1097 |
child realized ifTrue:[ |
1098 |
childsPreference := child extent max:child preferredExtent. |
|
3675
dc94ab5c7abb
spacing computation fixed (boundary condition, spacing reduction)
Claus Gittinger <cg@exept.de>
parents:
3529
diff
changeset
|
1099 |
] ifFalse:[ |
dc94ab5c7abb
spacing computation fixed (boundary condition, spacing reduction)
Claus Gittinger <cg@exept.de>
parents:
3529
diff
changeset
|
1100 |
childsPreference := child preferredExtent. |
dc94ab5c7abb
spacing computation fixed (boundary condition, spacing reduction)
Claus Gittinger <cg@exept.de>
parents:
3529
diff
changeset
|
1101 |
]. |
2387
c589e85a4f43
prefExtent computation was wrong for fitSpace
Claus Gittinger <cg@exept.de>
parents:
2370
diff
changeset
|
1102 |
sumOfHeights := sumOfHeights + childsPreference y. |
c589e85a4f43
prefExtent computation was wrong for fitSpace
Claus Gittinger <cg@exept.de>
parents:
2370
diff
changeset
|
1103 |
maxHeight := maxHeight max:childsPreference y. |
c589e85a4f43
prefExtent computation was wrong for fitSpace
Claus Gittinger <cg@exept.de>
parents:
2370
diff
changeset
|
1104 |
maxWidth := maxWidth max:childsPreference x. |
125 | 1105 |
|
1106 |
"/ sumOfHeights := sumOfHeights + child heightIncludingBorder. |
|
1107 |
"/ maxWidth := maxWidth max:(child widthIncludingBorder). |
|
1108 |
"/ maxHeight := maxHeight max:(child heightIncludingBorder). |
|
1109 |
]. |
|
321
00c17944cb00
preferredExtent computation used hSpace instead of vSpace
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
1110 |
|
4021
48c8526db338
no more direct accesses to borderWidth and borderColor
Claus Gittinger <cg@exept.de>
parents:
3931
diff
changeset
|
1111 |
bw ~~ 0 ifTrue:[ |
2387
c589e85a4f43
prefExtent computation was wrong for fitSpace
Claus Gittinger <cg@exept.de>
parents:
2370
diff
changeset
|
1112 |
sumOfHeights := sumOfHeights + (verticalSpace * 2). |
c589e85a4f43
prefExtent computation was wrong for fitSpace
Claus Gittinger <cg@exept.de>
parents:
2370
diff
changeset
|
1113 |
maxWidth := maxWidth + (horizontalSpace * 2). |
125 | 1114 |
]. |
321
00c17944cb00
preferredExtent computation used hSpace instead of vSpace
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
1115 |
|
125 | 1116 |
(vLayout == #fit or:[vLayout == #fitSpace]) ifTrue:[ |
2387
c589e85a4f43
prefExtent computation was wrong for fitSpace
Claus Gittinger <cg@exept.de>
parents:
2370
diff
changeset
|
1117 |
sumOfHeights := maxHeight * subViews size. |
4021
48c8526db338
no more direct accesses to borderWidth and borderColor
Claus Gittinger <cg@exept.de>
parents:
3931
diff
changeset
|
1118 |
bw ~~ 0 ifTrue:[ |
2387
c589e85a4f43
prefExtent computation was wrong for fitSpace
Claus Gittinger <cg@exept.de>
parents:
2370
diff
changeset
|
1119 |
sumOfHeights := sumOfHeights + (verticalSpace * 2). |
c589e85a4f43
prefExtent computation was wrong for fitSpace
Claus Gittinger <cg@exept.de>
parents:
2370
diff
changeset
|
1120 |
]. |
c589e85a4f43
prefExtent computation was wrong for fitSpace
Claus Gittinger <cg@exept.de>
parents:
2370
diff
changeset
|
1121 |
vLayout == #fitSpace ifTrue:[ |
c589e85a4f43
prefExtent computation was wrong for fitSpace
Claus Gittinger <cg@exept.de>
parents:
2370
diff
changeset
|
1122 |
"/ care for spacing ... |
c589e85a4f43
prefExtent computation was wrong for fitSpace
Claus Gittinger <cg@exept.de>
parents:
2370
diff
changeset
|
1123 |
sumOfHeights := sumOfHeights + (verticalSpace * (subViews size + 1)). |
c589e85a4f43
prefExtent computation was wrong for fitSpace
Claus Gittinger <cg@exept.de>
parents:
2370
diff
changeset
|
1124 |
]. |
125 | 1125 |
] ifFalse:[ |
2387
c589e85a4f43
prefExtent computation was wrong for fitSpace
Claus Gittinger <cg@exept.de>
parents:
2370
diff
changeset
|
1126 |
sumOfHeights := sumOfHeights + ((subViews size - 1) * verticalSpace). |
c589e85a4f43
prefExtent computation was wrong for fitSpace
Claus Gittinger <cg@exept.de>
parents:
2370
diff
changeset
|
1127 |
((vLayout == #topSpace) or:[vLayout == #bottomSpace]) ifTrue:[ |
c589e85a4f43
prefExtent computation was wrong for fitSpace
Claus Gittinger <cg@exept.de>
parents:
2370
diff
changeset
|
1128 |
sumOfHeights := sumOfHeights + verticalSpace |
c589e85a4f43
prefExtent computation was wrong for fitSpace
Claus Gittinger <cg@exept.de>
parents:
2370
diff
changeset
|
1129 |
] ifFalse:[ |
c589e85a4f43
prefExtent computation was wrong for fitSpace
Claus Gittinger <cg@exept.de>
parents:
2370
diff
changeset
|
1130 |
((vLayout == #center) or:[vLayout == #spread]) ifTrue:[ |
c589e85a4f43
prefExtent computation was wrong for fitSpace
Claus Gittinger <cg@exept.de>
parents:
2370
diff
changeset
|
1131 |
sumOfHeights := sumOfHeights + (verticalSpace * 2) |
c589e85a4f43
prefExtent computation was wrong for fitSpace
Claus Gittinger <cg@exept.de>
parents:
2370
diff
changeset
|
1132 |
] |
c589e85a4f43
prefExtent computation was wrong for fitSpace
Claus Gittinger <cg@exept.de>
parents:
2370
diff
changeset
|
1133 |
]. |
125 | 1134 |
]. |
1135 |
||
1136 |
((hLayout == #leftSpace) or:[hLayout == #rightSpace]) ifTrue:[ |
|
2387
c589e85a4f43
prefExtent computation was wrong for fitSpace
Claus Gittinger <cg@exept.de>
parents:
2370
diff
changeset
|
1137 |
maxWidth := maxWidth + horizontalSpace |
125 | 1138 |
] ifFalse:[ |
2387
c589e85a4f43
prefExtent computation was wrong for fitSpace
Claus Gittinger <cg@exept.de>
parents:
2370
diff
changeset
|
1139 |
((hLayout == #fitSpace) or:[hLayout == #center]) ifTrue:[ |
c589e85a4f43
prefExtent computation was wrong for fitSpace
Claus Gittinger <cg@exept.de>
parents:
2370
diff
changeset
|
1140 |
maxWidth := maxWidth + (horizontalSpace * 2) |
c589e85a4f43
prefExtent computation was wrong for fitSpace
Claus Gittinger <cg@exept.de>
parents:
2370
diff
changeset
|
1141 |
] |
125 | 1142 |
]. |
380
6eb402d01ae0
looks better if panels level is ~~ 0 AND subview has 0 level
Claus Gittinger <cg@exept.de>
parents:
341
diff
changeset
|
1143 |
m2 := margin * 2. |
6eb402d01ae0
looks better if panels level is ~~ 0 AND subview has 0 level
Claus Gittinger <cg@exept.de>
parents:
341
diff
changeset
|
1144 |
^ (maxWidth + m2) @ (sumOfHeights + m2) |
321
00c17944cb00
preferredExtent computation used hSpace instead of vSpace
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
1145 |
|
1417
e9dffd6767a6
added ignoreInvisibleComponents support
Claus Gittinger <cg@exept.de>
parents:
1307
diff
changeset
|
1146 |
"Modified: / 17.1.1998 / 00:18:16 / cg" |
125 | 1147 |
! ! |
1148 |
||
980
6079922a5519
eliminated references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents:
797
diff
changeset
|
1149 |
!VerticalPanelView class methodsFor:'documentation'! |
205 | 1150 |
|
1151 |
version |
|
5425 | 1152 |
^ '$Header$' |
4021
48c8526db338
no more direct accesses to borderWidth and borderColor
Claus Gittinger <cg@exept.de>
parents:
3931
diff
changeset
|
1153 |
! |
48c8526db338
no more direct accesses to borderWidth and borderColor
Claus Gittinger <cg@exept.de>
parents:
3931
diff
changeset
|
1154 |
|
48c8526db338
no more direct accesses to borderWidth and borderColor
Claus Gittinger <cg@exept.de>
parents:
3931
diff
changeset
|
1155 |
version_CVS |
5425 | 1156 |
^ '$Header$' |
205 | 1157 |
! ! |
4562
45ac476a6250
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4021
diff
changeset
|
1158 |