]> git.saurik.com Git - wxWidgets.git/blame - docs/latex/wx/droptrgt.tex
remove C++ comment
[wxWidgets.git] / docs / latex / wx / droptrgt.tex
CommitLineData
dface61c
JS
1\section{\class{wxDropTarget}}\label{wxdroptarget}
2
f59d80ca
RR
3This class represents a target for a drag and drop operation. A \helpref{wxDataObject}{wxdataobject}
4can be associated with it and by default, this object will be filled with the data from the
5drag source, if the data formats supported by the data object match the drag source data
6format.
7
8There are various virtual handler functions defined in this class which may be overridden
9to give visual feedback or react in a more fine-tuned way, e.g. by not accepting data on
10the whole window area, but only a small portion of it. The normal sequence of calls is
11\helpref{OnEnter}{wxdroptargetonenter}, possibly many times \helpref{OnDragOver}{wxdroptargetondragover},
12\helpref{OnDrop}{wxdroptargetondrop} and finally \helpref{OnData}{wxdroptargetondata}.
dface61c 13
f6bcfd97 14See \helpref{Drag and drop overview}{wxdndoverview} and \helpref{wxDataObject overview}{wxdataobjectoverview}
23efdd02
RR
15for more information.
16
dface61c
JS
17\wxheading{Derived from}
18
f59d80ca 19None
dface61c 20
954b8ae6
JS
21\wxheading{Include files}
22
23<wx/dnd.h>
24
a7af285d
VZ
25\wxheading{Library}
26
27\helpref{wxCore}{librarieslist}
28
f59d80ca
RR
29\wxheading{Types}
30
31\index{wxDragResult}wxDragResult is defined as follows:
32
fa482912 33\begin{verbatim}
f59d80ca
RR
34enum wxDragResult
35{
36 wxDragError, // error prevented the d&d operation from completing
37 wxDragNone, // drag target didn't accept the data
38 wxDragCopy, // the data was successfully copied
3980000c
RR
39 wxDragMove, // the data was successfully moved (MSW only)
40 wxDragLink, // operation is a drag-link
f59d80ca
RR
41 wxDragCancel // the operation was cancelled by user (not an error)
42};
43\end{verbatim}
f59d80ca 44
dface61c
JS
45\wxheading{See also}
46
23efdd02 47\helpref{wxDropSource}{wxdropsource},
f59d80ca
RR
48\helpref{wxTextDropTarget}{wxtextdroptarget}, \helpref{wxFileDropTarget}{wxfiledroptarget},
49\helpref{wxDataFormat}{wxdataformat}, \helpref{wxDataObject}{wxdataobject}
dface61c
JS
50
51\latexignore{\rtfignore{\wxheading{Members}}}
52
53\membersection{wxDropTarget::wxDropTarget}\label{wxdroptargetwxdroptarget}
54
f59d80ca 55\func{}{wxDropTarget}{\param{wxDataObject*}{ data = NULL}}
dface61c 56
f59d80ca 57Constructor. {\it data} is the data to be associated with the drop target.
dface61c
JS
58
59\membersection{wxDropTarget::\destruct{wxDropTarget}}\label{wxdroptargetdtor}
60
61\func{}{\destruct{wxDropTarget}}{\void}
62
f59d80ca 63Destructor. Deletes the associated data object, if any.
dface61c 64
f59d80ca 65\membersection{wxDropTarget::GetData}\label{wxdroptargetgetdata}
dface61c 66
f59d80ca 67\func{virtual void}{GetData}{\void}
dface61c 68
f59d80ca
RR
69This method may only be called from within \helpref{OnData}{wxdroptargetondata}.
70By default, this method copies the data from the drop source to the
71\helpref{wxDataObject}{wxdataobject} associated with this drop target,
72calling its \helpref{wxDataObject::SetData}{wxdataobjectsetdata} method.
dface61c 73
1fb3eae5 74\membersection{wxDropTarget::OnData}\label{wxdroptargetondata}
dface61c 75
1fb3eae5 76\func{virtual wxDragResult}{OnData}{\param{wxCoord}{ x}, \param{wxCoord}{ y}, \param{wxDragResult}{ def}}
dface61c 77
cc81d32f 78Called after \helpref{OnDrop}{wxdroptargetondrop} returns true. By default this
f59d80ca
RR
79will usually \helpref{GetData}{wxdroptargetgetdata} and will return the suggested
80default value {\it def}.
dface61c
JS
81
82\membersection{wxDropTarget::OnDrop}\label{wxdroptargetondrop}
83
f59d80ca 84\func{virtual bool}{OnDrop}{\param{wxCoord }{x}, \param{wxCoord }{y}}
dface61c 85
cc81d32f 86Called when the user drops a data object on the target. Return false to veto the operation.
dface61c
JS
87
88\wxheading{Parameters}
89
90\docparam{x}{The x coordinate of the mouse.}
91
92\docparam{y}{The y coordinate of the mouse.}
93
dface61c
JS
94\wxheading{Return value}
95
cc81d32f 96Return true to accept the data, false to veto the operation.
dface61c 97
1fb3eae5
JS
98\membersection{wxDropTarget::OnEnter}\label{wxdroptargetonenter}
99
f59d80ca
RR
100\func{virtual wxDragResult}{OnEnter}{\param{wxCoord}{ x}, \param{wxCoord}{ y}, \param{wxDragResult}{ def}}
101
102Called when the mouse enters the drop target. By default, this calls \helpref{OnDragOver}{wxdroptargetondragover}.
103
104\wxheading{Parameters}
105
106\docparam{x}{The x coordinate of the mouse.}
107
108\docparam{y}{The y coordinate of the mouse.}
109
110\docparam{def}{Suggested default for return value. Determined by SHIFT or CONTROL key states.}
1fb3eae5 111
f59d80ca
RR
112\wxheading{Return value}
113
114Returns the desired operation or {\tt wxDragNone}. This is used for optical feedback
115from the side of the drop source, typically in form of changing the icon.
116
117\membersection{wxDropTarget::OnDragOver}\label{wxdroptargetondragover}
118
119\func{virtual wxDragResult}{OnDragOver}{\param{wxCoord}{ x}, \param{wxCoord}{ y}, \param{wxDragResult}{ def}}
120
121Called when the mouse is being dragged over the drop target. By default,
122this calls functions return the suggested return value {\it def}.
123
124\wxheading{Parameters}
125
126\docparam{x}{The x coordinate of the mouse.}
127
128\docparam{y}{The y coordinate of the mouse.}
129
130\docparam{def}{Suggested value for return value. Determined by SHIFT or CONTROL key states.}
131
132\wxheading{Return value}
133
134Returns the desired operation or {\tt wxDragNone}. This is used for optical feedback
135from the side of the drop source, typically in form of changing the icon.
1fb3eae5 136
dface61c
JS
137\membersection{wxDropTarget::OnLeave}\label{wxdroptargetonleave}
138
139\func{virtual void}{OnLeave}{\void}
140
141Called when the mouse leaves the drop target.
b82827dd 142
f59d80ca
RR
143\membersection{wxDropTarget::SetDataObject}\label{wxdroptargetsetdataobject}
144
145\func{void}{SetDataObject}{\param{wxDataObject*}{ data}}
146
147Sets the data \helpref{wxDataObject}{wxdataobject} associated with the
148drop target and deletes any previously associated data object.
457e6c54 149