From 598fe99d56158319f6b5f817c4670748f98bc70a Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sun, 17 Jun 2012 21:35:06 +0000 Subject: [PATCH] Move wxBell() from base to core library. This allows to get rid of ugly preprocessor checks due to the fact that this function could be defined in one or the other library depending on the port used and also fix a problem with it being defined differently in the base library depending on which GUI port (Carbon or Cocoa) was used under OS X. It also fixes the problem with wxBell() in wxGTK under Windows. Closes #14406. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@71797 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/utils.h | 5 ----- interface/wx/utils.h | 2 ++ src/gtk/utilsgtk.cpp | 3 --- src/gtk1/utilsgtk.cpp | 3 --- src/motif/utils.cpp | 3 --- src/msw/utils.cpp | 6 ------ src/msw/utilsgui.cpp | 6 ++++++ src/os2/utils.cpp | 6 ------ src/os2/utilsgui.cpp | 6 ++++++ src/osx/carbon/utils.cpp | 6 +----- src/osx/cocoa/utils.mm | 6 +----- src/osx/iphone/utils.mm | 14 +++++++------- src/x11/utils.cpp | 3 --- 13 files changed, 23 insertions(+), 46 deletions(-) diff --git a/include/wx/utils.h b/include/wx/utils.h index 8ef0cff3b0..c131fbb9ce 100644 --- a/include/wx/utils.h +++ b/include/wx/utils.h @@ -130,12 +130,7 @@ wxDEPRECATED_INLINE(inline bool wxStringEq(const wchar_t *s1, const wchar_t *s2) // ---------------------------------------------------------------------------- // Sound the bell -#if !defined __EMX__ && \ - (defined __WXMOTIF__ || defined __WXGTK__ || defined __WXX11__) WXDLLIMPEXP_CORE void wxBell(); -#else -WXDLLIMPEXP_BASE void wxBell(); -#endif #if wxUSE_MSGDLG // Show wxWidgets information diff --git a/interface/wx/utils.h b/interface/wx/utils.h index 355f4d60cc..a7eae5dfd8 100644 --- a/interface/wx/utils.h +++ b/interface/wx/utils.h @@ -192,6 +192,8 @@ bool wxIsBusy(); @note This function is categorized as a GUI one and so is not thread-safe. @header{wx/utils.h} + + @library{wxcore} */ void wxBell(); diff --git a/src/gtk/utilsgtk.cpp b/src/gtk/utilsgtk.cpp index 30ce5c732e..6293a68ddf 100644 --- a/src/gtk/utilsgtk.cpp +++ b/src/gtk/utilsgtk.cpp @@ -66,14 +66,11 @@ extern GtkWidget *wxGetRootWindow(); //---------------------------------------------------------------------------- // misc. //---------------------------------------------------------------------------- -#ifndef __EMX__ -// on OS/2, we use the wxBell from wxBase library void wxBell() { gdk_beep(); } -#endif // ---------------------------------------------------------------------------- // display characterstics diff --git a/src/gtk1/utilsgtk.cpp b/src/gtk1/utilsgtk.cpp index f49cf64931..86a866c0f6 100644 --- a/src/gtk1/utilsgtk.cpp +++ b/src/gtk1/utilsgtk.cpp @@ -58,14 +58,11 @@ extern GtkWidget *wxGetRootWindow(); //---------------------------------------------------------------------------- // misc. //---------------------------------------------------------------------------- -#ifndef __EMX__ -// on OS/2, we use the wxBell from wxBase library void wxBell() { gdk_beep(); } -#endif /* Don't synthesize KeyUp events holding down a key and producing KeyDown events with autorepeat. */ diff --git a/src/motif/utils.cpp b/src/motif/utils.cpp index 5fd3aeefb8..ec1095d283 100644 --- a/src/motif/utils.cpp +++ b/src/motif/utils.cpp @@ -112,14 +112,11 @@ int wxGUIAppTraits::AddProcessCallback(wxEndProcessData *proc_data, int fd) // ---------------------------------------------------------------------------- // Emit a beeeeeep -#ifndef __EMX__ -// on OS/2, we use the wxBell from wxBase library (src/os2/utils.cpp) void wxBell() { // Use current setting for the bell XBell (wxGlobalDisplay(), 0); } -#endif wxPortId wxGUIAppTraits::GetToolkitVersion(int *verMaj, int *verMin) const { diff --git a/src/msw/utils.cpp b/src/msw/utils.cpp index 292efc5dd1..abab0a651a 100644 --- a/src/msw/utils.cpp +++ b/src/msw/utils.cpp @@ -1076,12 +1076,6 @@ unsigned long wxGetProcessId() return ::GetCurrentProcessId(); } -// Emit a beeeeeep -void wxBell() -{ - ::MessageBeep((UINT)-1); // default sound -} - bool wxIsDebuggerRunning() { #if wxUSE_DYNLIB_CLASS diff --git a/src/msw/utilsgui.cpp b/src/msw/utilsgui.cpp index c18e1eaf59..b2cce08f54 100644 --- a/src/msw/utilsgui.cpp +++ b/src/msw/utilsgui.cpp @@ -41,6 +41,12 @@ // implementation // ============================================================================ +// Emit a beeeeeep +void wxBell() +{ + ::MessageBeep((UINT)-1); // default sound +} + // --------------------------------------------------------------------------- // helper functions for showing a "busy" cursor // --------------------------------------------------------------------------- diff --git a/src/os2/utils.cpp b/src/os2/utils.cpp index adf5aab3da..66af86b3e8 100644 --- a/src/os2/utils.cpp +++ b/src/os2/utils.cpp @@ -306,12 +306,6 @@ void wxFlushEvents() // wxYield(); } -// Emit a beeeeeep -void wxBell() -{ - DosBeep(1000,1000); // 1kHz during 1 sec. -} - wxString wxGetOsDescription() { wxString strVer(wxT("OS/2")); diff --git a/src/os2/utilsgui.cpp b/src/os2/utilsgui.cpp index eca34900b8..12aec216ba 100644 --- a/src/os2/utilsgui.cpp +++ b/src/os2/utilsgui.cpp @@ -42,6 +42,12 @@ // implementation // ============================================================================ +// Emit a beeeeeep +void wxBell() +{ + DosBeep(1000,1000); // 1kHz during 1 sec. +} + // ---------------------------------------------------------------------------- // functions to work with .INI files // ---------------------------------------------------------------------------- diff --git a/src/osx/carbon/utils.cpp b/src/osx/carbon/utils.cpp index f70317895f..2d2b5ccdf9 100644 --- a/src/osx/carbon/utils.cpp +++ b/src/osx/carbon/utils.cpp @@ -45,7 +45,7 @@ #include "wx/evtloop.h" -#if wxUSE_BASE +#if wxUSE_GUI // Emit a beeeeeep void wxBell() @@ -63,10 +63,6 @@ void wxBell() #endif } -#endif // wxUSE_BASE - -#if wxUSE_GUI - wxTimerImpl* wxGUIAppTraits::CreateTimerImpl(wxTimer *timer) { return new wxOSXTimerImpl(timer); diff --git a/src/osx/cocoa/utils.mm b/src/osx/cocoa/utils.mm index 4a4c1e0c33..c2c8369940 100644 --- a/src/osx/cocoa/utils.mm +++ b/src/osx/cocoa/utils.mm @@ -37,7 +37,7 @@ #if wxOSX_USE_COCOA -#if wxUSE_BASE +#if wxUSE_GUI // Emit a beeeeeep void wxBell() @@ -45,10 +45,6 @@ void wxBell() NSBeep(); } -#endif // wxUSE_BASE - -#if wxUSE_GUI - @implementation wxNSAppController - (void)applicationWillFinishLaunching:(NSNotification *)application { diff --git a/src/osx/iphone/utils.mm b/src/osx/iphone/utils.mm index f453992216..cd21d51fb9 100644 --- a/src/osx/iphone/utils.mm +++ b/src/osx/iphone/utils.mm @@ -39,13 +39,6 @@ #if 1 // wxUSE_BASE -// Emit a beeeeeep -void wxBell() -{ - // would be kSystemSoundID_UserPreferredAlert but since the headers aren't correct, add it manually - AudioServicesPlayAlertSound(0x00001000 ); -} - // ---------------------------------------------------------------------------- // Common Event Support // ---------------------------------------------------------------------------- @@ -91,6 +84,13 @@ void wxApp::DoCleanUp() #if wxUSE_GUI +// Emit a beeeeeep +void wxBell() +{ + // would be kSystemSoundID_UserPreferredAlert but since the headers aren't correct, add it manually + AudioServicesPlayAlertSound(0x00001000 ); +} + // ---------------------------------------------------------------------------- // Launch default browser // ---------------------------------------------------------------------------- diff --git a/src/x11/utils.cpp b/src/x11/utils.cpp index c32f5c62c9..688756efef 100644 --- a/src/x11/utils.cpp +++ b/src/x11/utils.cpp @@ -94,14 +94,11 @@ bool wxCheckForInterrupt(wxWindow *WXUNUSED(wnd)) // ---------------------------------------------------------------------------- // Emit a beeeeeep -#ifndef __EMX__ -// on OS/2, we use the wxBell from wxBase library (src/os2/utils.cpp) void wxBell() { // Use current setting for the bell XBell ((Display*) wxGetDisplay(), 0); } -#endif wxPortId wxGUIAppTraits::GetToolkitVersion(int *verMaj, int *verMin) const { -- 2.45.2