Merge pull request #501 from RobinD42/fix-issue499

Fix for wx.Notebook.HitTest
This commit is contained in:
Robin Dunn
2017-09-05 23:32:59 -05:00
committed by GitHub
5 changed files with 35 additions and 33 deletions

View File

@@ -20,11 +20,11 @@ Changes in this release include the following:
* Added a deprecated compatibility helper for wx.CustomDataFormat.
* Transfer ownership of the wx.EvtHandler when pushing/popping them, and also
for Set/RemoveEventHandler. (#443)
* Transfer ownership of the wx.EvtHandler object when pushing/popping
them, and also for Set/RemoveEventHandler. (#443)
* Add missing wx.VScrolledWindow methods listed in the docs as deprecated but
still present. (#441)
* Add missing wx.VScrolledWindow methods listed in the docs as deprecated
but still present. (#441)
* Fixed copy/paste error in wx.BusyInfo.__exit__ (#449)
@@ -39,13 +39,14 @@ Changes in this release include the following:
* Fix wx.ListCtrl.SetItemData to check that the data value is not out of
the range of a C long. (#467)
* Changed the default port on *nix builds to be GTK3. The new ``--gtk2`` flag
can be used to force a build for GTK2 instead, and the ``--gtk3`` flag still
exists, but defaults to True unless ``--gtk2`` is specified. Please note that
there is currently no auto-detection of whether GTK3 is available or not, so
if you know you need to build for GTK2 then you need to use the build flag,
and there is currently no way to specify that flag for builds performed by
pip. (#431)
* Changed the default port on *nix builds to be GTK3. The new ``--gtk2``
flag for build.py can be used to force a build for GTK2 instead, and
the ``--gtk3`` flag still exists, but defaults to True unless
``--gtk2`` is specified. Please note that there is currently no
auto-detection of whether GTK3 is available or not, so if you know
you need to build for GTK2 then you need to use the build flag, and
there is currently no way to specify that flag for builds performed
by pip. (#431)
* Fix parameter names in Toolbar.AddTool methods to be consistent. (#475)
@@ -64,6 +65,10 @@ Changes in this release include the following:
* Fixed improper initial scale factor in wx.lib.agw.speedmeter
* Fix for calls to wx.Notebook.HitTest calling the wrong instance (base class
version) of the method. (#499)

View File

@@ -42,6 +42,7 @@ def run():
c = module.find('wxAuiNotebook')
assert isinstance(c, etgtools.ClassDef)
tools.fixWindowClass(c)
tools.fixBookctrlClass(c)
c = module.find('wxAuiTabContainer')
tools.ignoreConstOverloads(c)

View File

@@ -37,12 +37,7 @@ def run():
c.find('OnSelChange').ignore()
tools.fixWindowClass(c)
# Let SIP know about other virtual methods that may be implemented here
c.addItem(etgtools.WigCode("""\
virtual bool DeleteAllPages();
"""))
tools.fixBookctrlClass(c)
module.addGlobalStr('wxNotebookNameStr', c)

View File

@@ -36,7 +36,7 @@ def run():
c = module.find('wxTreebook')
assert isinstance(c, etgtools.ClassDef)
tools.fixWindowClass(c)
tools.fixBookctrlClass(c, True)
tools.fixBookctrlClass(c)
module.addPyCode("""\
EVT_TREEBOOK_PAGE_CHANGED = wx.PyEventBinder( wxEVT_TREEBOOK_PAGE_CHANGED, 1 )

View File

@@ -318,24 +318,25 @@ def fixSizerClass(klass):
klass.find('RecalcSizes').isPureVirtual = True
def fixBookctrlClass(klass, treeBook=False):
def fixBookctrlClass(klass):
"""
Add declarations of the pure virtual methods from the base class.
"""
klass.addItem(extractors.WigCode("""\
virtual int GetPageImage(size_t nPage) const;
virtual bool SetPageImage(size_t page, int image);
virtual wxString GetPageText(size_t nPage) const;
virtual bool SetPageText(size_t page, const wxString& text);
virtual int SetSelection(size_t page);
virtual int ChangeSelection(size_t page);
"""))
if not treeBook:
klass.addItem(extractors.WigCode("""\
virtual int GetSelection() const;
virtual bool InsertPage(size_t index, wxWindow * page, const wxString & text,
bool select = false, int imageId = NO_IMAGE);
"""))
methods = [
("GetPageImage", "virtual int GetPageImage(size_t nPage) const;"),
("SetPageImage", "virtual bool SetPageImage(size_t page, int image);"),
("GetPageText", "virtual wxString GetPageText(size_t nPage) const;"),
("SetPageText", "virtual bool SetPageText(size_t page, const wxString& text);"),
("GetSelection", "virtual int GetSelection() const;"),
("SetSelection", "virtual int SetSelection(size_t page);"),
("ChangeSelection", "virtual int ChangeSelection(size_t page);"),
("HitTest", "virtual int HitTest(const wxPoint& pt, long* flags /Out/ = NULL) const;"),
("InsertPage", "virtual bool InsertPage(size_t index, wxWindow * page, const wxString & text, bool select = false, int imageId = NO_IMAGE);"),
]
for name, decl in methods:
if not klass.findItem(name):
klass.addItem(extractors.WigCode(decl))
def fixHtmlSetFonts(klass):