X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/7e3d8eabcf419cde7b47afd3b522331b3199299d..8a31648287be0ef976f133de2786b137f1e98340:/src/osx/cocoa/filedlg.mm diff --git a/src/osx/cocoa/filedlg.mm b/src/osx/cocoa/filedlg.mm index 44c1240c57..a1c79b7fc5 100644 --- a/src/osx/cocoa/filedlg.mm +++ b/src/osx/cocoa/filedlg.mm @@ -65,7 +65,7 @@ - (id) init { - [super init]; + self = [super init]; _dialog = NULL; return self; } @@ -164,6 +164,13 @@ wxFileDialog::wxFileDialog( : wxFileDialogBase(parent, message, defaultDir, defaultFileName, wildCard, style, pos, sz, name) { m_filterIndex = -1; + m_sheetDelegate = [[ModalDialogDelegate alloc] init]; + [(ModalDialogDelegate*)m_sheetDelegate setImplementation: this]; +} + +wxFileDialog::~wxFileDialog() +{ + [m_sheetDelegate release]; } bool wxFileDialog::SupportsExtraControl() const @@ -308,10 +315,8 @@ void wxFileDialog::ShowWindowModal() [sPanel setAllowsOtherFileTypes:NO]; NSWindow* nativeParent = parentWindow->GetWXWindow(); - ModalDialogDelegate* sheetDelegate = [[ModalDialogDelegate alloc] init]; - [sheetDelegate setImplementation: this]; [sPanel beginSheetForDirectory:dir.AsNSString() file:file.AsNSString() - modalForWindow: nativeParent modalDelegate: sheetDelegate + modalForWindow: nativeParent modalDelegate: m_sheetDelegate didEndSelector: @selector(sheetDidEnd:returnCode:contextInfo:) contextInfo: nil]; } @@ -329,11 +334,9 @@ void wxFileDialog::ShowWindowModal() [oPanel setAllowsMultipleSelection: (HasFlag(wxFD_MULTIPLE) ? YES : NO )]; 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 + modalDelegate: m_sheetDelegate didEndSelector: @selector(sheetDidEnd:returnCode:contextInfo:) contextInfo: nil]; }