]> git.saurik.com Git - wxWidgets.git/blame - docs/latex/wx/helpinst.tex
Large parts rewritten and reorganized
[wxWidgets.git] / docs / latex / wx / helpinst.tex
CommitLineData
6fb26ea3 1\section{\class{wxHelpController}}\label{wxhelpcontroller}
a660d684 2
6fb26ea3 3This is a family of classes by which
fe604ccd 4applications may invoke a help viewer to provide on-line help.
a660d684 5
fe604ccd
JS
6A help controller allows an application to display help, at the contents
7or at a particular topic, and shut the help program down on termination.
8This avoids proliferation of many instances of the help viewer whenever the
9user requests a different topic via the application's menus or buttons.
a660d684 10
fe604ccd
JS
11Typically, an application will create a help controller instance
12when it starts, and immediately call {\bf Initialize}\rtfsp
13to associate a filename with it. The help viewer will only get run, however,
14just before the first call to display something.
a660d684 15
154f22b3
JS
16Most help controller classes actually derive from wxHelpControllerBase and have
17names of the form wxXXXHelpController or wxHelpControllerXXX. An
18appropriate class is aliased to the name wxHelpController for each platform, as follows:
19
20\begin{itemize}\itemsep=0pt
21\item On Windows, wxWinHelpController is used.
22\item On all other platforms, wxHelpControllerHtml is used if wxHTML is
23compiled into wxWindows; otherwise wxExtHelpController is used (for invoking an external
24browser).
25\end{itemize}
26
27The remaining help controller classess need to be named
28explicitly by an application that wishes to make use of them.
a660d684 29
6fb26ea3 30There are currently the following help controller classes defined:
a660d684 31
2432b92d 32\begin{itemize}\itemsep=0pt
6fb26ea3
JS
33\item wxWinHelpController, for controlling Windows Help.
34\item wxExtHelpController, for controlling external browsers under Unix.
154f22b3
JS
35The default browser is Netscape Navigator. The 'help' sample shows its use.
36\item wxHelpControllerHtml, using \helpref{wxHTML}{wxhtml} to display help. The API for this class
37is reasonably close to the wxWindows help controller API; see {\tt wx/helpwxht.h} for
38details of use.
39\item \helpref{wxHtmlHelpController}{wxhtmlhelpcontroller}, a more sophisticated help controller using \helpref{wxHTML}{wxhtml}, in
40a similar style to the Windows HTML Help viewer and using some of the same files.
41The API is not the same as the standard API, which is why it is documented separately.
42\item wxXLPHelpController, for controlling wxHelp (from wxWindows 1). Obsolete.
6fb26ea3 43\end{itemize}
a660d684 44
954b8ae6 45\wxheading{Derived from}
a660d684 46
6fb26ea3
JS
47wxHelpControllerBase\\
48\helpref{wxObject}{wxobject}
fe604ccd 49
954b8ae6 50\wxheading{Include files}
a660d684 51
dbdb39b2
JS
52<wx/help.h> (wxWindows chooses the appropriate help controller class)\\
53<wx/helpbase.h> (wxHelpControllerBase class)\\
54<wx/helpwin.h> (Windows Help controller)\\
33b64e6f 55<wx/generic/helpext.h> (external HTML browser controller)
db8db70a 56<wx/generic/helpwxht.h> (wxHTML based help controller)
33b64e6f 57<wx/generic/helpxlp.h> (wxHelp controller)
a660d684 58
154f22b3
JS
59\wxheading{See also}
60
61\helpref{wxHtmlHelpController}{wxhtmlhelpcontroller}, \helpref{wxHTML}{wxhtml}
62
a660d684
KB
63\latexignore{\rtfignore{\wxheading{Members}}}
64
6fb26ea3 65\membersection{wxHelpController::wxHelpController}
a660d684 66
6fb26ea3 67\func{}{wxHelpController}{\void}
a660d684 68
fe604ccd 69Constructs a help instance object, but does not invoke the help viewer.
a660d684 70
6fb26ea3 71\membersection{wxHelpController::\destruct{wxHelpController}}
a660d684 72
6fb26ea3 73\func{}{\destruct{wxHelpController}}{\void}
a660d684 74
fe604ccd 75Destroys the help instance, closing down the viewer if it is running.
a660d684 76
6fb26ea3 77\membersection{wxHelpController::Initialize}\label{wxhelpcontrollerinitialize}
a660d684 78
fe604ccd
JS
79\func{virtual void}{Initialize}{\param{const wxString\& }{file}}
80
81\func{virtual void}{Initialize}{\param{const wxString\& }{file}, \param{int}{ server}}
a660d684
KB
82
83Initializes the help instance with a help filename, and optionally a server (socket)
33b64e6f 84number if using wxHelp. Does not invoke the help viewer.
a660d684 85This must be called directly after the help instance object is created and before
fe604ccd
JS
86any attempts to communicate with the viewer.
87
88You may omit the file extension and a suitable one will be chosen.
a660d684 89
6fb26ea3 90\membersection{wxHelpController::DisplayBlock}\label{wxhelpcontrollerdisplayblock}
a660d684 91
fe604ccd 92\func{virtual bool}{DisplayBlock}{\param{long}{ blockNo}}
a660d684 93
fe604ccd 94If the help viewer is not running, runs it and displays the file at the given block number.
33b64e6f
JS
95
96{\it wxHelp:} this is the wxHelp block number.
97
98{\it WinHelp:} Refers to the context number.
99
100{\it External HTML help:} the same as for \helpref{wxHelpController::DisplaySection}{wxhelpcontrollerdisplaysection}.
a660d684 101
6fb26ea3 102\membersection{wxHelpController::DisplayContents}\label{wxhelpcontrollerdisplaycontents}
a660d684 103
fe604ccd 104\func{virtual bool}{DisplayContents}{\void}
a660d684 105
fe604ccd
JS
106If the help viewer is not running, runs it and displays the
107contents.
a660d684 108
6fb26ea3 109\membersection{wxHelpController::DisplaySection}\label{wxhelpcontrollerdisplaysection}
a660d684 110
fe604ccd 111\func{virtual bool}{DisplaySection}{\param{int}{ sectionNo}}
a660d684 112
fe604ccd 113If the help viewer is not running, runs it and displays the given section.
a660d684 114
33b64e6f
JS
115{\it wxHelp:} Sections are numbered starting from 1. Section numbers may be viewed by running wxHelp in edit mode.
116
117{\it WinHelp:} {\it sectionNo} is a context id.
a660d684 118
db8db70a 119{\it External HTML help/wxHTML based help:} wxExtHelpController and wxHelpControllerHtml implement {\it sectionNo} as an id in a map file, which is of the form:
33b64e6f
JS
120
121\begin{verbatim}
1220 wx.html ; Index
1231 wx34.html#classref ; Class reference
1242 wx204.html ; Function reference
125\end{verbatim}
a660d684 126
6fb26ea3 127\membersection{wxHelpController::KeywordSearch}\label{wxhelpcontrollerkeywordsearch}
a660d684 128
fe604ccd
JS
129\func{virtual bool}{KeywordSearch}{\param{const wxString\& }{keyWord}}
130
131If the help viewer is not running, runs it, and searches for sections matching the given keyword. If one
33b64e6f
JS
132match is found, the file is displayed at this section.
133
134{\it wxHelp:} If more than one
135match is found, the Search dialog is displayed with the matches.
136
137{\it WinHelp:} If more than one match is found,
138the first topic is displayed.
139
140{\it External HTML help:} If more than one match is found,
141a choice of topics is displayed.
a660d684 142
6fb26ea3 143\membersection{wxHelpController::LoadFile}\label{wxhelpcontrollerloadfile}
a660d684 144
33b64e6f 145\func{virtual bool}{LoadFile}{\param{const wxString\& }{file = ""}}
a660d684 146
fe604ccd
JS
147If the help viewer is not running, runs it and loads the given file.
148If the filename is not supplied or is
149NULL, the file specified in {\bf Initialize} is used. If the viewer is
a660d684
KB
150already displaying the specified file, it will not be reloaded. This
151member function may be used before each display call in case the user
152has opened another file.
153
33b64e6f
JS
154\membersection{wxHelpController::SetViewer}\label{wxhelpcontrollersetviewer}
155
156\func{virtual void}{SetViewer}{\param{const wxString\& }{viewer}, \param{long}{ flags}}
157
158Sets detailed viewer information. So far this is only relevant to wxExtHelpController.
159
db8db70a
KB
160\membersection{wxHelpController::SetFrameParameters}\label{wxhelpcontrollersetframeparameters}
161\func{virtual void}{SetFrameParameters}
162{\param{const wxString \& }{title},
163 \param{const wxSize \& }{size}, \param{const wxPoint \& }{pos = wxDefaultPosition},
164 \param{bool }{newFrameEachTime = FALSE}}
165
166For the wxHelpControllerHtml, this allows the application to set the
167default frame title, size and position for the frame. If the title
168contains \%s, this will be replaced with the page title. If the
169parammeter newFrameEachTime is set, the controller will open a new
170help frame each time it is called. For all other help controllers this
171function has no effect.
172
173\membersection{wxHelpController::GetFrameParameters}\label{wxhelpcontrollergetframeparameters}
174\func{virtual wxFrame *}{GetFrameParameters}
175{\param{const wxSize * }{size = NULL}, \param{const wxPoint * }{pos = NULL},
176 \param{bool *}{newFrameEachTime = NULL}}
177This reads the current settings for the help frame in the case of the
178wxHelpControllerHtml, setting the frame size, position and
179the newFrameEachTime parameters to the last values used. It also
180returns the pointer to the last opened help frame. This can be used
181for example, to automatically close the help frame on program
182shutdown. For all other help controllers, this function does nothing
183and just returns NULL.
184
33b64e6f
JS
185\wxheading{Parameters}
186
187\docparam{viewer}{This defaults to "netscape" for wxExtHelpController.}
188
189\docparam{flags}{This defaults to wxHELP\_NETSCAPE for wxExtHelpController, indicating
190that the viewer is a variant of Netscape Navigator.}
191
6fb26ea3 192\membersection{wxHelpController::OnQuit}\label{wxhelpcontrolleronquit}
fe604ccd
JS
193
194\func{virtual bool}{OnQuit}{\void}
a660d684 195
fe604ccd 196Overridable member called when this application's viewer is quit by the user.
a660d684 197
6fb26ea3 198This does not work for all help controllers.
a660d684 199
6fb26ea3 200\membersection{wxHelpController::Quit}\label{wxhelpcontrollerquit}
a660d684 201
fe604ccd 202\func{virtual bool}{Quit}{\void}
a660d684 203
fe604ccd 204If the viewer is running, quits it by disconnecting.
a660d684 205
fe604ccd 206For Windows Help, the viewer will only close if no other application is using it.
a660d684 207