use common code for H/V scrollers
authorClaus Gittinger <cg@exept.de>
Wed, 17 Apr 1996 14:06:06 +0200
changeset 538 b747ea31b972
parent 537 21fc632b22fe
child 539 c7c5585e77f6
use common code for H/V scrollers
HScroller.st
HorizontalScroller.st
Scroller.st
--- a/HScroller.st	Tue Apr 16 20:48:22 1996 +0200
+++ b/HScroller.st	Wed Apr 17 14:06:06 1996 +0200
@@ -11,10 +11,10 @@
 "
 
 Scroller subclass:#HorizontalScroller
-	 instanceVariableNames:''
-	 classVariableNames:''
-	 poolDictionaries:''
-	 category:'Views-Interactors'
+	instanceVariableNames:''
+	classVariableNames:''
+	poolDictionaries:''
+	category:'Views-Interactors'
 !
 
 !HorizontalScroller class methodsFor:'documentation'!
@@ -59,18 +59,8 @@
     orientation := #horizontal 
 ! !
 
-!HorizontalScroller methodsFor:'queries'!
-
-preferredExtent
-    |w h|
-
-    w := self class defaultExtent x.
-    h := (device verticalPixelPerMillimeter asFloat * 6) rounded.
-    ^ w @ h.
-! !
-
 !HorizontalScroller class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libwidg/Attic/HScroller.st,v 1.12 1995-11-23 18:18:00 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libwidg/Attic/HScroller.st,v 1.13 1996-04-17 12:06:06 cg Exp $'
 ! !
--- a/HorizontalScroller.st	Tue Apr 16 20:48:22 1996 +0200
+++ b/HorizontalScroller.st	Wed Apr 17 14:06:06 1996 +0200
@@ -11,10 +11,10 @@
 "
 
 Scroller subclass:#HorizontalScroller
-	 instanceVariableNames:''
-	 classVariableNames:''
-	 poolDictionaries:''
-	 category:'Views-Interactors'
+	instanceVariableNames:''
+	classVariableNames:''
+	poolDictionaries:''
+	category:'Views-Interactors'
 !
 
 !HorizontalScroller class methodsFor:'documentation'!
@@ -59,18 +59,8 @@
     orientation := #horizontal 
 ! !
 
-!HorizontalScroller methodsFor:'queries'!
-
-preferredExtent
-    |w h|
-
-    w := self class defaultExtent x.
-    h := (device verticalPixelPerMillimeter asFloat * 6) rounded.
-    ^ w @ h.
-! !
-
 !HorizontalScroller class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libwidg/HorizontalScroller.st,v 1.12 1995-11-23 18:18:00 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libwidg/HorizontalScroller.st,v 1.13 1996-04-17 12:06:06 cg Exp $'
 ! !
--- a/Scroller.st	Tue Apr 16 20:48:22 1996 +0200
+++ b/Scroller.st	Wed Apr 17 14:06:06 1996 +0200
@@ -1693,15 +1693,25 @@
 !Scroller methodsFor:'queries'!
 
 preferredExtent
-    |w h|
+    |defExt w h|
+
+    defExt := self class defaultExtent.
 
-    h := self class defaultExtent y.
-    w := (device horizontalPixelPerMillimeter asFloat * 6) rounded.
+    orientation == #vertical ifTrue:[
+        h := defExt y.
+        w := (device horizontalPixelPerMillimeter asFloat * 6) rounded.
+    ] ifFalse:[
+        w := defExt x.
+        h := (device verticalPixelPerMillimeter asFloat * 6) rounded.
+    ].
+
     ^ w @ h.
+
+    "Modified: 17.4.1996 / 14:00:58 / cg"
 ! !
 
 !Scroller class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libwidg/Scroller.st,v 1.43 1996-03-20 15:27:20 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libwidg/Scroller.st,v 1.44 1996-04-17 12:05:38 cg Exp $'
 ! !