2008-03-08 08:52:38 -05:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Name: html/helpctrl.h
|
2008-03-10 11:24:38 -04:00
|
|
|
// Purpose: interface of wxHtmlHelpController
|
2008-03-08 08:52:38 -05:00
|
|
|
// Author: wxWidgets team
|
|
|
|
// RCS-ID: $Id$
|
|
|
|
// Licence: wxWindows license
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
/**
|
|
|
|
@class wxHtmlHelpController
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
This help controller provides an easy way of displaying HTML help in your
|
2008-03-08 09:43:31 -05:00
|
|
|
application (see @e test sample). The help system is based on @b books
|
2008-03-08 08:52:38 -05:00
|
|
|
(see wxHtmlHelpController::AddBook). A book is a logical
|
|
|
|
section of documentation (for example "User's Guide" or "Programmer's Guide" or
|
|
|
|
"C++ Reference" or "wxWidgets Reference"). The help controller can handle as
|
|
|
|
many books as you want.
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
Although this class has an API compatible with other wxWidgets
|
|
|
|
help controllers as documented by wxHelpController, it
|
|
|
|
is recommended that you use the enhanced capabilities of wxHtmlHelpController's
|
|
|
|
API.
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
wxHTML uses Microsoft's HTML Help Workshop project files (.hhp, .hhk, .hhc) as
|
|
|
|
its
|
2008-03-10 11:24:38 -04:00
|
|
|
native format. The file format is described here().
|
2008-03-08 08:52:38 -05:00
|
|
|
Have a look at docs/html/ directory where sample project files are stored.
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
You can use Tex2RTF to produce these files when generating HTML, if you set @b
|
|
|
|
htmlWorkshopFiles to @b @true in
|
|
|
|
your tex2rtf.ini file. The commercial tool HelpBlocks (www.helpblocks.com) can
|
|
|
|
also create these files.
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
@library{wxhtml}
|
|
|
|
@category{help}
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-03-10 11:24:38 -04:00
|
|
|
@see @ref overview_wxhelpcontroller "Information about wxBestHelpController",
|
2008-03-08 08:52:38 -05:00
|
|
|
wxHtmlHelpFrame, wxHtmlHelpDialog, wxHtmlHelpWindow, wxHtmlModalHelp
|
|
|
|
*/
|
2008-03-08 09:43:31 -05:00
|
|
|
class wxHtmlHelpController
|
2008-03-08 08:52:38 -05:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
/**
|
|
|
|
Constructor.
|
|
|
|
*/
|
|
|
|
wxHtmlHelpController(int style = wxHF_DEFAULT_STYLE,
|
2008-03-09 08:33:59 -04:00
|
|
|
wxWindow* parentWindow = NULL);
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
//@{
|
|
|
|
/**
|
|
|
|
Adds book (@ref overview_helpformat ".hhp file" - HTML Help Workshop project
|
|
|
|
file) into the list of loaded books.
|
|
|
|
This must be called at least once before displaying any help.
|
2008-03-09 08:33:59 -04:00
|
|
|
@a bookFile or @a bookUrl may be either .hhp file or ZIP archive
|
2008-03-08 09:43:31 -05:00
|
|
|
that contains arbitrary number of .hhp files in
|
2008-03-08 08:52:38 -05:00
|
|
|
top-level directory. This ZIP archive must have .zip or .htb extension
|
|
|
|
(the latter stands for "HTML book"). In other words, @c
|
2008-03-08 09:43:31 -05:00
|
|
|
AddBook(wxFileName("help.zip"))
|
2008-03-08 08:52:38 -05:00
|
|
|
is possible and is the recommended way.
|
|
|
|
|
2008-03-08 09:43:31 -05:00
|
|
|
@param showWaitMsg
|
2008-03-09 08:33:59 -04:00
|
|
|
If @true then a decoration-less window with progress message is displayed.
|
2008-03-08 09:43:31 -05:00
|
|
|
@param bookFile
|
2008-03-09 08:33:59 -04:00
|
|
|
Help book filename. It is recommended to use this prototype
|
|
|
|
instead of the one taking URL, because it is less error-prone.
|
2008-03-08 09:43:31 -05:00
|
|
|
@param bookUrl
|
2008-03-09 08:33:59 -04:00
|
|
|
Help book URL (note that syntax of filename and URL is
|
|
|
|
different on most platforms)
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
|
|
|
bool AddBook(const wxFileName& bookFile, bool showWaitMsg);
|
2008-03-08 09:43:31 -05:00
|
|
|
bool AddBook(const wxString& bookUrl, bool showWaitMsg);
|
2008-03-08 08:52:38 -05:00
|
|
|
//@}
|
|
|
|
|
|
|
|
/**
|
|
|
|
This protected virtual method may be overridden so that when specifying the
|
|
|
|
wxHF_DIALOG style, the controller
|
|
|
|
uses a different dialog.
|
|
|
|
*/
|
2008-03-09 08:33:59 -04:00
|
|
|
virtual wxHtmlHelpDialog* CreateHelpDialog(wxHtmlHelpData* data);
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
This protected virtual method may be overridden so that the controller
|
|
|
|
uses a different frame.
|
|
|
|
*/
|
2008-03-09 08:33:59 -04:00
|
|
|
virtual wxHtmlHelpFrame* CreateHelpFrame(wxHtmlHelpData* data);
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
//@{
|
|
|
|
/**
|
|
|
|
This alternative form is used to search help contents by numeric IDs.
|
|
|
|
*/
|
|
|
|
void Display(const wxString& x);
|
2008-03-08 09:43:31 -05:00
|
|
|
void Display(const int id);
|
2008-03-08 08:52:38 -05:00
|
|
|
//@}
|
|
|
|
|
|
|
|
/**
|
|
|
|
Displays help window and focuses contents panel.
|
|
|
|
*/
|
|
|
|
void DisplayContents();
|
|
|
|
|
|
|
|
/**
|
|
|
|
Displays help window and focuses index panel.
|
|
|
|
*/
|
|
|
|
void DisplayIndex();
|
|
|
|
|
|
|
|
/**
|
|
|
|
Displays help window, focuses search panel and starts searching. Returns @true
|
|
|
|
if the keyword was found. Optionally it searches through the index (mode =
|
|
|
|
wxHELP_SEARCH_INDEX), default the content (mode = wxHELP_SEARCH_ALL).
|
|
|
|
@b Important: KeywordSearch searches only pages listed in .hhc file(s).
|
|
|
|
You should list all pages in the contents file.
|
|
|
|
*/
|
|
|
|
bool KeywordSearch(const wxString& keyword,
|
|
|
|
wxHelpSearchMode mode = wxHELP_SEARCH_ALL);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Reads the controller's setting (position of window, etc.)
|
|
|
|
*/
|
|
|
|
void ReadCustomization(wxConfigBase* cfg,
|
|
|
|
wxString path = wxEmptyString);
|
|
|
|
|
|
|
|
/**
|
|
|
|
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
|
2008-03-08 09:43:31 -05:00
|
|
|
that no cached data are stored). Note that these files are @e not
|
2008-03-08 08:52:38 -05:00
|
|
|
deleted when program exits.
|
2008-03-08 09:43:31 -05:00
|
|
|
Once created these cached files will be used in all subsequent executions
|
2008-03-08 08:52:38 -05:00
|
|
|
of your application. If cached files become older than corresponding .hhp
|
|
|
|
file (e.g. if you regenerate documentation) it will be refreshed.
|
|
|
|
*/
|
|
|
|
void SetTempDir(const wxString& path);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Sets format of title of the frame. Must contain exactly one "%s"
|
|
|
|
(for title of displayed HTML page).
|
|
|
|
*/
|
|
|
|
void SetTitleFormat(const wxString& format);
|
|
|
|
|
|
|
|
/**
|
2008-03-09 08:33:59 -04:00
|
|
|
Associates @a config object with the controller.
|
2008-03-08 08:52:38 -05:00
|
|
|
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.
|
2008-03-08 09:43:31 -05:00
|
|
|
If you do not use @e UseConfig, wxHtmlHelpController will use
|
|
|
|
default wxConfig object if available (for details see
|
|
|
|
wxConfigBase::Get and
|
2008-03-08 08:52:38 -05:00
|
|
|
wxConfigBase::Set).
|
|
|
|
*/
|
|
|
|
void UseConfig(wxConfigBase* config,
|
|
|
|
const wxString& rootpath = wxEmptyString);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Stores controllers setting (position of window etc.)
|
|
|
|
*/
|
|
|
|
void WriteCustomization(wxConfigBase* cfg,
|
|
|
|
wxString path = wxEmptyString);
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2008-03-10 11:24:38 -04:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
/**
|
|
|
|
@class wxHtmlModalHelp
|
2008-03-08 09:43:31 -05:00
|
|
|
|
|
|
|
This class uses wxHtmlHelpController
|
2008-03-08 08:52:38 -05:00
|
|
|
to display help in a modal dialog. This is useful on platforms such as wxMac
|
|
|
|
where if you display help from a modal dialog, the help window must itself be a
|
|
|
|
modal
|
|
|
|
dialog.
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
Create objects of this class on the stack, for example:
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
@code
|
|
|
|
// The help can be browsed during the lifetime of this object; when the user
|
|
|
|
quits
|
|
|
|
// the help, program execution will continue.
|
|
|
|
wxHtmlModalHelp help(parent, wxT("help"), wxT("My topic"));
|
|
|
|
@endcode
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
@library{wxhtml}
|
|
|
|
@category{FIXME}
|
|
|
|
*/
|
2008-03-08 09:43:31 -05:00
|
|
|
class wxHtmlModalHelp
|
2008-03-08 08:52:38 -05:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
/**
|
2008-03-08 09:43:31 -05:00
|
|
|
@param parent
|
2008-03-09 08:33:59 -04:00
|
|
|
is the parent of the dialog.
|
2008-03-08 09:43:31 -05:00
|
|
|
@param helpFile
|
2008-03-09 08:33:59 -04:00
|
|
|
is the HTML help file to show.
|
2008-03-08 09:43:31 -05:00
|
|
|
@param topic
|
2008-03-09 08:33:59 -04:00
|
|
|
is an optional topic. If this is empty, the help contents will be shown.
|
2008-03-08 09:43:31 -05:00
|
|
|
@param style
|
2008-03-09 08:33:59 -04:00
|
|
|
is a combination of the flags described in the wxHtmlHelpController
|
2008-03-08 08:52:38 -05:00
|
|
|
documentation.
|
|
|
|
*/
|
|
|
|
wxHtmlModalHelp(wxWindow* parent, const wxString& helpFile,
|
|
|
|
const wxString& topic = wxEmptyString,
|
|
|
|
int style = wxHF_DEFAULT_STYLE | wxHF_DIALOG | wxHF_MODAL);
|
|
|
|
};
|
2008-03-10 11:24:38 -04:00
|
|
|
|