diff --git a/wxPython/CHANGES.txt b/wxPython/CHANGES.txt index 22775ca5c6..9b96d8c58a 100644 --- a/wxPython/CHANGES.txt +++ b/wxPython/CHANGES.txt @@ -2,7 +2,7 @@ CHANGES.txt for wxPython ---------------------------------------------------------------------- -2.3b1 +2.3b2 ----- New typemaps for wxString when compiling for Python 2.0 and beyond @@ -15,7 +15,7 @@ Fixed the generic buttons so tool tips work for them. Fixed a bug in the demo's tree control. Added a listbox to the listbox demo that shows how to find items with -a patching prefix as keys are typed. +a matching prefix as keys are typed. Added code to the wxListCtrl demo to show how to get text from a column in report mode. @@ -33,6 +33,17 @@ Added wxNotifyEvent.Allow() Fixed GOBS of reference leaks. +Massive code changes and cleanup to allow wxPython to be split into +multiple extension modules again. A Python CObject is used to allow +the "export" of SWIG and other common helper functions from the wxc +module to other modules, even if they are in separate shared +libraries. Should also be usable from 3rd party code, just include +wxPython/src/export.h + +Changed the default setup so the following are built as separate +extension modules: calendar, glcanvas, grid, html, ogl, stc, and +utils. Will probably add more later. + New in 2.2.2 diff --git a/wxPython/contrib/glcanvas/glcanvas.i b/wxPython/contrib/glcanvas/glcanvas.i index 247137b5a1..96f19eb065 100644 --- a/wxPython/contrib/glcanvas/glcanvas.i +++ b/wxPython/contrib/glcanvas/glcanvas.i @@ -14,7 +14,7 @@ %module glcanvas %{ -#include "helpers.h" +#include "export.h" #include %} @@ -35,14 +35,6 @@ %extern events.i -%{ -#if defined(__WXMSW__) - static wxString wxPyEmptyStr(""); - static wxPoint wxPyDefaultPosition(-1, -1); - static wxSize wxPyDefaultSize(-1, -1); -#endif -%} - %pragma(python) code = "import wx" //--------------------------------------------------------------------------- @@ -99,8 +91,8 @@ public: class wxGLCanvas : public wxScrolledWindow { public: wxGLCanvas(wxWindow *parent, wxWindowID id = -1, - const wxPoint& pos = wxPyDefaultPosition, - const wxSize& size = wxPyDefaultSize, long style = 0, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, long style = 0, const char* name = "GLCanvas", int *attribList = NULL, const wxPalette& palette = wxNullPalette); @@ -119,8 +111,8 @@ public: %init %{ - wxClassInfo::CleanUpClasses(); - wxClassInfo::InitializeClasses(); +// wxClassInfo::CleanUpClasses(); +// wxClassInfo::InitializeClasses(); %} diff --git a/wxPython/contrib/glcanvas/msw/glcanvas.cpp b/wxPython/contrib/glcanvas/msw/glcanvas.cpp index d1d8ab9a5d..8d38980275 100644 --- a/wxPython/contrib/glcanvas/msw/glcanvas.cpp +++ b/wxPython/contrib/glcanvas/msw/glcanvas.cpp @@ -55,7 +55,7 @@ extern PyObject *SWIG_newvarlink(void); #define SWIG_name "glcanvasc" -#include "helpers.h" +#include "export.h" #include static PyObject* l_output_helper(PyObject* target, PyObject* o) { @@ -105,12 +105,6 @@ static PyObject* t_output_helper(PyObject* target, PyObject* o) { } static char* wxStringErrorMsg = "string type is required for parameter"; - -#if defined(__WXMSW__) - static wxString wxPyEmptyStr(""); - static wxPoint wxPyDefaultPosition(-1, -1); - static wxSize wxPyDefaultSize(-1, -1); -#endif #ifdef __cplusplus extern "C" { #endif @@ -341,8 +335,8 @@ static PyObject *_wrap_new_wxGLCanvas(PyObject *self, PyObject *args, PyObject * wxGLCanvas * _result; wxWindow * _arg0; wxWindowID _arg1 = (wxWindowID ) -1; - wxPoint * _arg2 = (wxPoint *) &wxPyDefaultPosition; - wxSize * _arg3 = (wxSize *) &wxPyDefaultSize; + wxPoint * _arg2 = (wxPoint *) &wxDefaultPosition; + wxSize * _arg3 = (wxSize *) &wxDefaultSize; long _arg4 = (long ) 0; char * _arg5 = (char *) "GLCanvas"; int * _arg6 = (int *) NULL; @@ -1102,8 +1096,8 @@ SWIGEXPORT(void) initglcanvasc() { d = PyModule_GetDict(m); - wxClassInfo::CleanUpClasses(); - wxClassInfo::InitializeClasses(); +// wxClassInfo::CleanUpClasses(); +// wxClassInfo::InitializeClasses(); { int i; diff --git a/wxPython/contrib/glcanvas/stub.cpp b/wxPython/contrib/glcanvas/stub.cpp deleted file mode 100644 index b675bd21c0..0000000000 --- a/wxPython/contrib/glcanvas/stub.cpp +++ /dev/null @@ -1,24 +0,0 @@ -/* Definitions for Windows/Unix exporting */ -#if defined(__WIN32__) -# if defined(_MSC_VER) -# define SWIGEXPORT(a) __declspec(dllexport) a -# else -# if defined(__BORLANDC__) -# define SWIGEXPORT(a) a _export -# else -# define SWIGEXPORT(a) a -# endif -# endif -#else -# define SWIGEXPORT(a) a -#endif - - - -#ifdef __cplusplus -extern "C" -#endif -SWIGEXPORT(void) initglcanvasc() { -} - - diff --git a/wxPython/contrib/ogl/ogl.cpp b/wxPython/contrib/ogl/ogl.cpp index 964cc44d8a..70f8829ada 100644 --- a/wxPython/contrib/ogl/ogl.cpp +++ b/wxPython/contrib/ogl/ogl.cpp @@ -55,7 +55,7 @@ extern PyObject *SWIG_newvarlink(void); #define SWIG_name "oglc" -#include "helpers.h" +#include "export.h" #include "oglhelpers.h" static PyObject* l_output_helper(PyObject* target, PyObject* o) { @@ -106,6 +106,87 @@ static PyObject* t_output_helper(PyObject* target, PyObject* o) { static char* wxStringErrorMsg = "string type is required for parameter"; +//--------------------------------------------------------------------------- +// This one will work for any class for the VERY generic cases, but beyond that +// the helper needs to know more about the type. + +wxList* wxPy_wxListHelper(PyObject* pyList, char* className) { + bool doSave = wxPyRestoreThread(); + if (!PyList_Check(pyList)) { + PyErr_SetString(PyExc_TypeError, "Expected a list object."); + wxPySaveThread(doSave); + return NULL; + } + int count = PyList_Size(pyList); + wxList* list = new wxList; + if (! list) { + PyErr_SetString(PyExc_MemoryError, "Unable to allocate wxList object"); + wxPySaveThread(doSave); + return NULL; + } + for (int x=0; xAppend(wxo); + } + wxPySaveThread(doSave); + return list; +} + +//--------------------------------------------------------------------------- + +wxList* wxPy_wxRealPoint_ListHelper(PyObject* pyList) { + bool doSave = wxPyRestoreThread(); + if (!PyList_Check(pyList)) { + PyErr_SetString(PyExc_TypeError, "Expected a list object."); + wxPySaveThread(doSave); + return NULL; + } + int count = PyList_Size(pyList); + wxList* list = new wxList; + if (! list) { + PyErr_SetString(PyExc_MemoryError, "Unable to allocate wxList object"); + wxPySaveThread(doSave); + return NULL; + } + for (int x=0; xAppend((wxObject*) new wxRealPoint(val1, val2)); + + } else { + wxRealPoint* wxo = NULL; + if (SWIG_GetPtrObj(pyo, (void **)&wxo, "_wxRealPoint_p")) { + PyErr_SetString(PyExc_TypeError, "Type error, expected list of wxRealPoint objects or 2-tuples"); + wxPySaveThread(doSave); + return NULL; + } + list->Append((wxObject*) new wxRealPoint(*wxo)); + } + } + wxPySaveThread(doSave); + return list; +} + + +//--------------------------------------------------------------------------- + + extern "C" SWIGEXPORT(void) initoglbasicc(); extern "C" SWIGEXPORT(void) initoglshapesc(); extern "C" SWIGEXPORT(void) initoglshapes2c(); @@ -268,6 +349,7 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = { { "_class_wxRealPoint","_wxRealPoint",0}, { "_wxNavigationKeyEvent","_class_wxNavigationKeyEvent",0}, { "_wxPNMHandler","_class_wxPNMHandler",0}, + { "_wxPrinterDC","_class_wxPrinterDC",0}, { "_wxWindowCreateEvent","_class_wxWindowCreateEvent",0}, { "_wxLogGui","_class_wxLogGui",0}, { "_class_wxPyShapeEvtHandler","_wxPyShapeEvtHandler",0}, @@ -279,7 +361,6 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = { { "_class_wxPySizer","_wxPySizer",0}, { "_class_wxPyCompositeShape","_wxPyCompositeShape",0}, { "_wxPyPolygonShape","_class_wxPyPolygonShape",0}, - { "_class_wxPostScriptDC","_wxPostScriptDC",0}, { "_wxPanel","_class_wxPanel",0}, { "_wxInitDialogEvent","_class_wxInitDialogEvent",0}, { "_wxCheckBox","_class_wxCheckBox",0}, @@ -345,6 +426,7 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = { { "_class_wxZipFSHandler","_wxZipFSHandler",0}, { "_char","_wxChar",0}, { "_wxBitmap","_class_wxBitmap",0}, + { "_wxTaskBarIcon","_class_wxTaskBarIcon",0}, { "_wxPrintDialog","_class_wxPrintDialog",0}, { "_wxPyControlPoint","_class_wxPyControlPoint",0}, { "_wxWindowDC","_class_wxWindowDC",0}, @@ -436,6 +518,7 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = { { "_class_wxTextCtrl","_wxTextCtrl",0}, { "_class_wxListItemAttr","_wxListItemAttr",0}, { "_wxLayoutConstraints","_class_wxLayoutConstraints",0}, + { "_wxMetaFileDC","_class_wxMetaFileDC",0}, { "_class_wxTextDataObject","_wxTextDataObject",0}, { "_wxMenu","_class_wxMenu",0}, { "_class_wxMoveEvent","_wxMoveEvent",0}, @@ -489,6 +572,7 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = { { "_signed_short","_short",0}, { "_wxMemoryDC","_class_wxMemoryDC",0}, { "_wxPyTextDataObject","_class_wxPyTextDataObject",0}, + { "_class_wxTaskBarIcon","_wxTaskBarIcon",0}, { "_class_wxPrintDialog","_wxPrintDialog",0}, { "_wxPyFileSystemHandler","_class_wxPyFileSystemHandler",0}, { "_class_wxPyControlPoint","_wxPyControlPoint",0}, @@ -499,7 +583,6 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = { { "_wxStatusBar","_class_wxStatusBar",0}, { "_class_wxAcceleratorEntry","_wxAcceleratorEntry",0}, { "_class_wxCursor","_wxCursor",0}, - { "_wxPostScriptDC","_class_wxPostScriptDC",0}, { "_wxPyFileDropTarget","_class_wxPyFileDropTarget",0}, { "_class_wxPyProcess","_wxPyProcess",0}, { "_class_wxImageHandler","_wxImageHandler",0}, @@ -508,6 +591,7 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = { { "_class_wxLog","_wxLog",0}, { "_wxTreeItemId","_class_wxTreeItemId",0}, { "_unsigned_char","_byte",0}, + { "_class_wxMetaFileDC","_wxMetaFileDC",0}, { "_class_wxMenu","_wxMenu",0}, { "_wxControl","_class_wxControl",0}, { "_class_wxListBox","_wxListBox",0}, @@ -595,6 +679,7 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = { { "_class_wxPyApp","_wxPyApp",0}, { "_wxSize","_class_wxSize",0}, { "_wxRegionIterator","_class_wxRegionIterator",0}, + { "_class_wxPrinterDC","_wxPrinterDC",0}, { "_class_wxPyTextDataObject","_wxPyTextDataObject",0}, { "_class_wxLogTextCtrl","_wxLogTextCtrl",0}, { "_class_wxLogGui","_wxLogGui",0}, @@ -790,8 +875,8 @@ SWIGEXPORT(void) initoglc() { initoglcanvasc(); - wxClassInfo::CleanUpClasses(); - wxClassInfo::InitializeClasses(); +// wxClassInfo::CleanUpClasses(); +// wxClassInfo::InitializeClasses(); { int i; diff --git a/wxPython/contrib/ogl/ogl.i b/wxPython/contrib/ogl/ogl.i index 78fc0229e1..ed49855716 100644 --- a/wxPython/contrib/ogl/ogl.i +++ b/wxPython/contrib/ogl/ogl.i @@ -14,7 +14,7 @@ %module ogl %{ -#include "helpers.h" +#include "export.h" #include "oglhelpers.h" %} @@ -133,10 +133,88 @@ void wxOGLInitialize(); void wxOGLCleanUp(); -//--------------------------------------------------------------------------- -//--------------------------------------------------------------------------- -//--------------------------------------------------------------------------- %{ +//--------------------------------------------------------------------------- +// This one will work for any class for the VERY generic cases, but beyond that +// the helper needs to know more about the type. + +wxList* wxPy_wxListHelper(PyObject* pyList, char* className) { + bool doSave = wxPyRestoreThread(); + if (!PyList_Check(pyList)) { + PyErr_SetString(PyExc_TypeError, "Expected a list object."); + wxPySaveThread(doSave); + return NULL; + } + int count = PyList_Size(pyList); + wxList* list = new wxList; + if (! list) { + PyErr_SetString(PyExc_MemoryError, "Unable to allocate wxList object"); + wxPySaveThread(doSave); + return NULL; + } + for (int x=0; xAppend(wxo); + } + wxPySaveThread(doSave); + return list; +} + +//--------------------------------------------------------------------------- + +wxList* wxPy_wxRealPoint_ListHelper(PyObject* pyList) { + bool doSave = wxPyRestoreThread(); + if (!PyList_Check(pyList)) { + PyErr_SetString(PyExc_TypeError, "Expected a list object."); + wxPySaveThread(doSave); + return NULL; + } + int count = PyList_Size(pyList); + wxList* list = new wxList; + if (! list) { + PyErr_SetString(PyExc_MemoryError, "Unable to allocate wxList object"); + wxPySaveThread(doSave); + return NULL; + } + for (int x=0; xAppend((wxObject*) new wxRealPoint(val1, val2)); + + } else { + wxRealPoint* wxo = NULL; + if (SWIG_GetPtrObj(pyo, (void **)&wxo, "_wxRealPoint_p")) { + PyErr_SetString(PyExc_TypeError, "Type error, expected list of wxRealPoint objects or 2-tuples"); + wxPySaveThread(doSave); + return NULL; + } + list->Append((wxObject*) new wxRealPoint(*wxo)); + } + } + wxPySaveThread(doSave); + return list; +} + + +//--------------------------------------------------------------------------- + + extern "C" SWIGEXPORT(void) initoglbasicc(); extern "C" SWIGEXPORT(void) initoglshapesc(); extern "C" SWIGEXPORT(void) initoglshapes2c(); @@ -152,8 +230,8 @@ extern "C" SWIGEXPORT(void) initoglcanvasc(); initoglcanvasc(); - wxClassInfo::CleanUpClasses(); - wxClassInfo::InitializeClasses(); +// wxClassInfo::CleanUpClasses(); +// wxClassInfo::InitializeClasses(); %} diff --git a/wxPython/contrib/ogl/oglbasic.cpp b/wxPython/contrib/ogl/oglbasic.cpp index 4730152f5d..e201df629c 100644 --- a/wxPython/contrib/ogl/oglbasic.cpp +++ b/wxPython/contrib/ogl/oglbasic.cpp @@ -55,7 +55,7 @@ extern PyObject *SWIG_newvarlink(void); #define SWIG_name "oglbasicc" -#include "helpers.h" +#include "export.h" #include "oglhelpers.h" static PyObject* l_output_helper(PyObject* target, PyObject* o) { @@ -8464,6 +8464,7 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = { { "_class_wxRealPoint","_wxRealPoint",0}, { "_wxNavigationKeyEvent","_class_wxNavigationKeyEvent",0}, { "_wxPNMHandler","_class_wxPNMHandler",0}, + { "_wxPrinterDC","_class_wxPrinterDC",0}, { "_wxWindowCreateEvent","_class_wxWindowCreateEvent",0}, { "_wxLogGui","_class_wxLogGui",0}, { "_class_wxPyShapeEvtHandler","_class_wxPyShape",SwigwxPyShapeTowxPyShapeEvtHandler}, @@ -8475,7 +8476,6 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = { { "_class_wxStatusBar","_wxStatusBar",0}, { "_class_wxGIFHandler","_wxGIFHandler",0}, { "_class_wxPySizer","_wxPySizer",0}, - { "_class_wxPostScriptDC","_wxPostScriptDC",0}, { "_wxPanel","_class_wxPanel",0}, { "_wxInitDialogEvent","_class_wxInitDialogEvent",0}, { "_wxCheckBox","_class_wxCheckBox",0}, @@ -8538,6 +8538,7 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = { { "_class_wxZipFSHandler","_wxZipFSHandler",0}, { "_char","_wxChar",0}, { "_wxBitmap","_class_wxBitmap",0}, + { "_wxTaskBarIcon","_class_wxTaskBarIcon",0}, { "_wxPrintDialog","_class_wxPrintDialog",0}, { "_wxWindowDC","_class_wxWindowDC",0}, { "_wxTimerEvent","_class_wxTimerEvent",0}, @@ -8622,6 +8623,7 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = { { "_class_wxTextCtrl","_wxTextCtrl",0}, { "_class_wxListItemAttr","_wxListItemAttr",0}, { "_wxLayoutConstraints","_class_wxLayoutConstraints",0}, + { "_wxMetaFileDC","_class_wxMetaFileDC",0}, { "_class_wxTextDataObject","_wxTextDataObject",0}, { "_wxMenu","_class_wxMenu",0}, { "_class_wxMoveEvent","_wxMoveEvent",0}, @@ -8672,6 +8674,7 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = { { "_signed_short","_short",0}, { "_wxMemoryDC","_class_wxMemoryDC",0}, { "_wxPyTextDataObject","_class_wxPyTextDataObject",0}, + { "_class_wxTaskBarIcon","_wxTaskBarIcon",0}, { "_class_wxPrintDialog","_wxPrintDialog",0}, { "_wxPyFileSystemHandler","_class_wxPyFileSystemHandler",0}, { "_wxPaintDC","_class_wxPaintDC",0}, @@ -8681,7 +8684,6 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = { { "_wxStatusBar","_class_wxStatusBar",0}, { "_class_wxAcceleratorEntry","_wxAcceleratorEntry",0}, { "_class_wxCursor","_wxCursor",0}, - { "_wxPostScriptDC","_class_wxPostScriptDC",0}, { "_wxPyFileDropTarget","_class_wxPyFileDropTarget",0}, { "_class_wxPyProcess","_wxPyProcess",0}, { "_class_wxImageHandler","_wxImageHandler",0}, @@ -8690,6 +8692,7 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = { { "_class_wxLog","_wxLog",0}, { "_wxTreeItemId","_class_wxTreeItemId",0}, { "_unsigned_char","_byte",0}, + { "_class_wxMetaFileDC","_wxMetaFileDC",0}, { "_class_wxMenu","_wxMenu",0}, { "_wxControl","_class_wxControl",0}, { "_class_wxListBox","_wxListBox",0}, @@ -8775,6 +8778,7 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = { { "_class_wxPyApp","_wxPyApp",0}, { "_wxSize","_class_wxSize",0}, { "_wxRegionIterator","_class_wxRegionIterator",0}, + { "_class_wxPrinterDC","_wxPrinterDC",0}, { "_class_wxPyTextDataObject","_wxPyTextDataObject",0}, { "_class_wxLogTextCtrl","_wxLogTextCtrl",0}, { "_class_wxLogGui","_wxLogGui",0}, diff --git a/wxPython/contrib/ogl/oglbasic.i b/wxPython/contrib/ogl/oglbasic.i index 1df3cc74ee..43418c3833 100644 --- a/wxPython/contrib/ogl/oglbasic.i +++ b/wxPython/contrib/ogl/oglbasic.i @@ -14,7 +14,7 @@ %module oglbasic %{ -#include "helpers.h" +#include "export.h" #include "oglhelpers.h" %} diff --git a/wxPython/contrib/ogl/oglcanvas.cpp b/wxPython/contrib/ogl/oglcanvas.cpp index a296edeb6d..1d655bced8 100644 --- a/wxPython/contrib/ogl/oglcanvas.cpp +++ b/wxPython/contrib/ogl/oglcanvas.cpp @@ -55,7 +55,7 @@ extern PyObject *SWIG_newvarlink(void); #define SWIG_name "oglcanvasc" -#include "helpers.h" +#include "export.h" #include "oglhelpers.h" static PyObject* l_output_helper(PyObject* target, PyObject* o) { @@ -1201,8 +1201,8 @@ static PyObject *_wrap_new_wxPyShapeCanvas(PyObject *self, PyObject *args, PyObj wxPyShapeCanvas * _result; wxWindow * _arg0 = (wxWindow *) NULL; wxWindowID _arg1 = (wxWindowID ) -1; - wxPoint * _arg2 = (wxPoint *) &wxPyDefaultPosition; - wxSize * _arg3 = (wxSize *) &wxPyDefaultSize; + wxPoint * _arg2 = (wxPoint *) &wxDefaultPosition; + wxSize * _arg3 = (wxSize *) &wxDefaultSize; long _arg4 = (long ) wxBORDER; PyObject * _argo0 = 0; wxPoint temp; @@ -2105,6 +2105,7 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = { { "_class_wxRealPoint","_wxRealPoint",0}, { "_wxNavigationKeyEvent","_class_wxNavigationKeyEvent",0}, { "_wxPNMHandler","_class_wxPNMHandler",0}, + { "_wxPrinterDC","_class_wxPrinterDC",0}, { "_wxWindowCreateEvent","_class_wxWindowCreateEvent",0}, { "_wxLogGui","_class_wxLogGui",0}, { "_class_wxPyShapeEvtHandler","_wxPyShapeEvtHandler",0}, @@ -2114,7 +2115,6 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = { { "_class_wxStatusBar","_wxStatusBar",0}, { "_class_wxGIFHandler","_wxGIFHandler",0}, { "_class_wxPySizer","_wxPySizer",0}, - { "_class_wxPostScriptDC","_wxPostScriptDC",0}, { "_wxPanel","_class_wxPyShapeCanvas",SwigwxPyShapeCanvasTowxPanel}, { "_wxPanel","_wxPyShapeCanvas",SwigwxPyShapeCanvasTowxPanel}, { "_wxPanel","_class_wxPanel",0}, @@ -2180,6 +2180,7 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = { { "_class_wxZipFSHandler","_wxZipFSHandler",0}, { "_char","_wxChar",0}, { "_wxBitmap","_class_wxBitmap",0}, + { "_wxTaskBarIcon","_class_wxTaskBarIcon",0}, { "_wxPrintDialog","_class_wxPrintDialog",0}, { "_wxWindowDC","_class_wxWindowDC",0}, { "_wxTimerEvent","_class_wxTimerEvent",0}, @@ -2267,6 +2268,7 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = { { "_class_wxTextCtrl","_wxTextCtrl",0}, { "_class_wxListItemAttr","_wxListItemAttr",0}, { "_wxLayoutConstraints","_class_wxLayoutConstraints",0}, + { "_wxMetaFileDC","_class_wxMetaFileDC",0}, { "_class_wxTextDataObject","_wxTextDataObject",0}, { "_wxMenu","_class_wxMenu",0}, { "_class_wxMoveEvent","_wxMoveEvent",0}, @@ -2319,6 +2321,7 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = { { "_signed_short","_short",0}, { "_wxMemoryDC","_class_wxMemoryDC",0}, { "_wxPyTextDataObject","_class_wxPyTextDataObject",0}, + { "_class_wxTaskBarIcon","_wxTaskBarIcon",0}, { "_class_wxPrintDialog","_wxPrintDialog",0}, { "_wxPyFileSystemHandler","_class_wxPyFileSystemHandler",0}, { "_wxPaintDC","_class_wxPaintDC",0}, @@ -2328,7 +2331,6 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = { { "_wxStatusBar","_class_wxStatusBar",0}, { "_class_wxAcceleratorEntry","_wxAcceleratorEntry",0}, { "_class_wxCursor","_wxCursor",0}, - { "_wxPostScriptDC","_class_wxPostScriptDC",0}, { "_wxPyFileDropTarget","_class_wxPyFileDropTarget",0}, { "_class_wxPyProcess","_wxPyProcess",0}, { "_class_wxImageHandler","_wxImageHandler",0}, @@ -2339,6 +2341,7 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = { { "_class_wxLog","_wxLog",0}, { "_wxTreeItemId","_class_wxTreeItemId",0}, { "_unsigned_char","_byte",0}, + { "_class_wxMetaFileDC","_wxMetaFileDC",0}, { "_class_wxMenu","_wxMenu",0}, { "_wxControl","_class_wxControl",0}, { "_class_wxListBox","_wxListBox",0}, @@ -2424,6 +2427,7 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = { { "_class_wxPyApp","_wxPyApp",0}, { "_wxSize","_class_wxSize",0}, { "_wxRegionIterator","_class_wxRegionIterator",0}, + { "_class_wxPrinterDC","_wxPrinterDC",0}, { "_class_wxPyTextDataObject","_wxPyTextDataObject",0}, { "_class_wxLogTextCtrl","_wxLogTextCtrl",0}, { "_class_wxLogGui","_wxLogGui",0}, diff --git a/wxPython/contrib/ogl/oglcanvas.i b/wxPython/contrib/ogl/oglcanvas.i index bf96d849c0..88ed4a4345 100644 --- a/wxPython/contrib/ogl/oglcanvas.i +++ b/wxPython/contrib/ogl/oglcanvas.i @@ -14,7 +14,7 @@ %module oglcanvas %{ -#include "helpers.h" +#include "export.h" #include "oglhelpers.h" %} @@ -112,8 +112,8 @@ public: class wxPyShapeCanvas : public wxScrolledWindow { public: wxPyShapeCanvas(wxWindow* parent = NULL, wxWindowID id = -1, - const wxPoint& pos = wxPyDefaultPosition, - const wxSize& size = wxPyDefaultSize, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, long style = wxBORDER); void _setSelf(PyObject* self, PyObject* _class); diff --git a/wxPython/contrib/ogl/oglhelpers.cpp b/wxPython/contrib/ogl/oglhelpers.cpp deleted file mode 100644 index ab2152276a..0000000000 --- a/wxPython/contrib/ogl/oglhelpers.cpp +++ /dev/null @@ -1,103 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: oglhelpers.cpp -// Purpose: Some Helper functions to help in data conversions in OGL -// -// Author: Robin Dunn -// -// Created: 3-Sept-1999 -// RCS-ID: $Id$ -// Copyright: (c) 1998 by Total Control Software -// Licence: wxWindows license -///////////////////////////////////////////////////////////////////////////// - -#include -#include "helpers.h" - -//--------------------------------------------------------------------------- -// This one will work for any class for the VERY generic cases, but beyond that -// the helper needs to know more about the type. - -wxList* wxPy_wxListHelper(PyObject* pyList, char* className) { - bool doSave = wxPyRestoreThread(); - if (!PyList_Check(pyList)) { - PyErr_SetString(PyExc_TypeError, "Expected a list object."); - wxPySaveThread(doSave); - return NULL; - } - int count = PyList_Size(pyList); - wxList* list = new wxList; - if (! list) { - PyErr_SetString(PyExc_MemoryError, "Unable to allocate wxList object"); - wxPySaveThread(doSave); - return NULL; - } - for (int x=0; xAppend(wxo); - } - wxPySaveThread(doSave); - return list; -} - -//--------------------------------------------------------------------------- - -wxList* wxPy_wxRealPoint_ListHelper(PyObject* pyList) { - bool doSave = wxPyRestoreThread(); - if (!PyList_Check(pyList)) { - PyErr_SetString(PyExc_TypeError, "Expected a list object."); - wxPySaveThread(doSave); - return NULL; - } - int count = PyList_Size(pyList); - wxList* list = new wxList; - if (! list) { - PyErr_SetString(PyExc_MemoryError, "Unable to allocate wxList object"); - wxPySaveThread(doSave); - return NULL; - } - for (int x=0; xAppend((wxObject*) new wxRealPoint(val1, val2)); - - } else { - wxRealPoint* wxo = NULL; - if (SWIG_GetPtrObj(pyo, (void **)&wxo, "_wxRealPoint_p")) { - PyErr_SetString(PyExc_TypeError, "Type error, expected list of wxRealPoint objects or 2-tuples"); - wxPySaveThread(doSave); - return NULL; - } - list->Append((wxObject*) new wxRealPoint(*wxo)); - } - } - wxPySaveThread(doSave); - return list; -} - - -//--------------------------------------------------------------------------- - - - - - - - - - diff --git a/wxPython/contrib/ogl/oglshapes.cpp b/wxPython/contrib/ogl/oglshapes.cpp index 7c7be0f89a..2916429c24 100644 --- a/wxPython/contrib/ogl/oglshapes.cpp +++ b/wxPython/contrib/ogl/oglshapes.cpp @@ -55,7 +55,7 @@ extern PyObject *SWIG_newvarlink(void); #define SWIG_name "oglshapesc" -#include "helpers.h" +#include "export.h" #include "oglhelpers.h" static PyObject* l_output_helper(PyObject* target, PyObject* o) { @@ -12661,6 +12661,7 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = { { "_class_wxRealPoint","_wxRealPoint",0}, { "_wxNavigationKeyEvent","_class_wxNavigationKeyEvent",0}, { "_wxPNMHandler","_class_wxPNMHandler",0}, + { "_wxPrinterDC","_class_wxPrinterDC",0}, { "_wxWindowCreateEvent","_class_wxWindowCreateEvent",0}, { "_wxLogGui","_class_wxLogGui",0}, { "_class_wxPyShapeEvtHandler","_class_wxPyDivisionShape",SwigwxPyDivisionShapeTowxPyShapeEvtHandler}, @@ -12687,7 +12688,6 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = { { "_class_wxPyCompositeShape","_class_wxPyDivisionShape",SwigwxPyDivisionShapeTowxPyCompositeShape}, { "_class_wxPyCompositeShape","_wxPyDivisionShape",SwigwxPyDivisionShapeTowxPyCompositeShape}, { "_class_wxPyCompositeShape","_wxPyCompositeShape",0}, - { "_class_wxPostScriptDC","_wxPostScriptDC",0}, { "_wxPanel","_class_wxPanel",0}, { "_wxInitDialogEvent","_class_wxInitDialogEvent",0}, { "_wxCheckBox","_class_wxCheckBox",0}, @@ -12752,6 +12752,7 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = { { "_class_wxZipFSHandler","_wxZipFSHandler",0}, { "_char","_wxChar",0}, { "_wxBitmap","_class_wxBitmap",0}, + { "_wxTaskBarIcon","_class_wxTaskBarIcon",0}, { "_wxPrintDialog","_class_wxPrintDialog",0}, { "_wxPyControlPoint","_class_wxPyControlPoint",0}, { "_wxWindowDC","_class_wxWindowDC",0}, @@ -12839,6 +12840,7 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = { { "_class_wxTextCtrl","_wxTextCtrl",0}, { "_class_wxListItemAttr","_wxListItemAttr",0}, { "_wxLayoutConstraints","_class_wxLayoutConstraints",0}, + { "_wxMetaFileDC","_class_wxMetaFileDC",0}, { "_class_wxTextDataObject","_wxTextDataObject",0}, { "_wxMenu","_class_wxMenu",0}, { "_class_wxMoveEvent","_wxMoveEvent",0}, @@ -12890,6 +12892,7 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = { { "_signed_short","_short",0}, { "_wxMemoryDC","_class_wxMemoryDC",0}, { "_wxPyTextDataObject","_class_wxPyTextDataObject",0}, + { "_class_wxTaskBarIcon","_wxTaskBarIcon",0}, { "_class_wxPrintDialog","_wxPrintDialog",0}, { "_wxPyFileSystemHandler","_class_wxPyFileSystemHandler",0}, { "_class_wxPyControlPoint","_wxPyControlPoint",0}, @@ -12900,7 +12903,6 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = { { "_wxStatusBar","_class_wxStatusBar",0}, { "_class_wxAcceleratorEntry","_wxAcceleratorEntry",0}, { "_class_wxCursor","_wxCursor",0}, - { "_wxPostScriptDC","_class_wxPostScriptDC",0}, { "_wxPyFileDropTarget","_class_wxPyFileDropTarget",0}, { "_class_wxPyProcess","_wxPyProcess",0}, { "_class_wxImageHandler","_wxImageHandler",0}, @@ -12923,6 +12925,7 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = { { "_class_wxLog","_wxLog",0}, { "_wxTreeItemId","_class_wxTreeItemId",0}, { "_unsigned_char","_byte",0}, + { "_class_wxMetaFileDC","_wxMetaFileDC",0}, { "_class_wxMenu","_wxMenu",0}, { "_wxControl","_class_wxControl",0}, { "_class_wxListBox","_wxListBox",0}, @@ -13009,6 +13012,7 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = { { "_class_wxPyApp","_wxPyApp",0}, { "_wxSize","_class_wxSize",0}, { "_wxRegionIterator","_class_wxRegionIterator",0}, + { "_class_wxPrinterDC","_wxPrinterDC",0}, { "_class_wxPyTextDataObject","_wxPyTextDataObject",0}, { "_class_wxLogTextCtrl","_wxLogTextCtrl",0}, { "_class_wxLogGui","_wxLogGui",0}, diff --git a/wxPython/contrib/ogl/oglshapes.i b/wxPython/contrib/ogl/oglshapes.i index 2b2f94e40f..6beaa08a41 100644 --- a/wxPython/contrib/ogl/oglshapes.i +++ b/wxPython/contrib/ogl/oglshapes.i @@ -14,7 +14,7 @@ %module oglshapes %{ -#include "helpers.h" +#include "export.h" #include "oglhelpers.h" %} diff --git a/wxPython/contrib/ogl/oglshapes2.cpp b/wxPython/contrib/ogl/oglshapes2.cpp index 0814331896..474d070107 100644 --- a/wxPython/contrib/ogl/oglshapes2.cpp +++ b/wxPython/contrib/ogl/oglshapes2.cpp @@ -55,7 +55,7 @@ extern PyObject *SWIG_newvarlink(void); #define SWIG_name "oglshapes2c" -#include "helpers.h" +#include "export.h" #include "oglhelpers.h" static PyObject* l_output_helper(PyObject* target, PyObject* o) { @@ -8002,6 +8002,7 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = { { "_class_wxRealPoint","_wxRealPoint",0}, { "_wxNavigationKeyEvent","_class_wxNavigationKeyEvent",0}, { "_wxPNMHandler","_class_wxPNMHandler",0}, + { "_wxPrinterDC","_class_wxPrinterDC",0}, { "_wxWindowCreateEvent","_class_wxWindowCreateEvent",0}, { "_wxLogGui","_class_wxLogGui",0}, { "_class_wxPyShapeEvtHandler","_class_wxPyTextShape",SwigwxPyTextShapeTowxPyShapeEvtHandler}, @@ -8023,7 +8024,6 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = { { "_class_wxPySizer","_wxPySizer",0}, { "_class_wxPyCompositeShape","_wxPyCompositeShape",0}, { "_wxPyPolygonShape","_class_wxPyPolygonShape",0}, - { "_class_wxPostScriptDC","_wxPostScriptDC",0}, { "_wxPanel","_class_wxPanel",0}, { "_wxInitDialogEvent","_class_wxInitDialogEvent",0}, { "_wxCheckBox","_class_wxCheckBox",0}, @@ -8088,6 +8088,7 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = { { "_class_wxZipFSHandler","_wxZipFSHandler",0}, { "_char","_wxChar",0}, { "_wxBitmap","_class_wxBitmap",0}, + { "_wxTaskBarIcon","_class_wxTaskBarIcon",0}, { "_wxPrintDialog","_class_wxPrintDialog",0}, { "_wxPyControlPoint","_class_wxPyControlPoint",0}, { "_wxWindowDC","_class_wxWindowDC",0}, @@ -8178,6 +8179,7 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = { { "_class_wxTextCtrl","_wxTextCtrl",0}, { "_class_wxListItemAttr","_wxListItemAttr",0}, { "_wxLayoutConstraints","_class_wxLayoutConstraints",0}, + { "_wxMetaFileDC","_class_wxMetaFileDC",0}, { "_class_wxTextDataObject","_wxTextDataObject",0}, { "_wxMenu","_class_wxMenu",0}, { "_class_wxMoveEvent","_wxMoveEvent",0}, @@ -8231,6 +8233,7 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = { { "_signed_short","_short",0}, { "_wxMemoryDC","_class_wxMemoryDC",0}, { "_wxPyTextDataObject","_class_wxPyTextDataObject",0}, + { "_class_wxTaskBarIcon","_wxTaskBarIcon",0}, { "_class_wxPrintDialog","_wxPrintDialog",0}, { "_wxPyFileSystemHandler","_class_wxPyFileSystemHandler",0}, { "_class_wxPyControlPoint","_wxPyControlPoint",0}, @@ -8241,7 +8244,6 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = { { "_wxStatusBar","_class_wxStatusBar",0}, { "_class_wxAcceleratorEntry","_wxAcceleratorEntry",0}, { "_class_wxCursor","_wxCursor",0}, - { "_wxPostScriptDC","_class_wxPostScriptDC",0}, { "_wxPyFileDropTarget","_class_wxPyFileDropTarget",0}, { "_class_wxPyProcess","_wxPyProcess",0}, { "_class_wxImageHandler","_wxImageHandler",0}, @@ -8260,6 +8262,7 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = { { "_class_wxLog","_wxLog",0}, { "_wxTreeItemId","_class_wxTreeItemId",0}, { "_unsigned_char","_byte",0}, + { "_class_wxMetaFileDC","_wxMetaFileDC",0}, { "_class_wxMenu","_wxMenu",0}, { "_wxControl","_class_wxControl",0}, { "_class_wxListBox","_wxListBox",0}, @@ -8347,6 +8350,7 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = { { "_class_wxPyApp","_wxPyApp",0}, { "_wxSize","_class_wxSize",0}, { "_wxRegionIterator","_class_wxRegionIterator",0}, + { "_class_wxPrinterDC","_wxPrinterDC",0}, { "_class_wxPyTextDataObject","_wxPyTextDataObject",0}, { "_class_wxLogTextCtrl","_wxLogTextCtrl",0}, { "_class_wxLogGui","_wxLogGui",0}, diff --git a/wxPython/contrib/ogl/oglshapes2.i b/wxPython/contrib/ogl/oglshapes2.i index ef2a718958..2b90a48590 100644 --- a/wxPython/contrib/ogl/oglshapes2.i +++ b/wxPython/contrib/ogl/oglshapes2.i @@ -14,7 +14,7 @@ %module oglshapes2 %{ -#include "helpers.h" +#include "export.h" #include "oglhelpers.h" %} diff --git a/wxPython/contrib/ogl/stub.cpp b/wxPython/contrib/ogl/stub.cpp deleted file mode 100644 index 45305e77e1..0000000000 --- a/wxPython/contrib/ogl/stub.cpp +++ /dev/null @@ -1,24 +0,0 @@ -/* Definitions for Windows/Unix exporting */ -#if defined(__WIN32__) -# if defined(_MSC_VER) -# define SWIGEXPORT(a) __declspec(dllexport) a -# else -# if defined(__BORLANDC__) -# define SWIGEXPORT(a) a _export -# else -# define SWIGEXPORT(a) a -# endif -# endif -#else -# define SWIGEXPORT(a) a -#endif - - - -#ifdef __cplusplus -extern "C" -#endif -SWIGEXPORT(void) initoglc() { -} - - diff --git a/wxPython/contrib/stc/stc_.cpp b/wxPython/contrib/stc/stc_.cpp index 010be449b4..f31e053805 100644 --- a/wxPython/contrib/stc/stc_.cpp +++ b/wxPython/contrib/stc/stc_.cpp @@ -55,7 +55,7 @@ extern PyObject *SWIG_newvarlink(void); #define SWIG_name "stc_c" -#include "helpers.h" +#include "export.h" #include "wx/stc/stc.h" static PyObject* l_output_helper(PyObject* target, PyObject* o) { @@ -8626,6 +8626,7 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = { { "_class_wxRealPoint","_wxRealPoint",0}, { "_wxNavigationKeyEvent","_class_wxNavigationKeyEvent",0}, { "_wxPNMHandler","_class_wxPNMHandler",0}, + { "_wxPrinterDC","_class_wxPrinterDC",0}, { "_wxWindowCreateEvent","_class_wxWindowCreateEvent",0}, { "_wxLogGui","_class_wxLogGui",0}, { "_class_wxMenuItem","_wxMenuItem",0}, @@ -8634,7 +8635,6 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = { { "_class_wxStatusBar","_wxStatusBar",0}, { "_class_wxGIFHandler","_wxGIFHandler",0}, { "_class_wxPySizer","_wxPySizer",0}, - { "_class_wxPostScriptDC","_wxPostScriptDC",0}, { "_wxPanel","_class_wxPanel",0}, { "_wxInitDialogEvent","_class_wxInitDialogEvent",0}, { "_wxCheckBox","_class_wxCheckBox",0}, @@ -8701,6 +8701,7 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = { { "_class_wxZipFSHandler","_wxZipFSHandler",0}, { "_char","_wxChar",0}, { "_wxBitmap","_class_wxBitmap",0}, + { "_wxTaskBarIcon","_class_wxTaskBarIcon",0}, { "_wxPrintDialog","_class_wxPrintDialog",0}, { "_wxWindowDC","_class_wxWindowDC",0}, { "_wxTimerEvent","_class_wxTimerEvent",0}, @@ -8784,6 +8785,7 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = { { "_class_wxTextCtrl","_wxTextCtrl",0}, { "_class_wxListItemAttr","_wxListItemAttr",0}, { "_wxLayoutConstraints","_class_wxLayoutConstraints",0}, + { "_wxMetaFileDC","_class_wxMetaFileDC",0}, { "_class_wxTextDataObject","_wxTextDataObject",0}, { "_wxMenu","_class_wxMenu",0}, { "_class_wxMoveEvent","_wxMoveEvent",0}, @@ -8837,6 +8839,7 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = { { "_signed_short","_short",0}, { "_wxMemoryDC","_class_wxMemoryDC",0}, { "_wxPyTextDataObject","_class_wxPyTextDataObject",0}, + { "_class_wxTaskBarIcon","_wxTaskBarIcon",0}, { "_class_wxPrintDialog","_wxPrintDialog",0}, { "_wxPyFileSystemHandler","_class_wxPyFileSystemHandler",0}, { "_wxPaintDC","_class_wxPaintDC",0}, @@ -8846,7 +8849,6 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = { { "_wxStatusBar","_class_wxStatusBar",0}, { "_class_wxAcceleratorEntry","_wxAcceleratorEntry",0}, { "_class_wxCursor","_wxCursor",0}, - { "_wxPostScriptDC","_class_wxPostScriptDC",0}, { "_wxPyFileDropTarget","_class_wxPyFileDropTarget",0}, { "_class_wxPyProcess","_wxPyProcess",0}, { "_class_wxImageHandler","_wxImageHandler",0}, @@ -8854,6 +8856,7 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = { { "_class_wxLog","_wxLog",0}, { "_wxTreeItemId","_class_wxTreeItemId",0}, { "_unsigned_char","_byte",0}, + { "_class_wxMetaFileDC","_wxMetaFileDC",0}, { "_class_wxMenu","_wxMenu",0}, { "_wxControl","_class_wxStyledTextCtrl",SwigwxStyledTextCtrlTowxControl}, { "_wxControl","_wxStyledTextCtrl",SwigwxStyledTextCtrlTowxControl}, @@ -8941,6 +8944,7 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = { { "_class_wxPyApp","_wxPyApp",0}, { "_wxSize","_class_wxSize",0}, { "_wxRegionIterator","_class_wxRegionIterator",0}, + { "_class_wxPrinterDC","_wxPrinterDC",0}, { "_class_wxPyTextDataObject","_wxPyTextDataObject",0}, { "_class_wxLogTextCtrl","_wxLogTextCtrl",0}, { "_class_wxLogGui","_wxLogGui",0}, @@ -9431,8 +9435,8 @@ SWIGEXPORT(void) initstc_c() { PyDict_SetItemString(d,"wxEVT_STC_POSCHANGED", PyInt_FromLong((long) wxEVT_STC_POSCHANGED)); - wxClassInfo::CleanUpClasses(); - wxClassInfo::InitializeClasses(); +// wxClassInfo::CleanUpClasses(); +// wxClassInfo::InitializeClasses(); { int i; diff --git a/wxPython/contrib/stc/stc_.i b/wxPython/contrib/stc/stc_.i index 53d586bb9c..62ce47e23d 100644 --- a/wxPython/contrib/stc/stc_.i +++ b/wxPython/contrib/stc/stc_.i @@ -14,7 +14,7 @@ %{ -#include "helpers.h" +#include "export.h" #include "wx/stc/stc.h" %} @@ -34,7 +34,6 @@ // Get all our defs from the REAL header file. %include stc.h -//%include SciLexer.h //---------------------------------------------------------------------- // Python functions to act like the event macros @@ -89,8 +88,8 @@ def EVT_STC_POSCHANGED(win, id, fn): %init %{ - wxClassInfo::CleanUpClasses(); - wxClassInfo::InitializeClasses(); +// wxClassInfo::CleanUpClasses(); +// wxClassInfo::InitializeClasses(); %} diff --git a/wxPython/contrib/stc/stub.cpp b/wxPython/contrib/stc/stub.cpp deleted file mode 100644 index 4f696dc5fb..0000000000 --- a/wxPython/contrib/stc/stub.cpp +++ /dev/null @@ -1,23 +0,0 @@ -/* Definitions for Windows/Unix exporting */ -#if defined(__WIN32__) -# if defined(_MSC_VER) -# define SWIGEXPORT(a) __declspec(dllexport) a -# else -# if defined(__BORLANDC__) -# define SWIGEXPORT(a) a _export -# else -# define SWIGEXPORT(a) a -# endif -# endif -#else -# define SWIGEXPORT(a) a -#endif - - -#ifdef __cplusplus -extern "C" -#endif -SWIGEXPORT(void) initstc_c() { -} - - diff --git a/wxPython/demo/data/echo.py b/wxPython/demo/data/echo.py index 46e5fa761e..d40a9f1988 100644 --- a/wxPython/demo/data/echo.py +++ b/wxPython/demo/data/echo.py @@ -20,6 +20,8 @@ while line: line = line[:-1] sys.stdout.write('\nYou typed "%s"\n' % line) sys.stdout.flush() + #sys.stderr.write('\nTyped you "%s" Yoda say...\n' % line) + #sys.stderr.flush() line = sys.stdin.readline() diff --git a/wxPython/my_distutils.py b/wxPython/my_distutils.py index 9d66065ff0..a40ff6f66e 100644 --- a/wxPython/my_distutils.py +++ b/wxPython/my_distutils.py @@ -115,97 +115,6 @@ class MyMSVCCompiler(MSVCCompiler): - ##------------------------------------------------------------ - ## Now override the link() method to change where the import - ## library is placed. Hopefully distutils will be updated - ## someday to make this configurable... - ##------------------------------------------------------------ - - def link (self, - target_desc, - objects, - output_filename, - output_dir=None, - libraries=None, - library_dirs=None, - runtime_library_dirs=None, - export_symbols=None, - debug=0, - extra_preargs=None, - extra_postargs=None, - build_temp=None): - - (objects, output_dir) = self._fix_object_args (objects, output_dir) - (libraries, library_dirs, runtime_library_dirs) = \ - self._fix_lib_args (libraries, library_dirs, runtime_library_dirs) - - if runtime_library_dirs: - self.warn ("I don't know what to do with 'runtime_library_dirs': " - + str (runtime_library_dirs)) - - lib_opts = gen_lib_options (self, - library_dirs, runtime_library_dirs, - libraries) - if output_dir is not None: - output_filename = os.path.join (output_dir, output_filename) - - if self._need_link (objects, output_filename): - - if target_desc == CCompiler.EXECUTABLE: - if debug: - ldflags = self.ldflags_shared_debug[1:] - else: - ldflags = self.ldflags_shared[1:] - else: - if debug: - ldflags = self.ldflags_shared_debug - else: - ldflags = self.ldflags_shared - - export_opts = [] - for sym in (export_symbols or []): - export_opts.append("/EXPORT:" + sym) - - ld_args = (ldflags + lib_opts + export_opts + - objects + ['/OUT:' + output_filename]) - - # The MSVC linker generates .lib and .exp files, which cannot be - # suppressed by any linker switches. The .lib files may even be - # needed! Make sure they are generated in the temporary build - # directory. Since they have different names for debug and release - # builds, they can go into the same directory. - if export_symbols is not None: - (dll_name, dll_ext) = os.path.splitext( - os.path.basename(output_filename)) - - ## The old code - ##implib_file = os.path.join( - ## os.path.dirname(objects[0]), - ## self.library_filename(dll_name)) - - ## The new - implib_file = os.path.join('build', 'ilib', - self.library_filename(dll_name)) - self.mkpath(os.path.dirname(implib_file)) - - ld_args.append ('/IMPLIB:' + implib_file) - - if extra_preargs: - ld_args[:0] = extra_preargs - if extra_postargs: - ld_args.extend(extra_postargs) - - self.mkpath (os.path.dirname (output_filename)) - try: - self.spawn ([self.linker] + ld_args) - except DistutilsExecError, msg: - raise LinkError, msg - - else: - self.announce ("skipping %s (up-to-date)" % output_filename) - - # link () - #---------------------------------------------------------------------- diff --git a/wxPython/setup.py b/wxPython/setup.py index f440d5e3d3..64f8b24969 100755 --- a/wxPython/setup.py +++ b/wxPython/setup.py @@ -13,7 +13,7 @@ from my_distutils import run_swig, contrib_copy_tree # flags and values that affect this script #---------------------------------------------------------------------- -VERSION = "2.3b1" +VERSION = "2.3b2" DESCRIPTION = "Cross platform GUI toolkit for Python" AUTHOR = "Robin Dunn" AUTHOR_EMAIL = "robin@alldunn.com" @@ -102,8 +102,6 @@ if os.name == 'nt': WXPLAT = '__WXMSW__' GENDIR = 'msw' - - if debug: FINAL = 0 HYBRID = 0 @@ -111,7 +109,6 @@ if os.name == 'nt': if HYBRID: FINAL = 0 - includes = ['src', os.path.join(WXDIR, 'include'), ] @@ -144,14 +141,13 @@ if os.name == 'nt': else: wxdll = 'wx' + WXDLLVER + 'd' - #print 'Linking with ', wxdll libs = [wxdll, 'kernel32', 'user32', 'gdi32', 'comdlg32', 'winspool', 'winmm', 'shell32', 'oldnames', 'comctl32', 'ctl3d32', 'odbc32', 'ole32', 'oleaut32', 'uuid', 'rpcrt4', 'advapi32', 'wsock32'] - cflags = ['/GX-'] # workaround for internal compiler error in MSVC + cflags = ['/GX-'] # workaround for internal compiler error in MSVC 5 lflags = None if not FINAL and HYBRID: @@ -204,10 +200,11 @@ swig_args = ['-c++', '-shadow', '-python', '-keyword', '-dnone', #'-dascii', swig_deps = ['src/my_typemaps.i'] swig_files = [ 'wx.i', 'windows.i', 'windows2.i', 'windows3.i', 'events.i', - 'misc.i', 'misc2.i', 'utils.i', 'gdi.i', 'mdi.i', 'controls.i', + 'misc.i', 'misc2.i', 'gdi.i', 'mdi.i', 'controls.i', 'controls2.i', 'cmndlgs.i', 'stattool.i', 'frames.i', 'image.i', - 'printfw.i', 'sizers.i', 'clip_dnd.i', 'grid.i', 'html.i', - 'htmlhelp.i', 'calendar.i', 'filesys.i', 'streams.i' + 'printfw.i', 'sizers.i', 'clip_dnd.i', + 'filesys.i', 'streams.i', +# 'grid.i', 'html.i', 'htmlhelp.i', 'calendar.i', 'utils.i', ] swig_sources = run_swig(swig_files, 'src', GENDIR, PKGDIR, @@ -229,7 +226,7 @@ else: rc_file = [] -wxext = ext = Extension('wxc', ['src/helpers.cpp', +ext = Extension('wxc', ['src/helpers.cpp', 'src/libpy.c', ] + rc_file + swig_sources, @@ -242,30 +239,76 @@ wxext = ext = Extension('wxc', ['src/helpers.cpp', extra_compile_args = cflags, extra_link_args = lflags, ) - - wxpExtensions.append(ext) -if os.name == 'nt': - libs = libs[:] - if debug: - libs.insert(0, 'wxc_d') - else: - libs.insert(0, 'wxc') + +# Extension for the grid module +swig_sources = run_swig(['grid.i'], 'src', GENDIR, PKGDIR, + USE_SWIG, swig_force, swig_args, swig_deps) +ext = Extension('gridc', swig_sources, + include_dirs = includes, + define_macros = defines, + library_dirs = libdirs, + libraries = libs, + extra_compile_args = cflags, + extra_link_args = lflags, + ) +wxpExtensions.append(ext) + + +# Extension for the html modules +swig_sources = run_swig(['html.i', 'htmlhelp.i'], 'src', GENDIR, PKGDIR, + USE_SWIG, swig_force, swig_args, swig_deps) +ext = Extension('htmlc', swig_sources, + include_dirs = includes, + define_macros = defines, + library_dirs = libdirs, + libraries = libs, + extra_compile_args = cflags, + extra_link_args = lflags, + ) +wxpExtensions.append(ext) + + +# Extension for the utils module +swig_sources = run_swig(['utils.i'], 'src', GENDIR, PKGDIR, + USE_SWIG, swig_force, swig_args, swig_deps) +ext = Extension('utilsc', swig_sources, + include_dirs = includes, + define_macros = defines, + library_dirs = libdirs, + libraries = libs, + extra_compile_args = cflags, + extra_link_args = lflags, + ) +wxpExtensions.append(ext) + + +# Extension for the calendar module +swig_sources = run_swig(['calendar.i'], 'src', GENDIR, PKGDIR, + USE_SWIG, swig_force, swig_args, swig_deps) +ext = Extension('calendarc', swig_sources, + include_dirs = includes, + define_macros = defines, + library_dirs = libdirs, + libraries = libs, + extra_compile_args = cflags, + extra_link_args = lflags, + ) +wxpExtensions.append(ext) + #---------------------------------------------------------------------- # Define the GLCanvas extension module #---------------------------------------------------------------------- -if not BUILD_GLCANVAS: - wxext.sources = wxext.sources + ['contrib/glcanvas/stub.cpp'] -else: +if BUILD_GLCANVAS: print 'Preparing GLCANVAS...' location = 'contrib/glcanvas' swig_files = ['glcanvas.i'] swig_sources = run_swig(swig_files, location, GENDIR, PKGDIR, - USE_SWIG, swig_force, swig_args, swig_deps) + USE_SWIG, swig_force, swig_args) gl_libs = [] if os.name == 'posix': @@ -274,8 +317,20 @@ else: else: gl_libs = ['wx_gtk_gl', 'GL', 'GLU'] - wxext.sources = wxext.sources + swig_sources - wxext.libraries = wxext.libraries + gl_libs + ext = Extension('glcanvasc', + swig_sources, + + include_dirs = includes, + define_macros = defines, + + library_dirs = libdirs, + libraries = libs + gl_libs, + + extra_compile_args = cflags, + extra_link_args = lflags, + ) + + wxpExtensions.append(ext) #---------------------------------------------------------------------- @@ -283,9 +338,7 @@ else: #---------------------------------------------------------------------- -if not BUILD_OGL: - wxext.sources = wxext.sources + ['contrib/ogl/stub.cpp'] -else: +if BUILD_OGL: print 'Preparing OGL...' location = 'contrib/ogl' OGLLOC = location + '/contrib/src/ogl' @@ -295,39 +348,46 @@ else: 'oglcanvas.i'] swig_sources = run_swig(swig_files, location, '', PKGDIR, - USE_SWIG, swig_force, swig_args, swig_deps) + USE_SWIG, swig_force, swig_args) # make sure local copy of contrib files are up to date if IN_CVS_TREE: contrib_copy_tree(WXDIR + '/contrib/include/wx/ogl', OGLINC+'/wx/ogl') contrib_copy_tree(WXDIR + '/contrib/src/ogl', OGLLOC) - # add items to the core extension module definition - wxext.sources = wxext.sources + [location + '/oglhelpers.cpp', - '%s/basic.cpp' % OGLLOC, - '%s/bmpshape.cpp' % OGLLOC, - '%s/composit.cpp' % OGLLOC, - '%s/divided.cpp' % OGLLOC, - '%s/lines.cpp' % OGLLOC, - '%s/misc.cpp' % OGLLOC, - '%s/basic2.cpp' % OGLLOC, - '%s/canvas.cpp' % OGLLOC, - '%s/constrnt.cpp' % OGLLOC, - '%s/drawn.cpp' % OGLLOC, - '%s/mfutils.cpp' % OGLLOC, - '%s/ogldiag.cpp' % OGLLOC, - ] + swig_sources + ext = Extension('oglc', ['%s/basic.cpp' % OGLLOC, + '%s/bmpshape.cpp' % OGLLOC, + '%s/composit.cpp' % OGLLOC, + '%s/divided.cpp' % OGLLOC, + '%s/lines.cpp' % OGLLOC, + '%s/misc.cpp' % OGLLOC, + '%s/basic2.cpp' % OGLLOC, + '%s/canvas.cpp' % OGLLOC, + '%s/constrnt.cpp' % OGLLOC, + '%s/drawn.cpp' % OGLLOC, + '%s/mfutils.cpp' % OGLLOC, + '%s/ogldiag.cpp' % OGLLOC, + ] + swig_sources, + + include_dirs = [OGLINC] + includes, + define_macros = defines, + + library_dirs = libdirs, + libraries = libs, + + extra_compile_args = cflags, + extra_link_args = lflags, + ) + + wxpExtensions.append(ext) + - wxext.include_dirs = wxext.include_dirs + [OGLINC] #---------------------------------------------------------------------- # Define the STC extension module #---------------------------------------------------------------------- - -if not BUILD_STC: - wxext.sources = wxext.sources + ['contrib/stc/stub.cpp'] -else: +if BUILD_STC: print 'Preparing STC...' location = 'contrib/stc' STCLOC = location + '/contrib/src/stc' @@ -344,24 +404,25 @@ else: swig_sources = run_swig(swig_files, location, '', PKGDIR, USE_SWIG, swig_force, swig_args + ['-I'+STC_H, '-I'+location], - swig_deps + [STC_H+'/stc.h']) + [STC_H+'/stc.h']) # copy a project specific py module to the main package dir copy_file(location+'/stc.py', PKGDIR, update=1, verbose=1) # add some include dirs to the standard set - stc_includes = [ '%s/scintilla/include' % STCLOC, - '%s/scintilla/src' % STCLOC, - STCINC ] + stc_includes = includes[:] + stc_includes.append('%s/scintilla/include' % STCLOC) + stc_includes.append('%s/scintilla/src' % STCLOC) + stc_includes.append(STCINC) # and some macro definitions - stc_defines = [ ('__WX__', None), - ('SCI_LEXER', None) ] + stc_defines = defines[:] + stc_defines.append( ('__WX__', None) ) + stc_defines.append( ('SCI_LEXER', None) ) - # add items to the core extension module definition - wxext.sources = wxext.sources + [ - '%s/scintilla/src/AutoComplete.cxx' % STCLOC, + ext = Extension('stc_c', + ['%s/scintilla/src/AutoComplete.cxx' % STCLOC, '%s/scintilla/src/CallTip.cxx' % STCLOC, '%s/scintilla/src/CellBuffer.cxx' % STCLOC, '%s/scintilla/src/ContractionState.cxx' % STCLOC, @@ -391,10 +452,19 @@ else: '%s/PlatWX.cpp' % STCLOC, '%s/ScintillaWX.cpp' % STCLOC, '%s/stc.cpp' % STCLOC, - ] + swig_sources + ] + swig_sources, - wxext.include_dirs = wxext.include_dirs + stc_includes - wxext.define_macros = wxext.define_macros + stc_defines + include_dirs = stc_includes, + define_macros = stc_defines, + + library_dirs = libdirs, + libraries = libs, + + extra_compile_args = cflags, + extra_link_args = lflags, + ) + + wxpExtensions.append(ext) @@ -461,20 +531,15 @@ setup(name = PKGDIR, #---------------------------------------------------------------------- #---------------------------------------------------------------------- #---------------------------------------------------------------------- - -# Originally I was building separate extension module .so's for the -# CORE and the various contribs. Because of shared library issues I've -# decided to combine things into one .so as implemented above, but as -# I'm still not entirely convinced that this is the right thing to do -# I will keep the old code around for a while, but commented out below. - -## if BUILD_GLCANVAS: +## if not BUILD_GLCANVAS: +## wxext.sources = wxext.sources + ['contrib/glcanvas/stub.cpp'] +## else: ## print 'Preparing GLCANVAS...' ## location = 'contrib/glcanvas' ## swig_files = ['glcanvas.i'] ## swig_sources = run_swig(swig_files, location, GENDIR, PKGDIR, -## USE_SWIG, swig_force, swig_args) +## USE_SWIG, swig_force, swig_args, swig_deps) ## gl_libs = [] ## if os.name == 'posix': @@ -483,24 +548,13 @@ setup(name = PKGDIR, ## else: ## gl_libs = ['wx_gtk_gl', 'GL', 'GLU'] -## ext = Extension('glcanvasc', -## swig_sources, - -## include_dirs = includes, -## define_macros = defines, - -## library_dirs = libdirs, -## libraries = libs + gl_libs, - -## extra_compile_args = cflags, -## extra_link_args = lflags, -## ) - -## wxpExtensions.append(ext) +## wxext.sources = wxext.sources + swig_sources +## wxext.libraries = wxext.libraries + gl_libs - -## if BUILD_OGL: +## if not BUILD_OGL: +## wxext.sources = wxext.sources + ['contrib/ogl/stub.cpp'] +## else: ## print 'Preparing OGL...' ## location = 'contrib/ogl' ## OGLLOC = location + '/contrib/src/ogl' @@ -510,43 +564,37 @@ setup(name = PKGDIR, ## 'oglcanvas.i'] ## swig_sources = run_swig(swig_files, location, '', PKGDIR, -## USE_SWIG, swig_force, swig_args) +## USE_SWIG, swig_force, swig_args, swig_deps) ## # make sure local copy of contrib files are up to date ## if IN_CVS_TREE: ## contrib_copy_tree(WXDIR + '/contrib/include/wx/ogl', OGLINC+'/wx/ogl') ## contrib_copy_tree(WXDIR + '/contrib/src/ogl', OGLLOC) -## ext = Extension('oglc', [location + '/oglhelpers.cpp', -## '%s/basic.cpp' % OGLLOC, -## '%s/bmpshape.cpp' % OGLLOC, -## '%s/composit.cpp' % OGLLOC, -## '%s/divided.cpp' % OGLLOC, -## '%s/lines.cpp' % OGLLOC, -## '%s/misc.cpp' % OGLLOC, -## '%s/basic2.cpp' % OGLLOC, -## '%s/canvas.cpp' % OGLLOC, -## '%s/constrnt.cpp' % OGLLOC, -## '%s/drawn.cpp' % OGLLOC, -## '%s/mfutils.cpp' % OGLLOC, -## '%s/ogldiag.cpp' % OGLLOC, -## ] + swig_sources, +## # add items to the core extension module definition +## wxext.sources = wxext.sources + [location + '/oglhelpers.cpp', +## '%s/basic.cpp' % OGLLOC, +## '%s/bmpshape.cpp' % OGLLOC, +## '%s/composit.cpp' % OGLLOC, +## '%s/divided.cpp' % OGLLOC, +## '%s/lines.cpp' % OGLLOC, +## '%s/misc.cpp' % OGLLOC, +## '%s/basic2.cpp' % OGLLOC, +## '%s/canvas.cpp' % OGLLOC, +## '%s/constrnt.cpp' % OGLLOC, +## '%s/drawn.cpp' % OGLLOC, +## '%s/mfutils.cpp' % OGLLOC, +## '%s/ogldiag.cpp' % OGLLOC, +## ] + swig_sources -## include_dirs = [OGLINC] + includes, -## define_macros = defines, - -## library_dirs = libdirs, -## libraries = libs, - -## extra_compile_args = cflags, -## extra_link_args = lflags, -## ) - -## wxpExtensions.append(ext) +## wxext.include_dirs = wxext.include_dirs + [OGLINC] -## if BUILD_STC: + +## if not BUILD_STC: +## wxext.sources = wxext.sources + ['contrib/stc/stub.cpp'] +## else: ## print 'Preparing STC...' ## location = 'contrib/stc' ## STCLOC = location + '/contrib/src/stc' @@ -563,25 +611,24 @@ setup(name = PKGDIR, ## swig_sources = run_swig(swig_files, location, '', PKGDIR, ## USE_SWIG, swig_force, ## swig_args + ['-I'+STC_H, '-I'+location], -## [STC_H+'/stc.h']) +## swig_deps + [STC_H+'/stc.h']) ## # copy a project specific py module to the main package dir ## copy_file(location+'/stc.py', PKGDIR, update=1, verbose=1) ## # add some include dirs to the standard set -## stc_includes = includes[:] -## stc_includes.append('%s/scintilla/include' % STCLOC) -## stc_includes.append('%s/scintilla/src' % STCLOC) -## stc_includes.append(STCINC) +## stc_includes = [ '%s/scintilla/include' % STCLOC, +## '%s/scintilla/src' % STCLOC, +## STCINC ] ## # and some macro definitions -## stc_defines = defines[:] -## stc_defines.append( ('__WX__', None) ) -## stc_defines.append( ('SCI_LEXER', None) ) +## stc_defines = [ ('__WX__', None), +## ('SCI_LEXER', None) ] -## ext = Extension('stc_c', -## ['%s/scintilla/src/AutoComplete.cxx' % STCLOC, +## # add items to the core extension module definition +## wxext.sources = wxext.sources + [ +## '%s/scintilla/src/AutoComplete.cxx' % STCLOC, ## '%s/scintilla/src/CallTip.cxx' % STCLOC, ## '%s/scintilla/src/CellBuffer.cxx' % STCLOC, ## '%s/scintilla/src/ContractionState.cxx' % STCLOC, @@ -611,18 +658,7 @@ setup(name = PKGDIR, ## '%s/PlatWX.cpp' % STCLOC, ## '%s/ScintillaWX.cpp' % STCLOC, ## '%s/stc.cpp' % STCLOC, -## ] + swig_sources, - -## include_dirs = stc_includes, -## define_macros = stc_defines, - -## library_dirs = libdirs, -## libraries = libs, - -## extra_compile_args = cflags, -## extra_link_args = lflags, -## ) - -## wxpExtensions.append(ext) - +## ] + swig_sources +## wxext.include_dirs = wxext.include_dirs + stc_includes +## wxext.define_macros = wxext.define_macros + stc_defines diff --git a/wxPython/src/__version__.py b/wxPython/src/__version__.py index d814eaf09c..d1b8c358b2 100644 --- a/wxPython/src/__version__.py +++ b/wxPython/src/__version__.py @@ -1 +1 @@ -ver = '2.3b1' +ver = '2.3b2' diff --git a/wxPython/src/calendar.i b/wxPython/src/calendar.i index 73fc6bd66a..120e372b07 100644 --- a/wxPython/src/calendar.i +++ b/wxPython/src/calendar.i @@ -14,7 +14,7 @@ %{ -#include "helpers.h" +#include "export.h" #include %} diff --git a/wxPython/src/export.h b/wxPython/src/export.h new file mode 100644 index 0000000000..e674a8a6fc --- /dev/null +++ b/wxPython/src/export.h @@ -0,0 +1,66 @@ +//////////////////////////////////////////////////////////////////////////// +// Name: export.h +// Purpose: To be used from modules that are not part of the core +// wxPython extension in order to get access to some helper +// functions that live in wxc. +// +// Author: Robin Dunn +// +// Created: 14-Dec-2000 +// RCS-ID: $Id$ +// Copyright: (c) 2000 by Total Control Software +// Licence: wxWindows license +///////////////////////////////////////////////////////////////////////////// + +#ifndef __wxp_export__ +#define __wxp_export__ + +//---------------------------------------------------------------------- + +#define wxPyUSE_EXPORT +#include "helpers.h" + + +#define wxPyCoreAPI_IMPORT() \ + wxPyCoreAPIPtr = (wxPyCoreAPI*)PyCObject_Import("wxPython.wxc", "wxPyCoreAPI") + + +#define SWIG_MakePtr(a, b, c) (wxPyCoreAPIPtr->p_SWIG_MakePtr(a, b, c)) +#define SWIG_GetPtr(a, b, c) (wxPyCoreAPIPtr->p_SWIG_GetPtr(a, b, c)) +#define SWIG_GetPtrObj(a, b, c) (wxPyCoreAPIPtr->p_SWIG_GetPtrObj(a, b, c)) +#define SWIG_RegisterMapping(a, b, c) (wxPyCoreAPIPtr->p_SWIG_RegisterMapping(a, b, c)) +#define SWIG_addvarlink(a, b, c, d) (wxPyCoreAPIPtr->p_SWIG_addvarlink(a, b, c, d)) + +#define wxPyRestoreThread() (wxPyCoreAPIPtr->p_wxPyRestoreThread()) +#define wxPySaveThread(a) (wxPyCoreAPIPtr->p_wxPySaveThread(a)) +#define wxPyConstructObject(a,b,c) (wxPyCoreAPIPtr->p_wxPyConstructObject(a,b,c)) +#define wxPy_ConvertList(a,b) (wxPyCoreAPIPtr->p_wxPy_ConvertList(a,b)) +#define byte_LIST_helper(a) (wxPyCoreAPIPtr->p_byte_LIST_helper(a)) +#define int_LIST_helper(a) (wxPyCoreAPIPtr->p_int_LIST_helper(a)) +#define long_LIST_helper(a) (wxPyCoreAPIPtr->p_long_LIST_helper(a)) +#define string_LIST_helper(a) (wxPyCoreAPIPtr->p_string_LIST_helper(a)) +#define wxPoint_LIST_helper(a) (wxPyCoreAPIPtr->p_wxPoint_LIST_helper(a)) +#define wxBitmap_LIST_helper(a) (wxPyCoreAPIPtr->p_wxBitmap_LIST_helper(a)) +#define wxString_LIST_helper(a) (wxPyCoreAPIPtr->p_wxString_LIST_helper(a)) +#define wxAcceleratorEntry_LIST_helper(a) (wxPyCoreAPIPtr->p_wxAcceleratorEntry_LIST_helper(a)) + +#define wxSize_helper(a,b) (wxPyCoreAPIPtr->p_wxSize_helper(a,b)) +#define wxPoint_helper(a,b) (wxPyCoreAPIPtr->p_wxPoint_helper(a,b)) +#define wxRealPoint_helper(a,b) (wxPyCoreAPIPtr->p_wxRealPoint_helper(a,b)) +#define wxRect_helper(a,b) (wxPyCoreAPIPtr->p_wxRect_helper(a,b)) +#define wxColour_helper(a,b) (wxPyCoreAPIPtr->p_wxColour_helper(a,b)) + +#define wxPyCBH_setSelf(a, b, c, d) (wxPyCoreAPIPtr->p_wxPyCBH_setSelf(a,b,c,d)) +#define wxPyCBH_findCallback(a, b) (wxPyCoreAPIPtr->p_wxPyCBH_findCallback(a, b)) +#define wxPyCBH_callCallback(a, b) (wxPyCoreAPIPtr->p_wxPyCBH_callCallback(a, b)) +#define wxPyCBH_callCallbackObj(a, b) (wxPyCoreAPIPtr->p_wxPyCBH_callCallbackObj(a, b)) +#define wxPyCBH_delete(a) (wxPyCoreAPIPtr->p_wxPyCBH_delete(a)) + + +// This one is special. It's the first function called in SWIG generated +// modules, so we'll use it to also import the API. +#define SWIG_newvarlink() (wxPyCoreAPI_IMPORT(), wxPyCoreAPIPtr->p_SWIG_newvarlink()) + + +//---------------------------------------------------------------------- +#endif diff --git a/wxPython/src/grid.i b/wxPython/src/grid.i index 5e0971123d..31c6c73387 100644 --- a/wxPython/src/grid.i +++ b/wxPython/src/grid.i @@ -15,7 +15,7 @@ #ifndef OLD_GRID %{ -#include "helpers.h" +#include "export.h" #include %} @@ -47,10 +47,10 @@ wxGridCellAttr* CBNAME(int a, int b) { \ wxGridCellAttr* rval = NULL; \ bool doSave = wxPyRestoreThread(); \ - if (m_myInst.findCallback(#CBNAME)) { \ + if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \ PyObject* ro; \ wxGridCellAttr* ptr; \ - ro = m_myInst.callCallbackObj(Py_BuildValue("(ii)", a, b)); \ + ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(ii)", a, b)); \ if (ro) { \ if (!SWIG_GetPtrObj(ro, (void **)&ptr, "_wxGridCellAttr_p")) \ rval = ptr; \ @@ -71,9 +71,9 @@ #define PYCALLBACK__GCAINTINT(PCLASS, CBNAME) \ void CBNAME(wxGridCellAttr *attr, int a, int b) { \ bool doSave = wxPyRestoreThread(); \ - if (m_myInst.findCallback(#CBNAME)) { \ - PyObject* obj = wxPyConstructObject((void*)attr, "wxGridCellAttr");\ - m_myInst.callCallback(Py_BuildValue("(Oii)", obj, a, b)); \ + if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \ + PyObject* obj = wxPyConstructObject((void*)attr, "wxGridCellAttr", 0);\ + wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oii)", obj, a, b)); \ Py_DECREF(obj); \ } \ else \ @@ -89,9 +89,9 @@ #define PYCALLBACK__GCAINT(PCLASS, CBNAME) \ void CBNAME(wxGridCellAttr *attr, int val) { \ bool doSave = wxPyRestoreThread(); \ - if (m_myInst.findCallback(#CBNAME)) { \ - PyObject* obj = wxPyConstructObject((void*)attr, "wxGridCellAttr");\ - m_myInst.callCallback(Py_BuildValue("(Oi)", obj, val)); \ + if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \ + PyObject* obj = wxPyConstructObject((void*)attr, "wxGridCellAttr", 0);\ + wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oi)", obj, val)); \ Py_DECREF(obj); \ } \ else \ @@ -108,8 +108,8 @@ int CBNAME() { \ bool doSave = wxPyRestoreThread(); \ int rval = 0; \ - if (m_myInst.findCallback(#CBNAME)) \ - rval = m_myInst.callCallback(Py_BuildValue("()")); \ + if (wxPyCBH_findCallback(m_myInst, #CBNAME)) \ + rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \ wxPySaveThread(doSave); \ return rval; \ } @@ -120,8 +120,8 @@ bool CBNAME(int a, int b) { \ bool doSave = wxPyRestoreThread(); \ bool rval = 0; \ - if (m_myInst.findCallback(#CBNAME)) \ - rval = m_myInst.callCallback(Py_BuildValue("(ii)",a,b)); \ + if (wxPyCBH_findCallback(m_myInst, #CBNAME)) \ + rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ii)",a,b)); \ wxPySaveThread(doSave); \ return rval; \ } @@ -132,9 +132,9 @@ wxString CBNAME(int a, int b) { \ bool doSave = wxPyRestoreThread(); \ wxString rval; \ - if (m_myInst.findCallback(#CBNAME)) { \ + if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \ PyObject* ro; \ - ro = m_myInst.callCallbackObj(Py_BuildValue("(ii)",a,b)); \ + ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(ii)",a,b)); \ if (ro) { \ PyObject* str = PyObject_Str(ro); \ rval = PyString_AsString(str); \ @@ -150,8 +150,8 @@ #define PYCALLBACK__INTINTSTRING_pure(CBNAME) \ void CBNAME(int a, int b, const wxString& c) { \ bool doSave = wxPyRestoreThread(); \ - if (m_myInst.findCallback(#CBNAME)) \ - m_myInst.callCallback(Py_BuildValue("(iis)",a,b,c.c_str())); \ + if (wxPyCBH_findCallback(m_myInst, #CBNAME)) \ + wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iis)",a,b,c.c_str())); \ wxPySaveThread(doSave); \ } @@ -160,9 +160,9 @@ wxString CBNAME(int a, int b) { \ bool doSave = wxPyRestoreThread(); \ wxString rval; \ - if (m_myInst.findCallback(#CBNAME)) { \ + if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \ PyObject* ro; \ - ro = m_myInst.callCallbackObj(Py_BuildValue("(ii)",a,b)); \ + ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(ii)",a,b)); \ if (ro) { \ PyObject* str = PyObject_Str(ro); \ rval = PyString_AsString(str); \ @@ -183,8 +183,8 @@ bool CBNAME(int a, int b, const wxString& c) { \ bool rval; \ bool doSave = wxPyRestoreThread(); \ - if (m_myInst.findCallback(#CBNAME)) \ - rval = m_myInst.callCallback(Py_BuildValue("(iis)", a,b,c.c_str())); \ + if (wxPyCBH_findCallback(m_myInst, #CBNAME)) \ + rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iis)", a,b,c.c_str())); \ else \ rval = PCLASS::CBNAME(a,b,c); \ wxPySaveThread(doSave); \ @@ -201,8 +201,8 @@ long CBNAME(int a, int b) { \ long rval; \ bool doSave = wxPyRestoreThread(); \ - if (m_myInst.findCallback(#CBNAME)) \ - rval = m_myInst.callCallback(Py_BuildValue("(ii)", a,b)); \ + if (wxPyCBH_findCallback(m_myInst, #CBNAME)) \ + rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ii)", a,b)); \ else \ rval = PCLASS::CBNAME(a,b); \ wxPySaveThread(doSave); \ @@ -218,8 +218,8 @@ bool CBNAME(int a, int b) { \ bool rval; \ bool doSave = wxPyRestoreThread(); \ - if (m_myInst.findCallback(#CBNAME)) \ - rval = m_myInst.callCallback(Py_BuildValue("(ii)", a,b)); \ + if (wxPyCBH_findCallback(m_myInst, #CBNAME)) \ + rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ii)", a,b)); \ else \ rval = PCLASS::CBNAME(a,b); \ wxPySaveThread(doSave); \ @@ -235,9 +235,9 @@ double CBNAME(int a, int b) { \ bool doSave = wxPyRestoreThread(); \ double rval; \ - if (m_myInst.findCallback(#CBNAME)) { \ + if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \ PyObject* ro; \ - ro = m_myInst.callCallbackObj(Py_BuildValue("(ii)",a,b)); \ + ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(ii)",a,b)); \ if (ro) { \ PyObject* str = PyObject_Str(ro); \ rval = PyFloat_AsDouble(str); \ @@ -257,8 +257,8 @@ #define PYCALLBACK__(PCLASS, CBNAME) \ void CBNAME() { \ bool doSave = wxPyRestoreThread(); \ - if (m_myInst.findCallback(#CBNAME)) \ - m_myInst.callCallback(Py_BuildValue("()")); \ + if (wxPyCBH_findCallback(m_myInst, #CBNAME)) \ + wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \ else \ PCLASS::CBNAME(); \ wxPySaveThread(doSave); \ @@ -274,8 +274,8 @@ bool CBNAME(size_t a, size_t b) { \ bool rval; \ bool doSave = wxPyRestoreThread(); \ - if (m_myInst.findCallback(#CBNAME)) \ - rval = m_myInst.callCallback(Py_BuildValue("(ii)", a,b)); \ + if (wxPyCBH_findCallback(m_myInst, #CBNAME)) \ + rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ii)", a,b)); \ else \ rval = PCLASS::CBNAME(a,b); \ wxPySaveThread(doSave); \ @@ -291,8 +291,8 @@ bool CBNAME(size_t a) { \ bool rval; \ bool doSave = wxPyRestoreThread(); \ - if (m_myInst.findCallback(#CBNAME)) \ - rval = m_myInst.callCallback(Py_BuildValue("(i)", a)); \ + if (wxPyCBH_findCallback(m_myInst, #CBNAME)) \ + rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(i)", a)); \ else \ rval = PCLASS::CBNAME(a); \ wxPySaveThread(doSave); \ @@ -308,9 +308,9 @@ wxString CBNAME(int a) { \ bool doSave = wxPyRestoreThread(); \ wxString rval; \ - if (m_myInst.findCallback(#CBNAME)) { \ + if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \ PyObject* ro; \ - ro = m_myInst.callCallbackObj(Py_BuildValue("(i)",a)); \ + ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(i)",a)); \ if (ro) { \ PyObject* str = PyObject_Str(ro); \ rval = PyString_AsString(str); \ @@ -330,8 +330,8 @@ #define PYCALLBACK__INTSTRING(PCLASS, CBNAME) \ void CBNAME(int a, const wxString& c) { \ bool doSave = wxPyRestoreThread(); \ - if (m_myInst.findCallback(#CBNAME)) \ - m_myInst.callCallback(Py_BuildValue("(is)", a,c.c_str())); \ + if (wxPyCBH_findCallback(m_myInst, #CBNAME)) \ + wxPyCBH_callCallback(m_myInst, Py_BuildValue("(is)", a,c.c_str())); \ else \ PCLASS::CBNAME(a,c); \ wxPySaveThread(doSave); \ @@ -347,8 +347,8 @@ bool CBNAME() { \ bool rval; \ bool doSave = wxPyRestoreThread(); \ - if (m_myInst.findCallback(#CBNAME)) \ - rval = m_myInst.callCallback(Py_BuildValue("()")); \ + if (wxPyCBH_findCallback(m_myInst, #CBNAME)) \ + rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \ else \ rval = PCLASS::CBNAME(); \ wxPySaveThread(doSave); \ @@ -363,8 +363,8 @@ #define PYCALLBACK__SIZETINT(PCLASS, CBNAME) \ void CBNAME(size_t a, int b) { \ bool doSave = wxPyRestoreThread(); \ - if (m_myInst.findCallback(#CBNAME)) \ - m_myInst.callCallback(Py_BuildValue("(ii)", a,b)); \ + if (wxPyCBH_findCallback(m_myInst, #CBNAME)) \ + wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ii)", a,b)); \ else \ PCLASS::CBNAME(a,b); \ wxPySaveThread(doSave); \ @@ -379,8 +379,8 @@ #define PYCALLBACK__INTINTLONG(PCLASS, CBNAME) \ void CBNAME(int a, int b, long c) { \ bool doSave = wxPyRestoreThread(); \ - if (m_myInst.findCallback(#CBNAME)) \ - m_myInst.callCallback(Py_BuildValue("(iii)", a,b,c)); \ + if (wxPyCBH_findCallback(m_myInst, #CBNAME)) \ + wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iii)", a,b,c)); \ else \ PCLASS::CBNAME(a,b,c); \ wxPySaveThread(doSave); \ @@ -395,8 +395,8 @@ #define PYCALLBACK__INTINTDOUBLE(PCLASS, CBNAME) \ void CBNAME(int a, int b, double c) { \ bool doSave = wxPyRestoreThread(); \ - if (m_myInst.findCallback(#CBNAME)) \ - m_myInst.callCallback(Py_BuildValue("(iif)", a,b,c)); \ + if (wxPyCBH_findCallback(m_myInst, #CBNAME)) \ + wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iif)", a,b,c)); \ else \ PCLASS::CBNAME(a,b,c); \ wxPySaveThread(doSave); \ @@ -410,8 +410,8 @@ #define PYCALLBACK__INTINTBOOL(PCLASS, CBNAME) \ void CBNAME(int a, int b, bool c) { \ bool doSave = wxPyRestoreThread(); \ - if (m_myInst.findCallback(#CBNAME)) \ - m_myInst.callCallback(Py_BuildValue("(iii)", a,b,c)); \ + if (wxPyCBH_findCallback(m_myInst, #CBNAME)) \ + wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iii)", a,b,c)); \ else \ PCLASS::CBNAME(a,b,c); \ wxPySaveThread(doSave); \ @@ -484,13 +484,13 @@ public: wxDC& dc, const wxRect& rect, int row, int col, bool isSelected) { bool doSave = wxPyRestoreThread(); - if (m_myInst.findCallback("Draw")) { - m_myInst.callCallback( + if (wxPyCBH_findCallback(m_myInst, "Draw")) { + wxPyCBH_callCallback(m_myInst, Py_BuildValue("(OOOOiii)", - wxPyConstructObject((void*)&grid, "wxGrid"), - wxPyConstructObject((void*)&attr, "wxGridCellAttr"), - wxPyConstructObject((void*)&dc, "wxDC"), - wxPyConstructObject((void*)&rect, "wxRect"), + wxPyConstructObject((void*)&grid, "wxGrid", 0), + wxPyConstructObject((void*)&attr, "wxGridCellAttr", 0), + wxPyConstructObject((void*)&dc, "wxDC", 0), + wxPyConstructObject((void*)&rect, "wxRect", 0), row, col, isSelected)); } wxPySaveThread(doSave); @@ -500,14 +500,14 @@ public: int row, int col) { wxSize rval; bool doSave = wxPyRestoreThread(); - if (m_myInst.findCallback("GetBestSize")) { + if (wxPyCBH_findCallback(m_myInst, "GetBestSize")) { PyObject* ro; wxSize* ptr; - ro = m_myInst.callCallbackObj( + ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(OOOii)", - wxPyConstructObject((void*)&grid, "wxGrid"), - wxPyConstructObject((void*)&attr, "wxGridCellAttr"), - wxPyConstructObject((void*)&dc, "wxDC"), + wxPyConstructObject((void*)&grid, "wxGrid", 0), + wxPyConstructObject((void*)&attr, "wxGridCellAttr", 0), + wxPyConstructObject((void*)&dc, "wxDC", 0), row, col)); if (ro) { if (!SWIG_GetPtrObj(ro, (void **)&ptr, "_wxSize_p")) @@ -523,10 +523,10 @@ public: wxGridCellRenderer *Clone() const { wxGridCellRenderer* rval = NULL; bool doSave = wxPyRestoreThread(); - if (m_myInst.findCallback("Clone")) { + if (wxPyCBH_findCallback(m_myInst, "Clone")) { PyObject* ro; wxGridCellRenderer* ptr; - ro = m_myInst.callCallbackObj(Py_BuildValue("()")); + ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); if (ro) { if (!SWIG_GetPtrObj(ro, (void **)&ptr, "_wxGridCellRenderer_p")) rval = ptr; @@ -638,12 +638,12 @@ public: void Create(wxWindow* parent, wxWindowID id, wxEvtHandler* evtHandler) { bool doSave = wxPyRestoreThread(); - if (m_myInst.findCallback("Create")) { - m_myInst.callCallback( + if (wxPyCBH_findCallback(m_myInst, "Create")) { + wxPyCBH_callCallback(m_myInst, Py_BuildValue("(OiO)", - wxPyConstructObject((void*)parent, "wxWindow"), + wxPyConstructObject((void*)parent, "wxWindow", 0), id, - wxPyConstructObject((void*)evtHandler, "wxEvtHandler"))); + wxPyConstructObject((void*)evtHandler, "wxEvtHandler", 0))); } wxPySaveThread(doSave); } @@ -651,10 +651,10 @@ public: void BeginEdit(int row, int col, wxGrid* grid) { bool doSave = wxPyRestoreThread(); - if (m_myInst.findCallback("BeginEdit")) { - m_myInst.callCallback( + if (wxPyCBH_findCallback(m_myInst, "BeginEdit")) { + wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iiO)", row, col, - wxPyConstructObject((void*)grid, "wxGrid"))); + wxPyConstructObject((void*)grid, "wxGrid", 0))); } wxPySaveThread(doSave); } @@ -663,10 +663,10 @@ public: bool EndEdit(int row, int col, wxGrid* grid) { bool rv = FALSE; bool doSave = wxPyRestoreThread(); - if (m_myInst.findCallback("EndEdit")) { - rv = m_myInst.callCallback( + if (wxPyCBH_findCallback(m_myInst, "EndEdit")) { + rv = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iiO)", row, col, - wxPyConstructObject((void*)grid, "wxGrid"))); + wxPyConstructObject((void*)grid, "wxGrid", 0))); } wxPySaveThread(doSave); return rv; @@ -676,10 +676,10 @@ public: wxGridCellEditor*Clone() const { wxGridCellEditor* rval = NULL; bool doSave = wxPyRestoreThread(); - if (m_myInst.findCallback("Clone")) { + if (wxPyCBH_findCallback(m_myInst, "Clone")) { PyObject* ro; wxGridCellEditor* ptr; - ro = m_myInst.callCallbackObj(Py_BuildValue("()")); + ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); if (ro) { if (!SWIG_GetPtrObj(ro, (void **)&ptr, "_wxGridCellEditor_p")) rval = ptr; @@ -693,10 +693,10 @@ public: void Show(bool show, wxGridCellAttr *attr) { bool doSave = wxPyRestoreThread(); - if (m_myInst.findCallback("Show")) - m_myInst.callCallback( + if (wxPyCBH_findCallback(m_myInst, "Show")) + wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iO)", show, - wxPyConstructObject((void*)attr, "wxGridCellAttr"))); + wxPyConstructObject((void*)attr, "wxGridCellAttr", 0))); else wxGridCellEditor::Show(show, attr); wxPySaveThread(doSave); @@ -708,11 +708,11 @@ public: void PaintBackground(const wxRect& rectCell, wxGridCellAttr *attr) { bool doSave = wxPyRestoreThread(); - if (m_myInst.findCallback("PaintBackground")) - m_myInst.callCallback( + if (wxPyCBH_findCallback(m_myInst, "PaintBackground")) + wxPyCBH_callCallback(m_myInst, Py_BuildValue("(OO)", - wxPyConstructObject((void*)&rectCell, "wxRect"), - wxPyConstructObject((void*)attr, "wxGridCellAttr"))); + wxPyConstructObject((void*)&rectCell, "wxRect", 0), + wxPyConstructObject((void*)attr, "wxGridCellAttr", 0))); else wxGridCellEditor::PaintBackground(rectCell, attr); wxPySaveThread(doSave); @@ -989,9 +989,9 @@ public: wxString GetValue(int row, int col) { bool doSave = wxPyRestoreThread(); wxString rval; - if (m_myInst.findCallback("GetValue")) { + if (wxPyCBH_findCallback(m_myInst, "GetValue")) { PyObject* ro; - ro = m_myInst.callCallbackObj(Py_BuildValue("(ii)",row,col)); + ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(ii)",row,col)); if (ro) { PyObject* str = PyObject_Str(ro); rval = PyString_AsString(str); @@ -1005,8 +1005,8 @@ public: void SetValue(int row, int col, const wxString& val) { bool doSave = wxPyRestoreThread(); - if (m_myInst.findCallback("SetValue")) - m_myInst.callCallback(Py_BuildValue("(iis)",row,col,val.c_str())); + if (wxPyCBH_findCallback(m_myInst, "SetValue")) + wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iis)",row,col,val.c_str())); wxPySaveThread(doSave); } @@ -1016,10 +1016,10 @@ public: long GetValueAsLong( int row, int col ) { long rval = 0; bool doSave = wxPyRestoreThread(); - if (m_myInst.findCallback("GetValue")) { + if (wxPyCBH_findCallback(m_myInst, "GetValue")) { PyObject* ro; PyObject* num; - ro = m_myInst.callCallbackObj(Py_BuildValue("(ii)", row, col)); + ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(ii)", row, col)); if (ro && PyNumber_Check(ro)) { num = PyNumber_Int(ro); if (num) { @@ -1036,10 +1036,10 @@ public: double GetValueAsDouble( int row, int col ) { double rval = 0.0; bool doSave = wxPyRestoreThread(); - if (m_myInst.findCallback("GetValue")) { + if (wxPyCBH_findCallback(m_myInst, "GetValue")) { PyObject* ro; PyObject* num; - ro = m_myInst.callCallbackObj(Py_BuildValue("(ii)", row, col)); + ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(ii)", row, col)); if (ro && PyNumber_Check(ro)) { num = PyNumber_Float(ro); if (num) { @@ -1059,16 +1059,16 @@ public: void SetValueAsLong( int row, int col, long value ) { bool doSave = wxPyRestoreThread(); - if (m_myInst.findCallback("SetValue")) { - m_myInst.callCallback(Py_BuildValue("(iii)", row, col, value)); + if (wxPyCBH_findCallback(m_myInst, "SetValue")) { + wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iii)", row, col, value)); } wxPySaveThread(doSave); } void SetValueAsDouble( int row, int col, double value ) { bool doSave = wxPyRestoreThread(); - if (m_myInst.findCallback("SetValue")) { - m_myInst.callCallback(Py_BuildValue("(iid)", row, col, value)); + if (wxPyCBH_findCallback(m_myInst, "SetValue")) { + wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iid)", row, col, value)); } wxPySaveThread(doSave); } diff --git a/wxPython/src/helpers.cpp b/wxPython/src/helpers.cpp index 4495879274..d979802917 100644 --- a/wxPython/src/helpers.cpp +++ b/wxPython/src/helpers.cpp @@ -257,8 +257,8 @@ PyObject* __wxSetDictionary(PyObject* /* self */, PyObject* args) //--------------------------------------------------------------------------- PyObject* wxPyConstructObject(void* ptr, - const char* className, - int setThisOwn) { + const char* className, + int setThisOwn) { PyObject* obj; PyObject* arg; @@ -301,8 +301,6 @@ PyObject* wxPyConstructObject(void* ptr, //--------------------------------------------------------------------------- -static unsigned int _wxPyNestCount = 0; - static PyThreadState* myPyThreadState_Get() { PyThreadState* current; current = PyThreadState_Swap(NULL); @@ -320,7 +318,6 @@ HELPEREXPORT bool wxPyRestoreThread() { // already have the lock. (I hope!) // #ifdef WXP_WITH_THREAD - _wxPyNestCount += 1; if (wxPyEventThreadState != myPyThreadState_Get()) { PyEval_RestoreThread(wxPyEventThreadState); return TRUE; @@ -336,7 +333,6 @@ HELPEREXPORT void wxPySaveThread(bool doSave) { if (doSave) { wxPyEventThreadState = PyEval_SaveThread(); } - _wxPyNestCount -= 1; #endif } @@ -398,23 +394,6 @@ void wxPyCallback::EventThunker(wxEvent& event) { //---------------------------------------------------------------------- -wxPyCallbackHelper::wxPyCallbackHelper() { - m_class = NULL; - m_self = NULL; - m_lastFound = NULL; - m_incRef = FALSE; -} - - -wxPyCallbackHelper::~wxPyCallbackHelper() { - bool doSave = wxPyRestoreThread(); - if (m_incRef) { - Py_XDECREF(m_self); - Py_XDECREF(m_class); - } - wxPySaveThread(doSave); -} - wxPyCallbackHelper::wxPyCallbackHelper(const wxPyCallbackHelper& other) { m_lastFound = NULL; m_self = other.m_self; @@ -495,6 +474,31 @@ PyObject* wxPyCallbackHelper::callCallbackObj(PyObject* argTuple) const { } +void wxPyCBH_setSelf(wxPyCallbackHelper& cbh, PyObject* self, PyObject* klass, int incref) { + cbh.setSelf(self, klass, incref); +} + +bool wxPyCBH_findCallback(const wxPyCallbackHelper& cbh, const char* name) { + return cbh.findCallback(name); +} + +int wxPyCBH_callCallback(const wxPyCallbackHelper& cbh, PyObject* argTuple) { + return cbh.callCallback(argTuple); +} + +PyObject* wxPyCBH_callCallbackObj(const wxPyCallbackHelper& cbh, PyObject* argTuple) { + return cbh.callCallbackObj(argTuple); +} + + +void wxPyCBH_delete(wxPyCallbackHelper* cbh) { + bool doSave = wxPyRestoreThread(); + if (cbh->m_incRef) { + Py_XDECREF(cbh->m_self); + Py_XDECREF(cbh->m_class); + } + wxPySaveThread(doSave); +} //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- diff --git a/wxPython/src/helpers.h b/wxPython/src/helpers.h index 63f9c255a2..f53092e220 100644 --- a/wxPython/src/helpers.h +++ b/wxPython/src/helpers.h @@ -33,15 +33,8 @@ //--------------------------------------------------------------------------- -#if defined(__WXMSW__) -# define HELPEREXPORT __declspec(dllexport) -#else -# define HELPEREXPORT -#endif - typedef unsigned char byte; -//---------------------------------------------------------------------- class wxPyApp: public wxApp { @@ -50,9 +43,7 @@ public: ~wxPyApp(); int MainLoop(void); bool OnInit(void); -//# void AfterMainLoop(void); }; - extern wxPyApp *wxPythonApp; //---------------------------------------------------------------------- @@ -66,26 +57,15 @@ PyObject* __wxSetDictionary(PyObject*, PyObject* args); void wxPyEventThunker(wxObject*, wxEvent& event); -HELPEREXPORT PyObject* wxPyConstructObject(void* ptr, - const char* className, - int setThisOwn=0); -HELPEREXPORT bool wxPyRestoreThread(); -HELPEREXPORT void wxPySaveThread(bool doSave); -HELPEREXPORT PyObject* wxPy_ConvertList(wxListBase* list, const char* className); -HELPEREXPORT long wxPyGetWinHandle(wxWindow* win); +PyObject* wxPyConstructObject(void* ptr, + const char* className, + int setThisOwn=0); +bool wxPyRestoreThread(); +void wxPySaveThread(bool doSave); +PyObject* wxPy_ConvertList(wxListBase* list, const char* className); +long wxPyGetWinHandle(wxWindow* win); -//---------------------------------------------------------------------- -class wxPyUserData : public wxObject { -public: - wxPyUserData(PyObject* obj) { m_obj = obj; Py_INCREF(m_obj); } - ~wxPyUserData() { - bool doSave = wxPyRestoreThread(); - Py_DECREF(m_obj); - wxPySaveThread(doSave); - } - PyObject* m_obj; -}; //---------------------------------------------------------------------- // Handle wxInputStreams by Joerg Baumann @@ -97,7 +77,7 @@ WX_DECLARE_LIST(wxString, wxStringPtrList); // C++ class wxPyInputStream to act as base for python class wxInputStream // Use it in python like a python file object -class wxPyInputStream{ +class wxPyInputStream { public: // underlying wxInputStream wxInputStream* wxi; @@ -128,20 +108,20 @@ public: //---------------------------------------------------------------------- // These are helpers used by the typemaps -HELPEREXPORT byte* byte_LIST_helper(PyObject* source); -HELPEREXPORT int* int_LIST_helper(PyObject* source); -HELPEREXPORT long* long_LIST_helper(PyObject* source); -HELPEREXPORT char** string_LIST_helper(PyObject* source); -HELPEREXPORT wxPoint* wxPoint_LIST_helper(PyObject* source); -HELPEREXPORT wxBitmap** wxBitmap_LIST_helper(PyObject* source); -HELPEREXPORT wxString* wxString_LIST_helper(PyObject* source); -HELPEREXPORT wxAcceleratorEntry* wxAcceleratorEntry_LIST_helper(PyObject* source); +byte* byte_LIST_helper(PyObject* source); +int* int_LIST_helper(PyObject* source); +long* long_LIST_helper(PyObject* source); +char** string_LIST_helper(PyObject* source); +wxPoint* wxPoint_LIST_helper(PyObject* source); +wxBitmap** wxBitmap_LIST_helper(PyObject* source); +wxString* wxString_LIST_helper(PyObject* source); +wxAcceleratorEntry* wxAcceleratorEntry_LIST_helper(PyObject* source); -HELPEREXPORT bool wxSize_helper(PyObject* source, wxSize** obj); -HELPEREXPORT bool wxPoint_helper(PyObject* source, wxPoint** obj); -HELPEREXPORT bool wxRealPoint_helper(PyObject* source, wxRealPoint** obj); -HELPEREXPORT bool wxRect_helper(PyObject* source, wxRect** obj); -HELPEREXPORT bool wxColour_helper(PyObject* source, wxColour** obj); +bool wxSize_helper(PyObject* source, wxSize** obj); +bool wxPoint_helper(PyObject* source, wxPoint** obj); +bool wxRealPoint_helper(PyObject* source, wxRealPoint** obj); +bool wxRect_helper(PyObject* source, wxRect** obj); +bool wxColour_helper(PyObject* source, wxColour** obj); //---------------------------------------------------------------------- @@ -192,42 +172,6 @@ private: }; //--------------------------------------------------------------------------- - - - - -//--------------------------------------------------------------------------- -// This class holds an instance of a Python Shadow Class object and assists -// with looking up and invoking Python callback methods from C++ virtual -// method redirections. For all classes which have virtuals which should be -// overridable in wxPython, a new subclass is created that contains a -// wxPyCallbackHelper. -// -// TODO: This class should be combined with wxPyCallback defined above. -// - -class HELPEREXPORT wxPyCallbackHelper { -public: - wxPyCallbackHelper(); - ~wxPyCallbackHelper(); - - wxPyCallbackHelper(const wxPyCallbackHelper& other); - - void setSelf(PyObject* self, PyObject* klass, int incref=TRUE); - - bool findCallback(const char* name) const; - int callCallback(PyObject* argTuple) const; - PyObject* callCallbackObj(PyObject* argTuple) const; - -private: - PyObject* m_self; - PyObject* m_class; - PyObject* m_lastFound; - int m_incRef; -}; - - -//--------------------------------------------------------------------------- //--------------------------------------------------------------------------- // These Event classes can be derived from in Python and passed through the // event system without loosing anything. They do this by keeping a reference @@ -268,6 +212,134 @@ public: }; +//--------------------------------------------------------------------------- +// Export a C API in a struct. Other modules will be able to load this from +// the wxc module and will then have safe access to these functions, even if +// in another shared library. + +class wxPyCallbackHelper; + +struct wxPyCoreAPI { + + void (*p_SWIG_MakePtr)(char*, void*, char*); + char* (*p_SWIG_GetPtr)(char*, void**, char*); + char* (*p_SWIG_GetPtrObj)(PyObject*, void**, char*); + void (*p_SWIG_RegisterMapping)(char*, char*, void *(*cast)(void *)); + void (*p_SWIG_addvarlink)(PyObject*, char*, PyObject *(*get_attr)(void), int (*set_attr)(PyObject *p)); + PyObject* (*p_SWIG_newvarlink)(void); + + void (*p_wxPySaveThread)(bool); + bool (*p_wxPyRestoreThread)(); + PyObject* (*p_wxPyConstructObject)(void *, const char *, int); + PyObject* (*p_wxPy_ConvertList)(wxListBase* list, const char* className); + + byte* (*p_byte_LIST_helper)(PyObject* source); + int* (*p_int_LIST_helper)(PyObject* source); + long* (*p_long_LIST_helper)(PyObject* source); + char** (*p_string_LIST_helper)(PyObject* source); + wxPoint* (*p_wxPoint_LIST_helper)(PyObject* source); + wxBitmap** (*p_wxBitmap_LIST_helper)(PyObject* source); + wxString* (*p_wxString_LIST_helper)(PyObject* source); + wxAcceleratorEntry* (*p_wxAcceleratorEntry_LIST_helper)(PyObject* source); + + bool (*p_wxSize_helper)(PyObject* source, wxSize** obj); + bool (*p_wxPoint_helper)(PyObject* source, wxPoint** obj); + bool (*p_wxRealPoint_helper)(PyObject* source, wxRealPoint** obj); + bool (*p_wxRect_helper)(PyObject* source, wxRect** obj); + bool (*p_wxColour_helper)(PyObject* source, wxColour** obj); + + void (*p_wxPyCBH_setSelf)(wxPyCallbackHelper& cbh, PyObject* self, PyObject* klass, int incref); + bool (*p_wxPyCBH_findCallback)(const wxPyCallbackHelper& cbh, const char* name); + int (*p_wxPyCBH_callCallback)(const wxPyCallbackHelper& cbh, PyObject* argTuple); + PyObject* (*p_wxPyCBH_callCallbackObj)(const wxPyCallbackHelper& cbh, PyObject* argTuple); + void (*p_wxPyCBH_delete)(wxPyCallbackHelper* cbh); + +}; + +#ifdef wxPyUSE_EXPORT +static wxPyCoreAPI* wxPyCoreAPIPtr = NULL; // Each module needs one, but may not use it. +#endif + +//--------------------------------------------------------------------------- +// This class holds an instance of a Python Shadow Class object and assists +// with looking up and invoking Python callback methods from C++ virtual +// method redirections. For all classes which have virtuals which should be +// overridable in wxPython, a new subclass is created that contains a +// wxPyCallbackHelper. +// + +class wxPyCallbackHelper { +public: + wxPyCallbackHelper(const wxPyCallbackHelper& other); + + wxPyCallbackHelper() { + m_class = NULL; + m_self = NULL; + m_lastFound = NULL; + m_incRef = FALSE; + } + + ~wxPyCallbackHelper() { +#ifdef wxPyUSE_EXPORT + wxPyCoreAPIPtr->p_wxPyCBH_delete(this); +#else + wxPyCBH_delete(this); +#endif + } + + void setSelf(PyObject* self, PyObject* klass, int incref=TRUE); + bool findCallback(const char* name) const; + int callCallback(PyObject* argTuple) const; + PyObject* callCallbackObj(PyObject* argTuple) const; + +private: + PyObject* m_self; + PyObject* m_class; + PyObject* m_lastFound; + int m_incRef; + + friend void wxPyCBH_delete(wxPyCallbackHelper* cbh); +}; + + +void wxPyCBH_setSelf(wxPyCallbackHelper& cbh, PyObject* self, PyObject* klass, int incref); +bool wxPyCBH_findCallback(const wxPyCallbackHelper& cbh, const char* name); +int wxPyCBH_callCallback(const wxPyCallbackHelper& cbh, PyObject* argTuple); +PyObject* wxPyCBH_callCallbackObj(const wxPyCallbackHelper& cbh, PyObject* argTuple); +void wxPyCBH_delete(wxPyCallbackHelper* cbh); + + + +//---------------------------------------------------------------------- + +class wxPyUserData : public wxObject { +public: + wxPyUserData(PyObject* obj) { + m_obj = obj; + Py_INCREF(m_obj); + } + + ~wxPyUserData() { + bool doSave; +#ifdef wxPyUSE_EXPORT + doSave = wxPyCoreAPIPtr->p_wxPyRestoreThread(); +#else + doSave = wxPyRestoreThread(); +#endif + + Py_DECREF(m_obj); + +#ifdef wxPyUSE_EXPORT + wxPyCoreAPIPtr->p_wxPySaveThread(doSave); +#else + wxPySaveThread(doSave); +#endif + } + PyObject* m_obj; +}; + + + //--------------------------------------------------------------------------- // These macros are used to implement the virtual methods that should // redirect to a Python method if one exists. The names designate the @@ -276,7 +348,7 @@ public: #define PYPRIVATE \ void _setSelf(PyObject* self, PyObject* _class, int incref=1) { \ - m_myInst.setSelf(self, _class, incref); \ + wxPyCBH_setSelf(m_myInst, self, _class, incref); \ } \ private: wxPyCallbackHelper m_myInst @@ -290,8 +362,8 @@ public: #define IMP_PYCALLBACK__(CLASS, PCLASS, CBNAME) \ void CLASS::CBNAME() { \ bool doSave = wxPyRestoreThread(); \ - if (m_myInst.findCallback(#CBNAME)) \ - m_myInst.callCallback(Py_BuildValue("()")); \ + if (wxPyCBH_findCallback(m_myInst, #CBNAME)) \ + wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \ else \ PCLASS::CBNAME(); \ wxPySaveThread(doSave); \ @@ -311,8 +383,8 @@ public: bool CLASS::CBNAME(int a, int b) { \ bool rval; \ bool doSave = wxPyRestoreThread(); \ - if (m_myInst.findCallback(#CBNAME)) \ - rval = m_myInst.callCallback(Py_BuildValue("(ii)",a,b)); \ + if (wxPyCBH_findCallback(m_myInst, #CBNAME)) \ + rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ii)",a,b)); \ else \ rval = PCLASS::CBNAME(a,b); \ wxPySaveThread(doSave); \ @@ -332,8 +404,8 @@ public: #define IMP_PYCALLBACK_VOID_INTINT(CLASS, PCLASS, CBNAME) \ void CLASS::CBNAME(int a, int b) { \ bool doSave = wxPyRestoreThread(); \ - if (m_myInst.findCallback(#CBNAME)) \ - m_myInst.callCallback(Py_BuildValue("(ii)",a,b)); \ + if (wxPyCBH_findCallback(m_myInst, #CBNAME)) \ + wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ii)",a,b)); \ else \ PCLASS::CBNAME(a,b); \ wxPySaveThread(doSave); \ @@ -353,8 +425,8 @@ public: bool CLASS::CBNAME(int a) { \ bool rval; \ bool doSave = wxPyRestoreThread(); \ - if (m_myInst.findCallback(#CBNAME)) \ - rval = m_myInst.callCallback(Py_BuildValue("(i)",a)); \ + if (wxPyCBH_findCallback(m_myInst, #CBNAME)) \ + rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(i)",a)); \ else \ rval = PCLASS::CBNAME(a); \ wxPySaveThread(doSave); \ @@ -374,8 +446,8 @@ public: bool CLASS::CBNAME(int a) { \ bool rval; \ bool doSave = wxPyRestoreThread(); \ - if (m_myInst.findCallback(#CBNAME)) \ - rval = m_myInst.callCallback(Py_BuildValue("(i)",a)); \ + if (wxPyCBH_findCallback(m_myInst, #CBNAME)) \ + rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(i)",a)); \ else rval = FALSE; \ wxPySaveThread(doSave); \ return rval; \ @@ -392,9 +464,9 @@ public: #define IMP_PYCALLBACK__DC(CLASS, PCLASS, CBNAME) \ void CLASS::CBNAME(wxDC& a) { \ bool doSave = wxPyRestoreThread(); \ - if (m_myInst.findCallback(#CBNAME)) { \ - PyObject* obj = wxPyConstructObject(&a, "wxDC"); \ - m_myInst.callCallback(Py_BuildValue("(O)", obj)); \ + if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \ + PyObject* obj = wxPyConstructObject(&a, "wxDC", 0); \ + wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \ Py_DECREF(obj); \ } \ else \ @@ -417,9 +489,9 @@ public: #define IMP_PYCALLBACK__DCBOOL(CLASS, PCLASS, CBNAME) \ void CLASS::CBNAME(wxDC& a, bool b) { \ bool doSave = wxPyRestoreThread(); \ - if (m_myInst.findCallback(#CBNAME)) { \ - PyObject* obj = wxPyConstructObject(&a, "wxDC"); \ - m_myInst.callCallback(Py_BuildValue("(Oi)", obj, (int)b)); \ + if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \ + PyObject* obj = wxPyConstructObject(&a, "wxDC", 0); \ + wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oi)", obj, (int)b)); \ Py_DECREF(obj); \ } \ else \ @@ -440,9 +512,9 @@ public: #define IMP_PYCALLBACK__DCBOOL(CLASS, PCLASS, CBNAME) \ void CLASS::CBNAME(wxDC& a, bool b) { \ bool doSave = wxPyRestoreThread(); \ - if (m_myInst.findCallback(#CBNAME)) { \ - PyObject* obj = wxPyConstructObject(&a, "wxDC"); \ - m_myInst.callCallback(Py_BuildValue("(Oi)", obj, (int)b)); \ + if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \ + PyObject* obj = wxPyConstructObject(&a, "wxDC", 0); \ + wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oi)", obj, (int)b)); \ Py_DECREF(obj); \ } \ else \ @@ -463,8 +535,8 @@ public: #define IMP_PYCALLBACK__2DBL(CLASS, PCLASS, CBNAME) \ void CLASS::CBNAME(double a, double b) { \ bool doSave = wxPyRestoreThread(); \ - if (m_myInst.findCallback(#CBNAME)) \ - m_myInst.callCallback(Py_BuildValue("(dd)",a,b)); \ + if (wxPyCBH_findCallback(m_myInst, #CBNAME)) \ + wxPyCBH_callCallback(m_myInst, Py_BuildValue("(dd)",a,b)); \ else \ PCLASS::CBNAME(a, b); \ wxPySaveThread(doSave); \ @@ -483,8 +555,8 @@ public: #define IMP_PYCALLBACK__2DBL2INT(CLASS, PCLASS, CBNAME) \ void CLASS::CBNAME(double a, double b, int c, int d) { \ bool doSave = wxPyRestoreThread(); \ - if (m_myInst.findCallback(#CBNAME)) \ - m_myInst.callCallback(Py_BuildValue("(ddii)", \ + if (wxPyCBH_findCallback(m_myInst, #CBNAME)) \ + wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ddii)", \ a,b,c,d)); \ else \ PCLASS::CBNAME(a, b, c, d); \ @@ -504,9 +576,9 @@ public: #define IMP_PYCALLBACK__DC4DBLBOOL(CLASS, PCLASS, CBNAME) \ void CLASS::CBNAME(wxDC& a, double b, double c, double d, double e, bool f) { \ bool doSave = wxPyRestoreThread(); \ - if (m_myInst.findCallback(#CBNAME)) { \ - PyObject* obj = wxPyConstructObject(&a, "wxDC"); \ - m_myInst.callCallback(Py_BuildValue("(Oddddi)", obj, b, c, d, e, (int)f)); \ + if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \ + PyObject* obj = wxPyConstructObject(&a, "wxDC", 0); \ + wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oddddi)", obj, b, c, d, e, (int)f)); \ Py_DECREF(obj); \ } \ else \ @@ -528,9 +600,9 @@ public: bool CLASS::CBNAME(wxDC& a, double b, double c, double d, double e, bool f) { \ bool doSave = wxPyRestoreThread(); \ bool rval; \ - if (m_myInst.findCallback(#CBNAME)) { \ - PyObject* obj = wxPyConstructObject(&a, "wxDC"); \ - rval = m_myInst.callCallback(Py_BuildValue("(Oddddi)", obj, b, c, d, e, (int)f));\ + if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \ + PyObject* obj = wxPyConstructObject(&a, "wxDC", 0); \ + rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oddddi)", obj, b, c, d, e, (int)f));\ Py_DECREF(obj); \ } \ else \ @@ -552,8 +624,8 @@ public: #define IMP_PYCALLBACK__BOOL2DBL2INT(CLASS, PCLASS, CBNAME) \ void CLASS::CBNAME(bool a, double b, double c, int d, int e) { \ bool doSave = wxPyRestoreThread(); \ - if (m_myInst.findCallback(#CBNAME)) \ - m_myInst.callCallback(Py_BuildValue("(idii)", \ + if (wxPyCBH_findCallback(m_myInst, #CBNAME)) \ + wxPyCBH_callCallback(m_myInst, Py_BuildValue("(idii)", \ (int)a,b,c,d,e)); \ else \ PCLASS::CBNAME(a, b, c, d, e); \ @@ -573,9 +645,9 @@ public: #define IMP_PYCALLBACK__DC4DBL(CLASS, PCLASS, CBNAME) \ void CLASS::CBNAME(wxDC& a, double b, double c, double d, double e) { \ bool doSave = wxPyRestoreThread(); \ - if (m_myInst.findCallback(#CBNAME)) { \ - PyObject* obj = wxPyConstructObject(&a, "wxDC"); \ - m_myInst.callCallback(Py_BuildValue("(Odddd)", obj, b, c, d, e)); \ + if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \ + PyObject* obj = wxPyConstructObject(&a, "wxDC", 0); \ + wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Odddd)", obj, b, c, d, e)); \ Py_DECREF(obj); \ } \ else \ @@ -596,9 +668,9 @@ public: #define IMP_PYCALLBACK__DCBOOL(CLASS, PCLASS, CBNAME) \ void CLASS::CBNAME(wxDC& a, bool b) { \ bool doSave = wxPyRestoreThread(); \ - if (m_myInst.findCallback(#CBNAME)) { \ - PyObject* obj = wxPyConstructObject(&a, "wxDC"); \ - m_myInst.callCallback(Py_BuildValue("(Oi)", obj, (int)b)); \ + if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \ + PyObject* obj = wxPyConstructObject(&a, "wxDC", 0); \ + wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oi)", obj, (int)b)); \ Py_DECREF(obj); \ } \ else \ @@ -620,9 +692,9 @@ public: void CLASS::CBNAME(wxControlPoint* a, bool b, double c, double d, \ int e, int f) { \ bool doSave = wxPyRestoreThread(); \ - if (m_myInst.findCallback(#CBNAME)) { \ - PyObject* obj = wxPyConstructObject(a, "wxPyControlPoint"); \ - m_myInst.callCallback(Py_BuildValue("(Oiddii)", obj, (int)b, c, d, e, f));\ + if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \ + PyObject* obj = wxPyConstructObject(a, "wxPyControlPoint", 0); \ + wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oiddii)", obj, (int)b, c, d, e, f));\ Py_DECREF(obj); \ } \ else \ @@ -644,9 +716,9 @@ public: #define IMP_PYCALLBACK__WXCP2DBL2INT(CLASS, PCLASS, CBNAME) \ void CLASS::CBNAME(wxControlPoint* a, double b, double c, int d, int e) { \ bool doSave = wxPyRestoreThread(); \ - if (m_myInst.findCallback(#CBNAME)) { \ - PyObject* obj = wxPyConstructObject(a, "wxPyControlPoint"); \ - m_myInst.callCallback(Py_BuildValue("(Oddii)", obj, b, c, d, e)); \ + if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \ + PyObject* obj = wxPyConstructObject(a, "wxPyControlPoint", 0); \ + wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oddii)", obj, b, c, d, e)); \ Py_DECREF(obj); \ } \ else \ @@ -668,8 +740,8 @@ public: #define IMP_PYCALLBACK__2DBLINT(CLASS, PCLASS, CBNAME) \ void CLASS::CBNAME(double a, double b, int c) { \ bool doSave = wxPyRestoreThread(); \ - if (m_myInst.findCallback(#CBNAME)) \ - m_myInst.callCallback(Py_BuildValue("(ddi)", a,b,c)); \ + if (wxPyCBH_findCallback(m_myInst, #CBNAME)) \ + wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ddi)", a,b,c)); \ else \ PCLASS::CBNAME(a, b, c); \ wxPySaveThread(doSave); \ @@ -688,8 +760,8 @@ public: #define IMP_PYCALLBACK__BOOL2DBLINT(CLASS, PCLASS, CBNAME) \ void CLASS::CBNAME(bool a, double b, double c, int d) { \ bool doSave = wxPyRestoreThread(); \ - if (m_myInst.findCallback(#CBNAME)) \ - m_myInst.callCallback(Py_BuildValue("(iddi)", (int)a,b,c,d)); \ + if (wxPyCBH_findCallback(m_myInst, #CBNAME)) \ + wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iddi)", (int)a,b,c,d)); \ else \ PCLASS::CBNAME(a, b, c, d); \ wxPySaveThread(doSave); \ @@ -709,8 +781,8 @@ public: #define IMP_PYCALLBACK__STRING(CLASS, PCLASS, CBNAME) \ void CLASS::CBNAME(const wxString& a) { \ bool doSave = wxPyRestoreThread(); \ - if (m_myInst.findCallback(#CBNAME)) \ - m_myInst.callCallback(Py_BuildValue("(s)", a.c_str())); \ + if (wxPyCBH_findCallback(m_myInst, #CBNAME)) \ + wxPyCBH_callCallback(m_myInst, Py_BuildValue("(s)", a.c_str())); \ else \ PCLASS::CBNAME(a); \ wxPySaveThread(doSave); \ @@ -730,8 +802,8 @@ public: bool CLASS::CBNAME(const wxString& a) { \ bool rval; \ bool doSave = wxPyRestoreThread(); \ - if (m_myInst.findCallback(#CBNAME)) \ - rval = m_myInst.callCallback(Py_BuildValue("(s)", a.c_str())); \ + if (wxPyCBH_findCallback(m_myInst, #CBNAME)) \ + rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(s)", a.c_str())); \ else \ rval = PCLASS::CBNAME(a); \ wxPySaveThread(doSave); \ @@ -750,8 +822,8 @@ public: bool CLASS::CBNAME(const wxString& a) { \ bool rval; \ bool doSave = wxPyRestoreThread(); \ - if (m_myInst.findCallback(#CBNAME)) \ - rval = m_myInst.callCallback(Py_BuildValue("(s)", a.c_str())); \ + if (wxPyCBH_findCallback(m_myInst, #CBNAME)) \ + rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(s)", a.c_str())); \ wxPySaveThread(doSave); \ return rval; \ } \ @@ -765,9 +837,9 @@ public: wxString CLASS::CBNAME(const wxString& a) { \ wxString rval; \ bool doSave = wxPyRestoreThread(); \ - if (m_myInst.findCallback(#CBNAME)) { \ + if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \ PyObject* ro; \ - ro = m_myInst.callCallbackObj(Py_BuildValue("(s)", a.c_str())); \ + ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(s)", a.c_str())); \ if (ro) { \ PyObject* str = PyObject_Str(ro); \ rval = PyString_AsString(str); \ @@ -787,9 +859,9 @@ public: wxString CLASS::CBNAME(const wxString& a,int b) { \ wxString rval; \ bool doSave = wxPyRestoreThread(); \ - if (m_myInst.findCallback(#CBNAME)) { \ + if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \ PyObject* ro; \ - ro = m_myInst.callCallbackObj(Py_BuildValue("(si)", a.c_str(),b)); \ + ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(si)", a.c_str(),b)); \ if (ro) { \ PyObject* str = PyObject_Str(ro); \ rval = PyString_AsString(str); \ @@ -811,8 +883,8 @@ public: bool CLASS::CBNAME(const wxString& a, const wxString& b) { \ bool rval; \ bool doSave = wxPyRestoreThread(); \ - if (m_myInst.findCallback(#CBNAME)) \ - rval = m_myInst.callCallback(Py_BuildValue("(ss)", \ + if (wxPyCBH_findCallback(m_myInst, #CBNAME)) \ + rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ss)", \ a.c_str(), b.c_str())); \ else \ rval = PCLASS::CBNAME(a, b); \ @@ -834,9 +906,9 @@ public: wxString CLASS::CBNAME() { \ wxString rval; \ bool doSave = wxPyRestoreThread(); \ - if (m_myInst.findCallback(#CBNAME)) { \ + if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \ PyObject* ro; \ - ro = m_myInst.callCallbackObj(Py_BuildValue("()")); \ + ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \ if (ro) { \ PyObject* str = PyObject_Str(ro); \ rval = PyString_AsString(str); \ @@ -862,9 +934,9 @@ public: wxString CLASS::CBNAME() { \ wxString rval; \ bool doSave = wxPyRestoreThread(); \ - if (m_myInst.findCallback(#CBNAME)) { \ + if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \ PyObject* ro; \ - ro = m_myInst.callCallbackObj(Py_BuildValue("()")); \ + ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \ if (ro) { \ PyObject* str = PyObject_Str(ro); \ rval = PyString_AsString(str); \ @@ -885,9 +957,9 @@ public: bool CLASS::CBNAME(const wxHtmlTag& a) { \ bool rval = FALSE; \ bool doSave = wxPyRestoreThread(); \ - if (m_myInst.findCallback(#CBNAME)) { \ - PyObject* obj = wxPyConstructObject((void*)&a,"wxHtmlTag"); \ - rval = m_myInst.callCallback(Py_BuildValue("(O)", obj)); \ + if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \ + PyObject* obj = wxPyConstructObject((void*)&a,"wxHtmlTag", 0); \ + rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \ Py_DECREF(obj); \ } \ wxPySaveThread(doSave); \ @@ -903,8 +975,8 @@ public: #define IMP_PYCALLBACK___pure(CLASS, PCLASS, CBNAME) \ void CLASS::CBNAME() { \ bool doSave = wxPyRestoreThread(); \ - if (m_myInst.findCallback(#CBNAME)) \ - m_myInst.callCallback(Py_BuildValue("()")); \ + if (wxPyCBH_findCallback(m_myInst, #CBNAME)) \ + wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \ wxPySaveThread(doSave); \ } @@ -918,10 +990,10 @@ public: wxSize CLASS::CBNAME() { \ wxSize rval(0,0); \ bool doSave = wxPyRestoreThread(); \ - if (m_myInst.findCallback(#CBNAME)) { \ + if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \ PyObject* ro; \ wxSize* ptr; \ - ro = m_myInst.callCallbackObj(Py_BuildValue("()")); \ + ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \ if (ro) { \ if (! SWIG_GetPtrObj(ro, (void **)&ptr, "_wxSize_p")) \ rval = *ptr; \ @@ -943,9 +1015,9 @@ public: bool CLASS::CBNAME(wxWindow* a) { \ bool rval; \ bool doSave = wxPyRestoreThread(); \ - if (m_myInst.findCallback(#CBNAME)) { \ - PyObject* obj = wxPyConstructObject((void*)a,"wxWindow"); \ - rval = m_myInst.callCallback(Py_BuildValue("(O)", obj)); \ + if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \ + PyObject* obj = wxPyConstructObject((void*)a,"wxWindow", 0);\ + rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \ Py_DECREF(obj); \ } \ else \ @@ -968,8 +1040,8 @@ public: bool CLASS::CBNAME() { \ bool rval; \ bool doSave = wxPyRestoreThread(); \ - if (m_myInst.findCallback(#CBNAME)) \ - rval = m_myInst.callCallback(Py_BuildValue("()")); \ + if (wxPyCBH_findCallback(m_myInst, #CBNAME)) \ + rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \ else \ rval = PCLASS::CBNAME(); \ wxPySaveThread(doSave); \ @@ -990,8 +1062,8 @@ public: wxDragResult CLASS::CBNAME(wxCoord a, wxCoord b, wxDragResult c) { \ bool doSave = wxPyRestoreThread(); \ int rval; \ - if (m_myInst.findCallback(#CBNAME)) \ - rval = m_myInst.callCallback(Py_BuildValue("(iii)", a,b,c));\ + if (wxPyCBH_findCallback(m_myInst, #CBNAME)) \ + rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iii)", a,b,c));\ else \ rval = PCLASS::CBNAME(a, b, c); \ wxPySaveThread(doSave); \ @@ -1010,10 +1082,10 @@ public: wxFSFile* CLASS::CBNAME(wxFileSystem& a,const wxString& b) { \ bool doSave = wxPyRestoreThread(); \ wxFSFile* rval=0; \ - if (m_myInst.findCallback(#CBNAME)) { \ + if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \ PyObject* ro; \ - PyObject* obj = wxPyConstructObject(&a, "(wxFileSystem"); \ - ro = m_myInst.callCallbackObj(Py_BuildValue("(Os)", \ + PyObject* obj = wxPyConstructObject(&a, "wxFileSystem", 0); \ + ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(Os)", \ obj, b.c_str())); \ if (ro) { \ SWIG_GetPtrObj(ro, (void **)&rval, "_wxFSFILE_p"); \ @@ -1036,8 +1108,8 @@ public: bool CLASS::CBNAME(wxDragResult a) { \ bool doSave = wxPyRestoreThread(); \ bool rval; \ - if (m_myInst.findCallback(#CBNAME)) \ - rval = m_myInst.callCallback(Py_BuildValue("(i)", a)); \ + if (wxPyCBH_findCallback(m_myInst, #CBNAME)) \ + rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(i)", a)); \ else \ rval = PCLASS::CBNAME(a); \ wxPySaveThread(doSave); \ @@ -1057,8 +1129,8 @@ public: wxDragResult CLASS::CBNAME(wxCoord a, wxCoord b, wxDragResult c) { \ bool doSave = wxPyRestoreThread(); \ int rval; \ - if (m_myInst.findCallback(#CBNAME)) \ - rval = m_myInst.callCallback(Py_BuildValue("(iii)", a,b,c));\ + if (wxPyCBH_findCallback(m_myInst, #CBNAME)) \ + rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iii)", a,b,c));\ wxPySaveThread(doSave); \ return (wxDragResult)rval; \ } \ @@ -1073,8 +1145,8 @@ public: bool CLASS::CBNAME(int a, int b, const wxString& c) { \ bool rval; \ bool doSave = wxPyRestoreThread(); \ - if (m_myInst.findCallback(#CBNAME)) \ - rval = m_myInst.callCallback(Py_BuildValue("(iis)",a,b,c.c_str()));\ + if (wxPyCBH_findCallback(m_myInst, #CBNAME)) \ + rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iis)",a,b,c.c_str()));\ wxPySaveThread(doSave); \ return rval; \ } \ @@ -1090,8 +1162,8 @@ public: size_t CLASS::CBNAME() { \ size_t rval; \ bool doSave = wxPyRestoreThread(); \ - if (m_myInst.findCallback(#CBNAME)) \ - rval = m_myInst.callCallback(Py_BuildValue("()")); \ + if (wxPyCBH_findCallback(m_myInst, #CBNAME)) \ + rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \ else \ rval = PCLASS::CBNAME(); \ wxPySaveThread(doSave); \ @@ -1112,10 +1184,10 @@ public: wxDataFormat CLASS::CBNAME(size_t a) { \ wxDataFormat rval; \ bool doSave = wxPyRestoreThread(); \ - if (m_myInst.findCallback(#CBNAME)) { \ + if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \ PyObject* ro; \ wxDataFormat* ptr; \ - ro = m_myInst.callCallbackObj(Py_BuildValue("(i)", a)); \ + ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(i)", a)); \ if (ro) { \ if (! SWIG_GetPtrObj(ro, (void **)&ptr, "_wxDataFormat_p")) \ rval = *ptr; \ @@ -1141,9 +1213,9 @@ public: #define IMP_PYCALLBACK__constany(CLASS, PCLASS, CBNAME, Type) \ void CLASS::CBNAME(const Type& a) { \ bool doSave = wxPyRestoreThread(); \ - if (m_myInst.findCallback(#CBNAME)) { \ - PyObject* obj = wxPyConstructObject((void*)&a, #Type); \ - m_myInst.callCallback(Py_BuildValue("(O)", obj)); \ + if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \ + PyObject* obj = wxPyConstructObject((void*)&a, #Type, 0); \ + wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \ Py_DECREF(obj); \ } \ else \ @@ -1165,9 +1237,9 @@ public: #define IMP_PYCALLBACK__any(CLASS, PCLASS, CBNAME, Type) \ void CLASS::CBNAME(Type& a) { \ bool doSave = wxPyRestoreThread(); \ - if (m_myInst.findCallback(#CBNAME)) { \ - PyObject* obj = wxPyConstructObject((void*)&a, #Type); \ - m_myInst.callCallback(Py_BuildValue("(O)", obj)); \ + if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \ + PyObject* obj = wxPyConstructObject((void*)&a, #Type, 0); \ + wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \ Py_DECREF(obj); \ } \ else \ @@ -1189,9 +1261,9 @@ public: bool CLASS::CBNAME(Type& a) { \ bool rv; \ bool doSave = wxPyRestoreThread(); \ - if (m_myInst.findCallback(#CBNAME)) { \ - PyObject* obj = wxPyConstructObject((void*)&a, #Type); \ - rv = m_myInst.callCallback(Py_BuildValue("(O)", obj)); \ + if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \ + PyObject* obj = wxPyConstructObject((void*)&a, #Type, 0); \ + rv = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \ Py_DECREF(obj); \ } \ else \ diff --git a/wxPython/src/html.i b/wxPython/src/html.i index 5ec1deae66..12ece75e6d 100644 --- a/wxPython/src/html.i +++ b/wxPython/src/html.i @@ -14,7 +14,7 @@ %module html %{ -#include "helpers.h" +#include "export.h" #include #include #include @@ -40,16 +40,6 @@ %extern utils.i -//--------------------------------------------------------------------------- - -%{ -// #ifdef __WXMSW__ -// wxString wxPyEmptyStr(""); -// wxPoint wxPyDefaultPosition(wxDefaultPosition); -// wxSize wxPyDefaultSize(wxDefaultSize); -// #endif -%} - %pragma(python) code = "import wx" @@ -433,9 +423,9 @@ IMP_PYCALLBACK__STRING(wxPyHtmlWindow, wxHtmlWindow, OnSetTitle); void wxPyHtmlWindow::OnLinkClicked(const wxHtmlLinkInfo& link) { bool doSave = wxPyRestoreThread(); - if (m_myInst.findCallback("OnLinkClicked")) { - PyObject* obj = wxPyConstructObject((void*)&link, "wxHtmlLinkInfo"); - m_myInst.callCallback(Py_BuildValue("(O)", obj)); + if (wxPyCBH_findCallback(m_myInst, "OnLinkClicked")) { + PyObject* obj = wxPyConstructObject((void*)&link, "wxHtmlLinkInfo", 0); + wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); Py_DECREF(obj); } else @@ -452,8 +442,8 @@ void wxPyHtmlWindow::base_OnLinkClicked(const wxHtmlLinkInfo& link) { %name(wxHtmlWindow) class wxPyHtmlWindow : public wxScrolledWindow { public: wxPyHtmlWindow(wxWindow *parent, int id = -1, - wxPoint& pos = wxPyDefaultPosition, - wxSize& size = wxPyDefaultSize, + wxPoint& pos = wxDefaultPosition, + wxSize& size = wxDefaultSize, int flags=wxHW_SCROLLBAR_AUTO, char* name = "htmlWindow"); diff --git a/wxPython/src/htmlhelp.i b/wxPython/src/htmlhelp.i index f354061324..0715d1ae0b 100644 --- a/wxPython/src/htmlhelp.i +++ b/wxPython/src/htmlhelp.i @@ -14,7 +14,7 @@ %module htmlhelp %{ -#include "helpers.h" +#include "export.h" #include #include #include diff --git a/wxPython/src/misc2.i b/wxPython/src/misc2.i index 97ba79ccd9..68ed499ae7 100644 --- a/wxPython/src/misc2.i +++ b/wxPython/src/misc2.i @@ -99,7 +99,15 @@ long wxGetNumberFromUser(const wxString& message, // GDI Functions bool wxColourDisplay(); + int wxDisplayDepth(); +int wxGetDisplayDepth(); + +void wxDisplaySize(int* OUTPUT, int* OUTPUT); +wxSize wxGetDisplaySize(); +void wxDisplaySizeMM(int* OUTPUT, int* OUTPUT); +wxSize wxGetDisplaySizeMM(); + void wxSetCursor(wxCursor& cursor); //---------------------------------------------------------------------- diff --git a/wxPython/src/msw/calendar.cpp b/wxPython/src/msw/calendar.cpp index 4a4e2b714c..6ffbca6e3a 100644 --- a/wxPython/src/msw/calendar.cpp +++ b/wxPython/src/msw/calendar.cpp @@ -55,7 +55,7 @@ extern PyObject *SWIG_newvarlink(void); #define SWIG_name "calendarc" -#include "helpers.h" +#include "export.h" #include static PyObject* l_output_helper(PyObject* target, PyObject* o) { diff --git a/wxPython/src/msw/grid.cpp b/wxPython/src/msw/grid.cpp index 636d9c0c46..d5e0a2105e 100644 --- a/wxPython/src/msw/grid.cpp +++ b/wxPython/src/msw/grid.cpp @@ -55,7 +55,7 @@ extern PyObject *SWIG_newvarlink(void); #define SWIG_name "gridc" -#include "helpers.h" +#include "export.h" #include static PyObject* l_output_helper(PyObject* target, PyObject* o) { @@ -110,10 +110,10 @@ static char* wxStringErrorMsg = "string type is required for parameter"; wxGridCellAttr* CBNAME(int a, int b) { \ wxGridCellAttr* rval = NULL; \ bool doSave = wxPyRestoreThread(); \ - if (m_myInst.findCallback(#CBNAME)) { \ + if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \ PyObject* ro; \ wxGridCellAttr* ptr; \ - ro = m_myInst.callCallbackObj(Py_BuildValue("(ii)", a, b)); \ + ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(ii)", a, b)); \ if (ro) { \ if (!SWIG_GetPtrObj(ro, (void **)&ptr, "_wxGridCellAttr_p")) \ rval = ptr; \ @@ -134,9 +134,9 @@ static char* wxStringErrorMsg = "string type is required for parameter"; #define PYCALLBACK__GCAINTINT(PCLASS, CBNAME) \ void CBNAME(wxGridCellAttr *attr, int a, int b) { \ bool doSave = wxPyRestoreThread(); \ - if (m_myInst.findCallback(#CBNAME)) { \ - PyObject* obj = wxPyConstructObject((void*)attr, "wxGridCellAttr");\ - m_myInst.callCallback(Py_BuildValue("(Oii)", obj, a, b)); \ + if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \ + PyObject* obj = wxPyConstructObject((void*)attr, "wxGridCellAttr", 0);\ + wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oii)", obj, a, b)); \ Py_DECREF(obj); \ } \ else \ @@ -152,9 +152,9 @@ static char* wxStringErrorMsg = "string type is required for parameter"; #define PYCALLBACK__GCAINT(PCLASS, CBNAME) \ void CBNAME(wxGridCellAttr *attr, int val) { \ bool doSave = wxPyRestoreThread(); \ - if (m_myInst.findCallback(#CBNAME)) { \ - PyObject* obj = wxPyConstructObject((void*)attr, "wxGridCellAttr");\ - m_myInst.callCallback(Py_BuildValue("(Oi)", obj, val)); \ + if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \ + PyObject* obj = wxPyConstructObject((void*)attr, "wxGridCellAttr", 0);\ + wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oi)", obj, val)); \ Py_DECREF(obj); \ } \ else \ @@ -171,8 +171,8 @@ static char* wxStringErrorMsg = "string type is required for parameter"; int CBNAME() { \ bool doSave = wxPyRestoreThread(); \ int rval = 0; \ - if (m_myInst.findCallback(#CBNAME)) \ - rval = m_myInst.callCallback(Py_BuildValue("()")); \ + if (wxPyCBH_findCallback(m_myInst, #CBNAME)) \ + rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \ wxPySaveThread(doSave); \ return rval; \ } @@ -183,8 +183,8 @@ static char* wxStringErrorMsg = "string type is required for parameter"; bool CBNAME(int a, int b) { \ bool doSave = wxPyRestoreThread(); \ bool rval = 0; \ - if (m_myInst.findCallback(#CBNAME)) \ - rval = m_myInst.callCallback(Py_BuildValue("(ii)",a,b)); \ + if (wxPyCBH_findCallback(m_myInst, #CBNAME)) \ + rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ii)",a,b)); \ wxPySaveThread(doSave); \ return rval; \ } @@ -195,9 +195,9 @@ static char* wxStringErrorMsg = "string type is required for parameter"; wxString CBNAME(int a, int b) { \ bool doSave = wxPyRestoreThread(); \ wxString rval; \ - if (m_myInst.findCallback(#CBNAME)) { \ + if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \ PyObject* ro; \ - ro = m_myInst.callCallbackObj(Py_BuildValue("(ii)",a,b)); \ + ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(ii)",a,b)); \ if (ro) { \ PyObject* str = PyObject_Str(ro); \ rval = PyString_AsString(str); \ @@ -213,8 +213,8 @@ static char* wxStringErrorMsg = "string type is required for parameter"; #define PYCALLBACK__INTINTSTRING_pure(CBNAME) \ void CBNAME(int a, int b, const wxString& c) { \ bool doSave = wxPyRestoreThread(); \ - if (m_myInst.findCallback(#CBNAME)) \ - m_myInst.callCallback(Py_BuildValue("(iis)",a,b,c.c_str())); \ + if (wxPyCBH_findCallback(m_myInst, #CBNAME)) \ + wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iis)",a,b,c.c_str())); \ wxPySaveThread(doSave); \ } @@ -223,9 +223,9 @@ static char* wxStringErrorMsg = "string type is required for parameter"; wxString CBNAME(int a, int b) { \ bool doSave = wxPyRestoreThread(); \ wxString rval; \ - if (m_myInst.findCallback(#CBNAME)) { \ + if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \ PyObject* ro; \ - ro = m_myInst.callCallbackObj(Py_BuildValue("(ii)",a,b)); \ + ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(ii)",a,b)); \ if (ro) { \ PyObject* str = PyObject_Str(ro); \ rval = PyString_AsString(str); \ @@ -246,8 +246,8 @@ static char* wxStringErrorMsg = "string type is required for parameter"; bool CBNAME(int a, int b, const wxString& c) { \ bool rval; \ bool doSave = wxPyRestoreThread(); \ - if (m_myInst.findCallback(#CBNAME)) \ - rval = m_myInst.callCallback(Py_BuildValue("(iis)", a,b,c.c_str())); \ + if (wxPyCBH_findCallback(m_myInst, #CBNAME)) \ + rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iis)", a,b,c.c_str())); \ else \ rval = PCLASS::CBNAME(a,b,c); \ wxPySaveThread(doSave); \ @@ -264,8 +264,8 @@ static char* wxStringErrorMsg = "string type is required for parameter"; long CBNAME(int a, int b) { \ long rval; \ bool doSave = wxPyRestoreThread(); \ - if (m_myInst.findCallback(#CBNAME)) \ - rval = m_myInst.callCallback(Py_BuildValue("(ii)", a,b)); \ + if (wxPyCBH_findCallback(m_myInst, #CBNAME)) \ + rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ii)", a,b)); \ else \ rval = PCLASS::CBNAME(a,b); \ wxPySaveThread(doSave); \ @@ -281,8 +281,8 @@ static char* wxStringErrorMsg = "string type is required for parameter"; bool CBNAME(int a, int b) { \ bool rval; \ bool doSave = wxPyRestoreThread(); \ - if (m_myInst.findCallback(#CBNAME)) \ - rval = m_myInst.callCallback(Py_BuildValue("(ii)", a,b)); \ + if (wxPyCBH_findCallback(m_myInst, #CBNAME)) \ + rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ii)", a,b)); \ else \ rval = PCLASS::CBNAME(a,b); \ wxPySaveThread(doSave); \ @@ -298,9 +298,9 @@ static char* wxStringErrorMsg = "string type is required for parameter"; double CBNAME(int a, int b) { \ bool doSave = wxPyRestoreThread(); \ double rval; \ - if (m_myInst.findCallback(#CBNAME)) { \ + if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \ PyObject* ro; \ - ro = m_myInst.callCallbackObj(Py_BuildValue("(ii)",a,b)); \ + ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(ii)",a,b)); \ if (ro) { \ PyObject* str = PyObject_Str(ro); \ rval = PyFloat_AsDouble(str); \ @@ -320,8 +320,8 @@ static char* wxStringErrorMsg = "string type is required for parameter"; #define PYCALLBACK__(PCLASS, CBNAME) \ void CBNAME() { \ bool doSave = wxPyRestoreThread(); \ - if (m_myInst.findCallback(#CBNAME)) \ - m_myInst.callCallback(Py_BuildValue("()")); \ + if (wxPyCBH_findCallback(m_myInst, #CBNAME)) \ + wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \ else \ PCLASS::CBNAME(); \ wxPySaveThread(doSave); \ @@ -337,8 +337,8 @@ static char* wxStringErrorMsg = "string type is required for parameter"; bool CBNAME(size_t a, size_t b) { \ bool rval; \ bool doSave = wxPyRestoreThread(); \ - if (m_myInst.findCallback(#CBNAME)) \ - rval = m_myInst.callCallback(Py_BuildValue("(ii)", a,b)); \ + if (wxPyCBH_findCallback(m_myInst, #CBNAME)) \ + rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ii)", a,b)); \ else \ rval = PCLASS::CBNAME(a,b); \ wxPySaveThread(doSave); \ @@ -354,8 +354,8 @@ static char* wxStringErrorMsg = "string type is required for parameter"; bool CBNAME(size_t a) { \ bool rval; \ bool doSave = wxPyRestoreThread(); \ - if (m_myInst.findCallback(#CBNAME)) \ - rval = m_myInst.callCallback(Py_BuildValue("(i)", a)); \ + if (wxPyCBH_findCallback(m_myInst, #CBNAME)) \ + rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(i)", a)); \ else \ rval = PCLASS::CBNAME(a); \ wxPySaveThread(doSave); \ @@ -371,9 +371,9 @@ static char* wxStringErrorMsg = "string type is required for parameter"; wxString CBNAME(int a) { \ bool doSave = wxPyRestoreThread(); \ wxString rval; \ - if (m_myInst.findCallback(#CBNAME)) { \ + if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \ PyObject* ro; \ - ro = m_myInst.callCallbackObj(Py_BuildValue("(i)",a)); \ + ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(i)",a)); \ if (ro) { \ PyObject* str = PyObject_Str(ro); \ rval = PyString_AsString(str); \ @@ -393,8 +393,8 @@ static char* wxStringErrorMsg = "string type is required for parameter"; #define PYCALLBACK__INTSTRING(PCLASS, CBNAME) \ void CBNAME(int a, const wxString& c) { \ bool doSave = wxPyRestoreThread(); \ - if (m_myInst.findCallback(#CBNAME)) \ - m_myInst.callCallback(Py_BuildValue("(is)", a,c.c_str())); \ + if (wxPyCBH_findCallback(m_myInst, #CBNAME)) \ + wxPyCBH_callCallback(m_myInst, Py_BuildValue("(is)", a,c.c_str())); \ else \ PCLASS::CBNAME(a,c); \ wxPySaveThread(doSave); \ @@ -410,8 +410,8 @@ static char* wxStringErrorMsg = "string type is required for parameter"; bool CBNAME() { \ bool rval; \ bool doSave = wxPyRestoreThread(); \ - if (m_myInst.findCallback(#CBNAME)) \ - rval = m_myInst.callCallback(Py_BuildValue("()")); \ + if (wxPyCBH_findCallback(m_myInst, #CBNAME)) \ + rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \ else \ rval = PCLASS::CBNAME(); \ wxPySaveThread(doSave); \ @@ -426,8 +426,8 @@ static char* wxStringErrorMsg = "string type is required for parameter"; #define PYCALLBACK__SIZETINT(PCLASS, CBNAME) \ void CBNAME(size_t a, int b) { \ bool doSave = wxPyRestoreThread(); \ - if (m_myInst.findCallback(#CBNAME)) \ - m_myInst.callCallback(Py_BuildValue("(ii)", a,b)); \ + if (wxPyCBH_findCallback(m_myInst, #CBNAME)) \ + wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ii)", a,b)); \ else \ PCLASS::CBNAME(a,b); \ wxPySaveThread(doSave); \ @@ -442,8 +442,8 @@ static char* wxStringErrorMsg = "string type is required for parameter"; #define PYCALLBACK__INTINTLONG(PCLASS, CBNAME) \ void CBNAME(int a, int b, long c) { \ bool doSave = wxPyRestoreThread(); \ - if (m_myInst.findCallback(#CBNAME)) \ - m_myInst.callCallback(Py_BuildValue("(iii)", a,b,c)); \ + if (wxPyCBH_findCallback(m_myInst, #CBNAME)) \ + wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iii)", a,b,c)); \ else \ PCLASS::CBNAME(a,b,c); \ wxPySaveThread(doSave); \ @@ -458,8 +458,8 @@ static char* wxStringErrorMsg = "string type is required for parameter"; #define PYCALLBACK__INTINTDOUBLE(PCLASS, CBNAME) \ void CBNAME(int a, int b, double c) { \ bool doSave = wxPyRestoreThread(); \ - if (m_myInst.findCallback(#CBNAME)) \ - m_myInst.callCallback(Py_BuildValue("(iif)", a,b,c)); \ + if (wxPyCBH_findCallback(m_myInst, #CBNAME)) \ + wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iif)", a,b,c)); \ else \ PCLASS::CBNAME(a,b,c); \ wxPySaveThread(doSave); \ @@ -473,8 +473,8 @@ static char* wxStringErrorMsg = "string type is required for parameter"; #define PYCALLBACK__INTINTBOOL(PCLASS, CBNAME) \ void CBNAME(int a, int b, bool c) { \ bool doSave = wxPyRestoreThread(); \ - if (m_myInst.findCallback(#CBNAME)) \ - m_myInst.callCallback(Py_BuildValue("(iii)", a,b,c)); \ + if (wxPyCBH_findCallback(m_myInst, #CBNAME)) \ + wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iii)", a,b,c)); \ else \ PCLASS::CBNAME(a,b,c); \ wxPySaveThread(doSave); \ @@ -497,13 +497,13 @@ public: wxDC& dc, const wxRect& rect, int row, int col, bool isSelected) { bool doSave = wxPyRestoreThread(); - if (m_myInst.findCallback("Draw")) { - m_myInst.callCallback( + if (wxPyCBH_findCallback(m_myInst, "Draw")) { + wxPyCBH_callCallback(m_myInst, Py_BuildValue("(OOOOiii)", - wxPyConstructObject((void*)&grid, "wxGrid"), - wxPyConstructObject((void*)&attr, "wxGridCellAttr"), - wxPyConstructObject((void*)&dc, "wxDC"), - wxPyConstructObject((void*)&rect, "wxRect"), + wxPyConstructObject((void*)&grid, "wxGrid", 0), + wxPyConstructObject((void*)&attr, "wxGridCellAttr", 0), + wxPyConstructObject((void*)&dc, "wxDC", 0), + wxPyConstructObject((void*)&rect, "wxRect", 0), row, col, isSelected)); } wxPySaveThread(doSave); @@ -513,14 +513,14 @@ public: int row, int col) { wxSize rval; bool doSave = wxPyRestoreThread(); - if (m_myInst.findCallback("GetBestSize")) { + if (wxPyCBH_findCallback(m_myInst, "GetBestSize")) { PyObject* ro; wxSize* ptr; - ro = m_myInst.callCallbackObj( + ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(OOOii)", - wxPyConstructObject((void*)&grid, "wxGrid"), - wxPyConstructObject((void*)&attr, "wxGridCellAttr"), - wxPyConstructObject((void*)&dc, "wxDC"), + wxPyConstructObject((void*)&grid, "wxGrid", 0), + wxPyConstructObject((void*)&attr, "wxGridCellAttr", 0), + wxPyConstructObject((void*)&dc, "wxDC", 0), row, col)); if (ro) { if (!SWIG_GetPtrObj(ro, (void **)&ptr, "_wxSize_p")) @@ -536,10 +536,10 @@ public: wxGridCellRenderer *Clone() const { wxGridCellRenderer* rval = NULL; bool doSave = wxPyRestoreThread(); - if (m_myInst.findCallback("Clone")) { + if (wxPyCBH_findCallback(m_myInst, "Clone")) { PyObject* ro; wxGridCellRenderer* ptr; - ro = m_myInst.callCallbackObj(Py_BuildValue("()")); + ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); if (ro) { if (!SWIG_GetPtrObj(ro, (void **)&ptr, "_wxGridCellRenderer_p")) rval = ptr; @@ -565,12 +565,12 @@ public: void Create(wxWindow* parent, wxWindowID id, wxEvtHandler* evtHandler) { bool doSave = wxPyRestoreThread(); - if (m_myInst.findCallback("Create")) { - m_myInst.callCallback( + if (wxPyCBH_findCallback(m_myInst, "Create")) { + wxPyCBH_callCallback(m_myInst, Py_BuildValue("(OiO)", - wxPyConstructObject((void*)parent, "wxWindow"), + wxPyConstructObject((void*)parent, "wxWindow", 0), id, - wxPyConstructObject((void*)evtHandler, "wxEvtHandler"))); + wxPyConstructObject((void*)evtHandler, "wxEvtHandler", 0))); } wxPySaveThread(doSave); } @@ -578,10 +578,10 @@ public: void BeginEdit(int row, int col, wxGrid* grid) { bool doSave = wxPyRestoreThread(); - if (m_myInst.findCallback("BeginEdit")) { - m_myInst.callCallback( + if (wxPyCBH_findCallback(m_myInst, "BeginEdit")) { + wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iiO)", row, col, - wxPyConstructObject((void*)grid, "wxGrid"))); + wxPyConstructObject((void*)grid, "wxGrid", 0))); } wxPySaveThread(doSave); } @@ -590,10 +590,10 @@ public: bool EndEdit(int row, int col, wxGrid* grid) { bool rv = FALSE; bool doSave = wxPyRestoreThread(); - if (m_myInst.findCallback("EndEdit")) { - rv = m_myInst.callCallback( + if (wxPyCBH_findCallback(m_myInst, "EndEdit")) { + rv = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iiO)", row, col, - wxPyConstructObject((void*)grid, "wxGrid"))); + wxPyConstructObject((void*)grid, "wxGrid", 0))); } wxPySaveThread(doSave); return rv; @@ -603,10 +603,10 @@ public: wxGridCellEditor*Clone() const { wxGridCellEditor* rval = NULL; bool doSave = wxPyRestoreThread(); - if (m_myInst.findCallback("Clone")) { + if (wxPyCBH_findCallback(m_myInst, "Clone")) { PyObject* ro; wxGridCellEditor* ptr; - ro = m_myInst.callCallbackObj(Py_BuildValue("()")); + ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); if (ro) { if (!SWIG_GetPtrObj(ro, (void **)&ptr, "_wxGridCellEditor_p")) rval = ptr; @@ -620,10 +620,10 @@ public: void Show(bool show, wxGridCellAttr *attr) { bool doSave = wxPyRestoreThread(); - if (m_myInst.findCallback("Show")) - m_myInst.callCallback( + if (wxPyCBH_findCallback(m_myInst, "Show")) + wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iO)", show, - wxPyConstructObject((void*)attr, "wxGridCellAttr"))); + wxPyConstructObject((void*)attr, "wxGridCellAttr", 0))); else wxGridCellEditor::Show(show, attr); wxPySaveThread(doSave); @@ -635,11 +635,11 @@ public: void PaintBackground(const wxRect& rectCell, wxGridCellAttr *attr) { bool doSave = wxPyRestoreThread(); - if (m_myInst.findCallback("PaintBackground")) - m_myInst.callCallback( + if (wxPyCBH_findCallback(m_myInst, "PaintBackground")) + wxPyCBH_callCallback(m_myInst, Py_BuildValue("(OO)", - wxPyConstructObject((void*)&rectCell, "wxRect"), - wxPyConstructObject((void*)attr, "wxGridCellAttr"))); + wxPyConstructObject((void*)&rectCell, "wxRect", 0), + wxPyConstructObject((void*)attr, "wxGridCellAttr", 0))); else wxGridCellEditor::PaintBackground(rectCell, attr); wxPySaveThread(doSave); @@ -717,9 +717,9 @@ public: wxString GetValue(int row, int col) { bool doSave = wxPyRestoreThread(); wxString rval; - if (m_myInst.findCallback("GetValue")) { + if (wxPyCBH_findCallback(m_myInst, "GetValue")) { PyObject* ro; - ro = m_myInst.callCallbackObj(Py_BuildValue("(ii)",row,col)); + ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(ii)",row,col)); if (ro) { PyObject* str = PyObject_Str(ro); rval = PyString_AsString(str); @@ -733,8 +733,8 @@ public: void SetValue(int row, int col, const wxString& val) { bool doSave = wxPyRestoreThread(); - if (m_myInst.findCallback("SetValue")) - m_myInst.callCallback(Py_BuildValue("(iis)",row,col,val.c_str())); + if (wxPyCBH_findCallback(m_myInst, "SetValue")) + wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iis)",row,col,val.c_str())); wxPySaveThread(doSave); } @@ -744,10 +744,10 @@ public: long GetValueAsLong( int row, int col ) { long rval = 0; bool doSave = wxPyRestoreThread(); - if (m_myInst.findCallback("GetValue")) { + if (wxPyCBH_findCallback(m_myInst, "GetValue")) { PyObject* ro; PyObject* num; - ro = m_myInst.callCallbackObj(Py_BuildValue("(ii)", row, col)); + ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(ii)", row, col)); if (ro && PyNumber_Check(ro)) { num = PyNumber_Int(ro); if (num) { @@ -764,10 +764,10 @@ public: double GetValueAsDouble( int row, int col ) { double rval = 0.0; bool doSave = wxPyRestoreThread(); - if (m_myInst.findCallback("GetValue")) { + if (wxPyCBH_findCallback(m_myInst, "GetValue")) { PyObject* ro; PyObject* num; - ro = m_myInst.callCallbackObj(Py_BuildValue("(ii)", row, col)); + ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(ii)", row, col)); if (ro && PyNumber_Check(ro)) { num = PyNumber_Float(ro); if (num) { @@ -787,16 +787,16 @@ public: void SetValueAsLong( int row, int col, long value ) { bool doSave = wxPyRestoreThread(); - if (m_myInst.findCallback("SetValue")) { - m_myInst.callCallback(Py_BuildValue("(iii)", row, col, value)); + if (wxPyCBH_findCallback(m_myInst, "SetValue")) { + wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iii)", row, col, value)); } wxPySaveThread(doSave); } void SetValueAsDouble( int row, int col, double value ) { bool doSave = wxPyRestoreThread(); - if (m_myInst.findCallback("SetValue")) { - m_myInst.callCallback(Py_BuildValue("(iid)", row, col, value)); + if (wxPyCBH_findCallback(m_myInst, "SetValue")) { + wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iid)", row, col, value)); } wxPySaveThread(doSave); } diff --git a/wxPython/src/msw/html.cpp b/wxPython/src/msw/html.cpp index 9c04d9602e..e19ad698ea 100644 --- a/wxPython/src/msw/html.cpp +++ b/wxPython/src/msw/html.cpp @@ -55,7 +55,7 @@ extern PyObject *SWIG_newvarlink(void); #define SWIG_name "htmlc" -#include "helpers.h" +#include "export.h" #include #include #include @@ -113,12 +113,6 @@ static PyObject* t_output_helper(PyObject* target, PyObject* o) { static char* wxStringErrorMsg = "string type is required for parameter"; -// #ifdef __WXMSW__ -// wxString wxPyEmptyStr(""); -// wxPoint wxPyDefaultPosition(wxDefaultPosition); -// wxSize wxPyDefaultSize(wxDefaultSize); -// #endif - class wxPyHtmlTagHandler : public wxHtmlTagHandler { public: wxPyHtmlTagHandler() : wxHtmlTagHandler() {}; @@ -228,9 +222,9 @@ IMP_PYCALLBACK__STRING(wxPyHtmlWindow, wxHtmlWindow, OnSetTitle); void wxPyHtmlWindow::OnLinkClicked(const wxHtmlLinkInfo& link) { bool doSave = wxPyRestoreThread(); - if (m_myInst.findCallback("OnLinkClicked")) { - PyObject* obj = wxPyConstructObject((void*)&link, "wxHtmlLinkInfo"); - m_myInst.callCallback(Py_BuildValue("(O)", obj)); + if (wxPyCBH_findCallback(m_myInst, "OnLinkClicked")) { + PyObject* obj = wxPyConstructObject((void*)&link, "wxHtmlLinkInfo", 0); + wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); Py_DECREF(obj); } else @@ -3954,8 +3948,8 @@ static PyObject *_wrap_new_wxHtmlWindow(PyObject *self, PyObject *args, PyObject wxPyHtmlWindow * _result; wxWindow * _arg0; int _arg1 = (int ) -1; - wxPoint * _arg2 = (wxPoint *) &wxPyDefaultPosition; - wxSize * _arg3 = (wxSize *) &wxPyDefaultSize; + wxPoint * _arg2 = (wxPoint *) &wxDefaultPosition; + wxSize * _arg3 = (wxSize *) &wxDefaultSize; int _arg4 = (int ) wxHW_SCROLLBAR_AUTO; char * _arg5 = (char *) "htmlWindow"; PyObject * _argo0 = 0; diff --git a/wxPython/src/msw/htmlhelp.cpp b/wxPython/src/msw/htmlhelp.cpp index 62f601e4ad..c9831ae331 100644 --- a/wxPython/src/msw/htmlhelp.cpp +++ b/wxPython/src/msw/htmlhelp.cpp @@ -55,7 +55,7 @@ extern PyObject *SWIG_newvarlink(void); #define SWIG_name "htmlhelpc" -#include "helpers.h" +#include "export.h" #include #include #include diff --git a/wxPython/src/msw/misc2.cpp b/wxPython/src/msw/misc2.cpp index 55aba98c86..f20e09cbc5 100644 --- a/wxPython/src/msw/misc2.cpp +++ b/wxPython/src/msw/misc2.cpp @@ -790,6 +790,135 @@ static PyObject *_wrap_wxDisplayDepth(PyObject *self, PyObject *args, PyObject * return _resultobj; } +static PyObject *_wrap_wxGetDisplayDepth(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + int _result; + char *_kwnames[] = { NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,":wxGetDisplayDepth",_kwnames)) + return NULL; +{ + wxPy_BEGIN_ALLOW_THREADS; + _result = (int )wxGetDisplayDepth(); + + wxPy_END_ALLOW_THREADS; +} _resultobj = Py_BuildValue("i",_result); + return _resultobj; +} + +static PyObject *_wrap_wxDisplaySize(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + int * _arg0; + int temp; + int * _arg1; + int temp0; + char *_kwnames[] = { NULL }; + + self = self; +{ + _arg0 = &temp; +} +{ + _arg1 = &temp0; +} + if(!PyArg_ParseTupleAndKeywords(args,kwargs,":wxDisplaySize",_kwnames)) + return NULL; +{ + wxPy_BEGIN_ALLOW_THREADS; + wxDisplaySize(_arg0,_arg1); + + wxPy_END_ALLOW_THREADS; +} Py_INCREF(Py_None); + _resultobj = Py_None; +{ + PyObject *o; + o = PyInt_FromLong((long) (*_arg0)); + _resultobj = t_output_helper(_resultobj, o); +} +{ + PyObject *o; + o = PyInt_FromLong((long) (*_arg1)); + _resultobj = t_output_helper(_resultobj, o); +} + return _resultobj; +} + +static PyObject *_wrap_wxGetDisplaySize(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxSize * _result; + char *_kwnames[] = { NULL }; + char _ptemp[128]; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,":wxGetDisplaySize",_kwnames)) + return NULL; +{ + wxPy_BEGIN_ALLOW_THREADS; + _result = new wxSize (wxGetDisplaySize()); + + wxPy_END_ALLOW_THREADS; +} SWIG_MakePtr(_ptemp, (void *) _result,"_wxSize_p"); + _resultobj = Py_BuildValue("s",_ptemp); + return _resultobj; +} + +static PyObject *_wrap_wxDisplaySizeMM(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + int * _arg0; + int temp; + int * _arg1; + int temp0; + char *_kwnames[] = { NULL }; + + self = self; +{ + _arg0 = &temp; +} +{ + _arg1 = &temp0; +} + if(!PyArg_ParseTupleAndKeywords(args,kwargs,":wxDisplaySizeMM",_kwnames)) + return NULL; +{ + wxPy_BEGIN_ALLOW_THREADS; + wxDisplaySizeMM(_arg0,_arg1); + + wxPy_END_ALLOW_THREADS; +} Py_INCREF(Py_None); + _resultobj = Py_None; +{ + PyObject *o; + o = PyInt_FromLong((long) (*_arg0)); + _resultobj = t_output_helper(_resultobj, o); +} +{ + PyObject *o; + o = PyInt_FromLong((long) (*_arg1)); + _resultobj = t_output_helper(_resultobj, o); +} + return _resultobj; +} + +static PyObject *_wrap_wxGetDisplaySizeMM(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxSize * _result; + char *_kwnames[] = { NULL }; + char _ptemp[128]; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,":wxGetDisplaySizeMM",_kwnames)) + return NULL; +{ + wxPy_BEGIN_ALLOW_THREADS; + _result = new wxSize (wxGetDisplaySizeMM()); + + wxPy_END_ALLOW_THREADS; +} SWIG_MakePtr(_ptemp, (void *) _result,"_wxSize_p"); + _resultobj = Py_BuildValue("s",_ptemp); + return _resultobj; +} + static PyObject *_wrap_wxSetCursor(PyObject *self, PyObject *args, PyObject *kwargs) { PyObject * _resultobj; wxCursor * _arg0; @@ -6452,6 +6581,11 @@ static PyMethodDef misc2cMethods[] = { { "wxFindWindowByName", (PyCFunction) _wrap_wxFindWindowByName, METH_VARARGS | METH_KEYWORDS }, { "wxFindWindowByLabel", (PyCFunction) _wrap_wxFindWindowByLabel, METH_VARARGS | METH_KEYWORDS }, { "wxSetCursor", (PyCFunction) _wrap_wxSetCursor, METH_VARARGS | METH_KEYWORDS }, + { "wxGetDisplaySizeMM", (PyCFunction) _wrap_wxGetDisplaySizeMM, METH_VARARGS | METH_KEYWORDS }, + { "wxDisplaySizeMM", (PyCFunction) _wrap_wxDisplaySizeMM, METH_VARARGS | METH_KEYWORDS }, + { "wxGetDisplaySize", (PyCFunction) _wrap_wxGetDisplaySize, METH_VARARGS | METH_KEYWORDS }, + { "wxDisplaySize", (PyCFunction) _wrap_wxDisplaySize, METH_VARARGS | METH_KEYWORDS }, + { "wxGetDisplayDepth", (PyCFunction) _wrap_wxGetDisplayDepth, METH_VARARGS | METH_KEYWORDS }, { "wxDisplayDepth", (PyCFunction) _wrap_wxDisplayDepth, METH_VARARGS | METH_KEYWORDS }, { "wxColourDisplay", (PyCFunction) _wrap_wxColourDisplay, METH_VARARGS | METH_KEYWORDS }, { "wxGetNumberFromUser", (PyCFunction) _wrap_wxGetNumberFromUser, METH_VARARGS | METH_KEYWORDS }, diff --git a/wxPython/src/msw/misc2.py b/wxPython/src/msw/misc2.py index ea88f93e61..dd70b6014f 100644 --- a/wxPython/src/msw/misc2.py +++ b/wxPython/src/msw/misc2.py @@ -632,6 +632,22 @@ wxColourDisplay = misc2c.wxColourDisplay wxDisplayDepth = misc2c.wxDisplayDepth +wxGetDisplayDepth = misc2c.wxGetDisplayDepth + +wxDisplaySize = misc2c.wxDisplaySize + +def wxGetDisplaySize(*_args, **_kwargs): + val = apply(misc2c.wxGetDisplaySize,_args,_kwargs) + if val: val = wxSizePtr(val); val.thisown = 1 + return val + +wxDisplaySizeMM = misc2c.wxDisplaySizeMM + +def wxGetDisplaySizeMM(*_args, **_kwargs): + val = apply(misc2c.wxGetDisplaySizeMM,_args,_kwargs) + if val: val = wxSizePtr(val); val.thisown = 1 + return val + wxSetCursor = misc2c.wxSetCursor def wxFindWindowByLabel(*_args, **_kwargs): diff --git a/wxPython/src/msw/utils.cpp b/wxPython/src/msw/utils.cpp index 03558621af..c869ce2ebf 100644 --- a/wxPython/src/msw/utils.cpp +++ b/wxPython/src/msw/utils.cpp @@ -55,7 +55,7 @@ extern PyObject *SWIG_newvarlink(void); #define SWIG_name "utilsc" -#include "helpers.h" +#include "export.h" #include #include #include @@ -108,6 +108,8 @@ static PyObject* t_output_helper(PyObject* target, PyObject* o) { static char* wxStringErrorMsg = "string type is required for parameter"; + static wxString wxPyEmptyStr(""); + static PyObject* __EnumerationHelper(bool flag, wxString& str, long index) { PyObject* ret = PyTuple_New(3); if (ret) { diff --git a/wxPython/src/msw/wx.cpp b/wxPython/src/msw/wx.cpp index 0b7f33e6fa..cabfca1b1d 100644 --- a/wxPython/src/msw/wx.cpp +++ b/wxPython/src/msw/wx.cpp @@ -623,6 +623,8 @@ PyObject *ptrfree(PyObject *_PTRVALUE) { __wxCleanup(); } + + extern "C" SWIGEXPORT(void) initwindowsc(); extern "C" SWIGEXPORT(void) initwindows2c(); extern "C" SWIGEXPORT(void) initeventsc(); @@ -640,17 +642,49 @@ extern "C" SWIGEXPORT(void) initimagec(); extern "C" SWIGEXPORT(void) initprintfwc(); extern "C" SWIGEXPORT(void) initsizersc(); extern "C" SWIGEXPORT(void) initclip_dndc(); -extern "C" SWIGEXPORT(void) initgridc(); -extern "C" SWIGEXPORT(void) initutilsc(); -extern "C" SWIGEXPORT(void) inithtmlc(); -extern "C" SWIGEXPORT(void) inithtmlhelpc(); -extern "C" SWIGEXPORT(void) initcalendarc(); extern "C" SWIGEXPORT(void) initstreamsc(); extern "C" SWIGEXPORT(void) initfilesysc(); -extern "C" SWIGEXPORT(void) initglcanvasc(); -extern "C" SWIGEXPORT(void) initoglc(); -extern "C" SWIGEXPORT(void) initstc_c(); + + +// Export a C API in a struct. Other modules will be able to load this from +// the wxc module and will then have safe access to these functions, even if +// in another shared library. +static wxPyCoreAPI API = { + SWIG_MakePtr, + SWIG_GetPtr, + SWIG_GetPtrObj, + SWIG_RegisterMapping, + SWIG_addvarlink, + SWIG_newvarlink, + + wxPySaveThread, + wxPyRestoreThread, + wxPyConstructObject, + wxPy_ConvertList, + + byte_LIST_helper, + int_LIST_helper, + long_LIST_helper, + string_LIST_helper, + wxPoint_LIST_helper, + wxBitmap_LIST_helper, + wxString_LIST_helper, + wxAcceleratorEntry_LIST_helper, + + wxSize_helper, + wxPoint_helper, + wxRealPoint_helper, + wxRect_helper, + wxColour_helper, + + wxPyCBH_setSelf, + wxPyCBH_findCallback, + wxPyCBH_callCallback, + wxPyCBH_callCallbackObj, + wxPyCBH_delete, +}; + #ifdef __cplusplus extern "C" { #endif @@ -2981,6 +3015,12 @@ SWIGEXPORT(void) initwxc() { SWIG_addvarlink(SWIG_globals,"wxPyDefaultPosition",_wrap_wxPyDefaultPosition_get, _wrap_wxPyDefaultPosition_set); SWIG_addvarlink(SWIG_globals,"wxPyDefaultSize",_wrap_wxPyDefaultSize_get, _wrap_wxPyDefaultSize_set); + // Make our API structure a CObject so other modules can import it + // from this module. + PyObject* v = PyCObject_FromVoidPtr(&API, NULL); + PyDict_SetItemString(d,"wxPyCoreAPI", v); + Py_XDECREF(v); + __wxPreStart(); // initialize the GUI toolkit, if needed. @@ -3008,15 +3048,6 @@ SWIGEXPORT(void) initwxc() { initstreamsc(); initfilesysc(); - initgridc(); - initutilsc(); - inithtmlc(); - inithtmlhelpc(); - initcalendarc(); - - initglcanvasc(); - initoglc(); - initstc_c(); { int i; for (i = 0; _swig_mapping[i].n1; i++) diff --git a/wxPython/src/utils.i b/wxPython/src/utils.i index 7566f336c7..a7646992a4 100644 --- a/wxPython/src/utils.i +++ b/wxPython/src/utils.i @@ -14,7 +14,7 @@ %module utils %{ -#include "helpers.h" +#include "export.h" #include #include #include @@ -34,6 +34,8 @@ //--------------------------------------------------------------------------- %{ + static wxString wxPyEmptyStr(""); + static PyObject* __EnumerationHelper(bool flag, wxString& str, long index) { PyObject* ret = PyTuple_New(3); if (ret) { diff --git a/wxPython/src/wx.i b/wxPython/src/wx.i index 41e0f7f90d..a9078d9b44 100644 --- a/wxPython/src/wx.i +++ b/wxPython/src/wx.i @@ -124,6 +124,8 @@ public: //---------------------------------------------------------------------- %{ + + extern "C" SWIGEXPORT(void) initwindowsc(); extern "C" SWIGEXPORT(void) initwindows2c(); extern "C" SWIGEXPORT(void) initeventsc(); @@ -141,22 +143,60 @@ extern "C" SWIGEXPORT(void) initimagec(); extern "C" SWIGEXPORT(void) initprintfwc(); extern "C" SWIGEXPORT(void) initsizersc(); extern "C" SWIGEXPORT(void) initclip_dndc(); -extern "C" SWIGEXPORT(void) initgridc(); -extern "C" SWIGEXPORT(void) initutilsc(); -extern "C" SWIGEXPORT(void) inithtmlc(); -extern "C" SWIGEXPORT(void) inithtmlhelpc(); -extern "C" SWIGEXPORT(void) initcalendarc(); extern "C" SWIGEXPORT(void) initstreamsc(); extern "C" SWIGEXPORT(void) initfilesysc(); -extern "C" SWIGEXPORT(void) initglcanvasc(); -extern "C" SWIGEXPORT(void) initoglc(); -extern "C" SWIGEXPORT(void) initstc_c(); + + +// Export a C API in a struct. Other modules will be able to load this from +// the wxc module and will then have safe access to these functions, even if +// in another shared library. +static wxPyCoreAPI API = { + SWIG_MakePtr, + SWIG_GetPtr, + SWIG_GetPtrObj, + SWIG_RegisterMapping, + SWIG_addvarlink, + SWIG_newvarlink, + + wxPySaveThread, + wxPyRestoreThread, + wxPyConstructObject, + wxPy_ConvertList, + + byte_LIST_helper, + int_LIST_helper, + long_LIST_helper, + string_LIST_helper, + wxPoint_LIST_helper, + wxBitmap_LIST_helper, + wxString_LIST_helper, + wxAcceleratorEntry_LIST_helper, + + wxSize_helper, + wxPoint_helper, + wxRealPoint_helper, + wxRect_helper, + wxColour_helper, + + wxPyCBH_setSelf, + wxPyCBH_findCallback, + wxPyCBH_callCallback, + wxPyCBH_callCallbackObj, + wxPyCBH_delete, +}; + %} %init %{ + // Make our API structure a CObject so other modules can import it + // from this module. + PyObject* v = PyCObject_FromVoidPtr(&API, NULL); + PyDict_SetItemString(d,"wxPyCoreAPI", v); + Py_XDECREF(v); + __wxPreStart(); // initialize the GUI toolkit, if needed. @@ -184,15 +224,6 @@ extern "C" SWIGEXPORT(void) initstc_c(); initstreamsc(); initfilesysc(); - initgridc(); - initutilsc(); - inithtmlc(); - inithtmlhelpc(); - initcalendarc(); - - initglcanvasc(); - initoglc(); - initstc_c(); %} //----------------------------------------------------------------------