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