VariableHorizontalPanel.st
changeset 63 f4eaf04d1eaf
parent 60 f3c738c24ce6
child 70 14443a9ea4ec
--- a/VariableHorizontalPanel.st	Thu Nov 17 15:34:12 1994 +0100
+++ b/VariableHorizontalPanel.st	Thu Nov 17 15:38:53 1994 +0100
@@ -21,7 +21,7 @@
 COPYRIGHT (c) 1992 by Claus Gittinger
 	      All Rights Reserved
 
-$Header: /cvs/stx/stx/libwidg/VariableHorizontalPanel.st,v 1.8 1994-10-28 03:25:33 claus Exp $
+$Header: /cvs/stx/stx/libwidg/VariableHorizontalPanel.st,v 1.9 1994-11-17 14:38:47 claus Exp $
 '!
 
 !VariableHorizontalPanel class methodsFor:'documentation'!
@@ -42,7 +42,7 @@
 
 version
 "
-$Header: /cvs/stx/stx/libwidg/VariableHorizontalPanel.st,v 1.8 1994-10-28 03:25:33 claus Exp $
+$Header: /cvs/stx/stx/libwidg/VariableHorizontalPanel.st,v 1.9 1994-11-17 14:38:47 claus Exp $
 "
 !
 
@@ -68,6 +68,11 @@
 			      corner:1.0 @ 1.0
 				  in:p.
 
+"
+!
+
+examples
+"
    example:
 	|top p v1 v2 v3|
 
@@ -119,21 +124,26 @@
 handleOriginsFrom:start to:stop do:aBlock
     "evaluate the argument block for some handle-origins"
 
-    |y hh|
+    |y hh vDelta|
 
     subViews notNil ifTrue:[
 	shadowForm notNil ifTrue:[
 	    hh := shadowForm height
 	] ifFalse:[
-	    hh := barHeight
+	    hh := barWidth
+	].
+	(handleStyle ~~ #normal and:[handleStyle ~~ #mswindows]) ifTrue:[
+	    vDelta := barWidth // 2.
+	] ifFalse:[
+	    vDelta := 0
 	].
 	(handlePosition == #left) ifTrue:[
-	    y := hh * 2
+	    y := vDelta
 	] ifFalse:[
 	    (handlePosition == #right) ifTrue:[
-		y := height - (2 * hh) - margin
+		y := height - hh - margin - vDelta
 	    ] ifFalse:[
-		y := height // 2
+		y := height - barWidth // 2
 	    ]
 	].
 	(start + 1) to:stop do:[:index |
@@ -263,7 +273,7 @@
     ]
 !
 
-buttonMotion:button x:bx y:by
+buttonMotion:buttonMask x:bx y:by
     "mouse-button was moved while pressed;
      clear prev handleBar and draw handle bar at new position" 
 
@@ -278,8 +288,15 @@
     self buttonMotionEventPending ifTrue:[^ self].
 
     xpos := bx - start.
-    limitTop := barHeight // 2.
-    limitBot := self width - barHeight.
+
+    "see comment in VariableVerticalPanel>>buttonMotion:x:y:"
+
+"/    limitTop := barHeight // 2.
+"/    limitBot := self width - barHeight.
+
+    limitTop := 0.
+    limitBot := self innerWidth.
+
     movedHandle > 1 ifTrue:[
 	limitTop := (subViews at:movedHandle) origin x + (barHeight // 2)
     ].
@@ -297,8 +314,15 @@
 
     self noClipByChildren.
     self xoring:[
-	self fillRectangleX:prev y:0 width:barHeight height:height.
-	self fillRectangleX:xpos y:0 width:barHeight height:height
+	trackLine ifTrue:[
+	   self displayLineFromX:prev+(barHeight // 2) y:0
+			     toX:prev+(barHeight // 2) y:height.
+	   self displayLineFromX:xpos+(barHeight // 2) y:0
+			     toX:xpos+(barHeight // 2) y:height.
+	] ifFalse:[
+	    self fillRectangleX:prev y:0 width:barHeight height:height.
+	    self fillRectangleX:xpos y:0 width:barHeight height:height
+	].
     ].
     self clipByChildren.
     prev := xpos
@@ -316,7 +340,12 @@
 
 	self noClipByChildren.
 	self xoring:[
-	    self fillRectangleX:prev y:0 width:barHeight height:height
+	    trackLine ifTrue:[
+	       self displayLineFromX:prev+(barHeight // 2) y:0
+				 toX:prev+(barHeight // 2) y:height.
+	    ] ifFalse:[
+		self fillRectangleX:prev y:0 width:barHeight height:height
+	    ].
 	].
 	self clipByChildren.
 
@@ -330,9 +359,9 @@
 	newX := (prev + start / width) asFloat .
 	aboveView relativeCorner:newX @ aboveView relativeCorner y.
 	belowView relativeOrigin:newX @ belowView relativeOrigin y.
-	self resizeSubviewsFrom:aboveIndex to:belowIndex.
+	movedHandle := nil.
 
-	movedHandle := nil.
+	self resizeSubviewsFrom:aboveIndex to:belowIndex.
 
 	"and redraw handles"
 
@@ -348,7 +377,7 @@
     |w x m|
 
     shadowForm notNil ifTrue:[
-	w := shadowForm height
+	w := shadowForm width
     ] ifFalse:[
 	w := barHeight - 4
     ].
@@ -385,7 +414,7 @@
 			 level:2.
 
 	    handleStyle == #iris ifTrue:[
-		self paint:Black.
+		self paint:handleColor.
 		self fillDeviceRectangleX:(x + m + 2)
 					y:(hy - barWidth + 2)
 				    width:w - 4
@@ -408,13 +437,13 @@
 	    self displayLineFromX:hx" "-1" " y:height-1 toX:(hx + barHeight - 1) y:height-1.
 	].
     ] ifFalse:[
-	x := hx + barHeight - 2.
+	x := hx + barHeight - 1.
 	self paint:handleColor.
 	separatingLine ifTrue:[
-	    self displayLineFromX:hx y:0 toX:hx y:height.
+	    self displayLineFromX:hx+1 y:0 toX:hx+1 y:height.
 	    self displayLineFromX:x y:0 toX:x y:height.
 	].
-	self fillRectangleX:hx y:hy width:barHeight height:barHeight
+	self fillRectangleX:hx y:hy width:barHeight height:barWidth
     ]
 !