/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. #include "nsISupports.idl"
  40. interface nsIDOMEvent;
  41. interface nsIDOMNode;
  42. interface imgIContainer;
  43. interface nsIURI;
  44. interface nsIContextMenuInfo;
  45. /* THIS IS A PUBLIC EMBEDDING API */
  46. /**
  47. * nsIContextMenuListener2
  48. *
  49. * This is an extended version of nsIContextMenuListener
  50. * It provides a helper class, nsIContextMenuInfo, to allow access to
  51. * background images as well as various utilities.
  52. *
  53. * @see nsIContextMenuListener
  54. * @see nsIContextMenuInfo
  55. */
  56. [scriptable, uuid(7fb719b3-d804-4964-9596-77cf924ee314)]
  57. interface nsIContextMenuListener2 : nsISupports
  58. {
  59. /** Flag. No context. */
  60. const unsigned long CONTEXT_NONE = 0;
  61. /** Flag. Context is a link element. */
  62. const unsigned long CONTEXT_LINK = 1;
  63. /** Flag. Context is an image element. */
  64. const unsigned long CONTEXT_IMAGE = 2;
  65. /** Flag. Context is the whole document. */
  66. const unsigned long CONTEXT_DOCUMENT = 4;
  67. /** Flag. Context is a text area element. */
  68. const unsigned long CONTEXT_TEXT = 8;
  69. /** Flag. Context is an input element. */
  70. const unsigned long CONTEXT_INPUT = 16;
  71. /** Flag. Context is a background image. */
  72. const unsigned long CONTEXT_BACKGROUND_IMAGE = 32;
  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, along with the
  76. * attributes of <CODE>aUtils</CODE>, indicate where and what was clicked on.
  77. *
  78. * The following table describes what context flags and node combinations are
  79. * possible.
  80. *
  81. * aContextFlags aUtils.targetNode
  82. *
  83. * CONTEXT_LINK <A>
  84. * CONTEXT_IMAGE <IMG>
  85. * CONTEXT_IMAGE | CONTEXT_LINK <IMG> with <A> as an ancestor
  86. * CONTEXT_INPUT <INPUT>
  87. * CONTEXT_INPUT | CONTEXT_IMAGE <INPUT> with type=image
  88. * CONTEXT_TEXT <TEXTAREA>
  89. * CONTEXT_DOCUMENT <HTML>
  90. * CONTEXT_BACKGROUND_IMAGE <HTML> with background image
  91. *
  92. * @param aContextFlags Flags indicating the kind of context.
  93. * @param aUtils Context information and helper utilities.
  94. *
  95. * @see nsIContextMenuInfo
  96. */
  97. void onShowContextMenu(in unsigned long aContextFlags, in nsIContextMenuInfo aUtils);
  98. };
  99. /**
  100. * nsIContextMenuInfo
  101. *
  102. * A helper object for implementors of nsIContextMenuListener2.
  103. */
  104. [scriptable, uuid(2f977d56-5485-11d4-87e2-0010a4e75ef2)]
  105. interface nsIContextMenuInfo : nsISupports
  106. {
  107. /**
  108. * The DOM context menu event.
  109. */
  110. readonly attribute nsIDOMEvent mouseEvent;
  111. /**
  112. * The DOM node most relevant to the context.
  113. */
  114. readonly attribute nsIDOMNode targetNode;
  115. /**
  116. * Given the <CODE>CONTEXT_LINK</CODE> flag, <CODE>targetNode</CODE> may not
  117. * nescesarily be a link. This returns the anchor from <CODE>targetNode</CODE>
  118. * if it has one or that of its nearest ancestor if it does not.
  119. */
  120. readonly attribute AString associatedLink;
  121. /**
  122. * Given the <CODE>CONTEXT_IMAGE</CODE> flag, these methods can be
  123. * used in order to get the image for viewing, saving, or for the clipboard.
  124. *
  125. * @return <CODE>NS_OK</CODE> if successful, otherwise <CODE>NS_ERROR_FAILURE</CODE> if no
  126. * image was found, or NS_ERROR_NULL_POINTER if an internal error occurs where we think there
  127. * is an image, but for some reason it cannot be returned.
  128. */
  129. readonly attribute imgIContainer imageContainer;
  130. readonly attribute nsIURI imageSrc;
  131. /**
  132. * Given the <CODE>CONTEXT_BACKGROUND_IMAGE</CODE> flag, these methods can be
  133. * used in order to get the image for viewing, saving, or for the clipboard.
  134. *
  135. * @return <CODE>NS_OK</CODE> if successful, otherwise <CODE>NS_ERROR_FAILURE</CODE> if no background
  136. * image was found, or NS_ERROR_NULL_POINTER if an internal error occurs where we think there is a
  137. * background image, but for some reason it cannot be returned.
  138. */
  139. readonly attribute imgIContainer backgroundImageContainer;
  140. readonly attribute nsIURI backgroundImageSrc;
  141. };