From: Vadim Zeitlin Date: Fri, 29 Jul 2005 13:43:55 +0000 (+0000) Subject: added Stop test X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/cb51c9902fa235ddd1152d923ad75d4c208a3233 added Stop test git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@34990 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/samples/sound/sound.cpp b/samples/sound/sound.cpp index 28c65be2f0..e1b9275203 100644 --- a/samples/sound/sound.cpp +++ b/samples/sound/sound.cpp @@ -61,16 +61,18 @@ public: ~MyFrame() { delete m_sound; } // event handlers (these functions should _not_ be virtual) - void OnPlaySync(wxCommandEvent& event); - void OnPlayAsync(wxCommandEvent& event); - void OnPlayAsyncOnStack(wxCommandEvent& event); - void OnPlayLoop(wxCommandEvent& event); - void OnSelectFile(wxCommandEvent& event); #ifdef __WXMSW__ void OnSelectResource(wxCommandEvent& event); #endif // __WXMSW__ void OnQuit(wxCommandEvent& event); + + void OnPlaySync(wxCommandEvent& event); + void OnPlayAsync(wxCommandEvent& event); + void OnPlayAsyncOnStack(wxCommandEvent& event); + void OnPlayLoop(wxCommandEvent& event); + void OnStop(wxCommandEvent& event); + void OnAbout(wxCommandEvent& event); void NotifyUsingFile(const wxString& name); @@ -107,6 +109,7 @@ enum Sound_PlayAsync, Sound_PlayAsyncOnStack, Sound_PlayLoop, + Sound_Stop, Sound_Quit = wxID_EXIT, Sound_About = wxID_ABOUT @@ -130,6 +133,7 @@ BEGIN_EVENT_TABLE(MyFrame, wxFrame) EVT_MENU(Sound_PlayAsync, MyFrame::OnPlayAsync) EVT_MENU(Sound_PlayAsyncOnStack, MyFrame::OnPlayAsyncOnStack) EVT_MENU(Sound_PlayLoop, MyFrame::OnPlayLoop) + EVT_MENU(Sound_Stop, MyFrame::OnStop) END_EVENT_TABLE() // Create a new application object: this macro will allow wxWidgets to create @@ -190,6 +194,8 @@ MyFrame::MyFrame(const wxString& title) playMenu->Append(Sound_PlayAsync, _T("Play sound &asynchronously\tCtrl+A")); playMenu->Append(Sound_PlayAsyncOnStack, _T("Play sound asynchronously (&object on stack)\tCtrl+T")); playMenu->Append(Sound_PlayLoop, _T("&Loop sound\tCtrl+L")); + playMenu->AppendSeparator(); + playMenu->Append(Sound_Stop, _T("&Stop playing\tCtrl-C")); // now append the freshly created menu to the menu bar... wxMenuBar *menuBar = new wxMenuBar(); @@ -321,3 +327,8 @@ void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event)) wxMessageBox(msg, _T("About"), wxOK | wxICON_INFORMATION, this); } + +void MyFrame::OnStop(wxCommandEvent& WXUNUSED(event)) +{ + wxSound::Stop(); +}