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:
@@ -153,9 +153,12 @@ public:
|
||||
|
||||
private:
|
||||
bool m_onInitResult;
|
||||
bool m_inited;
|
||||
wxArrayString m_openFiles;
|
||||
|
||||
public:
|
||||
|
||||
bool OSXInitWasCalled() { return m_inited; }
|
||||
void OSXStoreOpenFiles(const wxArrayString &files ) { m_openFiles = files ; }
|
||||
#endif
|
||||
|
||||
// Hide the application windows the same as the system hide command would do it.
|
||||
|
@@ -403,7 +403,6 @@ void wxApp::MacReopenApp()
|
||||
#if wxOSX_USE_COCOA_OR_IPHONE
|
||||
void wxApp::OSXOnWillFinishLaunching()
|
||||
{
|
||||
m_onInitResult = OnInit();
|
||||
}
|
||||
|
||||
void wxApp::OSXOnDidFinishLaunching()
|
||||
|
@@ -80,7 +80,10 @@ void wxBell()
|
||||
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
|
||||
@@ -112,7 +115,6 @@ void wxBell()
|
||||
withReplyEvent:(NSAppleEventDescriptor *)replyEvent
|
||||
{
|
||||
wxUnusedVar(replyEvent);
|
||||
wxTheApp->MacNewFile() ;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -315,7 +317,17 @@ bool wxApp::CallOnInit()
|
||||
{
|
||||
wxMacAutoreleasePool autoreleasepool;
|
||||
m_onInitResult = false;
|
||||
m_inited = false;
|
||||
[NSApp run];
|
||||
m_onInitResult = OnInit();
|
||||
m_inited = true;
|
||||
if ( m_onInitResult )
|
||||
{
|
||||
if ( m_openFiles.GetCount() > 0 )
|
||||
MacOpenFiles(m_openFiles);
|
||||
else
|
||||
MacNewFile();
|
||||
}
|
||||
return m_onInitResult;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user