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

commits at source.squeak.org commits at source.squeak.org
Mon Feb 28 11:44:02 UTC 2022


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

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

Name: Morphic-mt.1914
Author: mt
Time: 28 February 2022, 12:43:57.322532 pm
UUID: 5f3c3711-be3d-46f3-994e-446ca3c415db
Ancestors: Morphic-mt.1913

Removes the 'allButtons' hack from PluggableButtonMorph because it was in serious conflict with how layouting and event dispatching works (e.g. #visible: and #disableLayout:) in Morphic.

=============== Diff against Morphic-mt.1913 ===============

Item was changed:
  Morph subclass: #PluggableButtonMorph
+ 	instanceVariableNames: 'model label font getStateSelector actionSelector getLabelSelector getMenuSelector shortcutCharacter askBeforeChanging triggerOnMouseDown offColor onColor feedbackColor showSelectionFeedback arguments argumentsProvider argumentsSelector style hoverColor borderColor textColor labelOffset wantsGradient'
- 	instanceVariableNames: 'model label font getStateSelector actionSelector getLabelSelector getMenuSelector shortcutCharacter askBeforeChanging triggerOnMouseDown offColor onColor feedbackColor showSelectionFeedback allButtons arguments argumentsProvider argumentsSelector style hoverColor borderColor textColor labelOffset wantsGradient'
  	classVariableNames: 'GradientButton RoundedButtonCorners'
  	poolDictionaries: ''
  	category: 'Morphic-Pluggable Widgets'!
  
  !PluggableButtonMorph commentStamp: '<historical>' prior: 0!
  A PluggableButtonMorph is a combination of an indicator for a boolean value stored in its model and an action button. The action of a button is often, but not always, to toggle the boolean value that it shows. Its pluggable selectors are:
  
  		getStateSelector		fetch a boolean value from the model
  		actionSelector		invoke this button's action on the model
  		getLabelSelector		fetch this button's lable from the model
  		getMenuSelector		fetch a pop-up menu for this button from the model
  
  Any of the above selectors can be nil, meaning that the model does not supply behavior for the given action, and the default behavior should be used. For example, if getStateSelector is nil, then this button shows the state of a read-only boolean that is always false.
  
  The model informs its view(s) of changes by sending #changed: to itself with getStateSelector as a parameter. The view tells the model when the button is pressed by sending actionSelector.
  
  If the actionSelector takes one or more arguments, then the following are relevant:
  		arguments			A list of arguments to provide when the actionSelector is called.
  		argumentsProvider	The object that is sent the argumentSelector to obtain arguments, if dynamic
  		argumentsSelector	The message sent to the argumentProvider to obtain the arguments.
  
  Options:
  	askBeforeChanging		have model ask user before allowing a change that could lose edits
  	triggerOnMouseDown	do this button's action on mouse down (vs. up) transition
  	shortcutCharacter		a place to record an optional shortcut key
  !

Item was changed:
  ----- Method: PluggableButtonMorph>>mouseDown: (in category 'event handling') -----
  mouseDown: evt
- 	"Details: If this button is triggered on mouse down or the event is the menu gesture, handle it immediately. Otherwise, make a list of buttons (including the receiver) for mouseMove feedback. This allows a simple radio-button effect among the button submorphs of a given morph."
  
- 	allButtons := nil.
  	evt yellowButtonPressed ifTrue: [^ self invokeMenu: evt].
  	triggerOnMouseDown
  		ifTrue: [self performAction]
+ 		ifFalse: [self updateFillStyle: evt].
- 		ifFalse: [
- 			allButtons := owner submorphs select: [:m | m class = self class].
- 			self updateFillStyle: evt].
  !

Item was changed:
  ----- Method: PluggableButtonMorph>>mouseMove: (in category 'event handling') -----
  mouseMove: evt
  
+ 	self updateFillStyle: evt.!
- 	allButtons ifNil: [^ self].
- 	allButtons do: [:m | m updateFillStyle: evt].!

Item was changed:
  ----- Method: PluggableButtonMorph>>mouseUp: (in category 'event handling') -----
  mouseUp: evt
  
  	self updateFillStyle: evt.
+ 	(self containsPoint: evt cursorPoint)
+ 		ifTrue: [self performAction].!
- 	
- 	allButtons ifNil: [^ self].
- 	allButtons do: [:m |
- 		(m containsPoint: evt cursorPoint) ifTrue: [m performAction]].
- 	allButtons := nil.
- 	self changed.
- !



More information about the Squeak-dev mailing list