1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5 #ifndef _nsNativeDragTarget_h_
6 #define _nsNativeDragTarget_h_
9 #include "nsIDragSession.h"
13 #ifndef IDropTargetHelper
14 #include <shobjidl.h> // Vista drag image interfaces
17 #include "mozilla/Attributes.h"
25 * nsNativeDragTarget implements the IDropTarget interface and gets most of its
26 * behavior from the associated adapter (m_dragDrop).
29 class nsNativeDragTarget MOZ_FINAL
: public IDropTarget
32 nsNativeDragTarget(nsIWidget
* aWidget
);
33 ~nsNativeDragTarget();
35 // IUnknown members - see iunknown.h for documentation
36 STDMETHODIMP
QueryInterface(REFIID
, void**);
37 STDMETHODIMP_(ULONG
) AddRef();
38 STDMETHODIMP_(ULONG
) Release();
40 // IDataTarget members
42 // Set pEffect based on whether this object can support a drop based on
43 // the data available from pSource, the key and mouse states specified
44 // in grfKeyState, and the coordinates specified by point. This is
45 // called by OLE when a drag enters this object's window (as registered
47 STDMETHODIMP
DragEnter(LPDATAOBJECT pSource
, DWORD grfKeyState
,
48 POINTL point
, DWORD
* pEffect
);
50 // Similar to DragEnter except it is called frequently while the drag
51 // is over this object's window.
52 STDMETHODIMP
DragOver(DWORD grfKeyState
, POINTL point
, DWORD
* pEffect
);
54 // Release the drag-drop source and put internal state back to the point
55 // before the call to DragEnter. This is called when the drag leaves
56 // without a drop occurring.
57 STDMETHODIMP
DragLeave();
59 // If point is within our region of interest and pSource's data supports
60 // one of our formats, get the data and set pEffect according to
61 // grfKeyState (DROPEFFECT_MOVE if the control key was not pressed,
62 // DROPEFFECT_COPY if the control key was pressed). Otherwise return
64 STDMETHODIMP
Drop(LPDATAOBJECT pSource
, DWORD grfKeyState
,
65 POINTL point
, DWORD
* pEffect
);
67 * Cancel the current drag session, if any.
73 void GetGeckoDragAction(DWORD grfKeyState
, LPDWORD pdwEffect
,
74 uint32_t * aGeckoAction
);
75 void ProcessDrag(uint32_t aEventType
, DWORD grfKeyState
,
76 POINTL pt
, DWORD
* pdwEffect
);
77 void DispatchDragDropEvent(uint32_t aType
, POINTL pt
);
78 void AddLinkSupportIfCanBeGenerated(LPDATAOBJECT aIDataSource
);
81 ULONG m_cRef
; // reference count
83 DWORD mEffectsAllowed
;
84 DWORD mEffectsPreferred
;
89 nsIDragService
* mDragService
;
91 IDropTargetHelper
* GetDropTargetHelper();
96 IDropTargetHelper
* mDropTargetHelper
;
99 #endif // _nsNativeDragTarget_h_