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