mirror of
https://github.com/wxWidgets/Phoenix.git
synced 2025-12-16 09:40:07 +01:00
Add virtual dtor for DC classes
This commit is contained in:
@@ -51,6 +51,8 @@ def run():
|
|||||||
c.addPublic()
|
c.addPublic()
|
||||||
tools.removeVirtuals(c)
|
tools.removeVirtuals(c)
|
||||||
|
|
||||||
|
c.addDtor('public', True)
|
||||||
|
|
||||||
# Keep only the wxSize overloads of these
|
# Keep only the wxSize overloads of these
|
||||||
c.find('GetSize').findOverload('wxCoord').ignore()
|
c.find('GetSize').findOverload('wxCoord').ignore()
|
||||||
c.find('GetSizeMM').findOverload('wxCoord').ignore()
|
c.find('GetSizeMM').findOverload('wxCoord').ignore()
|
||||||
|
|||||||
@@ -1072,11 +1072,12 @@ private:
|
|||||||
{CLASS}& operator=(const {CLASS}&);""".format(CLASS=self.name))
|
{CLASS}& operator=(const {CLASS}&);""".format(CLASS=self.name))
|
||||||
self.addItem(wig)
|
self.addItem(wig)
|
||||||
|
|
||||||
def addDtor(self, prot='protected'):
|
def addDtor(self, prot='protected', isVirtual=False):
|
||||||
# add declaration of a destructor to this class
|
# add declaration of a destructor to this class
|
||||||
|
virtual = 'virtual ' if isVirtual else ''
|
||||||
wig = WigCode("""\
|
wig = WigCode("""\
|
||||||
{PROT}:
|
{PROT}:
|
||||||
~{CLASS}();""".format(CLASS=self.name, PROT=prot))
|
{VIRTUAL}~{CLASS}();""".format(VIRTUAL=virtual, CLASS=self.name, PROT=prot))
|
||||||
self.addItem(wig)
|
self.addItem(wig)
|
||||||
|
|
||||||
def addDefaultCtor(self, prot='protected'):
|
def addDefaultCtor(self, prot='protected'):
|
||||||
|
|||||||
@@ -182,9 +182,11 @@ class dc_Tests(wtc.WidgetTestCase):
|
|||||||
|
|
||||||
# check ownership
|
# check ownership
|
||||||
assert wx.siplib.ispyowned(dc)
|
assert wx.siplib.ispyowned(dc)
|
||||||
|
assert not wx.siplib.isdeleted(dc)
|
||||||
|
|
||||||
# check the DC's ownership has changed
|
# check the DC's ownership has changed
|
||||||
assert not wx.siplib.ispyowned(dc)
|
assert not wx.siplib.ispyowned(dc)
|
||||||
|
assert wx.siplib.isdeleted(dc)
|
||||||
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
|
|||||||
Reference in New Issue
Block a user