Back to index

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

#include <nsDragHelperService.h>

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

List of all members.

Public Member Functions

 nsDragHelperService ()
virtual ~nsDragHelperService ()
void enter (in DragReference inDragRef, in nsIEventSink inSink)
 Call when the mouse has entered the rectangle bounding the browser during a drag.
void enter (in DragReference inDragRef, in nsIEventSink inSink)
 Call when the mouse has entered the rectangle bounding the browser during a drag.
boolean tracking (in DragReference inDragRef, in nsIEventSink inSink)
 Call when the mouse is inside the rectangle bounding the browser during a drag.
boolean tracking (in DragReference inDragRef, in nsIEventSink inSink)
 Call when the mouse is inside the rectangle bounding the browser during a drag.
void leave (in DragReference inDragRef, in nsIEventSink inSink)
 Call when the mouse has left the rectangle bounding the browser during a drag.
void leave (in DragReference inDragRef, in nsIEventSink inSink)
 Call when the mouse has left the rectangle bounding the browser during a drag.
boolean drop (in DragReference inDragRef, in nsIEventSink inSink)
 Call when a drop occurs inside the rectangle bounding the browser.
boolean drop (in DragReference inDragRef, in nsIEventSink inSink)
 Call when a drop occurs inside the rectangle bounding the browser.

Protected Member Functions

PRBool DoDragAction (PRUint32 aMessage, DragReference aDragRef, nsIEventSink *aSink)
void SetDragActionBasedOnModifiers (short inModifiers)
void SetDragOverTimer (nsIEventSink *aSink, DragRef aDragRef)

Static Protected Member Functions

static void DragOverTimerHandler (EventLoopTimerRef aTimer, void *aUserData)

Protected Attributes

nsCOMPtr< nsIDragServicemDragService
EventLoopTimerRef mDragOverTimer
nsCOMPtr< nsIEventSinkmDragOverSink
DragRef mDragOverDragRef

Detailed Description

Definition at line 61 of file nsDragHelperService.h.


Constructor & Destructor Documentation

Definition at line 56 of file nsDragHelperService.cpp.

Definition at line 66 of file nsDragHelperService.cpp.

{
  if (mDragOverTimer)
    ::RemoveEventLoopTimer(mDragOverTimer);

  NS_ASSERTION(!mDragService.get(),
               "A drag was not correctly ended by shutdown");
}

Here is the call graph for this function:


Member Function Documentation

PRBool nsDragHelperService::DoDragAction ( PRUint32  aMessage,
DragReference  aDragRef,
nsIEventSink aSink 
) [protected]

Definition at line 263 of file nsDragHelperService.cpp.

{
  // Get information about the drag.
  Point mouseLocGlobal;
  ::GetDragMouse(aDragRef, &mouseLocGlobal, nsnull);
  short modifiers;
  ::GetDragModifiers(aDragRef, &modifiers, nsnull, nsnull);

  // Set the drag action on the service so the frames know what is going on.
  SetDragActionBasedOnModifiers(modifiers);

  // Pass into Gecko for handling.
  PRBool handled = PR_FALSE;
  aSink->DragEvent(aMessage, mouseLocGlobal.h, mouseLocGlobal.v,
                   modifiers, &handled);

  return handled;
}

Here is the call graph for this function:

void nsDragHelperService::DragOverTimerHandler ( EventLoopTimerRef  aTimer,
void aUserData 
) [static, protected]

Definition at line 365 of file nsDragHelperService.cpp.

{
  nsDragHelperService* self = NS_STATIC_CAST(nsDragHelperService*, aUserData);

  self->DoDragAction(NS_DRAGDROP_OVER,
                     self->mDragOverDragRef, self->mDragOverSink);
}

Here is the caller graph for this function:

boolean nsIDragHelperService::drop ( in DragReference  inDragRef,
in nsIEventSink  inSink 
) [inherited]

Call when a drop occurs inside the rectangle bounding the browser.

Parameters:
inDragRefthe native DragReference
inSinkthe event sink to which the event will be dispatched
Returns:
PR_TRUE if the drag was accepted by Gecko.
boolean nsIDragHelperService::drop ( in DragReference  inDragRef,
in nsIEventSink  inSink 
) [inherited]

Call when a drop occurs inside the rectangle bounding the browser.

Parameters:
inDragRefthe native DragReference
inSinkthe event sink to which the event will be dispatched
Returns:
PR_TRUE if the drag was accepted by Gecko.
void nsIDragHelperService::enter ( in DragReference  inDragRef,
in nsIEventSink  inSink 
) [inherited]

