1 /* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 #ifndef nsContentAreaDragDrop_h__
7 #define nsContentAreaDragDrop_h__
12 #include "nsIDOMEventListener.h"
13 #include "nsITransferable.h"
17 class nsIDOMDragEvent
;
19 class nsITransferable
;
23 class nsISimpleEnumerator
;
32 // class nsContentAreaDragDrop, used to generate the dragdata
34 class nsContentAreaDragDrop
39 * Determine what data in the content area, if any, is being dragged.
41 * aWindow - the window containing the target node
42 * aTarget - the mousedown event target that started the drag
43 * aSelectionTargetNode - the node where the drag event should be fired
44 * aIsAltKeyPressed - true if the Alt key is pressed. In some cases, this
45 * will prevent the drag from occuring. For example,
46 * holding down Alt over a link should select the text,
48 * aDataTransfer - the dataTransfer for the drag event.
49 * aCanDrag - [out] set to true if the drag may proceed, false to stop the
51 * aSelection - [out] set to the selection being dragged, or null if no
52 * selection is being dragged.
53 * aDragNode - [out] the link, image or area being dragged, or null if the
54 * drag occurred on another element.
56 static nsresult
GetDragData(nsPIDOMWindow
* aWindow
,
58 nsIContent
* aSelectionTargetNode
,
59 bool aIsAltKeyPressed
,
60 mozilla::dom::DataTransfer
* aDataTransfer
,
62 nsISelection
** aSelection
,
63 nsIContent
** aDragNode
);
66 // this is used to save images to disk lazily when the image data is asked for
67 // during the drop instead of when it is added to the drag data transfer. This
68 // ensures that the image data is only created when an image drop is allowed.
69 class nsContentAreaDragDropDataProvider
: public nsIFlavorDataProvider
71 virtual ~nsContentAreaDragDropDataProvider() {}
75 NS_DECL_NSIFLAVORDATAPROVIDER
77 nsresult
SaveURIToFile(nsAString
& inSourceURIString
,
78 nsIFile
* inDestFile
, bool isPrivate
);
82 #endif /* nsContentAreaDragDrop_h__ */