michael@0: /* -*- Mode: IDL; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #include "nsISupports.idl" michael@0: michael@0: interface nsIDOMEvent; michael@0: interface nsIDOMNode; michael@0: michael@0: /** michael@0: * An optional interface for embedding clients wishing to receive michael@0: * notifications for context menu events (e.g. generated by michael@0: * a user right-mouse clicking on a link). The embedder implements michael@0: * this interface on the web browser chrome object associated michael@0: * with the window that notifications are required for. When a context michael@0: * menu event, the browser will call this interface if present. michael@0: * michael@0: * @see nsIDOMNode michael@0: * @see nsIDOMEvent michael@0: */ michael@0: [scriptable, uuid(3478b6b0-3875-11d4-94ef-0020183bf181)] michael@0: interface nsIContextMenuListener : nsISupports michael@0: { michael@0: /** Flag. No context. */ michael@0: const unsigned long CONTEXT_NONE = 0; michael@0: /** Flag. Context is a link element. */ michael@0: const unsigned long CONTEXT_LINK = 1; michael@0: /** Flag. Context is an image element. */ michael@0: const unsigned long CONTEXT_IMAGE = 2; michael@0: /** Flag. Context is the whole document. */ michael@0: const unsigned long CONTEXT_DOCUMENT = 4; michael@0: /** Flag. Context is a text area element. */ michael@0: const unsigned long CONTEXT_TEXT = 8; michael@0: /** Flag. Context is an input element. */ michael@0: const unsigned long CONTEXT_INPUT = 16; michael@0: michael@0: /** michael@0: * Called when the browser receives a context menu event (e.g. user is right-mouse michael@0: * clicking somewhere on the document). The combination of flags, event and node michael@0: * provided in the call indicate where and what was clicked on. michael@0: * michael@0: * The following table describes what context flags and node combinations are michael@0: * possible. michael@0: * michael@0: * michael@0: * michael@0: * michael@0: * michael@0: * michael@0: * michael@0: * michael@0: * michael@0: *
aContextFlagaNode
CONTEXT_LINK<A>
CONTEXT_IMAGE<IMG>
CONTEXT_IMAGE | CONTEXT_LINK<IMG> michael@0: * with an <A> as an ancestor
CONTEXT_INPUT<INPUT>
CONTEXT_TEXT<TEXTAREA>
CONTEXT_DOCUMENT<HTML>
michael@0: * michael@0: * @param aContextFlags Flags indicating the kind of context. michael@0: * @param aEvent The DOM context menu event. michael@0: * @param aNode The DOM node most relevant to the context. michael@0: * michael@0: * @return NS_OK always. michael@0: */ michael@0: void onShowContextMenu(in unsigned long aContextFlags, in nsIDOMEvent aEvent, in nsIDOMNode aNode); michael@0: }; michael@0: