X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/f032bf3d16d85368509fca6857f8a70ad626c515..7f47faf4f2fb142f715e3e47ed6f25a002d7a5d2:/samples/nativdlg/nativdlg.cpp?ds=inline diff --git a/samples/nativdlg/nativdlg.cpp b/samples/nativdlg/nativdlg.cpp index 6ff49b5b0f..4e52a9ad23 100644 --- a/samples/nativdlg/nativdlg.cpp +++ b/samples/nativdlg/nativdlg.cpp @@ -9,10 +9,6 @@ // Licence: wxWindows license ///////////////////////////////////////////////////////////////////////////// -#ifdef __GNUG__ -#pragma implementation -#endif - // For compilers that support precompilation, includes "wx/wx.h". #include "wx/wxprec.h" @@ -32,23 +28,17 @@ #include "nativdlg.h" #include "resource.h" -// Declare two frames -MyFrame *frame = NULL; - IMPLEMENT_APP(MyApp) -// Testing of ressources -MyApp::MyApp() -{ -} - bool MyApp::OnInit(void) { // Create the main frame window - frame = new MyFrame(NULL, -1, _T("wxWindows Native Dialog Sample"), wxPoint(0, 0), wxSize(300, 250)); + MyFrame *frame = new MyFrame(NULL, wxID_ANY, _T("wxWidgets Native Dialog Sample"), wxPoint(0, 0), wxSize(300, 250)); +#if wxUSE_STATUSBAR // Give it a status line frame->CreateStatusBar(2); +#endif // wxUSE_STATUSBAR // Make a menubar wxMenu *file_menu = new wxMenu; @@ -64,13 +54,13 @@ bool MyApp::OnInit(void) frame->SetMenuBar(menu_bar); // Make a panel - frame->panel = new wxWindow(frame, -1, wxPoint(0, 0), wxSize(400, 400), 0, _T("MyMainFrame")); - frame->Show(TRUE); + frame->panel = new wxWindow(frame, wxID_ANY, wxPoint(0, 0), wxSize(400, 400), 0, _T("MyMainFrame")); + frame->Show(true); // Return the main frame window SetTopWindow(frame); - return TRUE; + return true; } BEGIN_EVENT_TABLE(MyFrame, wxFrame) @@ -85,20 +75,22 @@ MyFrame::MyFrame(wxWindow *parent, const wxWindowID id, const wxString& title, c panel = NULL; } -void MyFrame::OnQuit(wxCommandEvent& event) +void MyFrame::OnQuit(wxCommandEvent& WXUNUSED(event)) { - Close(TRUE); + Close(true); } -void MyFrame::OnTest1(wxCommandEvent& event) +void MyFrame::OnTest1(wxCommandEvent& WXUNUSED(event)) { - MyDialog *dialog = new MyDialog; - if (dialog->LoadNativeDialog(this, _T("dialog1"))) - { - dialog->SetModal(TRUE); - dialog->ShowModal(); - } - dialog->Close(TRUE); +#if ( defined(__WXOS2__) || defined(__WXMSW__) ) && !defined(__WXUNIVERSAL__) + MyDialog dialog; + if (dialog.LoadNativeDialog(this, _T("dialog1"))) + { + dialog.ShowModal(); + } +#else + wxMessageBox(_T("No native dialog support"),_T("Platform limitation")); +#endif } BEGIN_EVENT_TABLE(MyDialog, wxDialog) @@ -107,12 +99,12 @@ BEGIN_EVENT_TABLE(MyDialog, wxDialog) END_EVENT_TABLE() -void MyDialog::OnOk(wxCommandEvent& event) +void MyDialog::OnOk(wxCommandEvent& WXUNUSED(event)) { EndModal(wxID_OK); } -void MyDialog::OnCancel(wxCommandEvent& event) +void MyDialog::OnCancel(wxCommandEvent& WXUNUSED(event)) { EndModal(wxID_CANCEL); }