added thumbActiveLevel styleSheet variable
authorClaus Gittinger <cg@exept.de>
Wed, 20 Mar 1996 11:06:27 +0100
changeset 505 e13ee348dcc4
parent 504 36599ce06054
child 506 3273d75c3526
added thumbActiveLevel styleSheet variable
Scroller.st
--- a/Scroller.st	Mon Mar 18 17:33:10 1996 +0100
+++ b/Scroller.st	Wed Mar 20 11:06:27 1996 +0100
@@ -17,7 +17,8 @@
 		thumbLightColor thumbEdgeStyle thumbHalfShadowColor
 		thumbHalfLightColor thumbEnteredColor thumbFrameSizeDifference
 		tallyLevel tallyMarks fixThumbHeight frameBeforeMove ghostColor
-		ghostFrameColor ghostLevel rangeStart rangeEnd rangeStep entered'
+		ghostFrameColor ghostLevel rangeStart rangeEnd rangeStep entered
+		thumbActiveLevel'
 	classVariableNames:'HandleShadowForm HandleLightForm DefaultViewBackground
 		DefaultShadowColor DefaultLightColor DefaultThumbColor
 		DefaultThumbShadowColor DefaultThumbLightColor
@@ -27,7 +28,7 @@
 		DefaultThumbLevel DefaultInset DefaultThumbFrameColor
 		DefaultGhostColor DefaultGhostFrameColor DefaultGhostLevel
 		DefaultFixThumbHeight DefaultEdgeStyle DefaultFullViewBackground
-		DefaultThumbEnteredColor'
+		DefaultThumbEnteredColor DefaultThumbActiveLevel'
 	poolDictionaries:''
 	category:'Views-Interactors'
 !
@@ -329,7 +330,8 @@
                        #scrollerNTallyMarks #scrollerTallyLevel
                        #scrollerLevel #scrollerBorderWidth
                        #scrollerThumbLevel #scrollerThumbInset
-                       #scrollerThumbFixHeight #scrollerThumbEdgeStyle)>
+                       #scrollerThumbFixHeight #scrollerThumbEdgeStyle
+                       #scrollerThumbEnteredColor #scrollerThumbActiveLevel )>
 
     DefaultViewBackground := StyleSheet colorAt:'scrollerViewBackground'.
     DefaultFullViewBackground := StyleSheet colorAt:'scrollerFullViewBackground'.
@@ -351,6 +353,7 @@
         DefaultTallyLevel := StyleSheet at:'scrollerTallyLevel' default:1.
     ].
     DefaultLevel := StyleSheet at:'scrollerLevel' default:0.
+    DefaultThumbActiveLevel := StyleSheet at:'scrollerThumbActiveLevel' default:DefaultLevel.
     DefaultBorderWidth := StyleSheet at:'scrollerBorderWidth' default:(StyleSheet at:'borderWidth').
     DefaultThumbLevel := StyleSheet at:'scrollerThumbLevel' default:0.
     DefaultInset := StyleSheet at:'scrollerThumbInset' default:0.
@@ -364,7 +367,7 @@
         DefaultInset := 1.
     ]
 
-    "Modified: 6.3.1996 / 17:22:25 / cg"
+    "Modified: 20.3.1996 / 10:44:05 / cg"
 ! !
 
 !Scroller methodsFor:'accessing'!
@@ -793,7 +796,7 @@
 drawThumb
     "draw the thumb"
 
-    |handleX handleY l t 
+    |handleX handleY l t lvl
      w "{ Class: SmallInteger }"
      h "{ Class: SmallInteger }"
      x "{ Class: SmallInteger }"
@@ -815,7 +818,12 @@
     self paint:(entered ifTrue:[thumbEnteredColor] ifFalse:[thumbColor]).
     self fillRectangleX:l y:t width:w-1 height:h.
 
