Contents Up Previous Next

wxHtmlHelpController

WARNING! This help controller has an API incompatible with wxWindows wxHelpController!

This help controller provides an easy way of displaying HTML help in your application (see test sample). The help system is based on books (see AddBook). A book is a logical section of documentation (for example "User's Guide" or "Programmer's Guide" or "C++ Reference" or "wxWindows Reference"). The help controller can handle as many books as you want.

wxHTML uses Microsoft's HTML Help Workshop project files (.hhp, .hhk, .hhc) as its native format. The file format is described here. Have a look at docs/html/ directory where sample project files are stored.

You can use Tex2RTF to produce these files when generating HTML, if you set htmlWorkshopFiles to true in your tex2rtf.ini file.

In order to use the controller in your application under Windows you must have the following line in your .rc file:

#include "wx/html/msw/wxhtml.rc"
Derived from

wxEvtHandler

Members

wxHtmlHelpController::wxHtmlHelpController
wxHtmlHelpController::AddBook
wxHtmlHelpController::Display
wxHtmlHelpController::DisplayContents
wxHtmlHelpController::DisplayIndex
wxHtmlHelpController::KeywordSearch
wxHtmlHelpController::ReadCustomization
wxHtmlHelpController::SetTempDir
wxHtmlHelpController::SetTitleFormat
wxHtmlHelpController::UseConfig
wxHtmlHelpController::WriteCustomization


wxHtmlHelpController::wxHtmlHelpController

wxHtmlHelpController(int style = wxHF_DEFAULTSTYLE)

Constructor.

Parameters

style is combination of these flags:

wxHF_TOOLBAR Help frame has toolbar.
wxHF_CONTENTS Help frame has contents panel.
wxHF_INDEX Help frame has index panel.
wxHF_SEARCH Help frame has search panel.

Default value : everything enabled.


wxHtmlHelpController::AddBook

bool AddBook(const wxString& book, bool show_wait_msg)

Adds book (.hhp file - HTML Help Workshop project file) into the list of loaded books. This must be called at least once before displaying any help.

book may be either .hhp file or ZIP archive that contains arbitrary number of .hhp files in top-level directory. This ZIP archive must have .zip or .htb extension (the latter stands for "HTML book"). In other words, AddBook("help.zip") is possible and, in fact, recommended way.

If show_wait_msg is TRUE then a decorationless window with progress message is displayed.


wxHtmlHelpController::Display

void Display(const wxString& x)

Displays page x. This is THE important function - it is used to display the help in application.

You can specify the page in many ways:

Looking for the page runs in these steps:

  1. try to locate file named x (if x is for example "doc/howto.htm")
  2. try to open starting page of book named x
  3. try to find x in contents (if x is for example "How To ...")
  4. try to find x in index (if x is for example "How To ...")
  5. switch to Search panel and start searching

void Display(const int id)

This alternative form is used to search help contents by numeric IDs.

wxPython note: The second form of this method is named DisplayId in wxPython.


wxHtmlHelpController::DisplayContents

void DisplayContents()

Displays help window and focuses contents panel.


wxHtmlHelpController::DisplayIndex

void DisplayIndex()

Displays help window and focuses index panel.


wxHtmlHelpController::KeywordSearch

bool KeywordSearch(const wxString& keyword)

Displays help window, focuses search panel and starts searching. Returns TRUE if the keyword was found.

Important: KeywordSearch searches only pages listed in .htc file(s). You should list all pages in the contents file.


wxHtmlHelpController::ReadCustomization

void ReadCustomization(wxConfigBase* cfg, wxString path = wxEmptyString)

Reads the controller's setting (position of window, etc.)


wxHtmlHelpController::SetTempDir

void SetTempDir(const wxString& path)

Sets the path for storing temporary files - cached binary versions of index and contents files. These binary forms are much faster to read. Default value is empty string (empty string means that no cached data are stored). Note that these files are not deleted when program exits.


wxHtmlHelpController::SetTitleFormat

void SetTitleFormat(const wxString& format)

Sets format of title of the frame. Must contain exactly one "%s" (for title of displayed HTML page).


wxHtmlHelpController::UseConfig

void UseConfig(wxConfigBase* config, const wxString& rootpath = wxEmptyString)

Associates config object with the controller.

If there is associated config object, wxHtmlHelpController automatically reads and writes settings (including wxHtmlWindow's settings) when needed.

The only thing you must do is create wxConfig object and call UseConfig.


wxHtmlHelpController::WriteCustomization

void WriteCustomization(wxConfigBase* cfg, wxString path = wxEmptyString)

Stores controllers setting (position of window etc.)