VariableHorizontalPanel.st
changeset 38 4b9b70b2cc87
parent 23 69f1ba57f67a
child 59 450ce95a72a4
--- a/VariableHorizontalPanel.st	Sun Aug 07 15:22:53 1994 +0200
+++ b/VariableHorizontalPanel.st	Sun Aug 07 15:23:42 1994 +0200
@@ -18,28 +18,100 @@
 !
 
 VariableHorizontalPanel comment:'
-
 COPYRIGHT (c) 1992 by Claus Gittinger
               All Rights Reserved
 
-a View to separate its subviews horizontally by a movable bar
-to adjust the size-ratios.
-The bar-handle is either an exposed knob (knobStyle == #motif)
-or the forms defined in Scroller (knobStyle ~~ #motif)
+$Header: /cvs/stx/stx/libwidg/VariableHorizontalPanel.st,v 1.6 1994-08-07 13:23:35 claus Exp $
+'!
+
+!VariableHorizontalPanel class methodsFor:'documentation'!
+
+copyright
+"
+ COPYRIGHT (c) 1992 by Claus Gittinger
+              All Rights Reserved
+
+ This software is furnished under a license and may be used
+ only in accordance with the terms of that license and with the
+ inclusion of the above copyright notice.   This software may not
+ be provided or otherwise made available to, or used by, any
+ other person.  No title to or ownership of the software is
+ hereby transferred.
+"
+!
+
+version
+"
+$Header: /cvs/stx/stx/libwidg/VariableHorizontalPanel.st,v 1.6 1994-08-07 13:23:35 claus Exp $
+"
+!
+
+documentation
+"
+    a View to separate its subviews horizontally by a movable bar
+    to adjust the size-ratios.
+    The bar-handle is either an exposed knob (knobStyle == #motif)
+    or the forms defined in Scroller (knobStyle ~~ #motif)
+    or nothing.
+
+    The subvies dimensions MUST be given as relative sizes;
+    typically creation is done as:
 
-$Header: /cvs/stx/stx/libwidg/VariableHorizontalPanel.st,v 1.5 1994-01-08 17:31:27 claus Exp $
+        p := VariableHorizontalPanel in:superView.
+        v1 := <someViewClass> origin:0.0 @ 0.0
+                              corner:0.5 @ 1.0
+                                  in:p.
+        v2 := <someViewClass> origin:0.5 @ 0.0
+                              corner:0.8 @ 1.0
+                                  in:p.
+        v3 := <someViewClass> origin:0.8 @ 0.0
+                              corner:1.0 @ 1.0
+                                  in:p.
+
+   example:
+        |top p v1 v2 v3|
+
+        top := StandardSystemView new.
+        top extent:300@200.
 
-written summer 92 by claus
-'!
+        p := VariableHorizontalPanel 
+                 origin:0.0 @ 0.0
+                 corner:1.0 @ 1.0
+                 in:top.
+        v1 := SelectionInListView 
+                 origin:0.0 @ 0.0
+                 corner:0.5 @ 1.0
+                 in:p.
+        v2 := EditTextView 
+                 origin:0.5 @ 0.0
+                 corner:0.8 @ 1.0
+                 in:p.
+        v3 := ScrollableView 
+                 for:TextView 
+                 in:p.
+        v3 origin:0.8 @ 0.0 
+           corner:1.0 @ 1.0.
+        top open
+"
+! !
 
 !VariableHorizontalPanel methodsFor:'initializing'!
 
 initCursor
     "set the cursor - a horizontal double arrow"
 
-    "which one looks better ?"
-    cursor := Cursor leftRightArrow
-    "cursor := Cursor leftLimitArrow"
+    cursor := Cursor sourceForm:(Form fromFile:'VHPanel.xbm')
+                     maskForm:(Form fromFile:'VHPanel_m.xbm')
+                     hotX:8
+                     hotY:8.
+    "
+     if bitmaps are not available, use a standard cursor
+    "
+    cursor isNil ifTrue:[
+        "which one looks better ?"
+        cursor := Cursor leftRightArrow
+        "cursor := Cursor leftLimitArrow"
+    ]
 ! !
 
 !VariableHorizontalPanel methodsFor:'private'!
@@ -161,7 +233,7 @@
 
     |handle|
 
-    (button == 1) ifTrue:[
+    ((button == 1) or:[button == #select]) ifTrue:[
         handle := 1.
         self handleOriginsDo:[:hPoint |
             |hx|
@@ -232,7 +304,7 @@
 
     |aboveView belowView aboveIndex belowIndex newX|
 
-    (button == 1) ifTrue:[
+    ((button == 1) or:[button == #select]) ifTrue:[
         movedHandle isNil ifTrue:[^ self].
 
         "undo the last xor"
@@ -296,13 +368,25 @@
             self fillRectangleX:hx y:(hy - barWidth) 
                           width:w height:(barWidth + barWidth).
 
-            self drawEdgesForX:(hx + m)
+            "/ x := hx.    "old"
+            x := hx - 1.   "2.10.3"
+            self drawEdgesForX:(x + m)
                              y:(hy - barWidth)
                          width:w height:(barWidth + barWidth)
                          level:2
         ] ifFalse:[
-            self drawHandleFormAtX:(hx + m) y:hy
-        ]
+            "/ x := hx.    "old"
+            x := hx - 1.   "2.10.3"
+            self drawHandleFormAtX:(x + m) y:hy
+        ].
+        style == #st80 ifTrue:[
+            x := hx - 1.
+            self paint:lightColor.
+            self displayLineFromX:x y:margin toX:x y:(height - margin).
+            x := hx + barHeight - 2.
+            self paint:shadowColor.
+            self displayLineFromX:x y:margin toX:x y:(height - margin).
+        ].
     ] ifFalse:[
         x := hx + barHeight - 2.
         self paint:handleColor.