'From Cuis 5.0 [latest update: #4992] on 1 December 2021 at 3:56:19 pm'!

!Morph methodsFor: 'halos and balloon help' stamp: 'jmv 12/1/2021 15:49:30'!
wantsBalloonWordWrap
	"Answer true if receiver wants to show word-wrapped balloon help."

	^ self hasProperty: #wantsBalloonWordWrap! !


!HoverHelpMorph class methodsFor: 'instance creation' stamp: 'jmv 12/1/2021 15:47:33'!
contents: aString doWordWrap: doWordWrap
	"Make up and return a HoverHelp for morph.

	(HoverHelpMorph contents: 'This is a HoverHelpMorph with a rather long contents to see how it gets wrapped. Is this long enough? Maybe a few more words are in order.' doWordWrap: true) openInHand

	(HoverHelpMorph contents: 'This is a HoverHelpMorph with a rather long contents to see how it gets wrapped. Is this long enough? Maybe a few more words are in order.' doWordWrap: false) openInHand
	"

	^ doWordWrap
		ifTrue: [ self contentsWrapped: aString ]
		ifFalse: [ self contents: aString ]! !


!Morph methodsFor: 'halos and balloon help' stamp: 'jmv 12/1/2021 15:50:11'!
showBalloon: msgString hand: aHand
	"Pop up a balloon containing the given string,
	first removing any existing BalloonMorphs in the world."

	| w balloon h |
	(w _ self world) ifNil: [^ self].
	h _ aHand.
	h ifNil: [
		h _ w activeHand ].
	balloon _ HoverHelpMorph contents: msgString doWordWrap: self wantsBalloonWordWrap.
	
	"Do it in a while. In some cases, processing the event that might have triggered us might also remove any Help Balloon"
	UISupervisor whenUIinSafeState: [
		balloon popUpForHand: h ]! !

