'From Squeak3.7beta of ''1 April 2004'' [latest update: #5878] on 15 April 2004 at 10:58:09 am'! "Change Set: BorderFixes-nk (v2) Date: 15 April 2004 Author: Ned Konz This change set allows Players to change border widths to 0 and back up without losing the borders. I am proposing this instead of the 'Player borders' fix that Karl Ramberg posted on 9 April (ID 21791). This has the advantages of: - allowing for alternative implementations of borderWidth: and borderColor: - removing intimate knowledge of border style mechanisms from Player. v2: fix for borderColor: #raised, etc. "! !Morph methodsFor: 'accessing' stamp: 'nk 4/15/2004 10:55'! borderColor: aColorOrSymbolOrNil "Unfortunately, the argument to borderColor could be more than just a color. It could also be a symbol, in which case it is to be interpreted as a style identifier. But I might not be able to draw that kind of border, so it may have to be ignored. Or it could be nil, in which case I should revert to the default border." | style newStyle | style := self borderStyle. style baseColor = aColorOrSymbolOrNil ifTrue: [^ self]. aColorOrSymbolOrNil isColor ifTrue: [style style = #none "default border?" ifTrue: [self borderStyle: (SimpleBorder width: 0 color: aColorOrSymbolOrNil)] ifFalse: [style baseColor: aColorOrSymbolOrNil. self changed]. ^ self]. self borderStyle: ( ({ nil. #none } includes: aColorOrSymbolOrNil) ifTrue: [BorderStyle default] ifFalse: [ "a symbol" self doesBevels ifFalse: [ ^self ]. newStyle := (BorderStyle perform: aColorOrSymbolOrNil) color: style color; width: style width; yourself. (self canDrawBorder: newStyle) ifTrue: [newStyle] ifFalse: [style]])! ! !Morph methodsFor: 'accessing' stamp: 'nk 4/14/2004 17:48'! borderWidth: aNumber | style | style _ self borderStyle. style width = aNumber ifTrue: [ ^self ]. style style = #none ifTrue: [ self borderStyle: (SimpleBorder width: aNumber color: Color transparent) ] ifFalse: [ style width: aNumber. self changed ]. ! ! !Morph methodsFor: 'accessing' stamp: 'nk 4/15/2004 07:50'! doesBevels "To return true means that this object can show bevelled borders, and therefore can accept, eg, #raised or #inset as valid borderColors. Must be overridden by subclasses that do not support bevelled borders." ^ false! ! !Player methodsFor: 'slot getters/setters' stamp: 'nk 4/13/2004 18:55'! setBorderColor: aColor "Set the border color as requested" costume renderedMorph borderColor: aColor! ! !Player methodsFor: 'slot getters/setters' stamp: 'nk 4/13/2004 18:55'! setBorderWidth: aWidth "Set the border width to the given number" costume renderedMorph borderWidth: aWidth! !