Develop and Download Open Source Software

Browse CVS Repository

Annotation of /malonnote/main.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.1 - (hide annotations) (download) (as text)
Thu Jul 28 03:25:05 2005 UTC (18 years, 7 months ago) by maloninc
Branch: MAIN
Branch point for: vendor
File MIME type: text/x-c++src
Initial revision

1 maloninc 1.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 "mnFrame.h"
7     #include "mnController.h"
8    
9     #define MY_APP "MalonNote"
10    
11     class mnApp: public wxApp {
12     public:
13     bool OnInit();
14     int OnExit();
15    
16     private:
17     mnFrame* mainFrame;
18     wxSingleInstanceChecker* m_checker;
19     };
20    
21     IMPLEMENT_APP(mnApp)
22    
23     static wxLocale locale(wxLANGUAGE_DEFAULT);
24    
25     bool mnApp::OnInit()
26     {
27    
28     const wxString appName = wxString::Format(wxT(MY_APP) wxT("-%s"), wxGetUserId().c_str());
29    
30     m_checker = new wxSingleInstanceChecker(appName);
31     if ( m_checker->IsAnotherRunning() ){
32     wxMessageBox(wxT("Another program instance is already running, aborting."));
33     delete m_checker;
34     exit(0);
35     }
36    
37     wxInitAllImageHandlers();
38     mainFrame = new mnFrame(0, -1, wxT(""));
39    
40     /* set controller object as event handler */
41     mnController* controller = new mnController(mainFrame);
42     mainFrame->PushEventHandler(controller);
43    
44     SetTopWindow(mainFrame);
45     mainFrame->Show();
46    
47     return true;
48     }
49    
50     int mnApp::OnExit()
51     {
52     delete m_checker;
53     }

Back to OSDN">Back to OSDN
ViewVC Help
Powered by ViewVC 1.1.26