use common code for H/V miniScrollers
authorClaus Gittinger <cg@exept.de>
Wed, 17 Apr 1996 14:06:50 +0200
changeset 539 c7c5585e77f6
parent 538 b747ea31b972
child 540 2b42317ed02e
use common code for H/V miniScrollers
HMiniScr.st
HorizontalMiniScroller.st
MiniScr.st
MiniScroller.st
--- a/HMiniScr.st	Wed Apr 17 14:06:06 1996 +0200
+++ b/HMiniScr.st	Wed Apr 17 14:06:50 1996 +0200
@@ -10,11 +10,11 @@
  hereby transferred.
 "
 
-HorizontalScroller subclass:#HorizontalMiniScroller
-	 instanceVariableNames:''
-	 classVariableNames:''
-	 poolDictionaries:''
-	 category:'Views-Interactors'
+MiniScroller subclass:#HorizontalMiniScroller
+	instanceVariableNames:''
+	classVariableNames:''
+	poolDictionaries:''
+	category:'Views-Interactors'
 !
 
 !HorizontalMiniScroller class methodsFor:'documentation'!
@@ -39,47 +39,33 @@
 "
 ! !
 
+!HorizontalMiniScroller methodsFor:'accessing-behavior'!
+
+scrollLeftAction:aBlock
+    "ignored -
+     but implemented, so that scroller can be used in place of a scrollbar"
+
+    "Created: 17.4.1996 / 14:04:29 / cg"
+!
+
+scrollRightAction:aBlock
+    "ignored -
+     but implemented, so that scroller can be used in place of a scrollbar"
+
+    "Created: 17.4.1996 / 14:04:30 / cg"
+! !
+
 !HorizontalMiniScroller methodsFor:'initialization'!
 
-initStyle
-    |style lvl|
+initialize
+    super initialize.
+    orientation := #horizontal
 
-    super initStyle.
-    style := styleSheet name.
-    style == #iris ifTrue:[
-	tallyLevel := 0.
-	tallyMarks := 0.
-	thumbEdgeStyle := nil.
-	thumbLevel := 2.
-    ].
-    ((style ~~ #normal) and:[style ~~ #mswindows]) ifTrue:[
-	style == #st80 ifTrue:[
-	    lvl := inset := 1.
-	] ifFalse:[
-	    lvl := -1.
-	].
-	self level:lvl.
-	self borderWidth:0
-    ].
-    shadowForm := lightForm := nil.
-    fixThumbHeight := false
-! !
-
-!HorizontalMiniScroller methodsFor:'queries'!
-
-preferredExtent
-    "make my height very small"
-
-    |w h mm|
-
-    w := self class defaultExtent x.
-    mm := (thumbLevel ~~ 0) ifTrue:[2.5] ifFalse:[2.0].
-    h := (device verticalPixelPerMillimeter asFloat * mm) rounded.
-    ^ w @ h.
+    "Created: 17.4.1996 / 14:01:26 / cg"
 ! !
 
 !HorizontalMiniScroller class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libwidg/Attic/HMiniScr.st,v 1.6 1995-11-23 18:18:53 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libwidg/Attic/HMiniScr.st,v 1.7 1996-04-17 12:06:50 cg Exp $'
 ! !
--- a/HorizontalMiniScroller.st	Wed Apr 17 14:06:06 1996 +0200
+++ b/HorizontalMiniScroller.st	Wed Apr 17 14:06:50 1996 +0200
@@ -10,11 +10,11 @@
  hereby transferred.
 "
 
-HorizontalScroller subclass:#HorizontalMiniScroller
-	 instanceVariableNames:''
-	 classVariableNames:''
-	 poolDictionaries:''
-	 category:'Views-Interactors'
+MiniScroller subclass:#HorizontalMiniScroller
+	instanceVariableNames:''
+	classVariableNames:''
+	poolDictionaries:''
+	category:'Views-Interactors'
 !
 
 !HorizontalMiniScroller class methodsFor:'documentation'!
