X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/b93d8cc460d43840abb28f0f67f8c59c1af4bbd0..ee0d4b469ad3a53a32336e5f354694904c34db71:/src/cocoa/app.mm diff --git a/src/cocoa/app.mm b/src/cocoa/app.mm index fe12b0f00e..ec398d6724 100644 --- a/src/cocoa/app.mm +++ b/src/cocoa/app.mm @@ -32,6 +32,7 @@ #include "wx/cocoa/ObjcPose.h" #include "wx/cocoa/autorelease.h" +#include "wx/cocoa/mbarman.h" #if wxUSE_WX_RESOURCES # include "wx/resource.h" @@ -42,6 +43,7 @@ #import #import #import +#import // ---------------------------------------------------------------------------- // globals @@ -63,6 +65,8 @@ wxPoseAsInitializer *wxPoseAsInitializer::sm_first = NULL; - (void)doIdle: (id)data { wxASSERT(wxTheApp); + wxASSERT(wxMenuBarManager::GetInstance()); + wxMenuBarManager::GetInstance()->CocoaInternalIdle(); wxLogDebug("doIdle called"); #ifdef __WXDEBUG__ if(wxTheApp->IsInAssert()) @@ -168,6 +172,7 @@ bool wxApp::Initialize(int& argc, wxChar **argv) void wxApp::CleanUp() { wxDC::CocoaShutdownTextSystem(); + wxMenuBarManager::DestroyInstance(); wxAppBase::CleanUp(); } @@ -188,7 +193,6 @@ wxApp::wxApp() m_isInAssert = FALSE; #endif // __WXDEBUG__ - argc = 0; argv = NULL; m_cocoaApp = NULL; @@ -220,6 +224,9 @@ bool wxApp::OnInitGui() // Create the app using the sharedApplication method m_cocoaApp = [NSApplication sharedApplication]; + + wxMenuBarManager::CreateInstance(); + wxDC::CocoaInitializeTextSystem(); // [ m_cocoaApp setDelegate:m_cocoaApp ]; #if 0 @@ -309,8 +316,15 @@ bool wxApp::Yield(bool onlyIfNeeded) s_inYield = true; - wxLogDebug("WARNING: SUPPOSED to have yielded!"); - // FIXME: Do something! + // Run the event loop until it is out of events + while(NSEvent *event = [GetNSApplication() + nextEventMatchingMask:NSAnyEventMask + untilDate:[NSDate distantPast] + inMode:NSDefaultRunLoopMode + dequeue: YES]) + { + [GetNSApplication() sendEvent: event]; + } #if wxUSE_LOG // let the logs be flashed again