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

source/GenApp.cc

Go to the documentation of this file.
00001 /*
00002  * z2se
00003  * Copyright (C) 2004-2005 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: GenApp.cc,v 1.2 2005/08/04 05:23:21 technoplaza 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 <iostream>
00036 #include <sys/stat.h>
00037 
00038 #include "GenApp.hh"
00039 #include "view/MainFrame.hh"
00040 
00041 using namespace emuWorks;
00042 
00043 const wxString *GenApp::APP_NAME =
00044     new wxString(wxT(PACKAGE_NAME));
00045     
00046 const wxString *GenApp::APP_FULL_NAME =
00047     new wxString(wxT(PACKAGE_FULL_NAME));
00048 
00049 const wxString *GenApp::APP_VERSION =
00050     new wxString(wxT(PACKAGE_VERSION));
00051 
00052 const wxString *GenApp::APP_COPYRIGHT =
00053     new wxString(wxT("Copyright (C) 2004-2005 emuWorks"));
00054 
00055 const wxString *GenApp::APP_URL =
00056     new wxString(wxT("http://games.technoplaza.net/"));
00057 
00058 IMPLEMENT_APP(GenApp)
00059 IMPLEMENT_CLASS(GenApp, wxApp)
00060 
00061 bool GenApp::OnInit() {
00062     wxString *xrcfile;
00063     
00064     if (argc == 2) {
00065         xrcfile = new wxString(argv[1]);
00066     } else {
00067         xrcfile = new wxString(XRC_FILE);
00068     }
00069     
00070     struct stat xrcstats;
00071     
00072     if (stat(xrcfile->mb_str(), &xrcstats) != 0) {
00073         std::cerr << "error: unable to locate XRC file " << 
00074             xrcfile->mb_str() << std::endl;
00075         return false;
00076     }
00077     
00078     wxXmlResource::Get()->InitAllHandlers();
00079     wxXmlResource::Get()->Load(*xrcfile);
00080     
00081     MainFrame *frame = new MainFrame;
00082     frame->SetTitle(*APP_FULL_NAME + wxT(' ') + *APP_VERSION);
00083     frame->Show(true);
00084     SetTopWindow(frame);
00085     
00086     return true;
00087 }

Generated on Thu Aug 4 00:30:33 2005 for Zelda II SRAM Editor by  doxygen 1.4.4