Change wx.FileDialogCustomize.AddChoice to accept a list of strings

This commit is contained in:
Robin Dunn
2022-06-08 18:08:20 -07:00
parent 46f1c1759f
commit f993afa723

View File

@@ -59,6 +59,17 @@ def run():
assert isinstance(c, etgtools.ClassDef)
c.noDefCtor = True
# Change the AddChoice method to use a wxArrayString instead of a C array
# and size.
m = c.find('AddChoice')
m.find('n').ignore()
m.find('strings').type = 'const wxArrayString&'
m.argsString = '(size_t n, const wxArrayString& strings)'
m.setCppCode("""\
const wxString* ptr = &strings->front();
return self->AddChoice(strings->size(), ptr);
""")
c = module.find('wxFileDialogCustomizeHook')
assert isinstance(c, etgtools.ClassDef)