Use a different api for this.
This commit is contained in:
@@ -1,61 +1,52 @@
|
|||||||
#include "global.h"
|
#include "global.h"
|
||||||
#include "DialogDriver_Cocoa.h"
|
#include "DialogDriver_Cocoa.h"
|
||||||
#include "RageThreads.h"
|
#include "RageThreads.h"
|
||||||
#define Random Random_ // work around namespace pollution
|
#include "ProductInfo.h"
|
||||||
#include <Carbon/Carbon.h>
|
#include <Carbon/Carbon.h>
|
||||||
#undef Random_
|
|
||||||
|
|
||||||
static SInt16 ShowAlert( int type, CFStringRef message, CFStringRef OK, CFStringRef cancel = NULL )
|
static CFOptionFlags ShowAlert( CFOptionFlags flags, CFStringRef message,
|
||||||
|
CFStringRef OK, CFStringRef cancel = NULL )
|
||||||
{
|
{
|
||||||
struct AlertStdCFStringAlertParamRec params =
|
CFOptionFlags result;
|
||||||
{
|
|
||||||
kStdCFStringAlertVersionOne, true, false, OK, cancel, NULL,
|
|
||||||
kAlertStdAlertOKButton, kAlertStdAlertCancelButton, kWindowAlertPositionParentWindowScreen, 0
|
|
||||||
};
|
|
||||||
DialogRef dialog;
|
|
||||||
CreateStandardAlert( type, message, NULL, ¶ms, &dialog );
|
|
||||||
|
|
||||||
OSErr err = AutoSizeDialog( dialog );
|
CFUserNotificationDisplayAlert( 0.0, flags, NULL, NULL, NULL, CFSTR(PRODUCT_NAME_VER),
|
||||||
ASSERT( err == noErr );
|
message, OK, cancel, NULL, &result );
|
||||||
|
return result;
|
||||||
SInt16 iResult;
|
|
||||||
RunStandardAlert( dialog, NULL, &iResult );
|
|
||||||
|
|
||||||
return iResult;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void DialogDriver_Cocoa::OK( CString sMessage, CString sID )
|
void DialogDriver_Cocoa::OK( CString sMessage, CString sID )
|
||||||
{
|
{
|
||||||
CFStringRef message = CFStringCreateWithCString( NULL, sMessage, kCFStringEncodingASCII );
|
CFStringRef message = CFStringCreateWithCString( NULL, sMessage, kCFStringEncodingASCII );
|
||||||
SInt16 iResult = ShowAlert( kAlertNoteAlert, message, CFSTR("OK"), CFSTR("Don't show again") );
|
CFOptionFlags result = ShowAlert( kCFUserNotificationNoteAlertLevel, message,
|
||||||
|
CFSTR("OK"), CFSTR("Don't show again") );
|
||||||
|
|
||||||
CFRelease( message );
|
CFRelease( message );
|
||||||
if( iResult == kAlertStdAlertCancelButton )
|
if( result == kCFUserNotificationAlternateResponse )
|
||||||
Dialog::IgnoreMessage( sID );
|
Dialog::IgnoreMessage( sID );
|
||||||
}
|
}
|
||||||
|
|
||||||
void DialogDriver_Cocoa::Error( CString sError, CString sID )
|
void DialogDriver_Cocoa::Error( CString sError, CString sID )
|
||||||
{
|
{
|
||||||
CFStringRef error = CFStringCreateWithCString( NULL, sError, kCFStringEncodingASCII );
|
CFStringRef error = CFStringCreateWithCString( NULL, sError, kCFStringEncodingASCII );
|
||||||
ShowAlert( kAlertStopAlert, error, CFSTR("OK") );
|
ShowAlert( kCFUserNotificationStopAlertLevel, error, CFSTR("OK") );
|
||||||
|
|
||||||
CFRelease( error );
|
CFRelease( error );
|
||||||
}
|
}
|
||||||
|
|
||||||
// XXX: should show three options, not two
|
|
||||||
Dialog::Result DialogDriver_Cocoa::AbortRetryIgnore( CString sMessage, CString sID )
|
Dialog::Result DialogDriver_Cocoa::AbortRetryIgnore( CString sMessage, CString sID )
|
||||||
{
|
{
|
||||||
CFStringRef error = CFStringCreateWithCString( NULL, sMessage, kCFStringEncodingASCII );
|
CFStringRef error = CFStringCreateWithCString( NULL, sMessage, kCFStringEncodingASCII );
|
||||||
SInt16 iResult = ShowAlert( kAlertNoteAlert, error, CFSTR("Retry"), CFSTR("Ignore") );
|
CFOptionFlags result = ShowAlert( kCFUserNotificationNoteAlertLevel, error, CFSTR("Retry"), CFSTR("Ignore") );
|
||||||
Dialog::Result ret;
|
Dialog::Result ret;
|
||||||
|
|
||||||
CFRelease( error );
|
CFRelease( error );
|
||||||
switch( iResult )
|
switch( result )
|
||||||
{
|
{
|
||||||
case kAlertStdAlertOKButton:
|
case kCFUserNotificationDefaultResponse:
|
||||||
ret = Dialog::retry;
|
ret = Dialog::retry;
|
||||||
break;
|
break;
|
||||||
case kAlertStdAlertCancelButton:
|
case kCFUserNotificationAlternateResponse:
|
||||||
|
case kCFUserNotificationCancelResponse:
|
||||||
ret = Dialog::ignore;
|
ret = Dialog::ignore;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@@ -67,7 +58,7 @@ Dialog::Result DialogDriver_Cocoa::AbortRetryIgnore( CString sMessage, CString s
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* (c) 2003-2004 Steve Checkoway
|
* (c) 2003-2005 Steve Checkoway
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||||
|
|||||||
Reference in New Issue
Block a user