]> git.saurik.com Git - wxWidgets.git/commitdiff
wxHTMLHelpController compiles (and somewhat works) under Windows, added a
authorVadim Zeitlin <vadim@wxwidgets.org>
Tue, 22 Jun 1999 21:20:48 +0000 (21:20 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Tue, 22 Jun 1999 21:20:48 +0000 (21:20 +0000)
(compile-time) option to the sample to always use HTML help, even under MSW.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@2870 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

samples/help/demo.cpp
src/generic/helpext.cpp
src/generic/helphtml.cpp

index 087af6fc04d6a47207982db317691d2c4d3c3828..f8f5312abf41334fa8411a598a48ee577994ac92 100644 (file)
@@ -16,6 +16,7 @@
 // ----------------------------------------------------------------------------
 // headers
 // ----------------------------------------------------------------------------
+
 #ifdef __GNUG__
     #pragma implementation "demo.cpp"
     #pragma interface "demo.cpp"
     #include "wx/wx.h"
 #endif
 
-#include "wx/help.h"
+// defien this to 1 to use HTML help even under Windows (by default, Windows
+// version will HLP-based help)
+#define USE_HTML_HELP 1
+
+#if USE_HTML_HELP
+    #include "wx/helpbase.h"
+    #include "wx/generic/helpext.h"
+
+    #define wxHelpController wxExtHelpController
+    #define sm_classwxHelpController sm_classwxExtHelpController
+#else
+    #include "wx/help.h"
+#endif
 
 // ----------------------------------------------------------------------------
 // ressources
@@ -73,7 +86,8 @@ public:
     void OnHelp(wxCommandEvent& event);
 
 private:
-   wxHelpController  help;
+   wxHelpController m_help;
+
     // any class wishing to process wxWindows events must use this macro
    DECLARE_EVENT_TABLE()
 };
@@ -198,9 +212,10 @@ MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size)
     // and a static control whose parent is the panel
     (void)new wxStaticText(panel, -1, "Hello, world!", wxPoint(10, 10));
 
-    // initialise the help system
-    help.Initialize("doc");
-   
+    // initialise the help system: this means that we'll use doc.hlp file under
+    // Windows and that the HTML docs are in the subdirectory doc for platforms
+    // using HTML help
+    m_help.Initialize("doc");
 }
 
 
@@ -221,25 +236,25 @@ void MyFrame::OnHelp(wxCommandEvent& event)
    // (on Unix). For WinHelp, we'd need to use different context ids.
 
    case HelpDemo_Help_Classes:
-      help.DisplaySection(1);
+      m_help.DisplaySection(1);
       break;
    case HelpDemo_Help_Functions:
-      help.DisplaySection(2);
+      m_help.DisplaySection(4);
       break;
    case HelpDemo_Help_Help:
-      help.DisplaySection(5);
+      m_help.DisplaySection(5);
       break;
 
    // These three calls are only used by wxExtHelpController
 
    case HelpDemo_Help_KDE:
-      help.SetViewer("kdehelp");
+      m_help.SetViewer("kdehelp");
       break;
    case HelpDemo_Help_GNOME:
-      help.SetViewer("gnome-help-browser");
+      m_help.SetViewer("gnome-help-browser");
       break;
    case HelpDemo_Help_Netscape:
-      help.SetViewer("netscape", wxHELP_NETSCAPE);
+      m_help.SetViewer("netscape", wxHELP_NETSCAPE);
       break;
 
    case HelpDemo_Help_Search:
@@ -249,12 +264,12 @@ void MyFrame::OnHelp(wxCommandEvent& event)
                                        "",
                                        this);
       if(! key.IsEmpty())
-         help.KeywordSearch(key);
+         m_help.KeywordSearch(key);
    }
    break;
    case HelpDemo_Help_Index:
    default:
-      help.DisplayContents();
+      m_help.DisplayContents();
       break;
    }
 }
