BlockScopeWxApp.cpp

Go to the documentation of this file.
00001 #include <BlockScopeWxApp.h>
00002 #include <wx/wx.h>
00003 
00004 
00005 class DummyWxApp : public wxApp
00006 {
00007 public:
00008   bool OnInit( );
00009   int  OnExit() { return true; }
00010 };
00011 
00012 IMPLEMENT_APP_NO_MAIN(DummyWxApp);
00013 
00014 
00015 bool DummyWxApp::OnInit( )
00016 {        
00017 //  std::cout << "OnInit()"<<std::endl;
00018   wxApp::OnInit();
00019 #ifdef __WXGTK__
00020   //See http://www.wxwindows.org/faqgtk.htm#locale
00021   setlocale(LC_NUMERIC, "C");
00022 #endif
00023   return true;
00024 }
00025 
00026 
00027 BlockScopeWxApp::BlockScopeWxApp()
00028 {
00029   mNeedToUninitialize = false;
00030   if (wxApp::GetInstance()==0)
00031     {
00032       wxApp::SetInstance(new DummyWxApp);
00033       wxInitialize();
00034       mNeedToUninitialize = true;
00035     }
00036 }
00037 
00038 BlockScopeWxApp::~BlockScopeWxApp()
00039 {
00040   if (mNeedToUninitialize) wxUninitialize();
00041 }
00042 
00043 
00044  
00045