[squeak-dev] The Inbox: Morphic-ct.1742.mcz

commits at source.squeak.org commits at source.squeak.org
Fri Mar 19 15:00:57 UTC 2021


A new version of Morphic was added to project The Inbox:
http://source.squeak.org/inbox/Morphic-ct.1742.mcz

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

Name: Morphic-ct.1742
Author: ct
Time: 19 March 2021, 4:00:48.463632 pm
UUID: 136ee067-4ddc-a84e-86da-f3976f21093a
Ancestors: Morphic-mt.1741

Proposal: Adds #mouseFocusChange: hook analogously to #keyboardFocusChange:.

An examplary use case for this can be found in ColorContextMenu [1, 2].

[1] https://github.com/LinqLover/ColorContextMenu/blob/master/src/ColorContextMenu-Core.package/RadialMenuMorph.class/instance/mouseFocusChange..st
[2] http://forum.world.st/ann-Radial-Menu-for-Squeak-td5127916.html

=============== Diff against Morphic-mt.1741 ===============

Item was changed:
  ----- Method: HandMorph>>newMouseFocus: (in category 'focus handling') -----
  newMouseFocus: aMorphOrNil
  	"Make the given morph the new mouse focus, canceling the previous mouse focus if any. If the argument is nil, the current mouse focus is cancelled."
+ 
+ 	| newFocus oldFocus |
+ 	oldFocus := self mouseFocus.
+ 	newFocus := aMorphOrNil.
+ 	
+ 	self mouseFocus: newFocus.
+ 	
+ 	oldFocus == newFocus ifFalse: [
+ 		oldFocus ifNotNil: [:m | m mouseFocusChange: false].
+ 		newFocus ifNotNil: [:m | m mouseFocusChange: true]].
+ 	
+ 	^ newFocus!
- 	self mouseFocus: aMorphOrNil.
- !

Item was changed:
  ----- Method: Morph>>keyboardFocusChange: (in category 'event handling') -----
  keyboardFocusChange: aBoolean
+ 	"The message is sent to a morph when its keyboard focus changes. The given argument indicates whether the receiver is gaining (true) or losing (false) the focus. Morphs that accept keystrokes should change their appearance in some way when they are the current keyboard focus."
- 	"The message is sent to a morph when its keyboard focus change. The given argument indicates that the receiver is gaining keyboard focus (versus losing) the keyboard focus. Morphs that accept keystrokes should change their appearance in some way when they are the current keyboard focus."
  
  	self eventHandler
  		ifNotNil: [:h | h keyboardFocusChange: aBoolean fromMorph: self].
+ 	
- 
  	self indicateKeyboardFocus
  		ifTrue: [self changed].!

Item was added:
+ ----- Method: Morph>>mouseFocusChange: (in category 'event handling') -----
+ mouseFocusChange: aBoolean
+ 	"The message is sent to a morph when its mouse focus changes. The given argument indicates whether the receiver is gaining (true) or losing (false) the focus."!



More information about the Squeak-dev mailing list