made orientation an instVar
authorClaus Gittinger <cg@exept.de>
Wed, 07 Jul 1999 20:52:57 +0200
changeset 1950 4c19ae381920
parent 1949 f8a1dfee9935
child 1951 85859664005c
made orientation an instVar
ScrollBar.st
--- a/ScrollBar.st	Wed Jul 07 14:18:37 1999 +0200
+++ b/ScrollBar.st	Wed Jul 07 20:52:57 1999 +0200
@@ -11,7 +11,7 @@
 "
 
 SimpleView subclass:#ScrollBar
-	instanceVariableNames:'thumb button1 button2 buttonLayout elementSpacing'
+	instanceVariableNames:'thumb button1 button2 buttonLayout elementSpacing orientation'
 	classVariableNames:'DefaultButtonPositions DefaultLevel DefaultElementSpacing
 		DefaultScrollerBordered DefaultHScrollBarHeight
 		DefaultVScrollBarWidth'
@@ -288,6 +288,18 @@
 
 !ScrollBar methodsFor:'accessing-look'!
 
+orientation
+    "for ST-80 compatibility, answer this query"
+
+    ^ orientation
+!
+
+orientation:aSymbol
+    "set the orientation; either #horizontal or #vertical"
+
+    orientation := aSymbol
+!
+
 thumbColor:aColor
     "set the thumbs color"
 
@@ -398,7 +410,7 @@
     b2WasHidden := button2 realized not.
     thumbWasHidden := thumb realized not.
 
-    (isHorizontal := (self orientation == #horizontal)) ifTrue:[
+    (isHorizontal := (orientation == #horizontal)) ifTrue:[
         leftWidth := button1 width + bw.
         rightWidth := button2 width + bw.
         leftAndRightWidth := leftWidth + rightWidth.
@@ -723,7 +735,7 @@
 createElements
     "private: create my elements"
 
-    self orientation == #horizontal ifTrue:[
+    orientation == #horizontal ifTrue:[
         button1 := ArrowButton leftIn:self.
         button1 name:'leftButton'.
         button2 := ArrowButton rightIn:self.
@@ -771,6 +783,9 @@
     |clr style|
 
     super initialize.
+    orientation notNil ifTrue:[
+        orientation := #vertical
+    ].
 
     self createElements.
 
@@ -836,7 +851,7 @@
 
     bwn := borderWidth negated + margin.
 
-    self orientation == #horizontal ifTrue:[
+    orientation == #horizontal ifTrue:[
         (buttonLayout == #bottom) ifTrue:[
             "buttons at left"
             button1 origin:(bwn @ bwn).
@@ -969,12 +984,6 @@
     "Created: 7.3.1997 / 16:20:12 / cg"
 !
 
-orientation
-    "for ST-80 compatibility, answer this query"
-
-    ^ #vertical
-!
-
 preferredExtent
     "compute my extent from sub-components"
 
@@ -998,7 +1007,7 @@
     "
     style := styleSheet name.
 
-    self orientation == #horizontal ifTrue:[
+    orientation == #horizontal ifTrue:[
         form1 := ArrowButton leftArrowButtonForm:style on:device.
         form2 := ArrowButton rightArrowButtonForm:style on:device.
     ] ifFalse:[
@@ -1018,7 +1027,7 @@
         width2 := form2 width
     ].
 
-    self orientation == #horizontal ifTrue:[
+    orientation == #horizontal ifTrue:[
         DefaultHScrollBarHeight notNil ifTrue:[
             h := DefaultHScrollBarHeight
         ] ifFalse:[
@@ -1051,8 +1060,8 @@
     "return a symbol describing my native window type 
      (may be used internally by the device as a native window creation hint)"
 
-    self orientation == #vertical ifTrue:[
-	^ #VerticalScrollBar
+    orientation == #vertical ifTrue:[
+        ^ #VerticalScrollBar
     ].
     ^ #HorizontalScrollBar
 ! !
@@ -1060,5 +1069,5 @@
 !ScrollBar class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libwidg/ScrollBar.st,v 1.60 1999-04-29 07:09:14 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libwidg/ScrollBar.st,v 1.61 1999-07-07 18:52:57 cg Exp $'
 ! !