PageRenderTime 18ms CodeModel.GetById 12ms app.highlight 2ms RepoModel.GetById 2ms app.codeStats 0ms

/embedding/browser/webBrowser/nsIContextMenuListener2.idl

http://github.com/zpao/v8monkey
IDL | 155 lines | 29 code | 14 blank | 112 comment | 0 complexity | 47204089d32f2fdea6944fe05838a6fe MD5 | raw file
  1/* -*- Mode: IDL; tab-width: 2; 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 *   Conrad Carlen <ccarlen@netscape.com>
 24 *   Adam Lock <adamlock@netscape.com>
 25 *
 26 * Alternatively, the contents of this file may be used under the terms of
 27 * either the GNU General Public License Version 2 or later (the "GPL"), or
 28 * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
 29 * in which case the provisions of the GPL or the LGPL are applicable instead
 30 * of those above. If you wish to allow use of your version of this file only
 31 * under the terms of either the GPL or the LGPL, and not to allow others to
 32 * use your version of this file under the terms of the MPL, indicate your
 33 * decision by deleting the provisions above and replace them with the notice
 34 * and other provisions required by the GPL or the LGPL. If you do not delete
 35 * the provisions above, a recipient may use your version of this file under
 36 * the terms of any one of the MPL, the GPL or the LGPL.
 37 *
 38 * ***** END LICENSE BLOCK ***** */
 39
 40#include "nsISupports.idl"
 41
 42interface nsIDOMEvent;
 43interface nsIDOMNode;
 44interface imgIContainer;
 45interface nsIURI;
 46interface nsIContextMenuInfo;
 47
 48/* THIS IS A PUBLIC EMBEDDING API */
 49
 50/**
 51 * nsIContextMenuListener2
 52 *
 53 * This is an extended version of nsIContextMenuListener
 54 * It provides a helper class, nsIContextMenuInfo, to allow access to
 55 * background images as well as various utilities.
 56 *
 57 * @see nsIContextMenuListener
 58 * @see nsIContextMenuInfo
 59 */
 60 
 61[scriptable, uuid(7fb719b3-d804-4964-9596-77cf924ee314)]
 62interface nsIContextMenuListener2 : nsISupports
 63{
 64  /** Flag. No context. */
 65  const unsigned long CONTEXT_NONE        = 0;
 66  /** Flag. Context is a link element. */
 67  const unsigned long CONTEXT_LINK        = 1;
 68  /** Flag. Context is an image element. */
 69  const unsigned long CONTEXT_IMAGE       = 2;
 70  /** Flag. Context is the whole document. */
 71  const unsigned long CONTEXT_DOCUMENT    = 4;
 72  /** Flag. Context is a text area element. */
 73  const unsigned long CONTEXT_TEXT        = 8;
 74  /** Flag. Context is an input element. */
 75  const unsigned long CONTEXT_INPUT       = 16;  
 76  /** Flag. Context is a background image. */
 77  const unsigned long CONTEXT_BACKGROUND_IMAGE  = 32;
 78
 79  /**
 80   * Called when the browser receives a context menu event (e.g. user is right-mouse
 81   * clicking somewhere on the document). The combination of flags, along with the
 82   * attributes of <CODE>aUtils</CODE>, indicate where and what was clicked on.
 83   *
 84   * The following table describes what context flags and node combinations are
 85   * possible.
 86   *
 87   * aContextFlags                  aUtils.targetNode
 88   *
 89   * CONTEXT_LINK                   <A>
 90   * CONTEXT_IMAGE                  <IMG>
 91   * CONTEXT_IMAGE | CONTEXT_LINK   <IMG> with <A> as an ancestor
 92   * CONTEXT_INPUT                  <INPUT>
 93   * CONTEXT_INPUT | CONTEXT_IMAGE  <INPUT> with type=image
 94   * CONTEXT_TEXT                   <TEXTAREA>
 95   * CONTEXT_DOCUMENT               <HTML>
 96   * CONTEXT_BACKGROUND_IMAGE       <HTML> with background image
 97   *
 98   * @param aContextFlags           Flags indicating the kind of context.
 99   * @param aUtils                  Context information and helper utilities.
100   *
101   * @see nsIContextMenuInfo
102   */ 
103  void onShowContextMenu(in unsigned long aContextFlags, in nsIContextMenuInfo aUtils);
104};
105
106/**
107 * nsIContextMenuInfo
108 *
109 * A helper object for implementors of nsIContextMenuListener2.
110 */
111 
112[scriptable, uuid(2f977d56-5485-11d4-87e2-0010a4e75ef2)]
113interface nsIContextMenuInfo : nsISupports
114{
115  /**
116   * The DOM context menu event.
117   */
118  readonly attribute nsIDOMEvent mouseEvent;
119
120  /**
121   * The DOM node most relevant to the context.
122   */
123  readonly attribute nsIDOMNode targetNode;
124
125  /**
126   * Given the <CODE>CONTEXT_LINK</CODE> flag, <CODE>targetNode</CODE> may not
127   * nescesarily be a link. This returns the anchor from <CODE>targetNode</CODE>
128   * if it has one or that of its nearest ancestor if it does not.
129   */
130  readonly attribute AString associatedLink;
131
132  /**
133   * Given the <CODE>CONTEXT_IMAGE</CODE> flag, these methods can be
134   * used in order to get the image for viewing, saving, or for the clipboard.
135   *
136   * @return <CODE>NS_OK</CODE> if successful, otherwise <CODE>NS_ERROR_FAILURE</CODE> if no
137   * image was found, or NS_ERROR_NULL_POINTER if an internal error occurs where we think there 
138   * is an image, but for some reason it cannot be returned.
139   */
140
141  readonly attribute imgIContainer imageContainer;
142  readonly attribute nsIURI imageSrc;
143
144  /**
145   * Given the <CODE>CONTEXT_BACKGROUND_IMAGE</CODE> flag, these methods can be
146   * used in order to get the image for viewing, saving, or for the clipboard.
147   *
148   * @return <CODE>NS_OK</CODE> if successful, otherwise <CODE>NS_ERROR_FAILURE</CODE> if no background
149   * image was found, or NS_ERROR_NULL_POINTER if an internal error occurs where we think there is a 
150   * background image, but for some reason it cannot be returned.
151   */
152
153  readonly attribute imgIContainer backgroundImageContainer;
154  readonly attribute nsIURI backgroundImageSrc;
155};