--- a/VariableVerticalPanel.st Thu Nov 23 11:44:18 1995 +0100
+++ b/VariableVerticalPanel.st Thu Nov 23 15:37:40 1995 +0100
@@ -10,15 +10,13 @@
hereby transferred.
"
-'From Smalltalk/X, Version:2.10.5 on 14-mar-1995 at 11:10:57 am'!
-
SimpleView subclass:#VariableVerticalPanel
instanceVariableNames:'barHeight barWidth separatingLine shadowForm lightForm showHandle
- handlePosition handleColor handleStyle handleLevel noColor trackLine
- redrawLocked'
+ handlePosition handleColor handleStyle handleLevel noColor
+ trackLine redrawLocked'
classVariableNames:'DefaultShowHandle DefaultHandleStyle DefaultHandlePosition
- DefaultTrackingLine DefaultSeparatingLine DefaultHandleColor DefaultHandleLevel
- DefaultCursor'
+ DefaultTrackingLine DefaultSeparatingLine DefaultHandleColor
+ DefaultHandleLevel DefaultCursor'
poolDictionaries:''
category:'Views-Layout'
!
@@ -39,10 +37,6 @@
"
!
-version
- ^ '$Header: /cvs/stx/stx/libwidg/VariableVerticalPanel.st,v 1.22 1995-11-14 20:27:45 cg Exp $'
-!
-
documentation
"
a View to separate its subviews vertically by a movable bar;
@@ -152,10 +146,26 @@
v3 origin:0.0 @ 0.8 corner:1.0 @ 1.0.
top open
"
+!
+
+version
+ ^ '$Header: /cvs/stx/stx/libwidg/VariableVerticalPanel.st,v 1.23 1995-11-23 14:37:11 cg Exp $'
! !
!VariableVerticalPanel class methodsFor:'defaults'!
+lightFormOn:aDisplay
+ "use same handle as Scroller"
+
+ ^ Scroller handleLightFormOn:aDisplay
+!
+
+shadowFormOn:aDisplay
+ "use same handle as Scroller"
+
+ ^ Scroller handleShadowFormOn:aDisplay
+!
+
updateStyleCache
DefaultShowHandle := StyleSheet at:'variablePanelShowHandle' default:true.
DefaultHandleStyle := StyleSheet at:'variablePanelHandleStyle'.
@@ -164,18 +174,104 @@
DefaultTrackingLine := StyleSheet at:'variablePanelTrackingLine' default:false.
DefaultSeparatingLine := StyleSheet at:'variablePanelSeparatingLine' default:false.
DefaultHandleColor := StyleSheet colorAt:'variablePanelHandleColor' default:Black.
+! !
+
+!VariableVerticalPanel methodsFor:'accessing'!
+
+add:aView
+ "a view is added; make its size relative (if not already done)"
+
+"obsolete" self halt.
+
+ super add:aView.
+ shown ifTrue:[
+ (superView isNil or:[superView shown]) ifTrue:[
+ self setupSubviewSizes
+ ]
+ ]
+!
+
+barHeight
+ "return the height of the separating bar"
+
+ ^ barHeight
+!
+
+barHeight:nPixel
+ "set the height of the separating bar"
+
+ barHeight := nPixel.
+
+ "if screen is very low-res, make certain bar is visible and catchable"
+ (barHeight < 4) ifTrue:[
+ barHeight := 4
+ ].
+
+ "make it even so spacing is equally spreadable among subviews"
+ barHeight odd ifTrue:[
+ barHeight := barHeight + 1
+ ]
+!
+
+handleLevel:aNumber
+ "define the 3D level of the handle (only with some styles).
+ Normally, this is defined via styleSheet files, but this entry allows
+ individual views to be manipulated."
+
+ handleLevel := aNumber
!
-shadowFormOn:aDisplay
- "use same handle as Scroller"
+handlePosition
+ "return the position of the handle"
+
+ ^ handlePosition
+!
+
+handlePosition:aSymbol
+ "define the position of the handle; the argument aSymbol
+ may be one of #left, #right or #center"
- ^ Scroller handleShadowFormOn:aDisplay
+ handlePosition := aSymbol
+!
+
+removeSubView:aView
+ "a view is removed; adjust other subviews sizes"
+
+ super removeSubView:aView.
+ shown ifTrue:[
+ (superView isNil or:[superView shown]) ifTrue:[
+ self setupSubviewSizes
+ ]
+ ]
!
-lightFormOn:aDisplay
- "use same handle as Scroller"
+style:styleSymbol
+ "define the style of the handle;
+ styleSymbol may be #motif to draw a little knob or
+ anything else to draw scrollBars handleForm.
+ Normally, this is defined via styleSheet files, but this entry allows
+ individual views to be manipulated."
- ^ Scroller handleLightFormOn:aDisplay
+ (styleSymbol ~~ handleStyle) ifTrue:[
+ handleStyle := styleSymbol.
+ handleStyle == #next ifTrue:[
+ shadowForm := self class shadowFormOn:device.
+ lightForm := self class lightFormOn:device.
+ ] ifFalse:[
+ shadowForm := lightForm := nil
+ ].
+
+ shadowForm notNil ifTrue:[
+ (self is3D and:[handleStyle ~~ #motif]) ifTrue:[
+ self barHeight:(shadowForm height + 2).
+ barWidth := shadowForm width
+ ]
+ ].
+ shown ifTrue:[
+ self resizeSubviewsFrom:1 to:(subViews size).
+ self redraw
+ ]
+ ]
! !
!VariableVerticalPanel methodsFor:'drawing'!
@@ -263,32 +359,14 @@
"Modified: 14.11.1995 / 20:31:02 / cg"
!
-redrawHandlesFrom:start to:stop
- "redraw some handles"
-
- subViews notNil ifTrue:[
- showHandle ifTrue:[
- self handleOriginsFrom:start to:stop do:[:hPoint |
- self drawHandleAtX:(hPoint x) y:(hPoint y)
- ].
- ]
- ]
-!
+drawHandleFormAtX:hx y:hy
+ "draw a handles bitmap at hx/hy"
-lockRedraw
- redrawLocked := true
-!
-
-unlockRedraw
- redrawLocked := false
-!
-
-redraw
- "redraw all of the handles"
-
- redrawLocked ~~ true ifTrue:[
- self redrawHandlesFrom:1 to:(subViews size)
- ]
+ self paint:shadowColor.
+ self displayForm:shadowForm x:hx y:hy.
+ self paint:lightColor.
+ self displayForm:lightForm x:hx y:hy.
+ self paint:viewBackground
!
invertHandleBarAtX:hx y:hy
@@ -306,116 +384,57 @@
self clipByChildren.
!
-drawHandleFormAtX:hx y:hy
- "draw a handles bitmap at hx/hy"
-
- self paint:shadowColor.
- self displayForm:shadowForm x:hx y:hy.
- self paint:lightColor.
- self displayForm:lightForm x:hx y:hy.
- self paint:viewBackground
-! !
-
-!VariableVerticalPanel methodsFor:'accessing'!
+lockRedraw
+ redrawLocked := true
+!
-barHeight:nPixel
- "set the height of the separating bar"
-
- barHeight := nPixel.
+redraw
+ "redraw all of the handles"
- "if screen is very low-res, make certain bar is visible and catchable"
- (barHeight < 4) ifTrue:[
- barHeight := 4
- ].
-
- "make it even so spacing is equally spreadable among subviews"
- barHeight odd ifTrue:[
- barHeight := barHeight + 1
+ redrawLocked ~~ true ifTrue:[
+ self redrawHandlesFrom:1 to:(subViews size)
]
!
-barHeight
- "return the height of the separating bar"
-
- ^ barHeight
-!
+redrawHandlesFrom:start to:stop
+ "redraw some handles"
-add:aView
- "a view is added; make its size relative (if not already done)"
-
-"obsolete" self halt.
-
- super add:aView.
- shown ifTrue:[
- (superView isNil or:[superView shown]) ifTrue:[
- self setupSubviewSizes
+ subViews notNil ifTrue:[
+ showHandle ifTrue:[
+ self handleOriginsFrom:start to:stop do:[:hPoint |
+ self drawHandleAtX:(hPoint x) y:(hPoint y)
+ ].
]
]
!
-removeSubView:aView
- "a view is removed; adjust other subviews sizes"
-
- super removeSubView:aView.
- shown ifTrue:[
- (superView isNil or:[superView shown]) ifTrue:[
- self setupSubviewSizes
- ]
- ]
-!
+unlockRedraw
+ redrawLocked := false
+! !
-handlePosition:aSymbol
- "define the position of the handle; the argument aSymbol
- may be one of #left, #right or #center"
-
- handlePosition := aSymbol
-!
+!VariableVerticalPanel methodsFor:'event handling'!
-handlePosition
- "return the position of the handle"
-
- ^ handlePosition
-!
-
-handleLevel:aNumber
- "define the 3D level of the handle (only with some styles).
- Normally, this is defined via styleSheet files, but this entry allows
- individual views to be manipulated."
+sizeChanged:how
+ "tell subviews if I change size"
- handleLevel := aNumber
-!
-
-style:styleSymbol
- "define the style of the handle;
- styleSymbol may be #motif to draw a little knob or
- anything else to draw scrollBars handleForm.
- Normally, this is defined via styleSheet files, but this entry allows
- individual views to be manipulated."
-
- (styleSymbol ~~ handleStyle) ifTrue:[
- handleStyle := styleSymbol.
- handleStyle == #next ifTrue:[
- shadowForm := self class shadowFormOn:device.
- lightForm := self class lightFormOn:device.
+ shown ifTrue:[
+ (how == #smaller) ifTrue:[
+ self resizeSubviewsFrom:1 to:(subViews size)
] ifFalse:[
- shadowForm := lightForm := nil
- ].
-
- shadowForm notNil ifTrue:[
- (self is3D and:[handleStyle ~~ #motif]) ifTrue:[
- self barHeight:(shadowForm height + 2).
- barWidth := shadowForm width
- ]
- ].
- shown ifTrue:[
- self resizeSubviewsFrom:1 to:(subViews size).
- self redraw
+ self resizeSubviewsFrom:(subViews size) to:1
]
- ]
+ ].
+ self changed:#sizeOfView with:how.
! !
!VariableVerticalPanel methodsFor:'initializing'!
+defaultControllerClass
+ ^ VariableVerticalPanelController
+
+
+!
+
fixSize
extentChanged ifTrue:[
super fixSize.
@@ -425,9 +444,26 @@
]
!
-initialize
- super initialize.
- noColor := Color noColor.
+initCursor
+ "set the cursor - a double arrow"
+
+ DefaultCursor notNil ifTrue:[
+ cursor := DefaultCursor
+ ] ifFalse:[
+ 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"
+ ].
+ DefaultCursor := cursor
+ ]
!
initStyle
@@ -471,36 +507,32 @@
].
!
-defaultControllerClass
- ^ VariableVerticalPanelController
-
-
-!
-
-initCursor
- "set the cursor - a double arrow"
-
- DefaultCursor notNil ifTrue:[
- cursor := DefaultCursor
- ] ifFalse:[
- 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"
- ].
- DefaultCursor := cursor
- ]
+initialize
+ super initialize.
+ noColor := Color noColor.
! !
!VariableVerticalPanel methodsFor:'private'!
+anyNonRelativeSubviews
+ "return true, if any of my subviews has no relative origin/extent"
+
+ 1 to:(subViews size) do:[:index |
+ |view|
+
+ view := subViews at:index.
+ view relativeExtent isNil ifTrue:[^ true].
+ view relativeOrigin isNil ifTrue:[^ true]
+ ].
+ ^ false
+!
+
+handleOriginsDo:aBlock
+ "evaluate the argument block for every handle-origin"
+
+ self handleOriginsFrom:1 to:(subViews size) do:aBlock
+!
+
handleOriginsFrom:start to:stop do:aBlock
"evaluate the argument block for some handle-origins"
@@ -606,25 +638,6 @@
]
!
-handleOriginsDo:aBlock
- "evaluate the argument block for every handle-origin"
-
- self handleOriginsFrom:1 to:(subViews size) do:aBlock
-!
-
-anyNonRelativeSubviews
- "return true, if any of my subviews has no relative origin/extent"
-
- 1 to:(subViews size) do:[:index |
- |view|
-
- view := subViews at:index.
- view relativeExtent isNil ifTrue:[^ true].
- view relativeOrigin isNil ifTrue:[^ true]
- ].
- ^ false
-!
-
setupSubviewSizes
"setup subviews sizes (in case of non-relative sizes)"
@@ -652,17 +665,3 @@
]
! !
-!VariableVerticalPanel methodsFor:'event handling'!
-
-sizeChanged:how
- "tell subviews if I change size"
-
- shown ifTrue:[
- (how == #smaller) ifTrue:[
- self resizeSubviewsFrom:1 to:(subViews size)
- ] ifFalse:[
- self resizeSubviewsFrom:(subViews size) to:1
- ]
- ].
- self changed:#sizeOfView with:how.
-! !