mirror of
https://github.com/wxWidgets/Phoenix.git
synced 2026-01-07 04:20:07 +01:00
Add %ConvertToSubclass to wxObject class. Uses wxRTTI to select the real class type (or as close as possible) for any wxObject* return value.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxPython/Phoenix/trunk@66462 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -49,7 +49,6 @@ def run():
|
||||
c.addPrivateCopyCtor()
|
||||
|
||||
|
||||
|
||||
#--------------------------------------------------
|
||||
c = module.find('wxObject')
|
||||
c.find('operator delete').ignore()
|
||||
@@ -66,7 +65,25 @@ def run():
|
||||
doc='Deletes the C++ object this Python object is a proxy for.',
|
||||
transferThis=True) # TODO: Check this
|
||||
|
||||
|
||||
# Teach SIP how to convert to specific class types
|
||||
c.addItem(etgtools.WigCode("""\
|
||||
%ConvertToSubClassCode
|
||||
const wxClassInfo* info = sipCpp->GetClassInfo();
|
||||
wxString name = info->GetClassName();
|
||||
bool exists = sipFindType(name) != NULL;
|
||||
while (info && !exists) {
|
||||
info = info->GetBaseClass1();
|
||||
name = info->GetClassName();
|
||||
exists = sipFindType(name) != NULL;
|
||||
}
|
||||
if (info)
|
||||
sipType = sipFindType(name);
|
||||
else
|
||||
sipType = NULL;
|
||||
%End
|
||||
"""))
|
||||
|
||||
|
||||
#-----------------------------------------------------------------
|
||||
tools.doCommonTweaks(module)
|
||||
tools.runGenerators(module)
|
||||
|
||||
Reference in New Issue
Block a user