From: Kevin Ollivier Date: Thu, 28 Jan 2010 04:06:23 +0000 (+0000) Subject: Get ShowWindowModal behavior working under OS X Cocoa for file, dir and message dialogs. X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/bfa92264c07d094c05e5a07a17fd7f5bcee8e81f Get ShowWindowModal behavior working under OS X Cocoa for file, dir and message dialogs. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@63291 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/include/wx/osx/cocoa/private.h b/include/wx/osx/cocoa/private.h index e7ce32fa9a..f7ee0900a4 100644 --- a/include/wx/osx/cocoa/private.h +++ b/include/wx/osx/cocoa/private.h @@ -55,6 +55,8 @@ WXDLLIMPEXP_BASE wxString wxMacFSRefToPath( const FSRef *fsRef , CFStringRef add WXDLLIMPEXP_BASE OSStatus wxMacPathToFSRef( const wxString&path , FSRef *fsRef ); WXDLLIMPEXP_BASE wxString wxMacHFSUniStrToString( ConstHFSUniStr255Param uniname ); +class WXDLLIMPEXP_FWD_CORE wxDialog; + // // // @@ -346,8 +348,10 @@ protected : { BOOL sheetFinished; int resultCode; + wxDialog* impl; } + - (void)setImplementation: (wxDialog *)dialog; - (BOOL)finished; - (int)code; - (void)waitForSheetToFinish; diff --git a/include/wx/osx/dialog.h b/include/wx/osx/dialog.h index 17195a318a..77427be8b4 100644 --- a/include/wx/osx/dialog.h +++ b/include/wx/osx/dialog.h @@ -66,6 +66,10 @@ public: wxDialogModality GetModality() const; +#if wxOSX_USE_COCOA + virtual void ModalFinishedCallback(void* WXUNUSED(panel), int WXUNUSED(returnCode)) {} +#endif + protected: // show modal dialog and enter modal loop void DoShowModal(); @@ -79,10 +83,10 @@ protected: // needed for cleanup on the Cocoa side. void EndWindowModal(); + wxDialogModality m_modality; + private: void Init(); - - wxDialogModality m_modality; }; #endif diff --git a/include/wx/osx/dirdlg.h b/include/wx/osx/dirdlg.h index 7a40c8524c..5cb641617a 100644 --- a/include/wx/osx/dirdlg.h +++ b/include/wx/osx/dirdlg.h @@ -24,6 +24,11 @@ public: const wxString& name = wxDirDialogNameStr); virtual int ShowModal(); + +#if wxOSX_USE_COCOA + virtual void ShowWindowModal(); + virtual void ModalFinishedCallback(void* panel, int returnCode); +#endif protected: diff --git a/include/wx/osx/filedlg.h b/include/wx/osx/filedlg.h index cd2d7c9111..d5c17681df 100644 --- a/include/wx/osx/filedlg.h +++ b/include/wx/osx/filedlg.h @@ -38,6 +38,11 @@ public: virtual void GetFilenames(wxArrayString& files) const { files = m_fileNames ; } virtual int ShowModal(); + +#if wxOSX_USE_COCOA + virtual void ShowWindowModal(); + virtual void ModalFinishedCallback(void* panel, int resultCode); +#endif protected: // not supported for file dialog, RR diff --git a/include/wx/osx/msgdlg.h b/include/wx/osx/msgdlg.h index 4ec95ea4a6..00b54b7df0 100644 --- a/include/wx/osx/msgdlg.h +++ b/include/wx/osx/msgdlg.h @@ -23,6 +23,11 @@ public: const wxPoint& pos = wxDefaultPosition); virtual int ShowModal(); + +#if wxOSX_USE_COCOA + virtual void ShowWindowModal(); + virtual void ModalFinishedCallback(void* panel, int resultCode); +#endif protected: // not supported for message dialog @@ -30,6 +35,13 @@ protected: int WXUNUSED(width), int WXUNUSED(height), int WXUNUSED(sizeFlags) = wxSIZE_AUTO) {} +#if wxOSX_USE_COCOA + void* ConstructNSAlert(); +#endif + + int m_buttonId[3]; + int m_buttonCount; + DECLARE_DYNAMIC_CLASS(wxMessageDialog) }; diff --git a/src/osx/cocoa/dirdlg.mm b/src/osx/cocoa/dirdlg.mm index 9baab201ae..37e32fe813 100644 --- a/src/osx/cocoa/dirdlg.mm +++ b/src/osx/cocoa/dirdlg.mm @@ -47,11 +47,12 @@ wxDirDialog::wxDirDialog(wxWindow *parent, const wxString& message, SetPath(defaultPath); } - -int wxDirDialog::ShowModal() +void wxDirDialog::ShowWindowModal() { - int result = wxID_CANCEL; - + wxCFStringRef dir( m_path ); + + m_modality = wxDIALOG_MODALITY_WINDOW_MODAL; + NSOpenPanel *oPanel = [NSOpenPanel openPanel]; [oPanel setCanChooseDirectories:YES]; [oPanel setResolvesAliases:YES]; @@ -62,47 +63,65 @@ int wxDirDialog::ShowModal() if ( HasFlag(wxDD_NEW_DIR_BUTTON) ) [oPanel setCanCreateDirectories:YES]; - - wxCFStringRef dir( m_path ); - - m_path = wxEmptyString; - + wxNonOwnedWindow* parentWindow = NULL; - int returnCode = -1; - + if (GetParent()) - { parentWindow = dynamic_cast(wxGetTopLevelParent(GetParent())); - } - else - { - fprintf(stderr, "No parent!\n"); - } - -/* + + wxASSERT_MSG(parentWindow, "Window modal display requires parent."); + if (parentWindow) { NSWindow* nativeParent = parentWindow->GetWXWindow(); ModalDialogDelegate* sheetDelegate = [[ModalDialogDelegate alloc] init]; + [sheetDelegate setImplementation: this]; [oPanel beginSheetForDirectory:dir.AsNSString() file:nil types: nil modalForWindow: nativeParent modalDelegate: sheetDelegate didEndSelector: @selector(sheetDidEnd:returnCode:contextInfo:) contextInfo: nil]; - [sheetDelegate waitForSheetToFinish]; - returnCode = [sheetDelegate code]; - [sheetDelegate release]; - } - else -*/ - { - returnCode = (NSInteger)[oPanel runModalForDirectory:dir.AsNSString() file:nil types:nil]; } +} + +int wxDirDialog::ShowModal() +{ + NSOpenPanel *oPanel = [NSOpenPanel openPanel]; + [oPanel setCanChooseDirectories:YES]; + [oPanel setResolvesAliases:YES]; + [oPanel setCanChooseFiles:NO]; + + wxCFStringRef cf( m_message ); + [oPanel setMessage:cf.AsNSString()]; + + if ( HasFlag(wxDD_NEW_DIR_BUTTON) ) + [oPanel setCanCreateDirectories:YES]; + + wxCFStringRef dir( m_path ); + + m_path = wxEmptyString; + + int returnCode = -1; + + returnCode = (NSInteger)[oPanel runModalForDirectory:dir.AsNSString() file:nil types:nil]; + ModalFinishedCallback(oPanel, returnCode); + + return GetReturnCode(); +} + +void wxDirDialog::ModalFinishedCallback(void* panel, int returnCode) +{ + int result = wxID_CANCEL; + if (returnCode == NSOKButton ) { + NSOpenPanel* oPanel = (NSOpenPanel*)panel; SetPath( wxCFStringRef::AsString([[oPanel filenames] objectAtIndex:0])); result = wxID_OK; } - return result; + SetReturnCode(result); + + if (GetModality() == wxDIALOG_MODALITY_WINDOW_MODAL) + SendWindowModalDialogEvent ( wxEVT_WINDOW_MODAL_DIALOG_CLOSED ); } #endif // wxUSE_DIRDLG diff --git a/src/osx/cocoa/filedlg.mm b/src/osx/cocoa/filedlg.mm index 916b4e8b7a..b4decc5dcd 100644 --- a/src/osx/cocoa/filedlg.mm +++ b/src/osx/cocoa/filedlg.mm @@ -140,10 +140,63 @@ NSArray* GetTypesFromFilter( const wxString filter ) return types; } -int wxFileDialog::ShowModal() +void wxFileDialog::ShowWindowModal() { - int result = wxID_CANCEL; + wxCFStringRef cf( m_message ); + wxCFStringRef dir( m_dir ); + wxCFStringRef file( m_fileName ); + + wxNonOwnedWindow* parentWindow = NULL; + + m_modality = wxDIALOG_MODALITY_WINDOW_MODAL; + + if (GetParent()) + parentWindow = dynamic_cast(wxGetTopLevelParent(GetParent())); + + wxASSERT_MSG(parentWindow, "Window modal display requires parent."); + + if (HasFlag(wxFD_SAVE)) + { + NSSavePanel* sPanel = [NSSavePanel savePanel]; + // makes things more convenient: + [sPanel setCanCreateDirectories:YES]; + [sPanel setMessage:cf.AsNSString()]; + // if we should be able to descend into pacakges we must somehow + // be able to pass this in + [sPanel setTreatsFilePackagesAsDirectories:NO]; + [sPanel setCanSelectHiddenExtension:YES]; + + NSWindow* nativeParent = parentWindow->GetWXWindow(); + ModalDialogDelegate* sheetDelegate = [[ModalDialogDelegate alloc] init]; + [sheetDelegate setImplementation: this]; + [sPanel beginSheetForDirectory:dir.AsNSString() file:file.AsNSString() + modalForWindow: nativeParent modalDelegate: sheetDelegate + didEndSelector: @selector(sheetDidEnd:returnCode:contextInfo:) + contextInfo: nil]; + } + else + { + NSArray* types = GetTypesFromFilter( m_wildCard ) ; + NSOpenPanel* oPanel = [NSOpenPanel openPanel]; + [oPanel setTreatsFilePackagesAsDirectories:NO]; + [oPanel setCanChooseDirectories:NO]; + [oPanel setResolvesAliases:YES]; + [oPanel setCanChooseFiles:YES]; + [oPanel setMessage:cf.AsNSString()]; + + NSWindow* nativeParent = parentWindow->GetWXWindow(); + ModalDialogDelegate* sheetDelegate = [[ModalDialogDelegate alloc] init]; + [sheetDelegate setImplementation: this]; + [oPanel beginSheetForDirectory:dir.AsNSString() file:file.AsNSString() + types: types modalForWindow: nativeParent + modalDelegate: sheetDelegate + didEndSelector: @selector(sheetDidEnd:returnCode:contextInfo:) + contextInfo: nil]; + } +} +int wxFileDialog::ShowModal() +{ NSSavePanel *panel = nil; wxCFStringRef cf( m_message ); @@ -180,34 +233,8 @@ int wxFileDialog::ShowModal() { } -/* - if (parentWindow) - { - NSWindow* nativeParent = parentWindow->GetWXWindow(); - ModalDialogDelegate* sheetDelegate = [[ModalDialogDelegate alloc] init]; - [sPanel beginSheetForDirectory:dir.AsNSString() file:file.AsNSString() - modalForWindow: nativeParent modalDelegate: sheetDelegate - didEndSelector: @selector(sheetDidEnd:returnCode:contextInfo:) - contextInfo: nil]; - [sheetDelegate waitForSheetToFinish]; - returnCode = [sheetDelegate code]; - [sheetDelegate release]; - } - else -*/ - { - returnCode = [sPanel runModalForDirectory:dir.AsNSString() file:file.AsNSString() ]; - } - - if (returnCode == NSOKButton ) - { - panel = sPanel; - result = wxID_OK; - - m_path = wxCFStringRef::AsString([sPanel filename]); - m_fileName = wxFileNameFromPath(m_path); - m_dir = wxPathOnly( m_path ); - } + returnCode = [sPanel runModalForDirectory:dir.AsNSString() file:file.AsNSString() ]; + ModalFinishedCallback(sPanel, returnCode); } else { @@ -219,26 +246,36 @@ int wxFileDialog::ShowModal() [oPanel setCanChooseFiles:YES]; [oPanel setMessage:cf.AsNSString()]; -/* - if (parentWindow) - { - NSWindow* nativeParent = parentWindow->GetWXWindow(); - ModalDialogDelegate* sheetDelegate = [[ModalDialogDelegate alloc] init]; - [oPanel beginSheetForDirectory:dir.AsNSString() file:file.AsNSString() - types: types modalForWindow: nativeParent - modalDelegate: sheetDelegate - didEndSelector: @selector(sheetDidEnd:returnCode:contextInfo:) - contextInfo: nil]; - [sheetDelegate waitForSheetToFinish]; - returnCode = [sheetDelegate code]; - [sheetDelegate release]; - } - else -*/ - { - returnCode = [oPanel runModalForDirectory:dir.AsNSString() + returnCode = [oPanel runModalForDirectory:dir.AsNSString() file:file.AsNSString() types:types]; + + ModalFinishedCallback(oPanel, returnCode); + + if ( types != nil ) + [types release]; + } + + return GetReturnCode(); +} + +void wxFileDialog::ModalFinishedCallback(void* panel, int returnCode) +{ + int result = wxID_CANCEL; + if (HasFlag(wxFD_SAVE)) + { + if (returnCode == NSOKButton ) + { + NSSavePanel* sPanel = (NSSavePanel*)panel; + result = wxID_OK; + + m_path = wxCFStringRef::AsString([sPanel filename]); + m_fileName = wxFileNameFromPath(m_path); + m_dir = wxPathOnly( m_path ); } + } + else + { + NSOpenPanel* oPanel = (NSOpenPanel*)panel; if (returnCode == NSOKButton ) { panel = oPanel; @@ -257,11 +294,11 @@ int wxFileDialog::ShowModal() } } } - if ( types != nil ) - [types release]; } - - return result; + SetReturnCode(result); + + if (GetModality() == wxDIALOG_MODALITY_WINDOW_MODAL) + SendWindowModalDialogEvent ( wxEVT_WINDOW_MODAL_DIALOG_CLOSED ); } #endif // wxUSE_FILEDLG diff --git a/src/osx/cocoa/msgdlg.mm b/src/osx/cocoa/msgdlg.mm index 504e019070..75557ec715 100644 --- a/src/osx/cocoa/msgdlg.mm +++ b/src/osx/cocoa/msgdlg.mm @@ -86,7 +86,7 @@ int wxMessageDialog::ShowModal() wxCFStringRef cfOKString( GetOKLabel(), GetFont().GetEncoding()) ; wxCFStringRef cfCancelString( GetCancelLabel(), GetFont().GetEncoding() ); - int buttonId[4] = { 0, 0, 0, wxID_CANCEL /* time-out */ }; + int m_buttonId[4] = { 0, 0, 0, wxID_CANCEL /* time-out */ }; if (style & wxYES_NO) { @@ -94,32 +94,32 @@ int wxMessageDialog::ShowModal() { defaultButtonTitle = cfNoString; alternateButtonTitle = cfYesString; - buttonId[0] = wxID_NO; - buttonId[1] = wxID_YES; + m_buttonId[0] = wxID_NO; + m_buttonId[1] = wxID_YES; } else { defaultButtonTitle = cfYesString; alternateButtonTitle = cfNoString; - buttonId[0] = wxID_YES; - buttonId[1] = wxID_NO; + m_buttonId[0] = wxID_YES; + m_buttonId[1] = wxID_NO; } if (style & wxCANCEL) { otherButtonTitle = cfCancelString; - buttonId[2] = wxID_CANCEL; + m_buttonId[2] = wxID_CANCEL; } } else { // the MSW implementation even shows an OK button if it is not specified, we'll do the same - buttonId[0] = wxID_OK; + m_buttonId[0] = wxID_OK; // using null as default title does not work on earlier systems defaultButtonTitle = cfOKString; if (style & wxCANCEL) { alternateButtonTitle = cfCancelString; - buttonId[1] = wxID_CANCEL; + m_buttonId[1] = wxID_CANCEL; } } @@ -128,99 +128,135 @@ int wxMessageDialog::ShowModal() 0, alertType, NULL, NULL, NULL, cfTitle, cfText, defaultButtonTitle, alternateButtonTitle, otherButtonTitle, &exitButton ); if (err == noErr) - resultbutton = buttonId[exitButton]; + resultbutton = m_buttonId[exitButton]; } else { - NSAlert* alert = [[NSAlert alloc] init]; + NSAlert* alert = (NSAlert*)ConstructNSAlert(); - wxCFStringRef cfNoString( GetNoLabel(), GetFont().GetEncoding() ); - wxCFStringRef cfYesString( GetYesLabel(), GetFont().GetEncoding() ); - wxCFStringRef cfOKString( GetOKLabel(), GetFont().GetEncoding() ); - wxCFStringRef cfCancelString( GetCancelLabel(), GetFont().GetEncoding() ); + int button = -1; + button = [alert runModal]; + [alert release]; + ModalFinishedCallback(alert, button); + } - wxCFStringRef cfTitle( msgtitle, GetFont().GetEncoding() ); - wxCFStringRef cfText( msgtext, GetFont().GetEncoding() ); + return GetReturnCode(); +} - [alert setMessageText:cfTitle.AsNSString()]; - [alert setInformativeText:cfText.AsNSString()]; +void wxMessageDialog::ShowWindowModal() +{ + NSAlert* alert = (NSAlert*)ConstructNSAlert(); - int buttonId[3] = { 0, 0, 0 }; - int buttonCount = 0; + wxNonOwnedWindow* parentWindow = NULL; - if (style & wxYES_NO) - { - if ( style & wxNO_DEFAULT ) - { - [alert addButtonWithTitle:cfNoString.AsNSString()]; - buttonId[ buttonCount++ ] = wxID_NO; - [alert addButtonWithTitle:cfYesString.AsNSString()]; - buttonId[ buttonCount++ ] = wxID_YES; - } - else - { - [alert addButtonWithTitle:cfYesString.AsNSString()]; - buttonId[ buttonCount++ ] = wxID_YES; - [alert addButtonWithTitle:cfNoString.AsNSString()]; - buttonId[ buttonCount++ ] = wxID_NO; - } + m_modality = wxDIALOG_MODALITY_WINDOW_MODAL; - if (style & wxCANCEL) - { - [alert addButtonWithTitle:cfCancelString.AsNSString()]; - buttonId[ buttonCount++ ] = wxID_CANCEL; - } - } - // the MSW implementation even shows an OK button if it is not specified, we'll do the same + if (GetParent()) + parentWindow = dynamic_cast(wxGetTopLevelParent(GetParent())); + + wxASSERT_MSG(parentWindow, "Window modal display requires parent."); + + if (parentWindow) + { + NSWindow* nativeParent = parentWindow->GetWXWindow(); + ModalDialogDelegate* sheetDelegate = [[ModalDialogDelegate alloc] init]; + [sheetDelegate setImplementation: this]; + [alert beginSheetModalForWindow: nativeParent modalDelegate: sheetDelegate + didEndSelector: @selector(sheetDidEnd:returnCode:contextInfo:) + contextInfo: nil]; + } +} + +void wxMessageDialog::ModalFinishedCallback(void* panel, int resultCode) +{ + int resultbutton = wxID_CANCEL; + if ( resultCode < NSAlertFirstButtonReturn ) + resultbutton = wxID_CANCEL; + else + { + if ( resultCode - NSAlertFirstButtonReturn < m_buttonCount ) + resultbutton = m_buttonId[ resultCode - NSAlertFirstButtonReturn ]; else - { - [alert addButtonWithTitle:cfOKString.AsNSString()]; - buttonId[ buttonCount++ ] = wxID_OK; - if (style & wxCANCEL) - { - [alert addButtonWithTitle:cfCancelString.AsNSString()]; - buttonId[ buttonCount++ ] = wxID_CANCEL; - } - } + resultbutton = wxID_CANCEL; + } + SetReturnCode(resultbutton); + + if (GetModality() == wxDIALOG_MODALITY_WINDOW_MODAL) + SendWindowModalDialogEvent ( wxEVT_WINDOW_MODAL_DIALOG_CLOSED ); +} +void* wxMessageDialog::ConstructNSAlert() +{ + const long style = GetMessageDialogStyle(); - wxNonOwnedWindow* parentWindow = NULL; - int button = -1; + wxASSERT_MSG( (style & 0x3F) != wxYES, wxT("this style is not supported on Mac") ); - if (GetParent()) - { - parentWindow = dynamic_cast(wxGetTopLevelParent(GetParent())); - } + // work out what to display + // if the extended text is empty then we use the caption as the title + // and the message as the text (for backwards compatibility) + // but if the extended message is not empty then we use the message as the title + // and the extended message as the text because that makes more sense - /* - if (parentWindow) + wxString msgtitle,msgtext; + if(m_extendedMessage.IsEmpty()) + { + msgtitle = m_caption; + msgtext = m_message; + } + else + { + msgtitle = m_message; + msgtext = m_extendedMessage; + } + + NSAlert* alert = [[NSAlert alloc] init]; + + wxCFStringRef cfNoString( GetNoLabel(), GetFont().GetEncoding() ); + wxCFStringRef cfYesString( GetYesLabel(), GetFont().GetEncoding() ); + wxCFStringRef cfOKString( GetOKLabel(), GetFont().GetEncoding() ); + wxCFStringRef cfCancelString( GetCancelLabel(), GetFont().GetEncoding() ); + + wxCFStringRef cfTitle( msgtitle, GetFont().GetEncoding() ); + wxCFStringRef cfText( msgtext, GetFont().GetEncoding() ); + + [alert setMessageText:cfTitle.AsNSString()]; + [alert setInformativeText:cfText.AsNSString()]; + + m_buttonCount = 0; + + if (style & wxYES_NO) + { + if ( style & wxNO_DEFAULT ) { - NSWindow* nativeParent = parentWindow->GetWXWindow(); - ModalDialogDelegate* sheetDelegate = [[ModalDialogDelegate alloc] init]; - [alert beginSheetModalForWindow: nativeParent modalDelegate: sheetDelegate - didEndSelector: @selector(sheetDidEnd:returnCode:contextInfo:) - contextInfo: nil]; - [sheetDelegate waitForSheetToFinish]; - button = [sheetDelegate code]; - [sheetDelegate release]; + [alert addButtonWithTitle:cfNoString.AsNSString()]; + m_buttonId[ m_buttonCount++ ] = wxID_NO; + [alert addButtonWithTitle:cfYesString.AsNSString()]; + m_buttonId[ m_buttonCount++ ] = wxID_YES; } else -*/ { - button = [alert runModal]; + [alert addButtonWithTitle:cfYesString.AsNSString()]; + m_buttonId[ m_buttonCount++ ] = wxID_YES; + [alert addButtonWithTitle:cfNoString.AsNSString()]; + m_buttonId[ m_buttonCount++ ] = wxID_NO; } - [alert release]; - if ( button < NSAlertFirstButtonReturn ) - resultbutton = wxID_CANCEL; - else + if (style & wxCANCEL) { - if ( button - NSAlertFirstButtonReturn < buttonCount ) - resultbutton = buttonId[ button - NSAlertFirstButtonReturn ]; - else - resultbutton = wxID_CANCEL; + [alert addButtonWithTitle:cfCancelString.AsNSString()]; + m_buttonId[ m_buttonCount++ ] = wxID_CANCEL; } } - - return resultbutton; + // the MSW implementation even shows an OK button if it is not specified, we'll do the same + else + { + [alert addButtonWithTitle:cfOKString.AsNSString()]; + m_buttonId[ m_buttonCount++ ] = wxID_OK; + if (style & wxCANCEL) + { + [alert addButtonWithTitle:cfCancelString.AsNSString()]; + m_buttonId[ m_buttonCount++ ] = wxID_CANCEL; + } + } + return alert; } diff --git a/src/osx/cocoa/utils.mm b/src/osx/cocoa/utils.mm index 36ce2bb0d4..53abbfcf57 100644 --- a/src/osx/cocoa/utils.mm +++ b/src/osx/cocoa/utils.mm @@ -11,14 +11,13 @@ #include "wx/wxprec.h" -#include "wx/wxprec.h" - #include "wx/utils.h" #ifndef WX_PRECOMP #include "wx/intl.h" #include "wx/app.h" #if wxUSE_GUI + #include "wx/dialog.h" #include "wx/toplevel.h" #include "wx/font.h" #endif @@ -176,9 +175,15 @@ void wxMacWakeUp() [super init]; sheetFinished = NO; resultCode = -1; + impl = 0; return self; } +- (void)setImplementation: (wxDialog *)dialog +{ + impl = dialog; +} + - (BOOL)finished { return sheetFinished; @@ -205,6 +210,9 @@ void wxMacWakeUp() // NSAlerts don't need nor respond to orderOut if ([sheet respondsToSelector:@selector(orderOut:)]) [sheet orderOut: self]; + + if (impl) + impl->ModalFinishedCallback(sheet, returnCode); } @end diff --git a/src/osx/dialog_osx.cpp b/src/osx/dialog_osx.cpp index 02bde473d3..1408ea0fb3 100644 --- a/src/osx/dialog_osx.cpp +++ b/src/osx/dialog_osx.cpp @@ -122,7 +122,7 @@ bool wxDialog::Show(bool show) // Replacement for Show(true) for modal dialogs - returns return code int wxDialog::ShowModal() { - m_modality = wxDIALOG_MODALITY_WINDOW_MODAL; + m_modality = wxDIALOG_MODALITY_APP_MODAL; Show();