]> git.saurik.com Git - wxWidgets.git/blobdiff - src/osx/cocoa/dirdlg.mm
OpenGL changes for carbon and cocoa
[wxWidgets.git] / src / osx / cocoa / dirdlg.mm
index e68bf5020b8812f8a40aef545720155ca5825691..9baab201ae0cfedb2888e407bb438374c71df973 100644 (file)
@@ -1,8 +1,8 @@
 /////////////////////////////////////////////////////////////////////////////
 // Name:        src/osx/cocoa/dirdlg.mm
-// Purpose:     wxDirDialog  
+// Purpose:     wxDirDialog
 // Author:      Stefan Csomor
-// Modified by: 
+// Modified by:
 // Created:     2008-08-30
 // RCS-ID:      $Id: dirdlg.mm 40007 2006-07-05 13:10:46Z SC $
 // Copyright:   (c) Stefan Csomor
@@ -51,26 +51,26 @@ wxDirDialog::wxDirDialog(wxWindow *parent, const wxString& message,
 int wxDirDialog::ShowModal()
 {
     int result = wxID_CANCEL;
-    
+
     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) ) 
+
+    if ( HasFlag(wxDD_NEW_DIR_BUTTON) )
         [oPanel setCanCreateDirectories:YES];
 
     wxCFStringRef dir( m_path );
-    
+
     m_path = wxEmptyString;
 
     wxNonOwnedWindow* parentWindow = NULL;
     int returnCode = -1;
-    
-    if (GetParent()) 
+
+    if (GetParent())
     {
         parentWindow = dynamic_cast<wxNonOwnedWindow*>(wxGetTopLevelParent(GetParent()));
     }
@@ -79,14 +79,14 @@ int wxDirDialog::ShowModal()
         fprintf(stderr, "No parent!\n");
     }
 
-/*    
+/*
     if (parentWindow)
     {
         NSWindow* nativeParent = parentWindow->GetWXWindow();
-        ModalDialogDelegate* sheetDelegate = [[ModalDialogDelegate alloc] init]; 
-        [oPanel beginSheetForDirectory:dir.AsNSString() file:nil types: nil 
-            modalForWindow: nativeParent modalDelegate: sheetDelegate 
-            didEndSelector: @selector(sheetDidEnd:returnCode:contextInfo:) 
+        ModalDialogDelegate* sheetDelegate = [[ModalDialogDelegate alloc] init];
+        [oPanel beginSheetForDirectory:dir.AsNSString() file:nil types: nil
+            modalForWindow: nativeParent modalDelegate: sheetDelegate
+            didEndSelector: @selector(sheetDidEnd:returnCode:contextInfo:)
             contextInfo: nil];
         [sheetDelegate waitForSheetToFinish];
         returnCode = [sheetDelegate code];
@@ -99,9 +99,7 @@ int wxDirDialog::ShowModal()
     }
     if (returnCode == NSOKButton )
     {
-        wxCFStringRef resultpath( [[[oPanel filenames] objectAtIndex:0] retain] );
-        
-        SetPath( resultpath.AsString() );
+        SetPath( wxCFStringRef::AsString([[oPanel filenames] objectAtIndex:0]));
         result = wxID_OK;
     }
     return result;