- // thats a cancel missing
- param.defaultText = (StringPtr) kAlertDefaultOKText ;
- param.cancelText = NULL;
- param.otherText = NULL;
- param.helpButton = false ;
- param.defaultButton = kAlertStdAlertOKButton;
- param.cancelButton = 0;
+ AlertStdCFStringAlertParamRec param;
+ wxMacCFStringHolder cfNoString( _("No"), m_font.GetEncoding() );
+ wxMacCFStringHolder cfYesString( _("Yes"), m_font.GetEncoding() );
+
+ wxMacCFStringHolder cfTitle( m_caption, m_font.GetEncoding() );
+ wxMacCFStringHolder cfText( m_message, m_font.GetEncoding() );
+
+ param.movable = true;
+ param.flags = 0;
+ param.version = kStdCFStringAlertVersionOne;
+
+ bool skipDialog = false;
+
+ if (style & wxYES_NO)
+ {
+ if (style & wxCANCEL)
+ {
+ param.defaultText = cfYesString;
+ param.cancelText = (CFStringRef) kAlertDefaultCancelText;
+ param.otherText = cfNoString;
+ param.helpButton = false;
+ param.defaultButton = style & wxNO_DEFAULT ? kAlertStdAlertOtherButton : kAlertStdAlertOKButton;
+ param.cancelButton = kAlertStdAlertCancelButton;
+ }
+ else
+ {
+ param.defaultText = cfYesString;
+ param.cancelText = NULL;
+ param.otherText = cfNoString;
+ param.helpButton = false;
+ param.defaultButton = style & wxNO_DEFAULT ? kAlertStdAlertOtherButton : kAlertStdAlertOKButton;
+ param.cancelButton = 0;
+ }
+ }
+ // the MSW implementation even shows an OK button if it is not specified, we'll do the same
+ else
+ {
+ if (style & wxCANCEL)
+ {
+ // that's a cancel missing
+ param.defaultText = (CFStringRef) kAlertDefaultOKText;
+ param.cancelText = (CFStringRef) kAlertDefaultCancelText;
+ param.otherText = NULL;
+ param.helpButton = false;
+ param.defaultButton = kAlertStdAlertOKButton;
+ param.cancelButton = 0;
+ }
+ else
+ {
+ param.defaultText = (CFStringRef) kAlertDefaultOKText;
+ param.cancelText = NULL;
+ param.otherText = NULL;
+ param.helpButton = false;
+ param.defaultButton = kAlertStdAlertOKButton;
+ param.cancelButton = 0;
+ }
+ }
+#if 0
+ else
+ {
+ skipDialog = true;
+ }
+#endif
+
+ param.position = kWindowDefaultPosition;
+ if ( !skipDialog )
+ {
+ DialogRef alertRef;
+ CreateStandardAlert( alertType, cfTitle, cfText, ¶m, &alertRef );
+ RunStandardAlert( alertRef, NULL, &result );
+ }
+ else
+ {
+ return wxID_CANCEL;
+ }