]> git.saurik.com Git - wxWidgets.git/blobdiff - samples/sound/sound.cpp
Remove wxT from prototype
[wxWidgets.git] / samples / sound / sound.cpp
index c82d84be909dc5aad35d32c9ecea9126c1eb24de..8d450699be756aff508a16658405f50b48931cae 100644 (file)
 // ----------------------------------------------------------------------------
 
 // the application icon (under Windows and OS/2 it is in resources)
-#if defined(__WXGTK__) || defined(__WXMOTIF__) || defined(__WXMAC__) || defined(__WXMGL__) || defined(__WXX11__)
+#ifndef wxHAS_IMAGES_IN_RESOURCES
     #include "../sample.xpm"
 #endif
 
-#define WAV_FILE _T("doggrowl.wav")
+#define WAV_FILE wxT("doggrowl.wav")
 
 // ----------------------------------------------------------------------------
 // private classes
@@ -166,7 +166,7 @@ bool MyApp::OnInit()
         return false;
 
     // create the main application window
-    MyFrame *frame = new MyFrame(_T("wxWidgets Sound Sample"));
+    MyFrame *frame = new MyFrame(wxT("wxWidgets Sound Sample"));
 
     // and show it (the frames, unlike simple controls, are not shown when
     // created initially)
@@ -194,32 +194,32 @@ MyFrame::MyFrame(const wxString& title)
     SetIcon(wxICON(sample));
 
     wxMenu *menuFile = new wxMenu;
-    menuFile->Append(Sound_SelectFile, _T("Select WAV &file...\tCtrl-O"), _T("Select a new wav file to play"));
+    menuFile->Append(Sound_SelectFile, wxT("Select WAV &file...\tCtrl-O"), wxT("Select a new wav file to play"));
 #ifdef __WXMSW__
-    menuFile->Append(Sound_SelectResource, _T("Select WAV &resource...\tCtrl-R"), _T("Select a new resource to play"));
-    menuFile->Append(Sound_SelectMemory, _T("Select WAV &data\tCtrl-M"), _T("Choose to play from memory buffer"));
+    menuFile->Append(Sound_SelectResource, wxT("Select WAV &resource...\tCtrl-R"), wxT("Select a new resource to play"));
+    menuFile->Append(Sound_SelectMemory, wxT("Select WAV &data\tCtrl-M"), wxT("Choose to play from memory buffer"));
 #endif // __WXMSW__
 
-    menuFile->Append(Sound_Quit, _T("E&xit\tAlt-X"), _T("Quit this program"));
+    menuFile->Append(Sound_Quit, wxT("E&xit\tAlt-X"), wxT("Quit this program"));
 
     wxMenu *playMenu = new wxMenu;
-    playMenu->Append(Sound_PlaySync, _T("Play sound &synchronously\tCtrl-S"));
-    playMenu->Append(Sound_PlayAsync, _T("Play sound &asynchronously\tCtrl-A"));
-    playMenu->Append(Sound_PlayAsyncOnStack, _T("Play sound asynchronously (&object on stack)\tCtrl-K"));
-    playMenu->Append(Sound_PlayLoop, _T("&Loop sound\tCtrl-L"));
+    playMenu->Append(Sound_PlaySync, wxT("Play sound &synchronously\tCtrl-S"));
+    playMenu->Append(Sound_PlayAsync, wxT("Play sound &asynchronously\tCtrl-A"));
+    playMenu->Append(Sound_PlayAsyncOnStack, wxT("Play sound asynchronously (&object on stack)\tCtrl-K"));
+    playMenu->Append(Sound_PlayLoop, wxT("&Loop sound\tCtrl-L"));
     playMenu->AppendSeparator();
-    playMenu->Append(Sound_Stop, _T("&Stop playing\tCtrl-T"));
+    playMenu->Append(Sound_Stop, wxT("&Stop playing\tCtrl-T"));
     playMenu->AppendSeparator();
-    playMenu->Append(Sound_PlayBell, _T("Play system bell"));
+    playMenu->Append(Sound_PlayBell, wxT("Play system bell"));
 
     wxMenu *helpMenu = new wxMenu;
-    helpMenu->Append(Sound_About, _T("&About...\tF1"), _T("Show about dialog"));
+    helpMenu->Append(Sound_About, wxT("&About\tF1"), wxT("Show about dialog"));
 
     // now append the freshly created menu to the menu bar...
     wxMenuBar *menuBar = new wxMenuBar();
