widget/nsIDragService.idl

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/widget/nsIDragService.idl	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,122 @@
     1.4 +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
     1.5 + *
     1.6 + * This Source Code Form is subject to the terms of the Mozilla Public
     1.7 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.8 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.9 +
    1.10 +#include "nsISupports.idl"
    1.11 +#include "nsISupportsArray.idl"
    1.12 +#include "nsIDragSession.idl"
    1.13 +#include "nsIScriptableRegion.idl"
    1.14 +
    1.15 +
    1.16 +interface nsIDOMNode;
    1.17 +interface nsIDOMDragEvent;
    1.18 +interface nsIDOMDataTransfer;
    1.19 +interface nsISelection;
    1.20 +
    1.21 +[scriptable, uuid(82B58ADA-F490-4C3D-B737-1057C4F1D052), builtinclass]
    1.22 +interface nsIDragService : nsISupports
    1.23 +{
    1.24 +  const long DRAGDROP_ACTION_NONE = 0;
    1.25 +  const long DRAGDROP_ACTION_COPY = 1;
    1.26 +  const long DRAGDROP_ACTION_MOVE = 2;
    1.27 +  const long DRAGDROP_ACTION_LINK = 4;
    1.28 +  const long DRAGDROP_ACTION_UNINITIALIZED = 64;
    1.29 +
    1.30 +  /**
    1.31 +    * Starts a modal drag session with an array of transaferables 
    1.32 +    *
    1.33 +    * @param  aTransferables - an array of transferables to be dragged
    1.34 +    * @param  aRegion - a region containing rectangles for cursor feedback, 
    1.35 +    *            in window coordinates.
    1.36 +    * @param  aActionType - specified which of copy/move/link are allowed
    1.37 +    */
    1.38 +  void invokeDragSession ( in nsIDOMNode aDOMNode, in nsISupportsArray aTransferables, 
    1.39 +                             in nsIScriptableRegion aRegion, in unsigned long aActionType );
    1.40 +
    1.41 +  /**
    1.42 +   * Starts a modal drag session using an image. The first four arguments are
    1.43 +   * the same as invokeDragSession.
    1.44 +   *
    1.45 +   * A custom image may be specified using the aImage argument. If this is
    1.46 +   * supplied, the aImageX and aImageY arguments specify the offset within
    1.47 +   * the image where the cursor would be positioned. That is, when the image
    1.48 +   * is drawn, it is offset up and left the amount so that the cursor appears
    1.49 +   * at that location within the image.
    1.50 +   *
    1.51 +   * If aImage is null, aImageX and aImageY are not used and the image is instead
    1.52 +   * determined from the source node aDOMNode, and the offset calculated so that
    1.53 +   * the initial location for the image appears in the same screen position as
    1.54 +   * where the element is located. The node must be within a document.
    1.55 +   *
    1.56 +   * Currently, supported images are all DOM nodes. If this is an HTML <image> or
    1.57 +   * <canvas>, the drag image is taken from the image data. If the element is in
    1.58 +   * a document, it will be rendered at its displayed size, othewise, it will be
    1.59 +   * rendered at its real size. For other types of elements, the element is
    1.60 +   * rendered into an offscreen buffer in the same manner as it is currently
    1.61 +   * displayed. The document selection is hidden while drawing.
    1.62 +   *
    1.63 +   * The aDragEvent must be supplied as the current screen coordinates of the
    1.64 +   * event are needed to calculate the image location.
    1.65 +   */
    1.66 +  void invokeDragSessionWithImage(in nsIDOMNode aDOMNode,
    1.67 +                                  in nsISupportsArray aTransferableArray,
    1.68 +                                  in nsIScriptableRegion aRegion,
    1.69 +                                  in unsigned long aActionType,
    1.70 +                                  in nsIDOMNode aImage,
    1.71 +                                  in long aImageX,
    1.72 +                                  in long aImageY,
    1.73 +                                  in nsIDOMDragEvent aDragEvent,
    1.74 +                                  in nsIDOMDataTransfer aDataTransfer);
    1.75 +
    1.76 +  /**
    1.77 +   * Start a modal drag session using the selection as the drag image.
    1.78 +   * The aDragEvent must be supplied as the current screen coordinates of the
    1.79 +   * event are needed to calculate the image location.
    1.80 +   */
    1.81 +  void invokeDragSessionWithSelection(in nsISelection aSelection,
    1.82 +                                      in nsISupportsArray aTransferableArray,
    1.83 +                                      in unsigned long aActionType,
    1.84 +                                      in nsIDOMDragEvent aDragEvent,
    1.85 +                                      in nsIDOMDataTransfer aDataTransfer);
    1.86 +
    1.87 +  /**
    1.88 +    * Returns the current Drag Session  
    1.89 +    */
    1.90 +  nsIDragSession getCurrentSession ( ) ;
    1.91 +
    1.92 +  /**
    1.93 +    * Tells the Drag Service to start a drag session. This is called when
    1.94 +    * an external drag occurs
    1.95 +    */
    1.96 +  void startDragSession ( ) ;
    1.97 +
    1.98 +  /**
    1.99 +    * Tells the Drag Service to end a drag session. This is called when
   1.100 +    * an external drag occurs
   1.101 +    *
   1.102 +    * If aDoneDrag is true, the drag has finished, otherwise the drag has
   1.103 +    * just left the window.
   1.104 +    */
   1.105 +  void endDragSession ( in boolean aDoneDrag ) ;
   1.106 +
   1.107 +  /**
   1.108 +   * Fire a drag event at the source of the drag
   1.109 +   */
   1.110 +  void fireDragEventAtSource ( in unsigned long aMsg );
   1.111 +
   1.112 +  /**
   1.113 +   * Increase/decrease dragging suppress level by one.
   1.114 +   * If level is greater than one, dragging is disabled.
   1.115 +   */
   1.116 +  void suppress();
   1.117 +  void unsuppress();
   1.118 +
   1.119 +  [noscript] void dragMoved(in long aX, in long aY);
   1.120 +};
   1.121 +
   1.122 +
   1.123 +%{ C++
   1.124 +
   1.125 +%}

mercurial