X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/1e79049db32b48d5334a89e7cb56f74161ac1d10..f155075229d771430f0793700f5048ad4be00e9d:/samples/nativdlg/nativdlg.cpp?ds=sidebyside diff --git a/samples/nativdlg/nativdlg.cpp b/samples/nativdlg/nativdlg.cpp index 1ab4ea4940..16daebfdd8 100644 --- a/samples/nativdlg/nativdlg.cpp +++ b/samples/nativdlg/nativdlg.cpp @@ -1,18 +1,14 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: nativdlg.cpp +// Name: samples/nativdlg/nativdlg.cpp // Purpose: Native Windows dialog sample // Author: Julian Smart // Modified by: // Created: 04/01/98 // RCS-ID: $Id$ // Copyright: (c) Julian Smart -// Licence: wxWindows license +// Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// -#ifdef __GNUG__ -#pragma implementation -#endif - // For compilers that support precompilation, includes "wx/wx.h". #include "wx/wxprec.h" @@ -28,45 +24,49 @@ #error Sorry, this sample is only appropriate under Windows. #endif +#ifndef wxHAS_IMAGES_IN_RESOURCES + #include "../sample.xpm" +#endif + #include #include "nativdlg.h" #include "resource.h" -IMPLEMENT_APP(MyApp) -// Testing of ressources -MyApp::MyApp() -{ -} + + +IMPLEMENT_APP(MyApp) bool MyApp::OnInit(void) { + if ( !wxApp::OnInit() ) + return false; + // Create the main frame window - MyFrame *frame = new MyFrame(NULL, wxID_ANY, _T("wxWindows Native Dialog Sample"), wxPoint(0, 0), wxSize(300, 250)); + MyFrame *frame = new MyFrame(NULL, wxID_ANY, wxT("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; - file_menu->Append(RESOURCE_TEST1, _T("&Dialog box test"), _T("Test dialog box resource")); - file_menu->Append(RESOURCE_QUIT, _T("E&xit"), _T("Quit program")); + file_menu->Append(RESOURCE_TEST1, wxT("&Dialog box test"), wxT("Test dialog box resource")); + file_menu->Append(RESOURCE_QUIT, wxT("E&xit"), wxT("Quit program")); wxMenuBar *menu_bar = new wxMenuBar; - menu_bar->Append(file_menu, _T("&File")); + menu_bar->Append(file_menu, wxT("&File")); // Associate the menu bar with the frame frame->SetMenuBar(menu_bar); // Make a panel - frame->panel = new wxWindow(frame, wxID_ANY, wxPoint(0, 0), wxSize(400, 400), 0, _T("MyMainFrame")); + frame->panel = new wxWindow(frame, wxID_ANY, wxPoint(0, 0), wxSize(400, 400), 0, wxT("MyMainFrame")); frame->Show(true); - // Return the main frame window - SetTopWindow(frame); - return true; } @@ -79,7 +79,9 @@ END_EVENT_TABLE() MyFrame::MyFrame(wxWindow *parent, const wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size): wxFrame(parent, id, title, pos, size) { - panel = NULL; + SetIcon(wxICON(sample)); + + panel = NULL; } void MyFrame::OnQuit(wxCommandEvent& WXUNUSED(event)) @@ -89,16 +91,14 @@ void MyFrame::OnQuit(wxCommandEvent& WXUNUSED(event)) void MyFrame::OnTest1(wxCommandEvent& WXUNUSED(event)) { -#if ( defined(__WXOS2__) || defined(__WXMSW__) ) && !defined(__WXUNIVERSAL__) - MyDialog *dialog = new MyDialog; - if (dialog->LoadNativeDialog(this, _T("dialog1"))) - { - dialog->SetModal(true); - dialog->ShowModal(); - } - dialog->Close(true); +#if ( defined(__WXPM__) || defined(__WXMSW__) ) && !defined(__WXUNIVERSAL__) + MyDialog dialog; + if (dialog.LoadNativeDialog(this, wxT("dialog1"))) + { + dialog.ShowModal(); + } #else - wxMessageBox(_T("No native dialog support"),_T("Platform limitation")); + wxMessageBox(wxT("No native dialog support"),wxT("Platform limitation")); #endif } @@ -110,12 +110,10 @@ END_EVENT_TABLE() void MyDialog::OnOk(wxCommandEvent& WXUNUSED(event)) { - EndModal(wxID_OK); + EndModal(wxID_OK); } void MyDialog::OnCancel(wxCommandEvent& WXUNUSED(event)) { - EndModal(wxID_CANCEL); + EndModal(wxID_CANCEL); } - -