HorizontalScroller.st
changeset 38 4b9b70b2cc87
parent 24 966098a893f8
child 118 3ee5ea99d0e2
--- a/HorizontalScroller.st	Sun Aug 07 15:22:53 1994 +0200
+++ b/HorizontalScroller.st	Sun Aug 07 15:23:42 1994 +0200
@@ -24,7 +24,7 @@
 
 the scroller part of a horizontal scrollbar
 
-$Header: /cvs/stx/stx/libwidg/HorizontalScroller.st,v 1.4 1994-01-13 00:16:13 claus Exp $
+$Header: /cvs/stx/stx/libwidg/HorizontalScroller.st,v 1.5 1994-08-07 13:22:36 claus Exp $
 written spring/summer 89 by claus
 '!
 
@@ -56,13 +56,18 @@
         ]
     ].
     (realNewOrigin = thumbOrigin) ifFalse:[
-        oldFrame := thumbFrame.
         thumbOrigin := realNewOrigin.
-        self computeThumbFrame.
-        (thumbHeight = 100) ifTrue:[^ self].
 
         shown ifTrue:[
+            oldFrame := thumbFrame.
+            self computeThumbFrame.
+            (thumbHeight = 100) ifTrue:[^ self].
+
             (thumbFrame ~~ oldFrame) ifTrue:[
+                oldFrame isNil ifTrue:[
+                    self drawThumb.
+                    ^ self
+                ].
                 tH := thumbFrame height.
                 tW := thumbFrame width.
                 oldLeft := oldFrame left.
@@ -81,12 +86,11 @@
                     ^ self
                 ].
 
+                self catchExpose.
                 self copyFrom:self x:oldLeft y:top
                                  toX:thumbLeft y:top
                                width:tW height:tH.
 
-                self catchExpose.
-
                 oldLeft > thumbLeft ifTrue:[
                     delta := oldLeft - thumbLeft.
                     oldLeft > thumbRight ifTrue:[
@@ -112,58 +116,12 @@
     ]
 !
 
-setThumbFor:aView
-    "get contents and size info from aView and adjust thumb"
-
-    |percentHeight percentOrigin totalWidth|
-
-    aView isNil ifTrue:[
-        totalWidth := 0
-    ] ifFalse:[
-        totalWidth := aView widthOfContents
-    ].
-    (totalWidth = 0) ifTrue:[
-        percentHeight := 100.
-        percentOrigin := 100
-    ] ifFalse:[
-        percentHeight := (aView innerWidth) * 100 // totalWidth.
-        percentOrigin := (aView xOriginOfContents) * 100 // totalWidth
-    ].
-    (percentHeight = thumbHeight) ifTrue:[
-        self thumbOrigin:percentOrigin
-    ] ifFalse:[
-        (percentOrigin = thumbOrigin) ifTrue:[
-            self thumbHeight:percentHeight
-        ] ifFalse:[
-            self thumbOrigin:percentOrigin thumbHeight:percentHeight
-        ]
-    ]
+scrollLeftAction:aBlock
+    "ignored -
+     but implemented, so that scroller can be used in place of a scrollbar"
 !
 
-setThumbHeightFor:aView
-    "get contents and size info from aView and adjust thumb height"
-
-    |percent totalWidth|
-
-    totalWidth := aView widthOfContents.
-    (totalWidth = 0) ifTrue:[
-        percent := 100
-    ] ifFalse:[
-        percent := (aView innerWidth) * 100 // totalWidth
-    ].
-    self thumbHeight:percent
-!
-
-setThumbOriginFor:aView
-    "get contents and size info from aView and adjust thumb origin"
-
-    |percent totalWidth|
-
-    totalWidth := aView widthOfContents.
-    (totalWidth = 0) ifTrue:[
-        percent := 100
-    ] ifFalse:[
-        percent := (aView xOriginOfContents) * 100 // totalWidth
-    ].
-    self thumbOrigin:percent
+scrollRightAction:aBlock
+    "ignored -
+     but implemented, so that scroller can be used in place of a scrollbar"
 ! !