author | convert-repo |
Mon, 20 Jan 2020 04:27:28 +0000 | |
changeset 6803 | ee24f1bc43ae |
parent 6483 | 9b874828035a |
child 6845 | 505264a24615 |
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:
2099
diff
changeset
|
12 |
"{ Package: 'stx:libwidg' }" |
f2850e54b0ab
only access originChanged, extentChanged and cornerChanged
Claus Gittinger <cg@exept.de>
parents:
2099
diff
changeset
|
13 |
|
5424 | 14 |
"{ NameSpace: Smalltalk }" |
15 |
||
0 | 16 |
PanelView subclass:#HorizontalPanelView |
2039
ad9313ab0151
added support for component reversal if OK-atLeft
Claus Gittinger <cg@exept.de>
parents:
2033
diff
changeset
|
17 |
instanceVariableNames:'reverseOrderIfOKAtLeft' |
340
f820bcd29a51
defaultExtent with rightSpace forgot about spacing
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
18 |
classVariableNames:'' |
f820bcd29a51
defaultExtent with rightSpace forgot about spacing
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
19 |
poolDictionaries:'' |
f820bcd29a51
defaultExtent with rightSpace forgot about spacing
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
20 |
category:'Views-Layout' |
0 | 21 |
! |
22 |
||
980
6079922a5519
eliminated references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents:
797
diff
changeset
|
23 |
!HorizontalPanelView class methodsFor:'documentation'! |
38 | 24 |
|
25 |
copyright |
|
26 |
" |
|
27 |
COPYRIGHT (c) 1989 by Claus Gittinger |
|
59 | 28 |
All Rights Reserved |
38 | 29 |
|
30 |
This software is furnished under a license and may be used |
|
31 |
only in accordance with the terms of that license and with the |
|
32 |
inclusion of the above copyright notice. This software may not |
|
33 |
be provided or otherwise made available to, or used by, any |
|
34 |
other person. No title to or ownership of the software is |
|
35 |
hereby transferred. |
|
36 |
" |
|
37 |
! |
|
38 |
||
39 |
documentation |
|
40 |
" |
|
41 |
a View which arranges its child-views in a horizontal row. |
|
42 |
All real work is done in PanelView - only the layout computation is |
|
43 |
redefined here. |
|
44 |
||
77 | 45 |
The layout is controlled the instance variables: |
1418
3397ec6b8419
added ignoreInvisibleComponents stuff
Claus Gittinger <cg@exept.de>
parents:
1306
diff
changeset
|
46 |
horizontalLayout and verticalLayout |
127 | 47 |
in addition to |
1418
3397ec6b8419
added ignoreInvisibleComponents stuff
Claus Gittinger <cg@exept.de>
parents:
1306
diff
changeset
|
48 |
horizontalSpace and verticalSpace. |
77 | 49 |
|
133 | 50 |
HorizontalSpace and verticalSpace control the spacing between elements; |
51 |
they default to some 1mm. |
|
52 |
||
62 | 53 |
The horizontal layout can be any of: |
54 |
||
1418
3397ec6b8419
added ignoreInvisibleComponents stuff
Claus Gittinger <cg@exept.de>
parents:
1306
diff
changeset
|
55 |
#left arrange elements at left |
3397ec6b8419
added ignoreInvisibleComponents stuff
Claus Gittinger <cg@exept.de>
parents:
1306
diff
changeset
|
56 |
#leftSpace arrange elements at the left, start with spacing |
3397ec6b8419
added ignoreInvisibleComponents stuff
Claus Gittinger <cg@exept.de>
parents:
1306
diff
changeset
|
57 |
#fixLeft same as #left, but do not reduce spacing in case of no fit |
3397ec6b8419
added ignoreInvisibleComponents stuff
Claus Gittinger <cg@exept.de>
parents:
1306
diff
changeset
|
58 |
#fixLeftSpace same as #leftSpace, but do not reduce spacing in case of no fit |
3397ec6b8419
added ignoreInvisibleComponents stuff
Claus Gittinger <cg@exept.de>
parents:
1306
diff
changeset
|
59 |
#right arrange elements at the right |
3397ec6b8419
added ignoreInvisibleComponents stuff
Claus Gittinger <cg@exept.de>
parents:
1306
diff
changeset
|
60 |
#rightSpace arrange elements at the right, start with spacing |
3397ec6b8419
added ignoreInvisibleComponents stuff
Claus Gittinger <cg@exept.de>
parents:
1306
diff
changeset
|
61 |
#center arrange elements in the center |
3397ec6b8419
added ignoreInvisibleComponents stuff
Claus Gittinger <cg@exept.de>
parents:
1306
diff
changeset
|
62 |
#spread spread elements evenly |
3397ec6b8419
added ignoreInvisibleComponents stuff
Claus Gittinger <cg@exept.de>
parents:
1306
diff
changeset
|
63 |
#spreadSpace spread elements evenly with spacing at the ends |
3397ec6b8419
added ignoreInvisibleComponents stuff
Claus Gittinger <cg@exept.de>
parents:
1306
diff
changeset
|
64 |
#fit like #spread, but resize elements for tight packing |
3397ec6b8419
added ignoreInvisibleComponents stuff
Claus Gittinger <cg@exept.de>
parents:
1306
diff
changeset
|
65 |
#fitSpace like #fit, with additional spacing at the far ends |
3397ec6b8419
added ignoreInvisibleComponents stuff
Claus Gittinger <cg@exept.de>
parents:
1306
diff
changeset
|
66 |
#leftFit like #left, but extend the last (rightMost) element to the right |
3397ec6b8419
added ignoreInvisibleComponents stuff
Claus Gittinger <cg@exept.de>
parents:
1306
diff
changeset
|
67 |
#leftSpaceFit like #leftSpace, but extend the last (rightMost) element to the right |
3397ec6b8419
added ignoreInvisibleComponents stuff
Claus Gittinger <cg@exept.de>
parents:
1306
diff
changeset
|
68 |
#rightFit like #right, but extend the first (leftMost) element to the left |
3397ec6b8419
added ignoreInvisibleComponents stuff
Claus Gittinger <cg@exept.de>
parents:
1306
diff
changeset
|
69 |
#rightSpaceFit like #rightSpace, but extend the first (leftMost) element to the left |
133 | 70 |
|
1418
3397ec6b8419
added ignoreInvisibleComponents stuff
Claus Gittinger <cg@exept.de>
parents:
1306
diff
changeset
|
71 |
#leftMax like corresponding non-Max layouts, |
3397ec6b8419
added ignoreInvisibleComponents stuff
Claus Gittinger <cg@exept.de>
parents:
1306
diff
changeset
|
72 |
#leftSpaceMax but resize all components to width of widest components |
3397ec6b8419
added ignoreInvisibleComponents stuff
Claus Gittinger <cg@exept.de>
parents:
1306
diff
changeset
|
73 |
#rightMax |
3397ec6b8419
added ignoreInvisibleComponents stuff
Claus Gittinger <cg@exept.de>
parents:
1306
diff
changeset
|
74 |
#rightSpaceMax |
3397ec6b8419
added ignoreInvisibleComponents stuff
Claus Gittinger <cg@exept.de>
parents:
1306
diff
changeset
|
75 |
#centerMax |
3397ec6b8419
added ignoreInvisibleComponents stuff
Claus Gittinger <cg@exept.de>
parents:
1306
diff
changeset
|
76 |
#spreadMax |
3397ec6b8419
added ignoreInvisibleComponents stuff
Claus Gittinger <cg@exept.de>
parents:
1306
diff
changeset
|
77 |
#spreadSpaceMax |
62 | 78 |
|
79 |
the vertical layout can be: |
|
80 |
||
1418
3397ec6b8419
added ignoreInvisibleComponents stuff
Claus Gittinger <cg@exept.de>
parents:
1306
diff
changeset
|
81 |
#top place element at the top |
3397ec6b8419
added ignoreInvisibleComponents stuff
Claus Gittinger <cg@exept.de>
parents:
1306
diff
changeset
|
82 |
#topSpace place element at the top, offset by verticalSpace |
3397ec6b8419
added ignoreInvisibleComponents stuff
Claus Gittinger <cg@exept.de>
parents:
1306
diff
changeset
|
83 |
#center place it horizontally centered |
3397ec6b8419
added ignoreInvisibleComponents stuff
Claus Gittinger <cg@exept.de>
parents:
1306
diff
changeset
|
84 |
#bottom place it at the bottom |
3397ec6b8419
added ignoreInvisibleComponents stuff
Claus Gittinger <cg@exept.de>
parents:
1306
diff
changeset
|
85 |
#bottomSpace place it at the bottom, offset by verticalSpace |
3397ec6b8419
added ignoreInvisibleComponents stuff
Claus Gittinger <cg@exept.de>
parents:
1306
diff
changeset
|
86 |
#fit resize elements vertically to fit this panel |
3397ec6b8419
added ignoreInvisibleComponents stuff
Claus Gittinger <cg@exept.de>
parents:
1306
diff
changeset
|
87 |
#fitSpace like #fit, but with spacing |
133 | 88 |
|
1418
3397ec6b8419
added ignoreInvisibleComponents stuff
Claus Gittinger <cg@exept.de>
parents:
1306
diff
changeset
|
89 |
#topMax like #top, but resize all views vertically to max height |
3397ec6b8419
added ignoreInvisibleComponents stuff
Claus Gittinger <cg@exept.de>
parents:
1306
diff
changeset
|
90 |
#topSpaceMax like #topSpace, but resize all views vertically to max height |
3397ec6b8419
added ignoreInvisibleComponents stuff
Claus Gittinger <cg@exept.de>
parents:
1306
diff
changeset
|
91 |
#bottomMax like #bottom, but resize all views vertically to max height |
3397ec6b8419
added ignoreInvisibleComponents stuff
Claus Gittinger <cg@exept.de>
parents:
1306
diff
changeset
|
92 |
#bottomSpaceMax like #bottomSpace, but resize all views vertically to max height |
3397ec6b8419
added ignoreInvisibleComponents stuff
Claus Gittinger <cg@exept.de>
parents:
1306
diff
changeset
|
93 |
#centerMax like #center, but resize all views vertically to max height |
62 | 94 |
|
77 | 95 |
The defaults is #center for both directions. |
62 | 96 |
The layout is changed by the messages #verticalLayout: and #horizontalLayout:. |
97 |
For backward compatibility (to times, where only hLayout existed), the simple |
|
133 | 98 |
#layout: does the same as #horizontalLayout:. |
1306
bf4903012f7a
added #rightFit & #rightSpaceFit layouts
Claus Gittinger <cg@exept.de>
parents:
1291
diff
changeset
|
99 |
Do not use this old method; it will vanish and currently outputs a warning. |
77 | 100 |
|
127 | 101 |
The panel assumes, that the elements do not resize themselfes, after it |
1306
bf4903012f7a
added #rightFit & #rightSpaceFit layouts
Claus Gittinger <cg@exept.de>
parents:
1291
diff
changeset
|
102 |
became visible. This is not true for all widgets (buttons, labels or |
bf4903012f7a
added #rightFit & #rightSpaceFit layouts
Claus Gittinger <cg@exept.de>
parents:
1291
diff
changeset
|
103 |
inputFields may like to change). |
bf4903012f7a
added #rightFit & #rightSpaceFit layouts
Claus Gittinger <cg@exept.de>
parents:
1291
diff
changeset
|
104 |
If you have changing elements, tell this to the panel |
127 | 105 |
with 'aPanel elementsChangeSize:true'. In that case, the panel will react |
133 | 106 |
to size changes of its elements, and reorganize things. |
127 | 107 |
|
118 | 108 |
By combining Horizontal- and VerticalPanels (i.e. place a hPanel into a |
109 |
vPanel), most layouts should be implementable. |
|
133 | 110 |
However, iff none of these layout/space combinations is exactly what you need |
118 | 111 |
in your application, create a subclass, and redefine the setChildPositions |
112 |
method there. |
|
125 | 113 |
|
114 |
TODO: for completeness, support #fixRight, #fixRightSpace, |
|
1418
3397ec6b8419
added ignoreInvisibleComponents stuff
Claus Gittinger <cg@exept.de>
parents:
1306
diff
changeset
|
115 |
#rightFit, #rightSpaceFit layouts |
127 | 116 |
|
117 |
CAVEAT: this class started with #left and no vertical alignments; |
|
133 | 118 |
as time went by, more layouts were added (by users requests) |
1306
bf4903012f7a
added #rightFit & #rightSpaceFit layouts
Claus Gittinger <cg@exept.de>
parents:
1291
diff
changeset
|
119 |
and now, many layout combinations are possible. |
133 | 120 |
Reflecting this, the setup should be changed to use different selectors |
121 |
for space-on/off, max-resize and alignment |
|
127 | 122 |
(i.e. having more and more layout symbols makes things a bit confusing ...) |
585 | 123 |
|
124 |
[see also:] |
|
1418
3397ec6b8419
added ignoreInvisibleComponents stuff
Claus Gittinger <cg@exept.de>
parents:
1306
diff
changeset
|
125 |
VerticalPanelView |
3397ec6b8419
added ignoreInvisibleComponents stuff
Claus Gittinger <cg@exept.de>
parents:
1306
diff
changeset
|
126 |
VariableVerticalPanel VariableHorizontalPanel |
3397ec6b8419
added ignoreInvisibleComponents stuff
Claus Gittinger <cg@exept.de>
parents:
1306
diff
changeset
|
127 |
Label |
585 | 128 |
|
129 |
[author:] |
|
1418
3397ec6b8419
added ignoreInvisibleComponents stuff
Claus Gittinger <cg@exept.de>
parents:
1306
diff
changeset
|
130 |
Claus Gittinger |
585 | 131 |
|
132 |
[author:] |
|
1418
3397ec6b8419
added ignoreInvisibleComponents stuff
Claus Gittinger <cg@exept.de>
parents:
1306
diff
changeset
|
133 |
Claus Gittinger |
62 | 134 |
" |
135 |
! |
|
136 |
||
137 |
examples |
|
138 |
" |
|
77 | 139 |
These examples show the effect of various horizontalLayout and |
140 |
verticalLayout settings. Try them all. Especially, notice the |
|
141 |
differences between the xxx and xxxSpace layouts and the effect of |
|
142 |
setting different values for the spacing. |
|
143 |
Try resizing the view and see how the elements get rearranged. |
|
144 |
||
1306
bf4903012f7a
added #rightFit & #rightSpaceFit layouts
Claus Gittinger <cg@exept.de>
parents:
1291
diff
changeset
|
145 |
Most of the examples below place 3 buttons onto a panel; |
bf4903012f7a
added #rightFit & #rightSpaceFit layouts
Claus Gittinger <cg@exept.de>
parents:
1291
diff
changeset
|
146 |
Of course, you can put any other view into a panel ... the last examples show this. |
bf4903012f7a
added #rightFit & #rightSpaceFit layouts
Claus Gittinger <cg@exept.de>
parents:
1291
diff
changeset
|
147 |
(The fit layouts are especially useful to be used with SelectionInListViews; |
bf4903012f7a
added #rightFit & #rightSpaceFit layouts
Claus Gittinger <cg@exept.de>
parents:
1291
diff
changeset
|
148 |
you can combine multiple labels & editFields with a selectionInListView, which |
bf4903012f7a
added #rightFit & #rightSpaceFit layouts
Claus Gittinger <cg@exept.de>
parents:
1291
diff
changeset
|
149 |
is expanded to fill the remaining area of the view) |
77 | 150 |
|
127 | 151 |
example: default layout (center) |
5831 | 152 |
centers components |
153 |
[exBegin] |
|
154 |
|v p b1 b2 b3| |
|
38 | 155 |
|
5831 | 156 |
v := StandardSystemView new. |
157 |
v label:'default: center'. |
|
77 | 158 |
|
5831 | 159 |
p := HorizontalPanelView in:v. |
160 |
p origin:(0.0 @ 0.0) corner:(1.0 @ 1.0). |
|
161 |
b1 := Button label:'button1' in:p. |
|
162 |
b2 := Button label:'button2' in:p. |
|
163 |
b3 := Button label:'button3' in:p. |
|
164 |
v extent:300 @ 100. |
|
165 |
v open |
|
166 |
[exEnd] |
|
38 | 167 |
|
0 | 168 |
|
133 | 169 |
example: same (default center layout) with different sized elements |
5831 | 170 |
[exBegin] |
171 |
|v p b1 b2 b3| |
|
133 | 172 |
|
5831 | 173 |
v := StandardSystemView new. |
174 |
v label:'default: center'. |
|
133 | 175 |
|
5831 | 176 |
p := HorizontalPanelView in:v. |
177 |
p origin:(0.0 @ 0.0) corner:(1.0 @ 1.0). |
|
178 |
b1 := Button label:'but1' in:p. b1 font:(b1 font size:8). |
|
179 |
b2 := Button label:'b2' in:p. b2 font:(b1 font size:24). |
|
180 |
b3 := Button label:'button3' in:p. |
|
181 |
v extent:300 @ 100. |
|
182 |
v open |
|
183 |
[exEnd] |
|
133 | 184 |
|
185 |
||
186 |
example: horizontal default (center); vertical centerMax |
|
5831 | 187 |
[exBegin] |
188 |
|v p b1 b2 b3| |
|
133 | 189 |
|
5831 | 190 |
v := StandardSystemView new. |
191 |
v label:'vL=centerMax'. |
|
192 |
p := HorizontalPanelView in:v. |
|
193 |
p verticalLayout:#centerMax. |
|
194 |
p origin:(0.0 @ 0.0) corner:(1.0 @ 1.0). |
|
195 |
b1 := Button label:'but1' in:p. b1 font:(b1 font size:8). |
|
196 |
b2 := Button label:'b2' in:p. b2 font:(b1 font size:24). |
|
197 |
b3 := Button label:'button3' in:p. |
|
198 |
v extent:300 @ 100. |
|
199 |
v open |
|
200 |
[exEnd] |
|
133 | 201 |
|
202 |
||
203 |
example: horizontal default (center); vertical topMax |
|
5831 | 204 |
[exBegin] |
205 |
|v p b1 b2 b3| |
|
133 | 206 |
|
5831 | 207 |
v := StandardSystemView new. |
208 |
v label:'vL=topMax'. |
|
209 |
p := HorizontalPanelView in:v. |
|
210 |
p verticalLayout:#topMax. |
|
211 |
p origin:(0.0 @ 0.0) corner:(1.0 @ 1.0). |
|
212 |
b1 := Button label:'but1' in:p. b1 font:(b1 font size:8). |
|
213 |
b2 := Button label:'b2' in:p. b2 font:(b1 font size:24). |
|
214 |
b3 := Button label:'button3' in:p. |
|
215 |
v extent:300 @ 100. |
|
216 |
v open |
|
217 |
[exEnd] |
|
133 | 218 |
|
219 |
||
220 |
example: horizontal default (center); vertical topSpaceMax |
|
5831 | 221 |
[exBegin] |
222 |
|v p b1 b2 b3| |
|
133 | 223 |
|
5831 | 224 |
v := StandardSystemView new. |
225 |
v label:'vL=topSpaceMax'. |
|
226 |
p := HorizontalPanelView in:v. |
|
227 |
p verticalLayout:#topSpaceMax. |
|
228 |
p origin:(0.0 @ 0.0) corner:(1.0 @ 1.0). |
|
229 |
b1 := Button label:'but1' in:p. b1 font:(b1 font size:8). |
|
230 |
b2 := Button label:'b2' in:p. b2 font:(b1 font size:24). |
|
231 |
b3 := Button label:'button3' in:p. |
|
232 |
v extent:300 @ 100. |
|
233 |
v open |
|
234 |
[exEnd] |
|
133 | 235 |
|
236 |
||
237 |
example: horizontal default (center); vertical bottomMax |
|
5831 | 238 |
[exBegin] |
239 |
|v p b1 b2 b3| |
|
133 | 240 |
|
5831 | 241 |
v := StandardSystemView new. |
242 |
v label:'vL=bottomMax'. |
|
243 |
p := HorizontalPanelView in:v. |
|
244 |
p verticalLayout:#bottomMax. |
|
245 |
p origin:(0.0 @ 0.0) corner:(1.0 @ 1.0). |
|
246 |
b1 := Button label:'but1' in:p. b1 font:(b1 font size:8). |
|
247 |
b2 := Button label:'b2' in:p. b2 font:(b1 font size:24). |
|
248 |
b3 := Button label:'button3' in:p. |
|
249 |
v extent:300 @ 100. |
|
250 |
v open |
|
251 |
[exEnd] |
|
133 | 252 |
|
253 |
||
254 |
example: horizontal default (center); vertical bottomSpaceMax |
|
5831 | 255 |
[exBegin] |
256 |
|v p b1 b2 b3| |
|
133 | 257 |
|
5831 | 258 |
v := StandardSystemView new. |
259 |
v label:'vL=bottomSpaceMax'. |
|
260 |
p := HorizontalPanelView in:v. |
|
261 |
p verticalLayout:#bottomSpaceMax. |
|
262 |
p origin:(0.0 @ 0.0) corner:(1.0 @ 1.0). |
|
263 |
b1 := Button label:'but1' in:p. b1 font:(b1 font size:8). |
|
264 |
b2 := Button label:'b2' in:p. b2 font:(b1 font size:24). |
|
265 |
b3 := Button label:'button3' in:p. |
|
266 |
v extent:300 @ 100. |
|
267 |
v open |
|
268 |
[exEnd] |
|
133 | 269 |
|
270 |
||
127 | 271 |
example: left-layout (vertical is default -> center) |
5831 | 272 |
fills left-to-right; no spacing before leftMost component |
273 |
[exBegin] |
|
274 |
|v p b1 b2 b3| |
|
38 | 275 |
|
5831 | 276 |
v := StandardSystemView new. |
277 |
p := HorizontalPanelView in:v. |
|
278 |
v label:'hL=left; vL=default (center)'. |
|
77 | 279 |
|
5831 | 280 |
p horizontalLayout:#left. |
281 |
p origin:(0.0 @ 0.0) corner:(1.0 @ 1.0). |
|
282 |
b1 := Button label:'button1' in:p. |
|
283 |
b2 := Button label:'button2' in:p. |
|
284 |
b3 := Button label:'button3' in:p. |
|
285 |
v extent:300 @ 100. |
|
286 |
v open |
|
287 |
[exEnd] |
|
38 | 288 |
|
289 |
||
127 | 290 |
example: left starting with spacing (vertical is default -> center) |
5831 | 291 |
fills left-to-right; spacing before leftMost component |
292 |
[exBegin] |
|
293 |
|v p b1 b2 b3| |
|
77 | 294 |
|
5831 | 295 |
v := StandardSystemView new. |
296 |
p := HorizontalPanelView in:v. |
|
297 |
v label:'hL=leftSpace; vL=center'. |
|
77 | 298 |
|
5831 | 299 |
p horizontalLayout:#leftSpace. |
300 |
p origin:(0.0 @ 0.0) corner:(1.0 @ 1.0). |
|
301 |
b1 := Button label:'button1' in:p. |
|
302 |
b2 := Button label:'button2' in:p. |
|
303 |
b3 := Button label:'button3' in:p. |
|
304 |
v extent:300 @ 100. |
|
305 |
v open |
|
306 |
[exEnd] |
|
77 | 307 |
|
308 |
||
127 | 309 |
example: leftFit-layout (vertical is default -> center) |
5831 | 310 |
fills left-to-right; resizes the rightMost component to fit |
311 |
[exBegin] |
|
312 |
|v p b1 b2 b3| |
|
0 | 313 |
|
5831 | 314 |
v := StandardSystemView new. |
315 |
p := HorizontalPanelView in:v. |
|
316 |
v label:'hL=leftFit; vL=center'. |
|
77 | 317 |
|
5831 | 318 |
p horizontalLayout:#leftFit. |
319 |
p origin:(0.0 @ 0.0) corner:(1.0 @ 1.0). |
|
320 |
b1 := Button label:'button1' in:p. |
|
321 |
b2 := Button label:'button2' in:p. |
|
322 |
b3 := Button label:'button3' in:p. |
|
323 |
v extent:300 @ 100. |
|
324 |
v open |
|
325 |
[exEnd] |
|
77 | 326 |
|
327 |
||
127 | 328 |
example: leftSpaceFit-layout (vertical is default -> center) |
5831 | 329 |
fills left-to-right; |
330 |
starts with spacing & resizes the rightMost component to fit with spacing |
|
331 |
[exBegin] |
|
332 |
|v p b1 b2 b3| |
|
77 | 333 |
|
5831 | 334 |
v := StandardSystemView new. |
335 |
p := HorizontalPanelView in:v. |
|
336 |
v label:'hL=leftSpaceFit; vL=center'. |
|
77 | 337 |
|
5831 | 338 |
p horizontalLayout:#leftSpaceFit. |
339 |
p origin:(0.0 @ 0.0) corner:(1.0 @ 1.0). |
|
340 |
b1 := Button label:'button1' in:p. |
|
341 |
b2 := Button label:'button2' in:p. |
|
342 |
b3 := Button label:'button3' in:p. |
|
343 |
v extent:300 @ 100. |
|
344 |
v open |
|
345 |
[exEnd] |
|
77 | 346 |
|
347 |
||
127 | 348 |
example: right-layout (vertical is default -> center) |
5831 | 349 |
right-to-left |
350 |
[exBegin] |
|
351 |
|v p b1 b2 b3| |
|
77 | 352 |
|
5831 | 353 |
v := StandardSystemView new. |
354 |
v viewBackground:Color yellow. |
|
355 |
p := HorizontalPanelView in:v. |
|
356 |
p viewBackground:Color red. |
|
357 |
v label:'hL=right; vL=center'. |
|
358 |
||
359 |
p horizontalLayout:#rightSpaceFit. |
|
360 |
p origin:(0.0 @ 0.0) corner:(1.0 @ 1.0). |
|
361 |
b1 := View in:p. b1 viewBackground:(Color green). |
|
362 |
b2 := View in:p. b2 viewBackground:(Color gray). |
|
363 |
b3 := View in:p. b3 viewBackground:(Color white). |
|
364 |
v extent:300 @ 100. |
|
365 |
v open |
|
366 |
[exEnd] |
|
38 | 367 |
|
368 |
||
127 | 369 |
example: right with initial spacing (vertical is default -> center) |
5831 | 370 |
right-to-left with spacing after last component |
371 |
[exBegin] |
|
372 |
|v p b1 b2 b3| |
|
77 | 373 |
|
5831 | 374 |
v := StandardSystemView new. |
375 |
p := HorizontalPanelView in:v. |
|
376 |
v label:'hL=rightSpace; vL=center'. |
|
77 | 377 |
|
5831 | 378 |
p horizontalLayout:#rightSpace. |
379 |
p origin:(0.0 @ 0.0) corner:(1.0 @ 1.0). |
|
380 |
b1 := Button label:'button1' in:p. |
|
381 |
b2 := Button label:'button2' in:p. |
|
382 |
b3 := Button label:'button3' in:p. |
|
383 |
v extent:300 @ 100. |
|
384 |
v open |
|
385 |
[exEnd] |
|
77 | 386 |
|
387 |
||
1306
bf4903012f7a
added #rightFit & #rightSpaceFit layouts
Claus Gittinger <cg@exept.de>
parents:
1291
diff
changeset
|
388 |
example: rightFit-layout (vertical is default -> center) |
5831 | 389 |
right-to-left; resize the leftMost component to fit |
390 |
[exBegin] |
|
391 |
|v p b1 b2 b3| |
|
1306
bf4903012f7a
added #rightFit & #rightSpaceFit layouts
Claus Gittinger <cg@exept.de>
parents:
1291
diff
changeset
|
392 |
|
5831 | 393 |
v := StandardSystemView new. |
394 |
p := HorizontalPanelView in:v. |
|
395 |
v label:'hL=rightFit; vL=center'. |
|
1306
bf4903012f7a
added #rightFit & #rightSpaceFit layouts
Claus Gittinger <cg@exept.de>
parents:
1291
diff
changeset
|
396 |
|
5831 | 397 |
p horizontalLayout:#rightFit. |
398 |
p origin:(0.0 @ 0.0) corner:(1.0 @ 1.0). |
|
399 |
b1 := Button label:'button1' in:p. |
|
400 |
b2 := Button label:'button2' in:p. |
|
401 |
b3 := Button label:'button3' in:p. |
|
402 |
v extent:300 @ 100. |
|
403 |
v open |
|
404 |
[exEnd] |
|
1306
bf4903012f7a
added #rightFit & #rightSpaceFit layouts
Claus Gittinger <cg@exept.de>
parents:
1291
diff
changeset
|
405 |
|
bf4903012f7a
added #rightFit & #rightSpaceFit layouts
Claus Gittinger <cg@exept.de>
parents:
1291
diff
changeset
|
406 |
|
bf4903012f7a
added #rightFit & #rightSpaceFit layouts
Claus Gittinger <cg@exept.de>
parents:
1291
diff
changeset
|
407 |
example: rightSpaceFit with initial spacing (vertical is default -> center) |
5831 | 408 |
right-to-left; start with spacing & resize the leftMost to fit |
409 |
[exBegin] |
|
410 |
|v p b1 b2 b3| |
|
1306
bf4903012f7a
added #rightFit & #rightSpaceFit layouts
Claus Gittinger <cg@exept.de>
parents:
1291
diff
changeset
|
411 |
|
5831 | 412 |
v := StandardSystemView new. |
413 |
p := HorizontalPanelView in:v. |
|
414 |
v label:'hL=rightSpaceFit; vL=center'. |
|
1306
bf4903012f7a
added #rightFit & #rightSpaceFit layouts
Claus Gittinger <cg@exept.de>
parents:
1291
diff
changeset
|
415 |
|
5831 | 416 |
p horizontalLayout:#rightSpaceFit. |
417 |
p origin:(0.0 @ 0.0) corner:(1.0 @ 1.0). |
|
418 |
b1 := Button label:'button1' in:p. |
|
419 |
b2 := Button label:'button2' in:p. |
|
420 |
b3 := Button label:'button3' in:p. |
|
421 |
v extent:300 @ 100. |
|
422 |
v open |
|
423 |
[exEnd] |
|
1306
bf4903012f7a
added #rightFit & #rightSpaceFit layouts
Claus Gittinger <cg@exept.de>
parents:
1291
diff
changeset
|
424 |
|
bf4903012f7a
added #rightFit & #rightSpaceFit layouts
Claus Gittinger <cg@exept.de>
parents:
1291
diff
changeset
|
425 |
|
127 | 426 |
example: fit-layout (vertical is default -> center) |
5831 | 427 |
[exBegin] |
428 |
|v p b1 b2 b3| |
|
38 | 429 |
|
5831 | 430 |
v := StandardSystemView new. |
431 |
p := HorizontalPanelView in:v. |
|
432 |
p horizontalLayout:#fit. |
|
433 |
v label:'hL=fit; vL=center'. |
|
38 | 434 |
|
5831 | 435 |
p origin:(0.0 @ 0.0) corner:(1.0 @ 1.0). |
436 |
b1 := Button label:'button1' in:p. |
|
437 |
b2 := Button label:'button2' in:p. |
|
438 |
b3 := Button label:'button3' in:p. |
|
439 |
v extent:300 @ 100. |
|
440 |
v open |
|
441 |
[exEnd] |
|
77 | 442 |
|
443 |
||
127 | 444 |
example: full fit i.e. no spacing (vertical is default -> center) |
5831 | 445 |
[exBegin] |
446 |
|v p b1 b2 b3| |
|
77 | 447 |
|
5831 | 448 |
v := StandardSystemView new. |
449 |
p := HorizontalPanelView in:v. |
|
450 |
p horizontalLayout:#fit. |
|
451 |
p horizontalSpace:0. |
|
452 |
v label:'hL=fit hS=0; vL=center'. |
|
77 | 453 |
|
5831 | 454 |
p origin:(0.0 @ 0.0) corner:(1.0 @ 1.0). |
455 |
b1 := Button label:'button1' in:p. |
|
456 |
b2 := Button label:'button2' in:p. |
|
457 |
b3 := Button label:'button3' in:p. |
|
458 |
v extent:300 @ 100. |
|
459 |
v open |
|
460 |
[exEnd] |
|
77 | 461 |
|
462 |
||
127 | 463 |
example: fit with spacing (vertical is default -> center) |
5831 | 464 |
[exBegin] |
465 |
|v p b1 b2 b3| |
|
77 | 466 |
|
5831 | 467 |
v := StandardSystemView new. |
468 |
p := HorizontalPanelView in:v. |
|
469 |
v label:'hL=fitSpace; vL=center'. |
|
77 | 470 |
|
5831 | 471 |
p horizontalLayout:#fitSpace. |
472 |
p origin:(0.0 @ 0.0) corner:(1.0 @ 1.0). |
|
473 |
b1 := Button label:'button1' in:p. |
|
474 |
b2 := Button label:'button2' in:p. |
|
475 |
b3 := Button label:'button3' in:p. |
|
476 |
v extent:300 @ 100. |
|
477 |
v open |
|
478 |
[exEnd] |
|
62 | 479 |
|
77 | 480 |
|
127 | 481 |
example: spread-layout (vertical is default -> center) |
5831 | 482 |
[exBegin] |
483 |
|v p b1 b2 b3| |
|
77 | 484 |
|
5831 | 485 |
v := StandardSystemView new. |
486 |
p := HorizontalPanelView in:v. |
|
487 |
p horizontalLayout:#spread. |
|
488 |
v label:'hL=spread; vL=center'. |
|
77 | 489 |
|
5831 | 490 |
p origin:(0.0 @ 0.0) corner:(1.0 @ 1.0). |
491 |
b1 := Button label:'button1' in:p. |
|
492 |
b2 := Button label:'button2' in:p. |
|
493 |
b3 := Button label:'button3' in:p. |
|
494 |
v extent:300 @ 100. |
|
495 |
v open |
|
496 |
[exEnd] |
|
77 | 497 |
|
498 |
||
127 | 499 |
example: spread with spacing (vertical is default -> center) |
5831 | 500 |
[exBegin] |
501 |
|v p b1 b2 b3| |
|
77 | 502 |
|
5831 | 503 |
v := StandardSystemView new. |
504 |
p := HorizontalPanelView in:v. |
|
505 |
v label:'hL=spreadSpace; vL=center'. |
|
77 | 506 |
|
5831 | 507 |
p horizontalLayout:#spreadSpace. |
508 |
p origin:(0.0 @ 0.0) corner:(1.0 @ 1.0). |
|
509 |
b1 := Button label:'button1' in:p. |
|
510 |
b2 := Button label:'button2' in:p. |
|
511 |
b3 := Button label:'button3' in:p. |
|
512 |
v extent:300 @ 100. |
|
513 |
v open |
|
514 |
[exEnd] |
|
77 | 515 |
|
516 |
||
517 |
example: spread with spacing; vertical fit |
|
5831 | 518 |
[exBegin] |
519 |
|v p b1 b2 b3| |
|
77 | 520 |
|
5831 | 521 |
v := StandardSystemView new. |
522 |
p := HorizontalPanelView in:v. |
|
523 |
v label:'hL=spreadSpace; vL=fit'. |
|
77 | 524 |
|
5831 | 525 |
p horizontalLayout:#spreadSpace. |
526 |
p verticalLayout:#fit. |
|
527 |
p origin:(0.0 @ 0.0) corner:(1.0 @ 1.0). |
|
528 |
b1 := Button label:'button1' in:p. |
|
529 |
b2 := Button label:'button2' in:p. |
|
530 |
b3 := Button label:'button3' in:p. |
|
531 |
v extent:300 @ 100. |
|
532 |
v open |
|
533 |
[exEnd] |
|
77 | 534 |
|
535 |
||
536 |
example: spread with spacing; vertical fit with spacing |
|
5831 | 537 |
[exBegin] |
538 |
|v p b1 b2 b3| |
|
77 | 539 |
|
5831 | 540 |
v := StandardSystemView new. |
541 |
p := HorizontalPanelView in:v. |
|
542 |
v label:'hL=spreadSpace; vL=fitSpace'. |
|
77 | 543 |
|
5831 | 544 |
p horizontalLayout:#spreadSpace. |
545 |
p verticalLayout:#fitSpace. |
|
546 |
p origin:(0.0 @ 0.0) corner:(1.0 @ 1.0). |
|
547 |
b1 := Button label:'button1' in:p. |
|
548 |
b2 := Button label:'button2' in:p. |
|
549 |
b3 := Button label:'button3' in:p. |
|
550 |
v extent:300 @ 100. |
|
551 |
v open |
|
552 |
[exEnd] |
|
77 | 553 |
|
554 |
||
62 | 555 |
example: fit - top |
5831 | 556 |
[exBegin] |
557 |
|v p b1 b2 b3| |
|
62 | 558 |
|
5831 | 559 |
v := StandardSystemView new. |
560 |
p := HorizontalPanelView in:v. |
|
561 |
v label:'hL=fit; vL=top'. |
|
77 | 562 |
|
5831 | 563 |
p horizontalLayout:#fit. |
564 |
p verticalLayout:#top. |
|
565 |
p origin:(0.0 @ 0.0) corner:(1.0 @ 1.0). |
|
566 |
b1 := Button label:'button1' in:p. |
|
567 |
b2 := Button label:'button2' in:p. |
|
568 |
b3 := Button label:'button3' in:p. |
|
569 |
v extent:300 @ 100. |
|
570 |
v open |
|
571 |
[exEnd] |
|
62 | 572 |
|
77 | 573 |
|
574 |
example: fit with initial spacing |
|
5831 | 575 |
[exBegin] |
576 |
|v p b1 b2 b3| |
|
77 | 577 |
|
5831 | 578 |
v := StandardSystemView new. |
579 |
p := HorizontalPanelView in:v. |
|
580 |
v label:'hL=fitSpace; vL=top'. |
|
77 | 581 |
|
5831 | 582 |
p horizontalLayout:#fitSpace. |
583 |
p verticalLayout:#top. |
|
584 |
p origin:(0.0 @ 0.0) corner:(1.0 @ 1.0). |
|
585 |
b1 := Button label:'button1' in:p. |
|
586 |
b2 := Button label:'button2' in:p. |
|
587 |
b3 := Button label:'button3' in:p. |
|
588 |
v extent:300 @ 100. |
|
589 |
v open |
|
590 |
[exEnd] |
|
77 | 591 |
|
592 |
||
593 |
example: fit with initial spacing in both directions |
|
5831 | 594 |
[exBegin] |
595 |
|v p b1 b2 b3| |
|
77 | 596 |
|
5831 | 597 |
v := StandardSystemView new. |
598 |
p := HorizontalPanelView in:v. |
|
599 |
v label:'hL=fitSpace; vL=fitSpace'. |
|
77 | 600 |
|
5831 | 601 |
p horizontalLayout:#fitSpace. |
602 |
p verticalLayout:#fitSpace. |
|
603 |
p origin:(0.0 @ 0.0) corner:(1.0 @ 1.0). |
|
604 |
b1 := Button label:'button1' in:p. |
|
605 |
b2 := Button label:'button2' in:p. |
|
606 |
b3 := Button label:'button3' in:p. |
|
607 |
v extent:300 @ 100. |
|
608 |
v open |
|
609 |
[exEnd] |
|
77 | 610 |
|
611 |
||
612 |
example: fit without spacing in both directions |
|
5831 | 613 |
[exBegin] |
614 |
|v p b1 b2 b3| |
|
77 | 615 |
|
5831 | 616 |
v := StandardSystemView new. |
617 |
p := HorizontalPanelView in:v. |
|
618 |
v label:'hL=fit hS=0; vL=fit'. |
|
77 | 619 |
|
5831 | 620 |
p horizontalLayout:#fit. |
621 |
p verticalLayout:#fit. |
|
622 |
p horizontalSpace:0. |
|
623 |
p origin:(0.0 @ 0.0) corner:(1.0 @ 1.0). |
|
624 |
b1 := Button label:'button1' in:p. |
|
625 |
b2 := Button label:'button2' in:p. |
|
626 |
b3 := Button label:'button3' in:p. |
|
627 |
v extent:300 @ 100. |
|
628 |
v open |
|
629 |
[exEnd] |
|
77 | 630 |
|
631 |
||
632 |
example: fit with initial spacing; top with spacing |
|
5831 | 633 |
[exBegin] |
634 |
|v p b1 b2 b3| |
|
77 | 635 |
|
5831 | 636 |
v := StandardSystemView new. |
637 |
p := HorizontalPanelView in:v. |
|
638 |
v label:'hL=fitSpace; vL=topSpace'. |
|
77 | 639 |
|
5831 | 640 |
p horizontalLayout:#fitSpace. |
641 |
p verticalLayout:#topSpace. |
|
642 |
p origin:(0.0 @ 0.0) corner:(1.0 @ 1.0). |
|
643 |
b1 := Button label:'button1' in:p. |
|
644 |
b2 := Button label:'button2' in:p. |
|
645 |
b3 := Button label:'button3' in:p. |
|
646 |
v extent:300 @ 100. |
|
647 |
v open |
|
648 |
[exEnd] |
|
77 | 649 |
|
650 |
||
62 | 651 |
example: fit - top without spacing |
5831 | 652 |
[exBegin] |
653 |
|v p b1 b2 b3| |
|
62 | 654 |
|
5831 | 655 |
v := StandardSystemView new. |
656 |
p := HorizontalPanelView in:v. |
|
657 |
v label:'hL=fit; vL=top'. |
|
77 | 658 |
|
5831 | 659 |
p horizontalLayout:#fit. |
660 |
p verticalLayout:#top. |
|
661 |
p horizontalSpace:0. |
|
662 |
p origin:(0.0 @ 0.0) corner:(1.0 @ 1.0). |
|
663 |
b1 := Button label:'button1' in:p. |
|
664 |
b2 := Button label:'button2' in:p. |
|
665 |
b3 := Button label:'button3' in:p. |
|
666 |
v extent:300 @ 100. |
|
667 |
v open |
|
668 |
[exEnd] |
|
62 | 669 |
|
77 | 670 |
|
62 | 671 |
example: fit - bottom with spacing and bottomSpace |
5831 | 672 |
[exBegin] |
673 |
|v p b1 b2 b3| |
|
62 | 674 |
|
5831 | 675 |
v := StandardSystemView new. |
676 |
p := HorizontalPanelView in:v. |
|
677 |
v label:'hL=fitSpace; vL=bottomSpace'. |
|
77 | 678 |
|
5831 | 679 |
p horizontalLayout:#fitSpace. |
680 |
p verticalLayout:#bottomSpace. |
|
681 |
p origin:(0.0 @ 0.0) corner:(1.0 @ 1.0). |
|
682 |
b1 := Button label:'button1' in:p. |
|
683 |
b2 := Button label:'button2' in:p. |
|
684 |
b3 := Button label:'button3' in:p. |
|
685 |
v extent:300 @ 100. |
|
686 |
v open |
|
687 |
[exEnd] |
|
62 | 688 |
|
77 | 689 |
|
62 | 690 |
example: fit no horizontal space - bottom with spacing and bottomSpace |
5831 | 691 |
[exBegin] |
692 |
|v p b1 b2 b3| |
|
62 | 693 |
|
5831 | 694 |
v := StandardSystemView new. |
695 |
p := HorizontalPanelView in:v. |
|
696 |
v label:'hL=fit; vL=bottomSpace'. |
|
77 | 697 |
|
5831 | 698 |
p horizontalLayout:#fit. |
699 |
p verticalLayout:#bottomSpace. |
|
700 |
p horizontalSpace:0. |
|
701 |
p origin:(0.0 @ 0.0) corner:(1.0 @ 1.0). |
|
702 |
b1 := Button label:'button1' in:p. |
|
703 |
b2 := Button label:'button2' in:p. |
|
704 |
b3 := Button label:'button3' in:p. |
|
705 |
v extent:300 @ 100. |
|
706 |
v open |
|
707 |
[exEnd] |
|
77 | 708 |
|
133 | 709 |
example: leftMax - vertical default |
5831 | 710 |
[exBegin] |
711 |
|v p b1 b2 b3| |
|
133 | 712 |
|
5831 | 713 |
v := StandardSystemView new. |
714 |
p := HorizontalPanelView in:v. |
|
715 |
v label:'hL=leftMax; vL=default'. |
|
133 | 716 |
|
5831 | 717 |
p horizontalLayout:#leftMax. |
718 |
p origin:(0.0 @ 0.0) corner:(1.0 @ 1.0). |
|
719 |
b1 := Button label:'button1' in:p. |
|
720 |
b2 := Button label:'b2' in:p. |
|
721 |
b3 := Button label:'but3' in:p. |
|
722 |
v extent:300 @ 100. |
|
723 |
v open |
|
724 |
[exEnd] |
|
133 | 725 |
|
726 |
||
727 |
example: leftSpaceMax - vertical default |
|
5831 | 728 |
[exBegin] |
729 |
|v p b1 b2 b3| |
|
133 | 730 |
|
5831 | 731 |
v := StandardSystemView new. |
732 |
p := HorizontalPanelView in:v. |
|
733 |
v label:'hL=leftSpaceMax; vL=default'. |
|
133 | 734 |
|
5831 | 735 |
p horizontalLayout:#leftSpaceMax. |
736 |
p origin:(0.0 @ 0.0) corner:(1.0 @ 1.0). |
|
737 |
b1 := Button label:'button1' in:p. |
|
738 |
b2 := Button label:'b2' in:p. |
|
739 |
b3 := Button label:'but3' in:p. |
|
740 |
v extent:300 @ 100. |
|
741 |
v open |
|
742 |
[exEnd] |
|
133 | 743 |
|
744 |
||
745 |
example: rightMax - vertical default |
|
5831 | 746 |
[exBegin] |
747 |
|v p b1 b2 b3| |
|
133 | 748 |
|
5831 | 749 |
v := StandardSystemView new. |
750 |
p := HorizontalPanelView in:v. |
|
751 |
v label:'hL=rightMax; vL=default'. |
|
133 | 752 |
|
5831 | 753 |
p horizontalLayout:#rightMax. |
754 |
p origin:(0.0 @ 0.0) corner:(1.0 @ 1.0). |
|
755 |
b1 := Button label:'button1' in:p. |
|
756 |
b2 := Button label:'b2' in:p. |
|
757 |
b3 := Button label:'but3' in:p. |
|
758 |
v extent:300 @ 100. |
|
759 |
v open |
|
760 |
[exEnd] |
|
133 | 761 |
|
762 |
||
763 |
example: rightSpaceMax - vertical default |
|
5831 | 764 |
[exBegin] |
765 |
|v p b1 b2 b3| |
|
133 | 766 |
|
5831 | 767 |
v := StandardSystemView new. |
768 |
p := HorizontalPanelView in:v. |
|
769 |
v label:'hL=rightSpaceMax; vL=default'. |
|
133 | 770 |
|
5831 | 771 |
p horizontalLayout:#rightSpaceMax. |
772 |
p origin:(0.0 @ 0.0) corner:(1.0 @ 1.0). |
|
773 |
b1 := Button label:'button1' in:p. |
|
774 |
b2 := Button label:'b2' in:p. |
|
775 |
b3 := Button label:'but3' in:p. |
|
776 |
v extent:300 @ 100. |
|
777 |
v open |
|
778 |
[exEnd] |
|
133 | 779 |
|
780 |
||
781 |
example: centerMax - vertical default |
|
5831 | 782 |
[exBegin] |
783 |
|v p b1 b2 b3| |
|
133 | 784 |
|
5831 | 785 |
v := StandardSystemView new. |
786 |
p := HorizontalPanelView in:v. |
|
787 |
v label:'hL=centerMax; vL=default'. |
|
133 | 788 |
|
5831 | 789 |
p horizontalLayout:#centerMax. |
790 |
p origin:(0.0 @ 0.0) corner:(1.0 @ 1.0). |
|
791 |
b1 := Button label:'button1' in:p. |
|
792 |
b2 := Button label:'b2' in:p. |
|
793 |
b3 := Button label:'but3' in:p. |
|
794 |
v extent:300 @ 100. |
|
795 |
v open |
|
796 |
[exEnd] |
|
133 | 797 |
|
798 |
||
799 |
example: spreadMax - vertical default |
|
5831 | 800 |
[exBegin] |
801 |
|v p b1 b2 b3| |
|
133 | 802 |
|
5831 | 803 |
v := StandardSystemView new. |
804 |
p := HorizontalPanelView in:v. |
|
805 |
v label:'hL=spreadMax; vL=default'. |
|
133 | 806 |
|
5831 | 807 |
p horizontalLayout:#spreadMax. |
808 |
p origin:(0.0 @ 0.0) corner:(1.0 @ 1.0). |
|
809 |
b1 := Button label:'button1' in:p. |
|
810 |
b2 := Button label:'b2' in:p. |
|
811 |
b3 := Button label:'but3' in:p. |
|
812 |
v extent:300 @ 100. |
|
813 |
v open |
|
814 |
[exEnd] |
|
133 | 815 |
|
816 |
||
817 |
example: spreadSpaceMax - vertical default |
|
5831 | 818 |
[exBegin] |
819 |
|v p b1 b2 b3| |
|
133 | 820 |
|
5831 | 821 |
v := StandardSystemView new. |
822 |
p := HorizontalPanelView in:v. |
|
823 |
v label:'hL=spreadSpaceMax; vL=default'. |
|
133 | 824 |
|
5831 | 825 |
p horizontalLayout:#spreadSpaceMax. |
826 |
p origin:(0.0 @ 0.0) corner:(1.0 @ 1.0). |
|
827 |
b1 := Button label:'button1' in:p. |
|
828 |
b2 := Button label:'b2' in:p. |
|
829 |
b3 := Button label:'but3' in:p. |
|
830 |
v extent:300 @ 100. |
|
831 |
v open |
|
832 |
[exEnd] |
|
133 | 833 |
|
834 |
||
835 |
example: maximize elements in both directions and center |
|
5831 | 836 |
[exBegin] |
837 |
|v p b1 b2 b3| |
|
133 | 838 |
|
5831 | 839 |
v := StandardSystemView new. |
840 |
v label:'hL=centerMax; vL=centerMax'. |
|
133 | 841 |
|
5831 | 842 |
p := HorizontalPanelView in:v. |
843 |
p horizontalLayout:#centerMax. |
|
844 |
p verticalLayout:#centerMax. |
|
845 |
p origin:(0.0 @ 0.0) corner:(1.0 @ 1.0). |
|
846 |
b1 := Button label:'but1' in:p. b1 font:(b1 font size:8). |
|
847 |
b2 := Button label:'b2' in:p. b2 font:(b1 font size:24). |
|
848 |
b3 := Button label:'button3' in:p. |
|
849 |
v extent:300 @ 100. |
|
850 |
v open |
|
851 |
[exEnd] |
|
133 | 852 |
|
853 |
||
118 | 854 |
example: placing hPanels into a vPanel |
5831 | 855 |
[exBegin] |
856 |
|v vP hP1 hP2 hP3 b1 b2 b3 b4 b5 b6 b7 b8 b9| |
|
118 | 857 |
|
5831 | 858 |
v := StandardSystemView new. |
859 |
vP := VerticalPanelView in:v. |
|
860 |
vP origin:(0.0 @ 0.0) corner:(1.0 @ 1.0). |
|
861 |
vP verticalLayout:#fit; |
|
862 |
verticalSpace:0; |
|
863 |
horizontalLayout:#fit. |
|
118 | 864 |
|
5831 | 865 |
hP1 := HorizontalPanelView in:vP. |
866 |
hP1 horizontalLayout:#fitSpace; |
|
867 |
verticalLayout:#center. |
|
868 |
b1 := Button label:'button1' in:hP1. |
|
869 |
b2 := Button label:'button2' in:hP1. |
|
870 |
b3 := Button label:'button3' in:hP1. |
|
118 | 871 |
|
5831 | 872 |
hP2 := HorizontalPanelView in:vP. |
873 |
hP2 horizontalLayout:#fitSpace; |
|
874 |
verticalLayout:#center. |
|
875 |
b4 := Button label:'button4' in:hP2. |
|
876 |
b5 := Button label:'button5' in:hP2. |
|
877 |
b6 := Button label:'button6' in:hP2. |
|
118 | 878 |
|
5831 | 879 |
hP3 := HorizontalPanelView in:vP. |
880 |
hP3 horizontalLayout:#fitSpace; |
|
881 |
verticalLayout:#center. |
|
882 |
b7 := Button label:'button7' in:hP3. |
|
883 |
b8 := Button label:'button8' in:hP3. |
|
884 |
b9 := Button label:'button9' in:hP3. |
|
118 | 885 |
|
5831 | 886 |
v extent:300 @ 300. |
887 |
v open |
|
888 |
[exEnd] |
|
118 | 889 |
|
1306
bf4903012f7a
added #rightFit & #rightSpaceFit layouts
Claus Gittinger <cg@exept.de>
parents:
1291
diff
changeset
|
890 |
example: a browser like table, the two left tables have a fix width, |
5831 | 891 |
while the rightmost list extends to the far right. |
892 |
[exBegin] |
|
893 |
|v p l1 l2 l3| |
|
77 | 894 |
|
5831 | 895 |
v := StandardSystemView new. |
896 |
p := HorizontalPanelView in:v. |
|
897 |
v label:'hL=leftFit hS=0; vL=fit'. |
|
77 | 898 |
|
5831 | 899 |
p horizontalLayout:#leftFit. |
900 |
p horizontalSpace:0. |
|
901 |
p verticalLayout:#fit. |
|
902 |
p origin:(0.0 @ 0.0) corner:(1.0 @ 1.0). |
|
77 | 903 |
|
5831 | 904 |
l1 := ScrollableView for:FileSelectionList in:p. |
905 |
l1 stayInDirectory:true. |
|
906 |
l1 ignoreParentDirectory:true. |
|
907 |
l1 directory:'/'. |
|
908 |
l1 action:[:selection | l2 directory:(l1 selectedPathname)]. |
|
77 | 909 |
|
5831 | 910 |
l2 := ScrollableView for:FileSelectionList in:p. |
911 |
l2 stayInDirectory:true. |
|
912 |
l2 directory:nil. |
|
913 |
l2 ignoreParentDirectory:true. |
|
914 |
l2 action:[:selection | l3 directory:(l2 selectedPathname)]. |
|
77 | 915 |
|
5831 | 916 |
l3 := ScrollableView for:FileSelectionList in:p. |
917 |
l3 directory:nil. |
|
918 |
l3 ignoreParentDirectory:false. |
|
919 |
v extent:400 @ 300. |
|
920 |
v open |
|
921 |
[exEnd] |
|
125 | 922 |
|
923 |
||
1306
bf4903012f7a
added #rightFit & #rightSpaceFit layouts
Claus Gittinger <cg@exept.de>
parents:
1291
diff
changeset
|
924 |
trouble example: self-resizing elements may cause trouble |
5831 | 925 |
[exBegin] |
926 |
|v p l1 l2 l3| |
|
125 | 927 |
|
5831 | 928 |
v := StandardSystemView new. |
929 |
p := HorizontalPanelView origin:(0.0 @ 0.0) corner:(1.0 @ 1.0) in:v. |
|
593 | 930 |
|
5831 | 931 |
l1 := (Label label:'one' in:p) level:-1. |
932 |
l2 := (Label label:'two' in:p) level:-1. |
|
933 |
l3 := (Label label:'three' in:p) level:-1. |
|
125 | 934 |
|
5831 | 935 |
v extent:400 @ 300. |
936 |
v open. |
|
593 | 937 |
|
5831 | 938 |
(Delay forSeconds:5) wait. |
125 | 939 |
|
5831 | 940 |
l1 label:'oneone'. |
941 |
l2 label:'twotwo'. |
|
942 |
l3 label:'threethree'. |
|
943 |
[exEnd] |
|
125 | 944 |
|
945 |
||
946 |
fixed trouble example: tell the panel that this situation may happen |
|
5831 | 947 |
[exBegin] |
948 |
|v p l1 l2 l3| |
|
125 | 949 |
|
5831 | 950 |
v := StandardSystemView new. |
951 |
p := HorizontalPanelView origin:(0.0 @ 0.0) corner:(1.0 @ 1.0) in:v. |
|
952 |
p elementsChangeSize:true. |
|
125 | 953 |
|
5831 | 954 |
l1 := (Label label:'one' in:p) level:-1. |
955 |
l2 := (Label label:'two' in:p) level:-1. |
|
956 |
l3 := (Label label:'three' in:p) level:-1. |
|
593 | 957 |
|
5831 | 958 |
v extent:400 @ 300. |
959 |
v open. |
|
125 | 960 |
|
5831 | 961 |
(Delay forSeconds:5) wait. |
125 | 962 |
|
5831 | 963 |
l1 label:'oneone'. |
964 |
l2 label:'twotwo'. |
|
965 |
l3 label:'threethree'. |
|
966 |
[exEnd] |
|
38 | 967 |
" |
968 |
! ! |
|
0 | 969 |
|
5227 | 970 |
!HorizontalPanelView class methodsFor:'queries'! |
971 |
||
972 |
possibleHorizontalLayouts |
|
973 |
^ #( |
|
974 |
#okCancelBox |
|
975 |
||
976 |
#left |
|
977 |
#leftSpace |
|
978 |
#fixLeft |
|
979 |
#fixLeftSpace |
|
980 |
#right |
|
981 |
#rightSpace |
|
982 |
#center |
|
983 |
#spread |
|
984 |
#spreadSpace |
|
985 |
#fit |
|
986 |
#fitSpace |
|
987 |
#leftFit |
|
988 |
#leftSpaceFit |
|
989 |
#rightFit |
|
990 |
#rightSpaceFit |
|
991 |
||
992 |
#leftMax |
|
993 |
#leftSpaceMax |
|
994 |
#rightMax |
|
995 |
#rightSpaceMax |
|
996 |
#centerMax |
|
997 |
#spreadMax |
|
998 |
#spreadSpaceMax |
|
999 |
) |
|
1000 |
! |
|
1001 |
||
1002 |
possibleVerticalLayouts |
|
1003 |
^ #( |
|
1004 |
#top |
|
1005 |
#topSpace |
|
1006 |
#center |
|
1007 |
#bottom |
|
1008 |
#bottomSpace |
|
1009 |
#fit |
|
1010 |
#fitSpace |
|
1011 |
#topMax |
|
1012 |
#topSpaceMax |
|
1013 |
#bottomMax |
|
1014 |
#bottomSpaceMax |
|
1015 |
#centerMax |
|
1016 |
) |
|
1017 |
! ! |
|
1018 |
||
62 | 1019 |
!HorizontalPanelView methodsFor:'accessing'! |
1020 |
||
1021 |
horizontalLayout |
|
1022 |
"return the horizontal layout as symbol. |
|
1023 |
the returned value is one of |
|
1418
3397ec6b8419
added ignoreInvisibleComponents stuff
Claus Gittinger <cg@exept.de>
parents:
1306
diff
changeset
|
1024 |
#left arrange elements at the left |
3397ec6b8419
added ignoreInvisibleComponents stuff
Claus Gittinger <cg@exept.de>
parents:
1306
diff
changeset
|
1025 |
#leftSpace arrange elements at the left, start with spacing |
3397ec6b8419
added ignoreInvisibleComponents stuff
Claus Gittinger <cg@exept.de>
parents:
1306
diff
changeset
|
1026 |
#fixLeft same as #left, but do not reduce spacing in case of no fit |
3397ec6b8419
added ignoreInvisibleComponents stuff
Claus Gittinger <cg@exept.de>
parents:
1306
diff
changeset
|
1027 |
#fixLeftSpace same as #leftSpace, but do not reduce spacing in case of no fit |
3397ec6b8419
added ignoreInvisibleComponents stuff
Claus Gittinger <cg@exept.de>
parents:
1306
diff
changeset
|
1028 |
#right arrange elements at the right |
3397ec6b8419
added ignoreInvisibleComponents stuff
Claus Gittinger <cg@exept.de>
parents:
1306
diff
changeset
|
1029 |
#rightSpace arrange elements at the right, start with spacing |
3397ec6b8419
added ignoreInvisibleComponents stuff
Claus Gittinger <cg@exept.de>
parents:
1306
diff
changeset
|
1030 |
#center arrange elements in the center |
3397ec6b8419
added ignoreInvisibleComponents stuff
Claus Gittinger <cg@exept.de>
parents:
1306
diff
changeset
|
1031 |
#spread spread elements evenly |
3397ec6b8419
added ignoreInvisibleComponents stuff
Claus Gittinger <cg@exept.de>
parents:
1306
diff
changeset
|
1032 |
#spreadSpace spread elements evenly with spacing at the ends |
3397ec6b8419
added ignoreInvisibleComponents stuff
Claus Gittinger <cg@exept.de>
parents:
1306
diff
changeset
|
1033 |
#fit like #spread, but resize elements for tight packing |
3397ec6b8419
added ignoreInvisibleComponents stuff
Claus Gittinger <cg@exept.de>
parents:
1306
diff
changeset
|
1034 |
#fitSpace like #fit, with additional spacing at the far ends |
3397ec6b8419
added ignoreInvisibleComponents stuff
Claus Gittinger <cg@exept.de>
parents:
1306
diff
changeset
|
1035 |
#leftFit like #left, but resize the last element to fit |
3397ec6b8419
added ignoreInvisibleComponents stuff
Claus Gittinger <cg@exept.de>
parents:
1306
diff
changeset
|
1036 |
#leftSpaceFit like #leftSpace, but resize the last element to fit |
3397ec6b8419
added ignoreInvisibleComponents stuff
Claus Gittinger <cg@exept.de>
parents:
1306
diff
changeset
|
1037 |
#rightFit like #right, but resize the first element to fit |
3397ec6b8419
added ignoreInvisibleComponents stuff
Claus Gittinger <cg@exept.de>
parents:
1306
diff
changeset
|
1038 |
#rightSpaceFit like #rightSpace, but resize the first element to fit |
77 | 1039 |
the default is #center |
118 | 1040 |
See the class documentation for the meanings. |
62 | 1041 |
" |
1042 |
||
1043 |
^ hLayout |
|
1306
bf4903012f7a
added #rightFit & #rightSpaceFit layouts
Claus Gittinger <cg@exept.de>
parents:
1291
diff
changeset
|
1044 |
|
bf4903012f7a
added #rightFit & #rightSpaceFit layouts
Claus Gittinger <cg@exept.de>
parents:
1291
diff
changeset
|
1045 |
"Modified: 17.8.1997 / 15:21:26 / cg" |
62 | 1046 |
! |
1047 |
||
5227 | 1048 |
horizontalLayout:layoutSymbolArg |
62 | 1049 |
"change the horizontal layout as symbol. |
1050 |
The argument, aSymbol must be one of: |
|
5227 | 1051 |
#okCancelBox window system specific. Will dynamically be one of: |
1052 |
#maxRightSpace or #fitSpace, depending on style sheet value. |
|
1053 |
||
1054 |
#left arrange elements at the left |
|
1055 |
#leftSpace arrange elements at the left, start with spacing |
|
1056 |
#fixLeft same as #left, but do not reduce spacing in case of no fit |
|
1057 |
#fixLeftSpace same as #leftSpace, but do not reduce spacing in case of no fit |
|
1058 |
#right arrange elements at the right |
|
1059 |
#rightSpace arrange elements at the right, start with spacing |
|
1060 |
#center arrange elements in the center |
|
1061 |
#spread spread elements evenly |
|
1062 |
#spreadSpace spread elements evenly with spacing at the ends |
|
1063 |
#fit like #spread, but resize elements for tight packing |
|
1064 |
#fitSpace like #fit, with additional spacing at the far ends |
|
1065 |
#leftFit like #left, but resize the last element to fit |
|
1066 |
#leftSpaceFit like #leftSpace, but resize the last element to fit |
|
1067 |
#rightFit like #right, but resize the first element to fit |
|
1068 |
#rightSpaceFit like #rightSpace, but resize the first element to fit |
|
1306
bf4903012f7a
added #rightFit & #rightSpaceFit layouts
Claus Gittinger <cg@exept.de>
parents:
1291
diff
changeset
|
1069 |
|
5227 | 1070 |
#leftMax like non-Max layouts, resizing components to |
1071 |
#leftSpaceMax the width of the widest component |
|
1072 |
#rightMax |
|
1073 |
#rightSpaceMax |
|
1074 |
#centerMax |
|
1075 |
#spreadMax |
|
1076 |
#spreadSpaceMax |
|
118 | 1077 |
the default (if never changed) is #center. |
1306
bf4903012f7a
added #rightFit & #rightSpaceFit layouts
Claus Gittinger <cg@exept.de>
parents:
1291
diff
changeset
|
1078 |
See the class documentation for the meanings. |
62 | 1079 |
" |
1080 |
||
5227 | 1081 |
|layoutSymbol| |
1082 |
||
1083 |
layoutSymbol := layoutSymbolArg. |
|
1084 |
layoutSymbol == #okCancelBox ifTrue:[ |
|
1085 |
layoutSymbol := styleSheet at:#'horizontalPanel.okCancelBox' default:#fitSpace. |
|
1086 |
]. |
|
1087 |
||
1088 |
(hLayout ~~ layoutSymbol) ifTrue:[ |
|
1089 |
hLayout := layoutSymbol. |
|
1090 |
self layoutChanged |
|
62 | 1091 |
] |
1156 | 1092 |
|
1306
bf4903012f7a
added #rightFit & #rightSpaceFit layouts
Claus Gittinger <cg@exept.de>
parents:
1291
diff
changeset
|
1093 |
"Modified: 17.8.1997 / 15:21:16 / cg" |
62 | 1094 |
! |
1095 |
||
202 | 1096 |
layout:something |
1097 |
"OBSOLETE compatibility interface. Will vanish. |
|
1098 |
leftover for historic reasons - do not use any more. |
|
1099 |
In the meantime, try to figure out what is meant ... a kludge" |
|
1100 |
||
2365 | 1101 |
<resource:#obsolete> |
1102 |
||
202 | 1103 |
something isLayout ifTrue:[^ super layout:something]. |
1104 |
||
1105 |
self obsoleteMethodWarning:'use #horizontalLayout:'. |
|
1106 |
^ self horizontalLayout:something |
|
1107 |
||
1108 |
"Modified: 31.8.1995 / 23:07:33 / claus" |
|
1109 |
! |
|
1110 |
||
2099 | 1111 |
reverseOrderIfOKAtLeft |
1112 |
"return the reverseOrderIfOKAtLeft flag. |
|
1113 |
This can be set for OK-Cancel like panels, where the OK Button should |
|
1114 |
be positioned on the left for some viewStyles." |
|
1115 |
||
1116 |
^ reverseOrderIfOKAtLeft |
|
1117 |
! |
|
1118 |
||
2039
ad9313ab0151
added support for component reversal if OK-atLeft
Claus Gittinger <cg@exept.de>
parents:
2033
diff
changeset
|
1119 |
reverseOrderIfOKAtLeft:aBoolean |
ad9313ab0151
added support for component reversal if OK-atLeft
Claus Gittinger <cg@exept.de>
parents:
2033
diff
changeset
|
1120 |
"set/clear the reverseOrderIfOKAtLeft flag. |
ad9313ab0151
added support for component reversal if OK-atLeft
Claus Gittinger <cg@exept.de>
parents:
2033
diff
changeset
|
1121 |
This can be set for OK-Cancel like panels, where the OK Button should |
ad9313ab0151
added support for component reversal if OK-atLeft
Claus Gittinger <cg@exept.de>
parents:
2033
diff
changeset
|
1122 |
be positioned on the left for some viewStyles." |
ad9313ab0151
added support for component reversal if OK-atLeft
Claus Gittinger <cg@exept.de>
parents:
2033
diff
changeset
|
1123 |
|
ad9313ab0151
added support for component reversal if OK-atLeft
Claus Gittinger <cg@exept.de>
parents:
2033
diff
changeset
|
1124 |
reverseOrderIfOKAtLeft := aBoolean |
ad9313ab0151
added support for component reversal if OK-atLeft
Claus Gittinger <cg@exept.de>
parents:
2033
diff
changeset
|
1125 |
! |
ad9313ab0151
added support for component reversal if OK-atLeft
Claus Gittinger <cg@exept.de>
parents:
2033
diff
changeset
|
1126 |
|
202 | 1127 |
verticalLayout |
1128 |
"return the vertical layout as a symbol. |
|
1129 |
the returned value is one of |
|
1130 |
#top place element at the top |
|
1131 |
#topSpace place element at the top, offset by verticalSpace |
|
1132 |
#center place it horizontally centered |
|
1133 |
#bottom place it at the bottom |
|
1134 |
#bottomSpace place it at the bottom, offset by verticalSpace |
|
1135 |
#fit resize elements vertically to fit this panel |
|
1136 |
#fitSpace like #fit, but with spacing |
|
1137 |
||
1138 |
#topMax like #top, but resize all views vertically to max height |
|
1139 |
#topSpaceMax like #topSpace, but resize all views vertically to max height |
|
1140 |
#bottomMax like #bottom, but resize all views vertically to max height |
|
1141 |
#bottomSpaceMax like #bottomSpace, but resize all views vertically to max height |
|
1142 |
#centerMax like #center, but resize all views vertically to max height |
|
1143 |
the default is #center |
|
1144 |
See the class documentation for the meanings. |
|
1145 |
" |
|
1146 |
||
1147 |
^ vLayout |
|
1148 |
! |
|
1149 |
||
62 | 1150 |
verticalLayout:aSymbol |
1151 |
"change the vertical layout as a symbol. |
|
1152 |
The argument, aSymbol must be one of: |
|
133 | 1153 |
#top place element at the top |
1154 |
#topSpace place element at the top, offset by verticalSpace |
|
1155 |
#center place it horizontally centered |
|
1156 |
#bottom place it at the bottom |
|
1157 |
#bottomSpace place it at the bottom, offset by verticalSpace |
|
1158 |
#fit resize elements vertically to fit this panel |
|
1159 |
#fitSpace like #fit, but with spacing |
|
1160 |
||
1161 |
#topMax like #top, but resize all views vertically to max height |
|
1162 |
#topSpaceMax like #topSpace, but resize all views vertically to max height |
|
1163 |
#bottomMax like #bottom, but resize all views vertically to max height |
|
1164 |
#bottomSpaceMax like #bottomSpace, but resize all views vertically to max height |
|
1165 |
#centerMax like #center, but resize all views vertically to max height |
|
77 | 1166 |
the default (if never changed) is #center |
118 | 1167 |
See the class documentation for the meanings. |
62 | 1168 |
" |
1169 |
||
1170 |
(vLayout ~~ aSymbol) ifTrue:[ |
|
1171 |
vLayout := aSymbol. |
|
1172 |
self layoutChanged |
|
1173 |
] |
|
0 | 1174 |
! ! |
1175 |
||
3458 | 1176 |
!HorizontalPanelView methodsFor:'focus handling'! |
1177 |
||
1178 |
subviewsInFocusOrder |
|
3515 | 1179 |
|
1180 |
subViews isEmptyOrNil ifTrue:[ ^ #() ]. |
|
1181 |
||
6276 | 1182 |
(reverseOrderIfOKAtLeft == true and:[Dialog defaultOKButtonAtLeft]) ifTrue:[ |
3515 | 1183 |
^ subViews reversed |
3458 | 1184 |
]. |
1185 |
^ subViews |
|
1186 |
! ! |
|
1187 |
||
0 | 1188 |
!HorizontalPanelView methodsFor:'layout'! |
1189 |
||
1190 |
setChildPositions |
|
6483 | 1191 |
"(re)compute the position of every child; |
1192 |
called whenever children are added or my size has changed" |
|
0 | 1193 |
|
5813 | 1194 |
|xpos space sumOfWidths numChilds l wEach wInside hL vL resizeToMaxV |
4565
4c4b47122c2c
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4023
diff
changeset
|
1195 |
resizeToMaxH maxHeight maxWidth m2 subViews restWidth y2 bw| |
1042 | 1196 |
|
1418
3397ec6b8419
added ignoreInvisibleComponents stuff
Claus Gittinger <cg@exept.de>
parents:
1306
diff
changeset
|
1197 |
subViews := self subViewsToConsider. |
2039
ad9313ab0151
added support for component reversal if OK-atLeft
Claus Gittinger <cg@exept.de>
parents:
2033
diff
changeset
|
1198 |
(numChilds := subViews size) == 0 ifTrue:[^ self]. |
3778
c7257987a773
division by zero with numChilds == 1
Claus Gittinger <cg@exept.de>
parents:
3765
diff
changeset
|
1199 |
|
6276 | 1200 |
((reverseOrderIfOKAtLeft == true) and:[Dialog defaultOKButtonAtLeft]) ifTrue:[ |
1201 |
subViews := subViews reversed. |
|
2039
ad9313ab0151
added support for component reversal if OK-atLeft
Claus Gittinger <cg@exept.de>
parents:
2033
diff
changeset
|
1202 |
]. |
0 | 1203 |
|
3500 | 1204 |
"/ self extentChangedFlag ifTrue:[ |
1205 |
"/ ext := self computeExtent. |
|
1206 |
"/ width := ext x. |
|
1207 |
"/ height := ext y. |
|
1208 |
"/ ]. |
|
0 | 1209 |
|
1210 |
space := horizontalSpace. |
|
1254
c9e604f03e6a
code compactified (slightly)
Claus Gittinger <cg@exept.de>
parents:
1165
diff
changeset
|
1211 |
|
4023
06b045d4e152
no more direct accesses to borderWidth and borderColor
Claus Gittinger <cg@exept.de>
parents:
3778
diff
changeset
|
1212 |
bw := self borderWidth. |
379
a0ada7891fe9
looks bette if panels level is ~~ 0 AND subview has 0 level
Claus Gittinger <cg@exept.de>
parents:
340
diff
changeset
|
1213 |
m2 := margin * 2. |
4023
06b045d4e152
no more direct accesses to borderWidth and borderColor
Claus Gittinger <cg@exept.de>
parents:
3778
diff
changeset
|
1214 |
wInside := width - m2 + (bw*2) - subViews last borderWidth. |
59 | 1215 |
|
118 | 1216 |
hL := hLayout. |
1217 |
vL := vLayout. |
|
5976 | 1218 |
"/ hL == #rightFit ifTrue:[self halt]. |
133 | 1219 |
resizeToMaxH := false. |
1220 |
(hL endsWith:'Max') ifTrue:[ |
|
1431
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1418
diff
changeset
|
1221 |
resizeToMaxH := true. |
2484 | 1222 |
wEach := maxWidth := subViews |
5813 | 1223 |
inject:0 |
2480 | 1224 |
into:[:maxSoFar :child | |
5605 | 1225 |
maxSoFar max:child preferredWidth "widthIncludingBorder" |
2480 | 1226 |
]. |
4565
4c4b47122c2c
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4023
diff
changeset
|
1227 |
hL := (hL copyButLast:3) asSymbol. |
1306
bf4903012f7a
added #rightFit & #rightSpaceFit layouts
Claus Gittinger <cg@exept.de>
parents:
1291
diff
changeset
|
1228 |
]. |
bf4903012f7a
added #rightFit & #rightSpaceFit layouts
Claus Gittinger <cg@exept.de>
parents:
1291
diff
changeset
|
1229 |
|
bf4903012f7a
added #rightFit & #rightSpaceFit layouts
Claus Gittinger <cg@exept.de>
parents:
1291
diff
changeset
|
1230 |
numChilds == 1 ifTrue:[ |
1431
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1418
diff
changeset
|
1231 |
(hL == #leftFit or:[hL == #rightFit]) ifTrue:[ |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1418
diff
changeset
|
1232 |
hL := #fit |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1418
diff
changeset
|
1233 |
]. |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1418
diff
changeset
|
1234 |
(hL == #leftSpaceFit or:[hL == #rightSpaceFit]) ifTrue:[ |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1418
diff
changeset
|
1235 |
hL := #fitSpace |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1418
diff
changeset
|
1236 |
]. |
133 | 1237 |
]. |
1238 |
||
118 | 1239 |
hL == #fitSpace ifTrue:[ |
1431
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1418
diff
changeset
|
1240 |
" |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1418
diff
changeset
|
1241 |
adjust childs extents and set origins. |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1418
diff
changeset
|
1242 |
Be careful to avoid accumulation of rounding errors |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1418
diff
changeset
|
1243 |
" |
3458 | 1244 |
wEach := (wInside - ((numChilds + 1) * space)) / numChilds. |
4023
06b045d4e152
no more direct accesses to borderWidth and borderColor
Claus Gittinger <cg@exept.de>
parents:
3778
diff
changeset
|
1245 |
xpos := space + margin - bw. |
62 | 1246 |
] ifFalse:[ |
1431
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1418
diff
changeset
|
1247 |
hL == #fit ifTrue:[ |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1418
diff
changeset
|
1248 |
" |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1418
diff
changeset
|
1249 |
adjust childs extents and set origins. |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1418
diff
changeset
|
1250 |
Be careful to avoid accumulation of rounding errors |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1418
diff
changeset
|
1251 |
" |
3458 | 1252 |
wEach := (wInside - ((numChilds - 1) * space)) / numChilds. |
4023
06b045d4e152
no more direct accesses to borderWidth and borderColor
Claus Gittinger <cg@exept.de>
parents:
3778
diff
changeset
|
1253 |
xpos := margin - bw. |
1431
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1418
diff
changeset
|
1254 |
] ifFalse:[ |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1418
diff
changeset
|
1255 |
l := hL. |
1306
bf4903012f7a
added #rightFit & #rightSpaceFit layouts
Claus Gittinger <cg@exept.de>
parents:
1291
diff
changeset
|
1256 |
|
1431
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1418
diff
changeset
|
1257 |
" |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1418
diff
changeset
|
1258 |
compute net width needed |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1418
diff
changeset
|
1259 |
" |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1418
diff
changeset
|
1260 |
resizeToMaxH ifTrue:[ |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1418
diff
changeset
|
1261 |
sumOfWidths := subViews inject:0 into:[:sumSoFar :child | sumSoFar + maxWidth + (child borderWidth*2)]. |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1418
diff
changeset
|
1262 |
] ifFalse:[ |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1418
diff
changeset
|
1263 |
sumOfWidths := subViews inject:0 into:[:sumSoFar :child | sumSoFar + child widthIncludingBorder]. |
2030
30247cb8fab0
oops - bug in setChildPositions leading to recursion
Claus Gittinger <cg@exept.de>
parents:
2012
diff
changeset
|
1264 |
|
30247cb8fab0
oops - bug in setChildPositions leading to recursion
Claus Gittinger <cg@exept.de>
parents:
2012
diff
changeset
|
1265 |
"/ adjust - do not include width of last(first) element if doing a fit |
30247cb8fab0
oops - bug in setChildPositions leading to recursion
Claus Gittinger <cg@exept.de>
parents:
2012
diff
changeset
|
1266 |
(hL == #leftFit or:[hL == #leftSpaceFit]) ifTrue:[ |
30247cb8fab0
oops - bug in setChildPositions leading to recursion
Claus Gittinger <cg@exept.de>
parents:
2012
diff
changeset
|
1267 |
sumOfWidths := sumOfWidths - subViews last widthIncludingBorder. |
30247cb8fab0
oops - bug in setChildPositions leading to recursion
Claus Gittinger <cg@exept.de>
parents:
2012
diff
changeset
|
1268 |
] ifFalse:[ |
30247cb8fab0
oops - bug in setChildPositions leading to recursion
Claus Gittinger <cg@exept.de>
parents:
2012
diff
changeset
|
1269 |
(hL == #rightFit or:[hL == #rightSpaceFit]) ifTrue:[ |
30247cb8fab0
oops - bug in setChildPositions leading to recursion
Claus Gittinger <cg@exept.de>
parents:
2012
diff
changeset
|
1270 |
sumOfWidths := sumOfWidths - subViews first widthIncludingBorder. |
5976 | 1271 |
hL == #rightSpaceFit ifTrue:[ |
1272 |
sumOfWidths := sumOfWidths + (space * (numChilds+1)). |
|
1273 |
] ifFalse:[ |
|
1274 |
sumOfWidths := sumOfWidths + (space * (numChilds-1)). |
|
1275 |
] |
|
2030
30247cb8fab0
oops - bug in setChildPositions leading to recursion
Claus Gittinger <cg@exept.de>
parents:
2012
diff
changeset
|
1276 |
] |
30247cb8fab0
oops - bug in setChildPositions leading to recursion
Claus Gittinger <cg@exept.de>
parents:
2012
diff
changeset
|
1277 |
]. |
1431
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1418
diff
changeset
|
1278 |
]. |
1306
bf4903012f7a
added #rightFit & #rightSpaceFit layouts
Claus Gittinger <cg@exept.de>
parents:
1291
diff
changeset
|
1279 |
|
5424 | 1280 |
restWidth := wInside "width" - sumOfWidths "- (numChilds-1*space)". |
62 | 1281 |
|
1431
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1418
diff
changeset
|
1282 |
((l == #center) and:[numChilds == 1]) ifTrue:[l := #spread]. |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1418
diff
changeset
|
1283 |
(l == #spread and:[numChilds == 1]) ifTrue:[l := #spreadSpace]. |
0 | 1284 |
|
1431
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1418
diff
changeset
|
1285 |
" |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1418
diff
changeset
|
1286 |
compute position of leftmost subview and space between them; |
5813 | 1287 |
if they do hardly fit, leave no space between them |
1431
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1418
diff
changeset
|
1288 |
" |
5813 | 1289 |
((sumOfWidths > (width - m2)) |
1431
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1418
diff
changeset
|
1290 |
and:[l ~~ #fixLeftSpace and:[l ~~ #fixLeft]]) ifTrue:[ |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1418
diff
changeset
|
1291 |
xpos := margin. |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1418
diff
changeset
|
1292 |
space := 0 |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1418
diff
changeset
|
1293 |
] ifFalse: [ |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1418
diff
changeset
|
1294 |
l == #fixLeftSpace ifTrue:[ |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1418
diff
changeset
|
1295 |
l := #leftSpace |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1418
diff
changeset
|
1296 |
] ifFalse:[ |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1418
diff
changeset
|
1297 |
l == #fixLeft ifTrue:[ |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1418
diff
changeset
|
1298 |
l := #left |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1418
diff
changeset
|
1299 |
] |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1418
diff
changeset
|
1300 |
]. |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1418
diff
changeset
|
1301 |
((l == #right) or:[l == #rightSpace |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1418
diff
changeset
|
1302 |
or:[l == #rightFit or:[l == #rightSpaceFit]]]) ifTrue:[ |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1418
diff
changeset
|
1303 |
xpos := restWidth - (space * (numChilds - 1)). |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1418
diff
changeset
|
1304 |
"/ |
4023
06b045d4e152
no more direct accesses to borderWidth and borderColor
Claus Gittinger <cg@exept.de>
parents:
3778
diff
changeset
|
1305 |
"/ bw == 0 ifTrue:[ |
5813 | 1306 |
"/ xpos := xpos + space |
1431
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1418
diff
changeset
|
1307 |
"/ ]. |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1418
diff
changeset
|
1308 |
"/ |
5813 | 1309 |
(l == #rightSpace |
1431
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1418
diff
changeset
|
1310 |
or:[l == #rightSpaceFit]) ifTrue:[ |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1418
diff
changeset
|
1311 |
xpos >= space ifTrue:[ |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1418
diff
changeset
|
1312 |
xpos := xpos - space |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1418
diff
changeset
|
1313 |
] |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1418
diff
changeset
|
1314 |
]. |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1418
diff
changeset
|
1315 |
xpos := xpos - margin. |
62 | 1316 |
|
1431
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1418
diff
changeset
|
1317 |
xpos < 0 ifTrue:[ |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1418
diff
changeset
|
1318 |
space := space min:(restWidth // (numChilds + 1)). |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1418
diff
changeset
|
1319 |
xpos := restWidth - (space * numChilds). |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1418
diff
changeset
|
1320 |
] |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1418
diff
changeset
|
1321 |
] ifFalse:[ |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1418
diff
changeset
|
1322 |
(l == #spread) ifTrue:[ |
3778
c7257987a773
division by zero with numChilds == 1
Claus Gittinger <cg@exept.de>
parents:
3765
diff
changeset
|
1323 |
numChilds == 1 ifTrue:[ |
c7257987a773
division by zero with numChilds == 1
Claus Gittinger <cg@exept.de>
parents:
3765
diff
changeset
|
1324 |
space := (restWidth - m2). |
c7257987a773
division by zero with numChilds == 1
Claus Gittinger <cg@exept.de>
parents:
3765
diff
changeset
|
1325 |
] ifFalse:[ |
c7257987a773
division by zero with numChilds == 1
Claus Gittinger <cg@exept.de>
parents:
3765
diff
changeset
|
1326 |
space := (restWidth - m2) // (numChilds - 1). |
c7257987a773
division by zero with numChilds == 1
Claus Gittinger <cg@exept.de>
parents:
3765
diff
changeset
|
1327 |
]. |
1431
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1418
diff
changeset
|
1328 |
xpos := margin. |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1418
diff
changeset
|
1329 |
(space == 0) ifTrue:[ |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1418
diff
changeset
|
1330 |
xpos := restWidth // 2 |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1418
diff
changeset
|
1331 |
] |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1418
diff
changeset
|
1332 |
] ifFalse:[ |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1418
diff
changeset
|
1333 |
(l == #spreadSpace) ifTrue:[ |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1418
diff
changeset
|
1334 |
space := (restWidth - m2) // (numChilds + 1). |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1418
diff
changeset
|
1335 |
xpos := space + margin. |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1418
diff
changeset
|
1336 |
(space == 0) ifTrue:[ |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1418
diff
changeset
|
1337 |
xpos := restWidth // 2 |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1418
diff
changeset
|
1338 |
] |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1418
diff
changeset
|
1339 |
] ifFalse:[ |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1418
diff
changeset
|
1340 |
((l == #left) or:[l == #leftSpace |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1418
diff
changeset
|
1341 |
or:[l == #leftFit or:[l == #leftSpaceFit]]]) ifTrue:[ |
5813 | 1342 |
(l == #left or:[l == #leftFit]) ifTrue:[ |
3737 | 1343 |
numChilds == 1 ifTrue: [ |
1344 |
space := space min:(restWidth - m2). |
|
1345 |
]ifFalse:[ |
|
1346 |
space := space min:(restWidth - m2) // (numChilds - 1). |
|
1347 |
]. |
|
5813 | 1348 |
] ifFalse:[ |
3674
d9a22791dc50
spacing computation fixed (boundary condition, spacing reduction)
Claus Gittinger <cg@exept.de>
parents:
3515
diff
changeset
|
1349 |
space := space min:(restWidth - m2) // (numChilds "+ 1"). |
d9a22791dc50
spacing computation fixed (boundary condition, spacing reduction)
Claus Gittinger <cg@exept.de>
parents:
3515
diff
changeset
|
1350 |
]. |
1431
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1418
diff
changeset
|
1351 |
(hL == #fixLeft or:[hL == #fixLeftSpace]) ifTrue:[ |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1418
diff
changeset
|
1352 |
space := space max:horizontalSpace. |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1418
diff
changeset
|
1353 |
] ifFalse:[ |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1418
diff
changeset
|
1354 |
space := space max:0. |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1418
diff
changeset
|
1355 |
]. |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1418
diff
changeset
|
1356 |
(l == #leftSpace or:[l == #leftSpaceFit]) ifTrue:[ |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1418
diff
changeset
|
1357 |
xpos := space + margin. |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1418
diff
changeset
|
1358 |
] ifFalse:[ |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1418
diff
changeset
|
1359 |
"/ |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1418
diff
changeset
|
1360 |
"/ if the very first view has a 0-level AND |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1418
diff
changeset
|
1361 |
"/ my level is non-zero, begin with margin |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1418
diff
changeset
|
1362 |
"/ |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1418
diff
changeset
|
1363 |
true "(margin ~~ 0 and:[subViews first level == 0])" ifTrue:[ |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1418
diff
changeset
|
1364 |
xpos := margin |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1418
diff
changeset
|
1365 |
] ifFalse:[ |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1418
diff
changeset
|
1366 |
xpos := 0 |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1418
diff
changeset
|
1367 |
] |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1418
diff
changeset
|
1368 |
] |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1418
diff
changeset
|
1369 |
] ifFalse:[ |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1418
diff
changeset
|
1370 |
"center" |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1418
diff
changeset
|
1371 |
xpos := (restWidth - ((numChilds - 1) * space)) // 2. |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1418
diff
changeset
|
1372 |
xpos < 0 ifTrue:[ |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1418
diff
changeset
|
1373 |
space := restWidth // (numChilds + 1). |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1418
diff
changeset
|
1374 |
xpos := (restWidth - ((numChilds - 1) * space)) // 2. |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1418
diff
changeset
|
1375 |
] |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1418
diff
changeset
|
1376 |
] |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1418
diff
changeset
|
1377 |
] |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1418
diff
changeset
|
1378 |
] |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1418
diff
changeset
|
1379 |
] |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1418
diff
changeset
|
1380 |
]. |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1418
diff
changeset
|
1381 |
]. |
0 | 1382 |
]. |
1383 |
||
133 | 1384 |
resizeToMaxV := false. |
1306
bf4903012f7a
added #rightFit & #rightSpaceFit layouts
Claus Gittinger <cg@exept.de>
parents:
1291
diff
changeset
|
1385 |
(vL endsWith:'Max') ifTrue:[ |
1431
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1418
diff
changeset
|
1386 |
resizeToMaxV := true. |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1418
diff
changeset
|
1387 |
maxHeight := subViews inject:0 into:[:maxSoFar :child | maxSoFar max:child heightIncludingBorder]. |
4565
4c4b47122c2c
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4023
diff
changeset
|
1388 |
vL := (vL copyButLast:3) asSymbol. |
133 | 1389 |
]. |
1390 |
||
1306
bf4903012f7a
added #rightFit & #rightSpaceFit layouts
Claus Gittinger <cg@exept.de>
parents:
1291
diff
changeset
|
1391 |
" |
bf4903012f7a
added #rightFit & #rightSpaceFit layouts
Claus Gittinger <cg@exept.de>
parents:
1291
diff
changeset
|
1392 |
now set positions |
bf4903012f7a
added #rightFit & #rightSpaceFit layouts
Claus Gittinger <cg@exept.de>
parents:
1291
diff
changeset
|
1393 |
" |
0 | 1394 |
|
77 | 1395 |
subViews keysAndValuesDo:[:index :child | |
1431
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1418
diff
changeset
|
1396 |
|ypos advance bwChild hChild newHChild| |
62 | 1397 |
|
1431
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1418
diff
changeset
|
1398 |
hChild := child heightIncludingBorder. |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1418
diff
changeset
|
1399 |
bwChild := child borderWidth. |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1418
diff
changeset
|
1400 |
|
3118
996b7fc6dee7
1. Avoid endless recursion with #elementsChangesSize.
Stefan Vogel <sv@exept.de>
parents:
2699
diff
changeset
|
1401 |
elementsChangeSize ifTrue:[ |
5922 | 1402 |
"to avoid a recursion when we change the element's size" |
3118
996b7fc6dee7
1. Avoid endless recursion with #elementsChangesSize.
Stefan Vogel <sv@exept.de>
parents:
2699
diff
changeset
|
1403 |
child removeDependent:self. |
996b7fc6dee7
1. Avoid endless recursion with #elementsChangesSize.
Stefan Vogel <sv@exept.de>
parents:
2699
diff
changeset
|
1404 |
]. |
1431
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1418
diff
changeset
|
1405 |
resizeToMaxV ifTrue:[ |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1418
diff
changeset
|
1406 |
child height:(hChild := maxHeight - (bwChild * 2)). |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1418
diff
changeset
|
1407 |
]. |
0 | 1408 |
|
1431
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1418
diff
changeset
|
1409 |
vL == #top ifTrue:[ |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1418
diff
changeset
|
1410 |
ypos := margin |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1418
diff
changeset
|
1411 |
] ifFalse:[ |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1418
diff
changeset
|
1412 |
vL == #topSpace ifTrue:[ |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1418
diff
changeset
|
1413 |
ypos := margin + verticalSpace |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1418
diff
changeset
|
1414 |
] ifFalse:[ |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1418
diff
changeset
|
1415 |
vL == #bottom ifTrue:[ |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1418
diff
changeset
|
1416 |
ypos := height - margin - child heightIncludingBorder |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1418
diff
changeset
|
1417 |
] ifFalse:[ |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1418
diff
changeset
|
1418 |
vL == #bottomSpace ifTrue:[ |
5813 | 1419 |
ypos := height - margin |
1431
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1418
diff
changeset
|
1420 |
- verticalSpace - child heightIncludingBorder. |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1418
diff
changeset
|
1421 |
] ifFalse:[ |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1418
diff
changeset
|
1422 |
vL == #fitSpace ifTrue:[ |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1418
diff
changeset
|
1423 |
ypos := verticalSpace. |
3458 | 1424 |
newHChild := height - ((verticalSpace + bwChild) * 2). |
1431
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1418
diff
changeset
|
1425 |
ypos := ypos + margin. |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1418
diff
changeset
|
1426 |
newHChild := newHChild - m2. |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1418
diff
changeset
|
1427 |
] ifFalse:[ |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1418
diff
changeset
|
1428 |
vL == #fit ifTrue:[ |
5424 | 1429 |
newHChild := height "- (bwChild * 2)". |
1431
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1418
diff
changeset
|
1430 |
"/ |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1418
diff
changeset
|
1431 |
"/ if the view has a 0-level AND |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1418
diff
changeset
|
1432 |
"/ my level is non-zero, begin with margin |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1418
diff
changeset
|
1433 |
"/ |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1418
diff
changeset
|
1434 |
true "(level ~~ 0 and:[child level == 0])" ifTrue:[ |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1418
diff
changeset
|
1435 |
ypos := margin. |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1418
diff
changeset
|
1436 |
newHChild := newHChild - m2. |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1418
diff
changeset
|
1437 |
] ifFalse:[ |
5813 | 1438 |
ypos := 0. |
1431
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1418
diff
changeset
|
1439 |
]. |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1418
diff
changeset
|
1440 |
] ifFalse:[ |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1418
diff
changeset
|
1441 |
"centered" |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1418
diff
changeset
|
1442 |
ypos := margin + ((height - m2 - hChild) // 2). |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1418
diff
changeset
|
1443 |
] |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1418
diff
changeset
|
1444 |
] |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1418
diff
changeset
|
1445 |
] |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1418
diff
changeset
|
1446 |
] |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1418
diff
changeset
|
1447 |
] |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1418
diff
changeset
|
1448 |
]. |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1418
diff
changeset
|
1449 |
newHChild notNil ifTrue:[ |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1418
diff
changeset
|
1450 |
child height:newHChild |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1418
diff
changeset
|
1451 |
]. |
379
a0ada7891fe9
looks bette if panels level is ~~ 0 AND subview has 0 level
Claus Gittinger <cg@exept.de>
parents:
340
diff
changeset
|
1452 |
|
1431
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1418
diff
changeset
|
1453 |
(ypos < 0) ifTrue:[ypos := 0]. |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1418
diff
changeset
|
1454 |
|
2033
fc16e79f649b
size computation with bordered components
Claus Gittinger <cg@exept.de>
parents:
2030
diff
changeset
|
1455 |
y2 := ypos + child height - 1. |
fc16e79f649b
size computation with bordered components
Claus Gittinger <cg@exept.de>
parents:
2030
diff
changeset
|
1456 |
|
5813 | 1457 |
(hL == #fit |
1431
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1418
diff
changeset
|
1458 |
or:[hL == #fitSpace |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1418
diff
changeset
|
1459 |
or:[resizeToMaxH]]) ifTrue:[ |
1747
d5be0d4cf7fc
do not care for sizeFixed views with fit layouts.
Claus Gittinger <cg@exept.de>
parents:
1431
diff
changeset
|
1460 |
"/cg: removed this (OLD) piece of code, |
6100 | 1461 |
"/ which prevents resizing of label-like things if it's sizeFixed is set to true |
1747
d5be0d4cf7fc
do not care for sizeFixed views with fit layouts.
Claus Gittinger <cg@exept.de>
parents:
1431
diff
changeset
|
1462 |
|
d5be0d4cf7fc
do not care for sizeFixed views with fit layouts.
Claus Gittinger <cg@exept.de>
parents:
1431
diff
changeset
|
1463 |
"/ child sizeFixed ifTrue:[ |
d5be0d4cf7fc
do not care for sizeFixed views with fit layouts.
Claus Gittinger <cg@exept.de>
parents:
1431
diff
changeset
|
1464 |
"/ d := wEach - (child widthIncludingBorder) // 2. |
d5be0d4cf7fc
do not care for sizeFixed views with fit layouts.
Claus Gittinger <cg@exept.de>
parents:
1431
diff
changeset
|
1465 |
"/ child origin:(xpos truncated + d @ ypos) |
d5be0d4cf7fc
do not care for sizeFixed views with fit layouts.
Claus Gittinger <cg@exept.de>
parents:
1431
diff
changeset
|
1466 |
"/ ] ifFalse:[ |
1431
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1418
diff
changeset
|
1467 |
child origin:(xpos truncated @ ypos) |
6483 | 1468 |
corner:(xpos + wEach - bwChild "- 1") truncated @ y2. |
1747
d5be0d4cf7fc
do not care for sizeFixed views with fit layouts.
Claus Gittinger <cg@exept.de>
parents:
1431
diff
changeset
|
1469 |
"/ ]. |
1431
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1418
diff
changeset
|
1470 |
advance := wEach. |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1418
diff
changeset
|
1471 |
] ifFalse:[ |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1418
diff
changeset
|
1472 |
child origin:(xpos @ ypos). |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1418
diff
changeset
|
1473 |
advance := child widthIncludingBorder |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1418
diff
changeset
|
1474 |
]. |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1418
diff
changeset
|
1475 |
|
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1418
diff
changeset
|
1476 |
index == numChilds ifTrue:[ |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1418
diff
changeset
|
1477 |
|x| |
1306
bf4903012f7a
added #rightFit & #rightSpaceFit layouts
Claus Gittinger <cg@exept.de>
parents:
1291
diff
changeset
|
1478 |
|
1431
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1418
diff
changeset
|
1479 |
(hL == #leftFit or:[hL == #leftSpaceFit]) ifTrue:[ |
4023
06b045d4e152
no more direct accesses to borderWidth and borderColor
Claus Gittinger <cg@exept.de>
parents:
3778
diff
changeset
|
1480 |
x := width - margin - 1 - (bwChild * 2) + bw. |
1431
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1418
diff
changeset
|
1481 |
hL == #leftSpaceFit ifTrue:[ |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1418
diff
changeset
|
1482 |
x := x - space |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1418
diff
changeset
|
1483 |
]. |
2033
fc16e79f649b
size computation with bordered components
Claus Gittinger <cg@exept.de>
parents:
2030
diff
changeset
|
1484 |
child corner:(x @ y2) |
1431
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1418
diff
changeset
|
1485 |
]. |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1418
diff
changeset
|
1486 |
]. |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1418
diff
changeset
|
1487 |
index == 1 ifTrue:[ |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1418
diff
changeset
|
1488 |
(hL == #rightFit or:[hL == #rightSpaceFit]) ifTrue:[ |
4023
06b045d4e152
no more direct accesses to borderWidth and borderColor
Claus Gittinger <cg@exept.de>
parents:
3778
diff
changeset
|
1489 |
xpos := margin + 0 + (bwChild * 2) - bw. |
1431
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1418
diff
changeset
|
1490 |
hL == #rightSpaceFit ifTrue:[ |
3118
996b7fc6dee7
1. Avoid endless recursion with #elementsChangesSize.
Stefan Vogel <sv@exept.de>
parents:
2699
diff
changeset
|
1491 |
xpos := xpos + space |
1431
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1418
diff
changeset
|
1492 |
]. |
3118
996b7fc6dee7
1. Avoid endless recursion with #elementsChangesSize.
Stefan Vogel <sv@exept.de>
parents:
2699
diff
changeset
|
1493 |
advance := restWidth. |
996b7fc6dee7
1. Avoid endless recursion with #elementsChangesSize.
Stefan Vogel <sv@exept.de>
parents:
2699
diff
changeset
|
1494 |
child origin:(xpos @ (child origin y)) |
996b7fc6dee7
1. Avoid endless recursion with #elementsChangesSize.
Stefan Vogel <sv@exept.de>
parents:
2699
diff
changeset
|
1495 |
corner:((xpos+advance) @ (child corner y)) |
1431
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1418
diff
changeset
|
1496 |
]. |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1418
diff
changeset
|
1497 |
]. |
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1418
diff
changeset
|
1498 |
|
fd1e74d673ae
really care for margins when doing childPositions
Claus Gittinger <cg@exept.de>
parents:
1418
diff
changeset
|
1499 |
xpos := xpos + advance + space. |
3118
996b7fc6dee7
1. Avoid endless recursion with #elementsChangesSize.
Stefan Vogel <sv@exept.de>
parents:
2699
diff
changeset
|
1500 |
elementsChangeSize ifTrue:[ |
996b7fc6dee7
1. Avoid endless recursion with #elementsChangesSize.
Stefan Vogel <sv@exept.de>
parents:
2699
diff
changeset
|
1501 |
"reinstall dependency that we removed above" |
996b7fc6dee7
1. Avoid endless recursion with #elementsChangesSize.
Stefan Vogel <sv@exept.de>
parents:
2699
diff
changeset
|
1502 |
child addDependent:self. |
996b7fc6dee7
1. Avoid endless recursion with #elementsChangesSize.
Stefan Vogel <sv@exept.de>
parents:
2699
diff
changeset
|
1503 |
]. |
77 | 1504 |
]. |
155 | 1505 |
|
3503
6af61918313a
setChildPositions fix with rightFit
Claus Gittinger <cg@exept.de>
parents:
3500
diff
changeset
|
1506 |
"Modified: / 04-09-1995 / 18:43:10 / claus" |
5976 | 1507 |
"Modified: / 23-11-2016 / 00:36:03 / cg" |
6100 | 1508 |
"Modified (format): / 13-02-2017 / 20:22:45 / cg" |
6483 | 1509 |
"Modified: / 09-11-2018 / 21:12:26 / Claus Gittinger" |
0 | 1510 |
! ! |
202 | 1511 |
|
1512 |
!HorizontalPanelView methodsFor:'queries'! |
|
1513 |
||
6483 | 1514 |
computePreferredExtent |
202 | 1515 |
"return a good extent, one that makes subviews fit" |
1516 |
||
980
6079922a5519
eliminated references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents:
797
diff
changeset
|
1517 |
|sumOfWidths maxHeight maxWidth m2 subViews| |
202 | 1518 |
|
1418
3397ec6b8419
added ignoreInvisibleComponents stuff
Claus Gittinger <cg@exept.de>
parents:
1306
diff
changeset
|
1519 |
subViews := self subViewsToConsider. |
6138 | 1520 |
subViews isEmptyOrNil ifTrue:[ |
6483 | 1521 |
^ super computePreferredExtent. |
1038 | 1522 |
]. |
202 | 1523 |
|
1524 |
"compute net height needed" |
|
1525 |
||
1526 |
sumOfWidths := 0. |
|
1527 |
maxHeight := 0. |
|
1528 |
maxWidth := 0. |
|
1529 |
||
1530 |
subViews do:[:child | |
|
2387
c589e85a4f43
prefExtent computation was wrong for fitSpace
Claus Gittinger <cg@exept.de>
parents:
2365
diff
changeset
|
1531 |
|childsPreference| |
202 | 1532 |
|
2387
c589e85a4f43
prefExtent computation was wrong for fitSpace
Claus Gittinger <cg@exept.de>
parents:
2365
diff
changeset
|
1533 |
"/ better to use component's preferredExtent ... |
6138 | 1534 |
childsPreference := child preferredExtent. |
5932 | 1535 |
child realized ifTrue:[ |
6138 | 1536 |
childsPreference := childsPreference max:child extent. |
5932 | 1537 |
]. |
6138 | 1538 |
|
2387
c589e85a4f43
prefExtent computation was wrong for fitSpace
Claus Gittinger <cg@exept.de>
parents:
2365
diff
changeset
|
1539 |
sumOfWidths := sumOfWidths + childsPreference x. |
c589e85a4f43
prefExtent computation was wrong for fitSpace
Claus Gittinger <cg@exept.de>
parents:
2365
diff
changeset
|
1540 |
maxHeight := maxHeight max:childsPreference y. |
c589e85a4f43
prefExtent computation was wrong for fitSpace
Claus Gittinger <cg@exept.de>
parents:
2365
diff
changeset
|
1541 |
maxWidth := maxWidth max:childsPreference x. |
202 | 1542 |
|
2387
c589e85a4f43
prefExtent computation was wrong for fitSpace
Claus Gittinger <cg@exept.de>
parents:
2365
diff
changeset
|
1543 |
"/ ... instead of actual extent |
6483 | 1544 |
"/ sumOfWidths := sumOfWidths + child widthIncludingBorder. |
1545 |
"/ maxHeight := maxHeight max:(child heightIncludingBorder). |
|
1546 |
"/ maxWidth := maxWidth max:(child widthIncludingBorder). |
|
202 | 1547 |
]. |
6483 | 1548 |
|
4023
06b045d4e152
no more direct accesses to borderWidth and borderColor
Claus Gittinger <cg@exept.de>
parents:
3778
diff
changeset
|
1549 |
"/ self borderWidth ~~ 0 ifTrue:[ |
3686 | 1550 |
"/ sumOfWidths := sumOfWidths + (horizontalSpace * 2). |
1551 |
"/ maxHeight := maxHeight + (verticalSpace * 2). |
|
1552 |
"/ ]. |
|
1553 |
||
202 | 1554 |
(hLayout == #fit |
6138 | 1555 |
or:[hLayout == #fitSpace |
1556 |
or:[hLayout endsWith:'Max']]) ifTrue:[ |
|
2387
c589e85a4f43
prefExtent computation was wrong for fitSpace
Claus Gittinger <cg@exept.de>
parents:
2365
diff
changeset
|
1557 |
sumOfWidths := maxWidth * subViews size. |
4023
06b045d4e152
no more direct accesses to borderWidth and borderColor
Claus Gittinger <cg@exept.de>
parents:
3778
diff
changeset
|
1558 |
self borderWidth ~~ 0 ifTrue:[ |
2387
c589e85a4f43
prefExtent computation was wrong for fitSpace
Claus Gittinger <cg@exept.de>
parents:
2365
diff
changeset
|
1559 |
sumOfWidths := sumOfWidths + (horizontalSpace * 2). |
c589e85a4f43
prefExtent computation was wrong for fitSpace
Claus Gittinger <cg@exept.de>
parents:
2365
diff
changeset
|
1560 |
]. |
c589e85a4f43
prefExtent computation was wrong for fitSpace
Claus Gittinger <cg@exept.de>
parents:
2365
diff
changeset
|
1561 |
hLayout == #fitSpace ifTrue:[ |
c589e85a4f43
prefExtent computation was wrong for fitSpace
Claus Gittinger <cg@exept.de>
parents:
2365
diff
changeset
|
1562 |
"/ care for spacing ... |
c589e85a4f43
prefExtent computation was wrong for fitSpace
Claus Gittinger <cg@exept.de>
parents:
2365
diff
changeset
|
1563 |
sumOfWidths := sumOfWidths + (horizontalSpace * (subViews size + 1)). |
c589e85a4f43
prefExtent computation was wrong for fitSpace
Claus Gittinger <cg@exept.de>
parents:
2365
diff
changeset
|
1564 |
]. |
202 | 1565 |
] ifFalse:[ |
2387
c589e85a4f43
prefExtent computation was wrong for fitSpace
Claus Gittinger <cg@exept.de>
parents:
2365
diff
changeset
|
1566 |
sumOfWidths := sumOfWidths + ((subViews size - 1) * horizontalSpace). |
c589e85a4f43
prefExtent computation was wrong for fitSpace
Claus Gittinger <cg@exept.de>
parents:
2365
diff
changeset
|
1567 |
((hLayout == #leftSpace) or:[hLayout == #rightSpace]) ifTrue:[ |
c589e85a4f43
prefExtent computation was wrong for fitSpace
Claus Gittinger <cg@exept.de>
parents:
2365
diff
changeset
|
1568 |
sumOfWidths := sumOfWidths + horizontalSpace |
c589e85a4f43
prefExtent computation was wrong for fitSpace
Claus Gittinger <cg@exept.de>
parents:
2365
diff
changeset
|
1569 |
] ifFalse:[ |
c589e85a4f43
prefExtent computation was wrong for fitSpace
Claus Gittinger <cg@exept.de>
parents:
2365
diff
changeset
|
1570 |
((hLayout == #center) or:[hLayout == #spread]) ifTrue:[ |
c589e85a4f43
prefExtent computation was wrong for fitSpace
Claus Gittinger <cg@exept.de>
parents:
2365
diff
changeset
|
1571 |
sumOfWidths := sumOfWidths + (horizontalSpace * 2) |
c589e85a4f43
prefExtent computation was wrong for fitSpace
Claus Gittinger <cg@exept.de>
parents:
2365
diff
changeset
|
1572 |
] |
c589e85a4f43
prefExtent computation was wrong for fitSpace
Claus Gittinger <cg@exept.de>
parents:
2365
diff
changeset
|
1573 |
]. |
202 | 1574 |
]. |
1575 |
||
1165
16b8537595fd
care for spacing in preferredExtent of centerSpace layout.
Claus Gittinger <cg@exept.de>
parents:
1156
diff
changeset
|
1576 |
((vLayout == #topSpace) |
6138 | 1577 |
or:[vLayout == #bottomSpace]) ifTrue:[ |
2387
c589e85a4f43
prefExtent computation was wrong for fitSpace
Claus Gittinger <cg@exept.de>
parents:
2365
diff
changeset
|
1578 |
maxHeight := maxHeight + verticalSpace |
202 | 1579 |
] ifFalse:[ |
2387
c589e85a4f43
prefExtent computation was wrong for fitSpace
Claus Gittinger <cg@exept.de>
parents:
2365
diff
changeset
|
1580 |
((vLayout == #fitSpace) |
6138 | 1581 |
or:[vLayout == #center |
1582 |
or:[vLayout == #centerSpace]]) ifTrue:[ |
|
2387
c589e85a4f43
prefExtent computation was wrong for fitSpace
Claus Gittinger <cg@exept.de>
parents:
2365
diff
changeset
|
1583 |
maxHeight := maxHeight + (verticalSpace * 2) |
c589e85a4f43
prefExtent computation was wrong for fitSpace
Claus Gittinger <cg@exept.de>
parents:
2365
diff
changeset
|
1584 |
] |
202 | 1585 |
]. |
1586 |
||
379
a0ada7891fe9
looks bette if panels level is ~~ 0 AND subview has 0 level
Claus Gittinger <cg@exept.de>
parents:
340
diff
changeset
|
1587 |
m2 := margin * 2. |
a0ada7891fe9
looks bette if panels level is ~~ 0 AND subview has 0 level
Claus Gittinger <cg@exept.de>
parents:
340
diff
changeset
|
1588 |
^ (sumOfWidths + m2) @ (maxHeight + m2) |
340
f820bcd29a51
defaultExtent with rightSpace forgot about spacing
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
1589 |
|
6483 | 1590 |
"Created: / 09-11-2018 / 19:55:09 / Claus Gittinger" |
1591 |
"Modified (format): / 09-11-2018 / 21:07:01 / Claus Gittinger" |
|
202 | 1592 |
! ! |
1593 |
||
980
6079922a5519
eliminated references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents:
797
diff
changeset
|
1594 |
!HorizontalPanelView class methodsFor:'documentation'! |
205 | 1595 |
|
1596 |
version |
|
5424 | 1597 |
^ '$Header$' |
4023
06b045d4e152
no more direct accesses to borderWidth and borderColor
Claus Gittinger <cg@exept.de>
parents:
3778
diff
changeset
|
1598 |
! |
06b045d4e152
no more direct accesses to borderWidth and borderColor
Claus Gittinger <cg@exept.de>
parents:
3778
diff
changeset
|
1599 |
|
06b045d4e152
no more direct accesses to borderWidth and borderColor
Claus Gittinger <cg@exept.de>
parents:
3778
diff
changeset
|
1600 |
version_CVS |
5424 | 1601 |
^ '$Header$' |
205 | 1602 |
! ! |
4565
4c4b47122c2c
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4023
diff
changeset
|
1603 |