Use vector instead of array of wxDataFormats

Also rename EnableDropTarget() to EnableDropTargets(), as calling
EnableDropTarget(wxDF_XXX) would be ambiguous due to the existence of a
non-explicit wxVector ctor taking size_t (which is a mistake on its own,
but is probably not worth changing any more).
This commit is contained in:
Vadim Zeitlin
2021-08-16 18:22:08 +02:00
parent 1499d7d45b
commit cd555f9ff5
11 changed files with 27 additions and 30 deletions

View File

@@ -211,7 +211,7 @@ public:
// dnd iface
bool EnableDragSource( const wxDataFormat &format );
bool EnableDropTarget( const wxDataFormatArray &formats );
bool EnableDropTarget( const wxVector<wxDataFormat> &formats );
gboolean row_draggable( GtkTreeDragSource *drag_source, GtkTreePath *path );
gboolean drag_data_delete( GtkTreeDragSource *drag_source, GtkTreePath* path );
@@ -3794,16 +3794,17 @@ bool wxDataViewCtrlInternal::EnableDragSource( const wxDataFormat &format )
return true;
}
bool wxDataViewCtrlInternal::EnableDropTarget( const wxDataFormatArray& formats )
bool wxDataViewCtrlInternal::EnableDropTarget( const wxVector<wxDataFormat>& formats )
{
if (formats.GetCount() == 0)
if (formats.empty())
{
gtk_tree_view_unset_rows_drag_dest(GTK_TREE_VIEW(m_owner->GtkGetTreeView()));
return true;
}
wxGtkString atom_str( gdk_atom_name( formats.Item(0) ) );
// TODO: Use all formats, not just the first one.
wxGtkString atom_str( gdk_atom_name( formats[0] ) );
m_dropTargetTargetEntryTarget = wxCharBuffer( atom_str );
m_dropTargetTargetEntry.target = m_dropTargetTargetEntryTarget.data();
@@ -4929,7 +4930,7 @@ bool wxDataViewCtrl::EnableDragSource( const wxDataFormat &format )
return m_internal->EnableDragSource( format );
}
bool wxDataViewCtrl::DoEnableDropTarget( const wxDataFormatArray& formats )
bool wxDataViewCtrl::DoEnableDropTarget( const wxVector<wxDataFormat>& formats )
{
wxCHECK_MSG( m_internal, false, "model must be associated before calling EnableDragTarget" );
return m_internal->EnableDropTarget( formats );