nsIDOMDataTransfer.idl 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  1. /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
  2. /* This Source Code Form is subject to the terms of the Mozilla Public
  3. * License, v. 2.0. If a copy of the MPL was not distributed with this
  4. * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
  5. #include "domstubs.idl"
  6. interface nsIVariant;
  7. interface nsIDOMFileList;
  8. [builtinclass, uuid(655078bf-1675-4aa0-a48d-a133e864ce57)]
  9. interface nsIDOMDataTransfer : nsISupports
  10. {
  11. /**
  12. * The actual effect that will be used, and should always be one of the
  13. * possible values of effectAllowed.
  14. *
  15. * For dragstart, drag and dragleave events, the dropEffect is initialized
  16. * to none. Any value assigned to the dropEffect will be set, but the value
  17. * isn't used for anything.
  18. *
  19. * For the dragenter and dragover events, the dropEffect will be initialized
  20. * based on what action the user is requesting. How this is determined is
  21. * platform specific, but typically the user can press modifier keys to
  22. * adjust which action is desired. Within an event handler for the dragenter
  23. * and dragover events, the dropEffect should be modified if the action the
  24. * user is requesting is not the one that is desired.
  25. *
  26. * For the drop and dragend events, the dropEffect will be initialized to
  27. * the action that was desired, which will be the value that the dropEffect
  28. * had after the last dragenter or dragover event.
  29. *
  30. * Possible values:
  31. * copy - a copy of the source item is made at the new location
  32. * move - an item is moved to a new location
  33. * link - a link is established to the source at the new location
  34. * none - the item may not be dropped
  35. *
  36. * Assigning any other value has no effect and retains the old value.
  37. */
  38. attribute DOMString dropEffect;
  39. /*
  40. * Specifies the effects that are allowed for this drag. You may set this in
  41. * the dragstart event to set the desired effects for the source, and within
  42. * the dragenter and dragover events to set the desired effects for the
  43. * target. The value is not used for other events.
  44. *
  45. * Possible values:
  46. * copy - a copy of the source item is made at the new location
  47. * move - an item is moved to a new location
  48. * link - a link is established to the source at the new location
  49. * copyLink, copyMove, linkMove, all - combinations of the above
  50. * none - the item may not be dropped
  51. * uninitialized - the default value when the effect has not been set,
  52. * equivalent to all.
  53. *
  54. * Assigning any other value has no effect and retains the old value.
  55. */
  56. attribute DOMString effectAllowed;
  57. /**
  58. * Holds a list of all the local files available on this data transfer.
  59. * A dataTransfer containing no files will return an empty list, and an
  60. * invalid index access on the resulting file list will return null.
  61. */
  62. readonly attribute nsIDOMFileList files;
  63. /**
  64. * Set the image to be used for dragging if a custom one is desired. Most of
  65. * the time, this would not be set, as a default image is created from the
  66. * node that was dragged.
  67. *
  68. * If the node is an HTML img element, an HTML canvas element or a XUL image
  69. * element, the image data is used. Otherwise, image should be a visible
  70. * node and the drag image will be created from this. If image is null, any
  71. * custom drag image is cleared and the default is used instead.
  72. *
  73. * The coordinates specify the offset into the image where the mouse cursor
  74. * should be. To center the image for instance, use values that are half the
  75. * width and height.
  76. *
  77. * @param image a node to use
  78. * @param x the horizontal offset
  79. * @param y the vertical offset
  80. * @throws NO_MODIFICATION_ALLOWED_ERR if the item cannot be modified
  81. */
  82. void setDragImage(in nsIDOMElement image, in long x, in long y);
  83. /*
  84. * Set the drag source. Usually you would not change this, but it will
  85. * affect which node the drag and dragend events are fired at. The
  86. * default target is the node that was dragged.
  87. *
  88. * @param element drag source to use
  89. * @throws NO_MODIFICATION_ALLOWED_ERR if the item cannot be modified
  90. */
  91. void addElement(in nsIDOMElement element);
  92. /**
  93. * The number of items being dragged.
  94. */
  95. readonly attribute unsigned long mozItemCount;
  96. /**
  97. * Sets the drag cursor state. Primarily used to control the cursor during
  98. * tab drags, but could be expanded to other uses. XXX Currently implemented
  99. * on Win32 only.
  100. *
  101. * Possible values:
  102. * auto - use default system behavior.
  103. * default - set the cursor to an arrow during the drag operation.
  104. *
  105. * Values other than 'default' are indentical to setting mozCursor to
  106. * 'auto'.
  107. */
  108. attribute DOMString mozCursor;
  109. /**
  110. * Holds a list of the format types of the data that is stored for an item
  111. * at the specified index. If the index is not in the range from 0 to
  112. * itemCount - 1, an empty string list is returned.
  113. */
  114. nsISupports mozTypesAt(in unsigned long index);
  115. /**
  116. * Will be true when the user has cancelled the drag (typically by pressing
  117. * Escape) and when the drag has been cancelled unexpectedly. This will be
  118. * false otherwise, including when the drop has been rejected by its target.
  119. * This property is only relevant for the dragend event.
  120. */
  121. readonly attribute boolean mozUserCancelled;
  122. /**
  123. * The node that the mouse was pressed over to begin the drag. For external
  124. * drags, or if the caller cannot access this node, this will be null.
  125. */
  126. readonly attribute nsIDOMNode mozSourceNode;
  127. /*
  128. * Integer version of dropEffect, set to one of the constants in nsIDragService.
  129. */
  130. [noscript] attribute unsigned long dropEffectInt;
  131. /*
  132. * Integer version of effectAllowed, set to one or a combination of the
  133. * constants in nsIDragService.
  134. */
  135. [noscript] attribute unsigned long effectAllowedInt;
  136. };