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 "nsChildView.h"
12 #include <Cocoa/Cocoa.h>
14 class nsDragService
: public nsBaseDragService
{
19 MOZ_CAN_RUN_SCRIPT
virtual nsresult
InvokeDragSessionImpl(
20 nsIArray
* anArrayTransferables
,
21 const mozilla::Maybe
<mozilla::CSSIntRegion
>& aRegion
,
22 uint32_t aActionType
) override
;
24 MOZ_CAN_RUN_SCRIPT NS_IMETHOD
EndDragSession(bool aDoneDrag
,
25 uint32_t aKeyModifiers
) override
;
26 NS_IMETHOD
UpdateDragImage(nsINode
* aImage
, int32_t aImageX
,
27 int32_t aImageY
) override
;
30 NS_IMETHOD
GetData(nsITransferable
* aTransferable
,
31 uint32_t aItemIndex
) override
;
32 NS_IMETHOD
IsDataFlavorSupported(const char* aDataFlavor
,
33 bool* _retval
) override
;
34 NS_IMETHOD
GetNumDropItems(uint32_t* aNumItems
) override
;
36 void DragMovedWithView(NSDraggingSession
* aSession
, NSPoint aPoint
);
39 virtual ~nsDragService();
42 // Creates and returns the drag image for a drag. aImagePoint will be set to
43 // the origin of the drag relative to mNativeDragView.
44 NSImage
* ConstructDragImage(
45 nsINode
* aDOMNode
, const mozilla::Maybe
<mozilla::CSSIntRegion
>& aRegion
,
46 NSPoint
* aImagePoint
);
48 // Creates and returns the drag image for a drag. aPoint should be the origin
49 // of the drag, for example the mouse coordinate of the mousedown event.
50 // aDragRect will be set the area of the drag relative to this.
51 NSImage
* ConstructDragImage(
52 nsINode
* aDOMNode
, const mozilla::Maybe
<mozilla::CSSIntRegion
>& aRegion
,
53 mozilla::CSSIntPoint aPoint
, mozilla::LayoutDeviceIntRect
* aDragRect
);
55 nsCOMPtr
<nsIArray
> mDataItems
; // only valid for a drag started within gecko
56 ChildView
* mNativeDragView
;
57 NSEvent
* mNativeDragEvent
;
59 bool mDragImageChanged
;
62 #endif // nsDragService_h_