2006-10-25 22:45:22 +00:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
2012-05-21 11:12:37 +00: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-25 22:45:22 +00:00
|
|
|
|
2007-01-18 06:34:07 +00:00
|
|
|
#ifndef nsDragService_h_
|
|
|
|
#define nsDragService_h_
|
2006-10-25 22:45:22 +00:00
|
|
|
|
|
|
|
#include "nsBaseDragService.h"
|
2016-12-20 19:33:08 +00:00
|
|
|
#include "nsChildView.h"
|
2006-10-25 22:45:22 +00:00
|
|
|
|
2007-03-20 12:14:52 +00:00
|
|
|
#include <Cocoa/Cocoa.h>
|
|
|
|
|
2017-05-23 04:23:33 +00:00
|
|
|
extern NSString* const kPublicUrlPboardType;
|
|
|
|
extern NSString* const kPublicUrlNamePboardType;
|
|
|
|
extern NSString* const kUrlsWithTitlesPboardType;
|
2017-05-23 04:23:47 +00:00
|
|
|
extern NSString* const kMozWildcardPboardType;
|
|
|
|
extern NSString* const kMozCustomTypesPboardType;
|
|
|
|
extern NSString* const kMozFileUrlsPboardType;
|
2007-05-29 05:06:12 +00:00
|
|
|
|
2006-10-25 22:45:22 +00:00
|
|
|
class nsDragService : public nsBaseDragService
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
nsDragService();
|
|
|
|
|
2015-10-21 09:16:40 +00:00
|
|
|
// nsBaseDragService
|
2016-10-18 18:56:20 +00:00
|
|
|
virtual nsresult InvokeDragSessionImpl(nsIArray* anArrayTransferables,
|
2015-10-21 09:16:40 +00:00
|
|
|
nsIScriptableRegion* aRegion,
|
|
|
|
uint32_t aActionType);
|
2006-10-25 22:45:22 +00:00
|
|
|
// nsIDragService
|
2017-02-17 03:29:42 +00:00
|
|
|
NS_IMETHOD EndDragSession(bool aDoneDrag, uint32_t aKeyModifiers);
|
2016-12-23 23:09:44 +00:00
|
|
|
NS_IMETHOD UpdateDragImage(nsIDOMNode* aImage, int32_t aImageX, int32_t aImageY);
|
2006-10-25 22:45:22 +00:00
|
|
|
|
|
|
|
// nsIDragSession
|
2012-08-22 15:56:38 +00:00
|
|
|
NS_IMETHOD GetData(nsITransferable * aTransferable, uint32_t aItemIndex);
|
2011-09-29 06:19:26 +00:00
|
|
|
NS_IMETHOD IsDataFlavorSupported(const char *aDataFlavor, bool *_retval);
|
2012-08-22 15:56:38 +00:00
|
|
|
NS_IMETHOD GetNumDropItems(uint32_t * aNumItems);
|
2006-10-25 22:45:22 +00:00
|
|
|
|
2016-12-23 23:09:44 +00:00
|
|
|
void DragMovedWithView(NSDraggingSession* aSession, NSPoint aPoint);
|
|
|
|
|
2014-07-08 21:23:18 +00:00
|
|
|
protected:
|
|
|
|
virtual ~nsDragService();
|
|
|
|
|
2006-10-25 22:45:22 +00:00
|
|
|
private:
|
|
|
|
|
2016-12-23 23:09:44 +00:00
|
|
|
// Creates and returns the drag image for a drag. aImagePoint will be set to
|
|
|
|
// the origin of the drag relative to mNativeDragView.
|
|
|
|
NSImage* ConstructDragImage(nsIDOMNode* aDOMNode,
|
|
|
|
nsIScriptableRegion* aRegion,
|
|
|
|
NSPoint* aImagePoint);
|
|
|
|
|
|
|
|
// 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.
|
2007-03-20 12:14:52 +00:00
|
|
|
NSImage* ConstructDragImage(nsIDOMNode* aDOMNode,
|
2016-12-23 23:09:44 +00:00
|
|
|
nsIScriptableRegion* aRegion,
|
|
|
|
mozilla::CSSIntPoint aPoint,
|
|
|
|
mozilla::LayoutDeviceIntRect* aDragRect);
|
|
|
|
|
2015-08-14 21:33:59 +00:00
|
|
|
bool IsValidType(NSString* availableType, bool allowFileURL);
|
|
|
|
NSString* GetStringForType(NSPasteboardItem* item, const NSString* type,
|
|
|
|
bool allowFileURL = false);
|
|
|
|
NSString* GetTitleForURL(NSPasteboardItem* item);
|
|
|
|
NSString* GetFilePath(NSPasteboardItem* item);
|
2007-06-28 19:20:12 +00:00
|
|
|
|
2016-10-18 18:56:20 +00:00
|
|
|
nsCOMPtr<nsIArray> mDataItems; // only valid for a drag started within gecko
|
2016-12-20 19:33:08 +00:00
|
|
|
ChildView* mNativeDragView;
|
2007-09-24 00:01:04 +00:00
|
|
|
NSEvent* mNativeDragEvent;
|
2016-12-23 23:09:44 +00:00
|
|
|
|
|
|
|
bool mDragImageChanged;
|
2006-10-25 22:45:22 +00:00
|
|
|
};
|
|
|
|
|
2007-01-18 06:34:07 +00:00
|
|
|
#endif // nsDragService_h_
|