Back to index

lightning-sunbird  0.9+nobinonly
Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes
nsBaseDragService Class Reference

XP DragService wrapper base class. More...

#include <nsBaseDragService.h>

Inheritance diagram for nsBaseDragService:
Inheritance graph
[legend]
Collaboration diagram for nsBaseDragService:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 nsBaseDragService ()
virtual ~nsBaseDragService ()
void suppress ()
 Increase/decrease dragging suppress level by one.
void unsuppress ()
void invokeDragSession (in nsIDOMNode aDOMNode, in nsISupportsArray aTransferables, in nsIScriptableRegion aRegion, in unsigned long aActionType)
 Starts a modal drag session with an array of transaferables.
nsIDragSession getCurrentSession ()
 Returns the current Drag Session.
void startDragSession ()
 Tells the Drag Service to start a drag session.
void endDragSession ()
 Tells the Drag Service to end a drag session.
void getData (in nsITransferable aTransferable, in unsigned long aItemIndex)
 Get data from a Drag&Drop.
boolean isDataFlavorSupported (in string aDataFlavor)
 Check to set if ant of the native data on the clipboard matches this data flavor.

Public Attributes

const long DRAGDROP_ACTION_NONE = 0
const long DRAGDROP_ACTION_COPY = 1
const long DRAGDROP_ACTION_MOVE = 2
const long DRAGDROP_ACTION_LINK = 4
attribute boolean canDrop
 Set the current state of the drag whether it can be dropped or not.
attribute unsigned long dragAction
 Sets the action (copy, move, link, et.c) for the current drag.
attribute nsSize targetSize
 Sets the current width and height if the drag target area.
readonly attribute unsigned long numDropItems
 Get the number items that were dropped.
readonly attribute nsIDOMDocument sourceDocument
 The document where the drag was started, which will be null if the drag originated outside the application.
readonly attribute nsIDOMNode sourceNode
 The dom node that was originally dragged to start the session, which will be null if the drag originated outside the application.

Protected Member Functions

virtual void GetFrameFromNode (nsIDOMNode *inNode, nsIFrame **outFrame, nsPresContext **outContext)

Protected Attributes

PRPackedBool mCanDrop
PRPackedBool mDoingDrag
PRUint32 mDragAction
nsSize mTargetSize
nsCOMPtr< nsISupportsArraymTransArray
nsCOMPtr< nsIDOMNodemSourceNode
nsCOMPtr< nsIDOMDocumentmSourceDocument
PRUint32 mSuppressLevel

Detailed Description

XP DragService wrapper base class.

Definition at line 57 of file nsBaseDragService.h.


Constructor & Destructor Documentation

Definition at line 85 of file nsBaseDragService.cpp.

{
}

Member Function Documentation

Tells the Drag Service to end a drag session.

This is called when an external drag occurs

Returns the current Drag Session.

void nsIDragSession::getData ( in nsITransferable  aTransferable,
in unsigned long  aItemIndex 
) [inherited]

Get data from a Drag&Drop.

Can be called while the drag is in process or after the drop has completed.

Parameters:
aTransferablethe transferable for the data to be put into
aItemIndexwhich of multiple drag items, zero-based
void nsBaseDragService::GetFrameFromNode ( nsIDOMNode inNode,
nsIFrame **  outFrame,
nsPresContext **  outContext 
) [protected, virtual]

Definition at line 289 of file nsBaseDragService.cpp.

{
  *outFrame = nsnull;
  *outContext = nsnull;
  if (!inNode || !outContext)
    return;

  nsCOMPtr<nsIContent> contentNode = do_QueryInterface(inNode);
  if (contentNode) {
    nsIDocument* doc = contentNode->GetDocument();
    if (doc) {
      nsIPresShell *presShell = doc->GetShellAt(0);
      if (presShell) {
        NS_IF_ADDREF(*outContext = presShell->GetPresContext());
        presShell->GetPrimaryFrameFor(contentNode, outFrame);
        NS_ASSERTION(*outFrame, "Can't get frame for this dom node");
      }
    }
  }

} // GetFrameFromNode

Here is the call graph for this function:

Here is the caller graph for this function:

void nsIDragService::invokeDragSession ( in nsIDOMNode  aDOMNode,
in nsISupportsArray  aTransferables,
in nsIScriptableRegion  aRegion,
in unsigned long  aActionType 
) [inherited]

Starts a modal drag session with an array of transaferables.

Parameters:
aTransferables- an array of transferables to be dragged
aRegion- a region containing rectangles for cursor feedback, in window coordinates.
aActionType- specified which of copy/move/link are allowed

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

Returns:
NS_OK if if the data flavor is supported and, NS_ERROR_FAILURE is it is not

Tells the Drag Service to start a drag session.

This is called when an external drag occurs

Increase/decrease dragging suppress level by one.

If level is greater than one, dragging is disabled.


Member Data Documentation

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

Definition at line 62 of file nsIDragSession.idl.

Sets the action (copy, move, link, et.c) for the current drag.

Definition at line 67 of file nsIDragSession.idl.

Definition at line 53 of file nsIDragService.idl.

Definition at line 55 of file nsIDragService.idl.

Definition at line 54 of file nsIDragService.idl.

Definition at line 52 of file nsIDragService.idl.

Reimplemented in nsDragService.

Definition at line 78 of file nsBaseDragService.h.

Definition at line 79 of file nsBaseDragService.h.

Definition at line 80 of file nsBaseDragService.h.

Definition at line 84 of file nsBaseDragService.h.

Definition at line 83 of file nsBaseDragService.h.

Definition at line 86 of file nsBaseDragService.h.

Definition at line 81 of file nsBaseDragService.h.

Definition at line 82 of file nsBaseDragService.h.

readonly attribute unsigned long nsIDragSession::numDropItems [inherited]

Get the number items that were dropped.

Definition at line 78 of file nsIDragSession.idl.

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.

Definition at line 85 of file nsIDragSession.idl.

The dom node that was originally dragged to start the session, which will be null if the drag originated outside the application.

Definition at line 91 of file nsIDragSession.idl.

Sets the current width and height if the drag target area.

It will contain the current size of the Frame that the drag is currently in

Definition at line 73 of file nsIDragSession.idl.


The documentation for this class was generated from the following files: