2006-10-26 02:45:22 +04:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
2012-05-21 15:12:37 +04:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
2006-10-26 02:45:22 +04:00
|
|
|
|
2007-01-18 09:34:07 +03:00
|
|
|
#ifndef nsDragService_h_
|
|
|
|
#define nsDragService_h_
|
2006-10-26 02:45:22 +04:00
|
|
|
|
|
|
|
#include "nsBaseDragService.h"
|
2016-12-20 22:33:08 +03:00
|
|
|
#include "nsChildView.h"
|
2006-10-26 02:45:22 +04:00
|
|
|
|
2007-03-20 15:14:52 +03:00
|
|
|
#include <Cocoa/Cocoa.h>
|
|
|
|
|
2006-10-26 02:45:22 +04:00
|
|
|
class nsDragService : public nsBaseDragService {
|
|
|
|
public:
|
|
|
|
nsDragService();
|
|
|
|
|
2015-10-21 12:16:40 +03:00
|
|
|
// nsBaseDragService
|
2019-05-09 23:21:28 +03:00
|
|
|
MOZ_CAN_RUN_SCRIPT virtual nsresult InvokeDragSessionImpl(
|
2023-12-04 13:09:36 +03:00
|
|
|
nsIArray* anArrayTransferables,
|
|
|
|
const mozilla::Maybe<mozilla::CSSIntRegion>& aRegion,
|
2019-05-09 23:21:28 +03:00
|
|
|
uint32_t aActionType) override;
|
2006-10-26 02:45:22 +04:00
|
|
|
// nsIDragService
|
2023-12-04 13:09:36 +03:00
|
|
|
MOZ_CAN_RUN_SCRIPT NS_IMETHOD EndDragSession(bool aDoneDrag,
|
|
|
|
uint32_t aKeyModifiers) override;
|
|
|
|
NS_IMETHOD UpdateDragImage(nsINode* aImage, int32_t aImageX,
|
|
|
|
int32_t aImageY) override;
|
2006-10-26 02:45:22 +04:00
|
|
|
|
|
|
|
// nsIDragSession
|
2023-12-04 13:09:36 +03:00
|
|
|
NS_IMETHOD GetData(nsITransferable* aTransferable,
|
|
|
|
uint32_t aItemIndex) override;
|
|
|
|
NS_IMETHOD IsDataFlavorSupported(const char* aDataFlavor,
|
|
|
|
bool* _retval) override;
|
2017-11-06 06:37:28 +03:00
|
|
|
NS_IMETHOD GetNumDropItems(uint32_t* aNumItems) override;
|
2006-10-26 02:45:22 +04:00
|
|
|
|
2016-12-24 02:09:44 +03:00
|
|
|
void DragMovedWithView(NSDraggingSession* aSession, NSPoint aPoint);
|
|
|
|
|
2014-07-09 01:23:18 +04:00
|
|
|
protected:
|
|
|
|
virtual ~nsDragService();
|
|
|
|
|
2006-10-26 02:45:22 +04:00
|
|
|
private:
|
2016-12-24 02:09:44 +03:00
|
|
|
// Creates and returns the drag image for a drag. aImagePoint will be set to
|
|
|
|
// the origin of the drag relative to mNativeDragView.
|
2023-12-04 13:09:36 +03:00
|
|
|
NSImage* ConstructDragImage(
|
|
|
|
nsINode* aDOMNode, const mozilla::Maybe<mozilla::CSSIntRegion>& aRegion,
|
|
|
|
NSPoint* aImagePoint);
|
2016-12-24 02:09:44 +03:00
|
|
|
|
|
|
|
// Creates and returns the drag image for a drag. aPoint should be the origin
|
|
|
|
// of the drag, for example the mouse coordinate of the mousedown event.
|
|
|
|
// aDragRect will be set the area of the drag relative to this.
|
2023-12-04 13:09:36 +03:00
|
|
|
NSImage* ConstructDragImage(
|
|
|
|
nsINode* aDOMNode, const mozilla::Maybe<mozilla::CSSIntRegion>& aRegion,
|
|
|
|
mozilla::CSSIntPoint aPoint, mozilla::LayoutDeviceIntRect* aDragRect);
|
2016-12-24 02:09:44 +03:00
|
|
|
|
2016-10-18 21:56:20 +03:00
|
|
|
nsCOMPtr<nsIArray> mDataItems; // only valid for a drag started within gecko
|
2016-12-20 22:33:08 +03:00
|
|
|
ChildView* mNativeDragView;
|
2007-09-24 04:01:04 +04:00
|
|
|
NSEvent* mNativeDragEvent;
|
2016-12-24 02:09:44 +03:00
|
|
|
|
|
|
|
bool mDragImageChanged;
|
2006-10-26 02:45:22 +04:00
|
|
|
};
|
|
|
|
|
2007-01-18 09:34:07 +03:00
|
|
|
#endif // nsDragService_h_
|