Bug 1931425 - Limit how often moz-label's #setStyles runs r=reusable-components-revie...
[gecko.git] / widget / windows / nsDragService.h
blob193ff8958dfe7baeb99e182779c468aef4d3e870
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/. */
6 #ifndef nsDragService_h__
7 #define nsDragService_h__
9 #include "nsBaseDragService.h"
10 #include <windows.h>
11 #include <shlobj.h>
13 struct IDataObject;
14 class nsDataObjCollection;
16 /**
17 * Windows native nsIDragSession implementation
19 class nsDragSession : public nsBaseDragSession {
20 public:
21 virtual ~nsDragSession();
23 // nsIDragSession
24 NS_IMETHOD GetData(nsITransferable* aTransferable, uint32_t anItem) override;
25 NS_IMETHOD GetNumDropItems(uint32_t* aNumItems) override;
26 NS_IMETHOD IsDataFlavorSupported(const char* aDataFlavor,
27 bool* _retval) override;
28 NS_IMETHOD UpdateDragImage(nsINode* aImage, int32_t aImageX,
29 int32_t aImageY) override;
30 void SetIDataObject(IDataObject* aDataObj);
31 IDataObject* GetDataObject() { return mDataObject; }
33 MOZ_CAN_RUN_SCRIPT virtual nsresult InvokeDragSessionImpl(
34 nsIWidget* aWidget, nsIArray* anArrayTransferables,
35 const mozilla::Maybe<mozilla::CSSIntRegion>& aRegion,
36 uint32_t aActionType);
38 MOZ_CAN_RUN_SCRIPT nsresult
39 EndDragSessionImpl(bool aDoneDrag, uint32_t aKeyModifiers) override;
41 MOZ_CAN_RUN_SCRIPT nsresult StartInvokingDragSession(nsIWidget* aWidget,
42 IDataObject* aDataObj,
43 uint32_t aActionType);
45 // A drop occurred within the application vs. outside of it.
46 void SetDroppedLocal();
48 protected:
49 // determine if we have a single data object or one of our private
50 // collections
51 static bool IsCollectionObject(IDataObject* inDataObj);
52 static nsDataObjCollection* GetDataObjCollection(IDataObject* aDataObj);
54 // Create a bitmap for drag operations
55 bool CreateDragImage(nsINode* aDOMNode,
56 const mozilla::Maybe<mozilla::CSSIntRegion>& aRegion,
57 SHDRAGIMAGE* psdi);
59 IDataObject* mDataObject = nullptr;
60 bool mSentLocalDropEvent = false;
63 /**
64 * Windows native nsIDragService implementation
66 class nsDragService final : public nsBaseDragService {
67 public:
68 already_AddRefed<nsIDragSession> CreateDragSession() override;
71 #endif // nsDragService_h__