Bug 545431, fix versioning of mac sdks, r=ted.mielczarek
[gecko.git] / embedding / browser / webBrowser / nsIContextMenuListener2.idl
blob786f7f046b7a4afdf54c2d485a2fbb9f6ec2c778
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
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
13 * License.
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.
22 * Contributor(s):
23 * Conrad Carlen <ccarlen@netscape.com>
24 * Adam Lock <adamlock@netscape.com>
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.
38 * ***** END LICENSE BLOCK ***** */
40 #include "nsISupports.idl"
42 interface nsIDOMEvent;
43 interface nsIDOMNode;
44 interface imgIContainer;
45 interface nsIURI;
46 interface nsIContextMenuInfo;
48 /* THIS IS A PUBLIC EMBEDDING API */
50 /**
51 * nsIContextMenuListener2
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.
57 * @see nsIContextMenuListener
58 * @see nsIContextMenuInfo
60 * @status UNDER_REVIEW
63 [scriptable, uuid(7fb719b3-d804-4964-9596-77cf924ee314)]
64 interface nsIContextMenuListener2 : nsISupports
66 /** Flag. No context. */
67 const unsigned long CONTEXT_NONE = 0;
68 /** Flag. Context is a link element. */
69 const unsigned long CONTEXT_LINK = 1;
70 /** Flag. Context is an image element. */
71 const unsigned long CONTEXT_IMAGE = 2;
72 /** Flag. Context is the whole document. */
73 const unsigned long CONTEXT_DOCUMENT = 4;
74 /** Flag. Context is a text area element. */
75 const unsigned long CONTEXT_TEXT = 8;
76 /** Flag. Context is an input element. */
77 const unsigned long CONTEXT_INPUT = 16;
78 /** Flag. Context is a background image. */
79 const unsigned long CONTEXT_BACKGROUND_IMAGE = 32;
81 /**
82 * Called when the browser receives a context menu event (e.g. user is right-mouse
83 * clicking somewhere on the document). The combination of flags, along with the
84 * attributes of <CODE>aUtils</CODE>, indicate where and what was clicked on.
86 * The following table describes what context flags and node combinations are
87 * possible.
89 * aContextFlags aUtils.targetNode
91 * CONTEXT_LINK <A>
92 * CONTEXT_IMAGE <IMG>
93 * CONTEXT_IMAGE | CONTEXT_LINK <IMG> with <A> as an ancestor
94 * CONTEXT_INPUT <INPUT>
95 * CONTEXT_INPUT | CONTEXT_IMAGE <INPUT> with type=image
96 * CONTEXT_TEXT <TEXTAREA>
97 * CONTEXT_DOCUMENT <HTML>
98 * CONTEXT_BACKGROUND_IMAGE <HTML> with background image
100 * @param aContextFlags Flags indicating the kind of context.
101 * @param aUtils Context information and helper utilities.
103 * @see nsIContextMenuInfo
105 void onShowContextMenu(in unsigned long aContextFlags, in nsIContextMenuInfo aUtils);
109 * nsIContextMenuInfo
111 * A helper object for implementors of nsIContextMenuListener2.
113 * @status UNDER_REVIEW
116 [scriptable, uuid(2f977d56-5485-11d4-87e2-0010a4e75ef2)]
117 interface nsIContextMenuInfo : nsISupports
120 * The DOM context menu event.
122 readonly attribute nsIDOMEvent mouseEvent;
125 * The DOM node most relevant to the context.
127 readonly attribute nsIDOMNode targetNode;
130 * Given the <CODE>CONTEXT_LINK</CODE> flag, <CODE>targetNode</CODE> may not
131 * nescesarily be a link. This returns the anchor from <CODE>targetNode</CODE>
132 * if it has one or that of its nearest ancestor if it does not.
134 readonly attribute AString associatedLink;
137 * Given the <CODE>CONTEXT_IMAGE</CODE> flag, these methods can be
138 * used in order to get the image for viewing, saving, or for the clipboard.
140 * @return <CODE>NS_OK</CODE> if successful, otherwise <CODE>NS_ERROR_FAILURE</CODE> if no
141 * image was found, or NS_ERROR_NULL_POINTER if an internal error occurs where we think there
142 * is an image, but for some reason it cannot be returned.
145 readonly attribute imgIContainer imageContainer;
146 readonly attribute nsIURI imageSrc;
149 * Given the <CODE>CONTEXT_BACKGROUND_IMAGE</CODE> flag, these methods can be
150 * used in order to get the image for viewing, saving, or for the clipboard.
152 * @return <CODE>NS_OK</CODE> if successful, otherwise <CODE>NS_ERROR_FAILURE</CODE> if no background
153 * image was found, or NS_ERROR_NULL_POINTER if an internal error occurs where we think there is a
154 * background image, but for some reason it cannot be returned.
157 readonly attribute imgIContainer backgroundImageContainer;
158 readonly attribute nsIURI backgroundImageSrc;