Move apple_display_alert implementation to UI driver

This commit is contained in:
Twinaphex 2015-04-20 18:10:15 +02:00
parent a3e4eff02a
commit 09fe3e9176
3 changed files with 24 additions and 23 deletions

View File

@ -18,29 +18,6 @@
#include <sys/stat.h>
#include "cocoa_common.h"
void apple_display_alert(const char *message, const char *title)
{
#if defined(HAVE_COCOATOUCH)
UIAlertView* alert = [[UIAlertView alloc] initWithTitle:BOXSTRING(title)
message:BOXSTRING(message)
delegate:nil
cancelButtonTitle:BOXSTRING("OK")
otherButtonTitles:nil];
[alert show];
#else
NSAlert* alert = [[NSAlert new] autorelease];
[alert setMessageText:(*title) ? BOXSTRING(title) : BOXSTRING("RetroArch")];
[alert setInformativeText:BOXSTRING(message)];
[alert setAlertStyle:NSInformationalAlertStyle];
[alert beginSheetModalForWindow:[RetroArch_OSX get].window
modalDelegate:apple_platform
didEndSelector:@selector(alertDidEnd:returnCode:contextInfo:)
contextInfo:nil];
[[NSApplication sharedApplication] runModalForWindow:[alert window]];
#endif
}
// Number formatter class for setting strings
@implementation RANumberFormatter
- (id)initWithSetting:(const rarch_setting_t*)setting

View File

@ -411,6 +411,20 @@ int main(int argc, char *argv[])
return NSApplicationMain(argc, (const char **) argv);
}
void apple_display_alert(const char *message, const char *title)
{
NSAlert* alert = [[NSAlert new] autorelease];
[alert setMessageText:(*title) ? BOXSTRING(title) : BOXSTRING("RetroArch")];
[alert setInformativeText:BOXSTRING(message)];
[alert setAlertStyle:NSInformationalAlertStyle];
[alert beginSheetModalForWindow:[RetroArch_OSX get].window
modalDelegate:apple_platform
didEndSelector:@selector(alertDidEnd:returnCode:contextInfo:)
contextInfo:nil];
[[NSApplication sharedApplication] runModalForWindow:[alert window]];
}
typedef struct ui_companion_cocoa
{
void *empty;

View File

@ -461,6 +461,16 @@ int main(int argc, char *argv[])
}
}
void apple_display_alert(const char *message, const char *title)
{
UIAlertView* alert = [[UIAlertView alloc] initWithTitle:BOXSTRING(title)
message:BOXSTRING(message)
delegate:nil
cancelButtonTitle:BOXSTRING("OK")
otherButtonTitles:nil];
[alert show];
}
typedef struct ui_companion_cocoatouch
{
void *empty;