]> git.saurik.com Git - wxWidgets.git/commitdiff
Files from a Drop were only added but the fileslist never cleard
authorStefan Csomor <csomor@advancedconcepts.ch>
Sat, 15 Feb 2003 08:36:30 +0000 (08:36 +0000)
committerStefan Csomor <csomor@advancedconcepts.ch>
Sat, 15 Feb 2003 08:36:30 +0000 (08:36 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@19225 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/mac/carbon/dnd.cpp
src/mac/dnd.cpp

index 09a2f1d373bf30020cfff089809972dccbfac453..4033d33e014de559f113c363fd8cfa9d8d75925f 100644 (file)
@@ -173,6 +173,7 @@ bool wxDropTarget::GetData()
     {
       UInt16 items ;
       OSErr result;
+      bool firstFileAdded = false ;
       CountDragItems((DragReference)m_currentDrag, &items);
       for (UInt16 index = 1; index <= items; ++index) 
       {
@@ -215,7 +216,13 @@ bool wxDropTarget::GetData()
                   {
                     HFSFlavor* theFile = (HFSFlavor*) theData ;
                     wxString name = wxMacFSSpec2MacFilename( &theFile->fileSpec ) ;
-                    ((wxFileDataObject*)m_dataObject)->AddFile( name ) ;
+                    if (  firstFileAdded )
+                       ((wxFileDataObject*)m_dataObject)->AddFile( name ) ;
+                    else
+                    {
+                       ((wxFileDataObject*)m_dataObject)->SetData( 0 , name.c_str() ) ;
+                       firstFileAdded = true ; 
+                    }
                   }
                   else
                   {
index 09a2f1d373bf30020cfff089809972dccbfac453..4033d33e014de559f113c363fd8cfa9d8d75925f 100644 (file)
@@ -173,6 +173,7 @@ bool wxDropTarget::GetData()
     {
       UInt16 items ;
       OSErr result;
+      bool firstFileAdded = false ;
       CountDragItems((DragReference)m_currentDrag, &items);
       for (UInt16 index = 1; index <= items; ++index) 
       {
@@ -215,7 +216,13 @@ bool wxDropTarget::GetData()
                   {
                     HFSFlavor* theFile = (HFSFlavor*) theData ;
                     wxString name = wxMacFSSpec2MacFilename( &theFile->fileSpec ) ;
-                    ((wxFileDataObject*)m_dataObject)->AddFile( name ) ;
+                    if (  firstFileAdded )
+                       ((wxFileDataObject*)m_dataObject)->AddFile( name ) ;
+                    else
+                    {
+                       ((wxFileDataObject*)m_dataObject)->SetData( 0 , name.c_str() ) ;
+                       firstFileAdded = true ; 
+                    }
                   }
                   else
                   {