1 /* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
2 *
3 * ***** BEGIN LICENSE BLOCK *****
4 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
5 *
6 * The contents of this file are subject to the Mozilla Public License Version
7 * 1.1 (the "License"); you may not use this file except in compliance with
8 * the License. You may obtain a copy of the License at
9 * http://www.mozilla.org/MPL/
10 *
11 * Software distributed under the License is distributed on an "AS IS" basis,
12 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
13 * for the specific language governing rights and limitations under the
14 * License.
15 *
16 * The Original Code is Mozilla Communicator.
17 *
18 * The Initial Developer of the Original Code is
19 * Netscape Communications Corp.
20 * Portions created by the Initial Developer are Copyright (C) 1999
21 * the Initial Developer. All Rights Reserved.
22 *
23 * Contributor(s):
24 * Mike Pinkerton
25 *
26 * Alternatively, the contents of this file may be used under the terms of
27 * either the GNU General Public License Version 2 or later (the "GPL"), or
28 * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
29 * in which case the provisions of the GPL or the LGPL are applicable instead
30 * of those above. If you wish to allow use of your version of this file only
31 * under the terms of either the GPL or the LGPL, and not to allow others to
32 * use your version of this file under the terms of the MPL, indicate your
33 * decision by deleting the provisions above and replace them with the notice
34 * and other provisions required by the GPL or the LGPL. If you do not delete
35 * the provisions above, a recipient may use your version of this file under
36 * the terms of any one of the MPL, the GPL or the LGPL.
37 *
38 * ***** END LICENSE BLOCK ***** */
39
40 #include "nsISupports.idl"
41 #include "nsISupportsArray.idl"
42 #include "nsIDragSession.idl"
43 #include "nsIScriptableRegion.idl"
44
45
46 interface nsIDOMNode;
47 interface nsIDOMMouseEvent;
48 interface nsISelection;
49
50 [scriptable, uuid(034c44a4-604b-44a2-9205-676d5135f359)]
51 interface nsIDragService : nsISupports
52 {
53 const long DRAGDROP_ACTION_NONE = 0;
54 const long DRAGDROP_ACTION_COPY = 1;
55 const long DRAGDROP_ACTION_MOVE = 2;
56 const long DRAGDROP_ACTION_LINK = 4;
57
58 /**
59 * Starts a modal drag session with an array of transaferables
60 *
61 * @param aTransferables - an array of transferables to be dragged
62 * @param aRegion - a region containing rectangles for cursor feedback,
63 * in window coordinates.
64 * @param aActionType - specified which of copy/move/link are allowed
65 */
66 void invokeDragSession ( in nsIDOMNode aDOMNode, in nsISupportsArray aTransferables,
67 in nsIScriptableRegion aRegion, in unsigned long aActionType );
68
69 /**
70 * Starts a modal drag session using an image. The first four arguments are
71 * the same as invokeDragSession.
72 *
73 * A custom image may be specified using the aImage argument. If this is
74 * supplied, the aImageX and aImageY arguments specify the offset within
75 * the image where the cursor would be positioned. That is, when the image
76 * is drawn, it is offset up and left the amount so that the cursor appears
77 * at that location within the image.
78 *
79 * If aImage is null, aImageX and aImageY are not used and the image is instead
80 * determined from the source node aDOMNode, and the offset calculated so that
81 * the initial location for the image appears in the same screen position as
82 * where the element is located. The node must be within a document.
83 *
84 * Currently, supported images are all DOM nodes. If this is an HTML <image> or
85 * <canvas>, the drag image is taken from the image data. If the element is in
86 * a document, it will be rendered at its displayed size, othewise, it will be
87 * rendered at its real size. For other types of elements, the element is
88 * rendered into an offscreen buffer in the same manner as it is currently
89 * displayed. The document selection is hidden while drawing.
90 *
91 * The aDragEvent must be supplied as the current screen coordinates of the
92 * event are needed to calculate the image location.
93 */
94 void invokeDragSessionWithImage(in nsIDOMNode aDOMNode,
95 in nsISupportsArray aTransferableArray,
96 in nsIScriptableRegion aRegion,
97 in unsigned long aActionType,
98 in nsIDOMNode aImage,
99 in long aImageX,
100 in long aImageY,
101 in nsIDOMMouseEvent aDragEvent);
102
103 /**
104 * Start a modal drag session using the selection as the drag image.
105 * The aDragEvent must be supplied as the current screen coordinates of the
106 * event are needed to calculate the image location.
107 */
108 void invokeDragSessionWithSelection(in nsISelection aSelection,
109 in nsISupportsArray aTransferableArray,
110 in unsigned long aActionType,
111 in nsIDOMMouseEvent aDragEvent);
112
113 /**
114 * Returns the current Drag Session
115 */
116 nsIDragSession getCurrentSession ( ) ;
117
118 /**
119 * Tells the Drag Service to start a drag session. This is called when
120 * an external drag occurs
121 */
122 void startDragSession ( ) ;
123
124 /**
125 * Tells the Drag Service to end a drag session. This is called when
126 * an external drag occurs
127 *
128 * If aDoneDrag is true, the drag has finished, otherwise the drag has
129 * just left the window.
130 */
131 void endDragSession ( in PRBool aDoneDrag ) ;
132
133 /**
134 * Fire a drag event at the source of the drag
135 */
136 void fireDragEventAtSource ( in unsigned long aMsg );
137
138 /**
139 * Increase/decrease dragging suppress level by one.
140 * If level is greater than one, dragging is disabled.
141 */
142 void suppress();
143 void unsuppress();
144 };
145
146
147 %{ C++
148
149 %}