From: Robin Dunn Date: Tue, 7 Feb 2006 03:56:44 +0000 (+0000) Subject: Changes to how overridable C++ methods are virtualized for Python. X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/a7a014180017908d32f0af32ebfa140fdc82b390 Changes to how overridable C++ methods are virtualized for Python. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@37369 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/wxPython/demo/Calendar.py b/wxPython/demo/Calendar.py index 44cfdca5b0..58bbda9b6b 100644 --- a/wxPython/demo/Calendar.py +++ b/wxPython/demo/Calendar.py @@ -541,10 +541,10 @@ class SetPrintout(wx.Printout): self.end_pg = 1 def OnBeginDocument(self, start, end): - return self.base_OnBeginDocument(start, end) + return super(SetPrintout, self).OnBeginDocument(start, end) def OnEndDocument(self): - self.base_OnEndDocument() + super(SetPrintout, self).OnEndDocument() def HasPage(self, page): if page <= self.end_pg: @@ -564,7 +564,7 @@ class SetPrintout(wx.Printout): return (str_pg, end_pg, str_pg, end_pg) def OnPreparePrinting(self): - self.base_OnPreparePrinting() + super(SetPrintout, self).OnPreparePrinting() def OnBeginPrinting(self): dc = self.GetDC() @@ -581,7 +581,7 @@ class SetPrintout(wx.Printout): scaleY = float(h) / 1000 self.printUserScale = min(scaleX, scaleY) - self.base_OnBeginPrinting() + super(SetPrintout, self).OnBeginPrinting() def GetSize(self): self.psizew, self.psizeh = self.GetPPIPrinter() diff --git a/wxPython/demo/GridCustEditor.py b/wxPython/demo/GridCustEditor.py index 444152cc4f..c111a179ad 100644 --- a/wxPython/demo/GridCustEditor.py +++ b/wxPython/demo/GridCustEditor.py @@ -11,15 +11,6 @@ class MyCellEditor(gridlib.PyGridCellEditor): grid editors. All the methods that can be overridden are shown here. The ones that must be overridden are marked with "*Must Override*" in the docstring. - - Notice that in order to call the base class version of these special - methods we use the method name preceded by "base_". This is because these - methods are "virtual" in C++ so if we try to call wx.GridCellEditor.Create - for example, then when the wxPython extension module tries to call - ptr->Create(...) then it actually calls the derived class version which - looks up the method in this class and calls it, causing a recursion loop. - If you don't understand any of this, don't worry, just call the "base_" - version instead. """ def __init__(self, log): self.log = log @@ -58,7 +49,7 @@ class MyCellEditor(gridlib.PyGridCellEditor): to set colours or fonts for the control. """ self.log.write("MyCellEditor: Show(self, %s, %s)\n" % (show, attr)) - self.base_Show(show, attr) + super(MyCellEditor, self).Show(show, attr) def PaintBackground(self, rect, attr): @@ -126,7 +117,7 @@ class MyCellEditor(gridlib.PyGridCellEditor): self.log.write("MyCellEditor: IsAcceptedKey: %d\n" % (evt.GetKeyCode())) ## We can ask the base class to do it - #return self.base_IsAcceptedKey(evt) + #return super(MyCellEditor, self).IsAcceptedKey(evt) # or do it ourselves return (not (evt.ControlDown() or evt.AltDown()) and @@ -172,7 +163,7 @@ class MyCellEditor(gridlib.PyGridCellEditor): def Destroy(self): """final cleanup""" self.log.write("MyCellEditor: Destroy\n") - self.base_Destroy() + super(MyCellEditor, self).Destroy() def Clone(self): diff --git a/wxPython/demo/HtmlWindow.py b/wxPython/demo/HtmlWindow.py index 0374604f14..3e39f7ebd5 100644 --- a/wxPython/demo/HtmlWindow.py +++ b/wxPython/demo/HtmlWindow.py @@ -16,33 +16,25 @@ class MyHtmlWindow(html.HtmlWindow): def __init__(self, parent, id, log): html.HtmlWindow.__init__(self, parent, id, style=wx.NO_FULL_REPAINT_ON_RESIZE) self.log = log - self.Bind(wx.EVT_SCROLLWIN, self.OnScroll ) if "gtk2" in wx.PlatformInfo: self.SetStandardFonts() - def OnScroll( self, event ): - #print 'event.GetOrientation()',event.GetOrientation() - #print 'event.GetPosition()',event.GetPosition() - event.Skip() - def OnLinkClicked(self, linkinfo): self.log.WriteText('OnLinkClicked: %s\n' % linkinfo.GetHref()) - - # Virtuals in the base class have been renamed with base_ on the front. - self.base_OnLinkClicked(linkinfo) - + super(MyHtmlWindow, self).OnLinkClicked(linkinfo) def OnSetTitle(self, title): self.log.WriteText('OnSetTitle: %s\n' % title) - self.base_OnSetTitle(title) + super(MyHtmlWindow, self).OnSetTitle(title) def OnCellMouseHover(self, cell, x, y): self.log.WriteText('OnCellMouseHover: %s, (%d %d)\n' % (cell, x, y)) - self.base_OnCellMouseHover(cell, x, y) + super(MyHtmlWindow, self).OnCellMouseHover(cell, x, y) def OnCellClicked(self, cell, x, y, evt): self.log.WriteText('OnCellClicked: %s, (%d %d)\n' % (cell, x, y)) - self.base_OnCellClicked(cell, x, y, evt) + super(MyHtmlWindow, self).OnCellClicked(cell, x, y, evt) + # This filter doesn't really do anything but show how to use filters diff --git a/wxPython/demo/OGL.py b/wxPython/demo/OGL.py index af0c047845..871e6bc9cb 100644 --- a/wxPython/demo/OGL.py +++ b/wxPython/demo/OGL.py @@ -418,14 +418,6 @@ Pierre Hj less likely to get rusty because nobody cares about the C++ lib any more. -

