]>
Commit | Line | Data |
---|---|---|
dface61c JS |
1 | \section{\class{wxDropSource}}\label{wxdropsource} |
2 | ||
dface61c JS |
3 | This class represents a source for a drag and drop operation. |
4 | ||
f6bcfd97 | 5 | See \helpref{Drag and drop overview}{wxdndoverview} and \helpref{wxDataObject overview}{wxdataobjectoverview} |
23efdd02 RR |
6 | for more information. |
7 | ||
dface61c JS |
8 | \wxheading{Derived from} |
9 | ||
f59d80ca | 10 | None |
dface61c | 11 | |
954b8ae6 JS |
12 | \wxheading{Include files} |
13 | ||
14 | <wx/dnd.h> | |
15 | ||
dface61c JS |
16 | \wxheading{Types} |
17 | ||
18 | \index{wxDragResult}wxDragResult is defined as follows: | |
19 | ||
b2cf617c | 20 | \begin{verbatim} |
dface61c | 21 | enum wxDragResult |
f59d80ca | 22 | { |
dface61c JS |
23 | wxDragError, // error prevented the d&d operation from completing |
24 | wxDragNone, // drag target didn't accept the data | |
25 | wxDragCopy, // the data was successfully copied | |
26 | wxDragMove, // the data was successfully moved | |
27 | wxDragCancel // the operation was cancelled by user (not an error) | |
f59d80ca RR |
28 | }; |
29 | \end{verbatim} | |
dface61c JS |
30 | |
31 | \wxheading{See also} | |
32 | ||
23efdd02 | 33 | \helpref{wxDropTarget}{wxdroptarget}, |
dface61c JS |
34 | \helpref{wxTextDropTarget}{wxtextdroptarget}, \helpref{wxFileDropTarget}{wxfiledroptarget} |
35 | ||
36 | \latexignore{\rtfignore{\wxheading{Members}}} | |
37 | ||
38 | \membersection{wxDropSource::wxDropSource}\label{wxdropsourcewxdropsource} | |
39 | ||
c7952709 | 40 | \func{}{wxDropSource}{\param{wxWindow*}{ win = NULL},\param{const wxIconOrCursor\& }{iconCopy = wxNullIconOrCursor}, \param{const wxIconOrCursor\& }{iconMove = wxNullIconOrCursor}, \param{const wxIconOrCursor\& }{iconNone = wxNullIconOrCursor}} |
dface61c | 41 | |
c7952709 | 42 | \func{}{wxDropSource}{\param{wxDataObject\&}{ data}, \param{wxWindow*}{ win = NULL},\param{const wxIconOrCursor\& }{iconCopy = wxNullIconOrCursor}, \param{const wxIconOrCursor\& }{iconMove = wxNullIconOrCursor}, \param{const wxIconOrCursor\& }{iconNone = wxNullIconOrCursor}} |
dface61c | 43 | |
f6bcfd97 BP |
44 | The constructors for wxDataObject. |
45 | ||
46 | If you use the constructor without {\it data} parameter you must call | |
47 | \helpref{SetData}{wxdropsourcesetdata} later. | |
48 | ||
49 | Note that the exact type of {\it iconCopy} and subsequent parameters differs | |
50 | between wxMSW and wxGTK: these are cursors under Windows but icons for GTK. | |
51 | You should use the macro \helpref{wxDROP\_ICON}{wxdropicon} in portable | |
52 | programs instead of directly using either of these types. | |
53 | ||
54 | \wxheading{Parameters} | |
55 | ||
56 | \docparam{win}{The window which initiates the drag and drop operation.} | |
57 | ||
58 | \docparam{iconCopy}{The icon or cursor used for feedback for copy operation.} | |
59 | ||
60 | \docparam{iconMove}{The icon or cursor used for feedback for move operation.} | |
61 | ||
62 | \docparam{iconNone}{The icon or cursor used for feedback when operation can't be done.} | |
63 | ||
64 | {\it win} is the window which initiates the drag and drop operation. | |
dface61c | 65 | |
dface61c JS |
66 | \membersection{wxDropSource::\destruct{wxDropSource}}\label{wxdropsourcedtor} |
67 | ||
68 | \func{virtual }{\destruct{wxDropSource}}{\void} | |
69 | ||
70 | \membersection{wxDropSource::SetData}\label{wxdropsourcesetdata} | |
71 | ||
06ad8636 | 72 | \func{void}{SetData}{\param{wxDataObject\&}{ data}} |
dface61c | 73 | |
f59d80ca RR |
74 | Sets the data \helpref{wxDataObject}{wxdataobject} associated with the |
75 | drop source. This will not delete any previously associated data. | |
dface61c JS |
76 | |
77 | \membersection{wxDropSource::DoDragDrop}\label{wxdropsourcedodragdrop} | |
78 | ||
2245b2b2 | 79 | \func{virtual wxDragResult}{DoDragDrop}{\param{int }{flags = {\tt wxDrag\_CopyOnly}}} |
dface61c | 80 | |
2245b2b2 VZ |
81 | Do it (call this in response to a mouse button press, for example). This starts |
82 | the drag-and-drop operation which will terminate when the user releases the | |
83 | mouse. | |
dface61c | 84 | |
2245b2b2 VZ |
85 | \wxheading{Parameters} |
86 | ||
87 | \docparam{flags}{If {\tt wxDrag\_AllowMove} is included in the flags, data may | |
88 | be moved and not only copied (default). If {\tt wxDrag\_DefaultMove} is | |
89 | specified (which includes the previous flag), this is even the default | |
90 | operation}. | |
91 | ||
92 | \wxheading{Return value} | |
93 | ||
94 | Returns the operation requested by the user, may be {\tt wxDragCopy}, {\tt | |
95 | wxDragMove}, {\tt wxDragCancel} or {\tt wxDragNone} if an error occured. | |
dface61c JS |
96 | |
97 | \membersection{wxDropSource::GiveFeedback}\label{wxdropsourcegivefeedback} | |
98 | ||
fc9c7c09 | 99 | \func{virtual bool}{GiveFeedback}{\param{wxDragResult }{effect}, \param{bool }{scrolling}} |
dface61c JS |
100 | |
101 | Overridable: you may give some custom UI feedback during the drag and drop operation | |
102 | in this function. It is called on each mouse move, so your implementation must not be too | |
103 | slow. | |
104 | ||
105 | \wxheading{Parameters} | |
106 | ||
fc9c7c09 | 107 | \docparam{effect}{The effect to implement. One of wxDragCopy, wxDragMove and wxDragNone. } |
dface61c | 108 | |
cc81d32f | 109 | \docparam{scrolling}{true if the window is scrolling. MSW only. } |
dface61c JS |
110 | |
111 | \wxheading{Return value} | |
112 | ||
cc81d32f | 113 | Return false if you want default feedback, or true if you implement your own |
fc9c7c09 | 114 | feedback. The return values is ignored under GTK. |
dface61c | 115 |