FileDropTarget.cc

Go to the documentation of this file.
00001 /*
00002  * Zelda II SRAM Editor
00003  * Copyright (C) 2004-2005,2007-2008 emuWorks
00004  * http://games.technoplaza.net/
00005  *
00006  * This file is part of z2se.
00007  *
00008  * z2se is free software; you can redistribute it and/or modify
00009  * it under the terms of the GNU General Public License as published by
00010  * the Free Software Foundation; either version 2 of the License, or
00011  * (at your option) any later version.
00012  *
00013  * z2se is distributed in the hope that it will be useful,
00014  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00015  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00016  * GNU General Public License for more details.
00017  *
00018  * You should have received a copy of the GNU General Public License
00019  * along with z2se; if not, write to the Free Software
00020  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
00021  */
00022 
00023 // $Id: FileDropTarget.cc,v 1.7 2008/12/17 06:24:27 jdratlif Exp $
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 "view/FileDropTarget.hh"
00036 #include "view/MainFrame.hh"
00037 
00038 using namespace emuWorks;
00039 
00040 bool FileDropTarget::OnDropFiles(wxCoord, wxCoord, const wxArrayString &files) {
00041     int size = files.GetCount();
00042 
00043     if (size > 0) {
00044         wxString filename = files[0];
00045         
00046         wxString ext = filename.Mid(filename.Length() - 4);
00047         
00048         if (ext.CmpNoCase(wxT(".sav")) != 0) {
00049             wxMessageBox(wxT("Only NES SRAM (*.sav) files can be dropped."),
00050                          wxT("Error: Invalid File Drop"),
00051                          wxICON_ERROR | wxOK);
00052             
00053             return false;
00054         }
00055         
00056         owner->load(filename);
00057     }
00058 
00059     return true;
00060 }
00061 

Generated on Mon Dec 29 01:21:33 2008 for Zelda II SRAM Editor by  doxygen 1.5.4