]> git.saurik.com Git - wxWidgets.git/blame - interface/help.h
removed wxAcceleratorTable copy ctor docs, no port implements it
[wxWidgets.git] / interface / help.h
CommitLineData
23324ae1
FM
1/////////////////////////////////////////////////////////////////////////////
2// Name: help.h
e54c96f1 3// Purpose: interface of wxHelpController
23324ae1
FM
4// Author: wxWidgets team
5// RCS-ID: $Id$
6// Licence: wxWindows license
7/////////////////////////////////////////////////////////////////////////////
8
9/**
10 @class wxHelpController
11 @wxheader{help.h}
7c913512 12
23324ae1
FM
13 This is a family of classes by which
14 applications may invoke a help viewer to provide on-line help.
7c913512 15
23324ae1
FM
16 A help controller allows an application to display help, at the contents
17 or at a particular topic, and shut the help program down on termination.
18 This avoids proliferation of many instances of the help viewer whenever the
19 user requests a different topic via the application's menus or buttons.
7c913512 20
23324ae1
FM
21 Typically, an application will create a help controller instance
22 when it starts, and immediately call @b Initialize
23 to associate a filename with it. The help viewer will only get run, however,
24 just before the first call to display something.
7c913512 25
23324ae1
FM
26 Most help controller classes actually derive from wxHelpControllerBase and have
27 names of the form wxXXXHelpController or wxHelpControllerXXX. An
28 appropriate class is aliased to the name wxHelpController for each platform, as
29 follows:
7c913512 30
23324ae1
FM
31 On desktop Windows, wxCHMHelpController is used (MS HTML Help).
32 On Windows CE, wxWinceHelpController is used.
33 On all other platforms, wxHtmlHelpController is used if wxHTML is
34 compiled into wxWidgets; otherwise wxExtHelpController is used (for invoking an
35 external
36 browser).
7c913512 37
23324ae1
FM
38 The remaining help controller classes need to be named
39 explicitly by an application that wishes to make use of them.
7c913512 40
23324ae1 41 There are currently the following help controller classes defined:
7c913512 42
23324ae1
FM
43 wxWinHelpController, for controlling Windows Help.
44 wxCHMHelpController, for controlling MS HTML Help. To use this, you need to
45 set wxUSE_MS_HTML_HELP
46 to 1 in setup.h and have htmlhelp.h header from Microsoft's HTML Help kit (you
47 don't need
48 VC++ specific htmlhelp.lib because wxWidgets loads necessary DLL at runtime and
49 so it
50 works with all compilers).
51 wxBestHelpController, for controlling MS HTML Help or, if Microsoft's runtime
52 is
53 not available, wxHtmlHelpController. You need to provide
54 @b both CHM and HTB versions of the help file. For 32bit Windows only.
55 wxExtHelpController, for controlling external browsers under Unix.
56 The default browser is Netscape Navigator. The 'help' sample shows its use.
57 wxWinceHelpController, for controlling a simple @c .htm help controller for
58 Windows CE applications.
e54c96f1 59 wxHtmlHelpController, a sophisticated help controller using wxHTML(), in
23324ae1
FM
60 a similar style to the Microsoft HTML Help viewer and using some of the same
61 files.
62 Although it has an API compatible with other help controllers, it has more
63 advanced features, so it is
64 recommended that you use the specific API for this class instead. Note that if
65 you
66 use .zip or .htb formats for your books, you
67 must add this line to your application initialization: @c
68 wxFileSystem::AddHandler(new wxArchiveFSHandler);
69 or nothing will be shown in your help window.
7c913512
FM
70
71
23324ae1
FM
72 @library{wxbase}
73 @category{help}
7c913512 74
e54c96f1 75 @see wxHtmlHelpController, wxHTML()
23324ae1
FM
76*/
77class wxHelpController : public wxObject
78{
79public:
80 /**
81 Constructs a help instance object, but does not invoke the help viewer.
23324ae1
FM
82 If you provide a window, it will be used by some help controller classes, such
83 as
84 wxCHMHelpController, wxWinHelpController and wxHtmlHelpController, as the
85 parent for the help window instead of the value of wxApp::GetTopWindow. You can
7c913512 86 also change the parent window later with
23324ae1
FM
87 SetParentWindow().
88 */
4cc4bfaf 89 wxHelpController(wxWindow* parentWindow = NULL);
23324ae1
FM
90
91 /**
92 Destroys the help instance, closing down the viewer if it is running.
93 */
94 ~wxHelpController();
95
96 /**
97 If the help viewer is not running, runs it and displays the file at the given
98 block number.
23324ae1 99 @e WinHelp: Refers to the context number.
23324ae1 100 @e MS HTML Help: Refers to the context number.
23324ae1 101 @e External HTML help: the same as for DisplaySection().
23324ae1
FM
102 @e wxHtmlHelpController: @e sectionNo is an identifier as specified in the @c
103 .hhc file. See @ref overview_helpformat "Help files format".
23324ae1
FM
104 This function is for backward compatibility only, and applications should use
105 @ref displaysection() wxHelpController instead.
106 */
107 virtual bool DisplayBlock(long blockNo);
108
109 /**
110 If the help viewer is not running, runs it and displays the
111 contents.
112 */
113 virtual bool DisplayContents();
114
115 /**
116 Displays the section as a popup window using a context id.
23324ae1
FM
117 Returns @false if unsuccessful or not implemented.
118 */
119 virtual bool DisplayContextPopup(int contextId);
120
121 //@{
122 /**
123 If the help viewer is not running, runs it and displays the given section.
4cc4bfaf
FM
124 @e WinHelp, MS HTML Help @a sectionNo is a context id.
125 @e External HTML help: wxExtHelpController implements @a sectionNo as an id in
23324ae1 126 a map file, which is of the form:
23324ae1 127
4cc4bfaf
FM
128 @e wxHtmlHelpController: @a sectionNo is an identifier as specified in the @c
129 .hhc file. See @ref overview_helpformat "Help files format".
23324ae1
FM
130 See also the help sample for notes on how to specify section numbers for
131 various help file formats.
132 */
133 virtual bool DisplaySection(const wxString& section);
7c913512 134 virtual bool DisplaySection(int sectionNo);
23324ae1
FM
135 //@}
136
137 /**
138 Displays the text in a popup window, if possible.
23324ae1
FM
139 Returns @false if unsuccessful or not implemented.
140 */
141 virtual bool DisplayTextPopup(const wxString& text,
142 const wxPoint& pos);
143
144 /**
145 wxHtmlHelpController returns the frame, size and position.
23324ae1
FM
146 For all other help controllers, this function does nothing
147 and just returns @NULL.
148
7c913512 149 @param viewer
4cc4bfaf 150 This defaults to "netscape" for wxExtHelpController.
7c913512 151 @param flags
4cc4bfaf
FM
152 This defaults to wxHELP_NETSCAPE for wxExtHelpController, indicating
153 that the viewer is a variant of Netscape Navigator.
23324ae1 154 */
4cc4bfaf
FM
155 virtual wxFrame* GetFrameParameters(const wxSize* size = NULL,
156 const wxPoint* pos = NULL,
157 bool* newFrameEachTime = NULL);
23324ae1
FM
158
159 /**
160 Returns the window to be used as the parent for the help window. This window is
161 used
162 by wxCHMHelpController, wxWinHelpController and wxHtmlHelpController.
163 */
328f5751 164 virtual wxWindow* GetParentWindow() const;
23324ae1
FM
165
166 //@{
167 /**
168 Initializes the help instance with a help filename, and optionally a server
169 socket
170 number if using wxHelp (now obsolete). Does not invoke the help viewer.
171 This must be called directly after the help instance object is created and
172 before
173 any attempts to communicate with the viewer.
23324ae1
FM
174 You may omit the file extension and a suitable one will be chosen. For
175 wxHtmlHelpController, the extensions zip, htb and hhp will be appended while
176 searching for
177 a suitable file. For WinHelp, the hlp extension is appended.
178 */
179 virtual bool Initialize(const wxString& file);
7c913512 180 virtual bool Initialize(const wxString& file, int server);
23324ae1
FM
181 //@}
182
183 /**
184 If the help viewer is not running, runs it, and searches for sections matching
185 the given keyword. If one match is found, the file is displayed at this
186 section. The optional parameter allows the search the index
187 (wxHELP_SEARCH_INDEX) but this currently only supported by the
188 wxHtmlHelpController.
7c913512 189 @e WinHelp, MS HTML Help: If more than one match is found,
23324ae1 190 the first topic is displayed.
7c913512 191 @e External HTML help, simple wxHTML help: If more than one match is found,
23324ae1 192 a choice of topics is displayed.
23324ae1
FM
193 @e wxHtmlHelpController: see wxHtmlHelpController::KeywordSearch.
194 */
195 virtual bool KeywordSearch(const wxString& keyWord,
196 wxHelpSearchMode mode = wxHELP_SEARCH_ALL);
197
198 /**
199 If the help viewer is not running, runs it and loads the given file.
200 If the filename is not supplied or is
201 empty, the file specified in @b Initialize is used. If the viewer is
202 already displaying the specified file, it will not be reloaded. This
203 member function may be used before each display call in case the user
204 has opened another file.
23324ae1
FM
205 wxHtmlHelpController ignores this call.
206 */
207 virtual bool LoadFile(const wxString& file = "");
208
209 /**
210 Overridable member called when this application's viewer is quit by the user.
23324ae1
FM
211 This does not work for all help controllers.
212 */
213 virtual bool OnQuit();
214
215 /**
216 If the viewer is running, quits it by disconnecting.
23324ae1
FM
217 For Windows Help, the viewer will only close if no other application is using
218 it.
219 */
220 virtual bool Quit();
221
222 /**
223 For wxHtmlHelpController, the title is set (again with %s indicating the
224 page title) and also the size and position of the frame if the frame is already
4cc4bfaf 225 open. @a newFrameEachTime is ignored.
23324ae1
FM
226 For all other help controllers this function has no effect.
227 */
4cc4bfaf
FM
228 virtual void SetFrameParameters(const wxString& title,
229 const wxSize& size,
230 const wxPoint& pos = wxDefaultPosition,
231 bool newFrameEachTime = false);
23324ae1
FM
232
233 /**
234 Sets the window to be used as the parent for the help window. This is used
235 by wxCHMHelpController, wxWinHelpController and wxHtmlHelpController.
236 */
237 virtual void SetParentWindow(wxWindow* parentWindow);
238
239 /**
240 Sets detailed viewer information. So far this is only relevant to
241 wxExtHelpController.
23324ae1
FM
242 Some examples of usage:
243 */
244 virtual void SetViewer(const wxString& viewer, long flags);
245};
e54c96f1 246