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