Thu, 22 Jan 2015 13:21:57 +0100
Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6
michael@0 | 1 | /* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- |
michael@0 | 2 | * |
michael@0 | 3 | * This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 4 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 5 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 6 | |
michael@0 | 7 | #include "nsISupports.idl" |
michael@0 | 8 | #include "nsISupportsArray.idl" |
michael@0 | 9 | #include "nsIDragSession.idl" |
michael@0 | 10 | #include "nsIScriptableRegion.idl" |
michael@0 | 11 | |
michael@0 | 12 | |
michael@0 | 13 | interface nsIDOMNode; |
michael@0 | 14 | interface nsIDOMDragEvent; |
michael@0 | 15 | interface nsIDOMDataTransfer; |
michael@0 | 16 | interface nsISelection; |
michael@0 | 17 | |
michael@0 | 18 | [scriptable, uuid(82B58ADA-F490-4C3D-B737-1057C4F1D052), builtinclass] |
michael@0 | 19 | interface nsIDragService : nsISupports |
michael@0 | 20 | { |
michael@0 | 21 | const long DRAGDROP_ACTION_NONE = 0; |
michael@0 | 22 | const long DRAGDROP_ACTION_COPY = 1; |
michael@0 | 23 | const long DRAGDROP_ACTION_MOVE = 2; |
michael@0 | 24 | const long DRAGDROP_ACTION_LINK = 4; |
michael@0 | 25 | const long DRAGDROP_ACTION_UNINITIALIZED = 64; |
michael@0 | 26 | |
michael@0 | 27 | /** |
michael@0 | 28 | * Starts a modal drag session with an array of transaferables |
michael@0 | 29 | * |
michael@0 | 30 | * @param aTransferables - an array of transferables to be dragged |
michael@0 | 31 | * @param aRegion - a region containing rectangles for cursor feedback, |
michael@0 | 32 | * in window coordinates. |
michael@0 | 33 | * @param aActionType - specified which of copy/move/link are allowed |
michael@0 | 34 | */ |
michael@0 | 35 | void invokeDragSession ( in nsIDOMNode aDOMNode, in nsISupportsArray aTransferables, |
michael@0 | 36 | in nsIScriptableRegion aRegion, in unsigned long aActionType ); |
michael@0 | 37 | |
michael@0 | 38 | /** |
michael@0 | 39 | * Starts a modal drag session using an image. The first four arguments are |
michael@0 | 40 | * the same as invokeDragSession. |
michael@0 | 41 | * |
michael@0 | 42 | * A custom image may be specified using the aImage argument. If this is |
michael@0 | 43 | * supplied, the aImageX and aImageY arguments specify the offset within |
michael@0 | 44 | * the image where the cursor would be positioned. That is, when the image |
michael@0 | 45 | * is drawn, it is offset up and left the amount so that the cursor appears |
michael@0 | 46 | * at that location within the image. |
michael@0 | 47 | * |
michael@0 | 48 | * If aImage is null, aImageX and aImageY are not used and the image is instead |
michael@0 | 49 | * determined from the source node aDOMNode, and the offset calculated so that |
michael@0 | 50 | * the initial location for the image appears in the same screen position as |
michael@0 | 51 | * where the element is located. The node must be within a document. |
michael@0 | 52 | * |
michael@0 | 53 | * Currently, supported images are all DOM nodes. If this is an HTML <image> or |
michael@0 | 54 | * <canvas>, the drag image is taken from the image data. If the element is in |
michael@0 | 55 | * a document, it will be rendered at its displayed size, othewise, it will be |
michael@0 | 56 | * rendered at its real size. For other types of elements, the element is |
michael@0 | 57 | * rendered into an offscreen buffer in the same manner as it is currently |
michael@0 | 58 | * displayed. The document selection is hidden while drawing. |
michael@0 | 59 | * |
michael@0 | 60 | * The aDragEvent must be supplied as the current screen coordinates of the |
michael@0 | 61 | * event are needed to calculate the image location. |
michael@0 | 62 | */ |
michael@0 | 63 | void invokeDragSessionWithImage(in nsIDOMNode aDOMNode, |
michael@0 | 64 | in nsISupportsArray aTransferableArray, |
michael@0 | 65 | in nsIScriptableRegion aRegion, |
michael@0 | 66 | in unsigned long aActionType, |
michael@0 | 67 | in nsIDOMNode aImage, |
michael@0 | 68 | in long aImageX, |
michael@0 | 69 | in long aImageY, |
michael@0 | 70 | in nsIDOMDragEvent aDragEvent, |
michael@0 | 71 | in nsIDOMDataTransfer aDataTransfer); |
michael@0 | 72 | |
michael@0 | 73 | /** |
michael@0 | 74 | * Start a modal drag session using the selection as the drag image. |
michael@0 | 75 | * The aDragEvent must be supplied as the current screen coordinates of the |
michael@0 | 76 | * event are needed to calculate the image location. |
michael@0 | 77 | */ |
michael@0 | 78 | void invokeDragSessionWithSelection(in nsISelection aSelection, |
michael@0 | 79 | in nsISupportsArray aTransferableArray, |
michael@0 | 80 | in unsigned long aActionType, |
michael@0 | 81 | in nsIDOMDragEvent aDragEvent, |
michael@0 | 82 | in nsIDOMDataTransfer aDataTransfer); |
michael@0 | 83 | |
michael@0 | 84 | /** |
michael@0 | 85 | * Returns the current Drag Session |
michael@0 | 86 | */ |
michael@0 | 87 | nsIDragSession getCurrentSession ( ) ; |
michael@0 | 88 | |
michael@0 | 89 | /** |
michael@0 | 90 | * Tells the Drag Service to start a drag session. This is called when |
michael@0 | 91 | * an external drag occurs |
michael@0 | 92 | */ |
michael@0 | 93 | void startDragSession ( ) ; |
michael@0 | 94 | |
michael@0 | 95 | /** |
michael@0 | 96 | * Tells the Drag Service to end a drag session. This is called when |
michael@0 | 97 | * an external drag occurs |
michael@0 | 98 | * |
michael@0 | 99 | * If aDoneDrag is true, the drag has finished, otherwise the drag has |
michael@0 | 100 | * just left the window. |
michael@0 | 101 | */ |
michael@0 | 102 | void endDragSession ( in boolean aDoneDrag ) ; |
michael@0 | 103 | |
michael@0 | 104 | /** |
michael@0 | 105 | * Fire a drag event at the source of the drag |
michael@0 | 106 | */ |
michael@0 | 107 | void fireDragEventAtSource ( in unsigned long aMsg ); |
michael@0 | 108 | |
michael@0 | 109 | /** |
michael@0 | 110 | * Increase/decrease dragging suppress level by one. |
michael@0 | 111 | * If level is greater than one, dragging is disabled. |
michael@0 | 112 | */ |
michael@0 | 113 | void suppress(); |
michael@0 | 114 | void unsuppress(); |
michael@0 | 115 | |
michael@0 | 116 | [noscript] void dragMoved(in long aX, in long aY); |
michael@0 | 117 | }; |
michael@0 | 118 | |
michael@0 | 119 | |
michael@0 | 120 | %{ C++ |
michael@0 | 121 | |
michael@0 | 122 | %} |