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 _nsNativeDragSource_h_
6 #define _nsNativeDragSource_h_
9 #include "nsIDOMDataTransfer.h"
13 #include "mozilla/Attributes.h"
15 //class nsIDragSource;
18 * nsNativeDragSource implements the IDropSource interface and gets
19 * most of its behavior from the associated adapter (m_dragDrop).
21 class nsNativeDragSource MOZ_FINAL
: public IDropSource
25 // construct an nsNativeDragSource referencing adapter
26 // nsNativeDragSource(nsIDragSource * adapter);
27 nsNativeDragSource(nsIDOMDataTransfer
* aDataTransfer
);
28 ~nsNativeDragSource();
30 // IUnknown methods - see iunknown.h for documentation
32 STDMETHODIMP
QueryInterface(REFIID
, void**);
33 STDMETHODIMP_(ULONG
) AddRef();
34 STDMETHODIMP_(ULONG
) Release();
36 // IDropSource methods - see idropsrc.h for documentation
38 // Return DRAGDROP_S_USEDEFAULTCURSORS if this object lets OLE provide
39 // default cursors, otherwise return NOERROR. This method gets called in
40 // response to changes that the target makes to dEffect (DragEnter,
42 STDMETHODIMP
GiveFeedback(DWORD dEffect
);
44 // This method gets called if there is any change in the mouse or key
45 // state. Return DRAGDROP_S_CANCEL to stop the drag, DRAGDROP_S_DROP
46 // to execute the drop, otherwise NOERROR.
47 STDMETHODIMP
QueryContinueDrag(BOOL fESC
, DWORD grfKeyState
);
49 bool UserCancelled() { return mUserCancelled
; }
55 // Data object, hold information about cursor state
56 nsCOMPtr
<nsIDOMDataTransfer
> mDataTransfer
;
61 // true if the user cancelled the drag by pressing escape
65 #endif // _nsNativeDragSource_h_