]> git.saurik.com Git - wxWidgets.git/blame - docs/latex/wx/droptrgt.tex
Small changes
[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
23efdd02
RR
14See \helpref{Drag'n'Drop overview}{wxdndoverview} and \helpref{wxDataObject overview}{wxdataobjectoverview}
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
f59d80ca
RR
25\wxheading{Types}
26
27\index{wxDragResult}wxDragResult is defined as follows:
28
29{\small\begin{verbatim}
30enum wxDragResult
31{
32 wxDragError, // error prevented the d&d operation from completing
33 wxDragNone, // drag target didn't accept the data
34 wxDragCopy, // the data was successfully copied
35 wxDragMove, // the data was successfully moved
36 wxDragCancel // the operation was cancelled by user (not an error)
37};
38\end{verbatim}
39}
40
dface61c
JS
41\wxheading{See also}
42
23efdd02 43\helpref{wxDropSource}{wxdropsource},
f59d80ca
RR
44\helpref{wxTextDropTarget}{wxtextdroptarget}, \helpref{wxFileDropTarget}{wxfiledroptarget},
45\helpref{wxDataFormat}{wxdataformat}, \helpref{wxDataObject}{wxdataobject}
dface61c
JS
46
47\latexignore{\rtfignore{\wxheading{Members}}}
48
49\membersection{wxDropTarget::wxDropTarget}\label{wxdroptargetwxdroptarget}
50
f59d80ca 51\func{}{wxDropTarget}{\param{wxDataObject*}{ data = NULL}}
dface61c 52
f59d80ca 53Constructor. {\it data} is the data to be associated with the drop target.
dface61c
JS
54
55\membersection{wxDropTarget::\destruct{wxDropTarget}}\label{wxdroptargetdtor}
56
57\func{}{\destruct{wxDropTarget}}{\void}
58
f59d80ca 59Destructor. Deletes the associated data object, if any.
dface61c 60
f59d80ca 61\membersection{wxDropTarget::GetData}\label{wxdroptargetgetdata}
dface61c 62
f59d80ca 63\func{virtual void}{GetData}{\void}
dface61c 64
f59d80ca
RR
65This method may only be called from within \helpref{OnData}{wxdroptargetondata}.
66By default, this method copies the data from the drop source to the
67\helpref{wxDataObject}{wxdataobject} associated with this drop target,
68calling its \helpref{wxDataObject::SetData}{wxdataobjectsetdata} method.
dface61c 69
1fb3eae5 70\membersection{wxDropTarget::OnData}\label{wxdroptargetondata}
dface61c 71
1fb3eae5 72\func{virtual wxDragResult}{OnData}{\param{wxCoord}{ x}, \param{wxCoord}{ y}, \param{wxDragResult}{ def}}
dface61c 73
f59d80ca
RR
74Called after \helpref{OnDrop}{wxdroptargetondrop} returns TRUE. By default this
75will usually \helpref{GetData}{wxdroptargetgetdata} and will return the suggested
76default value {\it def}.
dface61c
JS
77
78\membersection{wxDropTarget::OnDrop}\label{wxdroptargetondrop}
79
f59d80ca 80\func{virtual bool}{OnDrop}{\param{wxCoord }{x}, \param{wxCoord }{y}}
dface61c
JS
81
82Called when the user drops a data object on the target. Return FALSE to veto the operation.
83
84\wxheading{Parameters}
85
86\docparam{x}{The x coordinate of the mouse.}
87
88\docparam{y}{The y coordinate of the mouse.}
89
dface61c
JS
90\wxheading{Return value}
91
92Return TRUE to accept the data, FALSE to veto the operation.
93
1fb3eae5
JS
94\membersection{wxDropTarget::OnEnter}\label{wxdroptargetonenter}
95
f59d80ca
RR
96\func{virtual wxDragResult}{OnEnter}{\param{wxCoord}{ x}, \param{wxCoord}{ y}, \param{wxDragResult}{ def}}
97
98Called when the mouse enters the drop target. By default, this calls \helpref{OnDragOver}{wxdroptargetondragover}.
99
100\wxheading{Parameters}
101
102\docparam{x}{The x coordinate of the mouse.}
103
104\docparam{y}{The y coordinate of the mouse.}
105
106\docparam{def}{Suggested default for return value. Determined by SHIFT or CONTROL key states.}
1fb3eae5 107
f59d80ca
RR
108\wxheading{Return value}
109
110Returns the desired operation or {\tt wxDragNone}. This is used for optical feedback
111from the side of the drop source, typically in form of changing the icon.
112
113\membersection{wxDropTarget::OnDragOver}\label{wxdroptargetondragover}
114
115\func{virtual wxDragResult}{OnDragOver}{\param{wxCoord}{ x}, \param{wxCoord}{ y}, \param{wxDragResult}{ def}}
116
117Called when the mouse is being dragged over the drop target. By default,
118this calls functions return the suggested return value {\it def}.
119
120\wxheading{Parameters}
121
122\docparam{x}{The x coordinate of the mouse.}
123
124\docparam{y}{The y coordinate of the mouse.}
125
126\docparam{def}{Suggested value for return value. Determined by SHIFT or CONTROL key states.}
127
128\wxheading{Return value}
129
130Returns the desired operation or {\tt wxDragNone}. This is used for optical feedback
131from the side of the drop source, typically in form of changing the icon.
1fb3eae5 132
dface61c
JS
133\membersection{wxDropTarget::OnLeave}\label{wxdroptargetonleave}
134
135\func{virtual void}{OnLeave}{\void}
136
137Called when the mouse leaves the drop target.
b82827dd 138
f59d80ca
RR
139\membersection{wxDropTarget::SetDataObject}\label{wxdroptargetsetdataobject}
140
141\func{void}{SetDataObject}{\param{wxDataObject*}{ data}}
142
143Sets the data \helpref{wxDataObject}{wxdataobject} associated with the
144drop target and deletes any previously associated data object.