Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Backed out use of @autorelease keyword for now, since it's not suppor…
…ted by older Xcode versions.
- Loading branch information
File 5 of 11 in
f7ddc3c
|
@@ -39,38 +39,40 @@ |
|
|
{ |
|
|
Cocoa_RegisterApp(); |
|
|
|
|
|
@autoreleasepool { |
|
|
NSAlert* alert = [[NSAlert alloc] init]; |
|
|
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; |
|
|
|
|
|
if (messageboxdata->flags & SDL_MESSAGEBOX_ERROR) { |
|
|
[alert setAlertStyle:NSCriticalAlertStyle]; |
|
|
} else if (messageboxdata->flags & SDL_MESSAGEBOX_WARNING) { |
|
|
[alert setAlertStyle:NSWarningAlertStyle]; |
|
|
NSAlert* alert = [[NSAlert alloc] init]; |
|
|
|
|
|
if (messageboxdata->flags & SDL_MESSAGEBOX_ERROR) { |
|
|
[alert setAlertStyle:NSCriticalAlertStyle]; |
|
|
} else if (messageboxdata->flags & SDL_MESSAGEBOX_WARNING) { |
|
|
[alert setAlertStyle:NSWarningAlertStyle]; |
|
|
} else { |
|
|
[alert setAlertStyle:NSInformationalAlertStyle]; |
|
|
} |
|
|
|
|
|
[alert setMessageText:[NSString stringWithUTF8String:messageboxdata->title]]; |
|
|
[alert setInformativeText:[NSString stringWithUTF8String:messageboxdata->message]]; |
|
|
|
|
|
const SDL_MessageBoxButtonData *buttons = messageboxdata->buttons; |
|
|
int i; |
|
|
for (i = 0; i < messageboxdata->numbuttons; ++i) { |
|
|
NSButton *button = [alert addButtonWithTitle:[NSString stringWithUTF8String:buttons[i].text]]; |
|
|
if (buttons[i].flags & SDL_MESSAGEBOX_BUTTON_RETURNKEY_DEFAULT) { |
|
|
[button setKeyEquivalent:@"\r"]; |
|
|
} else if (buttons[i].flags & SDL_MESSAGEBOX_BUTTON_ESCAPEKEY_DEFAULT) { |
|
|
[button setKeyEquivalent:@"\033"]; |
|
|
} else { |
|
|
[alert setAlertStyle:NSInformationalAlertStyle]; |
|
|
[button setKeyEquivalent:@""]; |
|
|
} |
|
|
} |
|
|
|
|
|
[alert setMessageText:[NSString stringWithUTF8String:messageboxdata->title]]; |
|
|
[alert setInformativeText:[NSString stringWithUTF8String:messageboxdata->message]]; |
|
|
|
|
|
const SDL_MessageBoxButtonData *buttons = messageboxdata->buttons; |
|
|
int i; |
|
|
for (i = 0; i < messageboxdata->numbuttons; ++i) { |
|
|
NSButton *button = [alert addButtonWithTitle:[NSString stringWithUTF8String:buttons[i].text]]; |
|
|
if (buttons[i].flags & SDL_MESSAGEBOX_BUTTON_RETURNKEY_DEFAULT) { |
|
|
[button setKeyEquivalent:@"\r"]; |
|
|
} else if (buttons[i].flags & SDL_MESSAGEBOX_BUTTON_ESCAPEKEY_DEFAULT) { |
|
|
[button setKeyEquivalent:@"\033"]; |
|
|
} else { |
|
|
[button setKeyEquivalent:@""]; |
|
|
} |
|
|
} |
|
|
NSInteger clicked = [alert runModal]; |
|
|
clicked -= NSAlertFirstButtonReturn; |
|
|
*buttonid = buttons[clicked].buttonid; |
|
|
[alert release]; |
|
|
|
|
|
NSInteger clicked = [alert runModal]; |
|
|
clicked -= NSAlertFirstButtonReturn; |
|
|
*buttonid = buttons[clicked].buttonid; |
|
|
[alert release]; |
|
|
} |
|
|
[pool release]; |
|
|
|
|
|
return 0; |
|
|
} |
|
|
Oops, something went wrong.