nsIDragService.idl 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  1. /* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
  2. *
  3. * This Source Code Form is subject to the terms of the Mozilla Public
  4. * License, v. 2.0. If a copy of the MPL was not distributed with this
  5. * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
  6. #include "nsIArray.idl"
  7. #include "nsISupports.idl"
  8. #include "nsIDragSession.idl"
  9. #include "nsIScriptableRegion.idl"
  10. #include "nsIContentPolicyBase.idl"
  11. interface nsIDOMNode;
  12. interface nsIDOMDragEvent;
  13. interface nsIDOMDataTransfer;
  14. interface nsISelection;
  15. %{C++
  16. #include "mozilla/EventForwards.h"
  17. namespace mozilla {
  18. namespace dom {
  19. class ContentParent;
  20. } // namespace dom
  21. } // namespace mozilla
  22. %}
  23. [ptr] native ContentParentPtr(mozilla::dom::ContentParent);
  24. native EventMessage(mozilla::EventMessage);
  25. [scriptable, uuid(ebd6b3a2-af16-43af-a698-3091a087dd62), builtinclass]
  26. interface nsIDragService : nsISupports
  27. {
  28. const long DRAGDROP_ACTION_NONE = 0;
  29. const long DRAGDROP_ACTION_COPY = 1;
  30. const long DRAGDROP_ACTION_MOVE = 2;
  31. const long DRAGDROP_ACTION_LINK = 4;
  32. const long DRAGDROP_ACTION_UNINITIALIZED = 64;
  33. /**
  34. * Starts a modal drag session with an array of transaferables.
  35. *
  36. * Note: This method is deprecated for non-native code.
  37. *
  38. * @param aTransferables - an array of transferables to be dragged
  39. * @param aRegion - a region containing rectangles for cursor feedback,
  40. * in window coordinates.
  41. * @param aActionType - specified which of copy/move/link are allowed
  42. * @param aContentPolicyType - the contentPolicyType that will be
  43. * passed to the loadInfo when creating a new channel
  44. * (defaults to TYPE_OTHER)
  45. */
  46. void invokeDragSession (in nsIDOMNode aDOMNode,
  47. in nsIArray aTransferables,
  48. in nsIScriptableRegion aRegion,
  49. in unsigned long aActionType,
  50. [optional] in nsContentPolicyType aContentPolicyType);
  51. /**
  52. * Starts a modal drag session using an image. The first four arguments are
  53. * the same as invokeDragSession.
  54. *
  55. * Note: This method is deprecated for non-native code.
  56. *
  57. * A custom image may be specified using the aImage argument. If this is
  58. * supplied, the aImageX and aImageY arguments specify the offset within
  59. * the image where the cursor would be positioned. That is, when the image
  60. * is drawn, it is offset up and left the amount so that the cursor appears
  61. * at that location within the image.
  62. *
  63. * If aImage is null, aImageX and aImageY are not used and the image is instead
  64. * determined from the source node aDOMNode, and the offset calculated so that
  65. * the initial location for the image appears in the same screen position as
  66. * where the element is located. The node must be within a document.
  67. *
  68. * Currently, supported images are all DOM nodes. If this is an HTML <image> or
  69. * <canvas>, the drag image is taken from the image data. If the element is in
  70. * a document, it will be rendered at its displayed size, othewise, it will be
  71. * rendered at its real size. For other types of elements, the element is
  72. * rendered into an offscreen buffer in the same manner as it is currently
  73. * displayed. The document selection is hidden while drawing.
  74. *
  75. * The aDragEvent must be supplied as the current screen coordinates of the
  76. * event are needed to calculate the image location.
  77. */
  78. void invokeDragSessionWithImage(in nsIDOMNode aDOMNode,
  79. in nsIArray aTransferableArray,
  80. in nsIScriptableRegion aRegion,
  81. in unsigned long aActionType,
  82. in nsIDOMNode aImage,
  83. in long aImageX,
  84. in long aImageY,
  85. in nsIDOMDragEvent aDragEvent,
  86. in nsIDOMDataTransfer aDataTransfer);
  87. /**
  88. * Start a modal drag session using the selection as the drag image.
  89. * The aDragEvent must be supplied as the current screen coordinates of the
  90. * event are needed to calculate the image location.
  91. *
  92. * Note: This method is deprecated for non-native code.
  93. */
  94. void invokeDragSessionWithSelection(in nsISelection aSelection,
  95. in nsIArray aTransferableArray,
  96. in unsigned long aActionType,
  97. in nsIDOMDragEvent aDragEvent,
  98. in nsIDOMDataTransfer aDataTransfer);
  99. /**
  100. * Returns the current Drag Session
  101. */
  102. nsIDragSession getCurrentSession ( ) ;
  103. /**
  104. * Tells the Drag Service to start a drag session. This is called when
  105. * an external drag occurs
  106. */
  107. void startDragSession ( ) ;
  108. /**
  109. * Tells the Drag Service to end a drag session. This is called when
  110. * an external drag occurs
  111. *
  112. * If aDoneDrag is true, the drag has finished, otherwise the drag has
  113. * just left the window.
  114. */
  115. void endDragSession ( in boolean aDoneDrag ) ;
  116. /**
  117. * Fire a drag event at the source of the drag
  118. */
  119. [noscript] void fireDragEventAtSource(in EventMessage aEventMessage);
  120. /**
  121. * Increase/decrease dragging suppress level by one.
  122. * If level is greater than one, dragging is disabled.
  123. */
  124. void suppress();
  125. void unsuppress();
  126. /**
  127. * aX and aY are in LayoutDevice pixels.
  128. */
  129. [noscript] void dragMoved(in long aX, in long aY);
  130. [notxpcom, nostdcall] boolean maybeAddChildProcess(in ContentParentPtr aChild);
  131. };
  132. %{ C++
  133. %}