Browse CVS Repository
Contents of /malonnote/main.cpp
Parent Directory
| Revision Log
| Revision Graph
Revision 1.4 -
( show annotations)
( download)
( as text)
Thu Sep 29 04:15:30 2005 UTC
(18 years, 5 months ago)
by maloninc
Branch: MAIN
CVS Tags: rel_1_4, dev_1_4-0003, dev_1_4-0002, dev_1_4-0005, dev_1_4-0006
Changes since 1.3: +7 -2 lines
File MIME type: text/x-c++src
use XRC file for mnFrame
| 1 |
// -*- C++ -*- generated by wxGlade 0.3.5.1 on Wed Jun 29 12:57:38 2005 |
| 2 |
|
| 3 |
#include <wx/wx.h> |
| 4 |
#include <wx/image.h> |
| 5 |
#include <wx/snglinst.h> |
| 6 |
#include <wx/xrc/xmlres.h> |
| 7 |
#include "mnDef.h" |
| 8 |
#include "mnFrame.h" |
| 9 |
#include "mnController.h" |
| 10 |
|
| 11 |
extern void InitXmlResource(); // defined in mnResource.cpp generated by wxrc |
| 12 |
|
| 13 |
class mnApp: public wxApp { |
| 14 |
public: |
| 15 |
bool OnInit(); |
| 16 |
int OnExit(); |
| 17 |
|
| 18 |
private: |
| 19 |
mnFrame* mainFrame; |
| 20 |
wxSingleInstanceChecker* m_checker; |
| 21 |
}; |
| 22 |
|
| 23 |
IMPLEMENT_APP(mnApp) |
| 24 |
|
| 25 |
//static wxLocale locale(wxLANGUAGE_DEFAULT); |
| 26 |
|
| 27 |
bool mnApp::OnInit() |
| 28 |
{ |
| 29 |
|
| 30 |
const wxString appName = wxString::Format(wxT(MN_APP_NAME) wxT("-%s"), wxGetUserId().c_str()); |
| 31 |
|
| 32 |
m_checker = new wxSingleInstanceChecker(appName); |
| 33 |
if ( m_checker->IsAnotherRunning() ){ |
| 34 |
wxMessageBox(wxT("Another program instance is already running, aborting.")); |
| 35 |
delete m_checker; |
| 36 |
exit(0); |
| 37 |
} |
| 38 |
|
| 39 |
wxInitAllImageHandlers(); |
| 40 |
wxXmlResource::Get()->InitAllHandlers(); |
| 41 |
InitXmlResource(); |
| 42 |
|
| 43 |
mainFrame = new mnFrame(0); |
| 44 |
|
| 45 |
/* set controller object as event handler */ |
| 46 |
mnController* controller = new mnController(mainFrame); |
| 47 |
mainFrame->PushEventHandler(controller); |
| 48 |
|
| 49 |
SetTopWindow(mainFrame); |
| 50 |
mainFrame->Show(); |
| 51 |
|
| 52 |
return true; |
| 53 |
} |
| 54 |
|
| 55 |
int mnApp::OnExit() |
| 56 |
{ |
| 57 |
delete m_checker; |
| 58 |
} |
|