]>
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
6 // Licence: wxWindows licence
7 /////////////////////////////////////////////////////////////////////////////
9 #define wxID_HTML_HELPFRAME (wxID_HIGHEST + 1)
11 /// This style indicates that the window is
12 /// embedded in the application and must not be
13 /// destroyed by the help controller.
14 #define wxHF_EMBEDDED 0x00008000
16 /// Create a dialog for the help window.
17 #define wxHF_DIALOG 0x00010000
19 /// Create a frame for the help window.
20 #define wxHF_FRAME 0x00020000
22 /// Make the dialog modal when displaying help.
23 #define wxHF_MODAL 0x00040000
28 @class wxHtmlHelpController
30 This help controller provides an easy way of displaying HTML help in your
31 application (see @sample{html}, test example).
33 The help system is based on @b books (see wxHtmlHelpController::AddBook).
34 A book is a logical section of documentation (for example "User's Guide" or
35 "Programmer's Guide" or "C++ Reference" or "wxWidgets Reference").
36 The help controller can handle as many books as you want.
38 Although this class has an API compatible with other wxWidgets help controllers
39 as documented by wxHelpController, it is recommended that you use the enhanced
40 capabilities of wxHtmlHelpController's API.
42 wxHTML uses Microsoft's HTML Help Workshop project files (.hhp, .hhk, .hhc) as
43 its native format. The file format is described in @ref overview_html_helpformats.
44 The directory @c helpfiles in the @sample{html} contains sample project files.
46 Note that the Microsoft's HTML Help Workshop
47 (http://www.microsoft.com/downloads/details.aspx?FamilyID=00535334-c8a6-452f-9aa0-d597d16580cc)
48 also runs on other platforms using WINE (http://www.winehq.org/) and it can
49 be used to create the .hpp, .hhk and .hhc files through a friendly GUI.
50 The commercial tool HelpBlocks (http://www.helpblocks.com) can also create these files.
55 @see wxBestHelpController, wxHtmlHelpFrame, wxHtmlHelpDialog,
56 wxHtmlHelpWindow, wxHtmlModalHelp
58 class wxHtmlHelpController
: public wxHelpControllerBase
65 This is a combination of these flags:
66 - wxHF_TOOLBAR: The help window has a toolbar.
67 - wxHF_FLAT_TOOLBAR: The help window has a toolbar with flat buttons (aka coolbar).
68 - wxHF_CONTENTS: The help window has a contents panel.
69 - wxHF_INDEX: The help window has an index panel.
70 - wxHF_SEARCH: The help window has a search panel.
71 - wxHF_BOOKMARKS: The help window has bookmarks controls.
72 - wxHF_OPEN_FILES: Allows user to open arbitrary HTML document.
73 - wxHF_PRINT: The toolbar contains "print" button.
74 - wxHF_MERGE_BOOKS: The contents pane does not show book nodes.
75 All books are merged together and appear as single book to the user.
76 - wxHF_ICONS_BOOK: All nodes in contents pane have a book icon.
77 This is how Microsoft's HTML help viewer behaves.
78 - wxHF_ICONS_FOLDER: Book nodes in contents pane have a book icon, book's
79 sections have a folder icon. This is the default.
80 - wxHF_ICONS_BOOK_CHAPTER: Both book nodes and nodes of top-level
81 sections of a book (i.e. chapters) have a book icon, all other sections
82 (sections, subsections, ...) have a folder icon.
83 - wxHF_EMBEDDED: Specifies that the help controller controls an embedded
84 window of class wxHtmlHelpWindow that should not be destroyed when
85 the controller is destroyed.
86 - wxHF_DIALOG: Specifies that the help controller should create a
87 dialog containing the help window.
88 - wxHF_FRAME: Specifies that the help controller should create a frame
89 containing the help window.
90 This is the default if neither wxHF_DIALOG nor wxHF_EMBEDDED is specified.
91 - wxHF_MODAL: Specifies that the help controller should create a modal
92 dialog containing the help window (used with the wxHF_DIALOG style).
93 - wxHF_DEFAULT_STYLE: wxHF_TOOLBAR | wxHF_CONTENTS | wxHF_INDEX |
94 wxHF_SEARCH | wxHF_BOOKMARKS | wxHF_PRINT
96 This is an optional window to be used as the parent for the help window.
98 wxHtmlHelpController(int style
= wxHF_DEFAULT_STYLE
,
99 wxWindow
* parentWindow
= NULL
);
100 wxHtmlHelpController(wxWindow
* parentWindow
, int style
= wxHF_DEFAULT_STYLE
);
104 Adds a book (i.e. a @ref overview_html_helpformats ".hhp file"; an HTML Help
105 Workshop project file) into the list of loaded books.
107 This must be called at least once before displaying any help.
108 @a bookFile or @a bookUrl may be either @c ".hhp" file or a ZIP archive
109 that contains an arbitrary number of @c ".hhp" files in its top-level
111 This ZIP archive must have @c ".zip" or @c ".htb" extension (the latter
112 stands for "HTML book"). In other words,
114 AddBook(wxFileName("help.zip"))
116 is possible and is the recommended way.
119 Help book filename. It is recommended to use this prototype
120 instead of the one taking URL, because it is less error-prone.
122 If @true then a decoration-less window with progress message is displayed.
124 bool AddBook(const wxFileName
& bookFile
, bool showWaitMsg
= false);
127 Adds a book (i.e. a @ref overview_html_helpformats ".hhp file"; an HTML Help
128 Workshop project file) into the list of loaded books.
130 See the other overload for additional info.
133 Help book URL (note that syntax of filename and URL is
134 different on most platforms).
136 If @true then a decoration-less window with progress message is displayed.
138 bool AddBook(const wxString
& bookUrl
, bool showWaitMsg
= false);
142 This is THE important function - it is used to display the help in application.
143 You can specify the page in many ways:
144 - as direct filename of HTML document
145 - as chapter name (from contents) or as a book name
146 - as some word from index
147 - even as any word (will be searched)
149 Looking for the page runs in these steps:
150 -# try to locate file named x (if x is for example "doc/howto.htm")
151 -# try to open starting page of book named x
152 -# try to find x in contents (if x is for example "How To ...")
153 -# try to find x in index (if x is for example "How To ...")
154 -# switch to Search panel and start searching
156 bool Display(const wxString
& x
);
161 This alternative form is used to search help contents by numeric IDs.
163 bool Display(int id
);
166 Displays help window and focuses contents panel.
168 virtual bool DisplayContents();
171 Displays help window and focuses index panel.
176 Displays the help window, focuses search panel and starts searching.
177 Returns @true if the keyword was found. Optionally it searches through the
178 index (mode = @c wxHELP_SEARCH_INDEX), default the content
179 (mode = @c wxHELP_SEARCH_ALL).
182 KeywordSearch() searches only pages listed in @c ".hhc" file(s).
183 You should list all pages in the contents file.
185 virtual bool KeywordSearch(const wxString
& keyword
,
186 wxHelpSearchMode mode
= wxHELP_SEARCH_ALL
);
189 Reads the controller's setting (position of window, etc.)
191 virtual void ReadCustomization(wxConfigBase
* cfg
,
192 const wxString
& path
= wxEmptyString
);
195 Sets whether the help frame should prevent application from exiting
196 if it's the only remaining top level window.
199 If @true, the application will not quit unless the help frame is
200 closed. Default is @false, i.e. the application does exit if only
201 the help window remains opened.
203 @see wxApp::SetExitOnFrameDelete()
207 void SetShouldPreventAppExit(bool enable
);
210 Sets the path for storing temporary files - cached binary versions of index and
213 These binary forms are much faster to read. Default value is empty string
214 (empty string means that no cached data are stored). Note that these files
215 are @e not deleted when program exits.
217 Once created these cached files will be used in all subsequent executions
218 of your application. If cached files become older than corresponding @c ".hhp"
219 file (e.g. if you regenerate documentation) it will be refreshed.
221 void SetTempDir(const wxString
& path
);
224 Sets format of title of the frame.
225 Must contain exactly one "%s" (for title of displayed HTML page).
227 void SetTitleFormat(const wxString
& format
);
230 Associates the @a config object with the controller.
232 If there is associated config object, wxHtmlHelpController automatically
233 reads and writes settings (including wxHtmlWindow's settings) when needed.
234 The only thing you must do is create wxConfig object and call UseConfig().
236 If you do not use UseConfig(), wxHtmlHelpController will use the default
237 wxConfig object if available (for details see wxConfigBase::Get and
240 void UseConfig(wxConfigBase
* config
,
241 const wxString
& rootpath
= wxEmptyString
);
244 Stores controllers setting (position of window etc.)
246 virtual void WriteCustomization(wxConfigBase
* cfg
,
247 const wxString
& path
= wxEmptyString
);
250 Get the current help window
252 wxHtmlHelpWindow
* GetHelpWindow();
255 Set the help window to be managed by this controller. This makes it
256 possible to have a help window that might not be in a wxHtmlHelpFrame or
257 dialog but is embedded in some other window in the application. Be sure
258 to use the wxHF_EMBEDDED style in this case.
260 void SetHelpWindow(wxHtmlHelpWindow
* helpWindow
);
263 Returns the current help frame. (May be NULL.)
265 wxHtmlHelpFrame
* GetFrame();
268 Returns the current help dialog. (May be NULL.)
270 wxHtmlHelpDialog
* GetDialog();
277 This protected virtual method may be overridden so that when specifying the
278 @c wxHF_DIALOG style, the controller uses a different dialog.
280 virtual wxHtmlHelpDialog
* CreateHelpDialog(wxHtmlHelpData
* data
);
283 This protected virtual method may be overridden so that the controller
284 uses a different frame.
286 virtual wxHtmlHelpFrame
* CreateHelpFrame(wxHtmlHelpData
* data
);
292 @class wxHtmlModalHelp
294 This class uses wxHtmlHelpController to display help in a modal dialog.
295 This is useful on platforms such as wxMac where if you display help from a
296 modal dialog, the help window must itself be a modal dialog.
298 Create objects of this class on the stack, for example:
301 // The help can be browsed during the lifetime of this object; when the
302 // user quits the help, program execution will continue.
303 wxHtmlModalHelp help(parent, "help", "My topic");
309 class wxHtmlModalHelp
316 is the parent of the dialog.
318 is the HTML help file to show.
320 is an optional topic. If this is empty, the help contents will be shown.
322 is a combination of the flags described in the wxHtmlHelpController
325 wxHtmlModalHelp(wxWindow
* parent
, const wxString
& helpFile
,
326 const wxString
& topic
= wxEmptyString
,
327 int style
= wxHF_DEFAULT_STYLE
| wxHF_DIALOG
| wxHF_MODAL
);