From dbb7be0fee67849f79c5f3e054462022820b56d6 Mon Sep 17 00:00:00 2001 From: Manolo Gouy Date: Wed, 29 Dec 2010 11:33:42 +0000 Subject: Mac OS X: removed dependency from AudioToolbox.framework by calling NSBeep() from Cocoa. git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@8135 ea41ed52-d2ee-0310-a9c1-e6b18d33e121 --- src/Fl_cocoa.mm | 12 ++++++++++++ src/fl_ask.cxx | 38 +++----------------------------------- 2 files changed, 15 insertions(+), 35 deletions(-) (limited to 'src') diff --git a/src/Fl_cocoa.mm b/src/Fl_cocoa.mm index 2ad315037..fb15cf539 100644 --- a/src/Fl_cocoa.mm +++ b/src/Fl_cocoa.mm @@ -71,6 +71,7 @@ extern "C" { #include #include #include +#include #include #include #include "flstring.h" @@ -3271,6 +3272,17 @@ Window fl_xid(const Fl_Window* w) return Fl_X::i(w)->xid; } +void fl_beep(int type) { + switch (type) { + case FL_BEEP_DEFAULT : + case FL_BEEP_ERROR : + NSBeep(); + break; + default : + break; + } +} + #endif // __APPLE__ // diff --git a/src/fl_ask.cxx b/src/fl_ask.cxx index 20e5bb5c3..5eedc77ab 100644 --- a/src/fl_ask.cxx +++ b/src/fl_ask.cxx @@ -47,12 +47,6 @@ #include #include -#ifdef __APPLE__ -# if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5 -# include -# endif -#endif - static Fl_Window *message_form; static Fl_Box *message; static Fl_Box *icon; @@ -258,7 +252,7 @@ const char* fl_cancel= "Cancel"; ///< string pointer used in common dialogs, you const char* fl_close= "Close"; ///< string pointer used in common dialogs, you can change it to a foreign language // fltk functions: - +#ifndef __APPLE__ // the Mac code is in file Fl_cocoa.mm /** Emits a system beep message. \note \#include @@ -283,34 +277,6 @@ void fl_beep(int type) { MessageBeep(0xFFFFFFFF); break; } -#elif defined(__APPLE__) - switch (type) { - case FL_BEEP_DEFAULT : - case FL_BEEP_ERROR : - // How Apple is not any better than Microsoft: - /* MacOS 8 */ // SysBeep(30); - /* OS X 10.1 */ // AlertSoundPlay(); - /* OS X 10.5 */ // AudioServicesPlayAlertSound(kUserPreferredAlert); - /* OS X 10.6 */ // AudioServicesPlayAlertSound(kSystemSoundID_UserPreferredAlert); -# if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5 - if (AudioServicesPlayAlertSound!=0L) -# if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6 - AudioServicesPlayAlertSound(kSystemSoundID_UserPreferredAlert); -# else - AudioServicesPlayAlertSound(kUserPreferredAlert); -# endif - else -# endif -#if MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_5 - AlertSoundPlay(); -#else - { - } -#endif - break; - default : - break; - } #else switch (type) { case FL_BEEP_DEFAULT : @@ -327,6 +293,8 @@ void fl_beep(int type) { } #endif // WIN32 } +#endif // __APPLE__ + /** Shows an information message dialog box. \note Common dialog boxes are application modal. No more than one common dialog box -- cgit v1.2.3