X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/116a877a9c6127d05150e482b21905766fb198b9..e38bacf8840985709905e3c9672fe13377c030cd:/samples/dynamic/dynamic.cpp diff --git a/samples/dynamic/dynamic.cpp b/samples/dynamic/dynamic.cpp index 5e66beef8e..f94ca57e44 100644 --- a/samples/dynamic/dynamic.cpp +++ b/samples/dynamic/dynamic.cpp @@ -10,8 +10,8 @@ ///////////////////////////////////////////////////////////////////////////// #if defined(__GNUG__) && !defined(__APPLE__) -#pragma implementation "dynamic.cpp" -#pragma interface "dynamic.cpp" +#pragma implementation +#pragma interface #endif // For compilers that support precompilation, includes "wx/wx.h". @@ -46,9 +46,9 @@ class MyFrame: public wxFrame }; // ID for the menu commands -#define DYNAMIC_QUIT 1 +#define DYNAMIC_QUIT wxID_EXIT #define DYNAMIC_TEXT 101 -#define DYNAMIC_ABOUT 102 +#define DYNAMIC_ABOUT wxID_ABOUT // Create a new application object IMPLEMENT_APP (MyApp) @@ -59,12 +59,11 @@ bool MyApp::OnInit(void) // Create the main frame window MyFrame *frame = new MyFrame(NULL, _T("Dynamic wxWidgets App"), 50, 50, 450, 340); - frame->Connect( DYNAMIC_QUIT, wxID_ANY, wxEVT_COMMAND_MENU_SELECTED, - (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) - &MyFrame::OnQuit ); - frame->Connect( DYNAMIC_ABOUT, wxID_ANY, wxEVT_COMMAND_MENU_SELECTED, - (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) - &MyFrame::OnAbout ); + // You used to have to do some casting for param 4, but now there are type-safe handlers + frame->Connect( DYNAMIC_QUIT, wxID_ANY, + wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(MyFrame::OnQuit) ); + frame->Connect( DYNAMIC_ABOUT, wxID_ANY, + wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(MyFrame::OnAbout) ); // Give it an icon #ifdef __WXMSW__