File: droptrgt.tex

package info (click to toggle)
wxwidgets2.8 2.8.12.1-12
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 242,920 kB
  • sloc: cpp: 1,840,772; xml: 385,749; python: 334,729; makefile: 51,774; ansic: 30,987; sh: 7,716; sql: 258; lex: 194; perl: 139; yacc: 128; pascal: 95; php: 45; lisp: 38; tcl: 38; java: 22; haskell: 20; cs: 18; erlang: 17; ruby: 16; asm: 15; ada: 9; ml: 9; csh: 9
file content (145 lines) | stat: -rw-r--r-- 5,199 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
\section{\class{wxDropTarget}}\label{wxdroptarget}

This class represents a target for a drag and drop operation. A \helpref{wxDataObject}{wxdataobject}
can be associated with it and by default, this object will be filled with the data from the
drag source, if the data formats supported by the data object match the drag source data 
format.

There are various virtual handler functions defined in this class which may be overridden
to give visual feedback or react in a more fine-tuned way, e.g. by not accepting data on
the whole window area, but only a small portion of it. The normal sequence of calls is
\helpref{OnEnter}{wxdroptargetonenter}, possibly many times \helpref{OnDragOver}{wxdroptargetondragover},
\helpref{OnDrop}{wxdroptargetondrop} and finally \helpref{OnData}{wxdroptargetondata}.

See \helpref{Drag and drop overview}{wxdndoverview} and \helpref{wxDataObject overview}{wxdataobjectoverview}
for more information.

\wxheading{Derived from}

None

\wxheading{Include files}

<wx/dnd.h>

\wxheading{Types}

\index{wxDragResult}wxDragResult is defined as follows:

\begin{verbatim}
enum wxDragResult
{
    wxDragError,    // error prevented the d&d operation from completing
    wxDragNone,     // drag target didn't accept the data
    wxDragCopy,     // the data was successfully copied
    wxDragMove,     // the data was successfully moved (MSW only)
    wxDragLink,     // operation is a drag-link
    wxDragCancel    // the operation was cancelled by user (not an error)
};
\end{verbatim}

\wxheading{See also}

\helpref{wxDropSource}{wxdropsource}, 
\helpref{wxTextDropTarget}{wxtextdroptarget}, \helpref{wxFileDropTarget}{wxfiledroptarget},
\helpref{wxDataFormat}{wxdataformat}, \helpref{wxDataObject}{wxdataobject}

\latexignore{\rtfignore{\wxheading{Members}}}

\membersection{wxDropTarget::wxDropTarget}\label{wxdroptargetwxdroptarget}

\func{}{wxDropTarget}{\param{wxDataObject*}{ data = NULL}}

Constructor. {\it data} is the data to be associated with the drop target.

\membersection{wxDropTarget::\destruct{wxDropTarget}}\label{wxdroptargetdtor}

\func{}{\destruct{wxDropTarget}}{\void}

Destructor. Deletes the associated data object, if any.

\membersection{wxDropTarget::GetData}\label{wxdroptargetgetdata}

\func{virtual void}{GetData}{\void}

This method may only be called from within \helpref{OnData}{wxdroptargetondata}.
By default, this method copies the data from the drop source to the 
\helpref{wxDataObject}{wxdataobject} associated with this drop target,
calling its \helpref{wxDataObject::SetData}{wxdataobjectsetdata} method.

\membersection{wxDropTarget::OnData}\label{wxdroptargetondata}

\func{virtual wxDragResult}{OnData}{\param{wxCoord}{ x}, \param{wxCoord}{ y}, \param{wxDragResult}{ def}}

Called after \helpref{OnDrop}{wxdroptargetondrop} returns true. By default this
will usually \helpref{GetData}{wxdroptargetgetdata} and will return the suggested
default value {\it def}.

\membersection{wxDropTarget::OnDrop}\label{wxdroptargetondrop}

\func{virtual bool}{OnDrop}{\param{wxCoord }{x}, \param{wxCoord }{y}}

Called when the user drops a data object on the target. Return false to veto the operation.

\wxheading{Parameters}

\docparam{x}{The x coordinate of the mouse.}

\docparam{y}{The y coordinate of the mouse.}

\wxheading{Return value}

Return true to accept the data, false to veto the operation.

\membersection{wxDropTarget::OnEnter}\label{wxdroptargetonenter}

\func{virtual wxDragResult}{OnEnter}{\param{wxCoord}{ x}, \param{wxCoord}{ y}, \param{wxDragResult}{ def}}

Called when the mouse enters the drop target. By default, this calls \helpref{OnDragOver}{wxdroptargetondragover}.

\wxheading{Parameters}

\docparam{x}{The x coordinate of the mouse.}

\docparam{y}{The y coordinate of the mouse.}

\docparam{def}{Suggested default for return value. Determined by SHIFT or CONTROL key states.}

\wxheading{Return value}

Returns the desired operation or {\tt wxDragNone}. This is used for optical feedback
from the side of the drop source, typically in form of changing the icon.

\membersection{wxDropTarget::OnDragOver}\label{wxdroptargetondragover}

\func{virtual wxDragResult}{OnDragOver}{\param{wxCoord}{ x}, \param{wxCoord}{ y}, \param{wxDragResult}{ def}}

Called when the mouse is being dragged over the drop target. By default, 
this calls functions return the suggested return value {\it def}.

\wxheading{Parameters}

\docparam{x}{The x coordinate of the mouse.}

\docparam{y}{The y coordinate of the mouse.}

\docparam{def}{Suggested value for return value. Determined by SHIFT or CONTROL key states.}

\wxheading{Return value}

Returns the desired operation or {\tt wxDragNone}. This is used for optical feedback
from the side of the drop source, typically in form of changing the icon.

\membersection{wxDropTarget::OnLeave}\label{wxdroptargetonleave}

\func{virtual void}{OnLeave}{\void}

Called when the mouse leaves the drop target.

\membersection{wxDropTarget::SetDataObject}\label{wxdroptargetsetdataobject}

\func{void}{SetDataObject}{\param{wxDataObject*}{ data}}

Sets the data \helpref{wxDataObject}{wxdataobject} associated with the 
drop target and deletes any previously associated data object.