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