Accept multiple data formats via drag-and-drop in wxDataViewCtrl
Allow specifying multiple formats to be accepted when dragging data to wxDataViewCtrl in the generic and Cocoa implementations. Add wxDataViewCtrlBase::EnableDropTarget() overload taking an array of wxDataFormats to support this at the API level. Add new DoEnableDropTarget() used by both EnableDropTarget() overloads and implement it in the generic and Cocoa ports. GTK implementation still uses only a single format, as before. Also refactor the Cocoa implementation: all operations using dragged data are now handled by wxDropTarget and unnecessary DataViewPboardType as removed. Update the dataview sample to show the new functionality.
This commit is contained in:
@@ -1430,21 +1430,20 @@ void MyFrame::OnDrop( wxDataViewEvent &event )
|
||||
return;
|
||||
}
|
||||
|
||||
wxTextDataObject obj;
|
||||
obj.SetData( wxDF_UNICODETEXT, event.GetDataSize(), event.GetDataBuffer() );
|
||||
const wxTextDataObject* const obj = static_cast<wxTextDataObject*>(event.GetDataObject());
|
||||
|
||||
if ( item.IsOk() )
|
||||
{
|
||||
if (m_music_model->IsContainer(item))
|
||||
{
|
||||
wxLogMessage("Text '%s' dropped in container '%s' (proposed index = %i)",
|
||||
obj.GetText(), m_music_model->GetTitle(item), event.GetProposedDropIndex());
|
||||
obj->GetText(), m_music_model->GetTitle(item), event.GetProposedDropIndex());
|
||||
}
|
||||
else
|
||||
wxLogMessage("Text '%s' dropped on item '%s'", obj.GetText(), m_music_model->GetTitle(item));
|
||||
wxLogMessage("Text '%s' dropped on item '%s'", obj->GetText(), m_music_model->GetTitle(item));
|
||||
}
|
||||
else
|
||||
wxLogMessage("Text '%s' dropped on background (proposed index = %i)", obj.GetText(), event.GetProposedDropIndex());
|
||||
wxLogMessage("Text '%s' dropped on background (proposed index = %i)", obj->GetText(), event.GetProposedDropIndex());
|
||||
}
|
||||
|
||||
#endif // wxUSE_DRAG_AND_DROP
|
||||
|
||||
Reference in New Issue
Block a user