added Stop test
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@34990 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -61,16 +61,18 @@ public:
|
|||||||
~MyFrame() { delete m_sound; }
|
~MyFrame() { delete m_sound; }
|
||||||
|
|
||||||
// event handlers (these functions should _not_ be virtual)
|
// 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);
|
void OnSelectFile(wxCommandEvent& event);
|
||||||
#ifdef __WXMSW__
|
#ifdef __WXMSW__
|
||||||
void OnSelectResource(wxCommandEvent& event);
|
void OnSelectResource(wxCommandEvent& event);
|
||||||
#endif // __WXMSW__
|
#endif // __WXMSW__
|
||||||
void OnQuit(wxCommandEvent& event);
|
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 OnAbout(wxCommandEvent& event);
|
||||||
|
|
||||||
void NotifyUsingFile(const wxString& name);
|
void NotifyUsingFile(const wxString& name);
|
||||||
@@ -107,6 +109,7 @@ enum
|
|||||||
Sound_PlayAsync,
|
Sound_PlayAsync,
|
||||||
Sound_PlayAsyncOnStack,
|
Sound_PlayAsyncOnStack,
|
||||||
Sound_PlayLoop,
|
Sound_PlayLoop,
|
||||||
|
Sound_Stop,
|
||||||
|
|
||||||
Sound_Quit = wxID_EXIT,
|
Sound_Quit = wxID_EXIT,
|
||||||
Sound_About = wxID_ABOUT
|
Sound_About = wxID_ABOUT
|
||||||
@@ -130,6 +133,7 @@ BEGIN_EVENT_TABLE(MyFrame, wxFrame)
|
|||||||
EVT_MENU(Sound_PlayAsync, MyFrame::OnPlayAsync)
|
EVT_MENU(Sound_PlayAsync, MyFrame::OnPlayAsync)
|
||||||
EVT_MENU(Sound_PlayAsyncOnStack, MyFrame::OnPlayAsyncOnStack)
|
EVT_MENU(Sound_PlayAsyncOnStack, MyFrame::OnPlayAsyncOnStack)
|
||||||
EVT_MENU(Sound_PlayLoop, MyFrame::OnPlayLoop)
|
EVT_MENU(Sound_PlayLoop, MyFrame::OnPlayLoop)
|
||||||
|
EVT_MENU(Sound_Stop, MyFrame::OnStop)
|
||||||
END_EVENT_TABLE()
|
END_EVENT_TABLE()
|
||||||
|
|
||||||
// Create a new application object: this macro will allow wxWidgets to create
|
// 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_PlayAsync, _T("Play sound &asynchronously\tCtrl+A"));
|
||||||
playMenu->Append(Sound_PlayAsyncOnStack, _T("Play sound asynchronously (&object on stack)\tCtrl+T"));
|
playMenu->Append(Sound_PlayAsyncOnStack, _T("Play sound asynchronously (&object on stack)\tCtrl+T"));
|
||||||
playMenu->Append(Sound_PlayLoop, _T("&Loop sound\tCtrl+L"));
|
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...
|
// now append the freshly created menu to the menu bar...
|
||||||
wxMenuBar *menuBar = new wxMenuBar();
|
wxMenuBar *menuBar = new wxMenuBar();
|
||||||
@@ -321,3 +327,8 @@ void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event))
|
|||||||
|
|
||||||
wxMessageBox(msg, _T("About"), wxOK | wxICON_INFORMATION, this);
|
wxMessageBox(msg, _T("About"), wxOK | wxICON_INFORMATION, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MyFrame::OnStop(wxCommandEvent& WXUNUSED(event))
|
||||||
|
{
|
||||||
|
wxSound::Stop();
|
||||||
|
}
|
||||||
|
Reference in New Issue
Block a user