SteppingSlider.st
author claus
Wed, 03 May 1995 02:43:15 +0200
changeset 49 4dd0f5c3353e
parent 23 1e6bf473d863
child 57 126745871373
permissions -rw-r--r--
.

"
 COPYRIGHT (c) 1994 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.
"

'From Smalltalk/X, Version:2.10.3 on 27-sep-1994 at 12:56:30'!

ScrollBar subclass:#SteppingSlider
	 instanceVariableNames:''
	 classVariableNames:''
	 poolDictionaries:''
	 category:'Views-Interactors'
!

SteppingSlider comment:'
COPYRIGHT (c) 1994 by Claus Gittinger
	      All Rights Reserved

$Header: /cvs/stx/stx/libwidg2/SteppingSlider.st,v 1.2 1995-05-03 00:43:02 claus Exp $
'!

!SteppingSlider class methodsFor:'documentation'!

copyright
"
 COPYRIGHT (c) 1994 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.
"
!

version
"
$Header: /cvs/stx/stx/libwidg2/SteppingSlider.st,v 1.2 1995-05-03 00:43:02 claus Exp $
"
!

documentation
"
    SteppingSliders are like Sliders, but add step-up and step-down
    buttons (which increment/decrement the value).
"
!

examples 
"
    non model operation:

      |top sl|

      top := StandardSystemView extent:200@200.
      sl := SteppingSlider in:top.
      sl origin:(0.0@0.0) corner:(sl width@1.0).
      sl scrollAction:[:pos | Transcript showCr:pos].    
      top open


    model operation (look at value in model):

      |model top sl|

      model := 0 asValue.
      model inspect.

      top := StandardSystemView extent:200@200.
      sl := SteppingSlider in:top.
      sl origin:(0.0@0.0) corner:(sl width@1.0).
      sl model:model.
      top open
"
! !

!SteppingSlider methodsFor:'initialization'!

createElements
    button1 := ArrowButton upIn:self.
    button1 name:'UpButton'.
    button2 := ArrowButton downIn:self.
    button2 name:'DownButton'.
    thumb := Slider in:self.
!

initialize
    super initialize.
    rangeStep := 1.
    self scrollDownAction:[|nO|
			 nO := (thumb thumbOrigin + 1) min:100.         
			 thumb thumbOrigin:nO.
			 thumb tellOthers "scrollAction value:nO"].
    self scrollUpAction:[|nO|
			 nO := (thumb thumbOrigin - 1) max:0.
			 thumb thumbOrigin:nO.
			 thumb tellOthers "scrollAction value:nO"].
! !

!SteppingSlider methodsFor:'accessing'!

model:aModel
    thumb model:aModel
! !

!SteppingSlider methodsFor:'misc'!

doesNotUnderstand:aMessage
    ^ aMessage sendTo:thumb 
! !