Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files

Backed out use of @autorelease keyword for now, since it's not suppor…

…ted by older Xcode versions.
  • Loading branch information
slouken committed Feb 12, 2013
1 parent 659da0b commit f7ddc3ca776a08c1b05ca6c3b3587647866dc1b5

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;
}

0 comments on commit f7ddc3c

Please sign in to comment.