XUL:Specs:TransferData: Difference between revisions

Jump to navigation Jump to search
another possible api for drag/drop
(another possible api for drag/drop)
Line 161: Line 161:


This interface was added in Mozilla 1.9.
This interface was added in Mozilla 1.9.
= Other Possibilities =
This is another possible set of interfaces. Here, the event has a dataTransferList property containing a set of nsIDOMDataTransfer objects. The 'dataTransfer' property of the event always returns the first one.
<pre>
interface nsIDOMDragEvent : nsIDOMMouseEvent
{
  readonly attribute nsIDOMDataTransfer dataTransfer;
  void initDragEvent(in DOMString typeArg,
                    in boolean canBubbleArg,
                    in boolean cancelableArg);
  void initDragEventNS(in DOMString namespaceURIArg,
                      in DOMString typeArg,
                      in boolean canBubbleArg,
                      in boolean cancelableArg);
};
interface nsIDOMNSDragEvent : nsISupports
{
  readonly attribute nsIDOMDataTransferList dataTransferList;
}
interface nsIDOMDataTransferList : nsISupports
{
  readonly attribute unsigned long length;
  nsIDOMDataTransfer item(in unsigned long length);
  nsIDOMDataTransfer appendDataTransfer();
  nsIDOMDataTransfer insertDataTransfer(in unsigned long index);
  nsIDOMDataTransfer removeDataTransfer(in unsigned long index);
  nsIVariant getAny(in unsigned long index);
  // these could go in the event
  attribute unsigned long flags;
  attribute nsIScriptableRegion dragRegion;
  readonly attribute nsITransferable transferable;
  [noscript] nsIDOMNSDataTransfer clone(in PRUint32 aEventType);
  [noscript] void allowAnyAccess();
}
interface nsIDOMDataTransfer : nsISupports
{
  attribute DOMString dropEffect;
  attribute DOMString effectAllowed;
  void clearData(in DOMString format);
  void setData(in DOMString format, in DOMString data);
  DOMString getData(in DOMString format);
  void setDragImage(in nsIDOMElement image, in long x, in long y);
  void addElement(in nsIDOMElement element);
}
interface nsIDOMNSDataTransfer : nsISupports
{
  boolean hasFormat(in AString format);
  nsIVariant getObject(in AString format);
  nsIVariant getObjectInSet(in AString formats, out AString foundFormat);
  void setObject(in AString format, in nsIVariant data);
  readonly attribute nsIDOMDOMStringList formats;
}
</pre>
287

edits

Navigation menu