completing OnInit rework for getURL and printFiles callback
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@74954 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -129,13 +129,15 @@ public:
|
||||
virtual short MacHandleAERApp(const WXAPPLEEVENTREF event , WXAPPLEEVENTREF reply) ;
|
||||
#endif
|
||||
// in response of an openFiles message with Cocoa and an
|
||||
// open-document apple event with Carbon
|
||||
// open-document apple event
|
||||
virtual void MacOpenFiles(const wxArrayString &fileNames) ;
|
||||
// called by MacOpenFiles for each file.
|
||||
virtual void MacOpenFile(const wxString &fileName) ;
|
||||
// in response of a get-url apple event
|
||||
virtual void MacOpenURL(const wxString &url) ;
|
||||
// in response of a print-document apple event
|
||||
virtual void MacPrintFiles(const wxArrayString &fileNames) ;
|
||||
// called by MacPrintFiles for each file
|
||||
virtual void MacPrintFile(const wxString &fileName) ;
|
||||
// in response of a open-application apple event
|
||||
virtual void MacNewFile() ;
|
||||
@@ -155,10 +157,14 @@ private:
|
||||
bool m_onInitResult;
|
||||
bool m_inited;
|
||||
wxArrayString m_openFiles;
|
||||
wxArrayString m_printFiles;
|
||||
wxString m_getURL;
|
||||
|
||||
public:
|
||||
bool OSXInitWasCalled() { return m_inited; }
|
||||
void OSXStoreOpenFiles(const wxArrayString &files ) { m_openFiles = files ; }
|
||||
void OSXStorePrintFiles(const wxArrayString &files ) { m_printFiles = files ; }
|
||||
void OSXStoreOpenURL(const wxString &url ) { m_getURL = url ; }
|
||||
#endif
|
||||
|
||||
// Hide the application windows the same as the system hide command would do it.
|
||||
|
@@ -229,6 +229,8 @@ short wxApp::MacHandleAEPDoc(const WXEVENTREF event , WXEVENTREF WXUNUSED(reply)
|
||||
|
||||
wxString fName ;
|
||||
FSRef theRef ;
|
||||
|
||||
wxArrayString fileNames;
|
||||
|
||||
for (i = 1; i <= itemsInList; i++)
|
||||
{
|
||||
@@ -240,9 +242,10 @@ short wxApp::MacHandleAEPDoc(const WXEVENTREF event , WXEVENTREF WXUNUSED(reply)
|
||||
return err;
|
||||
|
||||
fName = wxMacFSRefToPath( &theRef ) ;
|
||||
|
||||
MacPrintFile(fName);
|
||||
files += fName;
|
||||
}
|
||||
|
||||
MacPrintFiles(fileNames);
|
||||
|
||||
return noErr;
|
||||
}
|
||||
@@ -307,6 +310,16 @@ void wxApp::MacOpenURL(const wxString & WXUNUSED(url) )
|
||||
{
|
||||
}
|
||||
|
||||
void wxApp::MacPrintFiles(const wxArrayString & fileNames )
|
||||
{
|
||||
size_t i;
|
||||
const size_t fileCount = fileNames.GetCount();
|
||||
for (i = 0; i < fileCount; i++)
|
||||
{
|
||||
MacPrintFile(fileNames[i]);
|
||||
}
|
||||
}
|
||||
|
||||
void wxApp::MacPrintFile(const wxString & fileName )
|
||||
{
|
||||
#if wxUSE_DOC_VIEW_ARCHITECTURE
|
||||
|
@@ -86,12 +86,23 @@ void wxBell()
|
||||
wxTheApp->OSXStoreOpenFiles(fileList);
|
||||
}
|
||||
|
||||
- (BOOL)application:(NSApplication *)sender printFile:(NSString *)filename
|
||||
- (NSApplicationPrintReply)application:(NSApplication *)sender printFiles:(NSArray *)fileNames withSettings:(NSDictionary *)printSettings showPrintPanels:(BOOL)showPrintPanels
|
||||
{
|
||||
wxUnusedVar(sender);
|
||||
wxCFStringRef cf(wxCFRetain(filename));
|
||||
wxTheApp->MacPrintFile(cf.AsString()) ;
|
||||
return YES;
|
||||
wxArrayString fileList;
|
||||
size_t i;
|
||||
const size_t count = [fileNames count];
|
||||
for (i = 0; i < count; i++)
|
||||
{
|
||||
fileList.Add( wxCFStringRef::AsStringWithNormalizationFormC([fileNames objectAtIndex:i]) );
|
||||
}
|
||||
|
||||
if ( wxTheApp->OSXInitWasCalled() )
|
||||
wxTheApp->MacPrintFiles(fileList);
|
||||
else
|
||||
wxTheApp->OSXStorePrintFiles(fileList);
|
||||
|
||||
return NSPrintingSuccess;
|
||||
}
|
||||
|
||||
- (BOOL)applicationShouldHandleReopen:(NSApplication *)sender hasVisibleWindows:(BOOL)flag
|
||||
@@ -325,6 +336,10 @@ bool wxApp::CallOnInit()
|
||||
{
|
||||
if ( m_openFiles.GetCount() > 0 )
|
||||
MacOpenFiles(m_openFiles);
|
||||
else if ( m_printFiles.GetCount() > 0 )
|
||||
MacPrintFiles(m_printFiles);
|
||||
else if ( m_getURL.Len() > 0 )
|
||||
MacOpenURL(m_getURL);
|
||||
else
|
||||
MacNewFile();
|
||||
}
|
||||
|
Reference in New Issue
Block a user