]> git.saurik.com Git - wxWidgets.git/blobdiff - utils/helpview/src/helpview.cpp
Add wxBitmap::GetNSImage() which creates an autoreleased NSImage either
[wxWidgets.git] / utils / helpview / src / helpview.cpp
index 40202308466f47c0e67439c3cc062790dd1b5108..e288092dcb4007879d767ac521e57abbd7bbd4f1 100644 (file)
@@ -27,6 +27,7 @@
 #include "wx/wx.h"
 #endif
 
+#include "wx/filename.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);
        
+#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;
@@ -138,16 +144,16 @@ 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"),
                        wxGetCwd(),
                        wxEmptyString,
                        wxEmptyString,
-                       wxT(
-                       "Help books (*.htb)|*.htb|Help books (*.zip)|*.zip|\
-                       HTML Help Project (*.hhp)|*.hhp"),
+                       wxT("Help books (*.htb)|*.htb|Help books (*.zip)|*.zip|HTML Help Project (*.hhp)|*.hhp"),
                        wxOPEN | wxFILE_MUST_EXIST,
                        NULL);
                
@@ -157,7 +163,8 @@ bool hvApp::OnInit()
                        bookCount = 1;
                }
     } 
-       
+#endif
+    
 #if hvUSE_IPC
        
     if ( createServer ) {
@@ -217,11 +224,11 @@ bool hvApp::OnInit()
 int hvApp::OnExit()
 {
 #if hvUSE_IPC
-    wxNode* node = m_connections.First();
+    wxNode* node = m_connections.GetFirst();
     while (node)
     {
-        wxNode* next = node->Next();
-        hvConnection* connection = (hvConnection*) node->Data();
+        wxNode* next = node->GetNext();
+        hvConnection* connection = (hvConnection*) node->GetData();
         connection->Disconnect();
         delete connection;
         node = next;
@@ -267,6 +274,18 @@ bool hvApp::OpenBook(wxHtmlHelpController* controller)
     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
 */