]>
Commit | Line | Data |
---|---|---|
f6bcfd97 BP |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: helpchm.h | |
3 | // Purpose: Help system: MS HTML Help implementation | |
4 | // Author: Julian Smart | |
5 | // Modified by: | |
6 | // Created: 16/04/2000 | |
7 | // RCS-ID: $Id$ | |
8 | // Copyright: (c) Julian Smart | |
59af881e | 9 | // Licence: wxWindows licence |
f6bcfd97 BP |
10 | ///////////////////////////////////////////////////////////////////////////// |
11 | ||
0016bb3b VZ |
12 | #ifndef _WX_MSW_HELPCHM_H_ |
13 | #define _WX_MSW_HELPCHM_H_ | |
f6bcfd97 | 14 | |
3295e238 | 15 | #if wxUSE_MS_HTML_HELP |
f6bcfd97 BP |
16 | |
17 | #include "wx/helpbase.h" | |
18 | ||
53a2db12 | 19 | class WXDLLIMPEXP_CORE wxCHMHelpController : public wxHelpControllerBase |
f6bcfd97 | 20 | { |
f6bcfd97 | 21 | public: |
3db52265 | 22 | wxCHMHelpController(wxWindow* parentWindow = NULL): wxHelpControllerBase(parentWindow) { } |
3295e238 | 23 | |
f6bcfd97 BP |
24 | // Must call this to set the filename |
25 | virtual bool Initialize(const wxString& file); | |
0e4acbd4 | 26 | virtual bool Initialize(const wxString& file, int WXUNUSED(server) ) { return Initialize( file ); } |
3295e238 | 27 | |
f6bcfd97 BP |
28 | // If file is "", reloads file given in Initialize |
29 | virtual bool LoadFile(const wxString& file = wxEmptyString); | |
30 | virtual bool DisplayContents(); | |
31 | virtual bool DisplaySection(int sectionNo); | |
32 | virtual bool DisplaySection(const wxString& section); | |
33 | virtual bool DisplayBlock(long blockNo); | |
5100cabf JS |
34 | virtual bool DisplayContextPopup(int contextId); |
35 | virtual bool DisplayTextPopup(const wxString& text, const wxPoint& pos); | |
69b5cec2 VS |
36 | virtual bool KeywordSearch(const wxString& k, |
37 | wxHelpSearchMode mode = wxHELP_SEARCH_ALL); | |
f6bcfd97 BP |
38 | virtual bool Quit(); |
39 | ||
3295e238 VZ |
40 | wxString GetHelpFile() const { return m_helpFile; } |
41 | ||
392c5133 VZ |
42 | // helper of DisplayTextPopup(), also used in wxSimpleHelpProvider::ShowHelp |
43 | static bool ShowContextHelpPopup(const wxString& text, | |
44 | const wxPoint& pos, | |
45 | wxWindow *window); | |
46 | ||
f6bcfd97 | 47 | protected: |
0016bb3b VZ |
48 | // get the name of the CHM file we use from our m_helpFile |
49 | wxString GetValidFilename() const; | |
50 | ||
51 | // Call HtmlHelp() with the provided parameters (both overloads do the same | |
52 | // thing but allow to avoid casts in the calling code) and return false | |
53 | // (but don't crash) if HTML help is unavailable | |
54 | static bool CallHtmlHelp(wxWindow *win, const wxChar *str, | |
55 | unsigned cmd, WXWPARAM param); | |
56 | static bool CallHtmlHelp(wxWindow *win, const wxChar *str, | |
57 | unsigned cmd, const void *param = NULL) | |
58 | { | |
5c33522f | 59 | return CallHtmlHelp(win, str, cmd, reinterpret_cast<WXWPARAM>(param)); |
0016bb3b VZ |
60 | } |
61 | ||
62 | // even simpler wrappers using GetParentWindow() and GetValidFilename() as | |
63 | // the first 2 HtmlHelp() parameters | |
64 | bool CallHtmlHelp(unsigned cmd, WXWPARAM param) | |
65 | { | |
66 | return CallHtmlHelp(GetParentWindow(), GetValidFilename().wx_str(), | |
67 | cmd, param); | |
68 | } | |
69 | ||
70 | bool CallHtmlHelp(unsigned cmd, const void *param = NULL) | |
71 | { | |
5c33522f | 72 | return CallHtmlHelp(cmd, reinterpret_cast<WXWPARAM>(param)); |
0016bb3b VZ |
73 | } |
74 | ||
75 | // wrapper around CallHtmlHelp(HH_DISPLAY_TEXT_POPUP): only one of text and | |
76 | // contextId parameters can be non-NULL/non-zero | |
77 | static bool DoDisplayTextPopup(const wxChar *text, | |
78 | const wxPoint& pos, | |
79 | int contextId, | |
80 | wxWindow *window); | |
81 | ||
3295e238 | 82 | |
f6bcfd97 | 83 | wxString m_helpFile; |
3295e238 VZ |
84 | |
85 | DECLARE_CLASS(wxCHMHelpController) | |
f6bcfd97 BP |
86 | }; |
87 | ||
3295e238 VZ |
88 | #endif // wxUSE_MS_HTML_HELP |
89 | ||
0016bb3b | 90 | #endif // _WX_MSW_HELPCHM_H_ |