-    menuBar->Append(menuFile, _T("&File"));
-    menuBar->Append(playMenu, _T("&Play"));
-    menuBar->Append(helpMenu, _T("&Help"));
+    menuBar->Append(menuFile, wxT("&File"));
+    menuBar->Append(playMenu, wxT("&Play"));
+    menuBar->Append(helpMenu, wxT("&Help"));
 
     // ... and attach this menu bar to the frame
     SetMenuBar(menuBar);
@@ -980,7 +980,7 @@ bool MyFrame::CreateSound(wxSound& snd) const
 void MyFrame::NotifyUsingFile(const wxString& name)
 {
     wxString msg;
-    msg << _T("Using sound file: ") << name << _T("\n");
+    msg << wxT("Using sound file: ") << name << wxT("\n");
     m_tc->AppendText(msg);
 }
 
@@ -991,9 +991,15 @@ void MyFrame::NotifyUsingFile(const wxString& name)
 void MyFrame::OnSelectFile(wxCommandEvent& WXUNUSED(event))
 {
 #if wxUSE_FILEDLG
-    wxFileDialog dlg(this, _T("Choose a sound file"),
+    wxFileDialog dlg(this, wxT("Choose a sound file"),
                      wxEmptyString, wxEmptyString,
-                     _T("WAV files (*.wav)|*.wav"), wxFD_OPEN|wxFD_CHANGE_DIR);
+                     wxString::Format
+                     (
+                         "WAV files (*.wav)|*.wav|All files (%s)|%s",
+                         wxFileSelectorDefaultWildcardStr,
+                         wxFileSelectorDefaultWildcardStr
+                     ),
+                     wxFD_OPEN|wxFD_CHANGE_DIR);
     if ( dlg.ShowModal() == wxID_OK )
     {
         m_soundFile = dlg.GetPath();
@@ -1002,8 +1008,7 @@ void MyFrame::OnSelectFile(wxCommandEvent& WXUNUSED(event))
 #endif // __WXMSW__
         m_useMemory = false;
 
-        delete m_sound;
-        m_sound = NULL;
+        wxDELETE(m_sound);
         NotifyUsingFile(m_soundFile);
     }
 #endif // wxUSE_FILEDLG
@@ -1015,9 +1020,9 @@ void MyFrame::OnSelectResource(wxCommandEvent& WXUNUSED(event))
 {
     m_soundRes = wxGetTextFromUser
                  (
-                    _T("Enter resource name:"),
-                    _T("wxWidgets Sound Sample"),
-                    _T("FromResource"),
+                    wxT("Enter resource name:"),
+                    wxT("wxWidgets Sound Sample"),
+                    wxT("FromResource"),
                     this
                  );
     if ( m_soundRes.empty() )
@@ -1026,10 +1031,9 @@ void MyFrame::OnSelectResource(wxCommandEvent& WXUNUSED(event))
     m_soundFile.clear();
     m_useMemory = false;
 
-    delete m_sound;
-    m_sound = NULL;
+    wxDELETE(m_sound);
 
-    NotifyUsingFile(_T("Windows WAV resource"));
+    NotifyUsingFile(wxT("Windows WAV resource"));
 }
 
 #endif // __WXMSW__
@@ -1038,7 +1042,7 @@ void MyFrame::OnSelectMemory(wxCommandEvent& WXUNUSED(event))
 {
     m_useMemory = true;
 
-    NotifyUsingFile(_T("embedded sound fragment"));
+    NotifyUsingFile(wxT("embedded sound fragment"));
 }
 
 void MyFrame::OnQuit(wxCommandEvent& WXUNUSED(event))
@@ -1103,10 +1107,10 @@ void MyFrame::OnPlayBell(wxCommandEvent& WXUNUSED(event))
 void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event))
 {
     wxString msg;
-    msg.Printf( _T("This is the About dialog of the sound sample.\n")
-                _T("Welcome to %s"), wxVERSION_STRING);
+    msg.Printf( wxT("This is the About dialog of the sound sample.\n")
+                wxT("Welcome to %s"), wxVERSION_STRING);
 
-    wxMessageBox(msg, _T("About"), wxOK | wxICON_INFORMATION, this);
+    wxMessageBox(msg, wxT("About"), wxOK | wxICON_INFORMATION, this);
 }
 
 void MyFrame::OnStop(wxCommandEvent& WXUNUSED(event))