Bug 1793629 - Implement attention indicator for the unified extensions button, r...
[gecko.git] / widget / windows / nsNativeDragSource.h
bloba8e37b90a8c463be1aa4d1e3661cbc9b3ee977fc
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_
8 #include "nscore.h"
9 #include <ole2.h>
10 #include <oleidl.h>
11 #include "mozilla/Attributes.h"
12 #include "mozilla/RefPtr.h"
14 namespace mozilla {
15 namespace dom {
16 class DataTransfer;
17 } // namespace dom
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 {
27 public:
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,
44 // DragOver).
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; }
54 protected:
55 // Reference count
56 ULONG m_cRef;
58 // Data object, hold information about cursor state
59 RefPtr<mozilla::dom::DataTransfer> mDataTransfer;
61 // Custom drag cursor
62 HCURSOR m_hCursor;
64 // true if the user cancelled the drag by pressing escape
65 bool mUserCancelled;
68 #endif // _nsNativeDragSource_h_