1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/msw/helpchm.h
3 // Purpose: Help system: MS HTML Help implementation
4 // Author: Julian Smart
7 // Copyright: (c) Julian Smart
8 // Licence: wxWindows licence
9 /////////////////////////////////////////////////////////////////////////////
11 #ifndef _WX_MSW_HELPCHM_H_
12 #define _WX_MSW_HELPCHM_H_
14 #if wxUSE_MS_HTML_HELP
16 #include "wx/helpbase.h"
18 class WXDLLIMPEXP_CORE wxCHMHelpController
: public wxHelpControllerBase
21 wxCHMHelpController(wxWindow
* parentWindow
= NULL
): wxHelpControllerBase(parentWindow
) { }
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
); }
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
);
39 wxString
GetHelpFile() const { return m_helpFile
; }
41 // helper of DisplayTextPopup(), also used in wxSimpleHelpProvider::ShowHelp
42 static bool ShowContextHelpPopup(const wxString
& text
,
47 // get the name of the CHM file we use from our m_helpFile
48 wxString
GetValidFilename() const;
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
)
58 return CallHtmlHelp(win
, str
, cmd
, reinterpret_cast<WXWPARAM
>(param
));
61 // even simpler wrappers using GetParentWindow() and GetValidFilename() as
62 // the first 2 HtmlHelp() parameters
63 bool CallHtmlHelp(unsigned cmd
, WXWPARAM param
)
65 return CallHtmlHelp(GetParentWindow(), GetValidFilename().t_str(),
69 bool CallHtmlHelp(unsigned cmd
, const void *param
= NULL
)
71 return CallHtmlHelp(cmd
, reinterpret_cast<WXWPARAM
>(param
));
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
,
84 DECLARE_DYNAMIC_CLASS(wxCHMHelpController
)
87 #endif // wxUSE_MS_HTML_HELP
89 #endif // _WX_MSW_HELPCHM_H_