--- a/HVScrollableView.st Tue Aug 30 00:54:47 1994 +0200
+++ b/HVScrollableView.st Mon Oct 10 04:03:47 1994 +0100
@@ -1,6 +1,6 @@
"
COPYRIGHT (c) 1991 by Claus Gittinger
- All Rights Reserved
+ All Rights Reserved
This software is furnished under a license and may be used
only in accordance with the terms of that license and with the
@@ -20,9 +20,9 @@
HVScrollableView comment:'
COPYRIGHT (c) 1991 by Claus Gittinger
- All Rights Reserved
+ All Rights Reserved
-$Header: /cvs/stx/stx/libwidg/HVScrollableView.st,v 1.6 1994-08-07 13:22:38 claus Exp $
+$Header: /cvs/stx/stx/libwidg/HVScrollableView.st,v 1.7 1994-10-10 03:01:48 claus Exp $
written jan 91 by claus
'!
@@ -38,110 +38,100 @@
!HVScrollableView methodsFor:'initialization'!
initializeFor:aViewClass miniScrollerH:miniH miniScrollerV:miniV
- |negativeOffset halfMargin orgX mrg halfSpacing is3D cls|
+ |negativeOffset halfMargin orgX mrg halfSpacing is3D cls hBorderWidth isST80|
+
+ isST80 := StyleSheet name = #st80. "leftover - remove it"
-"/ self initStyle.
-
- cls := miniH ifTrue:[HorizontalMiniScroller] ifFalse:[HorizontalScrollBar].
- style == #st80 ifTrue:[cls := HorizontalScrollBar].
+ isST80 ifTrue:[
+ cls := HorizontalScrollBar
+ ] ifFalse:[
+ cls := miniH ifTrue:[HorizontalMiniScroller] ifFalse:[HorizontalScrollBar].
+ ].
hScrollBar := cls in:self.
super
- initializeFor:aViewClass
- miniScrollerH:miniH
- miniScrollerV:miniV.
+ initializeFor:aViewClass
+ miniScrollerH:miniH
+ miniScrollerV:miniV.
negativeOffset := borderWidth negated.
halfMargin := innerMargin // 2.
- is3D := (style ~~ #normal) and:[style ~~ #mswindows].
+ is3D := StyleSheet is3D.
"
change vertical scrollbars size
"
+ mrg := hScrollBar borderWidth.
+ mrg isNil ifTrue:[mrg := 0].
+ hBorderWidth := mrg.
+
is3D ifTrue:[
- mrg := innerMargin + innerMargin + hScrollBar borderWidth.
- halfSpacing := ViewSpacing // 2.
- ] ifFalse:[
- mrg := hScrollBar borderWidth
+ isST80 ifTrue:[
+ halfSpacing := 0
+ ] ifFalse:[
+ mrg := mrg + innerMargin + innerMargin.
+ halfSpacing := ViewSpacing // 2.
+ ].
].
scrollBar extent:[scrollBar width @ (height - hScrollBar height - mrg)].
hScrollBar thumbOrigin:0 thumbHeight:100.
scrollBarPosition == #left ifTrue:[
- orgX := scrollBar origin x + scrollBar width.
- is3D ifTrue:[
- orgX := orgX + halfSpacing + 1.
- style == #st80 ifTrue:[
- orgX := orgX - (scrolledView margin)
- ]
- ]
- ] ifFalse:[
- orgX := 0 - hScrollBar borderWidth
- ].
- is3D ifTrue:[
- hScrollBar origin:[(orgX + innerMargin - halfSpacing - hScrollBar margin)
- @
- (height - hScrollBar height - halfMargin)
- ]
- extent:[(width -
- scrollBar width -
- (innerMargin * 2))
- @
- hScrollBar height
- ]
+ orgX := scrollBar origin x + scrollBar width.
+ is3D ifTrue:[
+ orgX := orgX + halfSpacing + 1.
+ isST80 ifTrue:[
+ orgX := orgX - (scrolledView margin)
+ ]
+ ]
] ifFalse:[
- scrollBarPosition == #left ifTrue:[
- hScrollBar
- origin:[(orgX + scrollBar borderWidth)
- @
- (height - hScrollBar height - (hScrollBar borderWidth "* 2"))
- ]
- extent:[(width -
- scrollBar width "- (2 * hScrollBar borderWidth)")
- @
- hScrollBar height
- ]
- ] ifFalse:[
- hScrollBar
- origin:[(orgX)
- @
- (height - hScrollBar height - (hScrollBar borderWidth "* 2"))
- ]
- extent:[(width - scrollBar width - hScrollBar borderWidth)
- @
- hScrollBar height
- ]
- ]
+ orgX := 0 - hBorderWidth.
+ isST80 ifTrue:[
+"/ orgX := orgX + 1
+ ]
+ ].
+
+ is3D ifTrue:[
+ hScrollBar origin:[(orgX + innerMargin - halfSpacing - hScrollBar margin)
+ @
+ (height - hScrollBar height - halfMargin)
+ ]
+ extent:[(width - scrollBar width - (innerMargin * 2))
+ @
+ hScrollBar height
+ ]
+ ] ifFalse:[
+ scrollBarPosition == #left ifTrue:[
+ hScrollBar
+ origin:[(orgX + scrollBar borderWidth)
+ @
+ (height - hScrollBar height - hBorderWidth)
+ ]
+ extent:[(width - scrollBar width) @ hScrollBar height]
+ ] ifFalse:[
+ hScrollBar
+ origin:[orgX @ (height - hScrollBar height - hBorderWidth) ]
+ extent:[(width - scrollBar width - hBorderWidth) @ hScrollBar height]
+ ]
].
scrolledView notNil ifTrue:[
- "redefine subviews size"
- is3D ifTrue:[
- scrolledView
- extent:[(width
- - scrollBar width
- - (innerMargin * 2))
- @
- (height
- - hScrollBar height
- - (innerMargin * 2))
- ]
- ] ifFalse:[
- scrolledView
- extent:[(width
- - scrollBar width
- - scrollBar borderWidth
- "- scrolledView borderWidth")
- @
- (height
- - hScrollBar height
- - hScrollBar borderWidth
- "- scrolledView borderWidth")
- ]
- ].
- self setScrollActions
+ "redefine subviews size"
+ is3D ifTrue:[
+ scrolledView
+ extent:[(width - scrollBar width - (innerMargin * 2))
+ @
+ (height - hScrollBar height - (innerMargin * 2)) ]
+ ] ifFalse:[
+ scrolledView
+ extent:[(width - scrollBar width - scrollBar borderWidth)
+ @
+ (height - hScrollBar height - hScrollBar borderWidth)
+ ]
+ ].
+ self setScrollActions
].
self viewGravity:#south
!
@@ -149,7 +139,7 @@
realize
super realize.
scrolledView notNil ifTrue:[
- hScrollBar setThumbFor:scrolledView
+ hScrollBar setThumbFor:scrolledView
]
! !
@@ -161,30 +151,30 @@
lock := false.
scrollBar scrollAction:[:position |
- lock := true.
- scrolledView scrollVerticalToPercent:position.
- lock := false
+ lock := true.
+ scrolledView scrollVerticalToPercent:position.
+ lock := false
].
scrollBar scrollUpAction:[scrolledView scrollUp].
scrollBar scrollDownAction:[scrolledView scrollDown].
hScrollBar scrollAction:[:position |
- lock := true.
- scrolledView scrollHorizontalToPercent:position.
- lock := false
+ lock := true.
+ scrolledView scrollHorizontalToPercent:position.
+ lock := false
].
hScrollBar scrollLeftAction:[scrolledView scrollLeft].
hScrollBar scrollRightAction:[scrolledView scrollRight].
scrolledView originChangeAction:[:aView |
- lock ifFalse:[
- scrollBar setThumbOriginFor:aView.
- hScrollBar setThumbOriginFor:aView
- ]
+ lock ifFalse:[
+ scrollBar setThumbOriginFor:aView.
+ hScrollBar setThumbOriginFor:aView
+ ]
].
scrolledView contentsChangeAction:[:aView |
- scrollBar setThumbFor:aView.
- hScrollBar setThumbFor:aView
+ scrollBar setThumbFor:aView.
+ hScrollBar setThumbFor:aView
]
! !
@@ -197,37 +187,33 @@
!
scrolledView:aView
- |is3D|
-
"set the scrolled view"
super scrolledView:aView.
- is3D := (style ~~ #normal) and:[style ~~ #mswindows].
-
"redefine subviews size"
- is3D ifTrue:[
- scrolledView
- extent:[(width
- - scrollBar width
- - (innerMargin * 2))
- @
- (height
- - hScrollBar height
- - (innerMargin * 2))
- ]
+ StyleSheet is3D ifTrue:[
+ scrolledView
+ extent:[(width
+ - scrollBar width
+ - (innerMargin * 2))
+ @
+ (height
+ - hScrollBar height
+ - (innerMargin * 2))
+ ]
] ifFalse:[
- scrolledView
- extent:[(width
- - scrollBar width
- - scrollBar borderWidth
- "- scrolledView borderWidth")
- @
- (height
- - hScrollBar height
- - hScrollBar borderWidth
- "- scrolledView borderWidth")
- ]
+ scrolledView
+ extent:[(width
+ - scrollBar width
+ - scrollBar borderWidth
+ "- scrolledView borderWidth")
+ @
+ (height
+ - hScrollBar height
+ - hScrollBar borderWidth
+ "- scrolledView borderWidth")
+ ]
].
self setScrollActions
! !
@@ -237,6 +223,6 @@
sizeChanged:how
super sizeChanged:how.
scrolledView notNil ifTrue:[
- hScrollBar setThumbFor:scrolledView
+ hScrollBar setThumbFor:scrolledView
]
! !