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