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

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