Add CHMHelpController, and a wx.HelpController factory function

This commit is contained in:
Robin Dunn
2020-03-02 15:11:14 -08:00
parent b680b7f16e
commit 434365ec00
4 changed files with 65 additions and 16 deletions

View File

@@ -1572,6 +1572,7 @@
"HeaderCtrlSimple":"wx.",
"HeaderSortIconType":"wx.",
"Height":"wx.",
"HelpController":"wx.",
"HelpControllerBase":"wx.",
"HelpControllerHelpProvider":"wx.",
"HelpEvent":"wx.",

View File

@@ -31,6 +31,7 @@ ITEMS = []
INCLUDES = [
'axbase',
'helpchm',
]
# Separate the list into those that are generated from ETG scripts and the

View File

@@ -44,24 +44,29 @@ def run():
# NOTE: Since wxHelpController is an alias for wxHtmlHelpController on
# Mac and GTK, and since we don't want to force the wx.core extension
# module to link to the wxHTML library, then we won't provide a wrapper
# for the wxHelpController 'class'. Later on when we've got all the help
# controller classes that we'll want then we can add a wxHelpController
# or factory of our own in Python code.
# for the wxHelpController 'class' here.
#
# Instead we'll add a Python factory function that accomplishes the same
# thing. Basically it just provides a help controller instance that is the
# best for the platform.
module.addPyFunction('HelpController', '(parentWindow=None)',
doc="""\
Rather than being an alias for some class, the Python version of
``HelpController`` is a factory function that creates and returns an
instance of the best Help Controller is returned to the caller.
""",
body="""\
try:
if 'wxMSW' in wx.PlatformInfo:
import wx.msw.wxCHMHelpController as ControllerClass
else:
import wx.html.HtmlHelpController as ControllerClass
except ImportError:
ControllerClass = wx.ExtHelpController
#c = module.find('wxHelpController')
#c.mustHaveApp()
#c.addPrivateCopyCtor()
## Add pure virtuals with implemenations here
#c.addItem(etgtools.WigCode("""\
#virtual bool DisplayBlock(long blockNo);
#virtual bool DisplayContents();
#virtual bool DisplaySection(int sectionNo);
#virtual bool KeywordSearch(const wxString& keyWord,
# wxHelpSearchMode mode = wxHELP_SEARCH_ALL);
#virtual bool LoadFile(const wxString& file = wxEmptyString);
#virtual bool Quit();
#"""))
return ControllerClass(parentWindow)
""")

42
src/helpchm.sip Normal file
View File

@@ -0,0 +1,42 @@
//--------------------------------------------------------------------------
// Name: helpchm.sip
// Purpose: SIP wrapper details for wxCHMHelpController
//
// Author: Robin Dunn
//
// Created: 02-March-2020
// Copyright: (c) 2020 by Total Control Software
// Licence: wxWindows license
//--------------------------------------------------------------------------
class wxCHMHelpController : public wxHelpControllerBase
{
%TypeHeaderCode
#include <wx/msw/helpchm.h>
%End
public:
wxCHMHelpController(wxWindow* parentWindow = NULL);
virtual bool Initialize(const wxString& file);
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);
virtual bool DisplayContextPopup(int contextId);
virtual bool DisplayTextPopup(const wxString& text, const wxPoint& pos);
virtual bool KeywordSearch(const wxString& k,
wxHelpSearchMode mode = wxHELP_SEARCH_ALL);
virtual bool Quit();
wxString GetHelpFile() const;
static bool ShowContextHelpPopup(const wxString& text,
const wxPoint& pos,
wxWindow *window);
};