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