Mercurial > mercurial > hgweb_mover.cgi
comparison src/main.cpp @ 2:1ea4f7981ff5
create window.
| author | pyon@macmini |
|---|---|
| date | Sun, 02 Oct 2011 18:44:03 +0900 |
| parents | |
| children | 99d612849255 |
comparison
equal
deleted
inserted
replaced
| 1:214f2908b8e4 | 2:1ea4f7981ff5 |
|---|---|
| 1 // Filename : main.cpp | |
| 2 // Last Change: 02-Oct-2011. | |
| 3 // | |
| 4 | |
| 5 #include "common.h" | |
| 6 #include "main.h" | |
| 7 #include "myframe.h" | |
| 8 | |
| 9 IMPLEMENT_APP(MyApp) | |
| 10 | |
| 11 IMPLEMENT_CLASS( MyApp, wxApp ) | |
| 12 | |
| 13 MyApp::MyApp() | |
| 14 { | |
| 15 } | |
| 16 MyApp::~MyApp() | |
| 17 { | |
| 18 } | |
| 19 | |
| 20 bool MyApp::OnInit() | |
| 21 { | |
| 22 if ( !wxApp::OnInit() ) return false; | |
| 23 | |
| 24 wxImage::AddHandler( new wxJPEGHandler ); | |
| 25 | |
| 26 ConfInit(); | |
| 27 | |
| 28 MyFrame *mainframe = new MyFrame( NULL, ID_MAIN, wxT("A Mover") ); | |
| 29 mainframe->SetSize( rect ); | |
| 30 mainframe->SetMinSize( wxSize( 580, 680 ) ); | |
| 31 mainframe->Show(true); | |
| 32 | |
| 33 return true; | |
| 34 } | |
| 35 | |
| 36 int MyApp::OnExit() | |
| 37 { | |
| 38 config->SetPath( wxT("/Geometry") ); | |
| 39 config->Write( wxT("x"), rect.x ); | |
| 40 config->Write( wxT("y"), rect.y ); | |
| 41 config->Write( wxT("w"), rect.width ); | |
| 42 config->Write( wxT("h"), rect.height ); | |
| 43 | |
| 44 wxString key; | |
| 45 config->SetPath( wxT("/WorkDir") ); | |
| 46 config->Write( wxT("dir"), dir ); | |
| 47 | |
| 48 delete config; | |
| 49 | |
| 50 return 0; | |
| 51 } | |
| 52 | |
| 53 void MyApp::ConfInit() | |
| 54 { | |
| 55 conf_file = wxGetCwd() + wxFILE_SEP_PATH + MYAPPNAME + wxT(".conf"); | |
| 56 config = new wxFileConfig( wxT("MyApp"), wxT("T.Mutoh"), conf_file, wxEmptyString, wxCONFIG_USE_LOCAL_FILE ); | |
| 57 | |
| 58 config->SetPath( wxT("/Geometry") ); | |
| 59 config->Read( wxT("x"), &rect.x ); | |
| 60 config->Read( wxT("y"), &rect.y ); | |
| 61 config->Read( wxT("w"), &rect.width ); | |
| 62 config->Read( wxT("h"), &rect.height ); | |
| 63 | |
| 64 config->SetPath( wxT("/WorkDir") ); | |
| 65 config->Read( wxT("dir"), &dir ); | |
| 66 } | |
| 67 |
