VariablePanel.st
changeset 2623 fdc67970afc9
parent 2598 6817bf076dc9
child 2650 e4fee3badbdd
--- a/VariablePanel.st	Mon Sep 30 15:19:07 2002 +0200
+++ b/VariablePanel.st	Tue Oct 01 10:17:31 2002 +0200
@@ -13,10 +13,10 @@
 "{ Package: 'stx:libwidg' }"
 
 SimpleView subclass:#VariablePanel
-	instanceVariableNames:'barHeight barWidth separatingLine shadowForm lightForm showHandle
-		handlePosition handleColor handleStyle handleLevel noColor
-		trackLine redrawLocked orientation handleLabels knobHeight
-		realRelativeSizes snapAdornment'
+	instanceVariableNames:'barHeight barWidth barLevel separatingLine shadowForm lightForm
+		showHandle handlePosition handleColor handleStyle handleLevel
+		noColor trackLine redrawLocked orientation handleLabels
+		knobHeight realRelativeSizes snapAdornment'
 	classVariableNames:'DefaultShowHandle DefaultHandleStyle DefaultHandlePosition
 		DefaultTrackingLine DefaultSeparatingLine DefaultHandleColor
 		DefaultHandleLevel DefaultVCursor DefaultHCursor
@@ -870,7 +870,7 @@
         shown ifTrue:[
             self cursor:cursor.
             self sizeChanged:nil.
-            self invalidate.
+            self redrawIfShown.
         ]
     ]
 
@@ -907,6 +907,15 @@
     "Modified: / 30.1.2000 / 22:31:32 / cg"
 !
 
+barLevel:level
+    "set the 3D level of the separating bar"
+
+    barLevel ~~ level ifTrue:[
+        barLevel := level.
+        self redrawIfShown.    
+    ]
+!
+
 handleImage:aBitmapOrImage
     "define the handles image"
 
@@ -951,10 +960,7 @@
 
     handleLevel ~~ aNumber ifTrue:[
         handleLevel := aNumber.
-        shown ifTrue:[
-            self clear.
-            self invalidate
-        ]
+        self redrawIfShown.    
     ]
 !
 
@@ -971,10 +977,7 @@
 
     handlePosition ~~ aSymbol ifTrue:[
         handlePosition := aSymbol ? DefaultHandlePosition.
-        shown ifTrue:[
-            self clear.    
-            self invalidate
-        ]
+        self redrawIfShown.    
     ]
 !
 
@@ -1013,8 +1016,7 @@
         ].
         shown ifTrue:[
             self resizeSubviews.
-            self clear.
-            self invalidate
+            self redrawIfShown.    
         ]
     ]
 
@@ -1048,10 +1050,7 @@
 
     showHandle ~~ aBoolean ifTrue:[
         showHandle := aBoolean ? DefaultShowHandle.
-        realized ifTrue:[
-            self clear.
-            self invalidate
-        ]
+        self redrawIfShown
     ]
 !
 
@@ -1130,10 +1129,7 @@
             self resizeSubviews.
         ]
     ].
-    shown ifTrue:[
-        self clear.
-        self invalidate
-    ].
+    self redrawIfShown.    
 !
 
 style:styleSymbol
@@ -1218,9 +1214,8 @@
         self fillRectangleX:mar y:hy 
                       width:(width - mar - mar) 
                      height:barHeightInt.
-
-        (handleStyle isNil
-        or:[handleStyle == #none]) ifFalse:[
+        (handleStyle notNil
+        and:[handleStyle ~~ #none]) ifTrue:[
             (handleStyle ~~ #normal 
             and:[handleStyle ~~ #mswindows]) ifTrue:[
                 m := (maxKnob - h) // 2.
@@ -1311,7 +1306,7 @@
                     self displayLineFromX:0 y:hy+1 toX:width y:hy+1.
                     self displayLineFromX:0 y:y toX:width y:y.
                 ].
-                self fillRectangleX:hx y:hy width:barWidthInt height:barHeightInt
+                self fillRectangleX:hx y:hy width:barWidthInt height:barHeightInt.
             ].
         ].
         lbl := self handleLabelAt:hIndex.
@@ -1331,8 +1326,8 @@
                       width:barHeightInt
                      height:(height - mar - mar).
 
-        (handleStyle isNil
-        or:[handleStyle == #none]) ifFalse:[
+        (handleStyle notNil
+        and:[handleStyle ~~ #none]) ifTrue:[
             (handleStyle ~~ #normal
             and:[handleStyle ~~ #mswindows]) ifTrue:[
                  m := (barHeightInt - w) // 2.
@@ -1608,15 +1603,21 @@
     "
     subViews size ~~ 0 ifTrue:[
         "/ do not draw handle, if there is a snapper ...
-        (showHandle and:[snapAdornment isNil]) ifTrue:[
-            self handleOriginsWithIndexFrom:start to:stop do:[:hPoint :hIndex |
-                self drawHandle:hIndex atX:(hPoint x) y:(hPoint y).
+        self handleOriginsWithIndexFrom:start to:stop do:[:hPoint :hIndex |
+            |hx hy|
+
+            hx := hPoint x.
+            hy := hPoint y.
+            barLevel notNil ifTrue:[
+                self drawEdgesForX:0 y:hy width:width height:barHeight level:barLevel.
+            ].
+            (showHandle and:[snapAdornment isNil]) ifTrue:[
+                self drawHandle:hIndex atX:hx y:hy.
+            ].
+            snapAdornment notNil ifTrue:[
+                self drawSnapAt:hIndex-1
             ]
         ].
-
-        snapAdornment notNil ifTrue:[
-            start to:stop do:[:i| self drawSnapAt:i ].
-        ].
     ].
 !
 
@@ -1913,6 +1914,13 @@
     "Modified: / 1.11.1997 / 11:53:40 / cg"
 !
 
+redrawIfShown
+    shown ifTrue:[
+        self clear.
+    ].
+    self invalidate
+!
+
 resizeSubViewsTo:relativeSizeList
     "change subviews sizes as defined in the argument list
      (a collection of relative sizes)"
@@ -2292,5 +2300,5 @@
 !VariablePanel class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libwidg/VariablePanel.st,v 1.80 2002-09-02 10:24:53 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libwidg/VariablePanel.st,v 1.81 2002-10-01 08:17:31 cg Exp $'
 ! !