Main Page | Namespace List | Class List | File List | Namespace Members | Class Members | File Members

source/view/FileDropTarget.cc

Go to the documentation of this file.
00001 /*
00002  * Copyright (C) 2004 emuWorks
00003  * http://games.technoplaza.net/
00004  *
00005  * This program is free software; you can redistribute it and/or
00006  * modify it under the terms of the GNU General Public License
00007  * as published by the Free Software Foundation; either version 2
00008  * of the License, or (at your option) any later version.
00009  *
00010  * This program is distributed in the hope that it will be useful,
00011  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013  * GNU General Public License for more details.
00014  *
00015  * You should have received a copy of the GNU General Public License
00016  * along with this program; if not, write to the Free Software
00017  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
00018  */
00019 
00020 // $Id: FileDropTarget.cc,v 1.2 2004/12/10 16:10:32 technoplaza Exp $
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 

Generated on Fri Dec 10 11:33:56 2004 for Zelda II SRAM Editor by  doxygen 1.3.9.1