get OnInit with complete functionality without loosing sequence for MacOpenFile being called after OnInit

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@74947 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Stefan Csomor
2013-10-06 21:12:45 +00:00
parent a05ae051d8
commit 7c7cfb16d3
3 changed files with 19 additions and 5 deletions

View File

@@ -153,9 +153,12 @@ public:
private: private:
bool m_onInitResult; bool m_onInitResult;
bool m_inited;
wxArrayString m_openFiles;
public: public:
bool OSXInitWasCalled() { return m_inited; }
void OSXStoreOpenFiles(const wxArrayString &files ) { m_openFiles = files ; }
#endif #endif
// Hide the application windows the same as the system hide command would do it. // Hide the application windows the same as the system hide command would do it.

View File

@@ -403,7 +403,6 @@ void wxApp::MacReopenApp()
#if wxOSX_USE_COCOA_OR_IPHONE #if wxOSX_USE_COCOA_OR_IPHONE
void wxApp::OSXOnWillFinishLaunching() void wxApp::OSXOnWillFinishLaunching()
{ {
m_onInitResult = OnInit();
} }
void wxApp::OSXOnDidFinishLaunching() void wxApp::OSXOnDidFinishLaunching()

View File

@@ -80,7 +80,10 @@ void wxBell()
fileList.Add( wxCFStringRef::AsStringWithNormalizationFormC([fileNames objectAtIndex:i]) ); fileList.Add( wxCFStringRef::AsStringWithNormalizationFormC([fileNames objectAtIndex:i]) );
} }
wxTheApp->MacOpenFiles(fileList); if ( wxTheApp->OSXInitWasCalled() )
wxTheApp->MacOpenFiles(fileList);
else
wxTheApp->OSXStoreOpenFiles(fileList);
} }
- (BOOL)application:(NSApplication *)sender printFile:(NSString *)filename - (BOOL)application:(NSApplication *)sender printFile:(NSString *)filename
@@ -112,7 +115,6 @@ void wxBell()
withReplyEvent:(NSAppleEventDescriptor *)replyEvent withReplyEvent:(NSAppleEventDescriptor *)replyEvent
{ {
wxUnusedVar(replyEvent); wxUnusedVar(replyEvent);
wxTheApp->MacNewFile() ;
} }
/* /*
@@ -315,7 +317,17 @@ bool wxApp::CallOnInit()
{ {
wxMacAutoreleasePool autoreleasepool; wxMacAutoreleasePool autoreleasepool;
m_onInitResult = false; m_onInitResult = false;
m_inited = false;
[NSApp run]; [NSApp run];
m_onInitResult = OnInit();
m_inited = true;
if ( m_onInitResult )
{
if ( m_openFiles.GetCount() > 0 )
MacOpenFiles(m_openFiles);
else
MacNewFile();
}
return m_onInitResult; return m_onInitResult;
} }