00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifdef HAVE_CONFIG_H
00023 #include <config.h>
00024 #endif
00025
00026 #include <wx/wxprec.h>
00027
00028 #ifndef WX_PRECOMP
00029 #include <wx/wx.h>
00030 #endif
00031
00032 #include "FileDropTarget.hh"
00033
00034 using namespace emuWorks;
00035
00036 bool FileDropTarget::OnDropFiles(wxCoord x, wxCoord y,
00037 const wxArrayString &files) {
00038 int size = files.GetCount();
00039
00040 if (size > 0) {
00041 wxString filename = files[0];
00042
00043 #ifdef __WXGTK__
00044 filename.Replace("%20", " ");
00045 #endif
00046
00047 wxString ext = filename.Mid(filename.Length() - 4);
00048
00049 if (ext.CmpNoCase(".sav") != 0) {
00050 wxMessageBox(wxT("Only NES SRAM (*.sav) files can be dropped."),
00051 wxT("Error: Invalid File Drop"),
00052 wxICON_ERROR | wxOK);
00053
00054 return false;
00055 }
00056
00057 owner->load(filename);
00058 }
00059
00060 return true;
00061 }
00062