diff --git a/SConstruct b/SConstruct index 915f4fc76..0067bc7e9 100644 --- a/SConstruct +++ b/SConstruct @@ -1138,7 +1138,7 @@ class DXXCommon(LazyObjectConstructor): def adjust_environment(self,program,env): env.Append(CPPDEFINES = ['HAVE_STRUCT_TIMESPEC', 'HAVE_STRUCT_TIMEVAL', '__unix__']) env.Append(CPPPATH = [os.path.join(os.getenv("HOME"), 'Library/Frameworks/SDL.framework/Headers'), '/Library/Frameworks/SDL.framework/Headers']) - env.Append(FRAMEWORKS = ['ApplicationServices', 'Carbon', 'Cocoa', 'SDL']) + env.Append(FRAMEWORKS = ['ApplicationServices', 'Cocoa', 'SDL']) if (self.user_settings.opengl == 1) or (self.user_settings.opengles == 1): env.Append(FRAMEWORKS = ['OpenGL']) env.Append(FRAMEWORKPATH = [os.path.join(os.getenv("HOME"), 'Library/Frameworks'), '/System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks']) @@ -1463,7 +1463,7 @@ class DXXArchive(DXXCommon): pass class DarwinPlatformSettings(LazyObjectConstructor, DXXCommon.DarwinPlatformSettings, _PlatformSettings): platform_objects = LazyObjectConstructor.create_lazy_object_property([ - 'common/arch/carbon/messagebox.cpp', + 'common/arch/cocoa/messagebox.mm', 'common/arch/cocoa/SDLMain.m' ]) diff --git a/common/arch/cocoa/messagebox.mm b/common/arch/cocoa/messagebox.mm new file mode 100644 index 000000000..f1860c417 --- /dev/null +++ b/common/arch/cocoa/messagebox.mm @@ -0,0 +1,42 @@ +/* + * This file is part of the DXX-Rebirth project . + * It is copyright by its individual contributors, as recorded in the + * project's Git history. See COPYING.txt at the top level for license + * terms and a link to the Git history. + */ +/* + * messagebox.mm + * d1x-rebirth + * + * Display an error or warning messagebox using the OS's window server. + * + */ + +#import + +#include "window.h" +#include "event.h" +#include "messagebox.h" + +void display_cocoa_alert(const char *message, int error) +{ + NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; + NSAlert *alert = [[NSAlert alloc] init]; + alert.alertStyle = error == 1 ? NSCriticalAlertStyle : NSWarningAlertStyle; + alert.messageText = error ? @"Sorry, a critical error has occurred." : @"Attention!"; + alert.informativeText = [NSString stringWithUTF8String:message]; + + [alert runModal]; + [alert release]; + [pool drain]; +} + +void msgbox_warning(const char *message) +{ + display_cocoa_alert(message, 0); +} + +void msgbox_error(const char *message) +{ + display_cocoa_alert(message, 1); +}