2000-07-15 15:51:35 -04:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
2011-03-19 20:14:35 -04:00
|
|
|
// Name: wx/msw/helpchm.h
|
2000-07-15 15:51:35 -04:00
|
|
|
// Purpose: Help system: MS HTML Help implementation
|
|
|
|
// Author: Julian Smart
|
|
|
|
// Modified by:
|
|
|
|
// Created: 16/04/2000
|
|
|
|
// Copyright: (c) Julian Smart
|
2004-08-27 14:59:37 -04:00
|
|
|
// Licence: wxWindows licence
|
2000-07-15 15:51:35 -04:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
2008-03-01 07:23:04 -05:00
|
|
|
#ifndef _WX_MSW_HELPCHM_H_
|
|
|
|
#define _WX_MSW_HELPCHM_H_
|
2000-07-15 15:51:35 -04:00
|
|
|
|
2002-03-09 16:55:39 -05:00
|
|
|
#if wxUSE_MS_HTML_HELP
|
2000-07-15 15:51:35 -04:00
|
|
|
|
|
|
|
#include "wx/helpbase.h"
|
|
|
|
|
2008-03-26 11:06:00 -04:00
|
|
|
class WXDLLIMPEXP_CORE wxCHMHelpController : public wxHelpControllerBase
|
2000-07-15 15:51:35 -04:00
|
|
|
{
|
|
|
|
public:
|
2005-10-26 05:32:10 -04:00
|
|
|
wxCHMHelpController(wxWindow* parentWindow = NULL): wxHelpControllerBase(parentWindow) { }
|
2002-03-09 16:55:39 -05:00
|
|
|
|
2000-07-15 15:51:35 -04:00
|
|
|
// Must call this to set the filename
|
2016-09-23 10:59:11 -04:00
|
|
|
virtual bool Initialize(const wxString& file) wxOVERRIDE;
|
|
|
|
virtual bool Initialize(const wxString& file, int WXUNUSED(server) ) wxOVERRIDE { return Initialize( file ); }
|
2002-03-09 16:55:39 -05:00
|
|
|
|
2000-07-15 15:51:35 -04:00
|
|
|
// If file is "", reloads file given in Initialize
|
2016-09-23 10:59:11 -04:00
|
|
|
virtual bool LoadFile(const wxString& file = wxEmptyString) wxOVERRIDE;
|
|
|
|
virtual bool DisplayContents() wxOVERRIDE;
|
|
|
|
virtual bool DisplaySection(int sectionNo) wxOVERRIDE;
|
|
|
|
virtual bool DisplaySection(const wxString& section) wxOVERRIDE;
|
|
|
|
virtual bool DisplayBlock(long blockNo) wxOVERRIDE;
|
|
|
|
virtual bool DisplayContextPopup(int contextId) wxOVERRIDE;
|
|
|
|
virtual bool DisplayTextPopup(const wxString& text, const wxPoint& pos) wxOVERRIDE;
|
2003-09-09 13:29:11 -04:00
|
|
|
virtual bool KeywordSearch(const wxString& k,
|
2016-09-23 10:59:11 -04:00
|
|
|
wxHelpSearchMode mode = wxHELP_SEARCH_ALL) wxOVERRIDE;
|
|
|
|
virtual bool Quit() wxOVERRIDE;
|
2000-07-15 15:51:35 -04:00
|
|
|
|
2002-03-09 16:55:39 -05:00
|
|
|
wxString GetHelpFile() const { return m_helpFile; }
|
|
|
|
|
2006-06-14 13:46:51 -04:00
|
|
|
// helper of DisplayTextPopup(), also used in wxSimpleHelpProvider::ShowHelp
|
|
|
|
static bool ShowContextHelpPopup(const wxString& text,
|
|
|
|
const wxPoint& pos,
|
|
|
|
wxWindow *window);
|
|
|
|
|
2000-07-15 15:51:35 -04:00
|
|
|
protected:
|
2008-03-01 07:23:04 -05:00
|
|
|
// 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)
|
|
|
|
{
|
2008-11-01 22:39:52 -04:00
|
|
|
return CallHtmlHelp(win, str, cmd, reinterpret_cast<WXWPARAM>(param));
|
2008-03-01 07:23:04 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
// even simpler wrappers using GetParentWindow() and GetValidFilename() as
|
|
|
|
// the first 2 HtmlHelp() parameters
|
|
|
|
bool CallHtmlHelp(unsigned cmd, WXWPARAM param)
|
|
|
|
{
|
2012-06-03 15:16:59 -04:00
|
|
|
return CallHtmlHelp(GetParentWindow(), GetValidFilename().t_str(),
|
2008-03-01 07:23:04 -05:00
|
|
|
cmd, param);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool CallHtmlHelp(unsigned cmd, const void *param = NULL)
|
|
|
|
{
|
2008-11-01 22:39:52 -04:00
|
|
|
return CallHtmlHelp(cmd, reinterpret_cast<WXWPARAM>(param));
|
2008-03-01 07:23:04 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
// 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);
|
|
|
|
|
2002-03-09 16:55:39 -05:00
|
|
|
|
2000-07-15 15:51:35 -04:00
|
|
|
wxString m_helpFile;
|
2002-03-09 16:55:39 -05:00
|
|
|
|
2015-04-23 07:49:01 -04:00
|
|
|
wxDECLARE_DYNAMIC_CLASS(wxCHMHelpController);
|
2000-07-15 15:51:35 -04:00
|
|
|
};
|
|
|
|
|
2002-03-09 16:55:39 -05:00
|
|
|
#endif // wxUSE_MS_HTML_HELP
|
|
|
|
|
2008-03-01 07:23:04 -05:00
|
|
|
#endif // _WX_MSW_HELPCHM_H_
|