[squeak-dev] The Trunk: Morphic-mt.761.mcz

commits at source.squeak.org commits at source.squeak.org
Thu Feb 26 17:33:11 UTC 2015


Marcel Taeumel uploaded a new version of Morphic to project The Trunk:
http://source.squeak.org/trunk/Morphic-mt.761.mcz

==================== Summary ====================

Name: Morphic-mt.761
Author: mt
Time: 26 February 2015, 6:32:43.542 pm
UUID: 5cad7567-3a07-a94e-8544-72737cc6bbf0
Ancestors: Morphic-mt.760

Make pluggable buttons use the appropriate code for handling rounded corners (e.g. like system windows do).

Corner rounding is now also configurable for buttons. Same preference: 'Preferred corner radius'.

=============== Diff against Morphic-mt.760 ===============

Item was changed:
  ----- Method: PluggableButtonMorph>>drawOn: (in category 'drawing') -----
  drawOn: aCanvas 
  	| cc gradient borderColor fill |
  	cc := self color.
  	cc isTransparent ifTrue:[cc := Color gray: 0.9].
  	self enabled ifFalse:[cc := Color lightGray].
  	cc brightness > 0.9 ifTrue:[cc := cc adjustBrightness: 0.9 - cc brightness].
  	showSelectionFeedback ifTrue:[
  		borderColor := cc muchDarker.
  		gradient := GradientFillStyle ramp: {
  			0.0 -> cc muchDarker.
  			0.1-> (cc adjustBrightness: -0.2).
  			0.5 -> cc.
  			0.9-> (cc adjustBrightness: -0.1).
  			1 -> cc muchDarker}.
  		cc := cc muchDarker.
  	] ifFalse:[
  		borderColor := Color lightGray.
  		gradient := GradientFillStyle ramp: {
  			0.0 -> Color white.
  			0.1-> (cc adjustBrightness: 0.05).
  			0.6 -> (cc darker)}.
  	].
  	gradient origin: bounds topLeft.
  	gradient direction: 0 at self height.
  
  	PluggableButtonMorph gradientButton
  		ifFalse: [fill := SolidFillStyle color: cc]
  		ifTrue: [fill := gradient].
  
+ 	^ self wantsRoundedCorners
- 	^ self roundedButtonCorners
  		ifTrue: [aCanvas 
  				frameAndFillRoundRect: bounds 
+ 				radius: self class preferredCornerRadius
- 				radius: 8 
  				fillStyle: fill 
  				borderWidth: 1 
  				borderColor: borderColor]
  		ifFalse: [aCanvas 
  				frameAndFillRectangle: self innerBounds 
  				fillColor: fill asColor 
  				borderWidth: 1 
  				borderColor: borderColor darker;
  				fillRectangle: (self innerBounds insetBy: 1) 
  				fillStyle: fill]!

Item was removed:
- ----- Method: PluggableButtonMorph>>roundedButtonCorners (in category 'drawing') -----
- roundedButtonCorners
- 	"If the button is intended to invoke a menu for selection, provide a visual
- 	distinction by inverting the rounded corners attribute."
- 	^self class roundedButtonCorners
- 		xor: style == #menuButton!

Item was added:
+ ----- Method: PluggableButtonMorph>>wantsRoundedCorners (in category 'rounding') -----
+ wantsRoundedCorners
+ 	"If the button is intended to invoke a menu for selection, provide a visual
+ 	distinction by inverting the rounded corners attribute."
+ 
+ 	^ (self class roundedButtonCorners or: [super wantsRoundedCorners])
+ 		xor: style == #menuButton!



More information about the Squeak-dev mailing list