From: Stefan Csomor Date: Thu, 9 Jun 2011 00:29:13 +0000 (+0000) Subject: add member for sheetdialog X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/4d3e2dc9935ab7d46ce7ede856b496591b0d0627 add member for sheetdialog git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@67897 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/src/osx/cocoa/dirdlg.mm b/src/osx/cocoa/dirdlg.mm index 917e35dfeb..065b554241 100644 --- a/src/osx/cocoa/dirdlg.mm +++ b/src/osx/cocoa/dirdlg.mm @@ -45,6 +45,13 @@ wxDirDialog::wxDirDialog(wxWindow *parent, const wxString& message, SetMessage( message ); SetWindowStyle(style); SetPath(defaultPath); + m_sheetDelegate = [[ModalDialogDelegate alloc] init]; + [(ModalDialogDelegate*)m_sheetDelegate setImplementation: this]; +} + +wxDirDialog::~wxDirDialog() +{ + [m_sheetDelegate release]; } void wxDirDialog::ShowWindowModal() @@ -74,10 +81,8 @@ void wxDirDialog::ShowWindowModal() 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 + modalForWindow: nativeParent modalDelegate: m_sheetDelegate didEndSelector: @selector(sheetDidEnd:returnCode:contextInfo:) contextInfo: nil]; } 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]; } diff --git a/src/osx/cocoa/msgdlg.mm b/src/osx/cocoa/msgdlg.mm index 296c77ebcc..ad44f55600 100644 --- a/src/osx/cocoa/msgdlg.mm +++ b/src/osx/cocoa/msgdlg.mm @@ -49,6 +49,13 @@ wxMessageDialog::wxMessageDialog(wxWindow *parent, const wxPoint& WXUNUSED(pos)) : wxMessageDialogBase(parent, message, caption, style) { + m_sheetDelegate = [[ModalDialogDelegate alloc] init]; + [(ModalDialogDelegate*)m_sheetDelegate setImplementation: this]; +} + +wxMessageDialog::~wxMessageDialog() +{ + [m_sheetDelegate release]; } int wxMessageDialog::ShowModal() @@ -167,9 +174,7 @@ void wxMessageDialog::ShowWindowModal() if (parentWindow) { NSWindow* nativeParent = parentWindow->GetWXWindow(); - ModalDialogDelegate* sheetDelegate = [[ModalDialogDelegate alloc] init]; - [sheetDelegate setImplementation: this]; - [alert beginSheetModalForWindow: nativeParent modalDelegate: sheetDelegate + [alert beginSheetModalForWindow: nativeParent modalDelegate: m_sheetDelegate didEndSelector: @selector(sheetDidEnd:returnCode:contextInfo:) contextInfo: nil]; }