diff --git a/etg/checklst.py b/etg/checklst.py index cbd763fb..1e3c2329 100644 --- a/etg/checklst.py +++ b/etg/checklst.py @@ -41,6 +41,15 @@ def run(): c.find('Create').findOverload('wxString choices').ignore() c.find('Create').findOverload('wxArrayString').find('choices').default = 'wxArrayString()' + c.addCppMethod('wxArrayInt*', 'GetSelections', '()', + isConst=True, factory=True, + doc="Returns a list of the indices of the currently selected items.", + body="""\ + wxArrayInt* array = new wxArrayInt; + self->GetSelections(*array); + return array; + """) + tools.fixWindowClass(c) diff --git a/unittests/test_checklst.py b/unittests/test_checklst.py index 90687505..54df3a30 100644 --- a/unittests/test_checklst.py +++ b/unittests/test_checklst.py @@ -45,6 +45,16 @@ class CheckListBoxTests(wtc.WidgetTestCase): c.CheckedStrings = ['three'] self.assertTrue(set(c.GetCheckedItems()) == set([2])) + def test_GetSelections(self): + c = wx.CheckListBox( + self.frame, + choices="one two three four".split(), + style=wx.LB_EXTENDED, + ) + self.assertEqual(c.GetSelections(), []) + c.SetSelection(2) + self.assertEqual(c.GetSelections(), [2]) + #---------------------------------------------------------------------------