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_
11 #include "mozilla/Attributes.h"
12 #include "mozilla/RefPtr.h"
18 } // namespace mozilla
20 // class nsIDragSource;
23 * nsNativeDragSource implements the IDropSource interface and gets
24 * most of its behavior from the associated adapter (m_dragDrop).
26 class nsNativeDragSource final
: public IDropSource
{
28 // construct an nsNativeDragSource referencing adapter
29 // nsNativeDragSource(nsIDragSource * adapter);
30 explicit nsNativeDragSource(mozilla::dom::DataTransfer
* aDataTransfer
);
31 ~nsNativeDragSource();
33 // IUnknown methods - see iunknown.h for documentation
35 STDMETHODIMP
QueryInterface(REFIID
, void**);
36 STDMETHODIMP_(ULONG
) AddRef();
37 STDMETHODIMP_(ULONG
) Release();
39 // IDropSource methods - see idropsrc.h for documentation
41 // Return DRAGDROP_S_USEDEFAULTCURSORS if this object lets OLE provide
42 // default cursors, otherwise return NOERROR. This method gets called in
43 // response to changes that the target makes to dEffect (DragEnter,
45 STDMETHODIMP
GiveFeedback(DWORD dEffect
);
47 // This method gets called if there is any change in the mouse or key
48 // state. Return DRAGDROP_S_CANCEL to stop the drag, DRAGDROP_S_DROP
49 // to execute the drop, otherwise NOERROR.
50 STDMETHODIMP
QueryContinueDrag(BOOL fESC
, DWORD grfKeyState
);
52 bool UserCancelled() { return mUserCancelled
; }
58 // Data object, hold information about cursor state
59 RefPtr
<mozilla::dom::DataTransfer
> mDataTransfer
;
64 // true if the user cancelled the drag by pressing escape
68 #endif // _nsNativeDragSource_h_