content/base/src/nsContentAreaDragDrop.h

changeset 0
6474c204b198
equal deleted inserted replaced
-1:000000000000 0:40946cdcde3c
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/. */
4
5
6 #ifndef nsContentAreaDragDrop_h__
7 #define nsContentAreaDragDrop_h__
8
9
10 #include "nsCOMPtr.h"
11
12 #include "nsIDOMEventListener.h"
13 #include "nsITransferable.h"
14
15 class nsIDOMNode;
16 class nsPIDOMWindow;
17 class nsIDOMDragEvent;
18 class nsISelection;
19 class nsITransferable;
20 class nsIContent;
21 class nsIURI;
22 class nsIFile;
23 class nsISimpleEnumerator;
24
25 namespace mozilla {
26 namespace dom {
27 class DataTransfer;
28 }
29 }
30
31 //
32 // class nsContentAreaDragDrop, used to generate the dragdata
33 //
34 class nsContentAreaDragDrop
35 {
36 public:
37
38 /**
39 * Determine what data in the content area, if any, is being dragged.
40 *
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,
47 * not drag the link.
48 * aDataTransfer - the dataTransfer for the drag event.
49 * aCanDrag - [out] set to true if the drag may proceed, false to stop the
50 * drag entirely
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.
55 */
56 static nsresult GetDragData(nsPIDOMWindow* aWindow,
57 nsIContent* aTarget,
58 nsIContent* aSelectionTargetNode,
59 bool aIsAltKeyPressed,
60 mozilla::dom::DataTransfer* aDataTransfer,
61 bool* aCanDrag,
62 nsISelection** aSelection,
63 nsIContent** aDragNode);
64 };
65
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
70 {
71 public:
72 NS_DECL_ISUPPORTS
73 NS_DECL_NSIFLAVORDATAPROVIDER
74
75 virtual ~nsContentAreaDragDropDataProvider() {}
76
77 nsresult SaveURIToFile(nsAString& inSourceURIString,
78 nsIFile* inDestFile, bool isPrivate);
79 };
80
81
82 #endif /* nsContentAreaDragDrop_h__ */
83

mercurial