2000-07-15 15:51:35 -04:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Name: helpchm.h
|
|
|
|
// Purpose: Help system: MS HTML Help implementation
|
|
|
|
// Author: Julian Smart
|
|
|
|
// Modified by:
|
|
|
|
// Created: 16/04/2000
|
|
|
|
// RCS-ID: $Id$
|
|
|
|
// 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
|
|
|
|
virtual bool Initialize(const wxString& file);
|
2003-09-11 05:58:31 -04:00
|
|
|
virtual bool Initialize(const wxString& file, int WXUNUSED(server) ) { 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
|
|
|
|
virtual bool LoadFile(const wxString& file = wxEmptyString);
|
|
|
|
virtual bool DisplayContents();
|
|
|
|
virtual bool DisplaySection(int sectionNo);
|
|
|
|
virtual bool DisplaySection(const wxString& section);
|
|
|
|
virtual bool DisplayBlock(long blockNo);
|
2000-09-12 10:53:39 -04:00
|
|
|
virtual bool DisplayContextPopup(int contextId);
|
|
|
|
virtual bool DisplayTextPopup(const wxString& text, const wxPoint& pos);
|
2003-09-09 13:29:11 -04:00
|
|
|
virtual bool KeywordSearch(const wxString& k,
|
|
|
|
wxHelpSearchMode mode = wxHELP_SEARCH_ALL);
|
2000-07-15 15:51:35 -04:00
|
|
|
virtual bool Quit();
|
|
|
|
|
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)
|
|
|
|
{
|
|
|
|
return CallHtmlHelp(GetParentWindow(), GetValidFilename().wx_str(),
|
|
|
|
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
|
|
|
|
|
|
|
DECLARE_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_
|