mirror of
https://github.com/wxWidgets/Phoenix.git
synced 2025-12-16 01:30:07 +01:00
Ensure SIP knows about the item container pure virtuals.
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -64,6 +64,8 @@ def run():
|
||||
c.find('GetTextIndent').ignore()
|
||||
c.find('SetTextIndent').ignore()
|
||||
|
||||
#tools.fixItemContainerClass(c, False)
|
||||
|
||||
#-----------------------------------------------------------------
|
||||
tools.doCommonTweaks(module)
|
||||
tools.runGenerators(module)
|
||||
|
||||
@@ -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;
|
||||
"""))
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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());
|
||||
|
||||
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user