|
1 /* -*- Mode: IDL; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
|
2 /* This Source Code Form is subject to the terms of the Mozilla Public |
|
3 * License, v. 2.0. If a copy of the MPL was not distributed with this |
|
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
|
5 |
|
6 #include "nsISupports.idl" |
|
7 |
|
8 interface nsIDOMEvent; |
|
9 interface nsIDOMNode; |
|
10 |
|
11 /** |
|
12 * An optional interface for embedding clients wishing to receive |
|
13 * notifications for context menu events (e.g. generated by |
|
14 * a user right-mouse clicking on a link). The embedder implements |
|
15 * this interface on the web browser chrome object associated |
|
16 * with the window that notifications are required for. When a context |
|
17 * menu event, the browser will call this interface if present. |
|
18 * |
|
19 * @see nsIDOMNode |
|
20 * @see nsIDOMEvent |
|
21 */ |
|
22 [scriptable, uuid(3478b6b0-3875-11d4-94ef-0020183bf181)] |
|
23 interface nsIContextMenuListener : nsISupports |
|
24 { |
|
25 /** Flag. No context. */ |
|
26 const unsigned long CONTEXT_NONE = 0; |
|
27 /** Flag. Context is a link element. */ |
|
28 const unsigned long CONTEXT_LINK = 1; |
|
29 /** Flag. Context is an image element. */ |
|
30 const unsigned long CONTEXT_IMAGE = 2; |
|
31 /** Flag. Context is the whole document. */ |
|
32 const unsigned long CONTEXT_DOCUMENT = 4; |
|
33 /** Flag. Context is a text area element. */ |
|
34 const unsigned long CONTEXT_TEXT = 8; |
|
35 /** Flag. Context is an input element. */ |
|
36 const unsigned long CONTEXT_INPUT = 16; |
|
37 |
|
38 /** |
|
39 * Called when the browser receives a context menu event (e.g. user is right-mouse |
|
40 * clicking somewhere on the document). The combination of flags, event and node |
|
41 * provided in the call indicate where and what was clicked on. |
|
42 * |
|
43 * The following table describes what context flags and node combinations are |
|
44 * possible. |
|
45 * |
|
46 * <TABLE> |
|
47 * <TR><TD><B>aContextFlag</B></TD><TD>aNode</TD></TR> |
|
48 * <TR><TD>CONTEXT_LINK</TD><TD><A></TD></TR> |
|
49 * <TR><TD>CONTEXT_IMAGE</TD><TD><IMG></TD></TR> |
|
50 * <TR><TD>CONTEXT_IMAGE | CONTEXT_LINK</TD><TD><IMG> |
|
51 * with an <A> as an ancestor</TD></TR> |
|
52 * <TR><TD>CONTEXT_INPUT</TD><TD><INPUT></TD></TR> |
|
53 * <TR><TD>CONTEXT_TEXT</TD><TD><TEXTAREA></TD></TR> |
|
54 * <TR><TD>CONTEXT_DOCUMENT</TD><TD><HTML></TD></TR> |
|
55 * </TABLE> |
|
56 * |
|
57 * @param aContextFlags Flags indicating the kind of context. |
|
58 * @param aEvent The DOM context menu event. |
|
59 * @param aNode The DOM node most relevant to the context. |
|
60 * |
|
61 * @return <CODE>NS_OK</CODE> always. |
|
62 */ |
|
63 void onShowContextMenu(in unsigned long aContextFlags, in nsIDOMEvent aEvent, in nsIDOMNode aNode); |
|
64 }; |
|
65 |