widget/nsIDragService.idl

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

     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/. */
     7 #include "nsISupports.idl"
     8 #include "nsISupportsArray.idl"
     9 #include "nsIDragSession.idl"
    10 #include "nsIScriptableRegion.idl"
    13 interface nsIDOMNode;
    14 interface nsIDOMDragEvent;
    15 interface nsIDOMDataTransfer;
    16 interface nsISelection;
    18 [scriptable, uuid(82B58ADA-F490-4C3D-B737-1057C4F1D052), builtinclass]
    19 interface nsIDragService : nsISupports
    20 {
    21   const long DRAGDROP_ACTION_NONE = 0;
    22   const long DRAGDROP_ACTION_COPY = 1;
    23   const long DRAGDROP_ACTION_MOVE = 2;
    24   const long DRAGDROP_ACTION_LINK = 4;
    25   const long DRAGDROP_ACTION_UNINITIALIZED = 64;
    27   /**
    28     * Starts a modal drag session with an array of transaferables 
    29     *
    30     * @param  aTransferables - an array of transferables to be dragged
    31     * @param  aRegion - a region containing rectangles for cursor feedback, 
    32     *            in window coordinates.
    33     * @param  aActionType - specified which of copy/move/link are allowed
    34     */
    35   void invokeDragSession ( in nsIDOMNode aDOMNode, in nsISupportsArray aTransferables, 
    36                              in nsIScriptableRegion aRegion, in unsigned long aActionType );
    38   /**
    39    * Starts a modal drag session using an image. The first four arguments are
    40    * the same as invokeDragSession.
    41    *
    42    * A custom image may be specified using the aImage argument. If this is
    43    * supplied, the aImageX and aImageY arguments specify the offset within
    44    * the image where the cursor would be positioned. That is, when the image
    45    * is drawn, it is offset up and left the amount so that the cursor appears
    46    * at that location within the image.
    47    *
    48    * If aImage is null, aImageX and aImageY are not used and the image is instead
    49    * determined from the source node aDOMNode, and the offset calculated so that
    50    * the initial location for the image appears in the same screen position as
    51    * where the element is located. The node must be within a document.
    52    *
    53    * Currently, supported images are all DOM nodes. If this is an HTML <image> or
    54    * <canvas>, the drag image is taken from the image data. If the element is in
    55    * a document, it will be rendered at its displayed size, othewise, it will be
    56    * rendered at its real size. For other types of elements, the element is
    57    * rendered into an offscreen buffer in the same manner as it is currently
    58    * displayed. The document selection is hidden while drawing.
    59    *
    60    * The aDragEvent must be supplied as the current screen coordinates of the
    61    * event are needed to calculate the image location.
    62    */
    63   void invokeDragSessionWithImage(in nsIDOMNode aDOMNode,
    64                                   in nsISupportsArray aTransferableArray,
    65                                   in nsIScriptableRegion aRegion,
    66                                   in unsigned long aActionType,
    67                                   in nsIDOMNode aImage,
    68                                   in long aImageX,
    69                                   in long aImageY,
    70                                   in nsIDOMDragEvent aDragEvent,
    71                                   in nsIDOMDataTransfer aDataTransfer);
    73   /**
    74    * Start a modal drag session using the selection as the drag image.
    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 invokeDragSessionWithSelection(in nsISelection aSelection,
    79                                       in nsISupportsArray aTransferableArray,
    80                                       in unsigned long aActionType,
    81                                       in nsIDOMDragEvent aDragEvent,
    82                                       in nsIDOMDataTransfer aDataTransfer);
    84   /**
    85     * Returns the current Drag Session  
    86     */
    87   nsIDragSession getCurrentSession ( ) ;
    89   /**
    90     * Tells the Drag Service to start a drag session. This is called when
    91     * an external drag occurs
    92     */
    93   void startDragSession ( ) ;
    95   /**
    96     * Tells the Drag Service to end a drag session. This is called when
    97     * an external drag occurs
    98     *
    99     * If aDoneDrag is true, the drag has finished, otherwise the drag has
   100     * just left the window.
   101     */
   102   void endDragSession ( in boolean aDoneDrag ) ;
   104   /**
   105    * Fire a drag event at the source of the drag
   106    */
   107   void fireDragEventAtSource ( in unsigned long aMsg );
   109   /**
   110    * Increase/decrease dragging suppress level by one.
   111    * If level is greater than one, dragging is disabled.
   112    */
   113   void suppress();
   114   void unsuppress();
   116   [noscript] void dragMoved(in long aX, in long aY);
   117 };
   120 %{ C++
   122 %}

mercurial