no real changes, just refactor/simplify the code to remove duplication and unnecessary casts

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@52214 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2008-03-01 12:23:04 +00:00
parent 49b7574928
commit 0016bb3b1c
2 changed files with 91 additions and 84 deletions

View File

@@ -9,8 +9,8 @@
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_HELPCHM_H_
#define _WX_HELPCHM_H_
#ifndef _WX_MSW_HELPCHM_H_
#define _WX_MSW_HELPCHM_H_
#if wxUSE_MS_HTML_HELP
@@ -45,10 +45,41 @@ public:
wxWindow *window);
protected:
// Append extension if necessary.
wxString GetValidFilename(const wxString& file) const;
// get the name of the CHM file we use from our m_helpFile
wxString GetValidFilename() const;
// Call HtmlHelp() with the provided parameters (both overloads do the same
// thing but allow to avoid casts in the calling code) and return false
// (but don't crash) if HTML help is unavailable
static bool CallHtmlHelp(wxWindow *win, const wxChar *str,
unsigned cmd, WXWPARAM param);
static bool CallHtmlHelp(wxWindow *win, const wxChar *str,
unsigned cmd, const void *param = NULL)
{
return CallHtmlHelp(win, str, cmd, wx_reinterpret_cast(WPARAM, param));
}
// even simpler wrappers using GetParentWindow() and GetValidFilename() as
// the first 2 HtmlHelp() parameters
bool CallHtmlHelp(unsigned cmd, WXWPARAM param)
{
return CallHtmlHelp(GetParentWindow(), GetValidFilename().wx_str(),
cmd, param);
}
bool CallHtmlHelp(unsigned cmd, const void *param = NULL)
{
return CallHtmlHelp(cmd, wx_reinterpret_cast(WXWPARAM, param));
}
// wrapper around CallHtmlHelp(HH_DISPLAY_TEXT_POPUP): only one of text and
// contextId parameters can be non-NULL/non-zero
static bool DoDisplayTextPopup(const wxChar *text,
const wxPoint& pos,
int contextId,
wxWindow *window);
protected:
wxString m_helpFile;
DECLARE_CLASS(wxCHMHelpController)
@@ -56,5 +87,4 @@ protected:
#endif // wxUSE_MS_HTML_HELP
#endif
// _WX_HELPCHM_H_
#endif // _WX_MSW_HELPCHM_H_