'From Cuis 5.0 [latest update: #4520] on 9 January 2021 at 1:09:55 pm'!
!classDefinition: #FlashMorphMenuItem category: #'Morphic-Menus'!
MenuItemMorph subclass: #FlashMorphMenuItem
	instanceVariableNames: ''
	classVariableNames: ''
	poolDictionaries: ''
	category: 'Morphic-Menus'!

!DisplayScreen methodsFor: 'displaying' stamp: 'KenD 1/9/2021 13:04:40'!
flash2: aRectangle 
	"Flash the area of the screen defined by the given rectangle."

	self reverse: aRectangle.
	self forceToScreen: aRectangle.
	(Delay forMilliseconds: 500) wait.
	self reverse: aRectangle.
	self forceToScreen: aRectangle.
	(Delay forMilliseconds: 100) wait.! !


!Morph methodsFor: 'macpal' stamp: 'KenD 1/9/2021 13:02:39'!
flash2

	self displayBounds ifNotNil: [ :r |
		Display flash2: r ]! !


!FlashMorphMenuItem methodsFor: 'events' stamp: 'KenD 1/9/2021 13:03:43'!
mouseEnter: evt

	super mouseEnter: evt.
	target ifNotNil: [ 
		(target = self world) ifTrue: [ ^self ]. "Don't flash the world!!"
		target flash2
	]! !


!MenuMorph methodsFor: 'construction' stamp: 'KenD 1/9/2021 08:34:47'!
add: aString flashTarget: target action: aSymbol argumentList: argList
	"Append a menu item with the given label. If the item is selected, it will send the given selector to the target object with the given arguments. If the selector takes one more argument than the number of arguments in the given list, then the triggering event is supplied as as the last argument.  Answer the appended menu item."

	| item |
	item _ FlashMorphMenuItem new
		contents: aString;
		target: target selector: aSymbol arguments: argList asArray.
	self addMorphBack: item.
	^ item! !


!Morph methodsFor: 'meta-actions' stamp: 'KenD 1/9/2021 08:35:36'!
addEmbeddingMenuItemsTo: aMenu hand: aHandMorph
	| menu |
	menu _ MenuMorph new defaultTarget: self.
	self potentialEmbeddingTargets reverseDo: [:m | 
		menu 
			add: m class name asString 
			flashTarget: m 
			action: #addMorphFrontFromWorldPosition: 
			argumentList: {self}].
	aMenu ifNotNil:[
		menu submorphCount > 0 
			ifTrue:[aMenu add:'embed into' subMenu: menu].
	].
	^menu! !


!FlashMorphMenuItem reorganize!
('events' mouseEnter:)
!

