ViewScroller.st
changeset 424 c66e66d82e02
parent 236 20dba8483ad7
child 425 be88918a571b
equal deleted inserted replaced
423:02727ea12a87 424:c66e66d82e02
    15 	classVariableNames:''
    15 	classVariableNames:''
    16 	poolDictionaries:''
    16 	poolDictionaries:''
    17 	category:'Views-Basic'
    17 	category:'Views-Basic'
    18 !
    18 !
    19 
    19 
    20 !ViewScroller  class methodsFor:'documentation'!
    20 !ViewScroller class methodsFor:'documentation'!
    21 
    21 
    22 copyright
    22 copyright
    23 "
    23 "
    24  COPYRIGHT (c) 1994 by Claus Gittinger
    24  COPYRIGHT (c) 1994 by Claus Gittinger
    25 	      All Rights Reserved
    25 	      All Rights Reserved
   149 "
   149 "
   150 ! !
   150 ! !
   151 
   151 
   152 !ViewScroller methodsFor:'accessing'!
   152 !ViewScroller methodsFor:'accessing'!
   153 
   153 
       
   154 scrolledView
       
   155     "return the view which is scrolled"
       
   156 
       
   157     ^ scrolledView 
       
   158 !
       
   159 
   154 scrolledView:aView
   160 scrolledView:aView
   155     "set the view to be scrolled"
   161     "set the view to be scrolled"
   156 
   162 
   157     scrolledView notNil ifTrue:[
   163     scrolledView notNil ifTrue:[
   158         self error:'can only scroll a single view'.
   164         self error:'can only scroll a single view'.
   203 !ViewScroller methodsFor:'queries-contents'!
   209 !ViewScroller methodsFor:'queries-contents'!
   204 
   210 
   205 heightOfContents
   211 heightOfContents
   206     "return my contents' height; this is the scrolledViews height"
   212     "return my contents' height; this is the scrolledViews height"
   207 
   213 
       
   214     scrolledView isNil ifTrue:[^ super heightOfContents].
   208     ^ scrolledView height
   215     ^ scrolledView height
   209 
   216 
   210     "Modified: 24.5.1996 / 17:34:48 / cg"
   217     "Modified: 24.5.1996 / 17:34:48 / cg"
   211 !
   218 !
   212 
   219 
   213 viewOrigin
   220 viewOrigin
   214     "the viewOrigin (for scrollBars) is based upon the scrolledViews origin"
   221     "the viewOrigin (for scrollBars) is based upon the scrolledViews origin"
   215 
   222 
       
   223     scrolledView isNil ifTrue:[^ 0@0].
   216     ^ scrolledView origin negated
   224     ^ scrolledView origin negated
   217 
   225 
   218     "Modified: 24.5.1996 / 17:48:13 / cg"
   226     "Modified: 24.5.1996 / 17:48:13 / cg"
   219 !
   227 !
   220 
   228 
   221 widthOfContents
   229 widthOfContents
   222     "return my contents' width; this is the scrolledViews width"
   230     "return my contents' width; this is the scrolledViews width"
   223 
   231 
       
   232     scrolledView isNil ifTrue:[^ super widthOfContents].
   224     ^ scrolledView width
   233     ^ scrolledView width
   225 
   234 
   226     "Modified: 24.5.1996 / 17:34:56 / cg"
   235     "Modified: 24.5.1996 / 17:34:56 / cg"
   227 ! !
   236 ! !
   228 
   237 
   229 !ViewScroller methodsFor:'scrolling'!
   238 !ViewScroller methodsFor:'scrolling'!
       
   239 
       
   240 horizontalScrollStep
       
   241     "return the amount by which to step-scroll horizontally"
       
   242 
       
   243     ^ self width // 2
       
   244 !
   230 
   245 
   231 scrollTo:aPoint
   246 scrollTo:aPoint
   232     "change origin of scrolledView to scroll to aPoint"
   247     "change origin of scrolledView to scroll to aPoint"
   233 
   248 
   234     |wCont hCont "{ Class:SmallInteger }"
   249     |wCont hCont "{ Class:SmallInteger }"
   235      iw ih       "{ Class:SmallInteger }"
   250      iw ih       "{ Class:SmallInteger }"
   236      viewOrigin orgX orgY newX newY|
   251      viewOrigin orgX orgY newX newY|
       
   252 
       
   253     scrolledView isNil ifTrue:[^ self].
   237 
   254 
   238     viewOrigin := scrolledView origin.
   255     viewOrigin := scrolledView origin.
   239     orgX := viewOrigin x negated.
   256     orgX := viewOrigin x negated.
   240     orgY := viewOrigin y negated.
   257     orgY := viewOrigin y negated.
   241 
   258 
   262     self originWillChange.
   279     self originWillChange.
   263     scrolledView origin:(newX negated @ newY negated).
   280     scrolledView origin:(newX negated @ newY negated).
   264     self originChanged:((newX-orgX) negated @ (newY-orgY) negated).
   281     self originChanged:((newX-orgX) negated @ (newY-orgY) negated).
   265 
   282 
   266     "Modified: 21.8.1996 / 09:17:49 / stefan"
   283     "Modified: 21.8.1996 / 09:17:49 / stefan"
   267 ! !
   284 !
   268 
   285 
   269 !ViewScroller  class methodsFor:'documentation'!
   286 verticalScrollStep
       
   287     "return the amount by which to step-scroll vertically"
       
   288 
       
   289     ^ self height // 2
       
   290 ! !
       
   291 
       
   292 !ViewScroller class methodsFor:'documentation'!
   270 
   293 
   271 version
   294 version
   272     ^ '$Header: /cvs/stx/stx/libwidg2/ViewScroller.st,v 1.10 1996-08-21 08:15:42 stefan Exp $'
   295     ^ '$Header: /cvs/stx/stx/libwidg2/ViewScroller.st,v 1.11 1997-06-17 18:55:46 ca Exp $'
   273 ! !
   296 ! !