-    thumbLevel == 0 ifTrue:[
+    lvl := thumbLevel.
+    scrolling ifTrue:[
+        lvl := thumbActiveLevel
+    ].
+
+    lvl == 0 ifTrue:[
         thumbFrameColor notNil ifTrue:[
             self paint:thumbFrameColor.
             self displayRectangle:thumbFrame.
@@ -824,7 +832,7 @@
     ].
 
     "what a kludge - must be a parameter to drawEdge..."
-    self drawEdgesForX:l y:t width:w height:h level:thumbLevel
+    self drawEdgesForX:l y:t width:w height:h level:lvl
                 shadow:thumbShadowColor light:thumbLightColor
                 halfShadow:thumbHalfShadowColor halfLight:thumbHalfLightColor
                 style:thumbEdgeStyle.
@@ -862,8 +870,8 @@
     (orientation == #vertical) ifTrue:[
         self paint:color1.
         y := t + (h // 2) - 1.
-        xL := l + thumbLevel - 1.
-        xR := l + w - thumbLevel "+ 1".
+        xL := l + lvl - 1.
+        xR := l + w - lvl "+ 1".
         self displayLineFromX:xL y:y toX:xR y:y.
         y := y + 1.
         self paint:color2.
@@ -891,8 +899,8 @@
         ]
     ] ifFalse:[
         x := l + (w // 2) - 1.
-        yT := t + thumbLevel - 1.
-        yB := t + h - thumbLevel "+ 1".
+        yT := t + lvl - 1.
+        yB := t + h - lvl "+ 1".
         self paint:color1.
         self displayLineFromX:x y:yT toX:x y:yB.
         self paint:color2.
@@ -921,7 +929,7 @@
         ]
     ]
 
-    "Modified: 6.3.1996 / 17:27:43 / cg"
+    "Modified: 20.3.1996 / 10:55:29 / cg"
 !
 
 drawThumbBackgroundInX:x y:y width:w height:h
@@ -1052,30 +1060,40 @@
     "mouse-button was released - if scroll-mode is asynchronous, the scroll
      action is now performed"
 
-    |rect|
+    |rect mustDrawThumb|
 
     scrolling ifTrue:[
-	thumbFrame notNil ifTrue:[
-	    frameBeforeMove notNil ifTrue:[
-		rect := frameBeforeMove.
-		frameBeforeMove := nil.
-		self drawThumbBackgroundInX:rect left
-					  y:rect top
-				      width:rect width 
-				     height:rect height.
-		(rect intersects:thumbFrame) ifTrue:[
-		    self drawThumb
-		]
-	    ].
+        thumbFrame notNil ifTrue:[
+            mustDrawThumb := false.
+            scrolling := false.
+
+            frameBeforeMove notNil ifTrue:[
+                rect := frameBeforeMove.
+                frameBeforeMove := nil.
+                self drawThumbBackgroundInX:rect left
+                                          y:rect top
+                                      width:rect width 
+                                     height:rect height.
 
-	    scrolling := false.
-	    synchronousOperation ifFalse: [
-		self tellOthers.
-	    ]
-	]
+                (rect intersects:thumbFrame) ifTrue:[
+                    mustDrawThumb := true.
+                ]
+            ].
+            thumbLevel ~~ thumbActiveLevel ifTrue:[
+                mustDrawThumb := true
+            ].
+            mustDrawThumb ifTrue:[
+                self drawThumb
+            ].    
+
+"/            scrolling := false.
+            synchronousOperation ifFalse: [
+                self tellOthers.
+            ]
+        ]
     ]
 
-    "Modified: 23.12.1995 / 12:42:25 / cg"
+    "Modified: 20.3.1996 / 10:58:25 / cg"
 !
 
 buttonShiftPress:button x:x y:y
@@ -1124,16 +1142,18 @@
 
     |in|
 
-    thumbColor ~~ thumbEnteredColor ifTrue: [
-        in := thumbFrame containsPoint:(x@y).
-        in ~~ entered ifTrue:[
-            entered := in.
+    in := thumbFrame containsPoint:(x@y).
+    (in ~~ entered 
+    or:[thumbLevel ~~ thumbActiveLevel]) ifTrue:[
+        entered := in.
+        (thumbColor ~~ thumbEnteredColor 
+        or:[thumbLevel ~~ thumbActiveLevel]) ifTrue: [
             self drawThumb
         ].
     ].
 
     "Created: 6.3.1996 / 17:35:07 / cg"
-    "Modified: 6.3.1996 / 17:36:46 / cg"
+    "Modified: 20.3.1996 / 10:59:59 / cg"
 !
 
 pointerLeave:state
@@ -1284,6 +1304,7 @@
         self borderWidth:DefaultBorderWidth.
     ].
     thumbLevel := DefaultThumbLevel.
+    thumbActiveLevel := DefaultThumbActiveLevel.
     inset := DefaultInset.
     fixThumbHeight := DefaultFixThumbHeight.
     thumbEdgeStyle := DefaultEdgeStyle.
@@ -1384,7 +1405,7 @@
         self computeThumbFrame
     ]
 
-    "Modified: 6.3.1996 / 17:31:35 / cg"
+    "Modified: 20.3.1996 / 10:48:54 / cg"
 !
 
 initialize
@@ -1682,5 +1703,5 @@
 !Scroller class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libwidg/Scroller.st,v 1.41 1996-03-06 17:03:26 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libwidg/Scroller.st,v 1.42 1996-03-20 10:06:27 cg Exp $'
 ! !