HVScrollableView.st
changeset 65 b33e4f3a264e
parent 63 f4eaf04d1eaf
child 105 3d064ba4a0cc
equal deleted inserted replaced
64:c4e3323a5348 65:b33e4f3a264e
    20 HVScrollableView comment:'
    20 HVScrollableView comment:'
    21 
    21 
    22 COPYRIGHT (c) 1991 by Claus Gittinger
    22 COPYRIGHT (c) 1991 by Claus Gittinger
    23 	      All Rights Reserved
    23 	      All Rights Reserved
    24 
    24 
    25 $Header: /cvs/stx/stx/libwidg/HVScrollableView.st,v 1.8 1994-11-17 14:38:05 claus Exp $
    25 $Header: /cvs/stx/stx/libwidg/HVScrollableView.st,v 1.9 1994-11-21 16:45:26 claus Exp $
    26 written jan 91 by claus
    26 written jan 91 by claus
    27 '!
    27 '!
    28 
    28 
    29 !HVScrollableView class methodsFor:'documentation'!
    29 !HVScrollableView class methodsFor:'documentation'!
    30 
    30 
    42 "
    42 "
    43 !
    43 !
    44 
    44 
    45 version
    45 version
    46 "
    46 "
    47 $Header: /cvs/stx/stx/libwidg/HVScrollableView.st,v 1.8 1994-11-17 14:38:05 claus Exp $
    47 $Header: /cvs/stx/stx/libwidg/HVScrollableView.st,v 1.9 1994-11-21 16:45:26 claus Exp $
    48 "
    48 "
    49 !
    49 !
    50 
    50 
    51 documentation
    51 documentation
    52 "
    52 "
   163 ! !
   163 ! !
   164 
   164 
   165 !HVScrollableView methodsFor:'private'!
   165 !HVScrollableView methodsFor:'private'!
   166 
   166 
   167 setScrollActions
   167 setScrollActions
   168     |lock|
       
   169 
       
   170     lock := false.
       
   171 
       
   172     scrollBar scrollAction:[:position |
   168     scrollBar scrollAction:[:position |
   173 	lock := true.
   169 	lockUpdates := true.
   174 	scrolledView scrollVerticalToPercent:position.
   170 	scrolledView scrollVerticalToPercent:position.
   175 	lock := false
   171 	lockUpdates := false
   176     ].
   172     ].
   177     scrollBar scrollUpAction:[scrolledView scrollUp].
   173     scrollBar scrollUpAction:[scrolledView scrollUp].
   178     scrollBar scrollDownAction:[scrolledView scrollDown].
   174     scrollBar scrollDownAction:[scrolledView scrollDown].
   179 
   175 
   180     hScrollBar scrollAction:[:position |
   176     hScrollBar scrollAction:[:position |
   181 	lock := true.
   177 	lockUpdates := true.
   182 	scrolledView scrollHorizontalToPercent:position.
   178 	scrolledView scrollHorizontalToPercent:position.
   183 	lock := false
   179 	lockUpdates := false
   184     ].
   180     ].
   185     hScrollBar scrollLeftAction:[scrolledView scrollLeft].
   181     hScrollBar scrollLeftAction:[scrolledView scrollLeft].
   186     hScrollBar scrollRightAction:[scrolledView scrollRight].
   182     hScrollBar scrollRightAction:[scrolledView scrollRight].
   187 
   183 
   188     scrolledView originChangeAction:[:aView |
   184     scrolledView addDependent:self.
   189 	lock ifFalse:[
       
   190 	    scrollBar setThumbOriginFor:aView.
       
   191 	    hScrollBar setThumbOriginFor:aView
       
   192 	]
       
   193     ].
       
   194     scrolledView contentsChangeAction:[:aView | 
       
   195 	scrollBar setThumbFor:aView.
       
   196 	hScrollBar setThumbFor:aView
       
   197     ]
       
   198 ! !
   185 ! !
   199 
   186 
   200 !HVScrollableView methodsFor:'accessing'!
   187 !HVScrollableView methodsFor:'accessing'!
   201 
   188 
   202 horizontalScrollBar
   189 horizontalScrollBar
   235 		   ]
   222 		   ]
   236     ].
   223     ].
   237     self setScrollActions
   224     self setScrollActions
   238 ! !
   225 ! !
   239 
   226 
       
   227 !HVScrollableView methodsFor:'changes '!
       
   228 
       
   229 update:something with:argument from:changedObject
       
   230     "whenever the scrolledview changes its contents, we have to
       
   231      update the scrollers too"
       
   232 
       
   233     changedObject == scrolledView ifTrue:[
       
   234 	something == #sizeOfContents ifTrue:[
       
   235 	    scrollBar setThumbFor:scrolledView.
       
   236 	    hScrollBar setThumbFor:scrolledView.
       
   237 	    ^ self
       
   238 	].
       
   239 	something == #originOfContents ifTrue:[
       
   240 	    lockUpdates ifFalse:[
       
   241 		scrollBar setThumbOriginFor:scrolledView.
       
   242 		hScrollBar setThumbOriginFor:scrolledView.
       
   243 	    ].
       
   244 	    ^ self
       
   245 	].
       
   246     ].
       
   247 ! !
       
   248 
   240 !HVScrollableView methodsFor:'event processing'!
   249 !HVScrollableView methodsFor:'event processing'!
   241 
   250 
   242 sizeChanged:how
   251 sizeChanged:how
   243     super sizeChanged:how.
   252     super sizeChanged:how.
   244     scrolledView notNil ifTrue:[
   253     scrolledView notNil ifTrue:[