Blame widget/nsIDragService.idl

Packit f0b94e
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
Packit f0b94e
 *
Packit f0b94e
 * This Source Code Form is subject to the terms of the Mozilla Public
Packit f0b94e
 * License, v. 2.0. If a copy of the MPL was not distributed with this
Packit f0b94e
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
Packit f0b94e
Packit f0b94e
#include "nsIArray.idl"
Packit f0b94e
#include "nsISupports.idl"
Packit f0b94e
#include "nsIDragSession.idl"
Packit f0b94e
#include "nsIScriptableRegion.idl"
Packit f0b94e
#include "nsIContentPolicy.idl"
Packit f0b94e
Packit f0b94e
interface nsIDOMNode;
Packit f0b94e
interface nsIDOMDragEvent;
Packit f0b94e
interface nsIDOMDataTransfer;
Packit f0b94e
interface nsISelection;
Packit f0b94e
Packit f0b94e
%{C++
Packit f0b94e
#include "mozilla/EventForwards.h"
Packit f0b94e
Packit f0b94e
namespace mozilla {
Packit f0b94e
namespace dom {
Packit f0b94e
class ContentParent;
Packit f0b94e
} // namespace dom
Packit f0b94e
} // namespace mozilla
Packit f0b94e
%}
Packit f0b94e
Packit f0b94e
[ptr] native ContentParentPtr(mozilla::dom::ContentParent);
Packit f0b94e
native EventMessage(mozilla::EventMessage);
Packit f0b94e
Packit f0b94e
[scriptable, uuid(ebd6b3a2-af16-43af-a698-3091a087dd62), builtinclass]
Packit f0b94e
interface nsIDragService : nsISupports
Packit f0b94e
{
Packit f0b94e
  const long DRAGDROP_ACTION_NONE = 0;
Packit f0b94e
  const long DRAGDROP_ACTION_COPY = 1;
Packit f0b94e
  const long DRAGDROP_ACTION_MOVE = 2;
Packit f0b94e
  const long DRAGDROP_ACTION_LINK = 4;
Packit f0b94e
  const long DRAGDROP_ACTION_UNINITIALIZED = 64;
Packit f0b94e
Packit f0b94e
  /**
Packit f0b94e
    * Starts a modal drag session with an array of transaferables.
Packit f0b94e
    *
Packit f0b94e
    * Note: This method is deprecated for non-native code.
Packit f0b94e
    *
Packit f0b94e
    * @param  aPrincipalURISpec - the URI of the triggering principal of the
Packit f0b94e
    *            drag, or an empty string if it's from browser chrome or OS
Packit f0b94e
    * @param  aTransferables - an array of transferables to be dragged
Packit f0b94e
    * @param  aRegion - a region containing rectangles for cursor feedback, 
Packit f0b94e
    *            in window coordinates.
Packit f0b94e
    * @param  aActionType - specified which of copy/move/link are allowed
Packit f0b94e
    * @param  aContentPolicyType - the contentPolicyType that will be
Packit f0b94e
    *           passed to the loadInfo when creating a new channel
Packit f0b94e
    *           (defaults to TYPE_OTHER)
Packit f0b94e
    */
Packit f0b94e
  void invokeDragSession (in nsIDOMNode aDOMNode,
Packit f0b94e
                          in AUTF8String aPrincipalURISpec,
Packit f0b94e
                          in nsIArray aTransferables, 
Packit f0b94e
                          in nsIScriptableRegion aRegion,
Packit f0b94e
                          in unsigned long aActionType,
Packit f0b94e
                          [optional] in nsContentPolicyType aContentPolicyType);
Packit f0b94e
Packit f0b94e
  /**
Packit f0b94e
   * Starts a modal drag session using an image. The first four arguments are
Packit f0b94e
   * the same as invokeDragSession.
Packit f0b94e
   *
Packit f0b94e
   * Note: This method is deprecated for non-native code.
Packit f0b94e
   *
Packit f0b94e
   * A custom image may be specified using the aImage argument. If this is
Packit f0b94e
   * supplied, the aImageX and aImageY arguments specify the offset within
Packit f0b94e
   * the image where the cursor would be positioned. That is, when the image
Packit f0b94e
   * is drawn, it is offset up and left the amount so that the cursor appears
Packit f0b94e
   * at that location within the image.
Packit f0b94e
   *
Packit f0b94e
   * If aImage is null, aImageX and aImageY are not used and the image is instead
Packit f0b94e
   * determined from the source node aDOMNode, and the offset calculated so that
Packit f0b94e
   * the initial location for the image appears in the same screen position as
Packit f0b94e
   * where the element is located. The node must be within a document.
Packit f0b94e
   *
Packit f0b94e
   * Currently, supported images are all DOM nodes. If this is an HTML <image> or
Packit f0b94e
   * <canvas>, the drag image is taken from the image data. If the element is in
Packit f0b94e
   * a document, it will be rendered at its displayed size, othewise, it will be
Packit f0b94e
   * rendered at its real size. For other types of elements, the element is
Packit f0b94e
   * rendered into an offscreen buffer in the same manner as it is currently
Packit f0b94e
   * displayed. The document selection is hidden while drawing.
Packit f0b94e
   *
Packit f0b94e
   * The aDragEvent must be supplied as the current screen coordinates of the
Packit f0b94e
   * event are needed to calculate the image location.
Packit f0b94e
   */
Packit f0b94e
  void invokeDragSessionWithImage(in nsIDOMNode aDOMNode,
Packit f0b94e
                                  in AUTF8String aPrincipalURISpec,
Packit f0b94e
                                  in nsIArray aTransferableArray,
Packit f0b94e
                                  in nsIScriptableRegion aRegion,
Packit f0b94e
                                  in unsigned long aActionType,
Packit f0b94e
                                  in nsIDOMNode aImage,
Packit f0b94e
                                  in long aImageX,
Packit f0b94e
                                  in long aImageY,
Packit f0b94e
                                  in nsIDOMDragEvent aDragEvent,
Packit f0b94e
                                  in nsIDOMDataTransfer aDataTransfer);
Packit f0b94e
Packit f0b94e
  /**
Packit f0b94e
   * Start a modal drag session using the selection as the drag image.
Packit f0b94e
   * The aDragEvent must be supplied as the current screen coordinates of the
Packit f0b94e
   * event are needed to calculate the image location.
Packit f0b94e
   *
Packit f0b94e
   * Note: This method is deprecated for non-native code.
Packit f0b94e
   */
Packit f0b94e
  void invokeDragSessionWithSelection(in nsISelection aSelection,
Packit f0b94e
                                      in AUTF8String aPrincipalURISpec,
Packit f0b94e
                                      in nsIArray aTransferableArray,
Packit f0b94e
                                      in unsigned long aActionType,
Packit f0b94e
                                      in nsIDOMDragEvent aDragEvent,
Packit f0b94e
                                      in nsIDOMDataTransfer aDataTransfer);
Packit f0b94e
Packit f0b94e
  /**
Packit f0b94e
    * Returns the current Drag Session  
Packit f0b94e
    */
Packit f0b94e
  nsIDragSession getCurrentSession ( ) ;
Packit f0b94e
Packit f0b94e
  /**
Packit f0b94e
    * Tells the Drag Service to start a drag session. This is called when
Packit f0b94e
    * an external drag occurs
Packit f0b94e
    */
Packit f0b94e
  void startDragSession ( ) ;
Packit f0b94e
Packit f0b94e
  /**
Packit f0b94e
    * Tells the Drag Service to end a drag session. This is called when
Packit f0b94e
    * an external drag occurs
Packit f0b94e
    *
Packit f0b94e
    * If aDoneDrag is true, the drag has finished, otherwise the drag has
Packit f0b94e
    * just left the window.
Packit f0b94e
    */
Packit f0b94e
  void endDragSession(in boolean aDoneDrag,
Packit f0b94e
                      [optional] in unsigned long aKeyModifiers);
Packit f0b94e
Packit f0b94e
  /**
Packit f0b94e
   * Fire a drag event at the source of the drag
Packit f0b94e
   */
Packit f0b94e
  [noscript] void fireDragEventAtSource(in EventMessage aEventMessage,
Packit f0b94e
                                        in unsigned long aKeyModifiers);
Packit f0b94e
Packit f0b94e
  /**
Packit f0b94e
   * Increase/decrease dragging suppress level by one.
Packit f0b94e
   * If level is greater than one, dragging is disabled.
Packit f0b94e
   */
Packit f0b94e
  void suppress();
Packit f0b94e
  void unsuppress();
Packit f0b94e
Packit f0b94e
  /**
Packit f0b94e
    * aX and aY are in LayoutDevice pixels.
Packit f0b94e
    */
Packit f0b94e
  [noscript] void dragMoved(in long aX, in long aY);
Packit f0b94e
Packit f0b94e
  [notxpcom, nostdcall] boolean maybeAddChildProcess(in ContentParentPtr aChild);
Packit f0b94e
};
Packit f0b94e
Packit f0b94e
Packit f0b94e
%{ C++
Packit f0b94e
Packit f0b94e
%}