summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorManolo Gouy <Manolo>2010-12-29 11:33:42 +0000
committerManolo Gouy <Manolo>2010-12-29 11:33:42 +0000
commitdbb7be0fee67849f79c5f3e054462022820b56d6 (patch)
tree9b1eb79ad678d8c10129e7ecb1eb09128fb158d0 /src
parentd3d16a354ea61e9c893193e4ad17acc4316e5ac9 (diff)
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
Diffstat (limited to 'src')
-rw-r--r--src/Fl_cocoa.mm12
-rw-r--r--src/fl_ask.cxx38
2 files changed, 15 insertions, 35 deletions
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 <FL/Fl_Printer.H>
#include <FL/Fl_Input_.H>
#include <FL/Fl_Text_Display.H>
+#include <FL/fl_ask.H>
#include <stdio.h>
#include <stdlib.h>
#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 <FL/x.H>
#include <FL/fl_draw.H>
-#ifdef __APPLE__
-# if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5
-# include <AudioToolbox/AudioServices.h>
-# 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 <FL/fl_ask.H>
@@ -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