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
"nsISupports.idl"
8 #include
"nsITransferable.idl"
15 interface nsIContentSecurityPolicy
;
17 native nsSize
(nsSize
);
24 [scriptable
, builtinclass
, uuid(25bce737
-73f0
-43c7
-bc20
-c71044a73c5a
)]
25 interface nsIDragSession
: nsISupports
28 * Set the current state of the drag, whether it can be dropped or not.
29 * usually the target "frame" sets this so the native system can render the correct feedback
31 attribute
boolean canDrop
;
34 * Indicates if the drop event should be dispatched only to chrome.
36 attribute
boolean onlyChromeDrop
;
39 * Sets the action (copy, move, link, et.c) for the current drag
41 attribute
unsigned long dragAction
;
44 * Get the number of items that were dropped
46 readonly attribute
unsigned long numDropItems
;
49 * The window context where the drag was started, which will be null if the
50 * drag originated outside the application. Useful for determining if a drop
51 * originated in the same window context.
54 attribute WindowContext sourceWindowContext
;
57 * The dom node that was originally dragged to start the session, which will be null if the
58 * drag originated outside the application.
60 readonly attribute Node sourceNode
;
63 * Replace source node and selection with new ones.
64 * If sourceNode is a native anonymous node, it may be replaced at reframing.
65 * If sourceNode is disconnected from the document, we cannot dispatch
66 * `dragend` event properly.
67 * When this is called, sourceNode or aNewSourceNode should be a native
70 [notxpcom
, nostdcall
] void updateSource
(in Node aNewSourceNode
,
71 in Selection aNewSelection
);
74 * the triggering principal. This may be different than sourceNode's
75 * principal when sourceNode is xul:browser and the drag is
76 * triggered in a browsing context inside it.
78 attribute nsIPrincipal triggeringPrincipal
;
81 * the triggering csp. This may be different than sourceNode's
82 * csp when sourceNode is xul:browser and the drag is
83 * triggered in a browsing context inside it.
85 attribute nsIContentSecurityPolicy csp
;
88 * The data transfer object for the current drag.
90 [binaryname
(DataTransferXPCOM
)]
91 attribute DataTransfer dataTransfer
;
92 [notxpcom
, nostdcall
] DataTransfer getDataTransfer
();
93 [notxpcom
, nostdcall
] void setDataTransfer
(in DataTransfer aDataTransfer
);
96 * Get data from a Drag&Drop. Can be called while the drag is in process
97 * or after the drop has completed.
99 * @param aTransferable the transferable for the data to be put into
100 * @param aItemIndex which of multiple drag items, zero-based
102 void getData
( in nsITransferable aTransferable
, in unsigned long aItemIndex
) ;
105 * Check to set if any of the native data on the clipboard matches this data flavor
107 boolean isDataFlavorSupported
( in string aDataFlavor
) ;
109 void userCancelled
();
111 void dragEventDispatchedToChildProcess
();
113 // Called when nsIDragSession implementation should update the UI for the
114 // drag-and-drop based on the data got from the child process in response to
115 // NS_DRAGDROP_OVER sent from parent process to child process.
116 void updateDragEffect
();
118 // Change the drag image, using similar arguments as
119 // nsIDragService::InvokeDragSessionWithImage.
120 void updateDragImage
(in Node aImage
, in long aImageX
, in long aImageY
);
123 * Returns effects allowed at starting the session for tests.
125 [notxpcom
, nostdcall
] unsigned long getEffectAllowedForTests
();
128 * Returns true if current session was started with synthesized drag start.
130 [notxpcom
, nostdcall
] bool isSynthesizedForTests
();
133 * Sets drag end point of synthesized session when the test does not dispatch
136 void setDragEndPointForTests
(in long aScreenX
, in long aScreenY
);
139 * Returns true if the session is for dragging text in a text in text control
142 [notxpcom
, nostdcall
] bool isDraggingTextInTextControl
();