'From Squeak2.6 of 15 October 1999 [latest update: #1555] on 1 November 1999 at 3:13:43 am'! "Change Set: InsetBorderFix-dew Date: 1 November 1999 Author: Doug Way Fixes #inset and #raised borders so that if a morph is transparent, its border highlighting colors will be based on whichever owner is non-transparent (since that will be the actual color in the area where the border is drawn)."! !Morph methodsFor: 'accessing' stamp: 'dew 11/1/1999 03:13'! colorForInsets "Return the color to be used for shading inset borders. The default is my own color, but it might want to be, eg, my owner's color. Whoever's color ends up prevailing, the color itself gets the last chance to determine, so that when, for example, an InfiniteForm serves as the color, callers won't choke on some non-Color object being returned." "If the color is transparent, we should recursively check the owners until we find the first non-transparent color to use." color isTransparent ifFalse: [^ color colorForInsets] ifTrue: [owner isNil ifTrue: [^ color] ifFalse: [^ owner colorForInsets]] ! ! !BorderedMorph methodsFor: 'drawing' stamp: 'dew 10/24/1999 00:25'! drawOn: aCanvas "Draw a rectangle with a solid, inset, or raised border. Note: the raised border color is generated from the receiver's own color, while the inset border color is generated from the color of its owner. This behavior is visually more consistent. Thanks to Hans-Martin Mosner." | raisedColor insetColor | borderWidth = 0 ifTrue: [ "no border" "Note: This is the hook for border styles. When converting to the new borders we'll just put 0 into the borderWidth" super drawOn: aCanvas. ^ self]. borderColor == #raised ifTrue: [ color isTransparent ifTrue: [raisedColor _ owner colorForInsets] ifFalse: [raisedColor _ color]. "Use a hack for now" aCanvas fillRectangle: self bounds fillStyle: self fillStyle. ^ aCanvas frameAndFillRectangle: bounds fillColor: Color transparent borderWidth: borderWidth topLeftColor: (borderWidth = 1 ifTrue: [raisedColor twiceLighter] ifFalse: [raisedColor lighter]) bottomRightColor: (borderWidth = 1 ifTrue: [raisedColor twiceDarker] ifFalse: [raisedColor darker])]. borderColor == #inset ifTrue: [ insetColor _ owner colorForInsets. aCanvas fillRectangle: self bounds fillStyle: self fillStyle. ^ aCanvas frameAndFillRectangle: bounds fillColor: Color transparent borderWidth: borderWidth topLeftColor: (borderWidth = 1 ifTrue: [insetColor twiceDarker] ifFalse: [insetColor darker]) bottomRightColor: (borderWidth = 1 ifTrue: [insetColor twiceLighter] ifFalse: [insetColor lighter])]. "solid color border" aCanvas fillRectangle: self bounds fillStyle: self fillStyle. aCanvas frameAndFillRectangle: bounds fillColor: Color transparent borderWidth: borderWidth borderColor: borderColor.! !