"
COPYRIGHT (c) 1989 by Claus Gittinger
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
inclusion of the above copyright notice. This software may not
be provided or otherwise made available to, or used by, any
other person. No title to or ownership of the software is
hereby transferred.
"
Scroller subclass:#HorizontalScroller
instanceVariableNames:''
classVariableNames:''
poolDictionaries:''
category:'Views-Interactors'
!
HorizontalScroller comment:'
COPYRIGHT (c) 1989 by Claus Gittinger
All Rights Reserved
the scroller part of a horizontal scrollbar
$Header: /cvs/stx/stx/libwidg/HorizontalScroller.st,v 1.5 1994-08-07 13:22:36 claus Exp $
written spring/summer 89 by claus
'!
!HorizontalScroller methodsFor:'initialization'!
initialize
super initialize.
moveDirection := #x
! !
!HorizontalScroller methodsFor:'accessing'!
thumbOrigin:newOrigin
"set the thumbs origin (in percent)"
|realNewOrigin oldFrame oldLeft oldRight thumbLeft thumbRight
tH tW delta top|
((newOrigin + thumbHeight) > 100) ifTrue:[
realNewOrigin := 100 - thumbHeight
] ifFalse: [
realNewOrigin := newOrigin
].
(realNewOrigin > 100) ifTrue:[
realNewOrigin := 100
] ifFalse: [
(realNewOrigin < 0) ifTrue:[
realNewOrigin := 0
]
].
(realNewOrigin = thumbOrigin) ifFalse:[
thumbOrigin := realNewOrigin.
shown ifTrue:[
oldFrame := thumbFrame.
self computeThumbFrame.
(thumbHeight = 100) ifTrue:[^ self].
(thumbFrame ~~ oldFrame) ifTrue:[
oldFrame isNil ifTrue:[
self drawThumb.
^ self
].
tH := thumbFrame height.
tW := thumbFrame width.
oldLeft := oldFrame left.
oldRight := oldLeft + tW.
thumbLeft := thumbFrame left.
thumbRight := thumbLeft + tW.
top := thumbFrame top.
(oldRight >= width) ifTrue:[
"cannot copy - thumb was behind end"
self drawThumbBackgroundInX:oldLeft y:top
width:(width - oldLeft" - 1") height:tH.
self drawThumb.
^ self
].
self catchExpose.
self copyFrom:self x:oldLeft y:top
toX:thumbLeft y:top
width:tW height:tH.
oldLeft > thumbLeft ifTrue:[
delta := oldLeft - thumbLeft.
oldLeft > thumbRight ifTrue:[
self drawThumbBackgroundInX:oldLeft y:top
width:(tW + 1) height:tH
] ifFalse:[
self drawThumbBackgroundInX:thumbRight y:top
width:delta height:tH
]
] ifFalse:[
delta := thumbLeft - oldLeft.
oldRight < thumbLeft ifTrue:[
self drawThumbBackgroundInX:oldLeft y:top
width:tW + 1 height:tH
] ifFalse:[
self drawThumbBackgroundInX:oldLeft y:top
width:delta height:tH
]
].
self waitForExpose
]
]
]
!
scrollLeftAction:aBlock
"ignored -
but implemented, so that scroller can be used in place of a scrollbar"
!
scrollRightAction:aBlock
"ignored -
but implemented, so that scroller can be used in place of a scrollbar"
! !