[FIX][ENH] Drag over sys windows

Michael Rueger m.rueger at acm.org
Tue May 9 22:50:52 UTC 2000


Hi all,

Change Set:		SysWindow-dnd
Date:			9 May 2000
Author:			Michael Rueger

This changeset enables drag'n'drop events on passive system windows.
Passive windows still stay locked, but if a window is not supposed to
even receive dnd events the dnd has to be disabled explicitely.

Michael
-------------- next part --------------
'From Squeak2.8alpha of 19 January 2000 [latest update: #2052] on 9 May 2000 at 3:45:12 pm'!
"Change Set:		SysWindow-dnd
Date:			9 May 2000
Author:			Michael Rueger

This changeset enables drag'n'drop events on passive system windows.
Passive windows still stay locked, but if a window is not supposed to even receive dnd events the dnd has to be disabled explicitely.
"!

!HandMorph methodsFor: 'event handling' stamp: 'mir 5/9/2000 15:23'!
dragOverList: evt

	| p roots mList mm root |
	p _ evt cursorPoint.
	roots _ self world rootMorphsAt: p.  "root morphs in world"
	roots isEmpty
		ifTrue: [^EmptyArray]
		ifFalse: [root _ roots first].
	mList _ root morphsAt: p.
	mList size > 0 ifTrue:
		["NOTE: We really only want the top morph and all its owners"
		mm _ mList first.
		mList _ OrderedCollection new.
		[mm == root] whileFalse:
			[mList addLast: mm.
			mm _ mm owner].
		mList add: root].
	^ mList! !

!HandMorph methodsFor: 'event handling' stamp: 'mir 5/9/2000 15:27'!
dragOverListAt: p

	|  roots mList mm root |
	roots _ self world rootMorphsAt: p.  "root morphs in world"
	roots isEmpty
		ifTrue: [^EmptyArray]
		ifFalse: [root _ roots first].
	mList _ root morphsAt: p.
	mList size > 0 ifTrue:
		["NOTE: We really only want the top morph and all its owners"
		mm _ mList first.
		mList _ OrderedCollection new.
		[mm == root] whileFalse:
			[mList addLast: mm.
			mm _ mm owner].
		mList add: root].
	^ mList! !

!HandMorph methodsFor: 'event handling' stamp: 'mir 5/9/2000 15:28'!
handleDragOver: evt
	| mList allMouseOvers leftMorphs enteredMorphs |
	owner ifNil: [^ self].  "this hand is not in a world"
	"Start with a list consisting of the topmost unlocked morph in the
	innermost frame (pasteUp), and all of its containers in that frame."
	mList _ self dragOverList: evt.

	"Make a list of all potential drag-overs..."
	allMouseOvers _ mList select:
		[:m | m handlesMouseOverDragging: (evt transformedBy: (m transformFrom: self))].
	leftMorphs _ dragOverMorphs select: [:m | (allMouseOvers includes: m) not].
	enteredMorphs _ allMouseOvers select: [:m | (dragOverMorphs includes: m) not].

	"Notify and remove any morphs that have just been left..."
	leftMorphs do: [:m |
		dragOverMorphs remove: m.
		m mouseLeaveDragging: (evt transformedBy: (m transformFrom: self))].

	"Add any new mouse-overs and send mouseEnter:"
	enteredMorphs do: [:m |
		dragOverMorphs add: m.
		mouseOverMorphs remove: m ifAbsent: [].  "Cant be in two places at once"
		m mouseEnterDragging: (evt transformedBy: (m transformFrom: self))].! !



More information about the Squeak-dev mailing list