]> git.saurik.com Git - wxWidgets.git/commitdiff
add member for sheetdialog
authorStefan Csomor <csomor@advancedconcepts.ch>
Thu, 9 Jun 2011 00:29:13 +0000 (00:29 +0000)
committerStefan Csomor <csomor@advancedconcepts.ch>
Thu, 9 Jun 2011 00:29:13 +0000 (00:29 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@67897 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/osx/cocoa/dirdlg.mm
src/osx/cocoa/filedlg.mm
src/osx/cocoa/msgdlg.mm

index 917e35dfeb45611435009449ed2c0493f1b4c612..065b554241362aeaaeafa542b845260c93ef8b37 100644 (file)
@@ -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];
     }
index 44c1240c5752f8b6e3fea5d991e36d2b45af211e..a1c79b7fc51150881b913791457c7765d4123ae2 100644 (file)
@@ -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];
     }
index 296c77ebcc3ec58b067501a3f3943651bd044a9e..ad44f5560058760d57947ba283a4ebfadc735d99 100644 (file)
@@ -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];
     }