]> git.saurik.com Git - wxWidgets.git/commitdiff
renamed wxWave to wxSound
authorVáclav Slavík <vslavik@fastmail.fm>
Sun, 1 Feb 2004 18:27:25 +0000 (18:27 +0000)
committerVáclav Slavík <vslavik@fastmail.fm>
Sun, 1 Feb 2004 18:27:25 +0000 (18:27 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@25456 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

include/wx/sound.h [new file with mode: 0644]
include/wx/wave.h

diff --git a/include/wx/sound.h b/include/wx/sound.h
new file mode 100644 (file)
index 0000000..c96dc74
--- /dev/null
@@ -0,0 +1,82 @@
+/////////////////////////////////////////////////////////////////////////////
+// Name:        wx/sound.h
+// Purpose:     wxSoundBase class
+// Author:      Vaclav Slavik
+// Modified by:
+// Created:     2004/02/01
+// RCS-ID:      $Id$
+// Copyright:   (c) 2004, Vaclav Slavik
+// Licence:    wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_SOUND_H_BASE_
+#define _WX_SOUND_H_BASE_
+
+#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
+#pragma interface "soundbase.h"
+#endif
+
+#include "wx/object.h"
+
+// ----------------------------------------------------------------------------
+// wxSoundBase: common wxSound code and interface
+// ----------------------------------------------------------------------------
+
+// Flags for wxSound::Play
+enum wxSoundFlags
+{
+    wxSOUND_SYNC   = 0,
+    wxSOUND_ASYNC  = 1,
+    wxSOUND_LOOP   = 2 | wxSOUND_ASYNC
+};
+
+class wxSoundBase : public wxObject
+{
+public:
+    // Play the sound:
+    bool Play(unsigned flags = wxSOUND_ASYNC)
+    {
+        return DoPlay(flags);
+    }
+#if WXWIN_COMPATIBILITY_2_4
+    wxDEPRECATED( bool Play(bool async = true, bool looped = false) );
+#endif
+
+protected:
+    virtual bool DoPlay(unsigned flags) = 0;
+};
+    
+#if WXWIN_COMPATIBILITY_2_4
+inline bool wxSoundBase::Play(bool async, bool looped)
+{
+    unsigned flags = 0;
+    if (async) flags |= wxSOUND_ASYNC;
+    if (looped) flags |= wxSOUND_LOOP;
+    return DoPlay(flags);
+}
+#endif
+
+// ----------------------------------------------------------------------------
+// wxSound class implementation
+// ----------------------------------------------------------------------------
+
+#if defined(__WXMSW__)
+#include "wx/msw/wave.h"
+#elif defined(__UNIX__)
+#include "wx/unix/sound.h"
+#elif defined(__WXMAC__)
+#include "wx/mac/wave.h"
+#elif defined(__WXPM__)
+#include "wx/os2/wave.h"
+#endif
+
+// wxSound used to be called wxWave before wxWindows 2.5.1:
+#ifdef __UNIX__ // FIXME: on all platforms when everything is renamed
+    #if WXWIN_COMPATIBILITY_2_4
+        typedef wxSound wxWave;
+    #endif
+#else
+    typedef wxWave wxSound;
+#endif
+
+#endif // _WX_SOUND_H_BASE_
index d766cc341ed02a0c25249628e30d176ee717f4ba..582841f7e952ee16b0971b296e01676b0e8992d8 100644 (file)
@@ -1,19 +1,24 @@
+/////////////////////////////////////////////////////////////////////////////
+// Name:        wx/wave.h
+// Purpose:     wxSound compatibility header
+// Author:      Vaclav Slavik
+// Modified by:
+// Created:     2004/02/01
+// RCS-ID:      $Id$
+// Copyright:   (c) 2004, Vaclav Slavik
+// Licence:    wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
 #ifndef _WX_WAVE_H_BASE_
 #define _WX_WAVE_H_BASE_
 
-#if defined(__WXMSW__)
-#include "wx/msw/wave.h"
-#elif defined(__WXGTK__)
-#include "wx/unix/wave.h"
-#elif defined(__WXX11__)
-#include "wx/unix/wave.h"
-#elif defined(__WXMOTIF__)
-#include "wx/unix/wave.h"
-#elif defined(__WXMAC__)
-#include "wx/mac/wave.h"
-#elif defined(__WXPM__)
-#include "wx/os2/wave.h"
+#include "wx/setup.h"
+
+#if WXWIN_COMPATIBILITY_2_4
+    #warning "wx/wave.h header is deprecated, use wx/sound.h and wxSound"
+    #include "wx/sound.h"
+#else
+    #error "wx/wave.h is only available in compatibility mode"
 #endif
 
 #endif
-    // _WX_TREECTRL_H_BASE_