ViewScroller.st
changeset 3326 250f9f98b407
parent 3261 7f60ff4c779b
child 3329 52882e077d23
equal deleted inserted replaced
3325:8d2a6394f01a 3326:250f9f98b407
   237 
   237 
   238 scrolledView
   238 scrolledView
   239     "return the view which is scrolled"
   239     "return the view which is scrolled"
   240 
   240 
   241     ^ scrolledView 
   241     ^ scrolledView 
   242 !
       
   243 
       
   244 scrolledView:aView
       
   245     "set a new scolled view; dependent on the #keepViewsChannel
       
   246      the old scolled view will be destroyed or unmapped."
       
   247 
       
   248     scrolledView ~~ aView ifTrue:[
       
   249         scrolledView ifNotNil:[
       
   250             self keepViews ifTrue:[ scrolledView beInvisible ]
       
   251                           ifFalse:[ scrolledView destroy ].
       
   252         ].
       
   253         scrolledView := aView.
       
   254 
       
   255         "test whether new scrolled view not nil and
       
   256          not already added to my subViews.
       
   257         "
       
   258         (scrolledView notNil and:[scrolledView superView ~~ frame]) ifTrue:[
       
   259             |extent|
       
   260 
       
   261             scrolledView borderWidth:0; level:0.
       
   262             extent := scrolledView preferredExtent.
       
   263             frame addSubView:scrolledView.
       
   264 
       
   265             "/ test whether the new view is a scrollWrapper.
       
   266             "/ in this case scrolling can be done by this view
       
   267 
       
   268             scrolledView isScrollWrapper ifTrue:[
       
   269                 scrolledView isHorizontalScrollable ifTrue:[ extent x:1.0 ].     
       
   270                 scrolledView isVerticalScrollable   ifTrue:[ extent y:1.0 ].
       
   271             ].
       
   272 
       
   273             resizeScrolledViewHorizontal ifTrue:[ extent x:1.0 ].
       
   274             resizeScrolledViewVertical   ifTrue:[ extent y:1.0 ].
       
   275 
       
   276             scrolledView extent:extent.
       
   277         ].
       
   278 
       
   279         realized ifTrue:[
       
   280             scrolledView ifNotNil:[scrolledView beVisible].
       
   281             self sizeChanged:nil.
       
   282         ].
       
   283     ].
       
   284     model value:scrolledView.
       
   285 !
   242 !
   286 
   243 
   287 scrolledViews
   244 scrolledViews
   288     "Returns the collection of all scrolled views including the current scrolled view
   245     "Returns the collection of all scrolled views including the current scrolled view
   289      and all unmapped scrolled views."
   246      and all unmapped scrolled views."
   482 
   439 
   483     model := nil asValue.
   440     model := nil asValue.
   484     model addDependent:self.
   441     model addDependent:self.
   485 !
   442 !
   486 
   443 
       
   444 realize
       
   445     super realize.
       
   446     self sensor addEventListener:self.
       
   447 
       
   448 !
       
   449 
   487 release
   450 release
   488     "release all dependencies"
   451     "release all dependencies"
   489 
   452 
   490     keepViewsChannel removeDependent:self.
   453     keepViewsChannel removeDependent:self.
   491     model            removeDependent:self.
   454     model            removeDependent:self.
   580 ! !
   543 ! !
   581 
   544 
   582 !ViewScroller class methodsFor:'documentation'!
   545 !ViewScroller class methodsFor:'documentation'!
   583 
   546 
   584 version
   547 version
   585     ^ '$Header: /cvs/stx/stx/libwidg2/ViewScroller.st,v 1.25 2007-10-23 14:27:31 ca Exp $'
   548     ^ '$Header: /cvs/stx/stx/libwidg2/ViewScroller.st,v 1.26 2008-02-04 10:36:53 cg Exp $'
   586 ! !
   549 ! !