--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/ShadowView.st Fri Jul 16 11:42:20 1993 +0200
@@ -0,0 +1,133 @@
+"
+ COPYRIGHT (c) 1991-93 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.
+"
+
+View subclass:#ShadowView
+ instanceVariableNames:'myView shadowLength shadow imageUnderShadow'
+ classVariableNames:''
+ poolDictionaries:''
+ category:'Views-Basic'
+!
+
+ShadowView comment:'
+
+COPYRIGHT (c) 1991-93 by Claus Gittinger
+ All Rights Reserved
+
+just to give PopUps and ModalBoxes a shadow. A ShadowView just paints black.
+The instance variable myView is the view, the shadow is for.
+
+%W% %E%
+written nov 91 by claus.
+real shadow added jun-93 by claus (if shadowColor is nil)
+'!
+
+!ShadowView methodsFor:'initialization'!
+
+initialize
+ super initialize.
+ borderWidth := 0.
+ shadow := Black.
+
+ "the length of the shadow from myView"
+ shadowLength := (device pixelPerMillimeter * 1.0) rounded
+!
+
+realize
+ "realize the shadowView some distance away from myView"
+
+ |root shW shH right bot|
+
+ myView notNil ifTrue:[
+ self origin:(myView origin + (myView borderWidth * 2) + shadowLength) extent:(myView extent).
+
+ imageUnderShadow := Form width:width height:height depth:device depth on:device.
+ imageUnderShadow initGC.
+ device setClipByChildren:false in:imageUnderShadow gcId.
+
+ shW := shadowLength x.
+ shH := shadowLength y.
+ right := width - shW.
+ bot := height - shH.
+
+ root := DisplayRootView new.
+ imageUnderShadow copyFrom:root x:(self origin x + right) y:(self origin y)
+ toX:right y:0 width:shW height:height.
+
+ imageUnderShadow copyFrom:root x:(self origin x) y:(self origin y + bot)
+ toX:0 y:bot width:width height:shH.
+
+ "grey out image in area"
+
+ imageUnderShadow foreground:(Color colorId:0) background:(Color colorId:-1).
+ imageUnderShadow mask:(Form mediumGreyFormOn:device).
+ imageUnderShadow function:#and.
+ imageUnderShadow fillRectangleX:0 y:0 width:width height:height.
+
+ imageUnderShadow foreground:(Color black on:device) background:(Color colorId:0).
+ imageUnderShadow function:#or.
+ imageUnderShadow fillRectangleX:0 y:0 width:width height:height.
+
+ super realize.
+ self raise
+ ]
+!
+
+unrealize
+ "realize the shadowView some distance away from myView"
+
+ imageUnderShadow := nil.
+ super unrealize.
+!
+
+create
+ super create.
+ self backingStore:false.
+ self saveUnder:true
+! !
+
+!ShadowView methodsFor:'events'!
+
+redraw
+ "fill all of myself with black"
+
+"
+ self foreground:(Color colorId:-1) background:(Color colorId:0).
+ self function:#copy.
+"
+ self copyFrom:imageUnderShadow x:(width - shadowLength x) y:0
+ toX:(width - shadowLength x) y:0 width:shadowLength x height:height.
+ self copyFrom:imageUnderShadow x:0 y:(height - shadowLength y)
+ toX:0 y:(height - shadowLength y) width:width height:shadowLength y.
+
+"
+ self paint:shadow.
+ self fillRectangleX:0 y:0 width:width height:height
+"
+! !
+
+!ShadowView methodsFor:'accessing'!
+
+shadowColor:aColor
+ "to set the shadow color"
+
+ shadow := aColor
+!
+
+for:aView
+ "set the view I am for"
+
+ myView := aView
+!
+
+createOnTop
+ ^ true
+! !