1 \section{\class{wxDropSource
}}\label{wxdropsource
}
3 This class represents a source for a drag and drop operation.
5 See
\helpref{Drag and drop overview
}{wxdndoverview
} and
\helpref{wxDataObject overview
}{wxdataobjectoverview
}
8 \wxheading{Derived from
}
12 \wxheading{Include files
}
18 \helpref{wxCore
}{librarieslist
}
22 \index{wxDragResult
}wxDragResult is defined as follows:
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
30 wxDragMove, // the data was successfully moved (MSW only)
31 wxDragLink, // operation is a drag-link
32 wxDragCancel // the operation was cancelled by user (not an error)
38 \helpref{wxDropTarget
}{wxdroptarget
},
39 \helpref{wxTextDropTarget
}{wxtextdroptarget
},
\helpref{wxFileDropTarget
}{wxfiledroptarget
}
41 \latexignore{\rtfignore{\wxheading{Members
}}}
43 \membersection{wxDropSource::wxDropSource
}\label{wxdropsourcewxdropsource
}
45 \func{}{wxDropSource
}{\param{wxWindow*
}{ win = NULL
},
\param{const wxIconOrCursor\&
}{iconCopy = wxNullIconOrCursor
},
\param{const wxIconOrCursor\&
}{iconMove = wxNullIconOrCursor
},
\param{const wxIconOrCursor\&
}{iconNone = wxNullIconOrCursor
}}
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
}}
49 The constructors for wxDataObject.
51 If you use the constructor without
{\it data
} parameter you must call
52 \helpref{SetData
}{wxdropsourcesetdata
} later.
54 Note that the exact type of
{\it iconCopy
} and subsequent parameters differs
55 between wxMSW and wxGTK: these are cursors under Windows but icons for GTK.
56 You should use the macro
\helpref{wxDROP
\_ICON}{wxdropicon
} in portable
57 programs instead of directly using either of these types.
59 \wxheading{Parameters
}
61 \docparam{win
}{The window which initiates the drag and drop operation.
}
63 \docparam{iconCopy
}{The icon or cursor used for feedback for copy operation.
}
65 \docparam{iconMove
}{The icon or cursor used for feedback for move operation.
}
67 \docparam{iconNone
}{The icon or cursor used for feedback when operation can't be done.
}
69 {\it win
} is the window which initiates the drag and drop operation.
71 \membersection{wxDropSource::
\destruct{wxDropSource
}}\label{wxdropsourcedtor
}
73 \func{virtual
}{\destruct{wxDropSource
}}{\void}
75 \membersection{wxDropSource::SetData
}\label{wxdropsourcesetdata
}
77 \func{void
}{SetData
}{\param{wxDataObject\&
}{ data
}}
79 Sets the data
\helpref{wxDataObject
}{wxdataobject
} associated with the
80 drop source. This will not delete any previously associated data.
82 \membersection{wxDropSource::DoDragDrop
}\label{wxdropsourcedodragdrop
}
84 \func{virtual wxDragResult
}{DoDragDrop
}{\param{int
}{flags =
{\tt wxDrag
\_CopyOnly}}}
86 Do it (call this in response to a mouse button press, for example). This starts
87 the drag-and-drop operation which will terminate when the user releases the
90 \wxheading{Parameters
}
92 \docparam{flags
}{If
{\tt wxDrag
\_AllowMove} is included in the flags, data may
93 be moved and not only copied (default). If
{\tt wxDrag
\_DefaultMove} is
94 specified (which includes the previous flag), this is even the default
97 \wxheading{Return value
}
99 Returns the operation requested by the user, may be
{\tt wxDragCopy
},
{\tt
100 wxDragMove
},
{\tt wxDragLink
},
{\tt wxDragCancel
} or
{\tt wxDragNone
} if an error occurred.
102 \membersection{wxDropSource::GetDataObject
}\label{wxdropsourcegetdataobject
}
104 \func{wxDataObject *
}{GetDataObject
}{\void}
106 Returns the wxDataObject object that has been assigned previously.
108 \membersection{wxDropSource::GiveFeedback
}\label{wxdropsourcegivefeedback
}
110 \func{virtual bool
}{GiveFeedback
}{\param{wxDragResult
}{effect
}}
112 Overridable: you may give some custom UI feedback during the drag and drop operation
113 in this function. It is called on each mouse move, so your implementation must not be too
116 \wxheading{Parameters
}
118 \docparam{effect
}{The effect to implement. One of
{\tt wxDragCopy
},
{\tt wxDragMove
},
{\tt wxDragLink
} and
{\tt wxDragNone
}.
}
120 \docparam{scrolling
}{true if the window is scrolling. MSW only.
}
122 \wxheading{Return value
}
124 Return false if you want default feedback, or true if you implement your own
125 feedback. The return values is ignored under GTK.
127 \membersection{wxDropSource::SetCursor
}\label{wxdropsourcesetcursor
}
129 \func{void
}{SetCursor
}{\param{wxDragResult
}{res
},
\param{const wxCursor\&
}{cursor
}}
131 Set the icon to use for a certain drag result.
133 \wxheading{Parameters
}
135 \docparam{res
}{The drag result to set the icon for.
}
137 \docparam{cursor
}{The ion to show when this drag result occurs.
}