diff --git a/demo/CheckListBox.py b/demo/CheckListBox.py index 98221cdb..e8e248dd 100644 --- a/demo/CheckListBox.py +++ b/demo/CheckListBox.py @@ -15,7 +15,11 @@ class TestPanel(wx.Panel): wx.StaticText(self, -1, "This example uses the wxCheckListBox control.", (45, 15)) - lb = wx.CheckListBox(self, -1, (80, 50), wx.DefaultSize, sampleList) + lb = wx.CheckListBox(self, -1, (80, 50)) #, choices=sampleList) + for txt in sampleList: + lb.Append(txt) + + lb.SetSize(lb.GetBestSize()) self.Bind(wx.EVT_LISTBOX, self.EvtListBox, lb) self.Bind(wx.EVT_CHECKLISTBOX, self.EvtCheckListBox, lb) lb.SetSelection(0) diff --git a/etg/checklst.py b/etg/checklst.py index 99e14279..cbd763fb 100644 --- a/etg/checklst.py +++ b/etg/checklst.py @@ -97,6 +97,11 @@ def run(): c.addPyProperty('CheckedStrings GetCheckedStrings SetCheckedStrings') + tools.fixItemContainerClass(c) + c.addItem(etgtools.WigCode("""\ + virtual int GetSelections(wxArrayInt& aSelections) const; + """)) + #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module) diff --git a/etg/choice.py b/etg/choice.py index 5164f55e..b3a581c2 100644 --- a/etg/choice.py +++ b/etg/choice.py @@ -39,6 +39,7 @@ def run(): c.find('Create').findOverload('wxString choices').ignore() c.find('Create').findOverload('wxArrayString').find('choices').default = 'wxArrayString()' + tools.fixItemContainerClass(c, False) tools.fixWindowClass(c) module.addGlobalStr('wxChoiceNameStr', c) diff --git a/etg/combo.py b/etg/combo.py index f3326bfb..18577dea 100644 --- a/etg/combo.py +++ b/etg/combo.py @@ -64,6 +64,8 @@ def run(): c.find('GetTextIndent').ignore() c.find('SetTextIndent').ignore() + #tools.fixItemContainerClass(c, False) + #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module) diff --git a/etg/htmllbox.py b/etg/htmllbox.py index 67685085..593a8fab 100644 --- a/etg/htmllbox.py +++ b/etg/htmllbox.py @@ -64,13 +64,8 @@ def run(): c.find('Create.choices').default = 'wxArrayString()' # let sip know that these pure virtuals have been implemented in this class + tools.fixItemContainerClass(c, False) c.addItem(etgtools.WigCode("""\ - virtual unsigned int GetCount() const; - virtual wxString GetString(unsigned int n) const; - virtual void SetString(unsigned int n, const wxString & string); - virtual void SetSelection(int n); - virtual int GetSelection() const; - protected: virtual wxString OnGetItem(size_t n) const; """)) diff --git a/etg/listbox.py b/etg/listbox.py index f7345050..713b6a62 100644 --- a/etg/listbox.py +++ b/etg/listbox.py @@ -101,6 +101,11 @@ def run(): #endif """) + tools.fixItemContainerClass(c) + c.addItem(etgtools.WigCode("""\ + virtual int GetSelections(wxArrayInt& aSelections) const; + """)) + tools.fixWindowClass(c) module.addGlobalStr('wxListBoxNameStr', c) diff --git a/etg/odcombo.py b/etg/odcombo.py index ff440caa..e5e85c26 100644 --- a/etg/odcombo.py +++ b/etg/odcombo.py @@ -62,13 +62,8 @@ def run(): # wxItemContainer pure virtuals that have an implementation in this class + tools.fixItemContainerClass(c, False) c.addItem(etgtools.WigCode("""\ - virtual unsigned int GetCount() const; - virtual wxString GetString(unsigned int n) const; - virtual void SetString(unsigned int n, const wxString& s); - virtual int GetSelection() const; - virtual void SetSelection(int n); - virtual wxString GetStringSelection() const; %MethodCode sipRes = new wxString(sipCpp->wxItemContainerImmutable::GetStringSelection()); diff --git a/etgtools/tweaker_tools.py b/etgtools/tweaker_tools.py index db2898c8..e67975db 100644 --- a/etgtools/tweaker_tools.py +++ b/etgtools/tweaker_tools.py @@ -358,6 +358,26 @@ def fixBookctrlClass(klass): if not klass.findItem(name): klass.addItem(extractors.WigCode(decl)) +def fixItemContainerClass(klass, addIsSelected=True): + """ + Add declarations of the pure virtual methods from the base class. + """ + methods = [ + ("GetCount", "virtual unsigned int GetCount() const;"), + ("GetString", "virtual wxString GetString(unsigned int n) const;"), + ("SetString", "virtual void SetString(unsigned int n, const wxString& s);"), + ("SetSelection", "virtual void SetSelection(int n);"), + ("GetSelection", "virtual int GetSelection() const;"), + ] + if addIsSelected: + methods += [ + ("IsSelected", "virtual bool IsSelected(int n) const;"), + ] + + for name, decl in methods: + if not klass.findItem(name): + klass.addItem(extractors.WigCode(decl)) + def fixHtmlSetFonts(klass): # Use wxArrayInt instead of a C array of ints.