1% 2% automatically generated by HelpGen from 3% htmlhelp.h at 02/May/99 19:58:53 4% 5 6\section{\class{wxHtmlHelpController}}\label{wxhtmlhelpcontroller} 7 8This help controller provides an easy way of displaying HTML help in your 9application (see {\it test} sample). The help system is based on {\bf books} 10(see \helpref{AddBook}{wxhtmlhelpcontrolleraddbook}). A book is a logical 11section of documentation (for example "User's Guide" or "Programmer's Guide" or 12"C++ Reference" or "wxWidgets Reference"). The help controller can handle as 13many books as you want. 14 15Although this class has an API compatible with other wxWidgets 16help controllers as documented by \helpref{wxHelpController}{wxhelpcontroller}, it 17is recommended that you use the enhanced capabilities of wxHtmlHelpController's API. 18 19wxHTML uses Microsoft's HTML Help Workshop project files (.hhp, .hhk, .hhc) as its 20native format. The file format is described \helpref{here}{helpformat}. 21Have a look at docs/html/ directory where sample project files are stored. 22 23You can use Tex2RTF to produce these files when generating HTML, if you set {\bf htmlWorkshopFiles} to {\bf true} in 24your tex2rtf.ini file. The commercial tool HelpBlocks (www.helpblocks.com) can also create these files. 25 26\wxheading{Note} 27 28It is strongly recommended to use preprocessed {\bf .hhp.cached} version of 29projects. It can be either created on-the-fly (see 30\helpref{SetTempDir}{wxhtmlhelpcontrollersettempdir}) or you can use 31{\bf hhp2cached} utility from {\it utils/hhp2cached} to create it and 32distribute the cached version together with helpfiles. See {\it samples/html/help} 33sample for demonstration of its use. 34 35\wxheading{See also} 36 37\helpref{Information about wxBestHelpController}{wxhelpcontroller}, 38\helpref{wxHtmlHelpFrame}{wxhtmlhelpframe}, 39\helpref{wxHtmlHelpDialog}{wxhtmlhelpdialog}, 40\helpref{wxHtmlHelpWindow}{wxhtmlhelpwindow}, 41\helpref{wxHtmlModalHelp}{wxhtmlmodalhelp} 42 43\wxheading{Derived from} 44 45wxHelpControllerBase 46 47\wxheading{Include files} 48 49<wx/html/helpctrl.h> 50 51\latexignore{\rtfignore{\wxheading{Members}}} 52 53\membersection{wxHtmlHelpController::wxHtmlHelpController}\label{wxhtmlhelpcontrollerwxhtmlhelpcontroller} 54 55\func{}{wxHtmlHelpController}{\param{int }{style = wxHF\_DEFAULT\_STYLE}, \param{wxWindow* }{parentWindow = NULL}} 56 57Constructor. 58 59\wxheading{Parameters} 60 61{\it style} is a combination of these flags: 62 63\begin{twocollist}\itemsep=0pt 64\twocolitem{\windowstyle{wxHF\_TOOLBAR}}{The help window has a toolbar.} 65\twocolitem{\windowstyle{wxHF\_FLAT\_TOOLBAR}}{The help window has a toolbar with flat buttons (aka coolbar).} 66\twocolitem{\windowstyle{wxHF\_CONTENTS}}{The help window has a contents panel.} 67\twocolitem{\windowstyle{wxHF\_INDEX}}{The help window has an index panel.} 68\twocolitem{\windowstyle{wxHF\_SEARCH}}{The help window has a search panel.} 69\twocolitem{\windowstyle{wxHF\_BOOKMARKS}}{The help window has bookmarks controls.} 70\twocolitem{\windowstyle{wxHF\_OPEN\_FILES}}{Allows user to open arbitrary HTML document.} 71\twocolitem{\windowstyle{wxHF\_PRINT}}{The toolbar contains "print" button.} 72\twocolitem{\windowstyle{wxHF\_MERGE\_BOOKS}}{The contents pane does not show 73book nodes. All books are merged together and appear as single book to the 74user.} 75\twocolitem{\windowstyle{wxHF\_ICONS\_BOOK}}{All nodes in contents pane 76have a book icon. This is how Microsoft's HTML help viewer behaves.} 77\twocolitem{\windowstyle{wxHF\_ICONS\_FOLDER}}{Book nodes in contents pane have 78a book icon, book's sections have a folder icon. This is the default.} 79\twocolitem{\windowstyle{wxHF\_ICONS\_BOOK\_CHAPTER}}{Both book nodes and 80nodes of top-level sections of a book (i.e. chapters) have a book icon, 81all other sections (sections, subsections, ...) have a folder icon.} 82\twocolitem{\windowstyle{wxHF\_EMBEDDED}}{Specifies that the help controller controls an embedded window of class \helpref{wxHtmlHelpWindow}{wxhtmlhelpwindow} that 83should not be destroyed when the controller is destroyed.} 84\twocolitem{\windowstyle{wxHF\_DIALOG}}{Specifies that the help controller should create a dialog containing the help window.} 85\twocolitem{\windowstyle{wxHF\_FRAME}}{Specifies that the help controller should create a frame containing the help window. This is the default if neither wxHF\_DIALOG nor wxHF\_EMBEDDED is specified.} 86\twocolitem{\windowstyle{wxHF\_MODAL}}{Specifies that the help controller should create a modal dialog containing the help window (used with the wxHF\_DIALOG style).} 87\twocolitem{\windowstyle{wxHF\_DEFAULT\_STYLE}}{{\tt wxHF\_TOOLBAR | wxHF\_CONTENTS 88| wxHF\_INDEX | wxHF\_SEARCH | wxHF\_BOOKMARKS | wxHF\_PRINT}} 89\end{twocollist} 90 91{\it parentWindow} is an optional window to be used as the parent for the help window. 92 93\membersection{wxHtmlHelpController::AddBook}\label{wxhtmlhelpcontrolleraddbook} 94 95\func{bool}{AddBook}{\param{const wxFileName\& }{bookFile}, \param{bool }{showWaitMsg}} 96 97\func{bool}{AddBook}{\param{const wxString\& }{bookUrl}, \param{bool }{showWaitMsg}} 98 99Adds book (\helpref{.hhp file}{helpformat} - HTML Help Workshop project file) into the list of loaded books. 100This must be called at least once before displaying any help. 101 102{\it bookFile} or {\it bookUrl} may be either .hhp file or ZIP archive 103that contains arbitrary number of .hhp files in 104top-level directory. This ZIP archive must have .zip or .htb extension 105(the latter stands for "HTML book"). In other words, {\tt AddBook(wxFileName("help.zip"))} 106is possible and is the recommended way. 107 108\wxheading{Parameters} 109 110\docparam{showWaitMsg}{If true then a decoration-less window with progress message is displayed.} 111\docparam{bookFile}{Help book filename. It is recommended to use this prototype 112instead of the one taking URL, because it is less error-prone.} 113\docparam{bookUrl}{Help book URL (note that syntax of filename and URL is 114different on most platforms)} 115 116\wxheading{Note} 117 118Don't forget to install the archive wxFileSystem handler with 119{\tt wxFileSystem::AddHandler(new wxArchiveFSHandler);} before calling this method 120on a .zip or .htb file! 121 122\membersection{wxHtmlHelpController::CreateHelpDialog}\label{wxhtmlhelpcontrollercreatehelpdialog} 123 124\func{virtual wxHtmlHelpDialog*}{CreateHelpDialog}{\param{wxHtmlHelpData * }{data}} 125 126This protected virtual method may be overridden so that when specifying the wxHF\_DIALOG style, the controller 127uses a different dialog. 128 129\membersection{wxHtmlHelpController::CreateHelpFrame}\label{wxhtmlhelpcontrollercreatehelpframe} 130 131\func{virtual wxHtmlHelpFrame*}{CreateHelpFrame}{\param{wxHtmlHelpData * }{data}} 132 133This protected virtual method may be overridden so that the controller 134uses a different frame. 135 136\membersection{wxHtmlHelpController::Display}\label{wxhtmlhelpcontrollerdisplay} 137 138\func{void}{Display}{\param{const wxString\& }{x}} 139 140Displays page {\it x}. This is THE important function - it is used to display 141the help in application. 142 143You can specify the page in many ways: 144 145\begin{itemize}\itemsep=0pt 146\item as direct filename of HTML document 147\item as chapter name (from contents) or as a book name 148\item as some word from index 149\item even as any word (will be searched) 150\end{itemize} 151 152Looking for the page runs in these steps: 153 154\begin{enumerate}\itemsep=0pt 155\item try to locate file named x (if x is for example "doc/howto.htm") 156\item try to open starting page of book named x 157\item try to find x in contents (if x is for example "How To ...") 158\item try to find x in index (if x is for example "How To ...") 159\item switch to Search panel and start searching 160\end{enumerate} 161 162\func{void}{Display}{\param{const int }{id}} 163 164This alternative form is used to search help contents by numeric IDs. 165 166\pythonnote{The second form of this method is named DisplayId in 167wxPython.} 168 169\membersection{wxHtmlHelpController::DisplayContents}\label{wxhtmlhelpcontrollerdisplaycontents} 170 171\func{void}{DisplayContents}{\void} 172 173Displays help window and focuses contents panel. 174 175\membersection{wxHtmlHelpController::DisplayIndex}\label{wxhtmlhelpcontrollerdisplayindex} 176 177\func{void}{DisplayIndex}{\void} 178 179Displays help window and focuses index panel. 180 181\membersection{wxHtmlHelpController::KeywordSearch}\label{wxhtmlhelpcontrollerkeywordsearch} 182 183\func{bool}{KeywordSearch}{\param{const wxString\& }{keyword}, \param{wxHelpSearchMode }{mode = wxHELP\_SEARCH\_ALL}} 184 185Displays help window, focuses search panel and starts searching. Returns true 186if the keyword was found. Optionally it searches through the index (mode = 187wxHELP\_SEARCH\_INDEX), default the content (mode = wxHELP\_SEARCH\_ALL). 188 189{\bf Important:} KeywordSearch searches only pages listed in .hhc file(s). 190You should list all pages in the contents file. 191 192\membersection{wxHtmlHelpController::ReadCustomization}\label{wxhtmlhelpcontrollerreadcustomization} 193 194\func{void}{ReadCustomization}{\param{wxConfigBase* }{cfg}, \param{wxString }{path = wxEmptyString}} 195 196Reads the controller's setting (position of window, etc.) 197 198\membersection{wxHtmlHelpController::SetTempDir}\label{wxhtmlhelpcontrollersettempdir} 199 200\func{void}{SetTempDir}{\param{const wxString\& }{path}} 201 202Sets the path for storing temporary files - cached binary versions of index and contents files. These binary 203forms are much faster to read. Default value is empty string (empty string means 204that no cached data are stored). Note that these files are {\it not} 205deleted when program exits. 206 207Once created these cached files will be used in all subsequent executions 208of your application. If cached files become older than corresponding .hhp 209file (e.g. if you regenerate documentation) it will be refreshed. 210 211\membersection{wxHtmlHelpController::SetTitleFormat}\label{wxhtmlhelpcontrollersettitleformat} 212 213\func{void}{SetTitleFormat}{\param{const wxString\& }{format}} 214 215Sets format of title of the frame. Must contain exactly one "\%s" 216(for title of displayed HTML page). 217 218\membersection{wxHtmlHelpController::UseConfig}\label{wxhtmlhelpcontrolleruseconfig} 219 220\func{void}{UseConfig}{\param{wxConfigBase* }{config}, \param{const wxString\& }{rootpath = wxEmptyString}} 221 222Associates {\it config} object with the controller. 223 224If there is associated config object, wxHtmlHelpController automatically 225reads and writes settings (including wxHtmlWindow's settings) when needed. 226 227The only thing you must do is create wxConfig object and call UseConfig. 228 229If you do not use {\it UseConfig}, wxHtmlHelpController will use 230default wxConfig object if available (for details see 231\helpref{wxConfigBase::Get}{wxconfigbaseget} and 232\helpref{wxConfigBase::Set}{wxconfigbaseset}). 233 234\membersection{wxHtmlHelpController::WriteCustomization}\label{wxhtmlhelpcontrollerwritecustomization} 235 236\func{void}{WriteCustomization}{\param{wxConfigBase* }{cfg}, \param{wxString }{path = wxEmptyString}} 237 238Stores controllers setting (position of window etc.) 239 240