]> git.saurik.com Git - wxWidgets.git/blobdiff - src/mac/carbon/app.cpp
document On{Open,Save}Document()
[wxWidgets.git] / src / mac / carbon / app.cpp
index 1120af3662244a9f687084978694034e9bfba9a8..a75a5112791edbd1017e102887922ca70e09cd54 100644 (file)
@@ -39,6 +39,7 @@
 #include "wx/docview.h"
 #include "wx/filename.h"
 #include "wx/link.h"
+#include "wx/thread.h"
 
 #include <string.h>
 
@@ -586,7 +587,7 @@ wxMacAppMenuEventHandler( EventHandlerCallRef WXUNUSED(handler),
             {
                 wxWindow *win = menu->GetInvokingWindow();
                 if (win)
-                    win->GetEventHandler()->ProcessEvent(wxevent);
+                    win->HandleWindowEvent(wxevent);
                 }
             }
     }
@@ -821,7 +822,7 @@ bool wxApp::Initialize(int& argc, wxChar **argv)
         CFRelease( url ) ;
         CFStringRef path = CFURLCopyFileSystemPath ( urlParent , kCFURLPOSIXPathStyle ) ;
         CFRelease( urlParent ) ;
-        wxString cwd = wxMacCFStringHolder(path).AsString(wxLocale::GetSystemEncoding());
+        wxString cwd = wxCFStringRef(path).AsString(wxLocale::GetSystemEncoding());
         wxSetWorkingDirectory( cwd ) ;
     }
 
@@ -1408,7 +1409,7 @@ bool wxApp::MacSendKeyDownEvent( wxWindow* focus , long keymessage , long modifi
     wxKeyEvent event(wxEVT_KEY_DOWN) ;
     MacCreateKeyEvent( event, focus , keymessage , modifiers , when , wherex , wherey , uniChar ) ;
 
-    handled = focus->GetEventHandler()->ProcessEvent( event ) ;
+    handled = focus->HandleWindowEvent( event ) ;
     if ( handled && event.GetSkipped() )
         handled = false ;
 
@@ -1455,7 +1456,7 @@ bool wxApp::MacSendKeyUpEvent( wxWindow* focus , long keymessage , long modifier
     bool handled;
     wxKeyEvent event( wxEVT_KEY_UP ) ;
     MacCreateKeyEvent( event, focus , keymessage , modifiers , when , wherex , wherey , uniChar ) ;
-    handled = focus->GetEventHandler()->ProcessEvent( event ) ;
+    handled = focus->HandleWindowEvent( event ) ;
 
     return handled ;
 }
@@ -1471,12 +1472,12 @@ bool wxApp::MacSendCharEvent( wxWindow* focus , long keymessage , long modifiers
 
     bool handled = false ;
 
-    wxTopLevelWindowMac *tlw = focus->MacGetTopLevelWindow() ;
+    wxNonOwnedWindow *tlw = focus->MacGetTopLevelWindow() ;
 
     if (tlw)
     {
         event.SetEventType( wxEVT_CHAR_HOOK );
-        handled = tlw->GetEventHandler()->ProcessEvent( event );
+        handled = tlw->HandleWindowEvent( event );
         if ( handled && event.GetSkipped() )
             handled = false ;
     }
@@ -1485,7 +1486,7 @@ bool wxApp::MacSendCharEvent( wxWindow* focus , long keymessage , long modifiers
     {
         event.SetEventType( wxEVT_CHAR );
         event.Skip( false ) ;
-        handled = focus->GetEventHandler()->ProcessEvent( event ) ;
+        handled = focus->HandleWindowEvent( event ) ;
     }
 
     if ( !handled && (keyval == WXK_TAB) )
@@ -1501,7 +1502,7 @@ bool wxApp::MacSendCharEvent( wxWindow* focus , long keymessage , long modifiers
                 /* CTRL-TAB changes the (parent) window, i.e. switch notebook page */
                 new_event.SetWindowChange( event.ControlDown() );
                 new_event.SetCurrentFocus( focus );
-                handled = focus->GetParent()->GetEventHandler()->ProcessEvent( new_event );
+                handled = focus->GetParent()->HandleWindowEvent( new_event );
                 if ( handled && new_event.GetSkipped() )
                     handled = false ;
             }
@@ -1540,7 +1541,7 @@ bool wxApp::MacSendCharEvent( wxWindow* focus , long keymessage , long modifiers
                 // generate wxID_CANCEL if command-. or <esc> has been pressed (typically in dialogs)
                 wxCommandEvent new_event(wxEVT_COMMAND_BUTTON_CLICKED,wxID_CANCEL);
                 new_event.SetEventObject( focus );
-                handled = focus->GetEventHandler()->ProcessEvent( new_event );
+                handled = focus->HandleWindowEvent( new_event );
             }
         }
 #endif
@@ -1634,3 +1635,14 @@ void wxApp::MacCreateKeyEvent( wxKeyEvent& event, wxWindow* focus , long keymess
     event.SetTimestamp(when);
     event.SetEventObject(focus);
 }
+
+
+void wxApp::MacHideApp()
+{
+    wxMacCarbonEvent event( kEventClassCommand , kEventCommandProcess );
+    HICommand command;
+    memset( &command, 0 , sizeof(command) );
+    command.commandID = kHICommandHide ;
+    event.SetParameter<HICommand>(kEventParamDirectObject, command );       
+    SendEventToApplication( event );
+}