#include <wx/dnd.h>
This class represents a source for a drag and drop operation.
Public Member Functions | |
wxDropSource (wxWindow *win=NULL, const wxIcon &iconCopy=wxNullIcon, const wxIcon &iconMove=wxNullIcon, const wxIcon &iconNone=wxNullIcon) | |
This constructor requires that you must call SetData() later. | |
wxDropSource (wxDataObject &data, wxWindow *win=NULL, const wxIcon &iconCopy=wxNullIcon, const wxIcon &iconMove=wxNullIcon, const wxIcon &iconNone=wxNullIcon) | |
The constructor for wxDataObject. | |
wxDropSource (wxWindow *win=NULL, const wxCursor &iconCopy=wxNullCursor, const wxCursor &iconMove=wxNullCursor, const wxCursor &iconNone=wxNullCursor) | |
This constructor requires that you must call SetData() later. | |
wxDropSource (wxDataObject &data, wxWindow *win=NULL, const wxCursor &iconCopy=wxNullCursor, const wxCursor &iconMove=wxNullCursor, const wxCursor &iconNone=wxNullCursor) | |
The constructor for wxDataObject. | |
virtual | ~wxDropSource () |
Default constructor. | |
virtual wxDragResult | DoDragDrop (int flags=wxDrag_CopyOnly) |
Starts the drag-and-drop operation which will terminate when the user releases the mouse. | |
wxDataObject * | GetDataObject () |
Returns the wxDataObject object that has been assigned previously. | |
virtual bool | GiveFeedback (wxDragResult effect) |
You may give some custom UI feedback during the drag and drop operation by overriding this function. | |
void | SetCursor (wxDragResult res, const wxCursor &cursor) |
Set the icon to use for a certain drag result. | |
void | SetData (wxDataObject &data) |
Sets the data wxDataObject associated with the drop source. |
wxDropSource::wxDropSource | ( | wxWindow * | win = NULL , |
|
const wxIcon & | iconCopy = wxNullIcon , |
|||
const wxIcon & | iconMove = wxNullIcon , |
|||
const wxIcon & | iconNone = wxNullIcon | |||
) |
This constructor requires that you must call SetData() later.
Note that the type of iconCopy and subsequent parameters differs between different ports: these are cursors under Windows but icons for GTK. You should use the macro wxDROP_ICON() in portable programs instead of directly using either of these types.
win | The window which initiates the drag and drop operation. | |
iconCopy | The icon or cursor used for feedback for copy operation. | |
iconMove | The icon or cursor used for feedback for move operation. | |
iconNone | The icon or cursor used for feedback when operation can't be done. |
wxDropSource::wxDropSource | ( | wxDataObject & | data, | |
wxWindow * | win = NULL , |
|||
const wxIcon & | iconCopy = wxNullIcon , |
|||
const wxIcon & | iconMove = wxNullIcon , |
|||
const wxIcon & | iconNone = wxNullIcon | |||
) |
The constructor for wxDataObject.
Note that the type of iconCopy and subsequent parameters differs between different ports: these are cursors under Windows but icons for GTK. You should use the macro wxDROP_ICON() in portable programs instead of directly using either of these types.
data | The data associated with the drop source. | |
win | The window which initiates the drag and drop operation. | |
iconCopy | The icon or cursor used for feedback for copy operation. | |
iconMove | The icon or cursor used for feedback for move operation. | |
iconNone | The icon or cursor used for feedback when operation can't be done. |
wxDropSource::wxDropSource | ( | wxWindow * | win = NULL , |
|
const wxCursor & | iconCopy = wxNullCursor , |
|||
const wxCursor & | iconMove = wxNullCursor , |
|||
const wxCursor & | iconNone = wxNullCursor | |||
) |
This constructor requires that you must call SetData() later.
Note that the type of iconCopy and subsequent parameters differs between different ports: these are cursors under Windows but icons for GTK. You should use the macro wxDROP_ICON() in portable programs instead of directly using either of these types.
win | The window which initiates the drag and drop operation. | |
iconCopy | The icon or cursor used for feedback for copy operation. | |
iconMove | The icon or cursor used for feedback for move operation. | |
iconNone | The icon or cursor used for feedback when operation can't be done. |
wxDropSource::wxDropSource | ( | wxDataObject & | data, | |
wxWindow * | win = NULL , |
|||
const wxCursor & | iconCopy = wxNullCursor , |
|||
const wxCursor & | iconMove = wxNullCursor , |
|||
const wxCursor & | iconNone = wxNullCursor | |||
) |
The constructor for wxDataObject.
Note that the type of iconCopy and subsequent parameters differs between different ports: these are cursors under Windows but icons for GTK. You should use the macro wxDROP_ICON() in portable programs instead of directly using either of these types.
data | The data associated with the drop source. | |
win | The window which initiates the drag and drop operation. | |
iconCopy | The icon or cursor used for feedback for copy operation. | |
iconMove | The icon or cursor used for feedback for move operation. | |
iconNone | The icon or cursor used for feedback when operation can't be done. |
virtual wxDropSource::~wxDropSource | ( | ) | [virtual] |
Default constructor.
virtual wxDragResult wxDropSource::DoDragDrop | ( | int | flags = wxDrag_CopyOnly |
) | [virtual] |
Starts the drag-and-drop operation which will terminate when the user releases the mouse.
Call this in response to a mouse button press, for example.
flags | If wxDrag_AllowMove is included in the flags, data may be moved and not only copied (default). If wxDrag_DefaultMove is specified (which includes the previous flag), this is even the default operation. |
wxDataObject* wxDropSource::GetDataObject | ( | ) |
Returns the wxDataObject object that has been assigned previously.
virtual bool wxDropSource::GiveFeedback | ( | wxDragResult | effect | ) | [virtual] |
You may give some custom UI feedback during the drag and drop operation by overriding this function.
It is called on each mouse move, so your implementation must not be too slow.
effect | The effect to implement. One of wxDragCopy, wxDragMove, wxDragLink and wxDragNone. |
void wxDropSource::SetCursor | ( | wxDragResult | res, | |
const wxCursor & | cursor | |||
) |
Set the icon to use for a certain drag result.
res | The drag result to set the icon for. | |
cursor | The ion to show when this drag result occurs. |
void wxDropSource::SetData | ( | wxDataObject & | data | ) |
Sets the data wxDataObject associated with the drop source.
This will not delete any previously associated data.
![]() |
[ top ] |