Re[2]: [wx-dev] wxDataViewCtrl DnD API
robert at roebling.de
robert at roebling.de
Tue Jan 1 11:48:05 PST 2008
> RR> > class wxDataViewModel..
> RR> > {
> RR> > bool AllowDrag( const wxDataViewItem &item );
> RR> > bool GetData( const wxDataViewItem &item,
> RR> > bool remove, data_target (?) );
> RR>
> RR> The problem starts here. We need something like
> RR> wxDataObject for storing strings etc. in the
> RR> platform specific way AND we need to make the
> RR> data dependent of the tree/list item from which
> RR> the data was dragged.
>
> So it looks like we need something aggregating a (pointer to)
> wxDataObject and the item?
Yes, something like that.
> RR> So the only way (I think) is to have
> RR>
> RR> class wxDataViewCtrl:
> RR> {
> RR> // informs the which formats are available
> RR> void EnableDrag( wxDataObject *object );
>
> Could this be (const) reference please? Also, is it really
> just for dragging? What about dropping?
Yes, the same for dropping. I'm just starting with
dragging.
> I think GetData() should rather create and return
> wxDataObject, i.e.
// create a new data object (to be deleted by caller) containing
// the data for the given item, return NULL to indicate failure
virtual wxDataObject *GetData(const wxDataViewItem& item);
This is the first obvious thought, but we need to declare
before, which formats are available (and there can be
several) and wxDataObjects are used for that, too, although
independent of the wxDataViewItem (GTK+ limitation).
So maybe the user should have to create 2 wxDataObjects,
one just for reporting the formats in EnableDrag(), one with
the real content in GetData(). I'd like to combine the two
by keeping the first wxDataObject around and handing
it over to the GetData() call, but this can be confusing, too.
I cannot think of any nice API right now.
Robert
More information about the wx-dev
mailing list