--- a/VariableVerticalPanel.st Sun Aug 07 15:22:53 1994 +0200
+++ b/VariableVerticalPanel.st Sun Aug 07 15:23:42 1994 +0200
@@ -14,28 +14,103 @@
instanceVariableNames:'movedHandle prev start
barHeight barWidth separatingLine
shadowForm lightForm
- handlePosition
- handleColor noColor'
+ showHandle handlePosition
+ handleColor noColor
+ trackLine'
classVariableNames:''
poolDictionaries:''
category:'Views-Layout'
!
VariableVerticalPanel comment:'
-
COPYRIGHT (c) 1991 by Claus Gittinger
All Rights Reserved
-a View to separate its subviews vertically by a movable bar;
-the size-ratios of the subviews can be changed by moving this bar.
+$Header: /cvs/stx/stx/libwidg/VariableVerticalPanel.st,v 1.7 1994-08-07 13:23:37 claus Exp $
+'!
+
+!VariableVerticalPanel class methodsFor:'documentation'!
+
+copyright
+"
+ COPYRIGHT (c) 1991 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/VariableVerticalPanel.st,v 1.7 1994-08-07 13:23:37 claus Exp $
+"
+!
+
+documentation
+"
+ a View to separate its subviews vertically by a movable bar;
+ the size-ratios of the subviews can be changed by moving this bar.
+
+ The bar-handle is either an exposed knob (style == #motif)
+ or the forms defined in Scroller (style ~~ #motif)
+ or nothing.
+
+ The subvies dimensions MUST be given as relative sizes;
+ typically creation is done as:
-The bar-handle is either an exposed knob (style == #motif)
-or the forms defined in Scroller (style ~~ #motif)
+ p := VariableVerticalPanel in:superView.
+ v1 := <someViewClass> origin:0.0 @ 0.0
+ corner:1.0 @ 0.5
+ in:p.
+ v2 := <someViewClass> origin:0.0 @ 0.5
+ corner:1.0 @ 0.8
+ in:p.
+ v3 := <someViewClass> origin:0.0 @ 0.8
+ corner:1.0 @ 1.0
+ in:p.
+
+ example:
+ |top p v1 v2 v3|
+
+ top := StandardSystemView new.
+ top extent:300@300.
-$Header: /cvs/stx/stx/libwidg/VariableVerticalPanel.st,v 1.6 1994-01-13 00:18:51 claus Exp $
+ p := VariableVerticalPanel
+ origin:0.0 @ 0.0
+ corner:1.0 @ 1.0
+ in:top.
+ v1 := ScrollableView for:SelectionInListView in:p.
+ v1 origin:0.0 @ 0.0
+ corner:1.0 @ 0.5.
+ v1 list:(FileDirectory directoryNamed:'/etc') contents.
+ v1 action:[:selNr |
+ |fullName stream text|
+ fullName := '/etc/' , v1 selectionValue.
+ stream := fullName asFilename readStream.
+ stream notNil ifTrue:[
+ text := stream contents.
+ v2 contents:text.
+ v3 contents:text
+ ]
+ ].
-written summer 91 by claus
-'!
+ v2 := TextView
+ origin:0.0 @ 0.5
+ corner:1.0 @ 0.8
+ in:p.
+ v3 := ScrollableView
+ for:EditTextView
+ in:p.
+ v3 origin:0.0 @ 0.8
+ corner:1.0 @ 1.0.
+ top open
+"
+! !
!VariableVerticalPanel class methodsFor:'defaults'!
@@ -60,22 +135,29 @@
!
initStyle
- |defaultPosition|
+ super initStyle.
- super initStyle.
+ showHandle := style ~~ #mswindows.
(style == #next) ifTrue:[
shadowForm := self class shadowFormOn:device.
lightForm := self class lightFormOn:device.
- defaultPosition := #center.
-
self barHeight:(shadowForm height + 2).
- barWidth := shadowForm width
+ barWidth := shadowForm width.
+ handlePosition := #center.
] ifFalse:[
- defaultPosition := #right
+ shadowForm := lightForm := nil.
+ handlePosition := #right
].
- handlePosition := resources at:'HANDLE_POSITION' default:defaultPosition.
- separatingLine := resources at:'SEPARATING_LINE' default:false. "its so ugly"
+
+ style == #motif ifTrue:[
+ trackLine := true.
+ separatingLine := "true" false. "its so ugly"
+ ] ifFalse:[
+ trackLine := false.
+ separatingLine := false
+ ].
+
self is3D ifTrue:[
self barHeight:(3 * ViewSpacing)
] ifFalse:[
@@ -87,9 +169,18 @@
initCursor
"set the cursor - a double arrow"
- "which one looks better ?"
- cursor := Cursor upDownArrow
- "cursor := Cursor upLimitArrow"
+ cursor := Cursor sourceForm:(Form fromFile:'VVPanel.xbm')
+ maskForm:(Form fromFile:'VVPanel_m.xbm')
+ hotX:8
+ hotY:8.
+ "
+ if bitmaps are not available, use a standard cursor
+ "
+ cursor isNil ifTrue:[
+ "which one looks better ?"
+ cursor := Cursor upDownArrow
+ "cursor := Cursor upLimitArrow"
+ ]
!
initEvents
@@ -168,10 +259,15 @@
(styleSymbol ~~ style) ifTrue:[
style := styleSymbol.
- shadowForm := self class shadowFormOn:device.
- lightForm := self class lightFormOn:device.
- (self is3D and:[style ~~ #motif]) ifTrue:[
- shadowForm notNil ifTrue:[
+ style == #next ifTrue:[
+ shadowForm := self class shadowFormOn:device.
+ lightForm := self class lightFormOn:device.
+ ] ifFalse:[
+ shadowForm := lightForm := nil
+ ].
+
+ shadowForm notNil ifTrue:[
+ (self is3D and:[style ~~ #motif]) ifTrue:[
self barHeight:(shadowForm height + 2).
barWidth := shadowForm width
]
@@ -236,13 +332,25 @@
width:(barWidth + barWidth)
height:h.
+ "/ y := hy. "old"
+ y := hy - 1. "2.10.3"
self drawEdgesForX:(hx - barWidth)
- y:(hy + m)
+ y:(y + m)
width:(barWidth + barWidth)
height:h level:2
] ifFalse:[
- self drawHandleFormAtX:hx y:(hy + m)
- ]
+ "/ y := hy. "old"
+ y := hy - 1. "2.10.3"
+ self drawHandleFormAtX:hx y:(y + m)
+ ].
+ style == #st80 ifTrue:[
+ y := hy - 1.
+ self paint:lightColor.
+ self displayLineFromX:margin y:y toX:(width - margin) y:y.
+ y := hy + barHeight - 2.
+ self paint:shadowColor.
+ self displayLineFromX:margin y:y toX:(width - margin) y:y.
+ ].
] ifFalse:[
y := hy + barHeight - 1.
self paint:handleColor.
@@ -258,15 +366,22 @@
"redraw some handles"
subViews notNil ifTrue:[
- self handleOriginsFrom:start to:stop do:[:hPoint |
- self drawHandleAtX:(hPoint x) y:(hPoint y)
- ].
- movedHandle notNil ifTrue:[
- self noClipByChildren.
- self xoring:[
- self fillRectangleX:0 y:prev width:width height:barHeight
+ showHandle ifTrue:[
+ self handleOriginsFrom:start to:stop do:[:hPoint |
+ self drawHandleAtX:(hPoint x) y:(hPoint y)
].
- self clipByChildren
+ movedHandle notNil ifTrue:[
+ self noClipByChildren.
+ self xoring:[
+ trackLine ifTrue:[
+ self displayLineFromX:0 y:prev+(barHeight // 2)
+ toX:width y:prev+(barHeight // 2).
+ ] ifFalse:[
+ self fillRectangleX:0 y:prev width:width height:barHeight
+ ]
+ ].
+ self clipByChildren
+ ]
]
]
!
@@ -296,7 +411,7 @@
|handle|
- (button == 1) ifTrue:[
+ ((button == 1) or:[button == #select]) ifTrue:[
handle := 1.
self handleOriginsDo:[:hPoint |
|hy|
@@ -308,7 +423,12 @@
start := by - hy.
self noClipByChildren.
self xoring:[
- self fillRectangleX:0 y:hy width:width height:barHeight
+ trackLine ifTrue:[
+ self displayLineFromX:0 y:hy+(barHeight // 2)
+ toX:width y:hy+(barHeight // 2).
+ ] ifFalse:[
+ self fillRectangleX:0 y:hy width:width height:barHeight
+ ]
].
self clipByChildren.
^ self
@@ -355,8 +475,15 @@
self noClipByChildren.
self xoring:[
- self fillRectangleX:0 y:prev width:width height:barHeight.
- self fillRectangleX:0 y:ypos width:width height:barHeight
+ trackLine ifTrue:[
+ self displayLineFromX:0 y:prev+(barHeight // 2)
+ toX:width y:prev+(barHeight // 2).
+ self displayLineFromX:0 y:ypos+(barHeight // 2)
+ toX:width y:ypos+(barHeight // 2).
+ ] ifFalse:[
+ self fillRectangleX:0 y:prev width:width height:barHeight.
+ self fillRectangleX:0 y:ypos width:width height:barHeight
+ ]
].
self clipByChildren.
prev := ypos
@@ -367,14 +494,19 @@
|aboveView belowView aboveIndex belowIndex newY|
- (button == 1) ifTrue:[
+ ((button == 1) or:[button == #select]) ifTrue:[
movedHandle isNil ifTrue:[^ self].
"undo the last xor"
self noClipByChildren.
self xoring:[
- self fillRectangleX:0 y:prev width:width height:barHeight
+ trackLine ifTrue:[
+ self displayLineFromX:0 y:prev+(barHeight // 2)
+ toX:width y:prev+(barHeight // 2).
+ ] ifFalse:[
+ self fillRectangleX:0 y:prev width:width height:barHeight
+ ].
].
self clipByChildren.
@@ -508,7 +640,7 @@
x := hw * 2
] ifFalse:[
(handlePosition == #right) ifTrue:[
- x := width - (2 * hw) - margin
+ x := width - (1 "2" * hw) - margin
] ifFalse:[
x := width // 2
]