Call when the mouse has entered the rectangle bounding the browser during a drag.

Parameters:
inDragRefthe native DragReference
inSinkthe event sink to which the event will be dispatched
void nsIDragHelperService::enter ( in DragReference  inDragRef,
in nsIEventSink  inSink 
) [inherited]

Call when the mouse has entered the rectangle bounding the browser during a drag.

Parameters:
inDragRefthe native DragReference
inSinkthe event sink to which the event will be dispatched
void nsIDragHelperService::leave ( in DragReference  inDragRef,
in nsIEventSink  inSink 
) [inherited]

Call when the mouse has left the rectangle bounding the browser during a drag.

Parameters:
inDragRefthe native DragReference
inSinkthe event sink to which the event will be dispatched
void nsIDragHelperService::leave ( in DragReference  inDragRef,
in nsIEventSink  inSink 
) [inherited]

Call when the mouse has left the rectangle bounding the browser during a drag.

Parameters:
inDragRefthe native DragReference
inSinkthe event sink to which the event will be dispatched
void nsDragHelperService::SetDragActionBasedOnModifiers ( short  inModifiers) [protected]

Definition at line 292 of file nsDragHelperService.cpp.

{
  nsCOMPtr<nsIDragSession> dragSession;
  mDragService->GetCurrentSession(getter_AddRefs(dragSession));
  if (dragSession) {
    PRUint32 action = nsIDragService::DRAGDROP_ACTION_MOVE;

    // force copy = option, alias = cmd-option, default is move
    if (inModifiers & optionKey) {
      if (inModifiers & cmdKey)
        action = nsIDragService::DRAGDROP_ACTION_LINK;
      else
        action = nsIDragService::DRAGDROP_ACTION_COPY;
    }

    dragSession->SetDragAction(action);
  }

} // SetDragActionBasedOnModifiers

Here is the call graph for this function:

Here is the caller graph for this function:

void nsDragHelperService::SetDragOverTimer ( nsIEventSink aSink,
DragRef  aDragRef 
) [protected]

Definition at line 321 of file nsDragHelperService.cpp.

{
  // win32 seems to use 16Hz internally, gtk2 has a 10Hz timer
  const EventTimerInterval kDragOverInterval = 1.0/10.0;

  if (!aSink || !aDragRef) {
    // Cancel the timer.
    if (mDragOverTimer) {
      ::RemoveEventLoopTimer(mDragOverTimer);
      mDragOverTimer = nsnull;
      mDragOverSink = nsnull;
    }
    return;
  }

  if (mDragOverTimer) {
    // A timer is already running, just bump its next-fire time.
    ::SetEventLoopTimerNextFireTime(mDragOverTimer, kDragOverInterval);
    return;
  }

  mDragOverSink = aSink;
  mDragOverDragRef = aDragRef;

  static EventLoopTimerUPP sDragOverTimerUPP;
  if (!sDragOverTimerUPP)
    sDragOverTimerUPP = ::NewEventLoopTimerUPP(DragOverTimerHandler);
 
  ::InstallEventLoopTimer(::GetCurrentEventLoop(),
                          kDragOverInterval,
                          kDragOverInterval,
                          sDragOverTimerUPP,
                          this,
                          &mDragOverTimer);
}

Here is the call graph for this function:

boolean nsIDragHelperService::tracking ( in DragReference  inDragRef,
in nsIEventSink  inSink 
) [inherited]

Call when the mouse is inside the rectangle bounding the browser during a drag.

The return value indicates if Gecko would accept the contents of the drag if a drop were to happen with the mouse in the current position. This can be used for doing some rudimentary drop feedback.

Parameters:
inDragRefthe native DragReference
inSinkthe event sink to which the event will be dispatched
Returns:
PR_TRUE if the drag would be accepted by Gecko.
boolean nsIDragHelperService::tracking ( in DragReference  inDragRef,
in nsIEventSink  inSink 
) [inherited]

Call when the mouse is inside the rectangle bounding the browser during a drag.

The return value indicates if Gecko would accept the contents of the drag if a drop were to happen with the mouse in the current position. This can be used for doing some rudimentary drop feedback.

Parameters:
inDragRefthe native DragReference
inSinkthe event sink to which the event will be dispatched
Returns:
PR_TRUE if the drag would be accepted by Gecko.

Member Data Documentation

Definition at line 95 of file nsDragHelperService.h.

Definition at line 94 of file nsDragHelperService.h.

EventLoopTimerRef nsDragHelperService::mDragOverTimer [protected]

Definition at line 93 of file nsDragHelperService.h.

Definition at line 90 of file nsDragHelperService.h.


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