Scroller.st
changeset 1518 6d8e1461f119
parent 1514 b819aca5ab4b
child 1531 c5f2cfee9998
--- a/Scroller.st	Tue May 12 20:49:58 1998 +0200
+++ b/Scroller.st	Tue May 12 20:59:41 1998 +0200
@@ -18,7 +18,7 @@
 		thumbHalfLightColor thumbEnteredColor thumbFrameSizeDifference
 		tallyLevel tallyMarks fixThumbHeight frameBeforeMove ghostColor
 		ghostFrameColor ghostLevel rangeStart rangeEnd rangeStep entered
-		thumbActiveLevel originBeforeMove'
+		thumbActiveLevel originBeforeMove thumbImage'
 	classVariableNames:'HandleShadowForm HandleLightForm DefaultViewBackground
 		DefaultShadowColor DefaultLightColor DefaultThumbColor
 		DefaultThumbShadowColor DefaultThumbLightColor
@@ -29,7 +29,7 @@
 		DefaultGhostColor DefaultGhostFrameColor DefaultGhostLevel
 		DefaultFixThumbHeight DefaultEdgeStyle DefaultFullViewBackground
 		DefaultThumbEnteredColor DefaultThumbActiveLevel SnapBackDistance
-		DefaultMiddleButtonJump NewCursors'
+		DefaultMiddleButtonJump NewCursors DefaultThumbImage'
 	poolDictionaries:''
 	category:'Views-Interactors'
 !
@@ -383,6 +383,7 @@
     DefaultEdgeStyle := StyleSheet at:'scroller.thumbEdgeStyle'.
     DefaultMiddleButtonJump := StyleSheet at:'scroller.middleButtonJump' default:false.
     NewCursors := StyleSheet at:'scroller.newCursors' default:true.
+    DefaultThumbImage := StyleSheet at:'scroller.thumbImage'.
 
     StyleSheet fileReadFailed ifTrue:[
         DefaultViewBackground := Grey.
@@ -397,7 +398,7 @@
      self updateStyleCache
     "
 
-    "Modified: 23.10.1997 / 04:00:44 / cg"
+    "Modified: / 12.5.1998 / 20:24:54 / cg"
 ! !
 
 !Scroller methodsFor:'accessing'!
@@ -981,6 +982,9 @@
             self paint:thumbFrameColor.
             self displayRectangle:thumbFrame.
         ].
+        thumbImage notNil ifTrue:[
+            thumbImage displayOn:self x:l y:t
+        ].
         ^ self
     ].
 
@@ -998,6 +1002,10 @@
         ]
     ].
 
+    thumbImage notNil ifTrue:[
+        thumbImage displayOn:self x:l y:t
+    ].
+
     (tallyLevel == 0 or:[tallyMarks == 0]) ifTrue:[
         shadowForm notNil ifTrue:[
             handleX := l + ((w - 8) // 2).
@@ -1081,7 +1089,7 @@
         ]
     ]
 
-    "Modified: 7.3.1997 / 17:02:50 / cg"
+    "Modified: / 12.5.1998 / 20:39:52 / cg"
 !
 
 drawThumbBackgroundInX:x y:y width:w height:h
@@ -1738,6 +1746,11 @@
         self enableEnterLeaveEvents.
     ].
 
+    DefaultThumbImage notNil ifTrue:[
+        thumbImage := DefaultThumbImage on:device.
+        fixThumbHeight := true.
+    ].
+
     nm = #next ifTrue:[
         shadowForm := self class handleShadowFormOn:device.
         lightForm := self class handleLightFormOn:device
@@ -1749,7 +1762,7 @@
         self computeThumbFrame
     ]
 
-    "Modified: / 29.10.1997 / 01:34:45 / cg"
+    "Modified: / 12.5.1998 / 20:26:21 / cg"
 !
 
 initialize
@@ -1857,6 +1870,9 @@
         "have a fix-size thumb (i.e. mswindows style)"
 
         newSize1 := sz2 - (2 * inset).   "make it square"
+        thumbImage notNil ifTrue:[
+            newSize1 := (newSize1 max:(thumbImage height)) max:(thumbImage width)
+        ].
         thumbFrameSizeDifference := newSize1 - computedSize.
     ].
 
@@ -1899,6 +1915,8 @@
         ]
     ].
     thumbFrame := Rectangle left:nx top:ny width:nw height:nh
+
+    "Modified: / 12.5.1998 / 20:58:51 / cg"
 !
 
 percentFromAbs:absValue
@@ -2083,46 +2101,30 @@
     "Modified: 19.7.1996 / 20:45:35 / cg"
 !
 
-thumbUsable
+thumbVisible
     "return true, if the thumb is usable i.e. its visible & movable.
-     Used by the scrollBar to decide if it should hide the scroller."
+     Can be used by the scrollBar to decide if it should hide the scroller."
+
+    |m2|
 
     (thumbHeight >= 100) ifTrue:[^ false].
     self computeThumbFrame.
     thumbFrame isNil ifTrue:[^ false].
 
+    m2 := margin * 2.
     orientation == #vertical ifTrue:[
-        thumbFrame height >= (height - margin - margin) ifTrue:[^ false].
+        thumbFrame height >= (height - m2) ifTrue:[^ false].
     ] ifFalse:[
-        thumbFrame width >= (width - margin - margin) ifTrue:[^ false].
+        thumbFrame width >= (width - m2) ifTrue:[^ false].
     ].
     ^ true
 
-    "Modified: 7.3.1997 / 17:23:07 / cg"
-    "Created: 7.3.1997 / 21:09:51 / cg"
-!
-
-thumbVisible
-    "return true, if the thumb is usable i.e. its visible & movable.
-     Can be used by the scrollBar to decide if it should hide the scroller."
-
-    (thumbHeight >= 100) ifTrue:[^ false].
-    self computeThumbFrame.
-    thumbFrame isNil ifTrue:[^ false].
-
-    orientation == #vertical ifTrue:[
-        thumbFrame height >= (height - margin - margin) ifTrue:[^ false].
-    ] ifFalse:[
-        thumbFrame width >= (width - margin - margin) ifTrue:[^ false].
-    ].
-    ^ true
-
-    "Modified: 7.3.1997 / 17:23:07 / cg"
-    "Created: 7.3.1997 / 21:10:23 / cg"
+    "Created: / 7.3.1997 / 21:10:23 / cg"
+    "Modified: / 12.5.1998 / 20:21:00 / cg"
 ! !
 
 !Scroller class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libwidg/Scroller.st,v 1.103 1998-05-07 17:41:44 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libwidg/Scroller.st,v 1.104 1998-05-12 18:59:41 cg Exp $'
 ! !