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
This commit is contained in:
Vadim Zeitlin 2012-06-17 21:35:06 +00:00
parent 54f59b007e
commit 598fe99d56
13 changed files with 23 additions and 46 deletions

View File

@ -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

View File

@ -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();

View File

@ -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

View File

@ -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. */

View File

@ -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
{

View File

@ -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

View File

@ -41,6 +41,12 @@
// implementation
// ============================================================================
// Emit a beeeeeep
void wxBell()
{
::MessageBeep((UINT)-1); // default sound
}
// ---------------------------------------------------------------------------
// helper functions for showing a "busy" cursor
// ---------------------------------------------------------------------------

View File

@ -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"));

View File

@ -42,6 +42,12 @@
// implementation
// ============================================================================
// Emit a beeeeeep
void wxBell()
{
DosBeep(1000,1000); // 1kHz during 1 sec.
}
// ----------------------------------------------------------------------------
// functions to work with .INI files
// ----------------------------------------------------------------------------

View File

@ -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);

View File

@ -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 {

View File

@ -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
// ----------------------------------------------------------------------------

View File

@ -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
{