SteppingSlider.st
changeset 65 40e27e2606b5
parent 57 126745871373
child 71 9f9243f5813b
equal deleted inserted replaced
64:10910b8b003a 65:40e27e2606b5
    21 
    21 
    22 SteppingSlider comment:'
    22 SteppingSlider comment:'
    23 COPYRIGHT (c) 1994 by Claus Gittinger
    23 COPYRIGHT (c) 1994 by Claus Gittinger
    24 	      All Rights Reserved
    24 	      All Rights Reserved
    25 
    25 
    26 $Header: /cvs/stx/stx/libwidg2/SteppingSlider.st,v 1.3 1995-05-12 18:40:34 claus Exp $
    26 $Header: /cvs/stx/stx/libwidg2/SteppingSlider.st,v 1.4 1995-07-23 03:12:59 claus Exp $
    27 '!
    27 '!
    28 
    28 
    29 !SteppingSlider class methodsFor:'documentation'!
    29 !SteppingSlider class methodsFor:'documentation'!
    30 
    30 
    31 copyright
    31 copyright
    42 "
    42 "
    43 !
    43 !
    44 
    44 
    45 version
    45 version
    46 "
    46 "
    47 $Header: /cvs/stx/stx/libwidg2/SteppingSlider.st,v 1.3 1995-05-12 18:40:34 claus Exp $
    47 $Header: /cvs/stx/stx/libwidg2/SteppingSlider.st,v 1.4 1995-07-23 03:12:59 claus Exp $
    48 "
    48 "
    49 !
    49 !
    50 
    50 
    51 documentation
    51 documentation
    52 "
    52 "
   115 !
   115 !
   116 
   116 
   117 initialize
   117 initialize
   118     super initialize.
   118     super initialize.
   119     stepIncrement := 1.
   119     stepIncrement := 1.
   120     self scrollDownAction:[|nO|
   120     self scrollDownAction:[self scrollStepUp].
   121 			 nO := (thumb thumbOrigin + stepIncrement) min:100.         
   121     self scrollUpAction:[self scrollStepDown].
   122 			 thumb thumbOrigin:nO.
       
   123 			 thumb tellOthers "scrollAction value:nO"].
       
   124     self scrollUpAction:[|nO|
       
   125 			 nO := (thumb thumbOrigin - stepIncrement) max:0.
       
   126 			 thumb thumbOrigin:nO.
       
   127 			 thumb tellOthers "scrollAction value:nO"].
       
   128 ! !
   122 ! !
   129 
   123 
   130 !SteppingSlider methodsFor:'accessing'!
   124 !SteppingSlider methodsFor:'accessing'!
   131 
   125 
   132 model:aModel
   126 model:aModel
   135 
   129 
   136 stepIncrement:aNumber 
   130 stepIncrement:aNumber 
   137     "set the value used for stepping (defaults to 1)"
   131     "set the value used for stepping (defaults to 1)"
   138 
   132 
   139     stepIncrement := aNumber
   133     stepIncrement := aNumber
       
   134 !
       
   135 
       
   136 step:aNumber
       
   137     "same as stepIncrement;
       
   138      set the value used for stepping (defaults to 1)"
       
   139 
       
   140     stepIncrement := aNumber
       
   141 !
       
   142 
       
   143 step
       
   144     ^ stepIncrement
       
   145 !
       
   146 
       
   147 start:start stop:stop step:step
       
   148     thumb start:start stop:stop.
       
   149     stepIncrement := step
       
   150 ! !
       
   151 
       
   152 !SteppingSlider methodsFor:'events'!
       
   153 
       
   154 keyPress:key x:x y:y
       
   155     key == #CursorRight ifTrue:[
       
   156 	self scrollStepUp.
       
   157 	^ self
       
   158     ].
       
   159     key == #CursorLeft ifTrue:[
       
   160 	self scrollStepDown.
       
   161 	^ self
       
   162     ].
       
   163     super keyPress:key x:x y:y
       
   164 ! !
       
   165 
       
   166 !SteppingSlider methodsFor:'private'!
       
   167 
       
   168 scrollStepUp
       
   169     |nO|
       
   170 
       
   171     nO := (thumb thumbOrigin + stepIncrement) min:thumb stop.         
       
   172     thumb thumbOrigin:nO.
       
   173     thumb tellOthers.
       
   174 !
       
   175 
       
   176 scrollStepDown
       
   177     |nO|
       
   178 
       
   179     nO := (thumb thumbOrigin - stepIncrement) max:thumb start.
       
   180     thumb thumbOrigin:nO.
       
   181     thumb tellOthers.
   140 ! !
   182 ! !
   141 
   183 
   142 !SteppingSlider methodsFor:'misc'!
   184 !SteppingSlider methodsFor:'misc'!
   143 
   185 
   144 doesNotUnderstand:aMessage
   186 doesNotUnderstand:aMessage