@@ -39,47 +39,33 @@
 "
 ! !
 
+!HorizontalMiniScroller methodsFor:'accessing-behavior'!
+
+scrollLeftAction:aBlock
+    "ignored -
+     but implemented, so that scroller can be used in place of a scrollbar"
+
+    "Created: 17.4.1996 / 14:04:29 / cg"
+!
+
+scrollRightAction:aBlock
+    "ignored -
+     but implemented, so that scroller can be used in place of a scrollbar"
+
+    "Created: 17.4.1996 / 14:04:30 / cg"
+! !
+
 !HorizontalMiniScroller methodsFor:'initialization'!
 
-initStyle
-    |style lvl|
+initialize
+    super initialize.
+    orientation := #horizontal
 
-    super initStyle.
-    style := styleSheet name.
-    style == #iris ifTrue:[
-	tallyLevel := 0.
-	tallyMarks := 0.
-	thumbEdgeStyle := nil.
-	thumbLevel := 2.
-    ].
-    ((style ~~ #normal) and:[style ~~ #mswindows]) ifTrue:[
-	style == #st80 ifTrue:[
-	    lvl := inset := 1.
-	] ifFalse:[
-	    lvl := -1.
-	].
-	self level:lvl.
-	self borderWidth:0
-    ].
-    shadowForm := lightForm := nil.
-    fixThumbHeight := false
-! !
-
-!HorizontalMiniScroller methodsFor:'queries'!
-
-preferredExtent
-    "make my height very small"
-
-    |w h mm|
-
-    w := self class defaultExtent x.
-    mm := (thumbLevel ~~ 0) ifTrue:[2.5] ifFalse:[2.0].
-    h := (device verticalPixelPerMillimeter asFloat * mm) rounded.
-    ^ w @ h.
+    "Created: 17.4.1996 / 14:01:26 / cg"
 ! !
 
 !HorizontalMiniScroller class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libwidg/HorizontalMiniScroller.st,v 1.6 1995-11-23 18:18:53 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libwidg/HorizontalMiniScroller.st,v 1.7 1996-04-17 12:06:50 cg Exp $'
 ! !
--- a/MiniScr.st	Wed Apr 17 14:06:06 1996 +0200
+++ b/MiniScr.st	Wed Apr 17 14:06:50 1996 +0200
@@ -11,10 +11,10 @@
 "
 
 Scroller subclass:#MiniScroller
-	 instanceVariableNames:''
-	 classVariableNames:''
-	 poolDictionaries:''
-	 category:'Views-Interactors'
+	instanceVariableNames:''
+	classVariableNames:''
+	poolDictionaries:''
+	category:'Views-Interactors'
 !
 
 !MiniScroller class methodsFor:'documentation'!
@@ -47,22 +47,23 @@
     super initStyle.
     style := StyleSheet name.
     style == #iris ifTrue:[
-	tallyLevel := 0.
-	tallyMarks := 0.
-	thumbEdgeStyle := nil.
-	thumbLevel := 2.
+        tallyLevel := tallyMarks := 0.
+        thumbEdgeStyle := nil.
+        thumbLevel := thumbActiveLevel := 2.
     ].
     ((style ~~ #normal) and:[style ~~ #mswindows]) ifTrue:[
-	style == #st80 ifTrue:[
-	    lvl := 1.
-	] ifFalse:[
-	    lvl := -1.
-	].
-	self level:lvl.
-	self borderWidth:0
+        style == #st80 ifTrue:[
+            lvl := 1.
+        ] ifFalse:[
+            lvl := -1.
+        ].
+        self level:lvl.
+        self borderWidth:0
     ].
     shadowForm := lightForm := nil.
     fixThumbHeight := false
+
+    "Modified: 17.4.1996 / 13:57:20 / cg"
 ! !
 
 !MiniScroller methodsFor:'queries'!
