Bug 401766 Starting Debug SeaMonkey with autoconfig file gives Assertion failure...
[mozilla-central.git] / widget / public / nsIClipboardDragDropHooks.idl
blob10140b7abb5050b0e7eb5800b705b6b7cf188e6b
1 /* ***** BEGIN LICENSE BLOCK *****
2 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
4 * The contents of this file are subject to the Mozilla Public License Version
5 * 1.1 (the "License"); you may not use this file except in compliance with
6 * the License. You may obtain a copy of the License at
7 * http://www.mozilla.org/MPL/
9 * Software distributed under the License is distributed on an "AS IS" basis,
10 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
11 * for the specific language governing rights and limitations under the
12 * License.
14 * The Original Code is Mozilla Communicator.
16 * The Initial Developer of the Original Code is
17 * Netscape Communications.
18 * Portions created by the Initial Developer are Copyright (C) 2002
19 * the Initial Developer. All Rights Reserved.
21 * Contributor(s):
22 * Mike Pinkerton <pinkerton@netscape.com>
23 * Kathleen Brade <brade@netscape.com>
25 * Alternatively, the contents of this file may be used under the terms of
26 * either the GNU General Public License Version 2 or later (the "GPL"), or
27 * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
28 * in which case the provisions of the GPL or the LGPL are applicable instead
29 * of those above. If you wish to allow use of your version of this file only
30 * under the terms of either the GPL or the LGPL, and not to allow others to
31 * use your version of this file under the terms of the MPL, indicate your
32 * decision by deleting the provisions above and replace them with the notice
33 * and other provisions required by the GPL or the LGPL. If you do not delete
34 * the provisions above, a recipient may use your version of this file under
35 * the terms of any one of the MPL, the GPL or the LGPL.
37 * ***** END LICENSE BLOCK ***** */
39 #include "nsISupports.idl"
41 interface nsITransferable;
42 interface nsIDragSession;
43 interface nsIDOMEvent;
46 /**
47 * Interfaces for overriding the built-in drag, drop, copy, and paste
48 * implementations in the content area and editors. Use this to do things
49 * such as prevent a drag from starting, adding or removing
50 * data and flavors, or preventing the drop.
52 * Embedders who want to have these hooks made available should implement
53 * nsIClipboardDragDropHooks and use the command manager to send the
54 * appropriate commands with these parameters/settings:
55 * command: cmd_clipboardDragDropHook
57 * params value type possible values
58 * "addhook" isupports nsIClipboardDragDropHooks as nsISupports
59 * "removehook" isupports nsIClipboardDragDropHooks as nsISupports
61 * Notes:
62 * * Overrides/hooks need to be added to each window (as appropriate).
63 * Adding them to the first window does not enable them for every window.
64 * * If more than one implementation is set for a window, the hooks will be
65 * called in the order they are added.
66 * * Adding the same hook to the same window will not add a second call.
67 * Each hook can only be called once per user action/api.
68 * * Not all hooks are guaranteed to be called. If there are multiple hooks
69 * set for a window, any of them has an opportunity to cancel the action
70 * so no further processing will occur.
71 * * If any errors occur (without setting the boolean result) the default
72 * action will occur.
73 * * AllowDrop will be called MANY times during drag so ensure that it is
74 * efficient.
78 [scriptable,uuid(e03e6c5e-0d84-4c0b-8739-e6b8d51922de)]
79 interface nsIClipboardDragDropHooks : nsISupports
81 /**
82 * Prevents the drag from starting
84 * @param event DOM event (drag gesture)
86 * @return TRUE drag can proceed
87 * @return FALSE drag is cancelled, does not go to OS
89 boolean allowStartDrag(in nsIDOMEvent event);
91 /**
92 * Tells gecko whether a drop is allowed on this content area
94 * @param event DOM event (drag over)
95 * @param session the drag session from which client can get
96 * the flavors present or the actual data
98 * @return TRUE indicates to OS that if a drop does happen on this
99 * browser, it will be accepted.
100 * @return FALSE indicates to OS drop is not allowed. On win32, this
101 * will change the cursor to "reject".
103 boolean allowDrop(in nsIDOMEvent event, in nsIDragSession session);
106 * Alter the flavors or data presented to the OS
107 * Used for drag and copy actions
108 * Because this can be called many times, it is highly recommended
109 * that the implementation be very efficient so user feedback is
110 * not negatively impacted.
112 * @param event DOM event (drag drop); null if triggered by copy.
113 * @param trans the transferable holding the list of flavors
114 * and the data for each flavor
116 * @return TRUE copy/drag can proceed
117 * @return FALSE copy/drag is cancelled, does not go to OS
119 boolean onCopyOrDrag(in nsIDOMEvent aEvent, in nsITransferable trans);
122 * Provide an alternative action to the built-in behavior when
123 * something is dropped on the browser or in an editor
125 * @param event DOM event (drag drop); null if triggered by paste.
126 * @param trans the transferable holding the list of flavors
127 * and the data for each flavor
129 * @return TRUE action was handled, do not perform built-in
130 * behavior
131 * @return FALSE action was not overridden, do built-in behavior
133 boolean onPasteOrDrop(in nsIDOMEvent event, in nsITransferable trans);