michael@0: /* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- michael@0: * michael@0: * This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #include "nsISupports.idl" michael@0: #include "nsISupportsArray.idl" michael@0: #include "nsIDragSession.idl" michael@0: #include "nsIScriptableRegion.idl" michael@0: michael@0: michael@0: interface nsIDOMNode; michael@0: interface nsIDOMDragEvent; michael@0: interface nsIDOMDataTransfer; michael@0: interface nsISelection; michael@0: michael@0: [scriptable, uuid(82B58ADA-F490-4C3D-B737-1057C4F1D052), builtinclass] michael@0: interface nsIDragService : nsISupports michael@0: { michael@0: const long DRAGDROP_ACTION_NONE = 0; michael@0: const long DRAGDROP_ACTION_COPY = 1; michael@0: const long DRAGDROP_ACTION_MOVE = 2; michael@0: const long DRAGDROP_ACTION_LINK = 4; michael@0: const long DRAGDROP_ACTION_UNINITIALIZED = 64; michael@0: michael@0: /** michael@0: * Starts a modal drag session with an array of transaferables michael@0: * michael@0: * @param aTransferables - an array of transferables to be dragged michael@0: * @param aRegion - a region containing rectangles for cursor feedback, michael@0: * in window coordinates. michael@0: * @param aActionType - specified which of copy/move/link are allowed michael@0: */ michael@0: void invokeDragSession ( in nsIDOMNode aDOMNode, in nsISupportsArray aTransferables, michael@0: in nsIScriptableRegion aRegion, in unsigned long aActionType ); michael@0: michael@0: /** michael@0: * Starts a modal drag session using an image. The first four arguments are michael@0: * the same as invokeDragSession. michael@0: * michael@0: * A custom image may be specified using the aImage argument. If this is michael@0: * supplied, the aImageX and aImageY arguments specify the offset within michael@0: * the image where the cursor would be positioned. That is, when the image michael@0: * is drawn, it is offset up and left the amount so that the cursor appears michael@0: * at that location within the image. michael@0: * michael@0: * If aImage is null, aImageX and aImageY are not used and the image is instead michael@0: * determined from the source node aDOMNode, and the offset calculated so that michael@0: * the initial location for the image appears in the same screen position as michael@0: * where the element is located. The node must be within a document. michael@0: * michael@0: * Currently, supported images are all DOM nodes. If this is an HTML or michael@0: * , the drag image is taken from the image data. If the element is in michael@0: * a document, it will be rendered at its displayed size, othewise, it will be michael@0: * rendered at its real size. For other types of elements, the element is michael@0: * rendered into an offscreen buffer in the same manner as it is currently michael@0: * displayed. The document selection is hidden while drawing. michael@0: * michael@0: * The aDragEvent must be supplied as the current screen coordinates of the michael@0: * event are needed to calculate the image location. michael@0: */ michael@0: void invokeDragSessionWithImage(in nsIDOMNode aDOMNode, michael@0: in nsISupportsArray aTransferableArray, michael@0: in nsIScriptableRegion aRegion, michael@0: in unsigned long aActionType, michael@0: in nsIDOMNode aImage, michael@0: in long aImageX, michael@0: in long aImageY, michael@0: in nsIDOMDragEvent aDragEvent, michael@0: in nsIDOMDataTransfer aDataTransfer); michael@0: michael@0: /** michael@0: * Start a modal drag session using the selection as the drag image. michael@0: * The aDragEvent must be supplied as the current screen coordinates of the michael@0: * event are needed to calculate the image location. michael@0: */ michael@0: void invokeDragSessionWithSelection(in nsISelection aSelection, michael@0: in nsISupportsArray aTransferableArray, michael@0: in unsigned long aActionType, michael@0: in nsIDOMDragEvent aDragEvent, michael@0: in nsIDOMDataTransfer aDataTransfer); michael@0: michael@0: /** michael@0: * Returns the current Drag Session michael@0: */ michael@0: nsIDragSession getCurrentSession ( ) ; michael@0: michael@0: /** michael@0: * Tells the Drag Service to start a drag session. This is called when michael@0: * an external drag occurs michael@0: */ michael@0: void startDragSession ( ) ; michael@0: michael@0: /** michael@0: * Tells the Drag Service to end a drag session. This is called when michael@0: * an external drag occurs michael@0: * michael@0: * If aDoneDrag is true, the drag has finished, otherwise the drag has michael@0: * just left the window. michael@0: */ michael@0: void endDragSession ( in boolean aDoneDrag ) ; michael@0: michael@0: /** michael@0: * Fire a drag event at the source of the drag michael@0: */ michael@0: void fireDragEventAtSource ( in unsigned long aMsg ); michael@0: michael@0: /** michael@0: * Increase/decrease dragging suppress level by one. michael@0: * If level is greater than one, dragging is disabled. michael@0: */ michael@0: void suppress(); michael@0: void unsuppress(); michael@0: michael@0: [noscript] void dragMoved(in long aX, in long aY); michael@0: }; michael@0: michael@0: michael@0: %{ C++ michael@0: michael@0: %}