Contents Up Previous Next

wxDropSource

Overview

This class represents a source for a drag and drop operation.

Derived from

wxObject

Include files

<wx/dnd.h>

Types

wxDragResult is defined as follows:


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
    wxDragCancel    // the operation was cancelled by user (not an error)
  ;

See also

Drag and drop overview, wxDropTarget, wxTextDropTarget, wxFileDropTarget

Members

wxDropSource::wxDropSource
wxDropSource::~wxDropSource
wxDropSource::SetData
wxDropSource::DoDragDrop
wxDropSource::GiveFeedback


wxDropSource::wxDropSource

wxDropSource(wxWindow* win = NULL)

Default/wxGTK-specific constructor. If you use the default constructor you must call wxDropSource::SetData later.

win is required by wxGTK and therefore should always be set.

wxDropSource(wxDataObject& data, wxWindow* win = NULL)

Parameters

data

win


wxDropSource::~wxDropSource

virtual ~wxDropSource()


wxDropSource::SetData

void SetData(wxDataObject& data)

Sets the data data object associated with the drop source.


wxDropSource::DoDragDrop

virtual wxDragResult DoDragDrop(bool bAllowMove = FALSE)

Do it (call this in response to a mouse button press, for example).

If bAllowMove is FALSE, data can only be copied. Under GTK, data is always copied.


wxDropSource::GiveFeedback

virtual bool GiveFeedback(wxDragResult effect, bool bScrolling)

Overridable: you may give some custom UI feedback during the drag and drop operation in this function. It is called on each mouse move, so your implementation must not be too slow.

Parameters

effect

bScrolling

Return value

Return FALSE if you want default feedback, or TRUE if you implement your own feedback.