Mac OS X DialogDriver was lacking OKCancel, I also added YesNo Dialog to every platform.

This commit is contained in:
Aldo Fregoso
2012-05-20 22:19:27 -05:00
parent 341a474c9a
commit 0e2cc939d6
7 changed files with 90 additions and 3 deletions
+42
View File
@@ -54,6 +54,27 @@ void DialogDriver_MacOSX::Error( RString sError, RString sID )
ShowAlert( kCFUserNotificationStopAlertLevel, sError, CFSTR("OK") );
}
Dialog::Result DialogDriver_MacOSX::OKCancel( RString sMessage, RString sID )
{
CFBundleRef bundle = CFBundleGetMainBundle();
CFStringRef sOK = LSTRING( bundle, "OK" );
CFStringRef sCancel = LSTRING( bundle, "Cancel" );
CFOptionFlags result = ShowAlert( kCFUserNotificationNoteAlertLevel, sMessage, sOK, sCancel );
CFRelease( sOK );
CFRelease( sCancel );
switch( result )
{
case kCFUserNotificationDefaultResponse:
case kCFUserNotificationCancelResponse:
return Dialog::cancel;
case kCFUserNotificationAlternateResponse:
return Dialog::ok;
default:
FAIL_M( ssprintf("Invalid response: %d.", int(result)) );
}
}
Dialog::Result DialogDriver_MacOSX::AbortRetryIgnore( RString sMessage, RString sID )
{
CFBundleRef bundle = CFBundleGetMainBundle();
@@ -101,6 +122,27 @@ Dialog::Result DialogDriver_MacOSX::AbortRetry( RString sMessage, RString sID )
}
}
Dialog::Result DialogDriver_MacOSX::YesNo( RString sMessage, RString sID )
{
CFBundleRef bundle = CFBundleGetMainBundle();
CFStringRef sYes = LSTRING( bundle, "Yes" );
CFStringRef sNo = LSTRING( bundle, "No" );
CFOptionFlags result = ShowAlert( kCFUserNotificationNoteAlertLevel, sMessage, sYes, sNo );
CFRelease( sYes );
CFRelease( sNo );
switch( result )
{
case kCFUserNotificationDefaultResponse:
case kCFUserNotificationCancelResponse:
return Dialog::no;
case kCFUserNotificationAlternateResponse:
return Dialog::yes;
default:
FAIL_M( ssprintf("Invalid response: %d.", int(result)) );
}
}
/*
* (c) 2003-2006 Steve Checkoway
* All rights reserved.