--- a/BorderedWrapper.st Wed Jun 05 17:28:29 1996 +0200
+++ b/BorderedWrapper.st Wed Jun 05 17:31:20 1996 +0200
@@ -1,5 +1,5 @@
BoundedWrapper subclass:#BorderedWrapper
- instanceVariableNames:'border inset insideColor'
+ instanceVariableNames:'border inset insideColor borderWidth borderColor level'
classVariableNames:''
poolDictionaries:''
category:'Graphics-Display Objects'
@@ -34,6 +34,69 @@
examples
"
[exBegin]
+ |t component|
+
+ t := StandardSystemView extent:250@200.
+
+ component := ClockView new.
+
+ t addComponent:((BorderedWrapper
+ on:component in:(0.1@0.1 corner:0.9@0.9))
+ insideColor:Color blue).
+
+ t open
+ [exEnd]
+ [exBegin]
+ |t component|
+
+ t := StandardSystemView extent:250@200.
+
+ component := ClockView new.
+ t addComponent:((BorderedWrapper
+ on:component in:(10@10 corner:100@100))
+ borderWidth:1; borderColor:Color blue).
+
+ component := ClockView new.
+ t addComponent:((BorderedWrapper
+ on:component in:(0.5@0.5 corner:1.0@1.0))
+ borderWidth:1; borderColor:Color red).
+
+
+ t openAndWait.
+ [exEnd]
+ [exBegin]
+ |t component|
+
+ t := StandardSystemView extent:250@200.
+
+ component := ClockView new.
+ component borderWidth:1; borderColor:Color blue.
+ component layout:((10@10 corner:100@100) asLayout).
+ t addComponent:component.
+
+ component := ClockView new.
+ component borderWidth:1; borderColor:Color red.
+ component layout:((0.5@0.5 corner:1.0@1.0) asLayout).
+ t addComponent:component.
+
+
+ t openAndWait.
+ [exEnd]
+ [exBegin]
+ |t component|
+
+ t := StandardSystemView extent:250@200.
+
+ component := ClockView new.
+
+ t addComponent:((BorderedWrapper
+ on:component in:(0.1@0.1 corner:0.9@0.9))
+ level:1).
+
+ t open
+ [exEnd]
+
+ [exBegin]
|t s v e component|
t := StandardSystemView extent:250@200.
@@ -44,19 +107,21 @@
e := Rectangle origin:0@0 corner:80@80.
component := FillingWrapper on:e.
component foregroundColor:Color red.
- v addComponent:(BorderedWrapper on:component at:10@10).
+ v addComponent:((BorderedWrapper on:component at:10@10)
+ borderWidth:3; borderColor:Color green darkened).
e := EllipticalArc boundingBox:(0@0 corner:80@80)
startAngle:0 sweepAngle:360.
component := StrokingWrapper on:e.
component lineWidth:5; foregroundColor:Color yellow.
v addComponent:((BorderedWrapper on:component at:50@50)
- insideColor:Color blue).
+ insideColor:Color blue;
+ level:1).
e := Arrow from:0@0 to:50@150.
component := StrokingWrapper on:e.
component lineWidth:2.
- v addComponent:(BorderedWrapper on:component at:100@100).
+ v addComponent:((BorderedWrapper on:component at:100@100) level:2).
t open
[exEnd]
@@ -89,6 +154,59 @@
"Created: 28.5.1996 / 23:15:15 / cg"
!
+borderColor:aColor
+ "set the 2D borderColor"
+
+ |v|
+
+ borderColor := aColor.
+ (v := self view) notNil ifTrue:[v invalidate]
+
+ "Modified: 5.6.1996 / 01:20:37 / cg"
+ "Created: 5.6.1996 / 01:34:17 / cg"
+!
+
+borderWidth
+ "return the 2D borderWidth"
+
+ ^ borderWidth
+
+ "Modified: 5.6.1996 / 01:52:41 / cg"
+ "Created: 5.6.1996 / 14:27:28 / cg"
+!
+
+borderWidth:aNumber
+ "set the 2D borderWidth"
+
+ |v|
+
+ borderWidth ~~ aNumber ifTrue:[
+ borderWidth := aNumber.
+ bounds notNil ifTrue:[self bounds:bounds].
+ (v := self view) notNil ifTrue:[v invalidate]
+ ]
+
+ "Created: 5.6.1996 / 01:33:56 / cg"
+ "Modified: 5.6.1996 / 01:52:41 / cg"
+!
+
+inset
+ |i|
+
+ borderWidth notNil ifTrue:[
+ i := borderWidth
+ ] ifFalse:[
+ i := 0
+ ].
+ level notNil ifTrue:[
+ i := i + level abs.
+ ].
+ ^ i
+
+ "Created: 5.6.1996 / 01:03:25 / cg"
+ "Modified: 5.6.1996 / 01:03:47 / cg"
+!
+
insideColor
"return the insideColor"
@@ -103,55 +221,115 @@
insideColor := aColorOrPixmap
"Created: 29.5.1996 / 11:10:16 / cg"
+!
+
+level
+ "return the 3D level"
+
+ ^ level
+
+ "Created: 5.6.1996 / 14:27:47 / cg"
+!
+
+level:aNumber
+ "set the 3D level"
+
+ |v|
+
+ level ~~ aNumber ifTrue:[
+ level := aNumber.
+ bounds notNil ifTrue:[self bounds:bounds].
+ (v := self view) notNil ifTrue:[v invalidate]
+ ]
+
+ "Created: 5.6.1996 / 01:19:41 / cg"
+ "Modified: 5.6.1996 / 01:53:00 / cg"
! !
!BorderedWrapper methodsFor:'accessing - bounds'!
-bounds
- ^ component bounds + origin
+bounds:newBounds
+ |v|
- "Created: 29.5.1996 / 11:09:39 / cg"
+ bounds := newBounds.
+ component bounds:(newBounds insetBy:self inset).
+ (v := self view) notNil ifTrue:[v invalidate]
+
+ "Created: 5.6.1996 / 00:52:49 / cg"
+ "Modified: 5.6.1996 / 02:35:30 / cg"
! !
!BorderedWrapper methodsFor:'displaying'!
displayOn:aGC
- |bounds x y w h tX tY|
+ |bounds x y w h r b tX tY bw|
bounds := self bounds.
x := bounds left rounded.
y := bounds top rounded.
- w := bounds width rounded.
- h := bounds height rounded.
+ r := bounds right rounded.
+ b := bounds bottom rounded.
insideColor notNil ifTrue:[
aGC paint:insideColor.
- aGC fillRectangleX:x y:y width:w height:h
+ aGC fillRectangleX:x y:y width:(r-x) height:(b-y)
].
super displayOn:aGC.
- "/ drawEdgesForX: draws in deviceCoordinates - have to translate here.
+ bw := 0.
+ borderColor notNil ifTrue:[
+ (borderWidth notNil
+ and:[borderWidth ~~ 0]) ifTrue:[
+ bw := borderWidth.
+ aGC paint:borderColor.
+ 0 to:(borderWidth-1) do:[:i |
+ aGC displayRectangleX:x+i y:y+i width:(r-x-i-i+1) height:(b-y-i-i+1).
+"/ aGC displayLineFromX:x+i y:y+i toX:r-i y:y+i.
+"/ aGC displayLineFromX:(r-i) y:y+i toX:(r-i) y:b-i.
+"/ aGC displayLineFromX:x+i y:b-i toX:(r-1-i) y:b-i.
+"/ aGC displayLineFromX:(x+i) y:y+i+1 toX:(x+i) y:b-1-i.
+ ].
+ ]
+ ].
- tX := aGC translation x.
- tY := aGC translation y.
+ level notNil ifTrue:[
+ "/ drawEdgesForX: draws in deviceCoordinates - have to translate here.
+
+ tX := aGC translation x.
+ tY := aGC translation y.
- aGC drawEdgesForX:x+tX
- y:y+tY
- width:w
- height:h
- level:1
- shadow:Color black
- light:Color white
- halfShadow:Color grey
- halfLight:Color grey
- style:#iris
+ aGC drawEdgesForX:x+tX+bw
+ y:y+tY+bw
+ width:(r-x+1-bw-bw)
+ height:(b-y+1-bw-bw)
+ level:level
+ shadow:Color black
+ light:Color white
+ halfShadow:Color grey
+ halfLight:Color grey
+ style:#iris
+ ].
- "Modified: 29.5.1996 / 11:30:34 / cg"
+ "Modified: 5.6.1996 / 02:25:45 / cg"
+! !
+
+!BorderedWrapper methodsFor:'queries'!
+
+hasBorder
+ ^ true
+
+ "Created: 5.6.1996 / 14:28:38 / cg"
+!
+
+isBorderedWrapper
+ ^ true
+
+ "Created: 5.6.1996 / 14:11:03 / cg"
! !
!BorderedWrapper class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libview2/BorderedWrapper.st,v 1.2 1996-05-29 09:36:48 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libview2/BorderedWrapper.st,v 1.3 1996-06-05 15:30:29 cg Exp $'
! !
--- a/BoundedWrapper.st Wed Jun 05 17:28:29 1996 +0200
+++ b/BoundedWrapper.st Wed Jun 05 17:31:20 1996 +0200
@@ -5,9 +5,25 @@
category:'Graphics-Display Objects'
!
+!BoundedWrapper class methodsFor:'documentation'!
+
+documentation
+"
+ a dummy class - only existing to provide a compatible home
+ for fileIn of ST-80 classes.
+
+ [see also:]
+ Wrapper TranslatingWrapper BorderedWrapper GeometricWrapper
+
+ [author:]
+ Claus Gittinger
+"
+
+
+! !
!BoundedWrapper class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libview2/BoundedWrapper.st,v 1.1 1996-05-28 22:43:21 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libview2/BoundedWrapper.st,v 1.2 1996-06-05 15:29:32 cg Exp $'
! !
--- a/GeomWrpr.st Wed Jun 05 17:28:29 1996 +0200
+++ b/GeomWrpr.st Wed Jun 05 17:31:20 1996 +0200
@@ -84,6 +84,23 @@
!GeometricWrapper methodsFor:'accessing - bounds'!
+bounds
+ "return the components bounds as default bounds"
+
+ bounds notNil ifTrue:[^ bounds].
+ ^ component bounds
+
+ "Created: 5.6.1996 / 02:29:10 / cg"
+!
+
+bounds:newBounds
+ "set my bounds"
+
+ bounds := newBounds
+
+ "Created: 5.6.1996 / 02:30:00 / cg"
+!
+
preferredBounds
"return the components bounds as preferredBounds"
@@ -92,8 +109,16 @@
"Created: 9.5.1996 / 10:28:10 / cg"
! !
+!GeometricWrapper methodsFor:'view protocol mimicri'!
+
+realize
+ "my container realized itself. Ignored here"
+
+ "Created: 5.6.1996 / 02:32:39 / cg"
+! !
+
!GeometricWrapper class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libview2/Attic/GeomWrpr.st,v 1.4 1996-05-28 22:43:09 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libview2/Attic/GeomWrpr.st,v 1.5 1996-06-05 15:31:20 cg Exp $'
! !
--- a/GeometricWrapper.st Wed Jun 05 17:28:29 1996 +0200
+++ b/GeometricWrapper.st Wed Jun 05 17:31:20 1996 +0200
@@ -84,6 +84,23 @@
!GeometricWrapper methodsFor:'accessing - bounds'!
+bounds
+ "return the components bounds as default bounds"
+
+ bounds notNil ifTrue:[^ bounds].
+ ^ component bounds
+
+ "Created: 5.6.1996 / 02:29:10 / cg"
+!
+
+bounds:newBounds
+ "set my bounds"
+
+ bounds := newBounds
+
+ "Created: 5.6.1996 / 02:30:00 / cg"
+!
+
preferredBounds
"return the components bounds as preferredBounds"
@@ -92,8 +109,16 @@
"Created: 9.5.1996 / 10:28:10 / cg"
! !
+!GeometricWrapper methodsFor:'view protocol mimicri'!
+
+realize
+ "my container realized itself. Ignored here"
+
+ "Created: 5.6.1996 / 02:32:39 / cg"
+! !
+
!GeometricWrapper class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libview2/GeometricWrapper.st,v 1.4 1996-05-28 22:43:09 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libview2/GeometricWrapper.st,v 1.5 1996-06-05 15:31:20 cg Exp $'
! !
--- a/VComponent.st Wed Jun 05 17:28:29 1996 +0200
+++ b/VComponent.st Wed Jun 05 17:31:20 1996 +0200
@@ -170,6 +170,16 @@
"Modified: 9.5.1996 / 00:13:39 / cg"
! !
+!VisualComponent methodsFor:'accessing-mvc'!
+
+model
+ "return nil - generic components have no model"
+
+ ^ nil
+
+ "Created: 5.6.1996 / 14:18:16 / cg"
+! !
+
!VisualComponent methodsFor:'displaying'!
displayOn:aGC x:x y:y
@@ -290,5 +300,5 @@
!VisualComponent class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libview2/Attic/VComponent.st,v 1.9 1996-06-05 15:22:58 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libview2/Attic/VComponent.st,v 1.10 1996-06-05 15:30:54 cg Exp $'
! !
--- a/VisualComponent.st Wed Jun 05 17:28:29 1996 +0200
+++ b/VisualComponent.st Wed Jun 05 17:31:20 1996 +0200
@@ -170,6 +170,16 @@
"Modified: 9.5.1996 / 00:13:39 / cg"
! !
+!VisualComponent methodsFor:'accessing-mvc'!
+
+model
+ "return nil - generic components have no model"
+
+ ^ nil
+
+ "Created: 5.6.1996 / 14:18:16 / cg"
+! !
+
!VisualComponent methodsFor:'displaying'!
displayOn:aGC x:x y:y
@@ -290,5 +300,5 @@
!VisualComponent class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libview2/VisualComponent.st,v 1.9 1996-06-05 15:22:58 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libview2/VisualComponent.st,v 1.10 1996-06-05 15:30:54 cg Exp $'
! !