WARNING: Most of this content (with the exception of the Mozilla 1.9 XPCOM reference) is very old, and can be expected to be out of date and possibly obsolete. For better XUL documentation, please visit the XUL hub at the Mozilla Developer Center.

nsIDragService

IID:E8CD74A6-8BB6-4D27-9C65-4ED1B4398F8C
Inherits From:nsISupports

This interface is intended to be used as a service. To create an object implementing this interface:

var obj = Components.classes["@mozilla.org/widget/dragservice;1"].
            getService(Components.interfaces.nsIDragService);

This interface is implemented by the following components:


Constants

PRInt32 DRAGDROP_ACTION_NONE = 0
PRInt32 DRAGDROP_ACTION_COPY = 1
PRInt32 DRAGDROP_ACTION_MOVE = 2
PRInt32 DRAGDROP_ACTION_LINK = 4

Methods

void endDragSession ( PRBool doneDrag ) void fireDragEventAtSource ( PRUint32 msg ) nsIDragSession getCurrentSession ( ) void invokeDragSession ( nsIDOMNode DOMNode , nsISupportsArray transferables , nsIScriptableRegion region , PRUint32 actionType ) void invokeDragSessionWithImage ( nsIDOMNode DOMNode , nsISupportsArray transferableArray , nsIScriptableRegion region , PRUint32 actionType , nsIDOMNode image , PRInt32 imageX , PRInt32 imageY , nsIDOMMouseEvent dragEvent ) void invokeDragSessionWithSelection ( nsISelection selection , nsISupportsArray transferableArray , PRUint32 actionType , nsIDOMMouseEvent dragEvent ) void startDragSession ( )

void endDragSession ( PRBool doneDrag )

Tells the Drag Service to end a drag session. This is called when an external drag occurs

If doneDrag is true, the drag has finished, otherwise the drag has just left the window.

Arguments:
doneDrag

void fireDragEventAtSource ( PRUint32 msg )

Fire a drag event at the source of the drag

Arguments:
msg

nsIDragSession getCurrentSession ( )

Returns the current Drag Session


void invokeDragSession ( nsIDOMNode DOMNode , nsISupportsArray transferables , nsIScriptableRegion region , PRUint32 actionType )

Starts a modal drag session with an array of transaferables

Arguments:
DOMNode
transferables: - an array of transferables to be dragged
region: - a region containing rectangles for cursor feedback, in window coordinates.
actionType: - specified which of copy/move/link are allowed

void invokeDragSessionWithImage ( nsIDOMNode DOMNode , nsISupportsArray transferableArray , nsIScriptableRegion region , PRUint32 actionType , nsIDOMNode image , PRInt32 imageX , PRInt32 imageY , nsIDOMMouseEvent dragEvent )

Starts a modal drag session using an image. The first four arguments are the same as invokeDragSession.

A custom image may be specified using the image argument. If this is supplied, the imageX and imageY arguments specify the offset within the image where the cursor would be positioned. That is, when the image is drawn, it is offset up and left the amount so that the cursor appears at that location within the image.

If image is null, imageX and imageY are not used and the image is instead determined from the source node dOMNode, and the offset calculated so that the initial location for the image appears in the same screen position as where the element is located. The node must be within a document.

Currently, supported images are all DOM nodes. If this is an HTML or , the drag image is taken from the image data. If the element is in a document, it will be rendered at its displayed size, othewise, it will be rendered at its real size. For other types of elements, the element is rendered into an offscreen buffer in the same manner as it is currently displayed. The document selection is hidden while drawing.

The dragEvent must be supplied as the current screen coordinates of the event are needed to calculate the image location.

Arguments:
DOMNode
transferableArray
region
actionType
image
imageX
imageY
dragEvent

void invokeDragSessionWithSelection ( nsISelection selection , nsISupportsArray transferableArray , PRUint32 actionType , nsIDOMMouseEvent dragEvent )

Start a modal drag session using the selection as the drag image. The dragEvent must be supplied as the current screen coordinates of the event are needed to calculate the image location.

Arguments:
selection
transferableArray
actionType
dragEvent

void startDragSession ( )

Tells the Drag Service to start a drag session. This is called when an external drag occurs

Reference documentation is generated from Mozilla's source.