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