Fixed a bunch of embarassing reference leaks
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@15848 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -121,6 +121,16 @@ supported are:
|
|||||||
Changed wxGenButton to derive from wxPyControl and overload
|
Changed wxGenButton to derive from wxPyControl and overload
|
||||||
DoGetBestSize and AcceptsFocus.
|
DoGetBestSize and AcceptsFocus.
|
||||||
|
|
||||||
|
Added wxArtProvider.
|
||||||
|
|
||||||
|
Added wxCallAfter which is a helper function that registers a function
|
||||||
|
(or any callable Python object) to be called one time the next time
|
||||||
|
there are no pending events. This is useful for when you need to do
|
||||||
|
something but it can't be done during the current event handler. The
|
||||||
|
implementation is very simple, see wxPython/wx.py.
|
||||||
|
|
||||||
|
Fixed a boatload of reference leaks.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@@ -288,8 +288,9 @@ wxBitmap wxPyBitmapDataObject::GetBitmap() {
|
|||||||
void wxPyBitmapDataObject::SetBitmap(const wxBitmap& bitmap) {
|
void wxPyBitmapDataObject::SetBitmap(const wxBitmap& bitmap) {
|
||||||
wxPyBeginBlockThreads();
|
wxPyBeginBlockThreads();
|
||||||
if (m_myInst.findCallback("SetBitmap")) {
|
if (m_myInst.findCallback("SetBitmap")) {
|
||||||
m_myInst.callCallback(Py_BuildValue("(O)",
|
PyObject* bo = wxPyConstructObject((void*)&bitmap, "wxBitmap");
|
||||||
wxPyConstructObject((void*)&bitmap, "wxBitmap")));
|
m_myInst.callCallback(Py_BuildValue("(O)", bo));
|
||||||
|
Py_DECREF(bo);
|
||||||
}
|
}
|
||||||
wxPyEndBlockThreads();
|
wxPyEndBlockThreads();
|
||||||
}
|
}
|
||||||
@@ -625,10 +626,11 @@ bool wxPyFileDropTarget::OnDropFiles(wxCoord x, wxCoord y,
|
|||||||
const wxArrayString& filenames) {
|
const wxArrayString& filenames) {
|
||||||
bool rval = FALSE;
|
bool rval = FALSE;
|
||||||
wxPyBeginBlockThreads();
|
wxPyBeginBlockThreads();
|
||||||
PyObject* list = wxArrayString2PyList_helper(filenames);
|
if (m_myInst.findCallback("OnDropFiles")) {
|
||||||
if (m_myInst.findCallback("OnDropFiles"))
|
PyObject* list = wxArrayString2PyList_helper(filenames);
|
||||||
rval = m_myInst.callCallback(Py_BuildValue("(iiO)",x,y,list));
|
rval = m_myInst.callCallback(Py_BuildValue("(iiO)",x,y,list));
|
||||||
Py_DECREF(list);
|
Py_DECREF(list);
|
||||||
|
}
|
||||||
wxPyEndBlockThreads();
|
wxPyEndBlockThreads();
|
||||||
return rval;
|
return rval;
|
||||||
}
|
}
|
||||||
|
@@ -1075,11 +1075,13 @@ public:
|
|||||||
int rval = 0;
|
int rval = 0;
|
||||||
bool found;
|
bool found;
|
||||||
wxPyBeginBlockThreads();
|
wxPyBeginBlockThreads();
|
||||||
if ((found = m_myInst.findCallback("OnCompareItems")))
|
if ((found = m_myInst.findCallback("OnCompareItems"))) {
|
||||||
rval = m_myInst.callCallback(Py_BuildValue(
|
PyObject *o1 = wxPyConstructObject((void*)&item1, "wxTreeItemId");
|
||||||
"(OO)",
|
PyObject *o2 = wxPyConstructObject((void*)&item2, "wxTreeItemId");
|
||||||
wxPyConstructObject((void*)&item1, "wxTreeItemId"),
|
rval = m_myInst.callCallback(Py_BuildValue("(OO)",o1,o2));
|
||||||
wxPyConstructObject((void*)&item2, "wxTreeItemId")));
|
Py_DECREF(o1);
|
||||||
|
Py_DECREF(o2);
|
||||||
|
}
|
||||||
wxPyEndBlockThreads();
|
wxPyEndBlockThreads();
|
||||||
if (! found)
|
if (! found)
|
||||||
rval = wxTreeCtrl::OnCompareItems(item1, item2);
|
rval = wxTreeCtrl::OnCompareItems(item1, item2);
|
||||||
|
@@ -45,6 +45,50 @@
|
|||||||
%}
|
%}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
// OOR related typemaps and helper functions
|
||||||
|
|
||||||
|
%typemap(python, out) wxGridCellRenderer* { $target = wxPyMake_wxGridCellRenderer($source); }
|
||||||
|
%typemap(python, out) wxGridCellEditor* { $target = wxPyMake_wxGridCellEditor($source); }
|
||||||
|
%typemap(python, out) wxGridCellAttr* { $target = wxPyMake_wxGridCellAttr($source); }
|
||||||
|
%typemap(python, out) wxGridCellAttrProvider* { $target = wxPyMake_wxGridCellAttrProvider($source); }
|
||||||
|
%typemap(python, out) wxGridTableBase* { $target = wxPyMake_wxGridTableBase($source); }
|
||||||
|
|
||||||
|
|
||||||
|
%{
|
||||||
|
|
||||||
|
#define wxPyMake_TEMPLATE(TYPE) \
|
||||||
|
PyObject* wxPyMake_##TYPE(TYPE* source) { \
|
||||||
|
PyObject* target = NULL; \
|
||||||
|
if (source) { \
|
||||||
|
/* Check if there is already a pointer to a Python object in the \
|
||||||
|
OOR data that we can use. */ \
|
||||||
|
wxPyOORClientData* data = (wxPyOORClientData*)source->GetClientObject(); \
|
||||||
|
if (data) { \
|
||||||
|
target = data->m_obj; \
|
||||||
|
Py_INCREF(target); \
|
||||||
|
} \
|
||||||
|
/* Otherwise make a new wrapper for it the old fashioned way and \
|
||||||
|
give it the OOR treatment */ \
|
||||||
|
if (! target) { \
|
||||||
|
target = wxPyConstructObject(source, #TYPE, FALSE); \
|
||||||
|
if (target) \
|
||||||
|
source->SetClientObject(new wxPyOORClientData(target)); \
|
||||||
|
} \
|
||||||
|
} else { /* source was NULL so return None. */ \
|
||||||
|
Py_INCREF(Py_None); target = Py_None; \
|
||||||
|
} \
|
||||||
|
return target; \
|
||||||
|
} \
|
||||||
|
|
||||||
|
|
||||||
|
wxPyMake_TEMPLATE(wxGridCellRenderer)
|
||||||
|
wxPyMake_TEMPLATE(wxGridCellEditor)
|
||||||
|
wxPyMake_TEMPLATE(wxGridCellAttr)
|
||||||
|
wxPyMake_TEMPLATE(wxGridCellAttrProvider)
|
||||||
|
wxPyMake_TEMPLATE(wxGridTableBase)
|
||||||
|
|
||||||
|
%}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
// Macros, similar to what's in helpers.h, to aid in the creation of
|
// Macros, similar to what's in helpers.h, to aid in the creation of
|
||||||
// virtual methods that are able to make callbacks to Python. Many of these
|
// virtual methods that are able to make callbacks to Python. Many of these
|
||||||
@@ -81,14 +125,14 @@
|
|||||||
|
|
||||||
#define PYCALLBACK__GCAINTINT(PCLASS, CBNAME) \
|
#define PYCALLBACK__GCAINTINT(PCLASS, CBNAME) \
|
||||||
void CBNAME(wxGridCellAttr *attr, int a, int b) { \
|
void CBNAME(wxGridCellAttr *attr, int a, int b) { \
|
||||||
wxPyBeginBlockThreads(); \
|
wxPyBeginBlockThreads(); \
|
||||||
bool found; \
|
bool found; \
|
||||||
if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
|
if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
|
||||||
PyObject* obj = wxPyConstructObject((void*)attr, "wxGridCellAttr", 0);\
|
PyObject* obj = wxPyMake_wxGridCellAttr(attr); \
|
||||||
wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oii)", obj, a, b)); \
|
wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oii)", obj, a, b)); \
|
||||||
Py_DECREF(obj); \
|
Py_DECREF(obj); \
|
||||||
} \
|
} \
|
||||||
wxPyEndBlockThreads(); \
|
wxPyEndBlockThreads(); \
|
||||||
if (! found) \
|
if (! found) \
|
||||||
PCLASS::CBNAME(attr, a, b); \
|
PCLASS::CBNAME(attr, a, b); \
|
||||||
} \
|
} \
|
||||||
@@ -100,10 +144,10 @@
|
|||||||
|
|
||||||
#define PYCALLBACK__GCAINT(PCLASS, CBNAME) \
|
#define PYCALLBACK__GCAINT(PCLASS, CBNAME) \
|
||||||
void CBNAME(wxGridCellAttr *attr, int val) { \
|
void CBNAME(wxGridCellAttr *attr, int val) { \
|
||||||
wxPyBeginBlockThreads(); \
|
wxPyBeginBlockThreads(); \
|
||||||
bool found; \
|
bool found; \
|
||||||
if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
|
if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
|
||||||
PyObject* obj = wxPyConstructObject((void*)attr, "wxGridCellAttr", 0);\
|
PyObject* obj = wxPyMake_wxGridCellAttr(attr); \
|
||||||
wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oi)", obj, val)); \
|
wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oi)", obj, val)); \
|
||||||
Py_DECREF(obj); \
|
Py_DECREF(obj); \
|
||||||
} \
|
} \
|
||||||
@@ -160,8 +204,11 @@
|
|||||||
#define PYCALLBACK__INTINTSTRING_pure(CBNAME) \
|
#define PYCALLBACK__INTINTSTRING_pure(CBNAME) \
|
||||||
void CBNAME(int a, int b, const wxString& c) { \
|
void CBNAME(int a, int b, const wxString& c) { \
|
||||||
wxPyBeginBlockThreads(); \
|
wxPyBeginBlockThreads(); \
|
||||||
if (wxPyCBH_findCallback(m_myInst, #CBNAME)) \
|
if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
|
||||||
wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iiO)",a,b,wx2PyString(c)));\
|
PyObject* s = wx2PyString(c); \
|
||||||
|
rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iiO)",a,b,s));\
|
||||||
|
Py_DECREF(s); \
|
||||||
|
} \
|
||||||
wxPyEndBlockThreads(); \
|
wxPyEndBlockThreads(); \
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -194,8 +241,11 @@
|
|||||||
bool rval = 0; \
|
bool rval = 0; \
|
||||||
bool found; \
|
bool found; \
|
||||||
wxPyBeginBlockThreads(); \
|
wxPyBeginBlockThreads(); \
|
||||||
if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
|
if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
|
||||||
rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iiO)", a,b,wx2PyString(c)));\
|
PyObject* s = wx2PyString(c); \
|
||||||
|
rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iiO)",a,b,s));\
|
||||||
|
Py_DECREF(s); \
|
||||||
|
} \
|
||||||
wxPyEndBlockThreads(); \
|
wxPyEndBlockThreads(); \
|
||||||
if (! found) \
|
if (! found) \
|
||||||
rval = PCLASS::CBNAME(a,b,c); \
|
rval = PCLASS::CBNAME(a,b,c); \
|
||||||
@@ -258,7 +308,7 @@
|
|||||||
Py_DECREF(ro); Py_DECREF(str); \
|
Py_DECREF(ro); Py_DECREF(str); \
|
||||||
} \
|
} \
|
||||||
} \
|
} \
|
||||||
wxPyEndBlockThreads(); \
|
wxPyEndBlockThreads(); \
|
||||||
if (! found) \
|
if (! found) \
|
||||||
rval = PCLASS::CBNAME(a, b); \
|
rval = PCLASS::CBNAME(a, b); \
|
||||||
return rval; \
|
return rval; \
|
||||||
@@ -272,10 +322,10 @@
|
|||||||
#define PYCALLBACK__(PCLASS, CBNAME) \
|
#define PYCALLBACK__(PCLASS, CBNAME) \
|
||||||
void CBNAME() { \
|
void CBNAME() { \
|
||||||
bool found; \
|
bool found; \
|
||||||
wxPyBeginBlockThreads(); \
|
wxPyBeginBlockThreads(); \
|
||||||
if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
|
if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
|
||||||
wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \
|
wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \
|
||||||
wxPyEndBlockThreads(); \
|
wxPyEndBlockThreads(); \
|
||||||
if (! found) \
|
if (! found) \
|
||||||
PCLASS::CBNAME(); \
|
PCLASS::CBNAME(); \
|
||||||
} \
|
} \
|
||||||
@@ -290,10 +340,10 @@
|
|||||||
bool CBNAME(size_t a, size_t b) { \
|
bool CBNAME(size_t a, size_t b) { \
|
||||||
bool rval = 0; \
|
bool rval = 0; \
|
||||||
bool found; \
|
bool found; \
|
||||||
wxPyBeginBlockThreads(); \
|
wxPyBeginBlockThreads(); \
|
||||||
if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
|
if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
|
||||||
rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ii)", a,b)); \
|
rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ii)", a,b)); \
|
||||||
wxPyEndBlockThreads(); \
|
wxPyEndBlockThreads(); \
|
||||||
if (! found) \
|
if (! found) \
|
||||||
rval = PCLASS::CBNAME(a,b); \
|
rval = PCLASS::CBNAME(a,b); \
|
||||||
return rval; \
|
return rval; \
|
||||||
@@ -308,10 +358,10 @@
|
|||||||
bool CBNAME(size_t a) { \
|
bool CBNAME(size_t a) { \
|
||||||
bool rval = 0; \
|
bool rval = 0; \
|
||||||
bool found; \
|
bool found; \
|
||||||
wxPyBeginBlockThreads(); \
|
wxPyBeginBlockThreads(); \
|
||||||
if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
|
if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
|
||||||
rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(i)", a)); \
|
rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(i)", a)); \
|
||||||
wxPyEndBlockThreads(); \
|
wxPyEndBlockThreads(); \
|
||||||
if (! found) \
|
if (! found) \
|
||||||
rval = PCLASS::CBNAME(a); \
|
rval = PCLASS::CBNAME(a); \
|
||||||
return rval; \
|
return rval; \
|
||||||
@@ -348,8 +398,11 @@
|
|||||||
void CBNAME(int a, const wxString& c) { \
|
void CBNAME(int a, const wxString& c) { \
|
||||||
bool found; \
|
bool found; \
|
||||||
wxPyBeginBlockThreads(); \
|
wxPyBeginBlockThreads(); \
|
||||||
if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
|
if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
|
||||||
wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iO)", a, wx2PyString(c))); \
|
PyObject* s = wx2PyString(c); \
|
||||||
|
wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iO)",a,s)); \
|
||||||
|
Py_DECREF(s); \
|
||||||
|
} \
|
||||||
wxPyEndBlockThreads(); \
|
wxPyEndBlockThreads(); \
|
||||||
if (! found) \
|
if (! found) \
|
||||||
PCLASS::CBNAME(a,c); \
|
PCLASS::CBNAME(a,c); \
|
||||||
@@ -446,50 +499,6 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
%}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
|
||||||
// OOR related typemaps and helper functions
|
|
||||||
|
|
||||||
%typemap(python, out) wxGridCellRenderer* { $target = wxPyMake_wxGridCellRenderer($source); }
|
|
||||||
%typemap(python, out) wxGridCellEditor* { $target = wxPyMake_wxGridCellEditor($source); }
|
|
||||||
%typemap(python, out) wxGridCellAttr* { $target = wxPyMake_wxGridCellAttr($source); }
|
|
||||||
%typemap(python, out) wxGridCellAttrProvider* { $target = wxPyMake_wxGridCellAttrProvider($source); }
|
|
||||||
%typemap(python, out) wxGridTableBase* { $target = wxPyMake_wxGridTableBase($source); }
|
|
||||||
|
|
||||||
%{
|
|
||||||
|
|
||||||
|
|
||||||
#define wxPyMake_TEMPLATE(TYPE) \
|
|
||||||
PyObject* wxPyMake_##TYPE(TYPE* source) { \
|
|
||||||
PyObject* target = NULL; \
|
|
||||||
if (source) { \
|
|
||||||
/* Check if there is already a pointer to a Python object in the \
|
|
||||||
OOR data that we can use. */ \
|
|
||||||
wxPyOORClientData* data = (wxPyOORClientData*)source->GetClientObject(); \
|
|
||||||
if (data) { \
|
|
||||||
target = data->m_obj; \
|
|
||||||
Py_INCREF(target); \
|
|
||||||
} \
|
|
||||||
/* Otherwise make a new wrapper for it the old fashioned way and \
|
|
||||||
give it the OOR treatment */ \
|
|
||||||
if (! target) { \
|
|
||||||
target = wxPyConstructObject(source, #TYPE, FALSE); \
|
|
||||||
if (target) \
|
|
||||||
source->SetClientObject(new wxPyOORClientData(target)); \
|
|
||||||
} \
|
|
||||||
} else { /* source was NULL so return None. */ \
|
|
||||||
Py_INCREF(Py_None); target = Py_None; \
|
|
||||||
} \
|
|
||||||
return target; \
|
|
||||||
} \
|
|
||||||
|
|
||||||
wxPyMake_TEMPLATE(wxGridCellRenderer)
|
|
||||||
wxPyMake_TEMPLATE(wxGridCellEditor)
|
|
||||||
wxPyMake_TEMPLATE(wxGridCellAttr)
|
|
||||||
wxPyMake_TEMPLATE(wxGridCellAttrProvider)
|
|
||||||
wxPyMake_TEMPLATE(wxGridTableBase)
|
|
||||||
|
|
||||||
%}
|
%}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
@@ -559,13 +568,17 @@ public:
|
|||||||
int row, int col, bool isSelected) {
|
int row, int col, bool isSelected) {
|
||||||
wxPyBeginBlockThreads();
|
wxPyBeginBlockThreads();
|
||||||
if (wxPyCBH_findCallback(m_myInst, "Draw")) {
|
if (wxPyCBH_findCallback(m_myInst, "Draw")) {
|
||||||
wxPyCBH_callCallback(m_myInst,
|
PyObject* go = wxPyMake_wxObject(&grid);
|
||||||
Py_BuildValue("(OOOOiii)",
|
PyObject* dco = wxPyMake_wxObject(&dc);
|
||||||
wxPyConstructObject((void*)&grid, "wxGrid", 0),
|
PyObject* ao = wxPyMake_wxGridCellAttr(&attr);
|
||||||
wxPyConstructObject((void*)&attr, "wxGridCellAttr", 0),
|
PyObject* ro = wxPyConstructObject((void*)&rect, "wxRect", 0);
|
||||||
wxPyConstructObject((void*)&dc, "wxDC", 0),
|
|
||||||
wxPyConstructObject((void*)&rect, "wxRect", 0),
|
wxPyCBH_callCallback(m_myInst, Py_BuildValue("(OOOOiii)", go, ao, dco, ro,
|
||||||
row, col, isSelected));
|
row, col, isSelected));
|
||||||
|
Py_DECREF(go);
|
||||||
|
Py_DECREF(ao);
|
||||||
|
Py_DECREF(dco);
|
||||||
|
Py_DECREF(ro);
|
||||||
}
|
}
|
||||||
wxPyEndBlockThreads();
|
wxPyEndBlockThreads();
|
||||||
}
|
}
|
||||||
@@ -577,12 +590,17 @@ public:
|
|||||||
if (wxPyCBH_findCallback(m_myInst, "GetBestSize")) {
|
if (wxPyCBH_findCallback(m_myInst, "GetBestSize")) {
|
||||||
PyObject* ro;
|
PyObject* ro;
|
||||||
wxSize* ptr;
|
wxSize* ptr;
|
||||||
ro = wxPyCBH_callCallbackObj(m_myInst,
|
PyObject* go = wxPyMake_wxObject(&grid);
|
||||||
Py_BuildValue("(OOOii)",
|
PyObject* dco = wxPyMake_wxObject(&dc);
|
||||||
wxPyConstructObject((void*)&grid, "wxGrid", 0),
|
PyObject* ao = wxPyMake_wxGridCellAttr(&attr);
|
||||||
wxPyConstructObject((void*)&attr, "wxGridCellAttr", 0),
|
|
||||||
wxPyConstructObject((void*)&dc, "wxDC", 0),
|
ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(OOOii)",
|
||||||
row, col));
|
go, ao, dco,
|
||||||
|
row, col));
|
||||||
|
Py_DECREF(go);
|
||||||
|
Py_DECREF(ao);
|
||||||
|
Py_DECREF(dco);
|
||||||
|
|
||||||
if (ro) {
|
if (ro) {
|
||||||
const char* errmsg = "GetBestSize should return a 2-tuple of integers or a wxSize object.";
|
const char* errmsg = "GetBestSize should return a 2-tuple of integers or a wxSize object.";
|
||||||
if (!SWIG_GetPtrObj(ro, (void **)&ptr, "_wxSize_p")) {
|
if (!SWIG_GetPtrObj(ro, (void **)&ptr, "_wxSize_p")) {
|
||||||
@@ -763,11 +781,12 @@ public:
|
|||||||
void Create(wxWindow* parent, wxWindowID id, wxEvtHandler* evtHandler) {
|
void Create(wxWindow* parent, wxWindowID id, wxEvtHandler* evtHandler) {
|
||||||
wxPyBeginBlockThreads();
|
wxPyBeginBlockThreads();
|
||||||
if (wxPyCBH_findCallback(m_myInst, "Create")) {
|
if (wxPyCBH_findCallback(m_myInst, "Create")) {
|
||||||
wxPyCBH_callCallback(m_myInst,
|
PyObject* po = wxPyMake_wxObject(parent);
|
||||||
Py_BuildValue("(OiO)",
|
PyObject* eo = wxPyMake_wxObject(evtHandler);
|
||||||
wxPyConstructObject((void*)parent, "wxWindow", 0),
|
|
||||||
id,
|
wxPyCBH_callCallback(m_myInst, Py_BuildValue("(OiO)", po, id, eo));
|
||||||
wxPyConstructObject((void*)evtHandler, "wxEvtHandler", 0)));
|
Py_DECREF(po);
|
||||||
|
Py_DECREF(eo);
|
||||||
}
|
}
|
||||||
wxPyEndBlockThreads();
|
wxPyEndBlockThreads();
|
||||||
}
|
}
|
||||||
@@ -776,9 +795,9 @@ public:
|
|||||||
void BeginEdit(int row, int col, wxGrid* grid) {
|
void BeginEdit(int row, int col, wxGrid* grid) {
|
||||||
wxPyBeginBlockThreads();
|
wxPyBeginBlockThreads();
|
||||||
if (wxPyCBH_findCallback(m_myInst, "BeginEdit")) {
|
if (wxPyCBH_findCallback(m_myInst, "BeginEdit")) {
|
||||||
wxPyCBH_callCallback(m_myInst,
|
PyObject* go = wxPyMake_wxObject(grid);
|
||||||
Py_BuildValue("(iiO)", row, col,
|
wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iiO)", row, col, go));
|
||||||
wxPyConstructObject((void*)grid, "wxGrid", 0)));
|
Py_DECREF(go);
|
||||||
}
|
}
|
||||||
wxPyEndBlockThreads();
|
wxPyEndBlockThreads();
|
||||||
}
|
}
|
||||||
@@ -788,9 +807,9 @@ public:
|
|||||||
bool rv = FALSE;
|
bool rv = FALSE;
|
||||||
wxPyBeginBlockThreads();
|
wxPyBeginBlockThreads();
|
||||||
if (wxPyCBH_findCallback(m_myInst, "EndEdit")) {
|
if (wxPyCBH_findCallback(m_myInst, "EndEdit")) {
|
||||||
rv = wxPyCBH_callCallback(m_myInst,
|
PyObject* go = wxPyMake_wxObject(grid);
|
||||||
Py_BuildValue("(iiO)", row, col,
|
rv = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iiO)", row, col, go));
|
||||||
wxPyConstructObject((void*)grid, "wxGrid", 0)));
|
Py_DECREF(go);
|
||||||
}
|
}
|
||||||
wxPyEndBlockThreads();
|
wxPyEndBlockThreads();
|
||||||
return rv;
|
return rv;
|
||||||
@@ -818,10 +837,11 @@ public:
|
|||||||
void Show(bool show, wxGridCellAttr *attr) {
|
void Show(bool show, wxGridCellAttr *attr) {
|
||||||
bool found;
|
bool found;
|
||||||
wxPyBeginBlockThreads();
|
wxPyBeginBlockThreads();
|
||||||
if ((found = wxPyCBH_findCallback(m_myInst, "Show")))
|
if ((found = wxPyCBH_findCallback(m_myInst, "Show"))) {
|
||||||
wxPyCBH_callCallback(m_myInst,
|
PyObject* ao = wxPyMake_wxGridCellAttr(attr);
|
||||||
Py_BuildValue("(iO)", show,
|
wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iO)", show, ao));
|
||||||
wxPyConstructObject((void*)attr, "wxGridCellAttr", 0)));
|
Py_DECREF(ao);
|
||||||
|
}
|
||||||
wxPyEndBlockThreads();
|
wxPyEndBlockThreads();
|
||||||
if (! found)
|
if (! found)
|
||||||
wxGridCellEditor::Show(show, attr);
|
wxGridCellEditor::Show(show, attr);
|
||||||
@@ -832,13 +852,17 @@ public:
|
|||||||
|
|
||||||
|
|
||||||
void PaintBackground(const wxRect& rectCell, wxGridCellAttr *attr) {
|
void PaintBackground(const wxRect& rectCell, wxGridCellAttr *attr) {
|
||||||
bool found; \
|
bool found;
|
||||||
wxPyBeginBlockThreads();
|
wxPyBeginBlockThreads();
|
||||||
if ((found = wxPyCBH_findCallback(m_myInst, "PaintBackground)")))
|
if ((found = wxPyCBH_findCallback(m_myInst, "PaintBackground)"))) {
|
||||||
wxPyCBH_callCallback(m_myInst,
|
PyObject* ao = wxPyMake_wxGridCellAttr(attr);
|
||||||
Py_BuildValue("(OO)",
|
PyObject* ro = wxPyConstructObject((void*)&rectCell, "wxRect", 0);
|
||||||
wxPyConstructObject((void*)&rectCell, "wxRect", 0),
|
|
||||||
wxPyConstructObject((void*)attr, "wxGridCellAttr", 0)));
|
wxPyCBH_callCallback(m_myInst, Py_BuildValue("(OO)", ro, ao));
|
||||||
|
|
||||||
|
Py_DECREF(ro);
|
||||||
|
Py_DECREF(ao);
|
||||||
|
}
|
||||||
wxPyEndBlockThreads();
|
wxPyEndBlockThreads();
|
||||||
if (! found)
|
if (! found)
|
||||||
wxGridCellEditor::PaintBackground(rectCell, attr);
|
wxGridCellEditor::PaintBackground(rectCell, attr);
|
||||||
@@ -1189,7 +1213,9 @@ public:
|
|||||||
void SetValue(int row, int col, const wxString& val) {
|
void SetValue(int row, int col, const wxString& val) {
|
||||||
wxPyBeginBlockThreads();
|
wxPyBeginBlockThreads();
|
||||||
if (wxPyCBH_findCallback(m_myInst, "SetValue")) {
|
if (wxPyCBH_findCallback(m_myInst, "SetValue")) {
|
||||||
wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iiO)",row,col,wx2PyString(val)));
|
PyObject* s = wx2PyString(val);
|
||||||
|
wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iiO)",row,col,s));
|
||||||
|
Py_DECREF(s);
|
||||||
}
|
}
|
||||||
wxPyEndBlockThreads();
|
wxPyEndBlockThreads();
|
||||||
}
|
}
|
||||||
|
@@ -950,10 +950,10 @@ void wxPyCBH_delete(wxPyCallbackHelper* cbh);
|
|||||||
#define IMP_PYCALLBACK__BOOL2DBLINT(CLASS, PCLASS, CBNAME) \
|
#define IMP_PYCALLBACK__BOOL2DBLINT(CLASS, PCLASS, CBNAME) \
|
||||||
void CLASS::CBNAME(bool a, double b, double c, int d) { \
|
void CLASS::CBNAME(bool a, double b, double c, int d) { \
|
||||||
bool found; \
|
bool found; \
|
||||||
wxPyBeginBlockThreads(); \
|
wxPyBeginBlockThreads(); \
|
||||||
if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
|
if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
|
||||||
wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iddi)", (int)a,b,c,d));\
|
wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iddi)", (int)a,b,c,d));\
|
||||||
wxPyEndBlockThreads(); \
|
wxPyEndBlockThreads(); \
|
||||||
if (! found) \
|
if (! found) \
|
||||||
PCLASS::CBNAME(a, b, c, d); \
|
PCLASS::CBNAME(a, b, c, d); \
|
||||||
} \
|
} \
|
||||||
@@ -971,10 +971,13 @@ void wxPyCBH_delete(wxPyCallbackHelper* cbh);
|
|||||||
#define IMP_PYCALLBACK__STRING(CLASS, PCLASS, CBNAME) \
|
#define IMP_PYCALLBACK__STRING(CLASS, PCLASS, CBNAME) \
|
||||||
void CLASS::CBNAME(const wxString& a) { \
|
void CLASS::CBNAME(const wxString& a) { \
|
||||||
bool found; \
|
bool found; \
|
||||||
wxPyBeginBlockThreads(); \
|
wxPyBeginBlockThreads(); \
|
||||||
if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
|
if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
|
||||||
wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", wx2PyString(a))); \
|
PyObject* s = wx2PyString(a); \
|
||||||
wxPyEndBlockThreads(); \
|
wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", s)); \
|
||||||
|
Py_DECREF(s); \
|
||||||
|
} \
|
||||||
|
wxPyEndBlockThreads(); \
|
||||||
if (! found) \
|
if (! found) \
|
||||||
PCLASS::CBNAME(a); \
|
PCLASS::CBNAME(a); \
|
||||||
} \
|
} \
|
||||||
@@ -992,10 +995,13 @@ void wxPyCBH_delete(wxPyCallbackHelper* cbh);
|
|||||||
bool CLASS::CBNAME(const wxString& a) { \
|
bool CLASS::CBNAME(const wxString& a) { \
|
||||||
bool rval=FALSE; \
|
bool rval=FALSE; \
|
||||||
bool found; \
|
bool found; \
|
||||||
wxPyBeginBlockThreads(); \
|
wxPyBeginBlockThreads(); \
|
||||||
if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
|
if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
|
||||||
rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", wx2PyString(a)));\
|
PyObject* s = wx2PyString(a); \
|
||||||
wxPyEndBlockThreads(); \
|
rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", s)); \
|
||||||
|
Py_DECREF(s); \
|
||||||
|
} \
|
||||||
|
wxPyEndBlockThreads(); \
|
||||||
if (! found) \
|
if (! found) \
|
||||||
rval = PCLASS::CBNAME(a); \
|
rval = PCLASS::CBNAME(a); \
|
||||||
return rval; \
|
return rval; \
|
||||||
@@ -1009,15 +1015,18 @@ void wxPyCBH_delete(wxPyCallbackHelper* cbh);
|
|||||||
#define DEC_PYCALLBACK_BOOL_STRING_pure(CBNAME) \
|
#define DEC_PYCALLBACK_BOOL_STRING_pure(CBNAME) \
|
||||||
bool CBNAME(const wxString& a);
|
bool CBNAME(const wxString& a);
|
||||||
|
|
||||||
#define IMP_PYCALLBACK_BOOL_STRING_pure(CLASS, PCLASS, CBNAME) \
|
#define IMP_PYCALLBACK_BOOL_STRING_pure(CLASS, PCLASS, CBNAME) \
|
||||||
bool CLASS::CBNAME(const wxString& a) { \
|
bool CLASS::CBNAME(const wxString& a) { \
|
||||||
bool rval=FALSE; \
|
bool rval=FALSE; \
|
||||||
wxPyBeginBlockThreads(); \
|
wxPyBeginBlockThreads(); \
|
||||||
if (wxPyCBH_findCallback(m_myInst, #CBNAME)) \
|
if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
|
||||||
rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", wx2PyString(a))); \
|
PyObject* s = wx2PyString(a); \
|
||||||
wxPyEndBlockThreads(); \
|
rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", s)); \
|
||||||
return rval; \
|
Py_DECREF(s); \
|
||||||
} \
|
} \
|
||||||
|
wxPyEndBlockThreads(); \
|
||||||
|
return rval; \
|
||||||
|
} \
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
@@ -1030,7 +1039,9 @@ void wxPyCBH_delete(wxPyCallbackHelper* cbh);
|
|||||||
wxPyBeginBlockThreads(); \
|
wxPyBeginBlockThreads(); \
|
||||||
if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
|
if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
|
||||||
PyObject* ro; \
|
PyObject* ro; \
|
||||||
ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(O)", wx2PyString(a)));\
|
PyObject* s = wx2PyString(a); \
|
||||||
|
ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(O)", s)); \
|
||||||
|
Py_DECREF(s); \
|
||||||
if (ro) { \
|
if (ro) { \
|
||||||
rval = Py2wxString(ro); \
|
rval = Py2wxString(ro); \
|
||||||
Py_DECREF(ro); \
|
Py_DECREF(ro); \
|
||||||
@@ -1048,10 +1059,12 @@ void wxPyCBH_delete(wxPyCallbackHelper* cbh);
|
|||||||
#define IMP_PYCALLBACK_STRING_STRINGINT_pure(CLASS, PCLASS, CBNAME) \
|
#define IMP_PYCALLBACK_STRING_STRINGINT_pure(CLASS, PCLASS, CBNAME) \
|
||||||
wxString CLASS::CBNAME(const wxString& a,int b) { \
|
wxString CLASS::CBNAME(const wxString& a,int b) { \
|
||||||
wxString rval; \
|
wxString rval; \
|
||||||
wxPyBeginBlockThreads(); \
|
wxPyBeginBlockThreads(); \
|
||||||
if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
|
if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
|
||||||
PyObject* ro; \
|
PyObject* ro; \
|
||||||
ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(Oi)", wx2PyString(a),b)); \
|
PyObject* s = wx2PyString(a); \
|
||||||
|
ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(Oi)",s,b)); \
|
||||||
|
Py_DECREF(s); \
|
||||||
if (ro) { \
|
if (ro) { \
|
||||||
rval = Py2wxString(ro); \
|
rval = Py2wxString(ro); \
|
||||||
Py_DECREF(ro); \
|
Py_DECREF(ro); \
|
||||||
@@ -1071,10 +1084,14 @@ void wxPyCBH_delete(wxPyCallbackHelper* cbh);
|
|||||||
bool CLASS::CBNAME(const wxString& a, const wxString& b) { \
|
bool CLASS::CBNAME(const wxString& a, const wxString& b) { \
|
||||||
bool rval=FALSE; \
|
bool rval=FALSE; \
|
||||||
bool found; \
|
bool found; \
|
||||||
wxPyBeginBlockThreads(); \
|
wxPyBeginBlockThreads(); \
|
||||||
if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
|
if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
|
||||||
rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(OO)", \
|
PyObject* s1 = wx2PyString(a); \
|
||||||
wx2PyString(a), wx2PyString(b))); \
|
PyObject* s2 = wx2PyString(b); \
|
||||||
|
rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(OO)",s1,s2)); \
|
||||||
|
Py_DECREF(s1); \
|
||||||
|
Py_DECREF(s2); \
|
||||||
|
} \
|
||||||
wxPyEndBlockThreads(); \
|
wxPyEndBlockThreads(); \
|
||||||
if (! found) \
|
if (! found) \
|
||||||
rval = PCLASS::CBNAME(a, b); \
|
rval = PCLASS::CBNAME(a, b); \
|
||||||
@@ -1142,13 +1159,13 @@ void wxPyCBH_delete(wxPyCallbackHelper* cbh);
|
|||||||
#define IMP_PYCALLBACK_BOOL_TAG_pure(CLASS, PCLASS, CBNAME) \
|
#define IMP_PYCALLBACK_BOOL_TAG_pure(CLASS, PCLASS, CBNAME) \
|
||||||
bool CLASS::CBNAME(const wxHtmlTag& a) { \
|
bool CLASS::CBNAME(const wxHtmlTag& a) { \
|
||||||
bool rval=FALSE; \
|
bool rval=FALSE; \
|
||||||
wxPyBeginBlockThreads(); \
|
wxPyBeginBlockThreads(); \
|
||||||
if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
|
if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
|
||||||
PyObject* obj = wxPyConstructObject((void*)&a, "wxHtmlTag", 0); \
|
PyObject* obj = wxPyConstructObject((void*)&a, "wxHtmlTag", 0); \
|
||||||
rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
|
rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
|
||||||
Py_DECREF(obj); \
|
Py_DECREF(obj); \
|
||||||
} \
|
} \
|
||||||
wxPyEndBlockThreads(); \
|
wxPyEndBlockThreads(); \
|
||||||
return rval; \
|
return rval; \
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1161,13 +1178,13 @@ void wxPyCBH_delete(wxPyCallbackHelper* cbh);
|
|||||||
#define IMP_PYCALLBACK__CELLINTINT(CLASS, PCLASS, CBNAME) \
|
#define IMP_PYCALLBACK__CELLINTINT(CLASS, PCLASS, CBNAME) \
|
||||||
void CLASS::CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y) { \
|
void CLASS::CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y) { \
|
||||||
bool found; \
|
bool found; \
|
||||||
wxPyBeginBlockThreads(); \
|
wxPyBeginBlockThreads(); \
|
||||||
if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
|
if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
|
||||||
PyObject* obj = wxPyConstructObject((void*)cell, "wxHtmlCell", 0); \
|
PyObject* obj = wxPyConstructObject((void*)cell, "wxHtmlCell", 0); \
|
||||||
wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(Oii)",obj,x,y)); \
|
wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(Oii)",obj,x,y)); \
|
||||||
Py_DECREF(obj); \
|
Py_DECREF(obj); \
|
||||||
} \
|
} \
|
||||||
wxPyEndBlockThreads(); \
|
wxPyEndBlockThreads(); \
|
||||||
if (! found) \
|
if (! found) \
|
||||||
PCLASS::CBNAME(cell, x, y); \
|
PCLASS::CBNAME(cell, x, y); \
|
||||||
} \
|
} \
|
||||||
@@ -1185,7 +1202,7 @@ void wxPyCBH_delete(wxPyCallbackHelper* cbh);
|
|||||||
#define IMP_PYCALLBACK__CELLINTINTME(CLASS, PCLASS, CBNAME) \
|
#define IMP_PYCALLBACK__CELLINTINTME(CLASS, PCLASS, CBNAME) \
|
||||||
void CLASS::CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y, const wxMouseEvent& e) { \
|
void CLASS::CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y, const wxMouseEvent& e) { \
|
||||||
bool found; \
|
bool found; \
|
||||||
wxPyBeginBlockThreads(); \
|
wxPyBeginBlockThreads(); \
|
||||||
if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
|
if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
|
||||||
PyObject* obj = wxPyConstructObject((void*)cell, "wxHtmlCell", 0); \
|
PyObject* obj = wxPyConstructObject((void*)cell, "wxHtmlCell", 0); \
|
||||||
PyObject* o2 = wxPyConstructObject((void*)&e, "wxMouseEvent", 0); \
|
PyObject* o2 = wxPyConstructObject((void*)&e, "wxMouseEvent", 0); \
|
||||||
@@ -1193,12 +1210,12 @@ void wxPyCBH_delete(wxPyCallbackHelper* cbh);
|
|||||||
Py_DECREF(obj); \
|
Py_DECREF(obj); \
|
||||||
Py_DECREF(o2); \
|
Py_DECREF(o2); \
|
||||||
} \
|
} \
|
||||||
wxPyEndBlockThreads(); \
|
wxPyEndBlockThreads(); \
|
||||||
if (! found) \
|
if (! found) \
|
||||||
PCLASS::CBNAME(cell, x, y, e); \
|
PCLASS::CBNAME(cell, x, y, e); \
|
||||||
} \
|
} \
|
||||||
void CLASS::base_##CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y, const wxMouseEvent& e) { \
|
void CLASS::base_##CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y, const wxMouseEvent& e) { \
|
||||||
PCLASS::CBNAME(cell, x, y, e); \
|
PCLASS::CBNAME(cell, x, y, e); \
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -1211,10 +1228,10 @@ void wxPyCBH_delete(wxPyCallbackHelper* cbh);
|
|||||||
|
|
||||||
#define IMP_PYCALLBACK___pure(CLASS, PCLASS, CBNAME) \
|
#define IMP_PYCALLBACK___pure(CLASS, PCLASS, CBNAME) \
|
||||||
void CLASS::CBNAME() { \
|
void CLASS::CBNAME() { \
|
||||||
wxPyBeginBlockThreads(); \
|
wxPyBeginBlockThreads(); \
|
||||||
if (wxPyCBH_findCallback(m_myInst, #CBNAME)) \
|
if (wxPyCBH_findCallback(m_myInst, #CBNAME)) \
|
||||||
wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \
|
wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \
|
||||||
wxPyEndBlockThreads(); \
|
wxPyEndBlockThreads(); \
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
@@ -1266,13 +1283,13 @@ void wxPyCBH_delete(wxPyCallbackHelper* cbh);
|
|||||||
bool CLASS::CBNAME(wxWindow* a) { \
|
bool CLASS::CBNAME(wxWindow* a) { \
|
||||||
bool rval=FALSE; \
|
bool rval=FALSE; \
|
||||||
bool found; \
|
bool found; \
|
||||||
wxPyBeginBlockThreads(); \
|
wxPyBeginBlockThreads(); \
|
||||||
if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
|
if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
|
||||||
PyObject* obj = wxPyMake_wxObject(a); \
|
PyObject* obj = wxPyMake_wxObject(a); \
|
||||||
rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
|
rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
|
||||||
Py_DECREF(obj); \
|
Py_DECREF(obj); \
|
||||||
} \
|
} \
|
||||||
wxPyEndBlockThreads(); \
|
wxPyEndBlockThreads(); \
|
||||||
if (! found) \
|
if (! found) \
|
||||||
rval = PCLASS::CBNAME(a); \
|
rval = PCLASS::CBNAME(a); \
|
||||||
return rval; \
|
return rval; \
|
||||||
@@ -1362,13 +1379,15 @@ void wxPyCBH_delete(wxPyCallbackHelper* cbh);
|
|||||||
if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
|
if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
|
||||||
PyObject* ro; \
|
PyObject* ro; \
|
||||||
PyObject* obj = wxPyMake_wxObject(&a); \
|
PyObject* obj = wxPyMake_wxObject(&a); \
|
||||||
|
PyObject* s = wx2PyString(b); \
|
||||||
ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(OO)",\
|
ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(OO)",\
|
||||||
obj, wx2PyString(b))); \
|
obj, s)); \
|
||||||
if (ro) { \
|
if (ro) { \
|
||||||
SWIG_GetPtrObj(ro, (void **)&rval, "_wxFSFILE_p"); \
|
SWIG_GetPtrObj(ro, (void **)&rval, "_wxFSFILE_p"); \
|
||||||
Py_DECREF(ro); \
|
Py_DECREF(ro); \
|
||||||
} \
|
} \
|
||||||
Py_DECREF(obj); \
|
Py_DECREF(obj); \
|
||||||
|
Py_DECREF(s); \
|
||||||
} \
|
} \
|
||||||
wxPyEndBlockThreads(); \
|
wxPyEndBlockThreads(); \
|
||||||
return rval; \
|
return rval; \
|
||||||
@@ -1422,8 +1441,11 @@ void wxPyCBH_delete(wxPyCallbackHelper* cbh);
|
|||||||
bool CLASS::CBNAME(int a, int b, const wxString& c) { \
|
bool CLASS::CBNAME(int a, int b, const wxString& c) { \
|
||||||
bool rval=FALSE; \
|
bool rval=FALSE; \
|
||||||
wxPyBeginBlockThreads(); \
|
wxPyBeginBlockThreads(); \
|
||||||
if (wxPyCBH_findCallback(m_myInst, #CBNAME)) \
|
if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
|
||||||
rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iiO)",a,b, wx2PyString(c)));\
|
PyObject* s = wx2PyString(c); \
|
||||||
|
rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iiO)",a,b,s));\
|
||||||
|
Py_DECREF(s); \
|
||||||
|
} \
|
||||||
wxPyEndBlockThreads(); \
|
wxPyEndBlockThreads(); \
|
||||||
return rval; \
|
return rval; \
|
||||||
} \
|
} \
|
||||||
|
@@ -514,7 +514,9 @@ wxHtmlOpeningStatus wxPyHtmlWindow::OnOpeningURL(wxHtmlURLType type,
|
|||||||
wxPyBeginBlockThreads();
|
wxPyBeginBlockThreads();
|
||||||
if ((found = wxPyCBH_findCallback(m_myInst, "OnOpeningURL"))) {
|
if ((found = wxPyCBH_findCallback(m_myInst, "OnOpeningURL"))) {
|
||||||
PyObject* ro;
|
PyObject* ro;
|
||||||
ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(iO)", type, wx2PyString(url)));
|
PyObject* s = wx2PyString(url);
|
||||||
|
ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(iO)", type, s));
|
||||||
|
Py_DECREF(s);
|
||||||
if (PyString_Check(ro)
|
if (PyString_Check(ro)
|
||||||
#if PYTHON_API_VERSION >= 1009
|
#if PYTHON_API_VERSION >= 1009
|
||||||
|| PyUnicode_Check(ro)
|
|| PyUnicode_Check(ro)
|
||||||
|
@@ -696,9 +696,11 @@ public:
|
|||||||
virtual void DoLog(wxLogLevel level, const wxChar *szString, time_t t) {
|
virtual void DoLog(wxLogLevel level, const wxChar *szString, time_t t) {
|
||||||
bool found;
|
bool found;
|
||||||
wxPyBeginBlockThreads();
|
wxPyBeginBlockThreads();
|
||||||
if ((found = wxPyCBH_findCallback(m_myInst, "DoLog")))
|
if ((found = wxPyCBH_findCallback(m_myInst, "DoLog"))) {
|
||||||
wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iOi)", level,
|
PyObject* s = wx2PyString(szString);
|
||||||
wx2PyString(szString), t));
|
wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iOi)", level, s, t));
|
||||||
|
Py_DECREF(s);
|
||||||
|
}
|
||||||
wxPyEndBlockThreads();
|
wxPyEndBlockThreads();
|
||||||
if (! found)
|
if (! found)
|
||||||
wxLog::DoLog(level, szString, t);
|
wxLog::DoLog(level, szString, t);
|
||||||
@@ -707,9 +709,11 @@ public:
|
|||||||
virtual void DoLogString(const wxChar *szString, time_t t) {
|
virtual void DoLogString(const wxChar *szString, time_t t) {
|
||||||
bool found;
|
bool found;
|
||||||
wxPyBeginBlockThreads();
|
wxPyBeginBlockThreads();
|
||||||
if ((found = wxPyCBH_findCallback(m_myInst, "DoLogString")))
|
if ((found = wxPyCBH_findCallback(m_myInst, "DoLogString"))) {
|
||||||
wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oi)",
|
PyObject* s = wx2PyString(szString);
|
||||||
wx2PyString(szString), t));
|
wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oi)", s, t));
|
||||||
|
Py_DECREF(s);
|
||||||
|
}
|
||||||
wxPyEndBlockThreads();
|
wxPyEndBlockThreads();
|
||||||
if (! found)
|
if (! found)
|
||||||
wxLog::DoLogString(szString, t);
|
wxLog::DoLogString(szString, t);
|
||||||
@@ -1412,20 +1416,13 @@ public:
|
|||||||
PyObject* so = wxPyConstructObject((void*)&size, "wxSize", 0);
|
PyObject* so = wxPyConstructObject((void*)&size, "wxSize", 0);
|
||||||
PyObject* ro;
|
PyObject* ro;
|
||||||
wxBitmap* ptr;
|
wxBitmap* ptr;
|
||||||
#if 0
|
PyObject* s1, *s2;
|
||||||
ro = wxPyCBH_callCallbackObj(
|
|
||||||
m_myInst, Py_BuildValue("(OOO)",
|
|
||||||
wx2PyString(id),
|
|
||||||
wx2PyString(client),
|
|
||||||
so));
|
|
||||||
#else // testing...
|
|
||||||
PyObject *args, *s1, *s2;
|
|
||||||
s1 = wx2PyString(id);
|
s1 = wx2PyString(id);
|
||||||
s2 = wx2PyString(client);
|
s2 = wx2PyString(client);
|
||||||
args = Py_BuildValue("(OOO)", s1, s2, so);
|
ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(OOO)", s1, s2, so));
|
||||||
ro = wxPyCBH_callCallbackObj(m_myInst, args);
|
|
||||||
#endif
|
|
||||||
Py_DECREF(so);
|
Py_DECREF(so);
|
||||||
|
Py_DECREF(s1);
|
||||||
|
Py_DECREF(s2);
|
||||||
if (ro) {
|
if (ro) {
|
||||||
if (!SWIG_GetPtrObj(ro, (void**)&ptr, "_wxBitmap_p"))
|
if (!SWIG_GetPtrObj(ro, (void**)&ptr, "_wxBitmap_p"))
|
||||||
rval = *ptr;
|
rval = *ptr;
|
||||||
|
@@ -191,8 +191,9 @@ wxBitmap wxPyBitmapDataObject::GetBitmap() {
|
|||||||
void wxPyBitmapDataObject::SetBitmap(const wxBitmap& bitmap) {
|
void wxPyBitmapDataObject::SetBitmap(const wxBitmap& bitmap) {
|
||||||
wxPyBeginBlockThreads();
|
wxPyBeginBlockThreads();
|
||||||
if (m_myInst.findCallback("SetBitmap")) {
|
if (m_myInst.findCallback("SetBitmap")) {
|
||||||
m_myInst.callCallback(Py_BuildValue("(O)",
|
PyObject* bo = wxPyConstructObject((void*)&bitmap, "wxBitmap");
|
||||||
wxPyConstructObject((void*)&bitmap, "wxBitmap")));
|
m_myInst.callCallback(Py_BuildValue("(O)", bo));
|
||||||
|
Py_DECREF(bo);
|
||||||
}
|
}
|
||||||
wxPyEndBlockThreads();
|
wxPyEndBlockThreads();
|
||||||
}
|
}
|
||||||
@@ -293,10 +294,11 @@ bool wxPyFileDropTarget::OnDropFiles(wxCoord x, wxCoord y,
|
|||||||
const wxArrayString& filenames) {
|
const wxArrayString& filenames) {
|
||||||
bool rval = FALSE;
|
bool rval = FALSE;
|
||||||
wxPyBeginBlockThreads();
|
wxPyBeginBlockThreads();
|
||||||
PyObject* list = wxArrayString2PyList_helper(filenames);
|
if (m_myInst.findCallback("OnDropFiles")) {
|
||||||
if (m_myInst.findCallback("OnDropFiles"))
|
PyObject* list = wxArrayString2PyList_helper(filenames);
|
||||||
rval = m_myInst.callCallback(Py_BuildValue("(iiO)",x,y,list));
|
rval = m_myInst.callCallback(Py_BuildValue("(iiO)",x,y,list));
|
||||||
Py_DECREF(list);
|
Py_DECREF(list);
|
||||||
|
}
|
||||||
wxPyEndBlockThreads();
|
wxPyEndBlockThreads();
|
||||||
return rval;
|
return rval;
|
||||||
}
|
}
|
||||||
|
@@ -213,11 +213,13 @@ public:
|
|||||||
int rval = 0;
|
int rval = 0;
|
||||||
bool found;
|
bool found;
|
||||||
wxPyBeginBlockThreads();
|
wxPyBeginBlockThreads();
|
||||||
if ((found = m_myInst.findCallback("OnCompareItems")))
|
if ((found = m_myInst.findCallback("OnCompareItems"))) {
|
||||||
rval = m_myInst.callCallback(Py_BuildValue(
|
PyObject *o1 = wxPyConstructObject((void*)&item1, "wxTreeItemId");
|
||||||
"(OO)",
|
PyObject *o2 = wxPyConstructObject((void*)&item2, "wxTreeItemId");
|
||||||
wxPyConstructObject((void*)&item1, "wxTreeItemId"),
|
rval = m_myInst.callCallback(Py_BuildValue("(OO)",o1,o2));
|
||||||
wxPyConstructObject((void*)&item2, "wxTreeItemId")));
|
Py_DECREF(o1);
|
||||||
|
Py_DECREF(o2);
|
||||||
|
}
|
||||||
wxPyEndBlockThreads();
|
wxPyEndBlockThreads();
|
||||||
if (! found)
|
if (! found)
|
||||||
rval = wxTreeCtrl::OnCompareItems(item1, item2);
|
rval = wxTreeCtrl::OnCompareItems(item1, item2);
|
||||||
|
@@ -91,6 +91,39 @@ static PyObject* t_output_helper(PyObject* target, PyObject* o) {
|
|||||||
DECLARE_DEF_STRING2(DateTimeFormatStr, wxT("%c"));
|
DECLARE_DEF_STRING2(DateTimeFormatStr, wxT("%c"));
|
||||||
static const wxString wxPyEmptyString(wxT(""));
|
static const wxString wxPyEmptyString(wxT(""));
|
||||||
|
|
||||||
|
|
||||||
|
#define wxPyMake_TEMPLATE(TYPE) \
|
||||||
|
PyObject* wxPyMake_##TYPE(TYPE* source) { \
|
||||||
|
PyObject* target = NULL; \
|
||||||
|
if (source) { \
|
||||||
|
/* Check if there is already a pointer to a Python object in the \
|
||||||
|
OOR data that we can use. */ \
|
||||||
|
wxPyOORClientData* data = (wxPyOORClientData*)source->GetClientObject(); \
|
||||||
|
if (data) { \
|
||||||
|
target = data->m_obj; \
|
||||||
|
Py_INCREF(target); \
|
||||||
|
} \
|
||||||
|
/* Otherwise make a new wrapper for it the old fashioned way and \
|
||||||
|
give it the OOR treatment */ \
|
||||||
|
if (! target) { \
|
||||||
|
target = wxPyConstructObject(source, #TYPE, FALSE); \
|
||||||
|
if (target) \
|
||||||
|
source->SetClientObject(new wxPyOORClientData(target)); \
|
||||||
|
} \
|
||||||
|
} else { /* source was NULL so return None. */ \
|
||||||
|
Py_INCREF(Py_None); target = Py_None; \
|
||||||
|
} \
|
||||||
|
return target; \
|
||||||
|
} \
|
||||||
|
|
||||||
|
|
||||||
|
wxPyMake_TEMPLATE(wxGridCellRenderer)
|
||||||
|
wxPyMake_TEMPLATE(wxGridCellEditor)
|
||||||
|
wxPyMake_TEMPLATE(wxGridCellAttr)
|
||||||
|
wxPyMake_TEMPLATE(wxGridCellAttrProvider)
|
||||||
|
wxPyMake_TEMPLATE(wxGridTableBase)
|
||||||
|
|
||||||
|
|
||||||
#define PYCALLBACK_GCA_INTINTKIND(PCLASS, CBNAME) \
|
#define PYCALLBACK_GCA_INTINTKIND(PCLASS, CBNAME) \
|
||||||
wxGridCellAttr* CBNAME(int a, int b, wxGridCellAttr::wxAttrKind c) { \
|
wxGridCellAttr* CBNAME(int a, int b, wxGridCellAttr::wxAttrKind c) { \
|
||||||
wxGridCellAttr* rval = NULL; \
|
wxGridCellAttr* rval = NULL; \
|
||||||
@@ -119,14 +152,14 @@ static PyObject* t_output_helper(PyObject* target, PyObject* o) {
|
|||||||
|
|
||||||
#define PYCALLBACK__GCAINTINT(PCLASS, CBNAME) \
|
#define PYCALLBACK__GCAINTINT(PCLASS, CBNAME) \
|
||||||
void CBNAME(wxGridCellAttr *attr, int a, int b) { \
|
void CBNAME(wxGridCellAttr *attr, int a, int b) { \
|
||||||
wxPyBeginBlockThreads(); \
|
wxPyBeginBlockThreads(); \
|
||||||
bool found; \
|
bool found; \
|
||||||
if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
|
if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
|
||||||
PyObject* obj = wxPyConstructObject((void*)attr, "wxGridCellAttr", 0);\
|
PyObject* obj = wxPyMake_wxGridCellAttr(attr); \
|
||||||
wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oii)", obj, a, b)); \
|
wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oii)", obj, a, b)); \
|
||||||
Py_DECREF(obj); \
|
Py_DECREF(obj); \
|
||||||
} \
|
} \
|
||||||
wxPyEndBlockThreads(); \
|
wxPyEndBlockThreads(); \
|
||||||
if (! found) \
|
if (! found) \
|
||||||
PCLASS::CBNAME(attr, a, b); \
|
PCLASS::CBNAME(attr, a, b); \
|
||||||
} \
|
} \
|
||||||
@@ -138,10 +171,10 @@ static PyObject* t_output_helper(PyObject* target, PyObject* o) {
|
|||||||
|
|
||||||
#define PYCALLBACK__GCAINT(PCLASS, CBNAME) \
|
#define PYCALLBACK__GCAINT(PCLASS, CBNAME) \
|
||||||
void CBNAME(wxGridCellAttr *attr, int val) { \
|
void CBNAME(wxGridCellAttr *attr, int val) { \
|
||||||
wxPyBeginBlockThreads(); \
|
wxPyBeginBlockThreads(); \
|
||||||
bool found; \
|
bool found; \
|
||||||
if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
|
if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
|
||||||
PyObject* obj = wxPyConstructObject((void*)attr, "wxGridCellAttr", 0);\
|
PyObject* obj = wxPyMake_wxGridCellAttr(attr); \
|
||||||
wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oi)", obj, val)); \
|
wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oi)", obj, val)); \
|
||||||
Py_DECREF(obj); \
|
Py_DECREF(obj); \
|
||||||
} \
|
} \
|
||||||
@@ -198,8 +231,11 @@ static PyObject* t_output_helper(PyObject* target, PyObject* o) {
|
|||||||
#define PYCALLBACK__INTINTSTRING_pure(CBNAME) \
|
#define PYCALLBACK__INTINTSTRING_pure(CBNAME) \
|
||||||
void CBNAME(int a, int b, const wxString& c) { \
|
void CBNAME(int a, int b, const wxString& c) { \
|
||||||
wxPyBeginBlockThreads(); \
|
wxPyBeginBlockThreads(); \
|
||||||
if (wxPyCBH_findCallback(m_myInst, #CBNAME)) \
|
if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
|
||||||
wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iiO)",a,b,wx2PyString(c)));\
|
PyObject* s = wx2PyString(c); \
|
||||||
|
rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iiO)",a,b,s));\
|
||||||
|
Py_DECREF(s); \
|
||||||
|
} \
|
||||||
wxPyEndBlockThreads(); \
|
wxPyEndBlockThreads(); \
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -232,8 +268,11 @@ static PyObject* t_output_helper(PyObject* target, PyObject* o) {
|
|||||||
bool rval = 0; \
|
bool rval = 0; \
|
||||||
bool found; \
|
bool found; \
|
||||||
wxPyBeginBlockThreads(); \
|
wxPyBeginBlockThreads(); \
|
||||||
if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
|
if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
|
||||||
rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iiO)", a,b,wx2PyString(c)));\
|
PyObject* s = wx2PyString(c); \
|
||||||
|
rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iiO)",a,b,s));\
|
||||||
|
Py_DECREF(s); \
|
||||||
|
} \
|
||||||
wxPyEndBlockThreads(); \
|
wxPyEndBlockThreads(); \
|
||||||
if (! found) \
|
if (! found) \
|
||||||
rval = PCLASS::CBNAME(a,b,c); \
|
rval = PCLASS::CBNAME(a,b,c); \
|
||||||
@@ -296,7 +335,7 @@ static PyObject* t_output_helper(PyObject* target, PyObject* o) {
|
|||||||
Py_DECREF(ro); Py_DECREF(str); \
|
Py_DECREF(ro); Py_DECREF(str); \
|
||||||
} \
|
} \
|
||||||
} \
|
} \
|
||||||
wxPyEndBlockThreads(); \
|
wxPyEndBlockThreads(); \
|
||||||
if (! found) \
|
if (! found) \
|
||||||
rval = PCLASS::CBNAME(a, b); \
|
rval = PCLASS::CBNAME(a, b); \
|
||||||
return rval; \
|
return rval; \
|
||||||
@@ -310,10 +349,10 @@ static PyObject* t_output_helper(PyObject* target, PyObject* o) {
|
|||||||
#define PYCALLBACK__(PCLASS, CBNAME) \
|
#define PYCALLBACK__(PCLASS, CBNAME) \
|
||||||
void CBNAME() { \
|
void CBNAME() { \
|
||||||
bool found; \
|
bool found; \
|
||||||
wxPyBeginBlockThreads(); \
|
wxPyBeginBlockThreads(); \
|
||||||
if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
|
if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
|
||||||
wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \
|
wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \
|
||||||
wxPyEndBlockThreads(); \
|
wxPyEndBlockThreads(); \
|
||||||
if (! found) \
|
if (! found) \
|
||||||
PCLASS::CBNAME(); \
|
PCLASS::CBNAME(); \
|
||||||
} \
|
} \
|
||||||
@@ -328,10 +367,10 @@ static PyObject* t_output_helper(PyObject* target, PyObject* o) {
|
|||||||
bool CBNAME(size_t a, size_t b) { \
|
bool CBNAME(size_t a, size_t b) { \
|
||||||
bool rval = 0; \
|
bool rval = 0; \
|
||||||
bool found; \
|
bool found; \
|
||||||
wxPyBeginBlockThreads(); \
|
wxPyBeginBlockThreads(); \
|
||||||
if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
|
if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
|
||||||
rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ii)", a,b)); \
|
rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ii)", a,b)); \
|
||||||
wxPyEndBlockThreads(); \
|
wxPyEndBlockThreads(); \
|
||||||
if (! found) \
|
if (! found) \
|
||||||
rval = PCLASS::CBNAME(a,b); \
|
rval = PCLASS::CBNAME(a,b); \
|
||||||
return rval; \
|
return rval; \
|
||||||
@@ -346,10 +385,10 @@ static PyObject* t_output_helper(PyObject* target, PyObject* o) {
|
|||||||
bool CBNAME(size_t a) { \
|
bool CBNAME(size_t a) { \
|
||||||
bool rval = 0; \
|
bool rval = 0; \
|
||||||
bool found; \
|
bool found; \
|
||||||
wxPyBeginBlockThreads(); \
|
wxPyBeginBlockThreads(); \
|
||||||
if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
|
if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
|
||||||
rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(i)", a)); \
|
rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(i)", a)); \
|
||||||
wxPyEndBlockThreads(); \
|
wxPyEndBlockThreads(); \
|
||||||
if (! found) \
|
if (! found) \
|
||||||
rval = PCLASS::CBNAME(a); \
|
rval = PCLASS::CBNAME(a); \
|
||||||
return rval; \
|
return rval; \
|
||||||
@@ -386,8 +425,11 @@ static PyObject* t_output_helper(PyObject* target, PyObject* o) {
|
|||||||
void CBNAME(int a, const wxString& c) { \
|
void CBNAME(int a, const wxString& c) { \
|
||||||
bool found; \
|
bool found; \
|
||||||
wxPyBeginBlockThreads(); \
|
wxPyBeginBlockThreads(); \
|
||||||
if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
|
if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
|
||||||
wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iO)", a, wx2PyString(c))); \
|
PyObject* s = wx2PyString(c); \
|
||||||
|
wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iO)",a,s)); \
|
||||||
|
Py_DECREF(s); \
|
||||||
|
} \
|
||||||
wxPyEndBlockThreads(); \
|
wxPyEndBlockThreads(); \
|
||||||
if (! found) \
|
if (! found) \
|
||||||
PCLASS::CBNAME(a,c); \
|
PCLASS::CBNAME(a,c); \
|
||||||
@@ -485,39 +527,6 @@ static PyObject* t_output_helper(PyObject* target, PyObject* o) {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#define wxPyMake_TEMPLATE(TYPE) \
|
|
||||||
PyObject* wxPyMake_##TYPE(TYPE* source) { \
|
|
||||||
PyObject* target = NULL; \
|
|
||||||
if (source) { \
|
|
||||||
/* Check if there is already a pointer to a Python object in the \
|
|
||||||
OOR data that we can use. */ \
|
|
||||||
wxPyOORClientData* data = (wxPyOORClientData*)source->GetClientObject(); \
|
|
||||||
if (data) { \
|
|
||||||
target = data->m_obj; \
|
|
||||||
Py_INCREF(target); \
|
|
||||||
} \
|
|
||||||
/* Otherwise make a new wrapper for it the old fashioned way and \
|
|
||||||
give it the OOR treatment */ \
|
|
||||||
if (! target) { \
|
|
||||||
target = wxPyConstructObject(source, #TYPE, FALSE); \
|
|
||||||
if (target) \
|
|
||||||
source->SetClientObject(new wxPyOORClientData(target)); \
|
|
||||||
} \
|
|
||||||
} else { /* source was NULL so return None. */ \
|
|
||||||
Py_INCREF(Py_None); target = Py_None; \
|
|
||||||
} \
|
|
||||||
return target; \
|
|
||||||
} \
|
|
||||||
|
|
||||||
wxPyMake_TEMPLATE(wxGridCellRenderer)
|
|
||||||
wxPyMake_TEMPLATE(wxGridCellEditor)
|
|
||||||
wxPyMake_TEMPLATE(wxGridCellAttr)
|
|
||||||
wxPyMake_TEMPLATE(wxGridCellAttrProvider)
|
|
||||||
wxPyMake_TEMPLATE(wxGridTableBase)
|
|
||||||
|
|
||||||
|
|
||||||
class wxPyGridCellRenderer : public wxGridCellRenderer
|
class wxPyGridCellRenderer : public wxGridCellRenderer
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@@ -529,13 +538,17 @@ public:
|
|||||||
int row, int col, bool isSelected) {
|
int row, int col, bool isSelected) {
|
||||||
wxPyBeginBlockThreads();
|
wxPyBeginBlockThreads();
|
||||||
if (wxPyCBH_findCallback(m_myInst, "Draw")) {
|
if (wxPyCBH_findCallback(m_myInst, "Draw")) {
|
||||||
wxPyCBH_callCallback(m_myInst,
|
PyObject* go = wxPyMake_wxObject(&grid);
|
||||||
Py_BuildValue("(OOOOiii)",
|
PyObject* dco = wxPyMake_wxObject(&dc);
|
||||||
wxPyConstructObject((void*)&grid, "wxGrid", 0),
|
PyObject* ao = wxPyMake_wxGridCellAttr(&attr);
|
||||||
wxPyConstructObject((void*)&attr, "wxGridCellAttr", 0),
|
PyObject* ro = wxPyConstructObject((void*)&rect, "wxRect", 0);
|
||||||
wxPyConstructObject((void*)&dc, "wxDC", 0),
|
|
||||||
wxPyConstructObject((void*)&rect, "wxRect", 0),
|
wxPyCBH_callCallback(m_myInst, Py_BuildValue("(OOOOiii)", go, ao, dco, ro,
|
||||||
row, col, isSelected));
|
row, col, isSelected));
|
||||||
|
Py_DECREF(go);
|
||||||
|
Py_DECREF(ao);
|
||||||
|
Py_DECREF(dco);
|
||||||
|
Py_DECREF(ro);
|
||||||
}
|
}
|
||||||
wxPyEndBlockThreads();
|
wxPyEndBlockThreads();
|
||||||
}
|
}
|
||||||
@@ -547,12 +560,17 @@ public:
|
|||||||
if (wxPyCBH_findCallback(m_myInst, "GetBestSize")) {
|
if (wxPyCBH_findCallback(m_myInst, "GetBestSize")) {
|
||||||
PyObject* ro;
|
PyObject* ro;
|
||||||
wxSize* ptr;
|
wxSize* ptr;
|
||||||
ro = wxPyCBH_callCallbackObj(m_myInst,
|
PyObject* go = wxPyMake_wxObject(&grid);
|
||||||
Py_BuildValue("(OOOii)",
|
PyObject* dco = wxPyMake_wxObject(&dc);
|
||||||
wxPyConstructObject((void*)&grid, "wxGrid", 0),
|
PyObject* ao = wxPyMake_wxGridCellAttr(&attr);
|
||||||
wxPyConstructObject((void*)&attr, "wxGridCellAttr", 0),
|
|
||||||
wxPyConstructObject((void*)&dc, "wxDC", 0),
|
ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(OOOii)",
|
||||||
row, col));
|
go, ao, dco,
|
||||||
|
row, col));
|
||||||
|
Py_DECREF(go);
|
||||||
|
Py_DECREF(ao);
|
||||||
|
Py_DECREF(dco);
|
||||||
|
|
||||||
if (ro) {
|
if (ro) {
|
||||||
const char* errmsg = "GetBestSize should return a 2-tuple of integers or a wxSize object.";
|
const char* errmsg = "GetBestSize should return a 2-tuple of integers or a wxSize object.";
|
||||||
if (!SWIG_GetPtrObj(ro, (void **)&ptr, "_wxSize_p")) {
|
if (!SWIG_GetPtrObj(ro, (void **)&ptr, "_wxSize_p")) {
|
||||||
@@ -612,11 +630,12 @@ public:
|
|||||||
void Create(wxWindow* parent, wxWindowID id, wxEvtHandler* evtHandler) {
|
void Create(wxWindow* parent, wxWindowID id, wxEvtHandler* evtHandler) {
|
||||||
wxPyBeginBlockThreads();
|
wxPyBeginBlockThreads();
|
||||||
if (wxPyCBH_findCallback(m_myInst, "Create")) {
|
if (wxPyCBH_findCallback(m_myInst, "Create")) {
|
||||||
wxPyCBH_callCallback(m_myInst,
|
PyObject* po = wxPyMake_wxObject(parent);
|
||||||
Py_BuildValue("(OiO)",
|
PyObject* eo = wxPyMake_wxObject(evtHandler);
|
||||||
wxPyConstructObject((void*)parent, "wxWindow", 0),
|
|
||||||
id,
|
wxPyCBH_callCallback(m_myInst, Py_BuildValue("(OiO)", po, id, eo));
|
||||||
wxPyConstructObject((void*)evtHandler, "wxEvtHandler", 0)));
|
Py_DECREF(po);
|
||||||
|
Py_DECREF(eo);
|
||||||
}
|
}
|
||||||
wxPyEndBlockThreads();
|
wxPyEndBlockThreads();
|
||||||
}
|
}
|
||||||
@@ -625,9 +644,9 @@ public:
|
|||||||
void BeginEdit(int row, int col, wxGrid* grid) {
|
void BeginEdit(int row, int col, wxGrid* grid) {
|
||||||
wxPyBeginBlockThreads();
|
wxPyBeginBlockThreads();
|
||||||
if (wxPyCBH_findCallback(m_myInst, "BeginEdit")) {
|
if (wxPyCBH_findCallback(m_myInst, "BeginEdit")) {
|
||||||
wxPyCBH_callCallback(m_myInst,
|
PyObject* go = wxPyMake_wxObject(grid);
|
||||||
Py_BuildValue("(iiO)", row, col,
|
wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iiO)", row, col, go));
|
||||||
wxPyConstructObject((void*)grid, "wxGrid", 0)));
|
Py_DECREF(go);
|
||||||
}
|
}
|
||||||
wxPyEndBlockThreads();
|
wxPyEndBlockThreads();
|
||||||
}
|
}
|
||||||
@@ -637,9 +656,9 @@ public:
|
|||||||
bool rv = FALSE;
|
bool rv = FALSE;
|
||||||
wxPyBeginBlockThreads();
|
wxPyBeginBlockThreads();
|
||||||
if (wxPyCBH_findCallback(m_myInst, "EndEdit")) {
|
if (wxPyCBH_findCallback(m_myInst, "EndEdit")) {
|
||||||
rv = wxPyCBH_callCallback(m_myInst,
|
PyObject* go = wxPyMake_wxObject(grid);
|
||||||
Py_BuildValue("(iiO)", row, col,
|
rv = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iiO)", row, col, go));
|
||||||
wxPyConstructObject((void*)grid, "wxGrid", 0)));
|
Py_DECREF(go);
|
||||||
}
|
}
|
||||||
wxPyEndBlockThreads();
|
wxPyEndBlockThreads();
|
||||||
return rv;
|
return rv;
|
||||||
@@ -667,10 +686,11 @@ public:
|
|||||||
void Show(bool show, wxGridCellAttr *attr) {
|
void Show(bool show, wxGridCellAttr *attr) {
|
||||||
bool found;
|
bool found;
|
||||||
wxPyBeginBlockThreads();
|
wxPyBeginBlockThreads();
|
||||||
if ((found = wxPyCBH_findCallback(m_myInst, "Show")))
|
if ((found = wxPyCBH_findCallback(m_myInst, "Show"))) {
|
||||||
wxPyCBH_callCallback(m_myInst,
|
PyObject* ao = wxPyMake_wxGridCellAttr(attr);
|
||||||
Py_BuildValue("(iO)", show,
|
wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iO)", show, ao));
|
||||||
wxPyConstructObject((void*)attr, "wxGridCellAttr", 0)));
|
Py_DECREF(ao);
|
||||||
|
}
|
||||||
wxPyEndBlockThreads();
|
wxPyEndBlockThreads();
|
||||||
if (! found)
|
if (! found)
|
||||||
wxGridCellEditor::Show(show, attr);
|
wxGridCellEditor::Show(show, attr);
|
||||||
@@ -681,13 +701,17 @@ public:
|
|||||||
|
|
||||||
|
|
||||||
void PaintBackground(const wxRect& rectCell, wxGridCellAttr *attr) {
|
void PaintBackground(const wxRect& rectCell, wxGridCellAttr *attr) {
|
||||||
bool found; \
|
bool found;
|
||||||
wxPyBeginBlockThreads();
|
wxPyBeginBlockThreads();
|
||||||
if ((found = wxPyCBH_findCallback(m_myInst, "PaintBackground)")))
|
if ((found = wxPyCBH_findCallback(m_myInst, "PaintBackground)"))) {
|
||||||
wxPyCBH_callCallback(m_myInst,
|
PyObject* ao = wxPyMake_wxGridCellAttr(attr);
|
||||||
Py_BuildValue("(OO)",
|
PyObject* ro = wxPyConstructObject((void*)&rectCell, "wxRect", 0);
|
||||||
wxPyConstructObject((void*)&rectCell, "wxRect", 0),
|
|
||||||
wxPyConstructObject((void*)attr, "wxGridCellAttr", 0)));
|
wxPyCBH_callCallback(m_myInst, Py_BuildValue("(OO)", ro, ao));
|
||||||
|
|
||||||
|
Py_DECREF(ro);
|
||||||
|
Py_DECREF(ao);
|
||||||
|
}
|
||||||
wxPyEndBlockThreads();
|
wxPyEndBlockThreads();
|
||||||
if (! found)
|
if (! found)
|
||||||
wxGridCellEditor::PaintBackground(rectCell, attr);
|
wxGridCellEditor::PaintBackground(rectCell, attr);
|
||||||
@@ -780,7 +804,9 @@ public:
|
|||||||
void SetValue(int row, int col, const wxString& val) {
|
void SetValue(int row, int col, const wxString& val) {
|
||||||
wxPyBeginBlockThreads();
|
wxPyBeginBlockThreads();
|
||||||
if (wxPyCBH_findCallback(m_myInst, "SetValue")) {
|
if (wxPyCBH_findCallback(m_myInst, "SetValue")) {
|
||||||
wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iiO)",row,col,wx2PyString(val)));
|
PyObject* s = wx2PyString(val);
|
||||||
|
wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iiO)",row,col,s));
|
||||||
|
Py_DECREF(s);
|
||||||
}
|
}
|
||||||
wxPyEndBlockThreads();
|
wxPyEndBlockThreads();
|
||||||
}
|
}
|
||||||
|
@@ -264,7 +264,9 @@ wxHtmlOpeningStatus wxPyHtmlWindow::OnOpeningURL(wxHtmlURLType type,
|
|||||||
wxPyBeginBlockThreads();
|
wxPyBeginBlockThreads();
|
||||||
if ((found = wxPyCBH_findCallback(m_myInst, "OnOpeningURL"))) {
|
if ((found = wxPyCBH_findCallback(m_myInst, "OnOpeningURL"))) {
|
||||||
PyObject* ro;
|
PyObject* ro;
|
||||||
ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(iO)", type, wx2PyString(url)));
|
PyObject* s = wx2PyString(url);
|
||||||
|
ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(iO)", type, s));
|
||||||
|
Py_DECREF(s);
|
||||||
if (PyString_Check(ro)
|
if (PyString_Check(ro)
|
||||||
#if PYTHON_API_VERSION >= 1009
|
#if PYTHON_API_VERSION >= 1009
|
||||||
|| PyUnicode_Check(ro)
|
|| PyUnicode_Check(ro)
|
||||||
|
@@ -145,9 +145,11 @@ public:
|
|||||||
virtual void DoLog(wxLogLevel level, const wxChar *szString, time_t t) {
|
virtual void DoLog(wxLogLevel level, const wxChar *szString, time_t t) {
|
||||||
bool found;
|
bool found;
|
||||||
wxPyBeginBlockThreads();
|
wxPyBeginBlockThreads();
|
||||||
if ((found = wxPyCBH_findCallback(m_myInst, "DoLog")))
|
if ((found = wxPyCBH_findCallback(m_myInst, "DoLog"))) {
|
||||||
wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iOi)", level,
|
PyObject* s = wx2PyString(szString);
|
||||||
wx2PyString(szString), t));
|
wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iOi)", level, s, t));
|
||||||
|
Py_DECREF(s);
|
||||||
|
}
|
||||||
wxPyEndBlockThreads();
|
wxPyEndBlockThreads();
|
||||||
if (! found)
|
if (! found)
|
||||||
wxLog::DoLog(level, szString, t);
|
wxLog::DoLog(level, szString, t);
|
||||||
@@ -156,9 +158,11 @@ public:
|
|||||||
virtual void DoLogString(const wxChar *szString, time_t t) {
|
virtual void DoLogString(const wxChar *szString, time_t t) {
|
||||||
bool found;
|
bool found;
|
||||||
wxPyBeginBlockThreads();
|
wxPyBeginBlockThreads();
|
||||||
if ((found = wxPyCBH_findCallback(m_myInst, "DoLogString")))
|
if ((found = wxPyCBH_findCallback(m_myInst, "DoLogString"))) {
|
||||||
wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oi)",
|
PyObject* s = wx2PyString(szString);
|
||||||
wx2PyString(szString), t));
|
wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oi)", s, t));
|
||||||
|
Py_DECREF(s);
|
||||||
|
}
|
||||||
wxPyEndBlockThreads();
|
wxPyEndBlockThreads();
|
||||||
if (! found)
|
if (! found)
|
||||||
wxLog::DoLogString(szString, t);
|
wxLog::DoLogString(szString, t);
|
||||||
@@ -289,20 +293,13 @@ public:
|
|||||||
PyObject* so = wxPyConstructObject((void*)&size, "wxSize", 0);
|
PyObject* so = wxPyConstructObject((void*)&size, "wxSize", 0);
|
||||||
PyObject* ro;
|
PyObject* ro;
|
||||||
wxBitmap* ptr;
|
wxBitmap* ptr;
|
||||||
#if 0
|
PyObject* s1, *s2;
|
||||||
ro = wxPyCBH_callCallbackObj(
|
|
||||||
m_myInst, Py_BuildValue("(OOO)",
|
|
||||||
wx2PyString(id),
|
|
||||||
wx2PyString(client),
|
|
||||||
so));
|
|
||||||
#else // testing...
|
|
||||||
PyObject *args, *s1, *s2;
|
|
||||||
s1 = wx2PyString(id);
|
s1 = wx2PyString(id);
|
||||||
s2 = wx2PyString(client);
|
s2 = wx2PyString(client);
|
||||||
args = Py_BuildValue("(OOO)", s1, s2, so);
|
ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(OOO)", s1, s2, so));
|
||||||
ro = wxPyCBH_callCallbackObj(m_myInst, args);
|
|
||||||
#endif
|
|
||||||
Py_DECREF(so);
|
Py_DECREF(so);
|
||||||
|
Py_DECREF(s1);
|
||||||
|
Py_DECREF(s2);
|
||||||
if (ro) {
|
if (ro) {
|
||||||
if (!SWIG_GetPtrObj(ro, (void**)&ptr, "_wxBitmap_p"))
|
if (!SWIG_GetPtrObj(ro, (void**)&ptr, "_wxBitmap_p"))
|
||||||
rval = *ptr;
|
rval = *ptr;
|
||||||
|
@@ -1788,8 +1788,6 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = {
|
|||||||
{ "_uint","_int",0},
|
{ "_uint","_int",0},
|
||||||
{ "_uint","_wxWindowID",0},
|
{ "_uint","_wxWindowID",0},
|
||||||
{ "_wxChar","_char",0},
|
{ "_wxChar","_char",0},
|
||||||
{ "_wxString","_wxArtID",0},
|
|
||||||
{ "_wxString","_wxArtClient",0},
|
|
||||||
{ "_char","_wxChar",0},
|
{ "_char","_wxChar",0},
|
||||||
{ "_struct_wxNativeFontInfo","_wxNativeFontInfo",0},
|
{ "_struct_wxNativeFontInfo","_wxNativeFontInfo",0},
|
||||||
{ "_EBool","_wxCoord",0},
|
{ "_EBool","_wxCoord",0},
|
||||||
@@ -1863,11 +1861,7 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = {
|
|||||||
{ "_wxCoord","_size_t",0},
|
{ "_wxCoord","_size_t",0},
|
||||||
{ "_wxCoord","_time_t",0},
|
{ "_wxCoord","_time_t",0},
|
||||||
{ "_wxCoord","_wxPrintQuality",0},
|
{ "_wxCoord","_wxPrintQuality",0},
|
||||||
{ "_wxArtClient","_wxArtID",0},
|
|
||||||
{ "_wxArtClient","_wxString",0},
|
|
||||||
{ "_wxEvtHandler","_wxPyApp",SwigwxPyAppTowxEvtHandler},
|
{ "_wxEvtHandler","_wxPyApp",SwigwxPyAppTowxEvtHandler},
|
||||||
{ "_wxArtID","_wxString",0},
|
|
||||||
{ "_wxArtID","_wxArtClient",0},
|
|
||||||
{0,0,0}};
|
{0,0,0}};
|
||||||
|
|
||||||
static PyObject *SWIG_globals;
|
static PyObject *SWIG_globals;
|
||||||
|
Reference in New Issue
Block a user