Allow dropping data outside of item area in wxDataViewCtrl.
Implement this change for the generic and the native GTK versions and document it. Closes #16152. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@76416 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -862,8 +862,8 @@ void MyFrame::OnDropPossible( wxDataViewEvent &event )
|
||||
{
|
||||
wxDataViewItem item( event.GetItem() );
|
||||
|
||||
// only allow drags for item, not containers
|
||||
if (m_music_model->IsContainer( item ) )
|
||||
// only allow drags for item or background, not containers
|
||||
if ( item.IsOk() && m_music_model->IsContainer( item ) )
|
||||
event.Veto();
|
||||
|
||||
if (event.GetDataFormat() != wxDF_UNICODETEXT)
|
||||
@@ -875,7 +875,7 @@ void MyFrame::OnDrop( wxDataViewEvent &event )
|
||||
wxDataViewItem item( event.GetItem() );
|
||||
|
||||
// only allow drops for item, not containers
|
||||
if (m_music_model->IsContainer( item ) )
|
||||
if ( item.IsOk() && m_music_model->IsContainer( item ) )
|
||||
{
|
||||
event.Veto();
|
||||
return;
|
||||
@@ -890,7 +890,10 @@ void MyFrame::OnDrop( wxDataViewEvent &event )
|
||||
wxTextDataObject obj;
|
||||
obj.SetData( wxDF_UNICODETEXT, event.GetDataSize(), event.GetDataBuffer() );
|
||||
|
||||
wxLogMessage( "Text dropped: %s", obj.GetText() );
|
||||
if ( item.IsOk() )
|
||||
wxLogMessage( "Text dropped on item %s: %s", m_music_model->GetTitle( item ), obj.GetText() );
|
||||
else
|
||||
wxLogMessage( "Text dropped on background: %s", obj.GetText() );
|
||||
}
|
||||
|
||||
#endif // wxUSE_DRAG_AND_DROP
|
||||
|
Reference in New Issue
Block a user