]>
git.saurik.com Git - wxWidgets.git/blob - samples/nativdlg/nativdlg.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: samples/nativdlg/nativdlg.cpp
3 // Purpose: Native Windows dialog sample
4 // Author: Julian Smart
8 // Copyright: (c) Julian Smart
9 // Licence: wxWindows license
10 /////////////////////////////////////////////////////////////////////////////
12 // For compilers that support precompilation, includes "wx/wx.h".
13 #include "wx/wxprec.h"
24 #error Sorry, this sample is only appropriate under Windows.
33 bool MyApp::OnInit(void)
35 // Create the main frame window
36 MyFrame
*frame
= new MyFrame(NULL
, wxID_ANY
, _T("wxWidgets Native Dialog Sample"), wxPoint(0, 0), wxSize(300, 250));
39 // Give it a status line
40 frame
->CreateStatusBar(2);
41 #endif // wxUSE_STATUSBAR
44 wxMenu
*file_menu
= new wxMenu
;
46 file_menu
->Append(RESOURCE_TEST1
, _T("&Dialog box test"), _T("Test dialog box resource"));
47 file_menu
->Append(RESOURCE_QUIT
, _T("E&xit"), _T("Quit program"));
49 wxMenuBar
*menu_bar
= new wxMenuBar
;
51 menu_bar
->Append(file_menu
, _T("&File"));
53 // Associate the menu bar with the frame
54 frame
->SetMenuBar(menu_bar
);
57 frame
->panel
= new wxWindow(frame
, wxID_ANY
, wxPoint(0, 0), wxSize(400, 400), 0, _T("MyMainFrame"));
60 // Return the main frame window
66 BEGIN_EVENT_TABLE(MyFrame
, wxFrame
)
67 EVT_MENU(RESOURCE_QUIT
, MyFrame::OnQuit
)
68 EVT_MENU(RESOURCE_TEST1
, MyFrame::OnTest1
)
71 // Define my frame constructor
72 MyFrame::MyFrame(wxWindow
*parent
, const wxWindowID id
, const wxString
& title
, const wxPoint
& pos
, const wxSize
& size
):
73 wxFrame(parent
, id
, title
, pos
, size
)
78 void MyFrame::OnQuit(wxCommandEvent
& WXUNUSED(event
))
83 void MyFrame::OnTest1(wxCommandEvent
& WXUNUSED(event
))
85 #if ( defined(__WXPM__) || defined(__WXMSW__) ) && !defined(__WXUNIVERSAL__)
87 if (dialog
.LoadNativeDialog(this, _T("dialog1")))
92 wxMessageBox(_T("No native dialog support"),_T("Platform limitation"));
96 BEGIN_EVENT_TABLE(MyDialog
, wxDialog
)
97 EVT_BUTTON(wxID_OK
, MyDialog::OnOk
)
98 EVT_BUTTON(wxID_CANCEL
, MyDialog::OnCancel
)
102 void MyDialog::OnOk(wxCommandEvent
& WXUNUSED(event
))
107 void MyDialog::OnCancel(wxCommandEvent
& WXUNUSED(event
))
109 EndModal(wxID_CANCEL
);