[wx-dev] wxDataViewCtrl DnD API

Vadim Zeitlin vadim at wxwidgets.org
Tue Jan 1 12:21:04 PST 2008


On Tue, 01 Jan 2008 20:48:05 +0100 "robert at roebling.de" <robert at roebling.de> wrote:

r> > I think GetData() should rather create and return
r> > wxDataObject, i.e.
r> 
r> 	// create a new data object (to be deleted by caller) containing
r> 	// the data for the given item, return NULL to indicate failure
r> 	virtual wxDataObject *GetData(const wxDataViewItem& item);
r> 
r> This is the first obvious thought, but we need to declare
r> before, which formats are available (and there can be
r> several) and wxDataObjects are used for that, too, although
r> independent of the wxDataViewItem (GTK+ limitation).
r> So maybe the user should have to create 2 wxDataObjects,
r> one just for reporting the formats in EnableDrag(), one with
r> the real content in GetData(). I'd like to combine the two
r> by keeping the first wxDataObject around and handing
r> it over to the GetData() call, but this can be confusing, too.
r> 
r> I cannot think of any nice API right now.

 What about:

	// call this to enable dnd of the data in the specified format(s)
	void AllowDnD(const wxDataFormat& format);
	void AllowDnD(const wxVector<wxDataFormat>& formats);

	// ... as before ...
	//
	// format is one of the formats passed to AllowDnD()
	virtual wxDataObject *GetData(item, const wxDataFormat& format);

?

VZ




More information about the wx-dev mailing list