diff options
author | Michael Lutz <michi@icosahedron.de> | 2018-01-28 23:54:51 +0100 |
---|---|---|
committer | Michael Lutz <michi@icosahedron.de> | 2018-04-10 23:30:01 +0200 |
commit | 964d310cdadf2133bc1bb0682c46b9c72a8dbd90 (patch) | |
tree | a47fc2790ccaa144e2c59d826873ab272071fca9 /src/video/cocoa | |
parent | f670277ff5ecd9843f379551265ce2ead05134f2 (diff) | |
download | openttd-964d310cdadf2133bc1bb0682c46b9c72a8dbd90.tar.xz |
Codechange: [OSX] Use non-deprecated API for displaying an alert where supported.
Diffstat (limited to 'src/video/cocoa')
-rw-r--r-- | src/video/cocoa/cocoa_v.mm | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/src/video/cocoa/cocoa_v.mm b/src/video/cocoa/cocoa_v.mm index 0616ddb5d..8922d3289 100644 --- a/src/video/cocoa/cocoa_v.mm +++ b/src/video/cocoa/cocoa_v.mm @@ -609,7 +609,22 @@ void CocoaDialog(const char *title, const char *message, const char *buttonLabel return; } - NSRunAlertPanel([ NSString stringWithUTF8String:title ], [ NSString stringWithUTF8String:message ], [ NSString stringWithUTF8String:buttonLabel ], nil, nil); +#if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_3) + if (MacOSVersionIsAtLeast(10, 3, 0)) { + NSAlert *alert = [ [ NSAlert alloc ] init ]; + [ alert setAlertStyle: NSCriticalAlertStyle ]; + [ alert setMessageText:[ NSString stringWithUTF8String:title ] ]; + [ alert setInformativeText:[ NSString stringWithUTF8String:message ] ]; + [ alert addButtonWithTitle: [ NSString stringWithUTF8String:buttonLabel ] ]; + [ alert runModal ]; + [ alert release ]; + } else +#endif + { +#if (MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_3) + NSRunAlertPanel([ NSString stringWithUTF8String:title ], [ NSString stringWithUTF8String:message ], [ NSString stringWithUTF8String:buttonLabel ], nil, nil); +#endif + } if (!wasstarted && VideoDriver::GetInstance() != NULL) VideoDriver::GetInstance()->Stop(); |