index aba6fd516ba60108b31660c3ed15a771ffe8a4a6..817b73c401a2504c77c3b840e0a30637f501b07f 100644 (file)
@@ -1,24 +1,42 @@
-/*-*- c++ -*-********************************************************
- * helpext.cpp - an external help controller for wxWindows          *
- *                                                                  *
- * (C) 1999 by Karsten Ballüder (Ballueder@usa.net)                 *
- *                                                                  *
- * $Id$
- *******************************************************************/
+/////////////////////////////////////////////////////////////////////////////
+// Name:        helpext.cpp
+// Purpose:     an external help controller for wxWindows
+// Author:      Karsten Ballueder
+// Modified by:
+// Created:     04/01/98
+// RCS-ID:      $Id$
+// Copyright:   (c) Karsten Ballueder
+// Licence:     wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
 #ifdef __GNUG__
 #   pragma implementation "wxexthlp.h"
 #endif
 
-#include   "wx/setup.h"
-#include   "wx/helpbase.h"
-#include   "wx/generic/helpext.h"
-#include   "wx/string.h"
-#include   "wx/utils.h"
-#include   "wx/list.h"
-#include   <stdio.h>
-#include   <ctype.h>
-#include   <sys/stat.h>
-#include   <unistd.h>
+#include "wx/wxprec.h"
+
+#ifdef __BORLANDC__
+    #pragma hdrstop
+#endif
+
+#ifndef WX_PRECOMP
+    #include "wx/setup.h"
+    #include "wx/string.h"
+    #include "wx/utils.h"
+    #include "wx/list.h"
+    #include "wx/intl.h"
+#endif
+
+#include "wx/helpbase.h"
+#include "wx/generic/helpext.h"
+
+#include <stdio.h>
+#include <ctype.h>
+#include <sys/stat.h>
+
+#ifndef __WINDOWS__
+    #include   <unistd.h>
+#endif
 
 IMPLEMENT_CLASS(wxExtHelpController, wxHTMLHelpControllerBase)
    
@@ -63,8 +81,10 @@ wxExtHelpController::DisplayHelp(wxString const &relativeURL)
 
 
 #ifdef __WXMSW__
-   bool bOk = (int)ShellExecute(NULL, "open", relativeURL.c_str(),
-                           NULL, NULL, SW_SHOWNORMAL ) > 32;
+   wxString url;
+   url << m_MapFile << '\\' << relativeURL.BeforeFirst('#');
+   bool bOk = (int)ShellExecute(NULL, "open", url,
+                                NULL, NULL, SW_SHOWNORMAL ) > 32;
    if ( !bOk )
    {
       wxLogSysError(_("Cannot open URL '%s'"), relativeURL.c_str());
index b7885919ca6f21e9bf71cabf08ae0b2ecef90757..3c546e1bd2cc79c727c40d127d49fb0cf981042b 100644 (file)
@@ -1,27 +1,42 @@
-/*-*- c++ -*-********************************************************
- * helphtml.cpp - base class for html help systems                  *
- *                                                                  *
- * (C) 1999 by Karsten Ballüder (Ballueder@usa.net)                 *
- *                                                                  *
- * $Id$
- *******************************************************************/
+/////////////////////////////////////////////////////////////////////////////
+// Name:        helphtml.cpp
+// Purpose:     base class for html help systems
+// Author:      Karsten Ballueder
+// Modified by:
+// Created:     04/01/98
+// RCS-ID:      $Id$
+// Copyright:   (c) Karsten Ballueder
+// Licence:     wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
 #ifdef __GNUG__
 #   pragma implementation "helphtml.h"
 #endif
 
-#include   "wx/setup.h"
-#include   "wx/helpbase.h"
-#include   "wx/generic/helpext.h"
-#include   "wx/string.h"
-#include   "wx/utils.h"
-#include   "wx/list.h"
-#include   "wx/intl.h"
-#include   <stdio.h>
-#include   <ctype.h>
-#include   <sys/stat.h>
-#include   <unistd.h>
+#include "wx/wxprec.h"
+
+#ifdef __BORLANDC__
+    #pragma hdrstop
+#endif
 
+#ifndef WX_PRECOMP
+    #include "wx/setup.h"
+    #include "wx/string.h"
+    #include "wx/utils.h"
+    #include "wx/list.h"
+    #include "wx/intl.h"
+#endif
 
+#include "wx/helpbase.h"
+#include "wx/generic/helpext.h"
+
+#include <stdio.h>
+#include <ctype.h>
+#include <sys/stat.h>
+
+#ifndef __WINDOWS__
+    #include   <unistd.h>
+#endif
 
 class wxExtHelpMapEntry : public wxObject
 {