1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/embedding/browser/webBrowser/nsIContextMenuListener.idl Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,65 @@ 1.4 +/* -*- Mode: IDL; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.8 + 1.9 +#include "nsISupports.idl" 1.10 + 1.11 +interface nsIDOMEvent; 1.12 +interface nsIDOMNode; 1.13 + 1.14 +/** 1.15 + * An optional interface for embedding clients wishing to receive 1.16 + * notifications for context menu events (e.g. generated by 1.17 + * a user right-mouse clicking on a link). The embedder implements 1.18 + * this interface on the web browser chrome object associated 1.19 + * with the window that notifications are required for. When a context 1.20 + * menu event, the browser will call this interface if present. 1.21 + * 1.22 + * @see nsIDOMNode 1.23 + * @see nsIDOMEvent 1.24 + */ 1.25 +[scriptable, uuid(3478b6b0-3875-11d4-94ef-0020183bf181)] 1.26 +interface nsIContextMenuListener : nsISupports 1.27 +{ 1.28 + /** Flag. No context. */ 1.29 + const unsigned long CONTEXT_NONE = 0; 1.30 + /** Flag. Context is a link element. */ 1.31 + const unsigned long CONTEXT_LINK = 1; 1.32 + /** Flag. Context is an image element. */ 1.33 + const unsigned long CONTEXT_IMAGE = 2; 1.34 + /** Flag. Context is the whole document. */ 1.35 + const unsigned long CONTEXT_DOCUMENT = 4; 1.36 + /** Flag. Context is a text area element. */ 1.37 + const unsigned long CONTEXT_TEXT = 8; 1.38 + /** Flag. Context is an input element. */ 1.39 + const unsigned long CONTEXT_INPUT = 16; 1.40 + 1.41 + /** 1.42 + * Called when the browser receives a context menu event (e.g. user is right-mouse 1.43 + * clicking somewhere on the document). The combination of flags, event and node 1.44 + * provided in the call indicate where and what was clicked on. 1.45 + * 1.46 + * The following table describes what context flags and node combinations are 1.47 + * possible. 1.48 + * 1.49 + * <TABLE> 1.50 + * <TR><TD><B>aContextFlag</B></TD><TD>aNode</TD></TR> 1.51 + * <TR><TD>CONTEXT_LINK</TD><TD><A></TD></TR> 1.52 + * <TR><TD>CONTEXT_IMAGE</TD><TD><IMG></TD></TR> 1.53 + * <TR><TD>CONTEXT_IMAGE | CONTEXT_LINK</TD><TD><IMG> 1.54 + * with an <A> as an ancestor</TD></TR> 1.55 + * <TR><TD>CONTEXT_INPUT</TD><TD><INPUT></TD></TR> 1.56 + * <TR><TD>CONTEXT_TEXT</TD><TD><TEXTAREA></TD></TR> 1.57 + * <TR><TD>CONTEXT_DOCUMENT</TD><TD><HTML></TD></TR> 1.58 + * </TABLE> 1.59 + * 1.60 + * @param aContextFlags Flags indicating the kind of context. 1.61 + * @param aEvent The DOM context menu event. 1.62 + * @param aNode The DOM node most relevant to the context. 1.63 + * 1.64 + * @return <CODE>NS_OK</CODE> always. 1.65 + */ 1.66 + void onShowContextMenu(in unsigned long aContextFlags, in nsIDOMEvent aEvent, in nsIDOMNode aNode); 1.67 +}; 1.68 +