@@ -70,16 +71,24 @@
 preferredExtent
     "make my width very small"
 
-    |w h mm|
+    |defExt w h mm|
 
-    h := self class defaultExtent y.
+    defExt := self class defaultExtent.
     mm := (thumbLevel ~~ 0) ifTrue:[2.5] ifFalse:[2.0].
-    w := (device horizontalPixelPerMillimeter asFloat * mm) rounded.
+    orientation == #vertical ifTrue:[
+        h := defExt y.
+        w := (device horizontalPixelPerMillimeter asFloat * mm) rounded.
+    ] ifFalse:[
+        w := defExt x.
+        h := (device verticalPixelPerMillimeter asFloat * mm) rounded.
+    ].
     ^ w @ h.
+
+    "Modified: 17.4.1996 / 14:02:43 / cg"
 ! !
 
 !MiniScroller class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libwidg/Attic/MiniScr.st,v 1.6 1995-11-23 18:18:30 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libwidg/Attic/MiniScr.st,v 1.7 1996-04-17 12:06:32 cg Exp $'
 ! !
--- a/MiniScroller.st	Wed Apr 17 14:06:06 1996 +0200
+++ b/MiniScroller.st	Wed Apr 17 14:06:50 1996 +0200
@@ -11,10 +11,10 @@
 "
 
 Scroller subclass:#MiniScroller
-	 instanceVariableNames:''
-	 classVariableNames:''
-	 poolDictionaries:''
-	 category:'Views-Interactors'
+	instanceVariableNames:''
+	classVariableNames:''
+	poolDictionaries:''
+	category:'Views-Interactors'
 !
 
 !MiniScroller class methodsFor:'documentation'!
@@ -47,22 +47,23 @@
     super initStyle.
     style := StyleSheet name.
     style == #iris ifTrue:[
-	tallyLevel := 0.
-	tallyMarks := 0.
-	thumbEdgeStyle := nil.
-	thumbLevel := 2.
+        tallyLevel := tallyMarks := 0.
+        thumbEdgeStyle := nil.
+        thumbLevel := thumbActiveLevel := 2.
     ].
     ((style ~~ #normal) and:[style ~~ #mswindows]) ifTrue:[
-	style == #st80 ifTrue:[
-	    lvl := 1.
-	] ifFalse:[
-	    lvl := -1.
-	].
-	self level:lvl.
-	self borderWidth:0
+        style == #st80 ifTrue:[
+            lvl := 1.
+        ] ifFalse:[
+            lvl := -1.
+        ].
+        self level:lvl.
+        self borderWidth:0
     ].
     shadowForm := lightForm := nil.
     fixThumbHeight := false
+
+    "Modified: 17.4.1996 / 13:57:20 / cg"
 ! !
 
 !MiniScroller methodsFor:'queries'!
@@ -70,16 +71,24 @@
 preferredExtent
     "make my width very small"
 
-    |w h mm|
+    |defExt w h mm|
 
-    h := self class defaultExtent y.
+    defExt := self class defaultExtent.
     mm := (thumbLevel ~~ 0) ifTrue:[2.5] ifFalse:[2.0].
-    w := (device horizontalPixelPerMillimeter asFloat * mm) rounded.
+    orientation == #vertical ifTrue:[
+        h := defExt y.
+        w := (device horizontalPixelPerMillimeter asFloat * mm) rounded.
+    ] ifFalse:[
+        w := defExt x.
+        h := (device verticalPixelPerMillimeter asFloat * mm) rounded.
+    ].
     ^ w @ h.
+
+    "Modified: 17.4.1996 / 14:02:43 / cg"
 ! !
 
 !MiniScroller class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libwidg/MiniScroller.st,v 1.6 1995-11-23 18:18:30 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libwidg/MiniScroller.st,v 1.7 1996-04-17 12:06:32 cg Exp $'
 ! !