----------------------------------------------------------------------
-2.3b1
+2.3b2
-----
New typemaps for wxString when compiling for Python 2.0 and beyond
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.
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
%module glcanvas
%{
-#include "helpers.h"
+#include "export.h"
#include <wx/glcanvas.h>
%}
%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"
//---------------------------------------------------------------------------
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);
%init %{
- wxClassInfo::CleanUpClasses();
- wxClassInfo::InitializeClasses();
+// wxClassInfo::CleanUpClasses();
+// wxClassInfo::InitializeClasses();
%}
#define SWIG_name "glcanvasc"
-#include "helpers.h"
+#include "export.h"
#include <wx/glcanvas.h>
static PyObject* l_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
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;
d = PyModule_GetDict(m);
- wxClassInfo::CleanUpClasses();
- wxClassInfo::InitializeClasses();
+// wxClassInfo::CleanUpClasses();
+// wxClassInfo::InitializeClasses();
{
int i;
+++ /dev/null
-/* 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() {
-}
-
-
#define SWIG_name "oglc"
-#include "helpers.h"
+#include "export.h"
#include "oglhelpers.h"
static PyObject* l_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; x<count; x++) {
+ PyObject* pyo = PyList_GetItem(pyList, x);
+ wxObject* wxo = NULL;
+
+ if (SWIG_GetPtrObj(pyo, (void **)&wxo, className)) {
+ char errmsg[1024];
+ sprintf(errmsg, "Type error, expected list of %s objects", className);
+ PyErr_SetString(PyExc_TypeError, errmsg);
+ wxPySaveThread(doSave);
+ return NULL;
+ }
+ list->Append(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; x<count; x++) {
+ PyObject* pyo = PyList_GetItem(pyList, x);
+
+ if (PyTuple_Check(pyo)) {
+ PyObject* o1 = PyNumber_Float(PyTuple_GetItem(pyo, 0));
+ PyObject* o2 = PyNumber_Float(PyTuple_GetItem(pyo, 1));
+
+ double val1 = (o1 ? PyFloat_AsDouble(o1) : 0.0);
+ double val2 = (o2 ? PyFloat_AsDouble(o2) : 0.0);
+
+ list->Append((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();
{ "_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},
{ "_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},
{ "_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},
{ "_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},
{ "_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},
{ "_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},
{ "_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},
{ "_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},
initoglcanvasc();
- wxClassInfo::CleanUpClasses();
- wxClassInfo::InitializeClasses();
+// wxClassInfo::CleanUpClasses();
+// wxClassInfo::InitializeClasses();
{
int i;
%module ogl
%{
-#include "helpers.h"
+#include "export.h"
#include "oglhelpers.h"
%}
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; x<count; x++) {
+ PyObject* pyo = PyList_GetItem(pyList, x);
+ wxObject* wxo = NULL;
+
+ if (SWIG_GetPtrObj(pyo, (void **)&wxo, className)) {
+ char errmsg[1024];
+ sprintf(errmsg, "Type error, expected list of %s objects", className);
+ PyErr_SetString(PyExc_TypeError, errmsg);
+ wxPySaveThread(doSave);
+ return NULL;
+ }
+ list->Append(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; x<count; x++) {
+ PyObject* pyo = PyList_GetItem(pyList, x);
+
+ if (PyTuple_Check(pyo)) {
+ PyObject* o1 = PyNumber_Float(PyTuple_GetItem(pyo, 0));
+ PyObject* o2 = PyNumber_Float(PyTuple_GetItem(pyo, 1));
+
+ double val1 = (o1 ? PyFloat_AsDouble(o1) : 0.0);
+ double val2 = (o2 ? PyFloat_AsDouble(o2) : 0.0);
+
+ list->Append((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();
initoglcanvasc();
- wxClassInfo::CleanUpClasses();
- wxClassInfo::InitializeClasses();
+// wxClassInfo::CleanUpClasses();
+// wxClassInfo::InitializeClasses();
%}
#define SWIG_name "oglbasicc"
-#include "helpers.h"
+#include "export.h"
#include "oglhelpers.h"
static PyObject* l_output_helper(PyObject* target, PyObject* o) {
{ "_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},
{ "_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},
{ "_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},
{ "_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},
{ "_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},
{ "_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},
{ "_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},
{ "_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},
%module oglbasic
%{
-#include "helpers.h"
+#include "export.h"
#include "oglhelpers.h"
%}
#define SWIG_name "oglcanvasc"
-#include "helpers.h"
+#include "export.h"
#include "oglhelpers.h"
static PyObject* l_output_helper(PyObject* target, PyObject* o) {
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;
{ "_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},
{ "_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},
{ "_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},
{ "_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},
{ "_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},
{ "_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},
{ "_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},
{ "_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},
%module oglcanvas
%{
-#include "helpers.h"
+#include "export.h"
#include "oglhelpers.h"
%}
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);
+++ /dev/null
-/////////////////////////////////////////////////////////////////////////////
-// 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 <Python.h>
-#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; x<count; x++) {
- PyObject* pyo = PyList_GetItem(pyList, x);
- wxObject* wxo = NULL;
-
- if (SWIG_GetPtrObj(pyo, (void **)&wxo, className)) {
- char errmsg[1024];
- sprintf(errmsg, "Type error, expected list of %s objects", className);
- PyErr_SetString(PyExc_TypeError, errmsg);
- wxPySaveThread(doSave);
- return NULL;
- }
- list->Append(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; x<count; x++) {
- PyObject* pyo = PyList_GetItem(pyList, x);
-
- if (PyTuple_Check(pyo)) {
- PyObject* o1 = PyNumber_Float(PyTuple_GetItem(pyo, 0));
- PyObject* o2 = PyNumber_Float(PyTuple_GetItem(pyo, 1));
-
- double val1 = (o1 ? PyFloat_AsDouble(o1) : 0.0);
- double val2 = (o2 ? PyFloat_AsDouble(o2) : 0.0);
-
- list->Append((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;
-}
-
-
-//---------------------------------------------------------------------------
-
-
-
-
-
-
-
-
-
#define SWIG_name "oglshapesc"
-#include "helpers.h"
+#include "export.h"
#include "oglhelpers.h"
static PyObject* l_output_helper(PyObject* target, PyObject* o) {
{ "_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},
{ "_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},
{ "_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},
{ "_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},
{ "_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},
{ "_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},
{ "_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},
{ "_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},
%module oglshapes
%{
-#include "helpers.h"
+#include "export.h"
#include "oglhelpers.h"
%}
#define SWIG_name "oglshapes2c"
-#include "helpers.h"
+#include "export.h"
#include "oglhelpers.h"
static PyObject* l_output_helper(PyObject* target, PyObject* o) {
{ "_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},
{ "_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},
{ "_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},
{ "_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},
{ "_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},
{ "_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},
{ "_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},
{ "_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},
%module oglshapes2
%{
-#include "helpers.h"
+#include "export.h"
#include "oglhelpers.h"
%}
+++ /dev/null
-/* 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() {
-}
-
-
#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) {
{ "_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},
{ "_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},
{ "_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},
{ "_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},
{ "_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},
{ "_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},
{ "_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},
{ "_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},
PyDict_SetItemString(d,"wxEVT_STC_POSCHANGED", PyInt_FromLong((long) wxEVT_STC_POSCHANGED));
- wxClassInfo::CleanUpClasses();
- wxClassInfo::InitializeClasses();
+// wxClassInfo::CleanUpClasses();
+// wxClassInfo::InitializeClasses();
{
int i;
%{
-#include "helpers.h"
+#include "export.h"
#include "wx/stc/stc.h"
%}
// Get all our defs from the REAL header file.
%include stc.h
-//%include SciLexer.h
//----------------------------------------------------------------------
// Python functions to act like the event macros
%init %{
- wxClassInfo::CleanUpClasses();
- wxClassInfo::InitializeClasses();
+// wxClassInfo::CleanUpClasses();
+// wxClassInfo::InitializeClasses();
%}
+++ /dev/null
-/* 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() {
-}
-
-
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()
- ##------------------------------------------------------------
- ## 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 ()
-
#----------------------------------------------------------------------
# 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"
WXPLAT = '__WXMSW__'
GENDIR = 'msw'
-
-
if debug:
FINAL = 0
HYBRID = 0
if HYBRID:
FINAL = 0
-
includes = ['src',
os.path.join(WXDIR, 'include'),
]
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:
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,
rc_file = []
-wxext = ext = Extension('wxc', ['src/helpers.cpp',
+ext = Extension('wxc', ['src/helpers.cpp',
'src/libpy.c',
] + rc_file + swig_sources,
extra_compile_args = cflags,
extra_link_args = lflags,
)
+wxpExtensions.append(ext)
+# 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)
-if os.name == 'nt':
- libs = libs[:]
- if debug:
- libs.insert(0, 'wxc_d')
- else:
- libs.insert(0, 'wxc')
#----------------------------------------------------------------------
# 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':
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)
#----------------------------------------------------------------------
#----------------------------------------------------------------------
-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'
'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
-
- wxext.include_dirs = wxext.include_dirs + [OGLINC]
+ 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)
+
+
#----------------------------------------------------------------------
# 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'
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,
'%s/PlatWX.cpp' % STCLOC,
'%s/ScintillaWX.cpp' % STCLOC,
'%s/stc.cpp' % STCLOC,
- ] + swig_sources
+ ] + swig_sources,
+
+ include_dirs = stc_includes,
+ define_macros = stc_defines,
+
+ library_dirs = libdirs,
+ libraries = libs,
- wxext.include_dirs = wxext.include_dirs + stc_includes
- wxext.define_macros = wxext.define_macros + stc_defines
+ extra_compile_args = cflags,
+ extra_link_args = lflags,
+ )
+
+ wxpExtensions.append(ext)
#----------------------------------------------------------------------
#----------------------------------------------------------------------
#----------------------------------------------------------------------
-
-# 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':
## 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,
-## )
+## wxext.sources = wxext.sources + swig_sources
+## wxext.libraries = wxext.libraries + gl_libs
-## wxpExtensions.append(ext)
-
-
-## 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'
## '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,
-
-## include_dirs = [OGLINC] + includes,
-## define_macros = defines,
+## # 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
-## library_dirs = libdirs,
-## libraries = libs,
+## wxext.include_dirs = wxext.include_dirs + [OGLINC]
-## extra_compile_args = cflags,
-## extra_link_args = lflags,
-## )
-## wxpExtensions.append(ext)
-
-## 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'
## 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,
## '%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
-ver = '2.3b1'
+ver = '2.3b2'
%{
-#include "helpers.h"
+#include "export.h"
#include <wx/calctrl.h>
%}
--- /dev/null
+////////////////////////////////////////////////////////////////////////////
+// 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
#ifndef OLD_GRID
%{
-#include "helpers.h"
+#include "export.h"
#include <wx/grid.h>
%}
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; \
#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 \
#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 \
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; \
}
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; \
}
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); \
#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); \
}
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); \
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); \
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); \
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); \
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); \
#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); \
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); \
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); \
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); \
#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); \
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); \
#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); \
#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); \
#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); \
#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); \
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);
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"))
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;
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);
}
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);
}
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;
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;
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);
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);
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);
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);
}
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) {
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) {
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);
}
//---------------------------------------------------------------------------
PyObject* wxPyConstructObject(void* ptr,
- const char* className,
- int setThisOwn) {
+ const char* className,
+ int setThisOwn) {
PyObject* obj;
PyObject* arg;
//---------------------------------------------------------------------------
-static unsigned int _wxPyNestCount = 0;
-
static PyThreadState* myPyThreadState_Get() {
PyThreadState* current;
current = PyThreadState_Swap(NULL);
// already have the lock. (I hope!)
//
#ifdef WXP_WITH_THREAD
- _wxPyNestCount += 1;
if (wxPyEventThreadState != myPyThreadState_Get()) {
PyEval_RestoreThread(wxPyEventThreadState);
return TRUE;
if (doSave) {
wxPyEventThreadState = PyEval_SaveThread();
}
- _wxPyNestCount -= 1;
#endif
}
//----------------------------------------------------------------------
-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;
}
+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);
+}
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
-#if defined(__WXMSW__)
-# define HELPEREXPORT __declspec(dllexport)
-#else
-# define HELPEREXPORT
-#endif
-
typedef unsigned char byte;
-//----------------------------------------------------------------------
class wxPyApp: public wxApp
{
~wxPyApp();
int MainLoop(void);
bool OnInit(void);
-//# void AfterMainLoop(void);
};
-
extern wxPyApp *wxPythonApp;
//----------------------------------------------------------------------
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
// 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;
//----------------------------------------------------------------------
// 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);
-
-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);
+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);
+
+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);
//----------------------------------------------------------------------
};
//---------------------------------------------------------------------------
-
-
-
-
-//---------------------------------------------------------------------------
-// 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
};
+//---------------------------------------------------------------------------
+// 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
#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
#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); \
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); \
#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); \
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); \
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; \
#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 \
#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 \
#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 \
#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); \
#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); \
#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 \
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 \
#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); \
#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 \
#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 \
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 \
#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 \
#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); \
#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); \
#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); \
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); \
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; \
} \
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); \
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); \
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); \
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); \
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); \
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); \
#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); \
}
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; \
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 \
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); \
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); \
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"); \
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); \
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; \
} \
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; \
} \
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); \
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; \
#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 \
#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 \
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 \
%module html
%{
-#include "helpers.h"
+#include "export.h"
#include <wx/html/htmlwin.h>
#include <wx/html/htmprint.h>
#include <wx/image.h>
%extern utils.i
-//---------------------------------------------------------------------------
-
-%{
-// #ifdef __WXMSW__
-// wxString wxPyEmptyStr("");
-// wxPoint wxPyDefaultPosition(wxDefaultPosition);
-// wxSize wxPyDefaultSize(wxDefaultSize);
-// #endif
-%}
-
%pragma(python) code = "import wx"
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
%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");
%module htmlhelp
%{
-#include "helpers.h"
+#include "export.h"
#include <wx/html/htmlwin.h>
#include <wx/html/helpctrl.h>
#include <wx/image.h>
// 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);
//----------------------------------------------------------------------
#define SWIG_name "calendarc"
-#include "helpers.h"
+#include "export.h"
#include <wx/calctrl.h>
static PyObject* l_output_helper(PyObject* target, PyObject* o) {
#define SWIG_name "gridc"
-#include "helpers.h"
+#include "export.h"
#include <wx/grid.h>
static PyObject* l_output_helper(PyObject* target, PyObject* o) {
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; \
#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 \
#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 \
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; \
}
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; \
}
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); \
#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); \
}
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); \
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); \
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); \
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); \
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); \
#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); \
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); \
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); \
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); \
#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); \
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); \
#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); \
#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); \
#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); \
#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); \
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);
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"))
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;
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);
}
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);
}
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;
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;
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);
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);
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);
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);
}
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) {
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) {
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);
}
#define SWIG_name "htmlc"
-#include "helpers.h"
+#include "export.h"
#include <wx/html/htmlwin.h>
#include <wx/html/htmprint.h>
#include <wx/image.h>
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() {};
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
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;
#define SWIG_name "htmlhelpc"
-#include "helpers.h"
+#include "export.h"
#include <wx/html/htmlwin.h>
#include <wx/html/helpctrl.h>
#include <wx/image.h>
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;
{ "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 },
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):
#define SWIG_name "utilsc"
-#include "helpers.h"
+#include "export.h"
#include <wx/config.h>
#include <wx/fileconf.h>
#include <wx/datetime.h>
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) {
__wxCleanup();
}
+
+
extern "C" SWIGEXPORT(void) initwindowsc();
extern "C" SWIGEXPORT(void) initwindows2c();
extern "C" SWIGEXPORT(void) initeventsc();
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
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.
initstreamsc();
initfilesysc();
- initgridc();
- initutilsc();
- inithtmlc();
- inithtmlhelpc();
- initcalendarc();
-
- initglcanvasc();
- initoglc();
- initstc_c();
{
int i;
for (i = 0; _swig_mapping[i].n1; i++)
%module utils
%{
-#include "helpers.h"
+#include "export.h"
#include <wx/config.h>
#include <wx/fileconf.h>
#include <wx/datetime.h>
//---------------------------------------------------------------------------
%{
+ static wxString wxPyEmptyStr("");
+
static PyObject* __EnumerationHelper(bool flag, wxString& str, long index) {
PyObject* ret = PyTuple_New(3);
if (ret) {
//----------------------------------------------------------------------
%{
+
+
extern "C" SWIGEXPORT(void) initwindowsc();
extern "C" SWIGEXPORT(void) initwindows2c();
extern "C" SWIGEXPORT(void) initeventsc();
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.
initstreamsc();
initfilesysc();
- initgridc();
- initutilsc();
- inithtmlc();
- inithtmlhelpc();
- initcalendarc();
-
- initglcanvasc();
- initoglc();
- initstc_c();
%}
//----------------------------------------------------------------------