Basic Image AlgorithmS Library  2.8.0
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
dndFileTarget.cpp
1 #include "dndFileTarget.hh"
2 #include <string>
3 #include <sstream>
4 #include "Base/Debug/Error.hh"
5 #include <Gui/StringConv.hh>
6 #include <wx/filename.h>
7 
8 using namespace std;
9 using namespace BIAS;
10 
11 /** @author Jan Woetzel 03/2005 */
12 dndFileTarget::dndFileTarget(wxFrame *frame){m_frame = frame;}
13 
14 //bool dndFileTarget::OnDropFiles (wxCoord x, wxCoord y, const wxArrayString& filenames)
15 bool dndFileTarget::OnDropFiles (wxCoord , wxCoord , const wxArrayString& filenames)
16 {
17  stringstream ss;
18  for (size_t n = 0; n < filenames.Count(); n++){
19  if (wxFileName(filenames[n]).IsDir()) {
20  wxMessageBox(wxT("Dropping directories is unsupoprted. Please drop only filenames!"),
21  wxT("dndFileTarget Error"), wxOK|wxICON_EXCLAMATION);
22  return FALSE;
23  } else {
24  ss.str("");
25  ss<<n<<". "<<filenames[n]<<" ";
26 
27  // do smoething with the dropped string
28  BIASASSERT(m_frame!=NULL);
29  m_frame->SetStatusText( AsciiToWx(ss.str()) );
30  //m_frame->files_.push_back( string(filenames[n]) );
31  //LoadImageFromList(files_.size()-1);
32  //// save last name as default if any selected
33  //if (files_.size()>0) defaultFile=wxString( files_.back().c_str() );
34  }
35  };
36  return TRUE;
37 }
wxString AsciiToWx(const char *thestring)
Converts a C string to a wxString.
Definition: StringConv.hh:32