]>
git.saurik.com Git - wxWidgets.git/blob - interface/wx/html/helpctrl.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: html/helpctrl.h
3 // Purpose: interface of wxHtmlHelpController
4 // Author: wxWidgets team
5 // Licence: wxWindows licence
6 /////////////////////////////////////////////////////////////////////////////
8 #define wxID_HTML_HELPFRAME (wxID_HIGHEST + 1)
10 /// This style indicates that the window is
11 /// embedded in the application and must not be
12 /// destroyed by the help controller.
13 #define wxHF_EMBEDDED 0x00008000
15 /// Create a dialog for the help window.
16 #define wxHF_DIALOG 0x00010000
18 /// Create a frame for the help window.
19 #define wxHF_FRAME 0x00020000
21 /// Make the dialog modal when displaying help.
22 #define wxHF_MODAL 0x00040000
27 @class wxHtmlHelpController
29 This help controller provides an easy way of displaying HTML help in your
30 application (see @sample{html}, test example).
32 The help system is based on @b books (see wxHtmlHelpController::AddBook).
33 A book is a logical section of documentation (for example "User's Guide" or
34 "Programmer's Guide" or "C++ Reference" or "wxWidgets Reference").
35 The help controller can handle as many books as you want.
37 Although this class has an API compatible with other wxWidgets help controllers
38 as documented by wxHelpController, it is recommended that you use the enhanced
39 capabilities of wxHtmlHelpController's API.
41 wxHTML uses Microsoft's HTML Help Workshop project files (.hhp, .hhk, .hhc) as
42 its native format. The file format is described in @ref overview_html_helpformats.
43 The directory @c helpfiles in the @sample{html} contains sample project files.
45 Note that the Microsoft's HTML Help Workshop
46 (http://www.microsoft.com/downloads/details.aspx?FamilyID=00535334-c8a6-452f-9aa0-d597d16580cc)
47 also runs on other platforms using WINE (http://www.winehq.org/) and it can
48 be used to create the .hpp, .hhk and .hhc files through a friendly GUI.
49 The commercial tool HelpBlocks (http://www.helpblocks.com) can also create these files.
54 @see wxBestHelpController, wxHtmlHelpFrame, wxHtmlHelpDialog,
55 wxHtmlHelpWindow, wxHtmlModalHelp
57 class wxHtmlHelpController
: public wxHelpControllerBase
64 This is a combination of these flags:
65 - wxHF_TOOLBAR: The help window has a toolbar.
66 - wxHF_FLAT_TOOLBAR: The help window has a toolbar with flat buttons (aka coolbar).
67 - wxHF_CONTENTS: The help window has a contents panel.
68 - wxHF_INDEX: The help window has an index panel.
69 - wxHF_SEARCH: The help window has a search panel.
70 - wxHF_BOOKMARKS: The help window has bookmarks controls.
71 - wxHF_OPEN_FILES: Allows user to open arbitrary HTML document.
72 - wxHF_PRINT: The toolbar contains "print" button.
73 - wxHF_MERGE_BOOKS: The contents pane does not show book nodes.
74 All books are merged together and appear as single book to the user.
75 - wxHF_ICONS_BOOK: All nodes in contents pane have a book icon.
76 This is how Microsoft's HTML help viewer behaves.
77 - wxHF_ICONS_FOLDER: Book nodes in contents pane have a book icon, book's
78 sections have a folder icon. This is the default.
79 - wxHF_ICONS_BOOK_CHAPTER: Both book nodes and nodes of top-level
80 sections of a book (i.e. chapters) have a book icon, all other sections
81 (sections, subsections, ...) have a folder icon.
82 - wxHF_EMBEDDED: Specifies that the help controller controls an embedded
83 window of class wxHtmlHelpWindow that should not be destroyed when
84 the controller is destroyed.
85 - wxHF_DIALOG: Specifies that the help controller should create a
86 dialog containing the help window.
87 - wxHF_FRAME: Specifies that the help controller should create a frame
88 containing the help window.
89 This is the default if neither wxHF_DIALOG nor wxHF_EMBEDDED is specified.
90 - wxHF_MODAL: Specifies that the help controller should create a modal
91 dialog containing the help window (used with the wxHF_DIALOG style).
92 - wxHF_DEFAULT_STYLE: wxHF_TOOLBAR | wxHF_CONTENTS | wxHF_INDEX |
93 wxHF_SEARCH | wxHF_BOOKMARKS | wxHF_PRINT
95 This is an optional window to be used as the parent for the help window.
97 wxHtmlHelpController(int style
= wxHF_DEFAULT_STYLE
,
98 wxWindow
* parentWindow
= NULL
);
99 wxHtmlHelpController(wxWindow
* parentWindow
, int style
= wxHF_DEFAULT_STYLE
);
103 Adds a book (i.e. a @ref overview_html_helpformats ".hhp file"; an HTML Help
104 Workshop project file) into the list of loaded books.
106 This must be called at least once before displaying any help.
107 @a bookFile or @a bookUrl may be either @c ".hhp" file or a ZIP archive
108 that contains an arbitrary number of @c ".hhp" files in its top-level
110 This ZIP archive must have @c ".zip" or @c ".htb" extension (the latter
111 stands for "HTML book"). In other words,
113 AddBook(wxFileName("help.zip"))
115 is possible and is the recommended way.
118 Help book filename. It is recommended to use this prototype
119 instead of the one taking URL, because it is less error-prone.
121 If @true then a decoration-less window with progress message is displayed.
123 bool AddBook(const wxFileName
& bookFile
, bool showWaitMsg
= false);
126 Adds a book (i.e. a @ref overview_html_helpformats ".hhp file"; an HTML Help
127 Workshop project file) into the list of loaded books.
129 See the other overload for additional info.
132 Help book URL (note that syntax of filename and URL is
133 different on most platforms).
135 If @true then a decoration-less window with progress message is displayed.
137 bool AddBook(const wxString
& bookUrl
, bool showWaitMsg
= false);
141 This is THE important function - it is used to display the help in application.
142 You can specify the page in many ways:
143 - as direct filename of HTML document
144 - as chapter name (from contents) or as a book name
145 - as some word from index
146 - even as any word (will be searched)
148 Looking for the page runs in these steps:
149 -# try to locate file named x (if x is for example "doc/howto.htm")
150 -# try to open starting page of book named x
151 -# try to find x in contents (if x is for example "How To ...")
152 -# try to find x in index (if x is for example "How To ...")
153 -# switch to Search panel and start searching
155 bool Display(const wxString
& x
);
160 This alternative form is used to search help contents by numeric IDs.
162 bool Display(int id
);
165 Displays help window and focuses contents panel.
167 virtual bool DisplayContents();
170 Displays help window and focuses index panel.
175 Displays the help window, focuses search panel and starts searching.
176 Returns @true if the keyword was found. Optionally it searches through the
177 index (mode = @c wxHELP_SEARCH_INDEX), default the content
178 (mode = @c wxHELP_SEARCH_ALL).
181 KeywordSearch() searches only pages listed in @c ".hhc" file(s).
182 You should list all pages in the contents file.
184 virtual bool KeywordSearch(const wxString
& keyword
,
185 wxHelpSearchMode mode
= wxHELP_SEARCH_ALL
);
188 Reads the controller's setting (position of window, etc.)
190 virtual void ReadCustomization(wxConfigBase
* cfg
,
191 const wxString
& path
= wxEmptyString
);
194 Sets whether the help frame should prevent application from exiting
195 if it's the only remaining top level window.
198 If @true, the application will not quit unless the help frame is
199 closed. Default is @false, i.e. the application does exit if only
200 the help window remains opened.
202 @see wxApp::SetExitOnFrameDelete()
206 void SetShouldPreventAppExit(bool enable
);
209 Sets the path for storing temporary files - cached binary versions of index and
212 These binary forms are much faster to read. Default value is empty string
213 (empty string means that no cached data are stored). Note that these files
214 are @e not deleted when program exits.
216 Once created these cached files will be used in all subsequent executions
217 of your application. If cached files become older than corresponding @c ".hhp"
218 file (e.g. if you regenerate documentation) it will be refreshed.
220 void SetTempDir(const wxString
& path
);
223 Sets format of title of the frame.
224 Must contain exactly one "%s" (for title of displayed HTML page).
226 void SetTitleFormat(const wxString
& format
);
229 Associates the @a config object with the controller.
231 If there is associated config object, wxHtmlHelpController automatically
232 reads and writes settings (including wxHtmlWindow's settings) when needed.
233 The only thing you must do is create wxConfig object and call UseConfig().
235 If you do not use UseConfig(), wxHtmlHelpController will use the default
236 wxConfig object if available (for details see wxConfigBase::Get and
239 void UseConfig(wxConfigBase
* config
,
240 const wxString
& rootpath
= wxEmptyString
);
243 Stores controllers setting (position of window etc.)
245 virtual void WriteCustomization(wxConfigBase
* cfg
,
246 const wxString
& path
= wxEmptyString
);
249 Get the current help window
251 wxHtmlHelpWindow
* GetHelpWindow();
254 Set the help window to be managed by this controller. This makes it
255 possible to have a help window that might not be in a wxHtmlHelpFrame or
256 dialog but is embedded in some other window in the application. Be sure
257 to use the wxHF_EMBEDDED style in this case.
259 void SetHelpWindow(wxHtmlHelpWindow
* helpWindow
);
262 Returns the current help frame. (May be NULL.)
264 wxHtmlHelpFrame
* GetFrame();
267 Returns the current help dialog. (May be NULL.)
269 wxHtmlHelpDialog
* GetDialog();
276 This protected virtual method may be overridden so that when specifying the
277 @c wxHF_DIALOG style, the controller uses a different dialog.
279 virtual wxHtmlHelpDialog
* CreateHelpDialog(wxHtmlHelpData
* data
);
282 This protected virtual method may be overridden so that the controller
283 uses a different frame.
285 virtual wxHtmlHelpFrame
* CreateHelpFrame(wxHtmlHelpData
* data
);
291 @class wxHtmlModalHelp
293 This class uses wxHtmlHelpController to display help in a modal dialog.
294 This is useful on platforms such as wxMac where if you display help from a
295 modal dialog, the help window must itself be a modal dialog.
297 Create objects of this class on the stack, for example:
300 // The help can be browsed during the lifetime of this object; when the
301 // user quits the help, program execution will continue.
302 wxHtmlModalHelp help(parent, "help", "My topic");
308 class wxHtmlModalHelp
315 is the parent of the dialog.
317 is the HTML help file to show.
319 is an optional topic. If this is empty, the help contents will be shown.
321 is a combination of the flags described in the wxHtmlHelpController
324 wxHtmlModalHelp(wxWindow
* parent
, const wxString
& helpFile
,
325 const wxString
& topic
= wxEmptyString
,
326 int style
= wxHF_DEFAULT_STYLE
| wxHF_DIALOG
| wxHF_MODAL
);