1 /* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
3 * This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #include
"nsIArray.idl"
8 #include
"nsISupports.idl"
9 #include
"nsIDragSession.idl"
10 #include
"nsIContentPolicy.idl"
17 #include
"mozilla/EventForwards.h"
24 } // namespace mozilla
27 [ptr] native ContentParentPtr
(mozilla
::dom
::ContentParent
);
28 [ptr] native DataTransferPtr
(mozilla
::dom
::DataTransfer
);
29 native EventMessage
(mozilla
::EventMessage
);
31 [scriptable
, uuid(ebd6b3a2
-af16
-43af
-a698
-3091a087dd62
), builtinclass
]
32 interface nsIDragService
: nsISupports
34 const long DRAGDROP_ACTION_NONE
= 0;
35 const long DRAGDROP_ACTION_COPY
= 1;
36 const long DRAGDROP_ACTION_MOVE
= 2;
37 const long DRAGDROP_ACTION_LINK
= 4;
38 const long DRAGDROP_ACTION_UNINITIALIZED
= 64;
41 * Starts a modal drag session with an array of transaferables.
43 * Note: This method is deprecated for non-native code.
45 * @param aPrincipal - the triggering principal of the drag, or null if
46 * it's from browser chrome or OS
47 * @param aTransferables - an array of transferables to be dragged
48 * @param aActionType - specified which of copy/move/link are allowed
49 * @param aContentPolicyType - the contentPolicyType that will be
50 * passed to the loadInfo when creating a new channel
51 * (defaults to TYPE_OTHER)
53 void invokeDragSession
(in Node aDOMNode
,
54 in nsIPrincipal aPrincipal
,
55 in nsIArray aTransferables
,
56 in unsigned long aActionType
,
57 [optional] in nsContentPolicyType aContentPolicyType
);
60 * Starts a modal drag session using an image. The first four arguments are
61 * the same as invokeDragSession.
63 * Note: This method is deprecated for non-native code.
65 * A custom image may be specified using the aImage argument. If this is
66 * supplied, the aImageX and aImageY arguments specify the offset within
67 * the image where the cursor would be positioned. That is, when the image
68 * is drawn, it is offset up and left the amount so that the cursor appears
69 * at that location within the image.
71 * If aImage is null, aImageX and aImageY are not used and the image is instead
72 * determined from the source node aDOMNode, and the offset calculated so that
73 * the initial location for the image appears in the same screen position as
74 * where the element is located. The node must be within a document.
76 * Currently, supported images are all DOM nodes. If this is an HTML <image> or
77 * <canvas>, the drag image is taken from the image data. If the element is in
78 * a document, it will be rendered at its displayed size, othewise, it will be
79 * rendered at its real size. For other types of elements, the element is
80 * rendered into an offscreen buffer in the same manner as it is currently
81 * displayed. The document selection is hidden while drawing.
83 * The aDragEvent must be supplied as the current screen coordinates of the
84 * event are needed to calculate the image location.
87 void invokeDragSessionWithImage
(in Node aDOMNode
,
88 in nsIPrincipal aPrincipal
,
89 in nsIArray aTransferableArray
,
90 in unsigned long aActionType
,
94 in DragEvent aDragEvent
,
95 in DataTransferPtr aDataTransfer
);
98 * Start a modal drag session using the selection as the drag image.
99 * The aDragEvent must be supplied as the current screen coordinates of the
100 * event are needed to calculate the image location.
102 * Note: This method is deprecated for non-native code.
104 void invokeDragSessionWithSelection
(in Selection aSelection
,
105 in nsIPrincipal aPrincipal
,
106 in nsIArray aTransferableArray
,
107 in unsigned long aActionType
,
108 in DragEvent aDragEvent
,
109 in DataTransferPtr aDataTransfer
);
112 * Returns the current Drag Session
114 nsIDragSession getCurrentSession
();
117 * Tells the Drag Service to start a drag session. This is called when
118 * an external drag occurs
120 void startDragSession
( ) ;
123 * Tells the Drag Service to end a drag session. This is called when
124 * an external drag occurs
126 * If aDoneDrag is true, the drag has finished, otherwise the drag has
127 * just left the window.
129 void endDragSession
(in boolean aDoneDrag
,
130 [optional] in unsigned long aKeyModifiers
);
133 * Fire a drag event at the source of the drag
135 [noscript
] void fireDragEventAtSource
(in EventMessage aEventMessage
,
136 in unsigned long aKeyModifiers
);
139 * Increase/decrease dragging suppress level by one.
140 * If level is greater than one, dragging is disabled.
146 * aX and aY are in LayoutDevice pixels.
148 [noscript
] void dragMoved
(in long aX
, in long aY
);
150 [notxpcom
, nostdcall
] boolean maybeAddChildProcess
(in ContentParentPtr aChild
);