HorizontalSteppingSlider.st
changeset 267 f534e60f85e3
parent 184 13a2f3677c68
child 400 d176fd820716
equal deleted inserted replaced
266:3dbbc5c8bfef 267:f534e60f85e3
    53 ! !
    53 ! !
    54 
    54 
    55 !HorizontalSteppingSlider methodsFor:'accessing'!
    55 !HorizontalSteppingSlider methodsFor:'accessing'!
    56 
    56 
    57 model:aModel
    57 model:aModel
       
    58     "set the model; this will get the thumbs origin
       
    59      via #value: messages"
       
    60 
    58     thumb model:aModel
    61     thumb model:aModel
    59 !
    62 !
    60 
    63 
    61 start:start stop:stop step:step
    64 start:start stop:stop step:step
       
    65     "set the range and stepIncrement"
       
    66 
    62     thumb start:start stop:stop.
    67     thumb start:start stop:stop.
    63     stepIncrement := step
    68     stepIncrement := step
    64 !
    69 !
    65 
    70 
    66 step
    71 step
       
    72     "retrieve the stepIncrement"
       
    73 
    67     ^ stepIncrement
    74     ^ stepIncrement
    68 !
    75 !
    69 
    76 
    70 step:aNumber
    77 step:aNumber
    71     "same as stepIncrement;
    78     "same as stepIncrement;
   112 ! !
   119 ! !
   113 
   120 
   114 !HorizontalSteppingSlider methodsFor:'misc'!
   121 !HorizontalSteppingSlider methodsFor:'misc'!
   115 
   122 
   116 doesNotUnderstand:aMessage
   123 doesNotUnderstand:aMessage
       
   124     "delegate any unknown messages to my thumb"
       
   125 
   117     ^ aMessage sendTo:thumb 
   126     ^ aMessage sendTo:thumb 
   118 ! !
   127 ! !
   119 
   128 
   120 !HorizontalSteppingSlider methodsFor:'private'!
   129 !HorizontalSteppingSlider methodsFor:'private'!
   121 
   130 
       
   131 scrollStep:delta
       
   132     "step by some delta"
       
   133 
       
   134     |oldOrg newOrg|
       
   135 
       
   136     oldOrg := thumb thumbOrigin.
       
   137     newOrg := ((oldOrg + delta) max:thumb start) min:thumb stop.
       
   138     oldOrg ~= newOrg ifTrue:[
       
   139         thumb thumbOrigin:newOrg.
       
   140         thumb tellOthers.
       
   141     ]
       
   142 !
       
   143 
   122 scrollStepDown
   144 scrollStepDown
   123     |nO|
   145     "stepDown"
   124 
   146 
   125     nO := (thumb thumbOrigin - stepIncrement) max:thumb start.
   147     self scrollStep:stepIncrement negated
   126     thumb thumbOrigin:nO.
       
   127     thumb tellOthers.
       
   128 !
   148 !
   129 
   149 
   130 scrollStepUp
   150 scrollStepUp
   131     |nO|
   151     "step up"
   132 
   152 
   133     nO := (thumb thumbOrigin + stepIncrement) min:thumb stop.         
   153     self scrollStep:stepIncrement
   134     thumb thumbOrigin:nO.
   154 
   135     thumb tellOthers.
       
   136 ! !
   155 ! !
   137 
   156 
   138 !HorizontalSteppingSlider class methodsFor:'documentation'!
   157 !HorizontalSteppingSlider class methodsFor:'documentation'!
   139 
   158 
   140 version
   159 version
   141     ^ '$Header: /cvs/stx/stx/libwidg2/HorizontalSteppingSlider.st,v 1.8 1996-05-18 15:43:18 cg Exp $'
   160     ^ '$Header: /cvs/stx/stx/libwidg2/HorizontalSteppingSlider.st,v 1.9 1996-12-12 13:35:26 cg Exp $'
   142 ! !
   161 ! !