Bug 983971 - Do not use gralloc for small size on ICS gonk r=nical
[gecko.git] / widget / nsIClipboardDragDropHooks.idl
blob0810ff70fe046ddb945e7bbf497ab8ddad772ea0
1 /* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5 #include "nsISupports.idl"
7 interface nsITransferable;
8 interface nsIDragSession;
9 interface nsIDOMEvent;
12 /**
13 * Interfaces for overriding the built-in drag, drop, copy, and paste
14 * implementations in the content area and editors. Use this to do things
15 * such as prevent a drag from starting, adding or removing
16 * data and flavors, or preventing the drop.
18 * Embedders who want to have these hooks made available should implement
19 * nsIClipboardDragDropHooks and use the command manager to send the
20 * appropriate commands with these parameters/settings:
21 * command: cmd_clipboardDragDropHook
23 * params value type possible values
24 * "addhook" isupports nsIClipboardDragDropHooks as nsISupports
25 * "removehook" isupports nsIClipboardDragDropHooks as nsISupports
27 * Notes:
28 * * Overrides/hooks need to be added to each window (as appropriate).
29 * Adding them to the first window does not enable them for every window.
30 * * If more than one implementation is set for a window, the hooks will be
31 * called in the order they are added.
32 * * Adding the same hook to the same window will not add a second call.
33 * Each hook can only be called once per user action/api.
34 * * Not all hooks are guaranteed to be called. If there are multiple hooks
35 * set for a window, any of them has an opportunity to cancel the action
36 * so no further processing will occur.
37 * * If any errors occur (without setting the boolean result) the default
38 * action will occur.
39 * * AllowDrop will be called MANY times during drag so ensure that it is
40 * efficient.
44 [scriptable,uuid(e03e6c5e-0d84-4c0b-8739-e6b8d51922de)]
45 interface nsIClipboardDragDropHooks : nsISupports
47 /**
48 * Prevents the drag from starting
50 * @param event DOM event (drag gesture)
52 * @return TRUE drag can proceed
53 * @return FALSE drag is cancelled, does not go to OS
55 boolean allowStartDrag(in nsIDOMEvent event);
57 /**
58 * Tells gecko whether a drop is allowed on this content area
60 * @param event DOM event (drag over)
61 * @param session the drag session from which client can get
62 * the flavors present or the actual data
64 * @return TRUE indicates to OS that if a drop does happen on this
65 * browser, it will be accepted.
66 * @return FALSE indicates to OS drop is not allowed. On win32, this
67 * will change the cursor to "reject".
69 boolean allowDrop(in nsIDOMEvent event, in nsIDragSession session);
71 /**
72 * Alter the flavors or data presented to the OS
73 * Used for drag and copy actions
74 * Because this can be called many times, it is highly recommended
75 * that the implementation be very efficient so user feedback is
76 * not negatively impacted.
78 * @param event DOM event (drag drop); null if triggered by copy.
79 * @param trans the transferable holding the list of flavors
80 * and the data for each flavor
82 * @return TRUE copy/drag can proceed
83 * @return FALSE copy/drag is cancelled, does not go to OS
85 boolean onCopyOrDrag(in nsIDOMEvent aEvent, in nsITransferable trans);
87 /**
88 * Provide an alternative action to the built-in behavior when
89 * something is dropped on the browser or in an editor
91 * @param event DOM event (drag drop); null if triggered by paste.
92 * @param trans the transferable holding the list of flavors
93 * and the data for each flavor
95 * @return TRUE action was handled, do not perform built-in
96 * behavior
97 * @return FALSE action was not overridden, do built-in behavior
99 boolean onPasteOrDrop(in nsIDOMEvent event, in nsITransferable trans);