diff include/dndfile.h @ 6:9c85d71cad7c

implement drag&drop.
author pyon@macmini
date Tue, 18 Oct 2011 22:43:46 +0900
parents 52697c869ce8
children dfa5cae8c992
line wrap: on
line diff
--- a/include/dndfile.h	Tue Oct 18 07:53:48 2011 +0900
+++ b/include/dndfile.h	Tue Oct 18 22:43:46 2011 +0900
@@ -1,23 +1,28 @@
-#include "wx/wxprec.h"
- 
-#ifndef WX_PRECOMP
-    #include "wx/wx.h"
-    #include "wx/arrstr.h"
-    #include "wx/textctrl.h"
-    #include "wx/dnd.h"
-#endif
+// Filename   : param.cpp
+// Last Change: 18-Oct-2011.
+//
 
 class DnDFile : public wxFileDropTarget
 {
     public:
-        DnDFile( wxTextCtrl *owner ) { m_owner = owner; }
-        virtual bool OnDropFiles( wxCoord x, wxCoord y, const wxArrayString& finenames )
+        DnDFile( wxDirPickerCtrl *dir )
+        {
+            m_workdir = dir->GetPath();
+        }
+        virtual bool OnDropFiles( wxCoord x, wxCoord y, const wxArrayString& filenames )
         {
-            m_owner->SetValue( finenames[0] );
+            size_t nFiles = filenames.GetCount();
+            for ( size_t n=0; n<nFiles; n++ ) {
+                wxFileName filename( filenames[n] );
+                wxString from = filenames[n];
+                wxString to   = m_workdir + wxFILE_SEP_PATH + filename.GetFullName();
+                wxRenameFile( from, to, true );
+                //wxMessageBox( wxT("move ") + filenames[n] + to );
+            }
             return true;
         }
 
     private:
-        wxTextCtrl *m_owner;
+        wxString m_workdir;
 };