PageRenderTime 57ms CodeModel.GetById 52ms app.highlight 2ms RepoModel.GetById 1ms app.codeStats 1ms

/gecko_sdk/idl/nsIContextMenuListener.idl

http://firefox-mac-pdf.googlecode.com/
IDL | 100 lines | 14 code | 5 blank | 81 comment | 0 complexity | e19f3feb5adcf08eb16ec451f68ee3f5 MD5 | raw file
  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
  4 *
  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/
  9 *
 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
 13 * License.
 14 *
 15 * The Original Code is mozilla.org code.
 16 *
 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.
 21 *
 22 * Contributor(s):
 23 *   Adam Lock <adamlock@netscape.com>
 24 *
 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.
 36 *
 37 * ***** END LICENSE BLOCK ***** */
 38 
 39#include "nsISupports.idl"
 40
 41interface nsIDOMEvent;
 42interface nsIDOMNode;
 43
 44/**
 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.
 51 * 
 52 * @see nsIDOMNode
 53 * @see nsIDOMEvent
 54 *
 55 * @status FROZEN
 56 */
 57[scriptable, uuid(3478b6b0-3875-11d4-94ef-0020183bf181)]
 58interface nsIContextMenuListener : nsISupports
 59{
 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;
 72
 73    /**
 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.
 77     *
 78     * The following table describes what context flags and node combinations are
 79     * possible.
 80     *
 81     * <TABLE>
 82     * <TR><TD><B>aContextFlag</B></TD><TD>aNode</TD></TR>
 83     * <TR><TD>CONTEXT_LINK</TD><TD>&lt;A&gt;</TD></TR>
 84     * <TR><TD>CONTEXT_IMAGE</TD><TD>&lt;IMG&gt;</TD></TR>
 85     * <TR><TD>CONTEXT_IMAGE | CONTEXT_LINK</TD><TD>&lt;IMG&gt;
 86     *       with an &lt;A&gt; as an ancestor</TD></TR>
 87     * <TR><TD>CONTEXT_INPUT</TD><TD>&lt;INPUT&gt;</TD></TR>
 88     * <TR><TD>CONTEXT_TEXT</TD><TD>&lt;TEXTAREA&gt;</TD></TR>
 89     * <TR><TD>CONTEXT_DOCUMENT</TD><TD>&lt;HTML&gt;</TD></TR>
 90     * </TABLE>
 91     *
 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.
 95     *
 96     * @return <CODE>NS_OK</CODE> always.
 97     */
 98    void onShowContextMenu(in unsigned long aContextFlags, in nsIDOMEvent aEvent, in nsIDOMNode aNode);
 99};
100