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