Turn on isVirtual for HtmlWindow.On* methods

This commit is contained in:
Robin Dunn
2017-12-29 12:55:08 -08:00
parent 2db369f9bb
commit d9c6d41c02
3 changed files with 20 additions and 8 deletions

View File

@@ -70,6 +70,9 @@ Changes in this release include the following:
* Fix OGL's ShapeCanvas to draw properly when the window is scrolled, and
to also adjust the mouse coordinates, etc. (#635)
* Fixed HtmlWindow's OnFoo virtual methods so calls to them are propagated to
the Python class. (#642)

View File

@@ -37,7 +37,7 @@ class MyHtmlWindow(html.HtmlWindow):
if isinstance(cell, html.HtmlWordCell):
sel = html.HtmlSelection()
self.log.WriteText(' %s\n' % cell.ConvertToText(sel))
super(MyHtmlWindow, self).OnCellClicked(cell, x, y, evt)
return super(MyHtmlWindow, self).OnCellClicked(cell, x, y, evt)

View File

@@ -37,15 +37,22 @@ def run():
c = module.find('wxHtmlWindow')
assert isinstance(c, etgtools.ClassDef)
tools.fixWindowClass(c)
c.bases = ['wxScrolledWindow']
c.find('OnCellClicked').ignore(False)
c.find('OnCellMouseHover').ignore(False)
c.find('AddFilter.filter').transfer = True
c.bases = ['wxScrolledWindow', 'wxHtmlWindowInterface']
tools.fixHtmlSetFonts(c)
# Pure virtuals inherited from wxHtmlWindowInterface
c.find('AddFilter.filter').transfer = True
# Turn the virtual flag back on for some methods
for name in [ 'OnLinkClicked',
'OnOpeningURL',
'OnSetTitle',
'OnCellMouseHover',
'OnCellClicked']:
c.find(name).isVirtual = True
c.find(name).ignore(False)
# Declare that the pure virtuals inherited from wxHtmlWindowInterface have
# implementations here
c.addItem(etgtools.WigCode("""\
virtual void SetHTMLWindowTitle(const wxString& title);
virtual void OnHTMLLinkClicked(const wxHtmlLinkInfo& link);
@@ -62,9 +69,11 @@ def run():
virtual wxCursor GetHTMLCursor(wxHtmlWindowInterface::HTMLCursor type) const;
"""))
c = module.find('wxHtmlLinkEvent')
tools.fixEventClass(c)
c = module.find('wxHtmlCellEvent')
tools.fixEventClass(c)