0
|
1 |
"
|
5
|
2 |
COPYRIGHT (c) 1991 by Claus Gittinger
|
59
|
3 |
All Rights Reserved
|
0
|
4 |
|
|
5 |
This software is furnished under a license and may be used
|
|
6 |
only in accordance with the terms of that license and with the
|
|
7 |
inclusion of the above copyright notice. This software may not
|
|
8 |
be provided or otherwise made available to, or used by, any
|
|
9 |
other person. No title to or ownership of the software is
|
|
10 |
hereby transferred.
|
|
11 |
"
|
|
12 |
|
105
|
13 |
'From Smalltalk/X, Version:2.10.5 on 14-mar-1995 at 11:10:57 am'!
|
99
|
14 |
|
119
|
15 |
SimpleView subclass:#VariableVerticalPanel
|
105
|
16 |
instanceVariableNames:'barHeight barWidth separatingLine shadowForm lightForm showHandle
|
116
|
17 |
handlePosition handleColor handleStyle noColor trackLine
|
|
18 |
redrawLocked'
|
59
|
19 |
classVariableNames:'DefaultShowHandle DefaultHandleStyle DefaultHandlePosition
|
116
|
20 |
DefaultTrackingLine DefaultSeparatingLine DefaultHandleColor
|
|
21 |
DefaultCursor'
|
59
|
22 |
poolDictionaries:''
|
|
23 |
category:'Views-Layout'
|
0
|
24 |
!
|
|
25 |
|
|
26 |
VariableVerticalPanel comment:'
|
5
|
27 |
COPYRIGHT (c) 1991 by Claus Gittinger
|
59
|
28 |
All Rights Reserved
|
0
|
29 |
|
130
|
30 |
$Header: /cvs/stx/stx/libwidg/VariableVerticalPanel.st,v 1.18 1995-06-06 04:15:54 claus Exp $
|
38
|
31 |
'!
|
|
32 |
|
|
33 |
!VariableVerticalPanel class methodsFor:'documentation'!
|
|
34 |
|
|
35 |
copyright
|
|
36 |
"
|
|
37 |
COPYRIGHT (c) 1991 by Claus Gittinger
|
59
|
38 |
All Rights Reserved
|
38
|
39 |
|
|
40 |
This software is furnished under a license and may be used
|
|
41 |
only in accordance with the terms of that license and with the
|
|
42 |
inclusion of the above copyright notice. This software may not
|
|
43 |
be provided or otherwise made available to, or used by, any
|
|
44 |
other person. No title to or ownership of the software is
|
|
45 |
hereby transferred.
|
|
46 |
"
|
|
47 |
!
|
|
48 |
|
|
49 |
version
|
|
50 |
"
|
130
|
51 |
$Header: /cvs/stx/stx/libwidg/VariableVerticalPanel.st,v 1.18 1995-06-06 04:15:54 claus Exp $
|
38
|
52 |
"
|
|
53 |
!
|
|
54 |
|
|
55 |
documentation
|
|
56 |
"
|
|
57 |
a View to separate its subviews vertically by a movable bar;
|
|
58 |
the size-ratios of the subviews can be changed by moving this bar.
|
|
59 |
|
|
60 |
The bar-handle is either an exposed knob (style == #motif)
|
|
61 |
or the forms defined in Scroller (style ~~ #motif)
|
|
62 |
or nothing.
|
|
63 |
|
|
64 |
The subvies dimensions MUST be given as relative sizes;
|
|
65 |
typically creation is done as:
|
0
|
66 |
|
59
|
67 |
p := VariableVerticalPanel in:superView.
|
|
68 |
v1 := <someViewClass> origin:0.0 @ 0.0
|
|
69 |
corner:1.0 @ 0.5
|
|
70 |
in:p.
|
|
71 |
v2 := <someViewClass> origin:0.0 @ 0.5
|
|
72 |
corner:1.0 @ 0.8
|
|
73 |
in:p.
|
|
74 |
v3 := <someViewClass> origin:0.0 @ 0.8
|
|
75 |
corner:1.0 @ 1.0
|
|
76 |
in:p.
|
38
|
77 |
|
63
|
78 |
"
|
|
79 |
!
|
|
80 |
|
|
81 |
examples
|
|
82 |
"
|
38
|
83 |
example:
|
59
|
84 |
|top p v1 v2 v3|
|
38
|
85 |
|
59
|
86 |
top := StandardSystemView new.
|
|
87 |
top extent:300@300.
|
0
|
88 |
|
59
|
89 |
p := VariableVerticalPanel
|
|
90 |
origin:0.0 @ 0.0
|
|
91 |
corner:1.0 @ 1.0
|
|
92 |
in:top.
|
|
93 |
v1 := ScrollableView for:SelectionInListView in:p.
|
79
|
94 |
v1 origin:0.0 @ 0.0 corner:1.0 @ 0.5.
|
59
|
95 |
v1 list:(FileDirectory directoryNamed:'/etc') contents.
|
|
96 |
v1 action:[:selNr |
|
|
97 |
|fullName stream text|
|
|
98 |
fullName := '/etc/' , v1 selectionValue.
|
|
99 |
stream := fullName asFilename readStream.
|
|
100 |
stream notNil ifTrue:[
|
|
101 |
text := stream contents.
|
|
102 |
v2 contents:text.
|
|
103 |
v3 contents:text
|
|
104 |
]
|
|
105 |
].
|
0
|
106 |
|
59
|
107 |
v2 := TextView
|
79
|
108 |
origin:0.0 @ 0.5 corner:1.0 @ 0.8 in:p.
|
|
109 |
|
59
|
110 |
v3 := ScrollableView
|
79
|
111 |
for:TextView
|
59
|
112 |
in:p.
|
79
|
113 |
v3 origin:0.0 @ 0.8 corner:1.0 @ 1.0.
|
59
|
114 |
top open
|
38
|
115 |
"
|
|
116 |
! !
|
0
|
117 |
|
|
118 |
!VariableVerticalPanel class methodsFor:'defaults'!
|
|
119 |
|
59
|
120 |
updateStyleCache
|
|
121 |
DefaultShowHandle := StyleSheet at:'variablePanelShowHandle' default:true.
|
|
122 |
DefaultHandleStyle := StyleSheet at:'variablePanelHandleStyle'.
|
|
123 |
DefaultHandlePosition := StyleSheet at:'variablePanelHandlePosition' default:#right.
|
|
124 |
DefaultTrackingLine := StyleSheet at:'variablePanelTrackingLine' default:false.
|
|
125 |
DefaultSeparatingLine := StyleSheet at:'variablePanelSeparatingLine' default:false.
|
60
|
126 |
DefaultHandleColor := StyleSheet colorAt:'variablePanelHandleColor' default:Black.
|
0
|
127 |
!
|
|
128 |
|
105
|
129 |
shadowFormOn:aDisplay
|
|
130 |
"use same handle as Scroller"
|
|
131 |
|
|
132 |
^ Scroller handleShadowFormOn:aDisplay
|
|
133 |
!
|
|
134 |
|
99
|
135 |
lightFormOn:aDisplay
|
|
136 |
"use same handle as Scroller"
|
59
|
137 |
|
99
|
138 |
^ Scroller handleLightFormOn:aDisplay
|
0
|
139 |
! !
|
|
140 |
|
99
|
141 |
!VariableVerticalPanel methodsFor:'drawing'!
|
0
|
142 |
|
|
143 |
drawHandleAtX:hx y:hy
|
79
|
144 |
"draw a single handle at hx/hy"
|
|
145 |
|
0
|
146 |
|h y m|
|
|
147 |
|
59
|
148 |
shadowForm notNil ifTrue:[
|
|
149 |
h := shadowForm height
|
0
|
150 |
] ifFalse:[
|
59
|
151 |
h := barHeight - 4
|
0
|
152 |
].
|
|
153 |
|
79
|
154 |
"/ self paint:viewBackground.
|
|
155 |
"/ self fillRectangleX:margin y:hy
|
|
156 |
"/ width:(width - margin - margin)
|
|
157 |
"/ height:barHeight.
|
0
|
158 |
|
59
|
159 |
(handleStyle ~~ #normal and:[handleStyle ~~ #mswindows]) ifTrue:[
|
|
160 |
m := (barHeight - h) // 2.
|
|
161 |
shadowForm isNil ifTrue:[
|
|
162 |
y := hy + (barHeight // 2).
|
|
163 |
separatingLine ifTrue:[
|
|
164 |
self paint:shadowColor.
|
|
165 |
self displayLineFromX:margin y:y toX:(width - margin) y:y.
|
|
166 |
y := y + 1.
|
|
167 |
self paint:lightColor.
|
|
168 |
self displayLineFromX:margin y:y toX:(width - margin) y:y.
|
|
169 |
].
|
|
170 |
self paint:viewBackground.
|
|
171 |
self fillRectangleX:(hx - barWidth) y:hy
|
|
172 |
width:(barWidth + barWidth)
|
|
173 |
height:h.
|
0
|
174 |
|
59
|
175 |
y := hy.
|
|
176 |
handleStyle == #st80 ifTrue:[
|
|
177 |
y := y - 1
|
|
178 |
].
|
|
179 |
self drawEdgesForX:(hx - barWidth)
|
|
180 |
y:(y + m)
|
|
181 |
width:(barWidth + barWidth)
|
|
182 |
height:h
|
60
|
183 |
level:2.
|
|
184 |
handleStyle == #iris ifTrue:[
|
63
|
185 |
self paint:handleColor.
|
60
|
186 |
self fillDeviceRectangleX:(hx - barWidth + 2)
|
|
187 |
y:(y + m + 2)
|
|
188 |
width:(barWidth + barWidth - 4)
|
|
189 |
height:h - 4
|
|
190 |
]
|
59
|
191 |
] ifFalse:[
|
|
192 |
y := hy.
|
|
193 |
self drawHandleFormAtX:hx y:(y + m)
|
|
194 |
].
|
|
195 |
handleStyle == #st80 ifTrue:[
|
|
196 |
y := hy - 1.
|
|
197 |
self paint:lightColor.
|
|
198 |
self displayLineFromX:margin y:y toX:(width - margin - margin - 1) y:y.
|
|
199 |
self displayLineFromX:0 y:hy toX:0 y:(hy + barHeight - 1).
|
|
200 |
y := hy + barHeight - 2.
|
|
201 |
self paint:shadowColor.
|
|
202 |
self displayLineFromX:margin y:y toX:(width - margin) y:y.
|
|
203 |
"uncomment the -1 if you dont like the notch at the right end"
|
|
204 |
" VVV"
|
|
205 |
self displayLineFromX:width-1 y:hy" "-1" " toX:width-1 y:(hy + barHeight - 1).
|
|
206 |
].
|
0
|
207 |
] ifFalse:[
|
59
|
208 |
y := hy + barHeight - 1.
|
|
209 |
self paint:handleColor.
|
|
210 |
separatingLine ifTrue:[
|
|
211 |
self displayLineFromX:0 y:hy+1 toX:width y:hy+1.
|
|
212 |
self displayLineFromX:0 y:y toX:width y:y.
|
|
213 |
].
|
63
|
214 |
self fillRectangleX:hx y:hy width:barWidth height:barHeight
|
0
|
215 |
]
|
|
216 |
!
|
|
217 |
|
105
|
218 |
redrawHandlesFrom:start to:stop
|
|
219 |
"redraw some handles"
|
|
220 |
|
|
221 |
subViews notNil ifTrue:[
|
|
222 |
showHandle ifTrue:[
|
|
223 |
self handleOriginsFrom:start to:stop do:[:hPoint |
|
|
224 |
self drawHandleAtX:(hPoint x) y:(hPoint y)
|
|
225 |
].
|
|
226 |
]
|
|
227 |
]
|
|
228 |
!
|
|
229 |
|
99
|
230 |
lockRedraw
|
|
231 |
redrawLocked := true
|
|
232 |
!
|
|
233 |
|
|
234 |
unlockRedraw
|
|
235 |
redrawLocked := false
|
|
236 |
!
|
|
237 |
|
105
|
238 |
redraw
|
|
239 |
"redraw all of the handles"
|
|
240 |
|
|
241 |
redrawLocked ~~ true ifTrue:[
|
|
242 |
self redrawHandlesFrom:1 to:(subViews size)
|
|
243 |
]
|
|
244 |
!
|
|
245 |
|
99
|
246 |
invertHandleBarAtX:hx y:hy
|
|
247 |
self noClipByChildren.
|
|
248 |
self xoring:[
|
|
249 |
|y|
|
|
250 |
|
|
251 |
trackLine ifTrue:[
|
|
252 |
y := hy + (barHeight // 2).
|
|
253 |
self displayLineFromX:0 y:y toX:width y:y.
|
|
254 |
] ifFalse:[
|
|
255 |
self fillRectangleX:0 y:hy width:width height:barHeight
|
|
256 |
]
|
|
257 |
].
|
|
258 |
self clipByChildren.
|
|
259 |
!
|
|
260 |
|
|
261 |
drawHandleFormAtX:hx y:hy
|
|
262 |
"draw a handles bitmap at hx/hy"
|
|
263 |
|
|
264 |
self paint:shadowColor.
|
|
265 |
self displayForm:shadowForm x:hx y:hy.
|
|
266 |
self paint:lightColor.
|
|
267 |
self displayForm:lightForm x:hx y:hy.
|
|
268 |
self paint:viewBackground
|
|
269 |
! !
|
0
|
270 |
|
99
|
271 |
!VariableVerticalPanel methodsFor:'accessing'!
|
|
272 |
|
|
273 |
barHeight:nPixel
|
|
274 |
"set the height of the separating bar"
|
|
275 |
|
|
276 |
barHeight := nPixel.
|
79
|
277 |
|
99
|
278 |
"if screen is very low-res, make certain bar is visible and catchable"
|
|
279 |
(barHeight < 4) ifTrue:[
|
|
280 |
barHeight := 4
|
|
281 |
].
|
|
282 |
|
|
283 |
"make it even so spacing is equally spreadable among subviews"
|
|
284 |
barHeight odd ifTrue:[
|
|
285 |
barHeight := barHeight + 1
|
|
286 |
]
|
|
287 |
!
|
|
288 |
|
105
|
289 |
barHeight
|
|
290 |
"return the height of the separating bar"
|
|
291 |
|
|
292 |
^ barHeight
|
|
293 |
!
|
|
294 |
|
99
|
295 |
add:aView
|
|
296 |
"a view is added; make its size relative (if not already done)"
|
|
297 |
|
|
298 |
"obsolete" self halt.
|
|
299 |
|
|
300 |
super add:aView.
|
|
301 |
shown ifTrue:[
|
|
302 |
(superView isNil or:[superView shown]) ifTrue:[
|
|
303 |
self setupSubviewSizes
|
59
|
304 |
]
|
0
|
305 |
]
|
|
306 |
!
|
|
307 |
|
99
|
308 |
removeSubView:aView
|
|
309 |
"a view is removed; adjust other subviews sizes"
|
0
|
310 |
|
99
|
311 |
super removeSubView:aView.
|
7
|
312 |
shown ifTrue:[
|
99
|
313 |
(superView isNil or:[superView shown]) ifTrue:[
|
|
314 |
self setupSubviewSizes
|
59
|
315 |
]
|
0
|
316 |
]
|
|
317 |
!
|
|
318 |
|
99
|
319 |
handlePosition:aSymbol
|
|
320 |
"define the position of the handle; the argument aSymbol
|
|
321 |
may be one of #left, #right or #center"
|
0
|
322 |
|
99
|
323 |
handlePosition := aSymbol
|
|
324 |
!
|
0
|
325 |
|
99
|
326 |
handlePosition
|
|
327 |
"return the position of the handle"
|
|
328 |
|
|
329 |
^ handlePosition
|
|
330 |
!
|
|
331 |
|
|
332 |
style:styleSymbol
|
|
333 |
"define the style of the handle;
|
|
334 |
styleSymbol may be #motif to draw a little knob or
|
|
335 |
anything else to draw scrollBars handleForm"
|
0
|
336 |
|
99
|
337 |
(styleSymbol ~~ handleStyle) ifTrue:[
|
|
338 |
handleStyle := styleSymbol.
|
|
339 |
handleStyle == #next ifTrue:[
|
|
340 |
shadowForm := self class shadowFormOn:device.
|
|
341 |
lightForm := self class lightFormOn:device.
|
|
342 |
] ifFalse:[
|
|
343 |
shadowForm := lightForm := nil
|
|
344 |
].
|
79
|
345 |
|
99
|
346 |
shadowForm notNil ifTrue:[
|
|
347 |
(self is3D and:[handleStyle ~~ #motif]) ifTrue:[
|
|
348 |
self barHeight:(shadowForm height + 2).
|
|
349 |
barWidth := shadowForm width
|
|
350 |
]
|
59
|
351 |
].
|
99
|
352 |
shown ifTrue:[
|
|
353 |
self resizeSubviewsFrom:1 to:(subViews size).
|
|
354 |
self redraw
|
|
355 |
]
|
|
356 |
]
|
|
357 |
! !
|
|
358 |
|
|
359 |
!VariableVerticalPanel methodsFor:'initializing'!
|
|
360 |
|
|
361 |
fixSize
|
|
362 |
extentChanged ifTrue:[
|
|
363 |
super fixSize.
|
|
364 |
self resizeSubviewsFrom:1 to:(subViews size)
|
0
|
365 |
] ifFalse:[
|
99
|
366 |
super fixSize
|
0
|
367 |
]
|
|
368 |
!
|
|
369 |
|
105
|
370 |
initialize
|
|
371 |
super initialize.
|
|
372 |
noColor := Color noColor.
|
|
373 |
!
|
|
374 |
|
99
|
375 |
initStyle
|
|
376 |
|mm|
|
0
|
377 |
|
99
|
378 |
super initStyle.
|
0
|
379 |
|
99
|
380 |
handleColor := DefaultHandleColor on:device.
|
0
|
381 |
|
99
|
382 |
showHandle := DefaultShowHandle.
|
63
|
383 |
|
99
|
384 |
DefaultHandleStyle isNil ifTrue:[
|
130
|
385 |
handleStyle := styleSheet name
|
99
|
386 |
] ifFalse:[
|
|
387 |
handleStyle := DefaultHandleStyle
|
|
388 |
].
|
|
389 |
handleStyle == #next ifTrue:[
|
|
390 |
shadowForm := self class shadowFormOn:device.
|
|
391 |
lightForm := self class lightFormOn:device.
|
63
|
392 |
|
99
|
393 |
self barHeight:(shadowForm height + 2).
|
|
394 |
barWidth := shadowForm width.
|
0
|
395 |
] ifFalse:[
|
99
|
396 |
shadowForm := lightForm := nil.
|
0
|
397 |
].
|
|
398 |
|
99
|
399 |
handlePosition := DefaultHandlePosition.
|
|
400 |
trackLine := DefaultTrackingLine.
|
|
401 |
separatingLine := DefaultSeparatingLine.
|
79
|
402 |
|
99
|
403 |
mm := device verticalPixelPerMillimeter.
|
|
404 |
self is3D ifTrue:[
|
|
405 |
self barHeight:(3 * mm) rounded
|
|
406 |
] ifFalse:[
|
|
407 |
self barHeight:(2 * mm) rounded
|
0
|
408 |
].
|
99
|
409 |
barWidth := (2 * mm) rounded. "motif style width"
|
|
410 |
handleStyle == #mswindows ifTrue:[
|
|
411 |
barWidth := (ArrowButton new direction:#up) width + 1
|
|
412 |
].
|
|
413 |
!
|
|
414 |
|
105
|
415 |
defaultControllerClass
|
|
416 |
^ VariableVerticalPanelController
|
|
417 |
|
|
418 |
|
0
|
419 |
!
|
|
420 |
|
99
|
421 |
initCursor
|
|
422 |
"set the cursor - a double arrow"
|
0
|
423 |
|
99
|
424 |
DefaultCursor notNil ifTrue:[
|
|
425 |
cursor := DefaultCursor
|
|
426 |
] ifFalse:[
|
|
427 |
cursor := Cursor sourceForm:(Form fromFile:'VVPanel.xbm')
|
|
428 |
maskForm:(Form fromFile:'VVPanel_m.xbm')
|
|
429 |
hotX:8
|
|
430 |
hotY:8.
|
|
431 |
"
|
|
432 |
if bitmaps are not available, use a standard cursor
|
|
433 |
"
|
|
434 |
cursor isNil ifTrue:[
|
|
435 |
"which one looks better ?"
|
|
436 |
cursor := Cursor upDownArrow
|
|
437 |
"cursor := Cursor upLimitArrow"
|
|
438 |
].
|
|
439 |
DefaultCursor := cursor
|
|
440 |
]
|
0
|
441 |
! !
|
|
442 |
|
|
443 |
!VariableVerticalPanel methodsFor:'private'!
|
|
444 |
|
99
|
445 |
handleOriginsFrom:start to:stop do:aBlock
|
|
446 |
"evaluate the argument block for some handle-origins"
|
0
|
447 |
|
99
|
448 |
|x hw hDelta|
|
0
|
449 |
|
99
|
450 |
subViews notNil ifTrue:[
|
116
|
451 |
shadowForm notNil ifTrue:[
|
|
452 |
hw := shadowForm width
|
|
453 |
] ifFalse:[
|
|
454 |
hw := barWidth
|
|
455 |
].
|
|
456 |
(handleStyle ~~ #normal and:[handleStyle ~~ #mswindows]) ifTrue:[
|
|
457 |
hDelta := barWidth // 2.
|
|
458 |
] ifFalse:[
|
|
459 |
hDelta := 0
|
|
460 |
].
|
|
461 |
(handlePosition == #left) ifTrue:[
|
|
462 |
x := hDelta
|
|
463 |
] ifFalse:[
|
|
464 |
(handlePosition == #right) ifTrue:[
|
|
465 |
x := width - (1 "2" * hw) - margin - hDelta.
|
|
466 |
] ifFalse:[
|
|
467 |
x := width - barWidth // 2
|
|
468 |
]
|
|
469 |
].
|
|
470 |
(start + 1) to:stop do:[:index |
|
|
471 |
|view y|
|
0
|
472 |
|
116
|
473 |
view := subViews at:index.
|
|
474 |
y := view top "origin y" - barHeight + 1.
|
|
475 |
aBlock value:(x @ y)
|
|
476 |
]
|
0
|
477 |
]
|
|
478 |
!
|
|
479 |
|
|
480 |
resizeSubviewsFrom:start to:stop
|
|
481 |
"readjust size of some subviews"
|
|
482 |
|
|
483 |
|step nSubviews|
|
|
484 |
|
|
485 |
subViews notNil ifTrue:[
|
116
|
486 |
(start <= stop) ifTrue:[
|
|
487 |
step := 1
|
|
488 |
] ifFalse:[
|
|
489 |
step := -1
|
|
490 |
].
|
|
491 |
nSubviews := subViews size.
|
|
492 |
start to:stop by:step do:[:index |
|
|
493 |
|bw view o1 o2 relOrg relCorner newOrg newCorner newExt|
|
0
|
494 |
|
116
|
495 |
view := subViews at:index.
|
|
496 |
bw := view borderWidth.
|
0
|
497 |
|
116
|
498 |
index == 1 ifTrue:[
|
|
499 |
o1 := 0.
|
|
500 |
] ifFalse:[
|
|
501 |
o1 := barHeight // 2 - bw
|
|
502 |
].
|
|
503 |
index == nSubviews ifTrue:[
|
|
504 |
o2 := 0.
|
|
505 |
] ifFalse:[
|
|
506 |
o2 := barHeight // 2 - bw
|
|
507 |
].
|
0
|
508 |
|
105
|
509 |
"
|
116
|
510 |
relCorner := view relativeCorner.
|
|
511 |
relCorner isNil ifTrue:[
|
|
512 |
self error:'subview must have relative corner'
|
|
513 |
].
|
|
514 |
newCorner := view cornerFromRelativeCorner.
|
|
515 |
newCorner notNil ifTrue:[
|
|
516 |
newCorner y:(newCorner y - o2)
|
|
517 |
].
|
0
|
518 |
|
116
|
519 |
relOrg := view relativeOrigin.
|
|
520 |
relOrg isNil ifTrue:[
|
|
521 |
self error:'subview must have relative origin'
|
|
522 |
].
|
|
523 |
newOrg := view originFromRelativeOrigin.
|
|
524 |
newOrg notNil ifTrue:[
|
|
525 |
(index ~~ 1) ifTrue:[
|
|
526 |
newOrg y:(newOrg y + o1)
|
|
527 |
].
|
|
528 |
].
|
|
529 |
view pixelOrigin:newOrg corner:newCorner
|
105
|
530 |
"
|
116
|
531 |
newOrg := view computeOrigin.
|
|
532 |
newOrg notNil ifTrue:[
|
|
533 |
(index ~~ 1) ifTrue:[
|
|
534 |
newOrg y:(newOrg y + o1)
|
|
535 |
].
|
|
536 |
].
|
|
537 |
newExt := view computeExtent.
|
|
538 |
newExt notNil ifTrue:[
|
|
539 |
newExt y:(newExt y - o2 - o1)
|
|
540 |
].
|
|
541 |
view pixelOrigin:newOrg extent:newExt.
|
|
542 |
]
|
0
|
543 |
]
|
|
544 |
!
|
|
545 |
|
105
|
546 |
handleOriginsDo:aBlock
|
|
547 |
"evaluate the argument block for every handle-origin"
|
|
548 |
|
|
549 |
self handleOriginsFrom:1 to:(subViews size) do:aBlock
|
|
550 |
!
|
|
551 |
|
99
|
552 |
anyNonRelativeSubviews
|
|
553 |
"return true, if any of my subviews has no relative origin/extent"
|
|
554 |
|
|
555 |
1 to:(subViews size) do:[:index |
|
|
556 |
|view|
|
0
|
557 |
|
99
|
558 |
view := subViews at:index.
|
|
559 |
view relativeExtent isNil ifTrue:[^ true].
|
|
560 |
view relativeOrigin isNil ifTrue:[^ true]
|
|
561 |
].
|
|
562 |
^ false
|
|
563 |
!
|
0
|
564 |
|
99
|
565 |
setupSubviewSizes
|
|
566 |
"setup subviews sizes (in case of non-relative sizes)"
|
|
567 |
|
|
568 |
|y h|
|
|
569 |
|
|
570 |
self anyNonRelativeSubviews ifTrue:[
|
|
571 |
"there is at least one subview without
|
|
572 |
relative origin/extent - setup all subviews
|
|
573 |
to spread evenly ..."
|
|
574 |
|
|
575 |
y := 0.0.
|
|
576 |
h := 1.0 / (subViews size).
|
|
577 |
|
|
578 |
1 to:(subViews size) do:[:index |
|
|
579 |
|view|
|
0
|
580 |
|
59
|
581 |
view := subViews at:index.
|
99
|
582 |
index == subViews size ifTrue:[
|
|
583 |
view origin:(0.0 @ y) corner:(1.0 @ 1.0)
|
|
584 |
] ifFalse:[
|
|
585 |
view origin:(0.0 @ y) corner:(1.0 @ (y + h))
|
|
586 |
].
|
|
587 |
y := y + h
|
59
|
588 |
]
|
0
|
589 |
]
|
99
|
590 |
! !
|
|
591 |
|
|
592 |
!VariableVerticalPanel methodsFor:'event handling'!
|
|
593 |
|
|
594 |
sizeChanged:how
|
|
595 |
"tell subviews if I change size"
|
0
|
596 |
|
99
|
597 |
shown ifTrue:[
|
116
|
598 |
(how == #smaller) ifTrue:[
|
|
599 |
self resizeSubviewsFrom:1 to:(subViews size)
|
|
600 |
] ifFalse:[
|
|
601 |
self resizeSubviewsFrom:(subViews size) to:1
|
|
602 |
]
|
105
|
603 |
].
|
|
604 |
self changed:#sizeOfView with:how.
|
99
|
605 |
! !
|
0
|
606 |
|