class: ViewScroller
authorClaus Gittinger <cg@exept.de>
Wed, 07 May 2014 17:54:53 +0200
changeset 4580 539edf955fd6
parent 4579 273356d6578d
child 4581 50af0a2b4e42
class: ViewScroller comment/format in: #repositionScrolledView #resizeScrolledViewHorizontal: changed: #resizeScrolledView #resizeScrolledViewVertical: #sizeChanged: adjustments to support fix in subcanvas
ViewScroller.st
--- a/ViewScroller.st	Wed May 07 17:54:23 2014 +0200
+++ b/ViewScroller.st	Wed May 07 17:54:53 2014 +0200
@@ -227,16 +227,31 @@
     ^ resizeScrolledViewHorizontal
 !
 
-resizeScrolledViewHorizontal:something
-    resizeScrolledViewHorizontal := something.
+resizeScrolledViewHorizontal:aBoolean
+    "if true, the scrolled view is actually NOT scrolled horizontally,
+     but instead always resized to fit.
+     Set this, if only vertical scrollability is wanted (i.e. the view
+     itself does adjust its size horizontally (for example, in a settings dialog,
+     the subcanvas to be enbedded has a horizontal panel, taking all of the space)"
+
+    resizeScrolledViewHorizontal := aBoolean.
 !
 
 resizeScrolledViewVertical
     ^ resizeScrolledViewVertical
 !
 
-resizeScrolledViewVertical:something
-    resizeScrolledViewVertical := something.
+resizeScrolledViewVertical:aBoolean
+    "if true, the scrolled view is actually NOT scrolled vertically,
+     but instead always resized to fit.
+     Set this, if only horizontal scrollability is wanted (i.e. the view
+     itself does adjust its size vertically (for example, in a settings dialog,
+     the subcanvas to be enbedded has a vertical panel, taking all of the space)"
+
+    resizeScrolledViewVertical := aBoolean.
+    scrolledView notNil ifTrue:[
+        self resizeScrolledView
+    ].
 !
 
 scrolledView
@@ -374,7 +389,7 @@
 !ViewScroller methodsFor:'change & update'!
 
 resizeScrolledView
-    "forces a recomputation of the scrolled views size"
+    "forces a recomputation of the scrolled view's size"
 
     |oldExtent newExtent xIsRelative yIsRelative|
 
@@ -407,12 +422,12 @@
         newExtent y:1.0.
         oldExtent y:1.0.
     ].
-    oldExtent ~= newExtent ifTrue:[
+    true "oldExtent ~= newExtent" ifTrue:[
         scrolledView extent:newExtent.
 
-        realized ifTrue:[
-            self sizeChanged:nil.
-        ].
+"/        realized ifTrue:[
+"/            self sizeChanged:nil.
+"/        ].
     ].
 !
 
@@ -507,6 +522,8 @@
 
     |newOrigin|
 
+    "/ self resizeScrolledView.
+
     "
      if we are beyond the end, scroll up a bit
     "
@@ -538,6 +555,7 @@
     self changed:#sizeOfContents.        "update possible scrollers"
 
     self repositionScrolledView.
+    self resizeScrolledView
 ! !
 
 !ViewScroller methodsFor:'focus handling'!
@@ -673,10 +691,10 @@
 !ViewScroller class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libwidg2/ViewScroller.st,v 1.43 2014-03-18 15:42:21 stefan Exp $'
+    ^ '$Header: /cvs/stx/stx/libwidg2/ViewScroller.st,v 1.44 2014-05-07 15:54:53 cg Exp $'
 !
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libwidg2/ViewScroller.st,v 1.43 2014-03-18 15:42:21 stefan Exp $'
+    ^ '$Header: /cvs/stx/stx/libwidg2/ViewScroller.st,v 1.44 2014-05-07 15:54:53 cg Exp $'
 ! !