/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. #include "nsISupports.idl"
  39. interface nsIDOMEvent;
  40. interface nsIDOMNode;
  41. /**
  42. * An optional interface for embedding clients wishing to receive
  43. * notifications for context menu events (e.g. generated by
  44. * a user right-mouse clicking on a link). The embedder implements
  45. * this interface on the web browser chrome object associated
  46. * with the window that notifications are required for. When a context
  47. * menu event, the browser will call this interface if present.
  48. *
  49. * @see nsIDOMNode
  50. * @see nsIDOMEvent
  51. *
  52. * @status FROZEN
  53. */
  54. [scriptable, uuid(3478b6b0-3875-11d4-94ef-0020183bf181)]
  55. interface nsIContextMenuListener : nsISupports
  56. {
  57. /** Flag. No context. */
  58. const unsigned long CONTEXT_NONE = 0;
  59. /** Flag. Context is a link element. */
  60. const unsigned long CONTEXT_LINK = 1;
  61. /** Flag. Context is an image element. */
  62. const unsigned long CONTEXT_IMAGE = 2;
  63. /** Flag. Context is the whole document. */
  64. const unsigned long CONTEXT_DOCUMENT = 4;
  65. /** Flag. Context is a text area element. */
  66. const unsigned long CONTEXT_TEXT = 8;
  67. /** Flag. Context is an input element. */
  68. const unsigned long CONTEXT_INPUT = 16;
  69. /**
  70. * Called when the browser receives a context menu event (e.g. user is right-mouse
  71. * clicking somewhere on the document). The combination of flags, event and node
  72. * provided in the call indicate where and what was clicked on.
  73. *
  74. * The following table describes what context flags and node combinations are
  75. * possible.
  76. *
  77. * <TABLE>
  78. * <TR><TD><B>aContextFlag</B></TD><TD>aNode</TD></TR>
  79. * <TR><TD>CONTEXT_LINK</TD><TD>&lt;A&gt;</TD></TR>
  80. * <TR><TD>CONTEXT_IMAGE</TD><TD>&lt;IMG&gt;</TD></TR>
  81. * <TR><TD>CONTEXT_IMAGE | CONTEXT_LINK</TD><TD>&lt;IMG&gt;
  82. * with an &lt;A&gt; as an ancestor</TD></TR>
  83. * <TR><TD>CONTEXT_INPUT</TD><TD>&lt;INPUT&gt;</TD></TR>
  84. * <TR><TD>CONTEXT_TEXT</TD><TD>&lt;TEXTAREA&gt;</TD></TR>
  85. * <TR><TD>CONTEXT_DOCUMENT</TD><TD>&lt;HTML&gt;</TD></TR>
  86. * </TABLE>
  87. *
  88. * @param aContextFlags Flags indicating the kind of context.
  89. * @param aEvent The DOM context menu event.
  90. * @param aNode The DOM node most relevant to the context.
  91. *
  92. * @return <CODE>NS_OK</CODE> always.
  93. */
  94. void onShowContextMenu(in unsigned long aContextFlags, in nsIDOMEvent aEvent, in nsIDOMNode aNode);
  95. };