]> git.saurik.com Git - wxWidgets.git/blobdiff - utils/helpview/src/helpview.cpp
Correction to splittree; removed newgrid sample reference from index.htm
[wxWidgets.git] / utils / helpview / src / helpview.cpp
index 40202308466f47c0e67439c3cc062790dd1b5108..22474726a273e0d91be8ab5dbcf69724fa8f9c18 100644 (file)
@@ -27,6 +27,7 @@
 #include "wx/wx.h"
 #endif
 
 #include "wx/wx.h"
 #endif
 
+#include "wx/filename.h"
 #include "wx/image.h"
 #include "wx/wxhtml.h"
 #include "wx/fs_zip.h"
 #include "wx/image.h"
 #include "wx/wxhtml.h"
 #include "wx/fs_zip.h"
@@ -60,6 +61,11 @@ bool hvApp::OnInit()
        
     wxArtProvider::PushProvider(new AlternateArtProvider);
        
        
     wxArtProvider::PushProvider(new AlternateArtProvider);
        
+#ifdef __WXMAC__
+    wxApp::s_macAboutMenuItemId = wxID_ABOUT;
+    wxFileName::MacRegisterDefaultTypeAndCreator( "htb" , 'HTBD' , 'HTBA' ) ;
+#endif
+
     int istyle = wxHF_DEFAULT_STYLE;
        
     wxString service, windowName, book[10], titleFormat, argStr;
     int istyle = wxHF_DEFAULT_STYLE;
        
     wxString service, windowName, book[10], titleFormat, argStr;
@@ -138,7 +144,9 @@ bool hvApp::OnInit()
                }
     }
        
                }
     }
        
-    //no book - query user
+    // No book - query user; but not on Mac, since there
+    // may be an AppleEvent to open a document on the way
+#ifndef __WXMAC__
     if ( bookCount < 1 )
     {
                wxString s = wxFileSelector( wxT("Open help file"),
     if ( bookCount < 1 )
     {
                wxString s = wxFileSelector( wxT("Open help file"),
@@ -157,7 +165,8 @@ bool hvApp::OnInit()
                        bookCount = 1;
                }
     } 
                        bookCount = 1;
                }
     } 
-       
+#endif
+    
 #if hvUSE_IPC
        
     if ( createServer ) {
 #if hvUSE_IPC
        
     if ( createServer ) {
@@ -267,6 +276,18 @@ bool hvApp::OpenBook(wxHtmlHelpController* controller)
     return FALSE;
 }
 
     return FALSE;
 }
 
+#ifdef __WXMAC__
+/// Respond to Apple Event for opening a document
+void hvApp::MacOpenFile(const wxString& filename)
+{
+    wxBusyCursor bcur;
+    wxFileName fileName(filename);
+    m_helpController->AddBook(fileName);
+    m_helpController->DisplayContents();
+}
+#endif
+
+
 /*
 * Art provider class
 */
 /*
 * Art provider class
 */