]> git.saurik.com Git - wxWidgets.git/blobdiff - src/html/helpctrl.cpp
do take the toolbar into account for Windows CE, otherwise the menus overlap with...
[wxWidgets.git] / src / html / helpctrl.cpp
index 21a80600ec9193bc07bec0e3429a7dd7985aad32..5f0bc3fd68e44db3555a3f40bc13e88cb4953547 100644 (file)
@@ -9,7 +9,7 @@
 // Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
-#ifdef __GNUG__
+#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
 #pragma implementation "helpctrl.h"
 #endif
 
 #include "wx/html/helpctrl.h"
 #include "wx/busyinfo.h"
 
+#ifdef __WXGTK__
+    // for the hack in AddGrabIfNeeded()
+    #include "wx/dialog.h"
+#endif // __WXGTK__
+
 #if wxUSE_HELP
-#include "wx/tipwin.h"
+    #include "wx/tipwin.h"
+#endif
+    
+
+#if wxUSE_LIBMSPACK
+#include "wx/html/forcelnk.h"
+FORCE_LINK(wxhtml_chm_support)
 #endif
 
 IMPLEMENT_DYNAMIC_CLASS(wxHtmlHelpController, wxHelpControllerBase)
@@ -79,6 +90,11 @@ void wxHtmlHelpController::SetTitleFormat(const wxString& title)
 }
 
 
+bool wxHtmlHelpController::AddBook(const wxFileName& book_file, bool show_wait_msg)
+{
+    return AddBook(wxFileSystem::FileNameToURL(book_file), show_wait_msg);
+}
+
 bool wxHtmlHelpController::AddBook(const wxString& book, bool show_wait_msg)
 {
     wxBusyCursor cur;
@@ -132,6 +148,7 @@ void wxHtmlHelpController::CreateHelpWindow()
 
     m_helpFrame->Create(NULL, wxID_HTML_HELPFRAME, wxEmptyString, m_FrameStyle);
     m_helpFrame->SetTitleFormat(m_titleFormat);
+
     m_helpFrame->Show(TRUE);
 }
 
@@ -166,7 +183,7 @@ bool wxHtmlHelpController::Initialize(const wxString& file)
     wxSplitPath(file, & dir, & filename, & ext);
 
     if (!dir.IsEmpty())
-        dir = dir + wxString(wxT("/"));
+        dir = dir + wxFILE_SEP_PATH;
 
     // Try to find a suitable file
     wxString actualFilename = dir + filename + wxString(wxT(".zip"));
@@ -177,11 +194,16 @@ bool wxHtmlHelpController::Initialize(const wxString& file)
         {
             actualFilename = dir + filename + wxString(wxT(".hhp"));
             if (!wxFileExists(actualFilename))
-                return FALSE;
+            {
+#if wxUSE_LIBMSPACK
+                actualFilename = dir + filename + wxString(wxT(".chm"));
+                if (!wxFileExists(actualFilename))
+#endif
+                    return false;
+            }
         }
     }
-
-    return AddBook(actualFilename);
+    return AddBook(wxFileName(actualFilename));
 }
 
 bool wxHtmlHelpController::LoadFile(const wxString& WXUNUSED(file))
@@ -261,7 +283,7 @@ void wxHtmlHelpController::AddGrabIfNeeded()
     
     // Check if there are any modal windows present,
     // in which case we need to add a grab.
-    for ( wxWindowList::Node * node = wxTopLevelWindows.GetFirst();
+    for ( wxWindowList::compatibility_iterator node = wxTopLevelWindows.GetFirst();
           node;
           node = node->GetNext() )
     {
@@ -274,7 +296,7 @@ void wxHtmlHelpController::AddGrabIfNeeded()
 
     if (needGrab && m_helpFrame)
         m_helpFrame->AddGrab();
-#endif
+#endif // __WXGTK__
 }
 
 bool wxHtmlHelpController::Display(const wxString& x)
@@ -309,10 +331,11 @@ bool wxHtmlHelpController::DisplayIndex()
     return success;
 }
 
-bool wxHtmlHelpController::KeywordSearch(const wxString& keyword)
+bool wxHtmlHelpController::KeywordSearch(const wxString& keyword,
+                                         wxHelpSearchMode mode)
 {
     CreateHelpWindow();
-    bool success = m_helpFrame->KeywordSearch(keyword);
+    bool success = m_helpFrame->KeywordSearch(keyword, mode);
     AddGrabIfNeeded();
     return success;
 }