The Python version should be mostly drop-in compatible with the -wrapped C++ version, except for the location of the package -(wx.lib.ogl instead of wx.ogl) and that the base class methods are -called the normal Python way (superclass.Method(self, ...)) instead of the -hacky way that had to be done to support overloaded methods with the -old SWIG (self.base_Method(...)) - - """ if __name__ == '__main__': diff --git a/wxPython/demo/PrintFramework.py b/wxPython/demo/PrintFramework.py index 86dcdd5eca..6aa0b5700f 100644 --- a/wxPython/demo/PrintFramework.py +++ b/wxPython/demo/PrintFramework.py @@ -15,38 +15,38 @@ class MyPrintout(wx.Printout): self.log = log def OnBeginDocument(self, start, end): - self.log.WriteText("wx.Printout.OnBeginDocument\n") - return self.base_OnBeginDocument(start, end) + self.log.WriteText("MyPrintout.OnBeginDocument\n") + return super(MyPrintout, self).OnBeginDocument(start, end) def OnEndDocument(self): - self.log.WriteText("wx.Printout.OnEndDocument\n") - self.base_OnEndDocument() + self.log.WriteText("MyPrintout.OnEndDocument\n") + super(MyPrintout, self).OnEndDocument() def OnBeginPrinting(self): - self.log.WriteText("wx.Printout.OnBeginPrinting\n") - self.base_OnBeginPrinting() + self.log.WriteText("MyPrintout.OnBeginPrinting\n") + super(MyPrintout, self).OnBeginPrinting() def OnEndPrinting(self): - self.log.WriteText("wx.Printout.OnEndPrinting\n") - self.base_OnEndPrinting() + self.log.WriteText("MyPrintout.OnEndPrinting\n") + super(MyPrintout, self).OnEndPrinting() def OnPreparePrinting(self): - self.log.WriteText("wx.Printout.OnPreparePrinting\n") - self.base_OnPreparePrinting() + self.log.WriteText("MyPrintout.OnPreparePrinting\n") + super(MyPrintout, self).OnPreparePrinting() def HasPage(self, page): - self.log.WriteText("wx.Printout.HasPage: %d\n" % page) + self.log.WriteText("MyPrintout.HasPage: %d\n" % page) if page <= 2: return True else: return False def GetPageInfo(self): - self.log.WriteText("wx.Printout.GetPageInfo\n") + self.log.WriteText("MyPrintout.GetPageInfo\n") return (1, 2, 1, 2) def OnPrintPage(self, page): - self.log.WriteText("wx.Printout.OnPrintPage: %d\n" % page) + self.log.WriteText("MyPrintout.OnPrintPage: %d\n" % page) dc = self.GetDC() #------------------------------------------- @@ -128,7 +128,7 @@ class TestPrintPanel(wx.Panel): def OnPrintSetup(self, event): data = wx.PrintDialogData(self.printData) printerDialog = wx.PrintDialog(self, data) - printerDialog.GetPrintDialogData().SetSetupDialog(True) + #printerDialog.GetPrintDialogData().SetSetupDialog(True) printerDialog.ShowModal(); # this makes a copy of the wx.PrintData instead of just saving diff --git a/wxPython/docs/CHANGES.txt b/wxPython/docs/CHANGES.txt index 51214a4173..3017415312 100644 --- a/wxPython/docs/CHANGES.txt +++ b/wxPython/docs/CHANGES.txt @@ -25,6 +25,59 @@ wx.EventLoop is now implemented for wxMac. Added wxPython wrappers for the new wx.Treebook and wx.Toolbook classes. +Solved a problem that has been around for a very long time in how C++ +methods are virtualized for overriding in derived Python classes. +Previously we couldn't do it for methods that needed to exist in the +base class wrappers such that they could be called normally. (The +reasons are long and complex, but suffice it to say that it was due to +mixing C++'s dynamic dispatch, and Python's runtime lookup of the +method attributes resulting in endless recursion of function calls.) +Because of this problem I used a hack that I have always hated, and +that is renaming the base class methods with a "base_" prefix, for +example wx.Printout.base_OnBeginDocument. Now that the problem has +finally been solved I have replaced all the base_Whatever() methods +with the real Whatever() method as well as a simple wrapper named +base_Whatever that is marked as deprecated. So now instead of writing +your overridden methods like this: + + def OnBeginDocument(self, start, end): + # do something here + return self.base_OnBeginDocument(start, end) + +You can do it the *right way* like this: + + def OnBeginDocument(self, start, end): + # do something here + return super(MyPrintout, self).OnBeginDocument(start, end) + +Note that the old way still works, but you will get a +DeprecationWarning from calling base_OnBeginDocument. The classes +affected by this are: + + * wx.DropSource + * wx.DropTarget + * wx.TextDropTarget + * wx.FileDropTarget + * wx.PyLog (also added the ability to override Flush) + * wx.PyApp (also added the ability to override ExitMainLoop) + * wx.Printout + * wx.PyPrintPreview + * wx.PyPreviewFrame + * wx.PreviewControlBar + * wx.Process + * wx.PyControl + * wx.PyPanel + * wx.PyScrolledWindow + * wx.PyWindow + * wx.Timer + * wx.grid.PyGridCellRenderer + * wx.grid.PyGridCellEditor + * wx.grid.PyGridCellAttrProvider + * wx.grid.PyGridTableBase + * wx.html.HtmlWindow + * wx.wizard.PyWizardPage + + diff --git a/wxPython/include/wx/wxPython/printfw.h b/wxPython/include/wx/wxPython/printfw.h index bfc4d2be7d..0ad0babdd4 100644 --- a/wxPython/include/wx/wxPython/printfw.h +++ b/wxPython/include/wx/wxPython/printfw.h @@ -32,7 +32,6 @@ public: // Since this one would be tough and ugly to do with the Macros... void GetPageInfo(int *minPage, int *maxPage, int *pageFrom, int *pageTo); - void base_GetPageInfo(int *minPage, int *maxPage, int *pageFrom, int *pageTo); PYPRIVATE; DECLARE_ABSTRACT_CLASS(wxPyPrintout) diff --git a/wxPython/include/wx/wxPython/wxPython_int.h b/wxPython/include/wx/wxPython/wxPython_int.h index 5cc05f5da5..ca3fbcc6a5 100644 --- a/wxPython/include/wx/wxPython/wxPython_int.h +++ b/wxPython/include/wx/wxPython/wxPython_int.h @@ -564,6 +564,9 @@ public: int callCallback(PyObject* argTuple) const; PyObject* callCallbackObj(PyObject* argTuple) const; PyObject* GetLastFound() const { return m_lastFound; } + + void setRecursionGuard(PyObject* method) const; + void clearRecursionGuard(PyObject* method) const; private: PyObject* m_self; @@ -627,6 +630,7 @@ public: const wxChar *cond, const wxChar *msg); #endif + virtual void ExitMainLoop(); // virtual int FilterEvent(wxEvent& event); // This one too???? // For catching Apple Events @@ -668,8 +672,7 @@ extern wxPyApp *wxPythonApp; //--------------------------------------------------------------------------- #define DEC_PYCALLBACK__(CBNAME) \ - void CBNAME(); \ - void base_##CBNAME() + void CBNAME() #define IMP_PYCALLBACK__(CLASS, PCLASS, CBNAME) \ @@ -681,16 +684,18 @@ extern wxPyApp *wxPythonApp; wxPyEndBlockThreads(blocked); \ if (! found) \ PCLASS::CBNAME(); \ - } \ - void CLASS::base_##CBNAME() { \ - PCLASS::CBNAME(); \ - } + } + +#define DEC_PYCALLBACK_VOID_(CBNAME) \ + DEC_PYCALLBACK__(CBNAME) + +#define IMP_PYCALLBACK_VOID_(CLASS, PCLASS, CBNAME) \ + IMP_PYCALLBACK__(CLASS, PCLASS, CBNAME) //--------------------------------------------------------------------------- #define DEC_PYCALLBACK_BOOL_INTINT(CBNAME) \ - bool CBNAME(int a, int b); \ - bool base_##CBNAME(int a, int b) + bool CBNAME(int a, int b) #define IMP_PYCALLBACK_BOOL_INTINT(CLASS, PCLASS, CBNAME) \ @@ -703,37 +708,12 @@ extern wxPyApp *wxPythonApp; if (! found) \ rval = PCLASS::CBNAME(a,b); \ return rval; \ - } \ - bool CLASS::base_##CBNAME(int a, int b) { \ - return PCLASS::CBNAME(a,b); \ - } - -//--------------------------------------------------------------------------- - -#define DEC_PYCALLBACK_VOID_(CBNAME) \ - void CBNAME(); \ - void base_##CBNAME() - - -#define IMP_PYCALLBACK_VOID_(CLASS, PCLASS, CBNAME) \ - void CLASS::CBNAME() { \ - bool found; \ - wxPyBlock_t blocked = wxPyBeginBlockThreads(); \ - if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \ - wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \ - wxPyEndBlockThreads(blocked); \ - if (! found) \ - PCLASS::CBNAME(); \ - } \ - void CLASS::base_##CBNAME() { \ - PCLASS::CBNAME(); \ } //--------------------------------------------------------------------------- #define DEC_PYCALLBACK_VOID_INTINT(CBNAME) \ - void CBNAME(int a, int b); \ - void base_##CBNAME(int a, int b) + void CBNAME(int a, int b) #define IMP_PYCALLBACK_VOID_INTINT(CLASS, PCLASS, CBNAME) \ @@ -745,16 +725,12 @@ extern wxPyApp *wxPythonApp; wxPyEndBlockThreads(blocked); \ if (! found) \ PCLASS::CBNAME(a,b); \ - } \ - void CLASS::base_##CBNAME(int a, int b) { \ - PCLASS::CBNAME(a,b); \ - } + } //--------------------------------------------------------------------------- #define DEC_PYCALLBACK_VOID_INT(CBNAME) \ - void CBNAME(int a); \ - void base_##CBNAME(int a) + void CBNAME(int a) #define IMP_PYCALLBACK_VOID_INT(CLASS, PCLASS, CBNAME) \ @@ -766,16 +742,12 @@ extern wxPyApp *wxPythonApp; wxPyEndBlockThreads(blocked); \ if (! found) \ PCLASS::CBNAME(a); \ - } \ - void CLASS::base_##CBNAME(int a) { \ - PCLASS::CBNAME(a); \ - } + } //--------------------------------------------------------------------------- #define DEC_PYCALLBACK_VOID_INT4(CBNAME) \ - void CBNAME(int a, int b, int c, int d); \ - void base_##CBNAME(int a, int b, int c, int d) + void CBNAME(int a, int b, int c, int d) #define IMP_PYCALLBACK_VOID_INT4(CLASS, PCLASS, CBNAME) \ @@ -787,15 +759,11 @@ extern wxPyApp *wxPythonApp; wxPyEndBlockThreads(blocked); \ if (! found) \ PCLASS::CBNAME(a,b,c,d); \ - } \ - void CLASS::base_##CBNAME(int a, int b, int c, int d) { \ - PCLASS::CBNAME(a,b,c,d); \ - } + } //--------------------------------------------------------------------------- #define DEC_PYCALLBACK_VOID_INT5(CBNAME) \ - void CBNAME(int a, int b, int c, int d, int e); \ - void base_##CBNAME(int a, int b, int c, int d, int e) + void CBNAME(int a, int b, int c, int d, int e) #define IMP_PYCALLBACK_VOID_INT5(CLASS, PCLASS, CBNAME) \ @@ -807,16 +775,12 @@ extern wxPyApp *wxPythonApp; wxPyEndBlockThreads(blocked); \ if (! found) \ PCLASS::CBNAME(a,b,c,d,e); \ - } \ - void CLASS::base_##CBNAME(int a, int b, int c, int d, int e) { \ - PCLASS::CBNAME(a,b,c,d,e); \ - } + } //--------------------------------------------------------------------------- #define DEC_PYCALLBACK_VOID_INTPINTP_const(CBNAME) \ - void CBNAME(int* a, int* b) const; \ - void base_##CBNAME(int* a, int* b) const + void CBNAME(int* a, int* b) const #define IMP_PYCALLBACK_VOID_INTPINTP_const(CLASS, PCLASS, CBNAME) \ @@ -848,17 +812,12 @@ extern wxPyApp *wxPythonApp; wxPyEndBlockThreads(blocked); \ if (! found) \ PCLASS::CBNAME(a,b); \ - } \ - void CLASS::base_##CBNAME(int* a, int* b) const { \ - PCLASS::CBNAME(a,b); \ - } - + } //--------------------------------------------------------------------------- #define DEC_PYCALLBACK_SIZE_const(CBNAME) \ - wxSize CBNAME() const; \ - wxSize base_##CBNAME() const + wxSize CBNAME() const #define IMP_PYCALLBACK_SIZE_const(CLASS, PCLASS, CBNAME) \ @@ -892,17 +851,12 @@ extern wxPyApp *wxPythonApp; return PCLASS::CBNAME(); \ else \ return rval; \ - } \ - wxSize CLASS::base_##CBNAME() const { \ - return PCLASS::CBNAME(); \ - } - + } //--------------------------------------------------------------------------- #define DEC_PYCALLBACK_BOOL_BOOL(CBNAME) \ - bool CBNAME(bool a); \ - bool base_##CBNAME(bool a) + bool CBNAME(bool a) #define IMP_PYCALLBACK_BOOL_BOOL(CLASS, PCLASS, CBNAME) \ @@ -915,16 +869,12 @@ extern wxPyApp *wxPythonApp; if (! found) \ rval = PCLASS::CBNAME(a); \ return rval; \ - } \ - bool CLASS::base_##CBNAME(bool a) { \ - return PCLASS::CBNAME(a); \ } //--------------------------------------------------------------------------- #define DEC_PYCALLBACK_BOOL_INT(CBNAME) \ - bool CBNAME(int a); \ - bool base_##CBNAME(int a) + bool CBNAME(int a) #define IMP_PYCALLBACK_BOOL_INT(CLASS, PCLASS, CBNAME) \ @@ -937,9 +887,6 @@ extern wxPyApp *wxPythonApp; if (! found) \ rval = PCLASS::CBNAME(a); \ return rval; \ - } \ - bool CLASS::base_##CBNAME(int a) { \ - return PCLASS::CBNAME(a); \ } //--------------------------------------------------------------------------- @@ -963,8 +910,7 @@ extern wxPyApp *wxPythonApp; //--------------------------------------------------------------------------- #define DEC_PYCALLBACK__DC(CBNAME) \ - void CBNAME(wxDC& a); \ - void base_##CBNAME(wxDC& a) + void CBNAME(wxDC& a) #define IMP_PYCALLBACK__DC(CLASS, PCLASS, CBNAME) \ @@ -979,18 +925,13 @@ extern wxPyApp *wxPythonApp; wxPyEndBlockThreads(blocked); \ if (! found) \ PCLASS::CBNAME(a); \ - } \ - void CLASS::base_##CBNAME(wxDC& a) { \ - PCLASS::CBNAME(a); \ - } - + } //--------------------------------------------------------------------------- #define DEC_PYCALLBACK__DCBOOL(CBNAME) \ - void CBNAME(wxDC& a, bool b); \ - void base_##CBNAME(wxDC& a, bool b) + void CBNAME(wxDC& a, bool b) #define IMP_PYCALLBACK__DCBOOL(CLASS, PCLASS, CBNAME) \ @@ -1005,16 +946,12 @@ extern wxPyApp *wxPythonApp; wxPyEndBlockThreads(blocked); \ if (! found) \ PCLASS::CBNAME(a, b); \ - } \ - void CLASS::base_##CBNAME(wxDC& a, bool b) { \ - PCLASS::CBNAME(a, b); \ - } + } //--------------------------------------------------------------------------- #define DEC_PYCALLBACK__DCBOOL(CBNAME) \ - void CBNAME(wxDC& a, bool b); \ - void base_##CBNAME(wxDC& a, bool b) + void CBNAME(wxDC& a, bool b) #define IMP_PYCALLBACK__DCBOOL(CLASS, PCLASS, CBNAME) \ @@ -1029,16 +966,12 @@ extern wxPyApp *wxPythonApp; wxPyEndBlockThreads(blocked); \ if (! found) \ PCLASS::CBNAME(a, b); \ - } \ - void CLASS::base_##CBNAME(wxDC& a, bool b) { \ - PCLASS::CBNAME(a, b); \ - } + } //--------------------------------------------------------------------------- #define DEC_PYCALLBACK__2DBL(CBNAME) \ - void CBNAME(double a, double b); \ - void base_##CBNAME(double a, double b) + void CBNAME(double a, double b) #define IMP_PYCALLBACK__2DBL(CLASS, PCLASS, CBNAME) \ @@ -1050,16 +983,12 @@ extern wxPyApp *wxPythonApp; wxPyEndBlockThreads(blocked); \ if (! found) \ PCLASS::CBNAME(a, b); \ - } \ - void CLASS::base_##CBNAME(double a, double b) { \ - PCLASS::CBNAME(a, b); \ - } + } //--------------------------------------------------------------------------- #define DEC_PYCALLBACK__2DBL2INT(CBNAME) \ - void CBNAME(double a, double b, int c, int d); \ - void base_##CBNAME(double a, double b, int c, int d) + void CBNAME(double a, double b, int c, int d) #define IMP_PYCALLBACK__2DBL2INT(CLASS, PCLASS, CBNAME) \ @@ -1072,16 +1001,12 @@ extern wxPyApp *wxPythonApp; wxPyEndBlockThreads(blocked); \ if (! found) \ PCLASS::CBNAME(a, b, c, d); \ - } \ - void CLASS::base_##CBNAME(double a, double b, int c, int d) { \ - PCLASS::CBNAME(a, b, c, d); \ - } + } //--------------------------------------------------------------------------- #define DEC_PYCALLBACK__DC4DBLBOOL(CBNAME) \ - void CBNAME(wxDC& a, double b, double c, double d, double e, bool f); \ - void base_##CBNAME(wxDC& a, double b, double c, double d, double e, bool f) + void CBNAME(wxDC& a, double b, double c, double d, double e, bool f) #define IMP_PYCALLBACK__DC4DBLBOOL(CLASS, PCLASS, CBNAME) \ @@ -1096,16 +1021,12 @@ extern wxPyApp *wxPythonApp; wxPyEndBlockThreads(blocked); \ if (! found) \ PCLASS::CBNAME(a, b, c, d, e, f); \ - } \ - void CLASS::base_##CBNAME(wxDC& a, double b, double c, double d, double e, bool f) {\ - PCLASS::CBNAME(a, b, c, d, e, f); \ - } + } //--------------------------------------------------------------------------- #define DEC_PYCALLBACK_BOOL_DC4DBLBOOL(CBNAME) \ - bool CBNAME(wxDC& a, double b, double c, double d, double e, bool f); \ - bool base_##CBNAME(wxDC& a, double b, double c, double d, double e, bool f) + bool CBNAME(wxDC& a, double b, double c, double d, double e, bool f) #define IMP_PYCALLBACK_BOOL_DC4DBLBOOL(CLASS, PCLASS, CBNAME) \ @@ -1122,16 +1043,12 @@ extern wxPyApp *wxPythonApp; if (! found) \ rval = PCLASS::CBNAME(a, b, c, d, e, f); \ return rval; \ - } \ - bool CLASS::base_##CBNAME(wxDC& a, double b, double c, double d, double e, bool f) {\ - return PCLASS::CBNAME(a, b, c, d, e, f); \ - } + } //--------------------------------------------------------------------------- #define DEC_PYCALLBACK__BOOL2DBL2INT(CBNAME) \ - void CBNAME(bool a, double b, double c, int d, int e); \ - void base_##CBNAME(bool a, double b, double c, int d, int e) + void CBNAME(bool a, double b, double c, int d, int e) #define IMP_PYCALLBACK__BOOL2DBL2INT(CLASS, PCLASS, CBNAME) \ @@ -1144,16 +1061,12 @@ extern wxPyApp *wxPythonApp; wxPyEndBlockThreads(blocked); \ if (! found) \ PCLASS::CBNAME(a, b, c, d, e); \ - } \ - void CLASS::base_##CBNAME(bool a, double b, double c, int d, int e) { \ - PCLASS::CBNAME(a, b, c, d, e); \ - } + } //--------------------------------------------------------------------------- #define DEC_PYCALLBACK__DC4DBL(CBNAME) \ - void CBNAME(wxDC& a, double b, double c, double d, double e); \ - void base_##CBNAME(wxDC& a, double b, double c, double d, double e) + void CBNAME(wxDC& a, double b, double c, double d, double e) #define IMP_PYCALLBACK__DC4DBL(CLASS, PCLASS, CBNAME) \ @@ -1168,16 +1081,12 @@ extern wxPyApp *wxPythonApp; wxPyEndBlockThreads(blocked); \ if (! found) \ PCLASS::CBNAME(a, b, c, d, e); \ - } \ - void CLASS::base_##CBNAME(wxDC& a, double b, double c, double d, double e) {\ - PCLASS::CBNAME(a, b, c, d, e); \ } //--------------------------------------------------------------------------- #define DEC_PYCALLBACK__DCBOOL(CBNAME) \ - void CBNAME(wxDC& a, bool b); \ - void base_##CBNAME(wxDC& a, bool b) + void CBNAME(wxDC& a, bool b) #define IMP_PYCALLBACK__DCBOOL(CLASS, PCLASS, CBNAME) \ @@ -1192,16 +1101,12 @@ extern wxPyApp *wxPythonApp; wxPyEndBlockThreads(blocked); \ if (! found) \ PCLASS::CBNAME(a, b); \ - } \ - void CLASS::base_##CBNAME(wxDC& a, bool b) { \ - PCLASS::CBNAME(a, b); \ } //--------------------------------------------------------------------------- #define DEC_PYCALLBACK__WXCPBOOL2DBL2INT(CBNAME) \ - void CBNAME(wxControlPoint* a, bool b, double c, double d, int e, int f); \ - void base_##CBNAME(wxControlPoint* a, bool b, double c, double d, int e, int f) + void CBNAME(wxControlPoint* a, bool b, double c, double d, int e, int f) #define IMP_PYCALLBACK__WXCPBOOL2DBL2INT(CLASS, PCLASS, CBNAME) \ @@ -1217,17 +1122,12 @@ extern wxPyApp *wxPythonApp; wxPyEndBlockThreads(blocked); \ if (! found) \ PCLASS::CBNAME(a, b, c, d, e, f); \ - } \ - void CLASS::base_##CBNAME(wxControlPoint* a, bool b, double c, double d, \ - int e, int f) { \ - PCLASS::CBNAME(a, b, c, d, e, f); \ - } + } //--------------------------------------------------------------------------- #define DEC_PYCALLBACK__WXCP2DBL2INT(CBNAME) \ - void CBNAME(wxControlPoint* a, double b, double c, int d, int e); \ - void base_##CBNAME(wxControlPoint* a, double b, double c, int d, int e) + void CBNAME(wxControlPoint* a, double b, double c, int d, int e) #define IMP_PYCALLBACK__WXCP2DBL2INT(CLASS, PCLASS, CBNAME) \ @@ -1242,17 +1142,12 @@ extern wxPyApp *wxPythonApp; wxPyEndBlockThreads(blocked); \ if (! found) \ PCLASS::CBNAME(a, b, c, d, e); \ - } \ - void CLASS::base_##CBNAME(wxControlPoint* a, double b, double c, \ - int d, int e) { \ - PCLASS::CBNAME(a, b, c, d, e); \ } //--------------------------------------------------------------------------- #define DEC_PYCALLBACK__2DBLINT(CBNAME) \ - void CBNAME(double a, double b, int c); \ - void base_##CBNAME(double a, double b, int c) + void CBNAME(double a, double b, int c) #define IMP_PYCALLBACK__2DBLINT(CLASS, PCLASS, CBNAME) \ @@ -1264,16 +1159,12 @@ extern wxPyApp *wxPythonApp; wxPyEndBlockThreads(blocked); \ if (! found) \ PCLASS::CBNAME(a, b, c); \ - } \ - void CLASS::base_##CBNAME(double a, double b, int c) { \ - PCLASS::CBNAME(a, b, c); \ - } + } //--------------------------------------------------------------------------- #define DEC_PYCALLBACK__BOOL2DBLINT(CBNAME) \ - void CBNAME(bool a, double b, double c, int d); \ - void base_##CBNAME(bool a, double b, double c, int d) + void CBNAME(bool a, double b, double c, int d) #define IMP_PYCALLBACK__BOOL2DBLINT(CLASS, PCLASS, CBNAME) \ @@ -1285,17 +1176,13 @@ extern wxPyApp *wxPythonApp; wxPyEndBlockThreads(blocked); \ if (! found) \ PCLASS::CBNAME(a, b, c, d); \ - } \ - void CLASS::base_##CBNAME(bool a, double b, double c, int d) { \ - PCLASS::CBNAME(a, b, c, d); \ - } + } //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #define DEC_PYCALLBACK__STRING(CBNAME) \ - void CBNAME(const wxString& a); \ - void base_##CBNAME(const wxString& a) + void CBNAME(const wxString& a) #define IMP_PYCALLBACK__STRING(CLASS, PCLASS, CBNAME) \ void CLASS::CBNAME(const wxString& a) { \ @@ -1309,16 +1196,12 @@ extern wxPyApp *wxPythonApp; wxPyEndBlockThreads(blocked); \ if (! found) \ PCLASS::CBNAME(a); \ - } \ - void CLASS::base_##CBNAME(const wxString& a) { \ - PCLASS::CBNAME(a); \ } //--------------------------------------------------------------------------- #define DEC_PYCALLBACK_BOOL_STRING(CBNAME) \ - bool CBNAME(const wxString& a); \ - bool base_##CBNAME(const wxString& a) + bool CBNAME(const wxString& a) #define IMP_PYCALLBACK_BOOL_STRING(CLASS, PCLASS, CBNAME) \ bool CLASS::CBNAME(const wxString& a) { \ @@ -1334,9 +1217,6 @@ extern wxPyApp *wxPythonApp; if (! found) \ rval = PCLASS::CBNAME(a); \ return rval; \ - } \ - bool CLASS::base_##CBNAME(const wxString& a) { \ - return PCLASS::CBNAME(a); \ } //--------------------------------------------------------------------------- @@ -1383,8 +1263,7 @@ extern wxPyApp *wxPythonApp; //--------------------------------------------------------------------------- #define DEC_PYCALLBACK_STRING_STRING(CBNAME) \ - wxString CBNAME(const wxString& a); \ - wxString base_##CBNAME(const wxString& a) + wxString CBNAME(const wxString& a) #define IMP_PYCALLBACK_STRING_STRING(CLASS, PCLASS, CBNAME) \ wxString CLASS::CBNAME(const wxString& a) { \ @@ -1433,8 +1312,7 @@ extern wxPyApp *wxPythonApp; //--------------------------------------------------------------------------- #define DEC_PYCALLBACK_BOOL_STRINGSTRING(CBNAME) \ - bool CBNAME(const wxString& a, const wxString& b); \ - bool base_##CBNAME(const wxString& a, const wxString& b) + bool CBNAME(const wxString& a, const wxString& b) #define IMP_PYCALLBACK_BOOL_STRINGSTRING(CLASS, PCLASS, CBNAME) \ bool CLASS::CBNAME(const wxString& a, const wxString& b) { \ @@ -1452,16 +1330,12 @@ extern wxPyApp *wxPythonApp; if (! found) \ rval = PCLASS::CBNAME(a, b); \ return rval; \ - } \ - bool CLASS::base_##CBNAME(const wxString& a, const wxString& b) { \ - return PCLASS::CBNAME(a, b); \ } //--------------------------------------------------------------------------- #define DEC_PYCALLBACK_STRING_(CBNAME) \ - wxString CBNAME(); \ - wxString base_##CBNAME() + wxString CBNAME() #define IMP_PYCALLBACK_STRING_(CLASS, PCLASS, CBNAME) \ wxString CLASS::CBNAME() { \ @@ -1480,16 +1354,12 @@ extern wxPyApp *wxPythonApp; if (! found) \ rval = PCLASS::CBNAME(); \ return rval; \ - } \ - wxString CLASS::base_##CBNAME() { \ - return PCLASS::CBNAME(); \ } //--------------------------------------------------------------------------- #define DEC_PYCALLBACK_STRING__const(CBNAME) \ - wxString CBNAME() const; \ - wxString base_##CBNAME() const; + wxString CBNAME() const #define IMP_PYCALLBACK_STRING__const(CLASS, PCLASS, CBNAME) \ wxString CLASS::CBNAME() const { \ @@ -1508,10 +1378,7 @@ extern wxPyApp *wxPythonApp; if (! found) \ rval = PCLASS::CBNAME(); \ return rval; \ - } \ - wxString CLASS::base_##CBNAME() const { \ - return PCLASS::CBNAME(); \ - } + } //--------------------------------------------------------------------------- @@ -1577,8 +1444,7 @@ extern wxPyApp *wxPythonApp; //--------------------------------------------------------------------------- #define DEC_PYCALLBACK__CELLINTINT(CBNAME) \ - void CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y); \ - void base_##CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y) + void CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y) #define IMP_PYCALLBACK__CELLINTINT(CLASS, PCLASS, CBNAME) \ void CLASS::CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y) { \ @@ -1592,16 +1458,12 @@ extern wxPyApp *wxPythonApp; wxPyEndBlockThreads(blocked); \ if (! found) \ PCLASS::CBNAME(cell, x, y); \ - } \ - void CLASS::base_##CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y) { \ - PCLASS::CBNAME(cell, x, y); \ - } + } //--------------------------------------------------------------------------- #define DEC_PYCALLBACK__COLOUR(CBNAME) \ - void CBNAME(const wxColour& c); \ - void base_##CBNAME(const wxColour& c) + void CBNAME(const wxColour& c); #define IMP_PYCALLBACK__COLOUR(CLASS, PCLASS, CBNAME) \ void CLASS::CBNAME(const wxColour& c) { \ @@ -1616,15 +1478,11 @@ extern wxPyApp *wxPythonApp; if (! found) \ PCLASS::CBNAME(c); \ } \ - void CLASS::base_##CBNAME(const wxColour& c) { \ - PCLASS::CBNAME(c); \ - } //--------------------------------------------------------------------------- #define DEC_PYCALLBACK__CELLINTINTME(CBNAME) \ - void CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y, const wxMouseEvent& e); \ - void base_##CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y, const wxMouseEvent& e) + void CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y, const wxMouseEvent& e) #define IMP_PYCALLBACK__CELLINTINTME(CLASS, PCLASS, CBNAME) \ void CLASS::CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y, const wxMouseEvent& e) { \ @@ -1640,11 +1498,7 @@ extern wxPyApp *wxPythonApp; wxPyEndBlockThreads(blocked); \ if (! found) \ PCLASS::CBNAME(cell, x, y, e); \ - } \ - void CLASS::base_##CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y, const wxMouseEvent& e) {\ - PCLASS::CBNAME(cell, x, y, e); \ - } - + } //--------------------------------------------------------------------------- @@ -1703,8 +1557,7 @@ extern wxPyApp *wxPythonApp; //--------------------------------------------------------------------------- #define DEC_PYCALLBACK_BOOL_WXWIN(CBNAME) \ - bool CBNAME(wxWindow* a); \ - bool base_##CBNAME(wxWindow* a) + bool CBNAME(wxWindow* a) #define IMP_PYCALLBACK_BOOL_WXWIN(CLASS, PCLASS, CBNAME) \ @@ -1721,16 +1574,12 @@ extern wxPyApp *wxPythonApp; if (! found) \ rval = PCLASS::CBNAME(a); \ return rval; \ - } \ - bool CLASS::base_##CBNAME(wxWindow* a) { \ - return PCLASS::CBNAME(a); \ - } + } //--------------------------------------------------------------------------- #define DEC_PYCALLBACK_BOOL_WXWINDC(CBNAME) \ - bool CBNAME(wxWindow* a, wxDC& b); \ - bool base_##CBNAME(wxWindow* a, wxDC& b) + bool CBNAME(wxWindow* a, wxDC& b) #define IMP_PYCALLBACK_BOOL_WXWINDC(CLASS, PCLASS, CBNAME) \ @@ -1749,16 +1598,12 @@ extern wxPyApp *wxPythonApp; if (! found) \ rval = PCLASS::CBNAME(a, b); \ return rval; \ - } \ - bool CLASS::base_##CBNAME(wxWindow* a, wxDC& b) { \ - return PCLASS::CBNAME(a, b); \ - } + } //--------------------------------------------------------------------------- #define DEC_PYCALLBACK_VOID_WXWINBASE(CBNAME) \ - void CBNAME(wxWindowBase* a); \ - void base_##CBNAME(wxWindowBase* a) + void CBNAME(wxWindowBase* a) #define IMP_PYCALLBACK_VOID_WXWINBASE(CLASS, PCLASS, CBNAME) \ @@ -1773,16 +1618,12 @@ extern wxPyApp *wxPythonApp; wxPyEndBlockThreads(blocked); \ if (! found) \ PCLASS::CBNAME(a); \ - } \ - void CLASS::base_##CBNAME(wxWindowBase* a) { \ - PCLASS::CBNAME(a); \ - } + } //--------------------------------------------------------------------------- #define DEC_PYCALLBACK_BOOL_(CBNAME) \ - bool CBNAME(); \ - bool base_##CBNAME() + bool CBNAME() #define IMP_PYCALLBACK_BOOL_(CLASS, PCLASS, CBNAME) \ @@ -1796,16 +1637,12 @@ extern wxPyApp *wxPythonApp; if (! found) \ rval = PCLASS::CBNAME(); \ return rval; \ - } \ - bool CLASS::base_##CBNAME() { \ - return PCLASS::CBNAME(); \ - } + } //--------------------------------------------------------------------------- #define DEC_PYCALLBACK_BOOL_const(CBNAME) \ - bool CBNAME() const; \ - bool base_##CBNAME() const + bool CBNAME() const #define IMP_PYCALLBACK_BOOL_const(CLASS, PCLASS, CBNAME) \ @@ -1819,16 +1656,12 @@ extern wxPyApp *wxPythonApp; if (! found) \ rval = PCLASS::CBNAME(); \ return rval; \ - } \ - bool CLASS::base_##CBNAME() const { \ - return PCLASS::CBNAME(); \ - } + } //--------------------------------------------------------------------------- #define DEC_PYCALLBACK_DR_2WXCDR(CBNAME) \ - wxDragResult CBNAME(wxCoord x, wxCoord y, wxDragResult def); \ - wxDragResult base_##CBNAME(wxCoord x, wxCoord y, wxDragResult def) + wxDragResult CBNAME(wxCoord x, wxCoord y, wxDragResult def) #define IMP_PYCALLBACK_DR_2WXCDR(CLASS, PCLASS, CBNAME) \ @@ -1842,10 +1675,7 @@ extern wxPyApp *wxPythonApp; if (! found) \ rval = PCLASS::CBNAME(a, b, c); \ return (wxDragResult)rval; \ - } \ - wxDragResult CLASS::base_##CBNAME(wxCoord a, wxCoord b, wxDragResult c) { \ - return PCLASS::CBNAME(a, b, c); \ - } + } //--------------------------------------------------------------------------- @@ -1876,8 +1706,7 @@ extern wxPyApp *wxPythonApp; //--------------------------------------------------------------------------- #define DEC_PYCALLBACK_BOOL_DR(CBNAME) \ - bool CBNAME(wxDragResult a); \ - bool base_##CBNAME(wxDragResult a) + bool CBNAME(wxDragResult a) #define IMP_PYCALLBACK_BOOL_DR(CLASS, PCLASS, CBNAME) \ @@ -1891,10 +1720,7 @@ extern wxPyApp *wxPythonApp; if (! found) \ rval = PCLASS::CBNAME(a); \ return rval; \ - } \ - bool CLASS::base_##CBNAME(wxDragResult a) { \ - return PCLASS::CBNAME(a); \ - } + } //--------------------------------------------------------------------------- @@ -1933,8 +1759,7 @@ extern wxPyApp *wxPythonApp; //--------------------------------------------------------------------------- #define DEC_PYCALLBACK_SIZET_(CBNAME) \ - size_t CBNAME(); \ - size_t base_##CBNAME() + size_t CBNAME() #define IMP_PYCALLBACK_SIZET_(CLASS, PCLASS, CBNAME) \ @@ -1948,16 +1773,12 @@ extern wxPyApp *wxPythonApp; if (! found) \ rval = PCLASS::CBNAME(); \ return rval; \ - } \ - size_t CLASS::base_##CBNAME() { \ - return PCLASS::CBNAME(); \ - } + } //--------------------------------------------------------------------------- #define DEC_PYCALLBACK_SIZET__const(CBNAME) \ - size_t CBNAME() const; \ - size_t base_##CBNAME() const + size_t CBNAME() const #define IMP_PYCALLBACK_SIZET__const(CLASS, PCLASS, CBNAME) \ @@ -1971,16 +1792,12 @@ extern wxPyApp *wxPythonApp; if (! found) \ rval = PCLASS::CBNAME(); \ return rval; \ - } \ - size_t CLASS::base_##CBNAME() const { \ - return PCLASS::CBNAME(); \ - } + } //--------------------------------------------------------------------------- #define DEC_PYCALLBACK_DATAFMT_SIZET(CBNAME) \ - wxDataFormat CBNAME(size_t a); \ - wxDataFormat base_##CBNAME(size_t a) + wxDataFormat CBNAME(size_t a) #define IMP_PYCALLBACK_DATAFMT_SIZET(CLASS, PCLASS, CBNAME) \ @@ -2002,16 +1819,12 @@ extern wxPyApp *wxPythonApp; if (! found) \ rval = PCLASS::CBNAME(a); \ return rval; \ - } \ - wxDataFormat CLASS::base_##CBNAME(size_t a) { \ - return PCLASS::CBNAME(a); \ - } + } //--------------------------------------------------------------------------- #define DEC_PYCALLBACK__constany(CBNAME, Type) \ - void CBNAME(const Type& a); \ - void base_##CBNAME(const Type& a) + void CBNAME(const Type& a) #define IMP_PYCALLBACK__constany(CLASS, PCLASS, CBNAME, Type) \ @@ -2026,17 +1839,13 @@ extern wxPyApp *wxPythonApp; wxPyEndBlockThreads(blocked); \ if (! found) \ PCLASS::CBNAME(a); \ - } \ - void CLASS::base_##CBNAME(const Type& a) { \ - PCLASS::CBNAME(a); \ - } + } //--------------------------------------------------------------------------- #define DEC_PYCALLBACK__any(CBNAME, Type) \ - void CBNAME(Type& a); \ - void base_##CBNAME(Type& a) + void CBNAME(Type& a) #define IMP_PYCALLBACK__any(CLASS, PCLASS, CBNAME, Type) \ @@ -2051,16 +1860,12 @@ extern wxPyApp *wxPythonApp; wxPyEndBlockThreads(blocked); \ if (! found) \ PCLASS::CBNAME(a); \ - } \ - void CLASS::base_##CBNAME(Type& a) { \ - PCLASS::CBNAME(a); \ - } + } //--------------------------------------------------------------------------- #define DEC_PYCALLBACK_bool_any(CBNAME, Type) \ - bool CBNAME(Type& a); \ - bool base_##CBNAME(Type& a) + bool CBNAME(Type& a) #define IMP_PYCALLBACK_bool_any(CLASS, PCLASS, CBNAME, Type) \ @@ -2077,10 +1882,7 @@ extern wxPyApp *wxPythonApp; if (! found) \ rv = PCLASS::CBNAME(a); \ return rv; \ - } \ - bool CLASS::base_##CBNAME(Type& a) { \ - return PCLASS::CBNAME(a); \ - } + } //--------------------------------------------------------------------------- @@ -2104,8 +1906,7 @@ extern wxPyApp *wxPythonApp; //--------------------------------------------------------------------------- #define DEC_PYCALLBACK_STRING_LONGLONG(CBNAME) \ - wxString CBNAME(long a, long b) const; \ - wxString base_##CBNAME(long a, long b) const + wxString CBNAME(long a, long b) const #define IMP_PYCALLBACK_STRING_LONGLONG(CLASS, PCLASS, CBNAME) \ wxString CLASS::CBNAME(long a, long b) const { \ @@ -2124,16 +1925,12 @@ extern wxPyApp *wxPythonApp; if (! found) \ rval = PCLASS::CBNAME(a,b); \ return rval; \ - } \ - wxString CLASS::base_##CBNAME(long a, long b) const { \ - return PCLASS::CBNAME(a,b); \ - } + } //--------------------------------------------------------------------------- #define DEC_PYCALLBACK_INT_LONG(CBNAME) \ - int CBNAME(long a) const; \ - int base_##CBNAME(long a) const + int CBNAME(long a) const #define IMP_PYCALLBACK_INT_LONG(CLASS, PCLASS, CBNAME) \ @@ -2153,12 +1950,7 @@ extern wxPyApp *wxPythonApp; if (! found) \ rval = PCLASS::CBNAME(a); \ return rval; \ - } \ - int CLASS::base_##CBNAME(long a) const { \ - return PCLASS::CBNAME(a); \ - } - - + } #define DEC_PYCALLBACK_INT_LONG_virtual(CBNAME) \ @@ -2186,8 +1978,7 @@ extern wxPyApp *wxPythonApp; //--------------------------------------------------------------------------- #define DEC_PYCALLBACK_INT_LONGLONG(CBNAME) \ - int CBNAME(long a, long b) const; \ - int base_##CBNAME(long a, long b) const + int CBNAME(long a, long b) const #define IMP_PYCALLBACK_INT_LONGLONG(CLASS, PCLASS, CBNAME) \ @@ -2207,12 +1998,7 @@ extern wxPyApp *wxPythonApp; if (! found) \ rval = PCLASS::CBNAME(a, b); \ return rval; \ - } \ - int CLASS::base_##CBNAME(long a, long b) const { \ - return PCLASS::CBNAME(a, b); \ - } - - + } #define DEC_PYCALLBACK_INT_LONGLONG_virtual(CBNAME) \ @@ -2240,8 +2026,7 @@ extern wxPyApp *wxPythonApp; //--------------------------------------------------------------------------- #define DEC_PYCALLBACK_LISTATTR_LONG(CBNAME) \ - wxListItemAttr* CBNAME(long a) const; \ - wxListItemAttr* base_##CBNAME(long a) const + wxListItemAttr* CBNAME(long a) const #define IMP_PYCALLBACK_LISTATTR_LONG(CLASS, PCLASS, CBNAME) \ @@ -2263,16 +2048,12 @@ extern wxPyApp *wxPythonApp; if (! found) \ rval = PCLASS::CBNAME(a); \ return rval; \ - } \ - wxListItemAttr *CLASS::base_##CBNAME(long a) const { \ - return PCLASS::CBNAME(a); \ - } + } //--------------------------------------------------------------------------- #define DEC_PYCALLBACK_BOOL_ME(CBNAME) \ - bool CBNAME(wxMouseEvent& e); \ - bool base_##CBNAME(wxMouseEvent& e) + bool CBNAME(wxMouseEvent& e) #define IMP_PYCALLBACK_BOOL_ME(CLASS, PCLASS, CBNAME) \ bool CLASS::CBNAME(wxMouseEvent& e) { \ @@ -2293,11 +2074,7 @@ extern wxPyApp *wxPythonApp; if (! found) \ return PCLASS::CBNAME(e); \ return rval; \ - } \ - bool CLASS::base_##CBNAME(wxMouseEvent& e) { \ - return PCLASS::CBNAME(e); \ - } - + } //--------------------------------------------------------------------------- @@ -2427,8 +2204,7 @@ extern wxPyApp *wxPythonApp; //--------------------------------------------------------------------------- #define DEC_PYCALLBACK_VOID_SIZETSIZET_const(CBNAME) \ - void CBNAME(size_t a, size_t b) const; \ - void base_##CBNAME(size_t a, size_t b) const + void CBNAME(size_t a, size_t b) const #define IMP_PYCALLBACK_VOID_SIZETSIZET_const(CLASS, PCLASS, CBNAME) \ @@ -2440,16 +2216,11 @@ extern wxPyApp *wxPythonApp; wxPyEndBlockThreads(blocked); \ if (! found) \ PCLASS::CBNAME(a,b); \ - } \ - void CLASS::base_##CBNAME(size_t a, size_t b) const { \ - PCLASS::CBNAME(a,b); \ - } - + } //--------------------------------------------------------------------------- #define DEC_PYCALLBACK_COORD_const(CBNAME) \ - wxCoord CBNAME() const; \ - wxCoord base_##CBNAME() const + wxCoord CBNAME() const #define IMP_PYCALLBACK_COORD_const(CLASS, PCLASS, CBNAME) \ @@ -2463,9 +2234,6 @@ extern wxPyApp *wxPythonApp; if (! found) \ rval = PCLASS::CBNAME(); \ return rval; \ - } \ - wxCoord CLASS::base_##CBNAME() const { \ - return PCLASS::CBNAME(); \ } //--------------------------------------------------------------------------- @@ -2490,8 +2258,7 @@ extern wxPyApp *wxPythonApp; //--------------------------------------------------------------------------- #define DEC_PYCALLBACK__DCRECTSIZET_const(CBNAME) \ - void CBNAME(wxDC& a, const wxRect& b, size_t c) const; \ - void base_##CBNAME(wxDC& a, const wxRect& b, size_t c) const + void CBNAME(wxDC& a, const wxRect& b, size_t c) const #define IMP_PYCALLBACK__DCRECTSIZET_const(CLASS, PCLASS, CBNAME) \ @@ -2507,17 +2274,13 @@ extern wxPyApp *wxPythonApp; wxPyEndBlockThreads(blocked); \ if (! found) \ PCLASS::CBNAME(a,b,c); \ - } \ - void CLASS::base_##CBNAME(wxDC& a, const wxRect& b, size_t c) const { \ - PCLASS::CBNAME(a,b,c); \ - } + } //--------------------------------------------------------------------------- #define DEC_PYCALLBACK_STRING_SIZET(CBNAME) \ - wxString CBNAME(size_t a) const; \ - wxString base_##CBNAME(size_t a) const + wxString CBNAME(size_t a) const #define IMP_PYCALLBACK_STRING_SIZET(CLASS, PCLASS, CBNAME) \ wxString CLASS::CBNAME(size_t a) const { \ @@ -2536,10 +2299,7 @@ extern wxPyApp *wxPythonApp; if (! found) \ rval = PCLASS::CBNAME(a); \ return rval; \ - } \ - wxString CLASS::base_##CBNAME(size_t a) const { \ - return PCLASS::CBNAME(a); \ - } + } //--------------------------------------------------------------------------- @@ -2566,8 +2326,7 @@ extern wxPyApp *wxPythonApp; //--------------------------------------------------------------------------- #define DEC_PYCALLBACK_VIZATTR_(CBNAME) \ - wxVisualAttributes CBNAME() const; \ - wxVisualAttributes base_##CBNAME() + wxVisualAttributes CBNAME() const #define IMP_PYCALLBACK_VIZATTR_(CLASS, PCLASS, CBNAME) \ @@ -2589,9 +2348,6 @@ extern wxPyApp *wxPythonApp; if (! found) \ rval = PCLASS::CBNAME(); \ return rval; \ - } \ - wxVisualAttributes CLASS::base_##CBNAME() { \ - return PCLASS::CBNAME(); \ } //--------------------------------------------------------------------------- diff --git a/wxPython/src/_defs.i b/wxPython/src/_defs.i index c07f2078b6..691a02987d 100644 --- a/wxPython/src/_defs.i +++ b/wxPython/src/_defs.i @@ -381,6 +381,23 @@ typedef unsigned long wxUIntPtr; %enddef #endif + +//--------------------------------------------------------------------------- +// Generates a base_On* method that just wraps a call to the On*, and mark it +// deprecated. We need this because there is no longer any need for a +// base_On* method to be able to call the C++ base class method, since our +// virtualization code can now sense when an attempt is being made to call +// the base class version from the derived class override. + +%define %MAKE_BASE_FUNC(Class, Method) + %pythoncode { + def base_##Method(*args, **kw): + return Class.Method(*args, **kw) + base_##Method = wx._deprecated(base_##Method, + "Please use Class.Method instead.") + } +%enddef + //--------------------------------------------------------------------------- // Forward declarations and %renames for some classes, so the autodoc strings // will be able to use the right types even when the real class declaration is diff --git a/wxPython/src/_dnd.i b/wxPython/src/_dnd.i index 39702a1980..01a908c031 100644 --- a/wxPython/src/_dnd.i +++ b/wxPython/src/_dnd.i @@ -84,7 +84,8 @@ public: wxDragResult DoDragDrop(int flags = wxDrag_CopyOnly); - bool base_GiveFeedback(wxDragResult effect); + bool GiveFeedback(wxDragResult effect); + %MAKE_BASE_FUNC(DropSource, GiveFeedback); }; @@ -151,11 +152,17 @@ public: %cleardisown( wxDataObject *dataObject ); - wxDragResult base_OnEnter(wxCoord x, wxCoord y, wxDragResult def); - wxDragResult base_OnDragOver(wxCoord x, wxCoord y, wxDragResult def); - void base_OnLeave(); - bool base_OnDrop(wxCoord x, wxCoord y); + wxDragResult OnEnter(wxCoord x, wxCoord y, wxDragResult def); + wxDragResult OnDragOver(wxCoord x, wxCoord y, wxDragResult def); + void OnLeave(); + bool OnDrop(wxCoord x, wxCoord y); + %MAKE_BASE_FUNC(DropTarget, OnEnter); + %MAKE_BASE_FUNC(DropTarget, OnDragOver); + %MAKE_BASE_FUNC(DropTarget, OnLeave); + %MAKE_BASE_FUNC(DropTarget, OnDrop); + + // may be called *only* from inside OnData() and will fill m_dataObject // with the data from the drop source if it returns True bool GetData(); @@ -213,12 +220,19 @@ public: wxPyTextDropTarget(); void _setCallbackInfo(PyObject* self, PyObject* _class); - //bool OnDropText(wxCoord x, wxCoord y, const wxString& text) = 0; - wxDragResult base_OnEnter(wxCoord x, wxCoord y, wxDragResult def); - wxDragResult base_OnDragOver(wxCoord x, wxCoord y, wxDragResult def); - void base_OnLeave(); - bool base_OnDrop(wxCoord x, wxCoord y); - wxDragResult base_OnData(wxCoord x, wxCoord y, wxDragResult def); + bool OnDropText(wxCoord x, wxCoord y, const wxString& text); + wxDragResult OnEnter(wxCoord x, wxCoord y, wxDragResult def); + wxDragResult OnDragOver(wxCoord x, wxCoord y, wxDragResult def); + void OnLeave(); + bool OnDrop(wxCoord x, wxCoord y); + wxDragResult OnData(wxCoord x, wxCoord y, wxDragResult def); + + %MAKE_BASE_FUNC(TextDropTarget, OnDropText); + %MAKE_BASE_FUNC(TextDropTarget, OnEnter); + %MAKE_BASE_FUNC(TextDropTarget, OnDragOver); + %MAKE_BASE_FUNC(TextDropTarget, OnLeave); + %MAKE_BASE_FUNC(TextDropTarget, OnDrop); + %MAKE_BASE_FUNC(TextDropTarget, OnData); }; //--------------------------------------------------------------------------- @@ -275,12 +289,19 @@ public: wxPyFileDropTarget(); void _setCallbackInfo(PyObject* self, PyObject* _class); -// bool OnDropFiles(wxCoord x, wxCoord y, const wxArrayString& filenames) = 0; - wxDragResult base_OnEnter(wxCoord x, wxCoord y, wxDragResult def); - wxDragResult base_OnDragOver(wxCoord x, wxCoord y, wxDragResult def); - void base_OnLeave(); - bool base_OnDrop(wxCoord x, wxCoord y); - wxDragResult base_OnData(wxCoord x, wxCoord y, wxDragResult def); + bool OnDropFiles(wxCoord x, wxCoord y, const wxArrayString& filenames); + wxDragResult OnEnter(wxCoord x, wxCoord y, wxDragResult def); + wxDragResult OnDragOver(wxCoord x, wxCoord y, wxDragResult def); + void OnLeave(); + bool OnDrop(wxCoord x, wxCoord y); + wxDragResult OnData(wxCoord x, wxCoord y, wxDragResult def); + + %MAKE_BASE_FUNC(FileDropTarget, OnDropFiles); + %MAKE_BASE_FUNC(FileDropTarget, OnEnter); + %MAKE_BASE_FUNC(FileDropTarget, OnDragOver); + %MAKE_BASE_FUNC(FileDropTarget, OnLeave); + %MAKE_BASE_FUNC(FileDropTarget, OnDrop); + %MAKE_BASE_FUNC(FileDropTarget, OnData); }; diff --git a/wxPython/src/_log.i b/wxPython/src/_log.i index 4aa96d65bd..3d52bf3a7d 100644 --- a/wxPython/src/_log.i +++ b/wxPython/src/_log.i @@ -154,6 +154,9 @@ public: %pythonAppend Destroy "args[0].thisown = 0"; %extend { void Destroy() { delete self; } } + + void DoLog(wxLogLevel level, const wxChar *szString, long t); + void DoLogString(const wxChar *szString, long t); }; @@ -388,8 +391,10 @@ public: wxLog::DoLogString(szString, t); } + DEC_PYCALLBACK_VOID_(Flush); PYPRIVATE; }; +IMP_PYCALLBACK_VOID_(wxPyLog, wxLog, Flush); %} // Now tell SWIG about it diff --git a/wxPython/src/_printfw.i b/wxPython/src/_printfw.i index fb390d0979..d6a702a12c 100644 --- a/wxPython/src/_printfw.i +++ b/wxPython/src/_printfw.i @@ -393,9 +393,6 @@ void wxPyPrintout::GetPageInfo(int *minPage, int *maxPage, int *pageFrom, int *p wxPrintout::GetPageInfo(minPage, maxPage, pageFrom, pageTo); } -void wxPyPrintout::base_GetPageInfo(int *minPage, int *maxPage, int *pageFrom, int *pageTo) { - wxPrintout::GetPageInfo(minPage, maxPage, pageFrom, pageTo); -} IMP_PYCALLBACK_BOOL_INTINT(wxPyPrintout, wxPrintout, OnBeginDocument); @@ -452,15 +449,22 @@ public: void SetIsPreview(bool p); - bool base_OnBeginDocument(int startPage, int endPage); - void base_OnEndDocument(); - void base_OnBeginPrinting(); - void base_OnEndPrinting(); - void base_OnPreparePrinting(); - bool base_HasPage(int page); + bool OnBeginDocument(int startPage, int endPage); + void OnEndDocument(); + void OnBeginPrinting(); + void OnEndPrinting(); + void OnPreparePrinting(); + bool HasPage(int page); DocDeclA( - void, base_GetPageInfo(int *OUTPUT, int *OUTPUT, int *OUTPUT, int *OUTPUT), - "base_GetPageInfo() -> (minPage, maxPage, pageFrom, pageTo)"); + void, GetPageInfo(int *OUTPUT, int *OUTPUT, int *OUTPUT, int *OUTPUT), + "GetPageInfo() -> (minPage, maxPage, pageFrom, pageTo)"); + + %MAKE_BASE_FUNC(Printout, OnBeginDocument); + %MAKE_BASE_FUNC(Printout, OnEndDocument); + %MAKE_BASE_FUNC(Printout, OnBeginPrinting); + %MAKE_BASE_FUNC(Printout, OnEndPrinting); + %MAKE_BASE_FUNC(Printout, OnPreparePrinting); + %MAKE_BASE_FUNC(Printout, GetPageInfo); }; //--------------------------------------------------------------------------- @@ -617,8 +621,7 @@ public: %{ #define DEC_PYCALLBACK_BOOL_PREWINDC(CBNAME) \ - bool CBNAME(wxPreviewCanvas* a, wxDC& b); \ - bool base_##CBNAME(wxPreviewCanvas* a, wxDC& b) + bool CBNAME(wxPreviewCanvas* a, wxDC& b) #define IMP_PYCALLBACK_BOOL_PREWINDC(CLASS, PCLASS, CBNAME) \ @@ -637,10 +640,7 @@ public: if (! found) \ rval = PCLASS::CBNAME(a, b); \ return rval; \ - } \ - bool CLASS::base_##CBNAME(wxPreviewCanvas* a, wxDC& b) { \ - return PCLASS::CBNAME(a, b); \ - } + } @@ -706,13 +706,21 @@ public: void _setCallbackInfo(PyObject* self, PyObject* _class); - bool base_SetCurrentPage(int pageNum); - bool base_PaintPage(wxPreviewCanvas *canvas, wxDC& dc); - bool base_DrawBlankPage(wxPreviewCanvas *canvas, wxDC& dc); - bool base_RenderPage(int pageNum); - void base_SetZoom(int percent); - bool base_Print(bool interactive); - void base_DetermineScaling(); + bool SetCurrentPage(int pageNum); + bool PaintPage(wxPreviewCanvas *canvas, wxDC& dc); + bool DrawBlankPage(wxPreviewCanvas *canvas, wxDC& dc); + bool RenderPage(int pageNum); + void SetZoom(int percent); + bool Print(bool interactive); + void DetermineScaling(); + + %MAKE_BASE_FUNC(PyPrintPreview, SetCurrentPage); + %MAKE_BASE_FUNC(PyPrintPreview, PaintPage); + %MAKE_BASE_FUNC(PyPrintPreview, DrawBlankPage); + %MAKE_BASE_FUNC(PyPrintPreview, RenderPage); + %MAKE_BASE_FUNC(PyPrintPreview, SetZoom); + %MAKE_BASE_FUNC(PyPrintPreview, Print); + %MAKE_BASE_FUNC(PyPrintPreview, DetermineScaling); }; @@ -769,9 +777,13 @@ public: void SetPreviewCanvas(wxPreviewCanvas* canvas); void SetControlBar(wxPreviewControlBar* bar); - void base_Initialize(); - void base_CreateCanvas(); - void base_CreateControlBar(); + void Initialize(); + void CreateCanvas(); + void CreateControlBar(); + + %MAKE_BASE_FUNC(PyPreviewFrame, Initialize); + %MAKE_BASE_FUNC(PyPreviewFrame, CreateCanvas); + %MAKE_BASE_FUNC(PyPreviewFrame, CreateControlBar); }; @@ -825,8 +837,11 @@ public: void SetPrintPreview(wxPrintPreview* preview); - void base_CreateButtons(); - void base_SetZoomControl(int zoom); + void CreateButtons(); + void SetZoomControl(int zoom); + + %MAKE_BASE_FUNC(PreviewControlBar, CreateButtons); + %MAKE_BASE_FUNC(PreviewControlBar, SetZoomControl); }; //--------------------------------------------------------------------------- diff --git a/wxPython/src/_process.i b/wxPython/src/_process.i index 7c26a92e8b..b256ae7114 100644 --- a/wxPython/src/_process.i +++ b/wxPython/src/_process.i @@ -104,8 +104,9 @@ public: void _setCallbackInfo(PyObject* self, PyObject* _class); - void base_OnTerminate(int pid, int status); - + void OnTerminate(int pid, int status); + %MAKE_BASE_FUNC(Process, OnTerminate); + // call Redirect before passing the object to wxExecute() to redirect the // launched process stdin/stdout, then use GetInputStream() and // GetOutputStream() to get access to them diff --git a/wxPython/src/_pycontrol.i b/wxPython/src/_pycontrol.i index 70bdedaeca..a9ad85b4d9 100644 --- a/wxPython/src/_pycontrol.i +++ b/wxPython/src/_pycontrol.i @@ -136,41 +136,63 @@ public: void SetBestSize(const wxSize& size); bool DoEraseBackground(wxDC* dc); - void base_DoMoveWindow(int x, int y, int width, int height); - void base_DoSetSize(int x, int y, int width, int height, + void DoMoveWindow(int x, int y, int width, int height); + void DoSetSize(int x, int y, int width, int height, int sizeFlags = wxSIZE_AUTO); - void base_DoSetClientSize(int width, int height); - void base_DoSetVirtualSize( int x, int y ); + void DoSetClientSize(int width, int height); + void DoSetVirtualSize( int x, int y ); DocDeclA( - void, base_DoGetSize( int *OUTPUT, int *OUTPUT ) const, - "base_DoGetSize() -> (width, height)"); + void, DoGetSize( int *OUTPUT, int *OUTPUT ) const, + "DoGetSize() -> (width, height)"); DocDeclA( - void, base_DoGetClientSize( int *OUTPUT, int *OUTPUT ) const, - "base_DoGetClientSize() -> (width, height)"); + void, DoGetClientSize( int *OUTPUT, int *OUTPUT ) const, + "DoGetClientSize() -> (width, height)"); DocDeclA( - void, base_DoGetPosition( int *OUTPUT, int *OUTPUT ) const, - "base_DoGetPosition() -> (x,y)"); - - wxSize base_DoGetVirtualSize() const; - wxSize base_DoGetBestSize() const; - - void base_InitDialog(); - bool base_TransferDataToWindow(); - bool base_TransferDataFromWindow(); - bool base_Validate(); - - bool base_AcceptsFocus() const; - bool base_AcceptsFocusFromKeyboard() const; - wxSize base_GetMaxSize() const; - - void base_AddChild(wxWindow* child); - void base_RemoveChild(wxWindow* child); - - bool base_ShouldInheritColours() const; - wxVisualAttributes base_GetDefaultAttributes(); - - void base_OnInternalIdle(); + void, DoGetPosition( int *OUTPUT, int *OUTPUT ) const, + "DoGetPosition() -> (x,y)"); + + wxSize DoGetVirtualSize() const; + wxSize DoGetBestSize() const; + + void InitDialog(); + bool TransferDataToWindow(); + bool TransferDataFromWindow(); + bool Validate(); + + bool AcceptsFocus() const; + bool AcceptsFocusFromKeyboard() const; + wxSize GetMaxSize() const; + + void AddChild(wxWindow* child); + void RemoveChild(wxWindow* child); + + bool ShouldInheritColours() const; + wxVisualAttributes GetDefaultAttributes(); + + void OnInternalIdle(); + + %MAKE_BASE_FUNC(PyScrolledWindow, DoMoveWindow); + %MAKE_BASE_FUNC(PyScrolledWindow, DoSetSize); + %MAKE_BASE_FUNC(PyScrolledWindow, DoSetClientSize); + %MAKE_BASE_FUNC(PyScrolledWindow, DoSetVirtualSize); + %MAKE_BASE_FUNC(PyScrolledWindow, DoGetSize); + %MAKE_BASE_FUNC(PyScrolledWindow, DoGetClientSize); + %MAKE_BASE_FUNC(PyScrolledWindow, DoGetPosition); + %MAKE_BASE_FUNC(PyScrolledWindow, DoGetVirtualSize); + %MAKE_BASE_FUNC(PyScrolledWindow, DoGetBestSize); + %MAKE_BASE_FUNC(PyScrolledWindow, InitDialog); + %MAKE_BASE_FUNC(PyScrolledWindow, TransferDataToWindow); + %MAKE_BASE_FUNC(PyScrolledWindow, TransferDataFromWindow); + %MAKE_BASE_FUNC(PyScrolledWindow, Validate); + %MAKE_BASE_FUNC(PyScrolledWindow, AcceptsFocus); + %MAKE_BASE_FUNC(PyScrolledWindow, AcceptsFocusFromKeyboard); + %MAKE_BASE_FUNC(PyScrolledWindow, GetMaxSize); + %MAKE_BASE_FUNC(PyScrolledWindow, AddChild); + %MAKE_BASE_FUNC(PyScrolledWindow, RemoveChild); + %MAKE_BASE_FUNC(PyScrolledWindow, ShouldInheritColours); + %MAKE_BASE_FUNC(PyScrolledWindow, GetDefaultAttributes); + %MAKE_BASE_FUNC(PyScrolledWindow, OnInternalIdle); }; diff --git a/wxPython/src/_pywindows.i b/wxPython/src/_pywindows.i index 00d753c045..9b9a06188d 100644 --- a/wxPython/src/_pywindows.i +++ b/wxPython/src/_pywindows.i @@ -163,42 +163,64 @@ public: void SetBestSize(const wxSize& size); bool DoEraseBackground(wxDC* dc); - void base_DoMoveWindow(int x, int y, int width, int height); - void base_DoSetSize(int x, int y, int width, int height, - int sizeFlags = wxSIZE_AUTO); - void base_DoSetClientSize(int width, int height); - void base_DoSetVirtualSize( int x, int y ); + void DoMoveWindow(int x, int y, int width, int height); + void DoSetSize(int x, int y, int width, int height, + int sizeFlags = wxSIZE_AUTO); + void DoSetClientSize(int width, int height); + void DoSetVirtualSize( int x, int y ); DocDeclA( - void, base_DoGetSize( int *OUTPUT, int *OUTPUT ) const, - "base_DoGetSize() -> (width, height)"); + void, DoGetSize( int *OUTPUT, int *OUTPUT ) const, + "DoGetSize() -> (width, height)"); DocDeclA( - void, base_DoGetClientSize( int *OUTPUT, int *OUTPUT ) const, - "base_DoGetClientSize() -> (width, height)"); + void, DoGetClientSize( int *OUTPUT, int *OUTPUT ) const, + "DoGetClientSize() -> (width, height)"); DocDeclA( - void, base_DoGetPosition( int *OUTPUT, int *OUTPUT ) const, - "base_DoGetPosition() -> (x,y)"); - - wxSize base_DoGetVirtualSize() const; - wxSize base_DoGetBestSize() const; - - void base_InitDialog(); - bool base_TransferDataToWindow(); - bool base_TransferDataFromWindow(); - bool base_Validate(); - - bool base_AcceptsFocus() const; - bool base_AcceptsFocusFromKeyboard() const; - wxSize base_GetMaxSize() const; - - void base_AddChild(wxWindow* child); - void base_RemoveChild(wxWindow* child); - - bool base_ShouldInheritColours() const; - wxVisualAttributes base_GetDefaultAttributes(); - - void base_OnInternalIdle(); - + void, DoGetPosition( int *OUTPUT, int *OUTPUT ) const, + "DoGetPosition() -> (x,y)"); + + wxSize DoGetVirtualSize() const; + wxSize DoGetBestSize() const; + + void InitDialog(); + bool TransferDataToWindow(); + bool TransferDataFromWindow(); + bool Validate(); + + bool AcceptsFocus() const; + bool AcceptsFocusFromKeyboard() const; + wxSize GetMaxSize() const; + + void AddChild(wxWindow* child); + void RemoveChild(wxWindow* child); + + bool ShouldInheritColours() const; + wxVisualAttributes GetDefaultAttributes(); + + void OnInternalIdle(); + + %MAKE_BASE_FUNC(PyWindow, DoMoveWindow); + %MAKE_BASE_FUNC(PyWindow, DoSetSize); + %MAKE_BASE_FUNC(PyWindow, DoSetClientSize); + %MAKE_BASE_FUNC(PyWindow, DoSetVirtualSize); + %MAKE_BASE_FUNC(PyWindow, DoGetSize); + %MAKE_BASE_FUNC(PyWindow, DoGetClientSize); + %MAKE_BASE_FUNC(PyWindow, DoGetPosition); + %MAKE_BASE_FUNC(PyWindow, DoGetVirtualSize); + %MAKE_BASE_FUNC(PyWindow, DoGetBestSize); + %MAKE_BASE_FUNC(PyWindow, InitDialog); + %MAKE_BASE_FUNC(PyWindow, TransferDataToWindow); + %MAKE_BASE_FUNC(PyWindow, TransferDataFromWindow); + %MAKE_BASE_FUNC(PyWindow, Validate); + %MAKE_BASE_FUNC(PyWindow, AcceptsFocus); + %MAKE_BASE_FUNC(PyWindow, AcceptsFocusFromKeyboard); + %MAKE_BASE_FUNC(PyWindow, GetMaxSize); + %MAKE_BASE_FUNC(PyWindow, AddChild); + %MAKE_BASE_FUNC(PyWindow, RemoveChild); + %MAKE_BASE_FUNC(PyWindow, ShouldInheritColours); + %MAKE_BASE_FUNC(PyWindow, GetDefaultAttributes); + %MAKE_BASE_FUNC(PyWindow, OnInternalIdle); + }; //--------------------------------------------------------------------------- @@ -324,42 +346,63 @@ public: void SetBestSize(const wxSize& size); bool DoEraseBackground(wxDC* dc); - void base_DoMoveWindow(int x, int y, int width, int height); - void base_DoSetSize(int x, int y, int width, int height, + void DoMoveWindow(int x, int y, int width, int height); + void DoSetSize(int x, int y, int width, int height, int sizeFlags = wxSIZE_AUTO); - void base_DoSetClientSize(int width, int height); - void base_DoSetVirtualSize( int x, int y ); + void DoSetClientSize(int width, int height); + void DoSetVirtualSize( int x, int y ); DocDeclA( - void, base_DoGetSize( int *OUTPUT, int *OUTPUT ) const, - "base_DoGetSize() -> (width, height)"); + void, DoGetSize( int *OUTPUT, int *OUTPUT ) const, + "DoGetSize() -> (width, height)"); DocDeclA( - void, base_DoGetClientSize( int *OUTPUT, int *OUTPUT ) const, - "base_DoGetClientSize() -> (width, height)"); + void, DoGetClientSize( int *OUTPUT, int *OUTPUT ) const, + "DoGetClientSize() -> (width, height)"); DocDeclA( - void, base_DoGetPosition( int *OUTPUT, int *OUTPUT ) const, - "base_DoGetPosition() -> (x,y)"); - - wxSize base_DoGetVirtualSize() const; - wxSize base_DoGetBestSize() const; - - void base_InitDialog(); - bool base_TransferDataToWindow(); - bool base_TransferDataFromWindow(); - bool base_Validate(); - - bool base_AcceptsFocus() const; - bool base_AcceptsFocusFromKeyboard() const; - wxSize base_GetMaxSize() const; - - void base_AddChild(wxWindow* child); - void base_RemoveChild(wxWindow* child); - - bool base_ShouldInheritColours() const ; - wxVisualAttributes base_GetDefaultAttributes(); - - void base_OnInternalIdle(); - + void, DoGetPosition( int *OUTPUT, int *OUTPUT ) const, + "DoGetPosition() -> (x,y)"); + + wxSize DoGetVirtualSize() const; + wxSize DoGetBestSize() const; + + void InitDialog(); + bool TransferDataToWindow(); + bool TransferDataFromWindow(); + bool Validate(); + + bool AcceptsFocus() const; + bool AcceptsFocusFromKeyboard() const; + wxSize GetMaxSize() const; + + void AddChild(wxWindow* child); + void RemoveChild(wxWindow* child); + + bool ShouldInheritColours() const ; + wxVisualAttributes GetDefaultAttributes(); + + void OnInternalIdle(); + + %MAKE_BASE_FUNC(PyPanel, DoMoveWindow); + %MAKE_BASE_FUNC(PyPanel, DoSetSize); + %MAKE_BASE_FUNC(PyPanel, DoSetClientSize); + %MAKE_BASE_FUNC(PyPanel, DoSetVirtualSize); + %MAKE_BASE_FUNC(PyPanel, DoGetSize); + %MAKE_BASE_FUNC(PyPanel, DoGetClientSize); + %MAKE_BASE_FUNC(PyPanel, DoGetPosition); + %MAKE_BASE_FUNC(PyPanel, DoGetVirtualSize); + %MAKE_BASE_FUNC(PyPanel, DoGetBestSize); + %MAKE_BASE_FUNC(PyPanel, InitDialog); + %MAKE_BASE_FUNC(PyPanel, TransferDataToWindow); + %MAKE_BASE_FUNC(PyPanel, TransferDataFromWindow); + %MAKE_BASE_FUNC(PyPanel, Validate); + %MAKE_BASE_FUNC(PyPanel, AcceptsFocus); + %MAKE_BASE_FUNC(PyPanel, AcceptsFocusFromKeyboard); + %MAKE_BASE_FUNC(PyPanel, GetMaxSize); + %MAKE_BASE_FUNC(PyPanel, AddChild); + %MAKE_BASE_FUNC(PyPanel, RemoveChild); + %MAKE_BASE_FUNC(PyPanel, ShouldInheritColours); + %MAKE_BASE_FUNC(PyPanel, GetDefaultAttributes); + %MAKE_BASE_FUNC(PyPanel, OnInternalIdle); }; //--------------------------------------------------------------------------- @@ -478,41 +521,63 @@ public: void SetBestSize(const wxSize& size); bool DoEraseBackground(wxDC* dc); - void base_DoMoveWindow(int x, int y, int width, int height); - void base_DoSetSize(int x, int y, int width, int height, + void DoMoveWindow(int x, int y, int width, int height); + void DoSetSize(int x, int y, int width, int height, int sizeFlags = wxSIZE_AUTO); - void base_DoSetClientSize(int width, int height); - void base_DoSetVirtualSize( int x, int y ); + void DoSetClientSize(int width, int height); + void DoSetVirtualSize( int x, int y ); DocDeclA( - void, base_DoGetSize( int *OUTPUT, int *OUTPUT ) const, - "base_DoGetSize() -> (width, height)"); + void, DoGetSize( int *OUTPUT, int *OUTPUT ) const, + "DoGetSize() -> (width, height)"); DocDeclA( - void, base_DoGetClientSize( int *OUTPUT, int *OUTPUT ) const, - "base_DoGetClientSize() -> (width, height)"); + void, DoGetClientSize( int *OUTPUT, int *OUTPUT ) const, + "DoGetClientSize() -> (width, height)"); DocDeclA( - void, base_DoGetPosition( int *OUTPUT, int *OUTPUT ) const, - "base_DoGetPosition() -> (x,y)"); - - wxSize base_DoGetVirtualSize() const; - wxSize base_DoGetBestSize() const; - - void base_InitDialog(); - bool base_TransferDataToWindow(); - bool base_TransferDataFromWindow(); - bool base_Validate(); - - bool base_AcceptsFocus() const; - bool base_AcceptsFocusFromKeyboard() const; - wxSize base_GetMaxSize() const; - - void base_AddChild(wxWindow* child); - void base_RemoveChild(wxWindow* child); - - bool base_ShouldInheritColours() const; - wxVisualAttributes base_GetDefaultAttributes(); - - void base_OnInternalIdle(); + void, DoGetPosition( int *OUTPUT, int *OUTPUT ) const, + "DoGetPosition() -> (x,y)"); + + wxSize DoGetVirtualSize() const; + wxSize DoGetBestSize() const; + + void InitDialog(); + bool TransferDataToWindow(); + bool TransferDataFromWindow(); + bool Validate(); + + bool AcceptsFocus() const; + bool AcceptsFocusFromKeyboard() const; + wxSize GetMaxSize() const; + + void AddChild(wxWindow* child); + void RemoveChild(wxWindow* child); + + bool ShouldInheritColours() const; + wxVisualAttributes GetDefaultAttributes(); + + void OnInternalIdle(); + + %MAKE_BASE_FUNC(PyScrolledWindow, DoMoveWindow); + %MAKE_BASE_FUNC(PyScrolledWindow, DoSetSize); + %MAKE_BASE_FUNC(PyScrolledWindow, DoSetClientSize); + %MAKE_BASE_FUNC(PyScrolledWindow, DoSetVirtualSize); + %MAKE_BASE_FUNC(PyScrolledWindow, DoGetSize); + %MAKE_BASE_FUNC(PyScrolledWindow, DoGetClientSize); + %MAKE_BASE_FUNC(PyScrolledWindow, DoGetPosition); + %MAKE_BASE_FUNC(PyScrolledWindow, DoGetVirtualSize); + %MAKE_BASE_FUNC(PyScrolledWindow, DoGetBestSize); + %MAKE_BASE_FUNC(PyScrolledWindow, InitDialog); + %MAKE_BASE_FUNC(PyScrolledWindow, TransferDataToWindow); + %MAKE_BASE_FUNC(PyScrolledWindow, TransferDataFromWindow); + %MAKE_BASE_FUNC(PyScrolledWindow, Validate); + %MAKE_BASE_FUNC(PyScrolledWindow, AcceptsFocus); + %MAKE_BASE_FUNC(PyScrolledWindow, AcceptsFocusFromKeyboard); + %MAKE_BASE_FUNC(PyScrolledWindow, GetMaxSize); + %MAKE_BASE_FUNC(PyScrolledWindow, AddChild); + %MAKE_BASE_FUNC(PyScrolledWindow, RemoveChild); + %MAKE_BASE_FUNC(PyScrolledWindow, ShouldInheritColours); + %MAKE_BASE_FUNC(PyScrolledWindow, GetDefaultAttributes); + %MAKE_BASE_FUNC(PyScrolledWindow, OnInternalIdle); }; diff --git a/wxPython/src/_timer.i b/wxPython/src/_timer.i index 69ea2a2674..f86f692c76 100644 --- a/wxPython/src/_timer.i +++ b/wxPython/src/_timer.i @@ -32,7 +32,7 @@ enum { %{ -//IMP_PYCALLBACK__(wxPyTimer, wxTimer, Notify); +IMP_PYCALLBACK__(wxPyTimer, wxTimer, Notify); IMPLEMENT_ABSTRACT_CLASS(wxPyTimer, wxTimer); @@ -41,21 +41,6 @@ wxPyTimer::wxPyTimer(wxEvtHandler *owner, int id) { if (owner == NULL) SetOwner(this); } - - -void wxPyTimer::Notify() { - bool found; - wxPyBlock_t blocked = wxPyBeginBlockThreads(); - if ((found = wxPyCBH_findCallback(m_myInst, "Notify"))) - wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); - wxPyEndBlockThreads(blocked); - if (! found) - wxTimer::Notify(); -} -void wxPyTimer::base_Notify() { - wxTimer::Notify(); -} - %} @@ -101,7 +86,7 @@ public: // override this in your wxTimer-derived class if you want to process timer // messages in it, use non default ctor or SetOwner() otherwise - //virtual void Notify(); + virtual void Notify(); // return True if the timer is running virtual bool IsRunning() const; diff --git a/wxPython/src/grid.i b/wxPython/src/grid.i index fa42ac8fee..3e63084f40 100644 --- a/wxPython/src/grid.i +++ b/wxPython/src/grid.i @@ -114,11 +114,7 @@ wxPyMake_TEMPLATE(wxGridTableBase) if (! found) \ rval = PCLASS::CBNAME(a, b, c); \ return rval; \ - } \ - wxGridCellAttr *base_##CBNAME(int a, int b, wxGridCellAttr::wxAttrKind c) { \ - return PCLASS::CBNAME(a, b, c); \ - } - + } #define PYCALLBACK__GCAINTINT(PCLASS, CBNAME) \ @@ -133,10 +129,7 @@ wxPyMake_TEMPLATE(wxGridTableBase) wxPyEndBlockThreads(blocked); \ if (! found) \ PCLASS::CBNAME(attr, a, b); \ - } \ - void base_##CBNAME(wxGridCellAttr *attr, int a, int b) { \ - PCLASS::CBNAME(attr, a, b); \ - } + } @@ -152,10 +145,7 @@ wxPyMake_TEMPLATE(wxGridTableBase) wxPyEndBlockThreads(blocked); \ if (! found) \ PCLASS::CBNAME(attr, val); \ - } \ - void base_##CBNAME(wxGridCellAttr *attr, int val) { \ - PCLASS::CBNAME(attr, val); \ - } + } @@ -228,10 +218,7 @@ wxPyMake_TEMPLATE(wxGridTableBase) if (! found) \ rval = PCLASS::CBNAME(a, b); \ return rval; \ - } \ - wxString base_##CBNAME(int a, int b) { \ - return PCLASS::CBNAME(a, b); \ - } + } #define PYCALLBACK_BOOL_INTINTSTRING(PCLASS, CBNAME) \ @@ -248,10 +235,7 @@ wxPyMake_TEMPLATE(wxGridTableBase) if (! found) \ rval = PCLASS::CBNAME(a,b,c); \ return rval; \ - } \ - bool base_##CBNAME(int a, int b, const wxString& c) { \ - return PCLASS::CBNAME(a,b,c); \ - } + } @@ -267,11 +251,7 @@ wxPyMake_TEMPLATE(wxGridTableBase) if (! found) \ rval = PCLASS::CBNAME(a,b); \ return rval; \ - } \ - long base_##CBNAME(int a, int b) { \ - return PCLASS::CBNAME(a,b); \ - } - + } #define PYCALLBACK_BOOL_INTINT(PCLASS, CBNAME) \ @@ -285,10 +265,7 @@ wxPyMake_TEMPLATE(wxGridTableBase) if (! found) \ rval = PCLASS::CBNAME(a,b); \ return rval; \ - } \ - bool base_##CBNAME(int a, int b) { \ - return PCLASS::CBNAME(a,b); \ - } + } @@ -310,10 +287,7 @@ wxPyMake_TEMPLATE(wxGridTableBase) if (! found) \ rval = PCLASS::CBNAME(a, b); \ return rval; \ - } \ - double base_##CBNAME(int a, int b) { \ - return PCLASS::CBNAME(a, b); \ - } + } @@ -326,11 +300,7 @@ wxPyMake_TEMPLATE(wxGridTableBase) wxPyEndBlockThreads(blocked); \ if (! found) \ PCLASS::CBNAME(); \ - } \ - void base_##CBNAME() { \ - PCLASS::CBNAME(); \ - } - + } @@ -345,10 +315,7 @@ wxPyMake_TEMPLATE(wxGridTableBase) if (! found) \ rval = PCLASS::CBNAME(a,b); \ return rval; \ - } \ - bool base_##CBNAME(size_t a, size_t b) { \ - return PCLASS::CBNAME(a,b); \ - } + } @@ -363,10 +330,7 @@ wxPyMake_TEMPLATE(wxGridTableBase) if (! found) \ rval = PCLASS::CBNAME(a); \ return rval; \ - } \ - bool base_##CBNAME(size_t a) { \ - return PCLASS::CBNAME(a); \ - } + } #define PYCALLBACK_STRING_INT(PCLASS, CBNAME) \ @@ -386,10 +350,7 @@ wxPyMake_TEMPLATE(wxGridTableBase) if (! found) \ rval = PCLASS::CBNAME(a); \ return rval; \ - } \ - wxString base_##CBNAME(int a) { \ - return PCLASS::CBNAME(a); \ - } + } #define PYCALLBACK__INTSTRING(PCLASS, CBNAME) \ @@ -404,10 +365,7 @@ wxPyMake_TEMPLATE(wxGridTableBase) wxPyEndBlockThreads(blocked); \ if (! found) \ PCLASS::CBNAME(a,c); \ - } \ - void base_##CBNAME(int a, const wxString& c) { \ - PCLASS::CBNAME(a,c); \ - } + } @@ -423,10 +381,7 @@ wxPyMake_TEMPLATE(wxGridTableBase) if (! found) \ rval = PCLASS::CBNAME(); \ return rval; \ - } \ - bool base_##CBNAME() { \ - return PCLASS::CBNAME(); \ - } + } @@ -439,10 +394,7 @@ wxPyMake_TEMPLATE(wxGridTableBase) wxPyEndBlockThreads(blocked); \ if (! found) \ PCLASS::CBNAME(a,b); \ - } \ - void base_##CBNAME(size_t a, int b) { \ - PCLASS::CBNAME(a,b); \ - } + } @@ -456,10 +408,7 @@ wxPyMake_TEMPLATE(wxGridTableBase) wxPyEndBlockThreads(blocked); \ if (! found) \ PCLASS::CBNAME(a,b,c); \ - } \ - void base_##CBNAME(int a, int b, long c) { \ - PCLASS::CBNAME(a,b,c); \ - } + } @@ -473,10 +422,7 @@ wxPyMake_TEMPLATE(wxGridTableBase) wxPyEndBlockThreads(blocked); \ if (! found) \ PCLASS::CBNAME(a,b,c); \ - } \ - void base_##CBNAME(int a, int b, double c) { \ - PCLASS::CBNAME(a,b,c); \ - } + } @@ -489,11 +435,7 @@ wxPyMake_TEMPLATE(wxGridTableBase) wxPyEndBlockThreads(blocked); \ if (! found) \ PCLASS::CBNAME(a,b,c); \ - } \ - void base_##CBNAME(int a, int b, bool c) { \ - PCLASS::CBNAME(a,b,c); \ - } - + } @@ -688,7 +630,8 @@ public: wxPyGridCellRenderer(); void _setCallbackInfo(PyObject* self, PyObject* _class); - void base_SetParameters(const wxString& params); + void SetParameters(const wxString& params); + %MAKE_BASE_FUNC(PyGridCellRenderer, SetParameters); }; //--------------------------------------------------------------------------- @@ -878,9 +821,6 @@ public: if (! found) wxGridCellEditor::Show(show, attr); } - void base_Show(bool show, wxGridCellAttr *attr) { - wxGridCellEditor::Show(show, attr); - } void PaintBackground(const wxRect& rectCell, wxGridCellAttr *attr) { @@ -899,9 +839,6 @@ public: if (! found) wxGridCellEditor::PaintBackground(rectCell, attr); } - void base_PaintBackground(const wxRect& rectCell, wxGridCellAttr *attr) { - wxGridCellEditor::PaintBackground(rectCell, attr); - } DEC_PYCALLBACK___pure(Reset); @@ -939,15 +876,25 @@ public: wxPyGridCellEditor(); void _setCallbackInfo(PyObject* self, PyObject* _class); - void base_SetSize(const wxRect& rect); - void base_Show(bool show, wxGridCellAttr *attr = NULL); - void base_PaintBackground(const wxRect& rectCell, wxGridCellAttr *attr); - bool base_IsAcceptedKey(wxKeyEvent& event); - void base_StartingKey(wxKeyEvent& event); - void base_StartingClick(); - void base_HandleReturn(wxKeyEvent& event); - void base_Destroy(); - void base_SetParameters(const wxString& params); + void SetSize(const wxRect& rect); + void Show(bool show, wxGridCellAttr *attr = NULL); + void PaintBackground(const wxRect& rectCell, wxGridCellAttr *attr); + bool IsAcceptedKey(wxKeyEvent& event); + void StartingKey(wxKeyEvent& event); + void StartingClick(); + void HandleReturn(wxKeyEvent& event); + void Destroy(); + void SetParameters(const wxString& params); + + %MAKE_BASE_FUNC(PyGridCellEditor, SetSize); + %MAKE_BASE_FUNC(PyGridCellEditor, Show); + %MAKE_BASE_FUNC(PyGridCellEditor, PaintBackground); + %MAKE_BASE_FUNC(PyGridCellEditor, IsAcceptedKey); + %MAKE_BASE_FUNC(PyGridCellEditor, StartingKey); + %MAKE_BASE_FUNC(PyGridCellEditor, StartingClick); + %MAKE_BASE_FUNC(PyGridCellEditor, HandleReturn); + %MAKE_BASE_FUNC(PyGridCellEditor, Destroy); + %MAKE_BASE_FUNC(PyGridCellEditor, SetParameters); }; //--------------------------------------------------------------------------- @@ -1144,11 +1091,16 @@ public: wxPyGridCellAttrProvider(); void _setCallbackInfo(PyObject* self, PyObject* _class); - wxGridCellAttr *base_GetAttr(int row, int col, + wxGridCellAttr *GetAttr(int row, int col, wxGridCellAttr::wxAttrKind kind); - void base_SetAttr(wxGridCellAttr *attr, int row, int col); - void base_SetRowAttr(wxGridCellAttr *attr, int row); - void base_SetColAttr(wxGridCellAttr *attr, int col); + void SetAttr(wxGridCellAttr *attr, int row, int col); + void SetRowAttr(wxGridCellAttr *attr, int row); + void SetColAttr(wxGridCellAttr *attr, int col); + + %MAKE_BASE_FUNC(PyGridCellAttrProvider, GetAttr); + %MAKE_BASE_FUNC(PyGridCellAttrProvider, SetAttr); + %MAKE_BASE_FUNC(PyGridCellAttrProvider, SetRowAttr); + %MAKE_BASE_FUNC(PyGridCellAttrProvider, SetColAttr); }; @@ -1367,26 +1319,46 @@ public: %pythonAppend Destroy "args[0].thisown = 0" %extend { void Destroy() { delete self; } } - wxString base_GetTypeName( int row, int col ); - bool base_CanGetValueAs( int row, int col, const wxString& typeName ); - bool base_CanSetValueAs( int row, int col, const wxString& typeName ); - void base_Clear(); - bool base_InsertRows( size_t pos = 0, size_t numRows = 1 ); - bool base_AppendRows( size_t numRows = 1 ); - bool base_DeleteRows( size_t pos = 0, size_t numRows = 1 ); - bool base_InsertCols( size_t pos = 0, size_t numCols = 1 ); - bool base_AppendCols( size_t numCols = 1 ); - bool base_DeleteCols( size_t pos = 0, size_t numCols = 1 ); - wxString base_GetRowLabelValue( int row ); - wxString base_GetColLabelValue( int col ); - void base_SetRowLabelValue( int row, const wxString& value ); - void base_SetColLabelValue( int col, const wxString& value ); - bool base_CanHaveAttributes(); - wxGridCellAttr *base_GetAttr( int row, int col, + wxString GetTypeName( int row, int col ); + bool CanGetValueAs( int row, int col, const wxString& typeName ); + bool CanSetValueAs( int row, int col, const wxString& typeName ); + void Clear(); + bool InsertRows( size_t pos = 0, size_t numRows = 1 ); + bool AppendRows( size_t numRows = 1 ); + bool DeleteRows( size_t pos = 0, size_t numRows = 1 ); + bool InsertCols( size_t pos = 0, size_t numCols = 1 ); + bool AppendCols( size_t numCols = 1 ); + bool DeleteCols( size_t pos = 0, size_t numCols = 1 ); + wxString GetRowLabelValue( int row ); + wxString GetColLabelValue( int col ); + void SetRowLabelValue( int row, const wxString& value ); + void SetColLabelValue( int col, const wxString& value ); + bool CanHaveAttributes(); + wxGridCellAttr *GetAttr( int row, int col, wxGridCellAttr::wxAttrKind kind ); - void base_SetAttr(wxGridCellAttr* attr, int row, int col); - void base_SetRowAttr(wxGridCellAttr *attr, int row); - void base_SetColAttr(wxGridCellAttr *attr, int col); + void SetAttr(wxGridCellAttr* attr, int row, int col); + void SetRowAttr(wxGridCellAttr *attr, int row); + void SetColAttr(wxGridCellAttr *attr, int col); + + %MAKE_BASE_FUNC(PyGridTableBase, GetTypeName); + %MAKE_BASE_FUNC(PyGridTableBase, CanGetValueAs); + %MAKE_BASE_FUNC(PyGridTableBase, CanSetValueAs); + %MAKE_BASE_FUNC(PyGridTableBase, Clear); + %MAKE_BASE_FUNC(PyGridTableBase, InsertRows); + %MAKE_BASE_FUNC(PyGridTableBase, AppendRows); + %MAKE_BASE_FUNC(PyGridTableBase, DeleteRows); + %MAKE_BASE_FUNC(PyGridTableBase, InsertCols); + %MAKE_BASE_FUNC(PyGridTableBase, AppendCols); + %MAKE_BASE_FUNC(PyGridTableBase, DeleteCols); + %MAKE_BASE_FUNC(PyGridTableBase, GetRowLabelValue); + %MAKE_BASE_FUNC(PyGridTableBase, GetColLabelValue); + %MAKE_BASE_FUNC(PyGridTableBase, SetRowLabelValue); + %MAKE_BASE_FUNC(PyGridTableBase, SetColLabelValue); + %MAKE_BASE_FUNC(PyGridTableBase, CanHaveAttributes); + %MAKE_BASE_FUNC(PyGridTableBase, GetAttr); + %MAKE_BASE_FUNC(PyGridTableBase, SetAttr); + %MAKE_BASE_FUNC(PyGridTableBase, SetRowAttr); + %MAKE_BASE_FUNC(PyGridTableBase, SetColAttr); }; diff --git a/wxPython/src/helpers.cpp b/wxPython/src/helpers.cpp index d426e4d007..963d0c58df 100644 --- a/wxPython/src/helpers.cpp +++ b/wxPython/src/helpers.cpp @@ -177,6 +177,18 @@ int wxPyApp::OnExit() { } + +void wxPyApp::ExitMainLoop() { + bool found; + wxPyBlock_t blocked = wxPyBeginBlockThreads(); + if ((found = wxPyCBH_findCallback(m_myInst, "ExitMainLoop"))) + wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); + wxPyEndBlockThreads(blocked); + if (! found) + wxApp::ExitMainLoop(); +} + + #ifdef __WXDEBUG__ void wxPyApp::OnAssert(const wxChar *file, int line, @@ -468,6 +480,7 @@ void wxPyApp::_BootstrapApp() PyObject* method = m_myInst.GetLastFound(); PyObject* argTuple = PyTuple_New(0); retval = PyEval_CallObject(method, argTuple); + m_myInst.clearRecursionGuard(method); Py_DECREF(argTuple); Py_DECREF(method); if (retval == NULL) @@ -1717,45 +1730,80 @@ PyObject* PyFindClassWithAttr(PyObject *klass, PyObject *name) static -PyObject* PyMethod_GetDefiningClass(PyObject* method, const char* name) +PyObject* PyMethod_GetDefiningClass(PyObject* method, PyObject* nameo) { PyObject* mgc = PyMethod_GET_CLASS(method); #if PYTHON_API_VERSION <= 1010 // prior to Python 2.2, the easy way return mgc; #else // 2.2 and after, the hard way... - - PyObject* nameo = PyString_FromString(name); - PyObject* klass = PyFindClassWithAttr(mgc, nameo); - Py_DECREF(nameo); - return klass; + return PyFindClassWithAttr(mgc, nameo); #endif } +// To avoid recursion when an overridden virtual method wants to call the base +// class version, temporarily set an attribute in the instance with the same +// name as the method. Then the PyObject_GetAttr in the next findCallback +// will return this attribute and the PyMethod_Check will fail. + +void wxPyCallbackHelper::setRecursionGuard(PyObject* method) const +{ + PyFunctionObject* func = (PyFunctionObject*)PyMethod_Function(method); + PyObject_SetAttr(m_self, func->func_name, Py_None); +} + +void wxPyCallbackHelper::clearRecursionGuard(PyObject* method) const +{ + PyFunctionObject* func = (PyFunctionObject*)PyMethod_Function(method); + if (PyObject_HasAttr(m_self, func->func_name)) { + PyObject_DelAttr(m_self, func->func_name); + } +} + +// bool wxPyCallbackHelper::hasRecursionGuard(PyObject* method) const +// { +// PyFunctionObject* func = (PyFunctionObject*)PyMethod_Function(method); +// if (PyObject_HasAttr(m_self, func->func_name)) { +// PyObject* attr = PyObject_GetAttr(m_self, func->func_name); +// bool retval = (attr == Py_None); +// Py_DECREF(attr); +// return retval; +// } +// return false; +// } + + bool wxPyCallbackHelper::findCallback(const char* name) const { wxPyCallbackHelper* self = (wxPyCallbackHelper*)this; // cast away const + PyObject *method, *klass; + PyObject* nameo = PyString_FromString(name); self->m_lastFound = NULL; // If the object (m_self) has an attibute of the given name... - if (m_self && PyObject_HasAttrString(m_self, (char*)name)) { - PyObject *method, *klass; - method = PyObject_GetAttrString(m_self, (char*)name); + if (m_self && PyObject_HasAttr(m_self, nameo)) { + method = PyObject_GetAttr(m_self, nameo); // ...and if that attribute is a method, and if that method's class is - // not from a base class... + // not from the registered class or a base class... if (PyMethod_Check(method) && - (klass = PyMethod_GetDefiningClass(method, (char*)name)) != NULL && - ((klass == m_class) || PyObject_IsSubclass(klass, m_class))) { - - // ...then we'll save a pointer to the method so callCallback can call it. + (klass = PyMethod_GetDefiningClass(method, nameo)) != NULL && + (klass != m_class) && + PyObject_IsSubclass(klass, m_class)) { + + // ...then we'll save a pointer to the method so callCallback can + // call it. But first, set a recursion guard in case the + // overridden method wants to call the base class version. + setRecursionGuard(method); self->m_lastFound = method; } else { Py_DECREF(method); } } + + Py_DECREF(nameo); return m_lastFound != NULL; } @@ -1784,6 +1832,8 @@ PyObject* wxPyCallbackHelper::callCallbackObj(PyObject* argTuple) const { PyObject* method = m_lastFound; result = PyEval_CallObject(method, argTuple); + clearRecursionGuard(method); + Py_DECREF(argTuple); Py_DECREF(method); if (!result) { diff --git a/wxPython/src/html.i b/wxPython/src/html.i index e7656c3b64..94ca8156ea 100644 --- a/wxPython/src/html.i +++ b/wxPython/src/html.i @@ -50,7 +50,6 @@ MAKE_CONST_WXSTRING2(HtmlPrintingTitleStr, wxT("Printing")) // TODO: Split this file into multiple %included files that coresponds to the // wx/html include files (more or less.) -//--------------------------------------------------------------------------- //--------------------------------------------------------------------------- %newgroup @@ -730,7 +729,7 @@ public: } void OnLinkClicked(const wxHtmlLinkInfo& link); - void base_OnLinkClicked(const wxHtmlLinkInfo& link); +//- void base_OnLinkClicked(const wxHtmlLinkInfo& link); wxHtmlOpeningStatus OnOpeningURL(wxHtmlURLType type, const wxString& url, @@ -760,9 +759,9 @@ void wxPyHtmlWindow::OnLinkClicked(const wxHtmlLinkInfo& link) { if (! found) wxHtmlWindow::OnLinkClicked(link); } -void wxPyHtmlWindow::base_OnLinkClicked(const wxHtmlLinkInfo& link) { - wxHtmlWindow::OnLinkClicked(link); -} +// void wxPyHtmlWindow::base_OnLinkClicked(const wxHtmlLinkInfo& link) { +// wxHtmlWindow::OnLinkClicked(link); +// } wxHtmlOpeningStatus wxPyHtmlWindow::OnOpeningURL(wxHtmlURLType type, @@ -939,12 +938,16 @@ public: // Converts current page to text: wxString ToText(); - void base_OnLinkClicked(const wxHtmlLinkInfo& link); - void base_OnSetTitle(const wxString& title); - void base_OnCellMouseHover(wxHtmlCell *cell, wxCoord x, wxCoord y); - void base_OnCellClicked(wxHtmlCell *cell, - wxCoord x, wxCoord y, - const wxMouseEvent& event); + void OnLinkClicked(const wxHtmlLinkInfo& link); + void OnSetTitle(const wxString& title); + void OnCellMouseHover(wxHtmlCell *cell, wxCoord x, wxCoord y); + void OnCellClicked(wxHtmlCell *cell, + wxCoord x, wxCoord y, + const wxMouseEvent& event); + %MAKE_BASE_FUNC(HtmlWindow, OnLinkClicked); + %MAKE_BASE_FUNC(HtmlWindow, OnSetTitle); + %MAKE_BASE_FUNC(HtmlWindow, OnCellMouseHover); + %MAKE_BASE_FUNC(HtmlWindow, OnCellClicked); static wxVisualAttributes GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL); diff --git a/wxPython/src/wizard.i b/wxPython/src/wizard.i index 051102f644..009477ea1f 100644 --- a/wxPython/src/wizard.i +++ b/wxPython/src/wizard.i @@ -242,36 +242,64 @@ public: void _setCallbackInfo(PyObject* self, PyObject* _class); - void base_DoMoveWindow(int x, int y, int width, int height); - void base_DoSetSize(int x, int y, int width, int height, + void DoMoveWindow(int x, int y, int width, int height); + void DoSetSize(int x, int y, int width, int height, int sizeFlags = wxSIZE_AUTO); - void base_DoSetClientSize(int width, int height); - void base_DoSetVirtualSize( int x, int y ); + void DoSetClientSize(int width, int height); + void DoSetVirtualSize( int x, int y ); DocDeclA( - void, base_DoGetSize( int *OUTPUT, int *OUTPUT ) const, - "base_DoGetSize() -> (width, height)"); + void, DoGetSize( int *OUTPUT, int *OUTPUT ) const, + "DoGetSize() -> (width, height)"); DocDeclA( - void, base_DoGetClientSize( int *OUTPUT, int *OUTPUT ) const, - "base_DoGetClientSize() -> (width, height)"); + void, DoGetClientSize( int *OUTPUT, int *OUTPUT ) const, + "DoGetClientSize() -> (width, height)"); DocDeclA( - void, base_DoGetPosition( int *OUTPUT, int *OUTPUT ) const, - "base_DoGetPosition() -> (x,y)"); - - wxSize base_DoGetVirtualSize() const; - wxSize base_DoGetBestSize() const; - - void base_InitDialog(); - bool base_TransferDataToWindow(); - bool base_TransferDataFromWindow(); - bool base_Validate(); - - bool base_AcceptsFocus() const; - bool base_AcceptsFocusFromKeyboard() const; - wxSize base_GetMaxSize() const; - - void base_AddChild(wxWindow* child); - void base_RemoveChild(wxWindow* child); + void, DoGetPosition( int *OUTPUT, int *OUTPUT ) const, + "DoGetPosition() -> (x,y)"); + + wxSize DoGetVirtualSize() const; + wxSize DoGetBestSize() const; + + void InitDialog(); + bool TransferDataToWindow(); + bool TransferDataFromWindow(); + bool Validate(); + + bool AcceptsFocus() const; + bool AcceptsFocusFromKeyboard() const; + wxSize GetMaxSize() const; + + void AddChild(wxWindow* child); + void RemoveChild(wxWindow* child); + + bool ShouldInheritColours() const; + wxVisualAttributes GetDefaultAttributes(); + + void OnInternalIdle(); + + %MAKE_BASE_FUNC(PyWizardPage, DoMoveWindow); + %MAKE_BASE_FUNC(PyWizardPage, DoSetSize); + %MAKE_BASE_FUNC(PyWizardPage, DoSetClientSize); + %MAKE_BASE_FUNC(PyWizardPage, DoSetVirtualSize); + %MAKE_BASE_FUNC(PyWizardPage, DoGetSize); + %MAKE_BASE_FUNC(PyWizardPage, DoGetClientSize); + %MAKE_BASE_FUNC(PyWizardPage, DoGetPosition); + %MAKE_BASE_FUNC(PyWizardPage, DoGetVirtualSize); + %MAKE_BASE_FUNC(PyWizardPage, DoGetBestSize); + %MAKE_BASE_FUNC(PyWizardPage, InitDialog); + %MAKE_BASE_FUNC(PyWizardPage, TransferDataToWindow); + %MAKE_BASE_FUNC(PyWizardPage, TransferDataFromWindow); + %MAKE_BASE_FUNC(PyWizardPage, Validate); + %MAKE_BASE_FUNC(PyWizardPage, AcceptsFocus); + %MAKE_BASE_FUNC(PyWizardPage, AcceptsFocusFromKeyboard); + %MAKE_BASE_FUNC(PyWizardPage, GetMaxSize); + %MAKE_BASE_FUNC(PyWizardPage, AddChild); + %MAKE_BASE_FUNC(PyWizardPage, RemoveChild); + %MAKE_BASE_FUNC(PyWizardPage, ShouldInheritColours); + %MAKE_BASE_FUNC(PyWizardPage, GetDefaultAttributes); + %MAKE_BASE_FUNC(PyWizardPage, OnInternalIdle); + }; //---------------------------------------------------------------------- diff --git a/wxPython/wx/lib/activexwrapper.py b/wxPython/wx/lib/activexwrapper.py index e4e66f445e..81a5d455c4 100644 --- a/wxPython/wx/lib/activexwrapper.py +++ b/wxPython/wx/lib/activexwrapper.py @@ -135,7 +135,7 @@ def axw_OEB(self, event): def axw_Cleanup(self): - del self._wnd + #del self._wnd self.close() pass diff --git a/wxPython/wx/lib/docview.py b/wxPython/wx/lib/docview.py index 2c47b8d0cb..dff329174c 100644 --- a/wxPython/wx/lib/docview.py +++ b/wxPython/wx/lib/docview.py @@ -2896,7 +2896,7 @@ class DocPrintout(wx.Printout): """ Not quite sure why this was overridden, but it was in wxWindows! :) """ - if not wx.Printout.base_OnBeginDocument(self, startPage, endPage): + if not wx.Printout.OnBeginDocument(self, startPage, endPage): return False return True diff --git a/wxPython/wx/lib/pdfwin.py b/wxPython/wx/lib/pdfwin.py index 9f884671eb..afbaada41c 100644 --- a/wxPython/wx/lib/pdfwin.py +++ b/wxPython/wx/lib/pdfwin.py @@ -17,10 +17,18 @@ import wx import wx.activex clsID = '{CA8A9780-280D-11CF-A24D-444553540000}' -progID = 'PDF.PdfCtrl.5' +progID = 'AcroPDF.PDF.1' +# Create eventTypes and event binders +wxEVT_Error = wx.activex.RegisterActiveXEvent('OnError') +wxEVT_Message = wx.activex.RegisterActiveXEvent('OnMessage') + +EVT_Error = wx.PyEventBinder(wxEVT_Error, 1) +EVT_Message = wx.PyEventBinder(wxEVT_Message, 1) + + # Derive a new class from ActiveXWindow class PDFWindow(wx.activex.ActiveXWindow): def __init__(self, parent, ID=-1, pos=wx.DefaultPosition, @@ -30,6 +38,27 @@ class PDFWindow(wx.activex.ActiveXWindow): ID, pos, size, style, name) # Methods exported by the ActiveX object + def QueryInterface(self, riid): + return self.CallAXMethod('QueryInterface', riid) + + def AddRef(self): + return self.CallAXMethod('AddRef') + + def Release(self): + return self.CallAXMethod('Release') + + def GetTypeInfoCount(self): + return self.CallAXMethod('GetTypeInfoCount') + + def GetTypeInfo(self, itinfo, lcid): + return self.CallAXMethod('GetTypeInfo', itinfo, lcid) + + def GetIDsOfNames(self, riid, rgszNames, cNames, lcid): + return self.CallAXMethod('GetIDsOfNames', riid, rgszNames, cNames, lcid) + + def Invoke(self, dispidMember, riid, lcid, wFlags, pdispparams): + return self.CallAXMethod('Invoke', dispidMember, riid, lcid, wFlags, pdispparams) + def LoadFile(self, fileName): return self.CallAXMethod('LoadFile', fileName) @@ -102,28 +131,120 @@ class PDFWindow(wx.activex.ActiveXWindow): def setShowScrollbars(self, On): return self.CallAXMethod('setShowScrollbars', On) - def AboutBox(self): - return self.CallAXMethod('AboutBox') + def GetVersions(self): + return self.CallAXMethod('GetVersions') + + def setCurrentHightlight(self, a, b, c, d): + return self.CallAXMethod('setCurrentHightlight', a, b, c, d) + + def setCurrentHighlight(self, a, b, c, d): + return self.CallAXMethod('setCurrentHighlight', a, b, c, d) + + def postMessage(self, strArray): + return self.CallAXMethod('postMessage', strArray) + + # Getters, Setters and properties + def _get_src(self): + return self.GetAXProp('src') + def _set_src(self, src): + self.SetAXProp('src', src) + src = property(_get_src, _set_src) + + def _get_messageHandler(self): + return self.GetAXProp('messageHandler') + def _set_messageHandler(self, messageHandler): + self.SetAXProp('messageHandler', messageHandler) + messagehandler = property(_get_messageHandler, _set_messageHandler) # PROPERTIES # -------------------- +# src +# type:string arg:string canGet:True canSet:True +# +# messagehandler +# type:VT_VARIANT arg:VT_VARIANT canGet:True canSet:True +# # # # # METHODS # -------------------- +# QueryInterface +# retType: VT_VOID +# params: +# riid +# in:True out:False optional:False type:unsupported type 29 +# ppvObj +# in:False out:True optional:False type:unsupported type 26 +# +# AddRef +# retType: int +# +# Release +# retType: int +# +# GetTypeInfoCount +# retType: VT_VOID +# params: +# pctinfo +# in:False out:True optional:False type:int +# +# GetTypeInfo +# retType: VT_VOID +# params: +# itinfo +# in:True out:False optional:False type:int +# lcid +# in:True out:False optional:False type:int +# pptinfo +# in:False out:True optional:False type:unsupported type 26 +# +# GetIDsOfNames +# retType: VT_VOID +# params: +# riid +# in:True out:False optional:False type:unsupported type 29 +# rgszNames +# in:True out:False optional:False type:unsupported type 26 +# cNames +# in:True out:False optional:False type:int +# lcid +# in:True out:False optional:False type:int +# rgdispid +# in:False out:True optional:False type:int +# +# Invoke +# retType: VT_VOID +# params: +# dispidMember +# in:True out:False optional:False type:int +# riid +# in:True out:False optional:False type:unsupported type 29 +# lcid +# in:True out:False optional:False type:int +# wFlags +# in:True out:False optional:False type:int +# pdispparams +# in:True out:False optional:False type:unsupported type 29 +# pvarResult +# in:False out:True optional:False type:VT_VARIANT +# pexcepinfo +# in:False out:True optional:False type:unsupported type 29 +# puArgErr +# in:False out:True optional:False type:int +# # LoadFile # retType: bool # params: # fileName -# in:False out:False optional:False type:string +# in:True out:False optional:False type:string # # setShowToolbar # retType: VT_VOID # params: # On -# in:False out:False optional:False type:bool +# in:True out:False optional:False type:bool # # gotoFirstPage # retType: VT_VOID @@ -141,7 +262,7 @@ class PDFWindow(wx.activex.ActiveXWindow): # retType: VT_VOID # params: # n -# in:False out:False optional:False type:int +# in:True out:False optional:False type:int # # goForwardStack # retType: VT_VOID @@ -153,19 +274,19 @@ class PDFWindow(wx.activex.ActiveXWindow): # retType: VT_VOID # params: # pageMode -# in:False out:False optional:False type:string +# in:True out:False optional:False type:string # # setLayoutMode # retType: VT_VOID # params: # layoutMode -# in:False out:False optional:False type:string +# in:True out:False optional:False type:string # # setNamedDest # retType: VT_VOID # params: # namedDest -# in:False out:False optional:False type:string +# in:True out:False optional:False type:string # # Print # retType: VT_VOID @@ -177,61 +298,61 @@ class PDFWindow(wx.activex.ActiveXWindow): # retType: VT_VOID # params: # percent -# in:False out:False optional:False type:double +# in:True out:False optional:False type:double # # setZoomScroll # retType: VT_VOID # params: # percent -# in:False out:False optional:False type:double +# in:True out:False optional:False type:double # left -# in:False out:False optional:False type:double +# in:True out:False optional:False type:double # top -# in:False out:False optional:False type:double +# in:True out:False optional:False type:double # # setView # retType: VT_VOID # params: # viewMode -# in:False out:False optional:False type:string +# in:True out:False optional:False type:string # # setViewScroll # retType: VT_VOID # params: # viewMode -# in:False out:False optional:False type:string +# in:True out:False optional:False type:string # offset -# in:False out:False optional:False type:double +# in:True out:False optional:False type:double # # setViewRect # retType: VT_VOID # params: # left -# in:False out:False optional:False type:double +# in:True out:False optional:False type:double # top -# in:False out:False optional:False type:double +# in:True out:False optional:False type:double # width -# in:False out:False optional:False type:double +# in:True out:False optional:False type:double # height -# in:False out:False optional:False type:double +# in:True out:False optional:False type:double # # printPages # retType: VT_VOID # params: # from -# in:False out:False optional:False type:int +# in:True out:False optional:False type:int # to -# in:False out:False optional:False type:int +# in:True out:False optional:False type:int # # printPagesFit # retType: VT_VOID # params: # from -# in:False out:False optional:False type:int +# in:True out:False optional:False type:int # to -# in:False out:False optional:False type:int +# in:True out:False optional:False type:int # shrinkToFit -# in:False out:False optional:False type:bool +# in:True out:False optional:False type:bool # # printAll # retType: VT_VOID @@ -240,22 +361,58 @@ class PDFWindow(wx.activex.ActiveXWindow): # retType: VT_VOID # params: # shrinkToFit -# in:False out:False optional:False type:bool +# in:True out:False optional:False type:bool # # setShowScrollbars # retType: VT_VOID # params: # On -# in:False out:False optional:False type:bool +# in:True out:False optional:False type:bool # -# AboutBox +# GetVersions +# retType: VT_VARIANT +# +# setCurrentHightlight +# retType: VT_VOID +# params: +# a +# in:True out:False optional:False type:int +# b +# in:True out:False optional:False type:int +# c +# in:True out:False optional:False type:int +# d +# in:True out:False optional:False type:int +# +# setCurrentHighlight +# retType: VT_VOID +# params: +# a +# in:True out:False optional:False type:int +# b +# in:True out:False optional:False type:int +# c +# in:True out:False optional:False type:int +# d +# in:True out:False optional:False type:int +# +# postMessage # retType: VT_VOID +# params: +# strArray +# in:True out:False optional:False type:VT_VARIANT # # # # # EVENTS # -------------------- +# Error +# retType: VT_VOID +# +# Message +# retType: VT_VOID +# # # # diff --git a/wxPython/wx/lib/printout.py b/wxPython/wx/lib/printout.py index 32f3eac88c..0ced233037 100644 --- a/wxPython/wx/lib/printout.py +++ b/wxPython/wx/lib/printout.py @@ -1056,10 +1056,10 @@ class SetPrintout(wx.Printout): self.end_pg = 1000 def OnBeginDocument(self, start, end): - return self.base_OnBeginDocument(start, end) + return super(SetPrintout, self).OnBeginDocument(start, end) def OnEndDocument(self): - self.base_OnEndDocument() + super(SetPrintout, self).OnEndDocument() def HasPage(self, page): try: @@ -1079,7 +1079,7 @@ class SetPrintout(wx.Printout): return (str_pg, end_pg, str_pg, end_pg) def OnPreparePrinting(self): - self.base_OnPreparePrinting() + super(SetPrintout, self).OnPreparePrinting() def OnBeginPrinting(self): dc = self.GetDC() @@ -1095,7 +1095,7 @@ class SetPrintout(wx.Printout): scaleY = float(h) / 1000 self.printUserScale = min(scaleX, scaleY) - self.base_OnBeginPrinting() + super(SetPrintout, self).OnBeginPrinting() def GetSize(self): self.psizew, self.psizeh = self.GetPPIPrinter() diff --git a/wxPython/wx/lib/sheet.py b/wxPython/wx/lib/sheet.py index 0ea303bc39..e177a3a35e 100644 --- a/wxPython/wx/lib/sheet.py +++ b/wxPython/wx/lib/sheet.py @@ -65,19 +65,19 @@ class CCellEditor(wx.grid.PyGridCellEditor): """ Show or hide the edit control. Use the attr (if not None) to set colors or fonts for the control. NOTE: There is no need to everride this if you don't need - to do something out of the ordingary. + to do something out of the ordinary. """ - self.base_Show(show, attr) + super(CCellEditor, self).Show(show, attr) def PaintBackground(self, rect, attr): """ Draws the part of the cell not occupied by the edit control. The base class version just fills it with background colour from the attribute. NOTE: There is no need to everride this if you don't need - to do something out of the ordingary. + to do something out of the ordinary. """ # Call base class method. - self.base_PaintBackground(self, rect, attr) + super(CCellEditor, self).PaintBackground(self, rect, attr) def BeginEdit(self, row, col, grid): """ Fetch the value from the table and prepare edit control to begin editing. @@ -152,9 +152,9 @@ class CCellEditor(wx.grid.PyGridCellEditor): def Destroy(self): """ Final cleanup NOTE: There is no need to everride this if you don't need - to do something out of the ordingary. + to do something out of the ordinary. """ - self.base_Destroy() + super(CCellEditor, self).Destroy() def Clone(self): """ Create a new object which is the copy of this one. Must Override. """