Visit Mozilla.org

nsIDragSession

From MDC

This article covers features introduced in Firefox 2


Contents

nsIDragSession is defined in widget/public/nsIDragSession.idl. It is scriptable and unfrozen (hasn't changed since Mozilla 1.8).

Inherits from: nsISupports

[edit] Method overview

void getData(in nsITransferable aTransferable, in unsigned long aItemIndex);
boolean isDataFlavorSupported(in string aDataFlavor);

[edit] Attributes

Attribute Type Description
canDrop boolean Set the current state of the drag, whether it can be dropped or not. Usually the target "frame" sets this so the native system can render the correct feedback.
dragAction unsigned long Sets the action (copy, move, link, et.c) for the current drag
targetSize nsSize Sets the current width and height of the drag target area. It will contain the current size of the Frame that the drag is currently in.
numDropItems readonly unsigned long Get the number of items that were dropped
sourceDocument readonly nsIDOMDocument The document where the drag was started, which will be null if the drag originated outside the application. Useful for determining if a drop originated in the same document.
sourceNode readonly nsIDOMNode The dom node that was originally dragged to start the session, which will be null if the drag originated outside the application.

[edit] Methods

[edit] getData()

Get data from a Drag&Drop. Can be called while the drag is in process or after the drop has completed.

  void getData ( 
     in nsITransferable aTransferable, 
     in unsigned long aItemIndex 
  ) ;
[edit] Parameters
aTransferable
The transferable for the data to be put into
aItemIndex
aItemIndex which of multiple drag items, zero-based

[edit] isDataFlavorSupported()

Check to set if any of the native data on the clipboard matches this data flavor

  boolean isDataFlavorSupported ( 
     in string aDataFlavor 
  ) ;
[edit] Parameters
aDataFlavor