1 /* -*- Mode: IDL; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* ***** BEGIN LICENSE BLOCK *****
3 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
5 * The contents of this file are subject to the Mozilla Public License Version
6 * 1.1 (the "License"); you may not use this file except in compliance with
7 * the License. You may obtain a copy of the License at
8 * http://www.mozilla.org/MPL/
10 * Software distributed under the License is distributed on an "AS IS" basis,
11 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
12 * for the specific language governing rights and limitations under the
15 * The Original Code is mozilla.org code.
17 * The Initial Developer of the Original Code is
18 * Netscape Communications Corporation.
19 * Portions created by the Initial Developer are Copyright (C) 1998
20 * the Initial Developer. All Rights Reserved.
23 * Adam Lock <adamlock@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 nsIDOMEvent
;
45 * An optional interface for embedding clients wishing to receive
46 * notifications for context menu events (e.g. generated by
47 * a user right-mouse clicking on a link). The embedder implements
48 * this interface on the web browser chrome object associated
49 * with the window that notifications are required for. When a context
50 * menu event, the browser will call this interface if present.
57 [scriptable
, uuid(3478b6b0
-3875-11d4
-94ef
-0020183bf181
)]
58 interface nsIContextMenuListener
: nsISupports
60 /** Flag. No context. */
61 const unsigned long CONTEXT_NONE
= 0;
62 /** Flag. Context is a link element. */
63 const unsigned long CONTEXT_LINK
= 1;
64 /** Flag. Context is an image element. */
65 const unsigned long CONTEXT_IMAGE
= 2;
66 /** Flag. Context is the whole document. */
67 const unsigned long CONTEXT_DOCUMENT
= 4;
68 /** Flag. Context is a text area element. */
69 const unsigned long CONTEXT_TEXT
= 8;
70 /** Flag. Context is an input element. */
71 const unsigned long CONTEXT_INPUT
= 16;
74 * Called when the browser receives a context menu event (e.g. user is right-mouse
75 * clicking somewhere on the document). The combination of flags, event and node
76 * provided in the call indicate where and what was clicked on.
78 * The following table describes what context flags and node combinations are
82 * <TR><TD><B>aContextFlag</B></TD><TD>aNode</TD></TR>
83 * <TR><TD>CONTEXT_LINK</TD><TD><A></TD></TR>
84 * <TR><TD>CONTEXT_IMAGE</TD><TD><IMG></TD></TR>
85 * <TR><TD>CONTEXT_IMAGE | CONTEXT_LINK</TD><TD><IMG>
86 * with an <A> as an ancestor</TD></TR>
87 * <TR><TD>CONTEXT_INPUT</TD><TD><INPUT></TD></TR>
88 * <TR><TD>CONTEXT_TEXT</TD><TD><TEXTAREA></TD></TR>
89 * <TR><TD>CONTEXT_DOCUMENT</TD><TD><HTML></TD></TR>
92 * @param aContextFlags Flags indicating the kind of context.
93 * @param aEvent The DOM context menu event.
94 * @param aNode The DOM node most relevant to the context.
96 * @return <CODE>NS_OK</CODE> always.
98 void onShowContextMenu
(in unsigned long aContextFlags
, in nsIDOMEvent aEvent
, in nsIDOMNode aNode
);