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
|
||||
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) {
|
||||
wxPyBeginBlockThreads();
|
||||
if (m_myInst.findCallback("SetBitmap")) {
|
||||
m_myInst.callCallback(Py_BuildValue("(O)",
|
||||
wxPyConstructObject((void*)&bitmap, "wxBitmap")));
|
||||
PyObject* bo = wxPyConstructObject((void*)&bitmap, "wxBitmap");
|
||||
m_myInst.callCallback(Py_BuildValue("(O)", bo));
|
||||
Py_DECREF(bo);
|
||||
}
|
||||
wxPyEndBlockThreads();
|
||||
}
|
||||
@@ -625,10 +626,11 @@ bool wxPyFileDropTarget::OnDropFiles(wxCoord x, wxCoord y,
|
||||
const wxArrayString& filenames) {
|
||||
bool rval = FALSE;
|
||||
wxPyBeginBlockThreads();
|
||||
if (m_myInst.findCallback("OnDropFiles")) {
|
||||
PyObject* list = wxArrayString2PyList_helper(filenames);
|
||||
if (m_myInst.findCallback("OnDropFiles"))
|
||||
rval = m_myInst.callCallback(Py_BuildValue("(iiO)",x,y,list));
|
||||
Py_DECREF(list);
|
||||
}
|
||||
wxPyEndBlockThreads();
|
||||
return rval;
|
||||
}
|
||||
|
@@ -1075,11 +1075,13 @@ public:
|
||||
int rval = 0;
|
||||
bool found;
|
||||
wxPyBeginBlockThreads();
|
||||
if ((found = m_myInst.findCallback("OnCompareItems")))
|
||||
rval = m_myInst.callCallback(Py_BuildValue(
|
||||
"(OO)",
|
||||
wxPyConstructObject((void*)&item1, "wxTreeItemId"),
|
||||
wxPyConstructObject((void*)&item2, "wxTreeItemId")));
|
||||
if ((found = m_myInst.findCallback("OnCompareItems"))) {
|
||||
PyObject *o1 = wxPyConstructObject((void*)&item1, "wxTreeItemId");
|
||||
PyObject *o2 = wxPyConstructObject((void*)&item2, "wxTreeItemId");
|
||||
rval = m_myInst.callCallback(Py_BuildValue("(OO)",o1,o2));
|
||||
Py_DECREF(o1);
|
||||
Py_DECREF(o2);
|
||||
}
|
||||
wxPyEndBlockThreads();
|
||||
if (! found)
|
||||
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
|
||||
// virtual methods that are able to make callbacks to Python. Many of these
|
||||
@@ -84,7 +128,7 @@
|
||||
wxPyBeginBlockThreads(); \
|
||||
bool found; \
|
||||
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)); \
|
||||
Py_DECREF(obj); \
|
||||
} \
|
||||
@@ -103,7 +147,7 @@
|
||||
wxPyBeginBlockThreads(); \
|
||||
bool found; \
|
||||
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)); \
|
||||
Py_DECREF(obj); \
|
||||
} \
|
||||
@@ -160,8 +204,11 @@
|
||||
#define PYCALLBACK__INTINTSTRING_pure(CBNAME) \
|
||||
void CBNAME(int a, int b, const wxString& c) { \
|
||||
wxPyBeginBlockThreads(); \
|
||||
if (wxPyCBH_findCallback(m_myInst, #CBNAME)) \
|
||||
wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iiO)",a,b,wx2PyString(c)));\
|
||||
if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
|
||||
PyObject* s = wx2PyString(c); \
|
||||
rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iiO)",a,b,s));\
|
||||
Py_DECREF(s); \
|
||||
} \
|
||||
wxPyEndBlockThreads(); \
|
||||
}
|
||||
|
||||
@@ -194,8 +241,11 @@
|
||||
bool rval = 0; \
|
||||
bool found; \
|
||||
wxPyBeginBlockThreads(); \
|
||||
if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
|
||||
rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iiO)", a,b,wx2PyString(c)));\
|
||||
if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
|
||||
PyObject* s = wx2PyString(c); \
|
||||
rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iiO)",a,b,s));\
|
||||
Py_DECREF(s); \
|
||||
} \
|
||||
wxPyEndBlockThreads(); \
|
||||
if (! found) \
|
||||
rval = PCLASS::CBNAME(a,b,c); \
|
||||
@@ -348,8 +398,11 @@
|
||||
void CBNAME(int a, const wxString& c) { \
|
||||
bool found; \
|
||||
wxPyBeginBlockThreads(); \
|
||||
if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
|
||||
wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iO)", a, wx2PyString(c))); \
|
||||
if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
|
||||
PyObject* s = wx2PyString(c); \
|
||||
wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iO)",a,s)); \
|
||||
Py_DECREF(s); \
|
||||
} \
|
||||
wxPyEndBlockThreads(); \
|
||||
if (! found) \
|
||||
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) {
|
||||
wxPyBeginBlockThreads();
|
||||
if (wxPyCBH_findCallback(m_myInst, "Draw")) {
|
||||
wxPyCBH_callCallback(m_myInst,
|
||||
Py_BuildValue("(OOOOiii)",
|
||||
wxPyConstructObject((void*)&grid, "wxGrid", 0),
|
||||
wxPyConstructObject((void*)&attr, "wxGridCellAttr", 0),
|
||||
wxPyConstructObject((void*)&dc, "wxDC", 0),
|
||||
wxPyConstructObject((void*)&rect, "wxRect", 0),
|
||||
PyObject* go = wxPyMake_wxObject(&grid);
|
||||
PyObject* dco = wxPyMake_wxObject(&dc);
|
||||
PyObject* ao = wxPyMake_wxGridCellAttr(&attr);
|
||||
PyObject* ro = wxPyConstructObject((void*)&rect, "wxRect", 0);
|
||||
|
||||
wxPyCBH_callCallback(m_myInst, Py_BuildValue("(OOOOiii)", go, ao, dco, ro,
|
||||
row, col, isSelected));
|
||||
Py_DECREF(go);
|
||||
Py_DECREF(ao);
|
||||
Py_DECREF(dco);
|
||||
Py_DECREF(ro);
|
||||
}
|
||||
wxPyEndBlockThreads();
|
||||
}
|
||||
@@ -577,12 +590,17 @@ public:
|
||||
if (wxPyCBH_findCallback(m_myInst, "GetBestSize")) {
|
||||
PyObject* ro;
|
||||
wxSize* ptr;
|
||||
ro = wxPyCBH_callCallbackObj(m_myInst,
|
||||
Py_BuildValue("(OOOii)",
|
||||
wxPyConstructObject((void*)&grid, "wxGrid", 0),
|
||||
wxPyConstructObject((void*)&attr, "wxGridCellAttr", 0),
|
||||
wxPyConstructObject((void*)&dc, "wxDC", 0),
|
||||
PyObject* go = wxPyMake_wxObject(&grid);
|
||||
PyObject* dco = wxPyMake_wxObject(&dc);
|
||||
PyObject* ao = wxPyMake_wxGridCellAttr(&attr);
|
||||
|
||||
ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(OOOii)",
|
||||
go, ao, dco,
|
||||
row, col));
|
||||
Py_DECREF(go);
|
||||
Py_DECREF(ao);
|
||||
Py_DECREF(dco);
|
||||
|
||||
if (ro) {
|
||||
const char* errmsg = "GetBestSize should return a 2-tuple of integers or a wxSize object.";
|
||||
if (!SWIG_GetPtrObj(ro, (void **)&ptr, "_wxSize_p")) {
|
||||
@@ -763,11 +781,12 @@ public:
|
||||
void Create(wxWindow* parent, wxWindowID id, wxEvtHandler* evtHandler) {
|
||||
wxPyBeginBlockThreads();
|
||||
if (wxPyCBH_findCallback(m_myInst, "Create")) {
|
||||
wxPyCBH_callCallback(m_myInst,
|
||||
Py_BuildValue("(OiO)",
|
||||
wxPyConstructObject((void*)parent, "wxWindow", 0),
|
||||
id,
|
||||
wxPyConstructObject((void*)evtHandler, "wxEvtHandler", 0)));
|
||||
PyObject* po = wxPyMake_wxObject(parent);
|
||||
PyObject* eo = wxPyMake_wxObject(evtHandler);
|
||||
|
||||
wxPyCBH_callCallback(m_myInst, Py_BuildValue("(OiO)", po, id, eo));
|
||||
Py_DECREF(po);
|
||||
Py_DECREF(eo);
|
||||
}
|
||||
wxPyEndBlockThreads();
|
||||
}
|
||||
@@ -776,9 +795,9 @@ public:
|
||||
void BeginEdit(int row, int col, wxGrid* grid) {
|
||||
wxPyBeginBlockThreads();
|
||||
if (wxPyCBH_findCallback(m_myInst, "BeginEdit")) {
|
||||
wxPyCBH_callCallback(m_myInst,
|
||||
Py_BuildValue("(iiO)", row, col,
|
||||
wxPyConstructObject((void*)grid, "wxGrid", 0)));
|
||||
PyObject* go = wxPyMake_wxObject(grid);
|
||||
wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iiO)", row, col, go));
|
||||
Py_DECREF(go);
|
||||
}
|
||||
wxPyEndBlockThreads();
|
||||
}
|
||||
@@ -788,9 +807,9 @@ public:
|
||||
bool rv = FALSE;
|
||||
wxPyBeginBlockThreads();
|
||||
if (wxPyCBH_findCallback(m_myInst, "EndEdit")) {
|
||||
rv = wxPyCBH_callCallback(m_myInst,
|
||||
Py_BuildValue("(iiO)", row, col,
|
||||
wxPyConstructObject((void*)grid, "wxGrid", 0)));
|
||||
PyObject* go = wxPyMake_wxObject(grid);
|
||||
rv = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iiO)", row, col, go));
|
||||
Py_DECREF(go);
|
||||
}
|
||||
wxPyEndBlockThreads();
|
||||
return rv;
|
||||
@@ -818,10 +837,11 @@ public:
|
||||
void Show(bool show, wxGridCellAttr *attr) {
|
||||
bool found;
|
||||
wxPyBeginBlockThreads();
|
||||
if ((found = wxPyCBH_findCallback(m_myInst, "Show")))
|
||||
wxPyCBH_callCallback(m_myInst,
|
||||
Py_BuildValue("(iO)", show,
|
||||
wxPyConstructObject((void*)attr, "wxGridCellAttr", 0)));
|
||||
if ((found = wxPyCBH_findCallback(m_myInst, "Show"))) {
|
||||
PyObject* ao = wxPyMake_wxGridCellAttr(attr);
|
||||
wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iO)", show, ao));
|
||||
Py_DECREF(ao);
|
||||
}
|
||||
wxPyEndBlockThreads();
|
||||
if (! found)
|
||||
wxGridCellEditor::Show(show, attr);
|
||||
@@ -832,13 +852,17 @@ public:
|
||||
|
||||
|
||||
void PaintBackground(const wxRect& rectCell, wxGridCellAttr *attr) {
|
||||
bool found; \
|
||||
bool found;
|
||||
wxPyBeginBlockThreads();
|
||||
if ((found = wxPyCBH_findCallback(m_myInst, "PaintBackground)")))
|
||||
wxPyCBH_callCallback(m_myInst,
|
||||
Py_BuildValue("(OO)",
|
||||
wxPyConstructObject((void*)&rectCell, "wxRect", 0),
|
||||
wxPyConstructObject((void*)attr, "wxGridCellAttr", 0)));
|
||||
if ((found = wxPyCBH_findCallback(m_myInst, "PaintBackground)"))) {
|
||||
PyObject* ao = wxPyMake_wxGridCellAttr(attr);
|
||||
PyObject* ro = wxPyConstructObject((void*)&rectCell, "wxRect", 0);
|
||||
|
||||
wxPyCBH_callCallback(m_myInst, Py_BuildValue("(OO)", ro, ao));
|
||||
|
||||
Py_DECREF(ro);
|
||||
Py_DECREF(ao);
|
||||
}
|
||||
wxPyEndBlockThreads();
|
||||
if (! found)
|
||||
wxGridCellEditor::PaintBackground(rectCell, attr);
|
||||
@@ -1189,7 +1213,9 @@ public:
|
||||
void SetValue(int row, int col, const wxString& val) {
|
||||
wxPyBeginBlockThreads();
|
||||
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();
|
||||
}
|
||||
|
@@ -972,8 +972,11 @@ void wxPyCBH_delete(wxPyCallbackHelper* cbh);
|
||||
void CLASS::CBNAME(const wxString& a) { \
|
||||
bool found; \
|
||||
wxPyBeginBlockThreads(); \
|
||||
if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
|
||||
wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", wx2PyString(a))); \
|
||||
if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
|
||||
PyObject* s = wx2PyString(a); \
|
||||
wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", s)); \
|
||||
Py_DECREF(s); \
|
||||
} \
|
||||
wxPyEndBlockThreads(); \
|
||||
if (! found) \
|
||||
PCLASS::CBNAME(a); \
|
||||
@@ -993,8 +996,11 @@ void wxPyCBH_delete(wxPyCallbackHelper* cbh);
|
||||
bool rval=FALSE; \
|
||||
bool found; \
|
||||
wxPyBeginBlockThreads(); \
|
||||
if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
|
||||
rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", wx2PyString(a)));\
|
||||
if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
|
||||
PyObject* s = wx2PyString(a); \
|
||||
rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", s)); \
|
||||
Py_DECREF(s); \
|
||||
} \
|
||||
wxPyEndBlockThreads(); \
|
||||
if (! found) \
|
||||
rval = PCLASS::CBNAME(a); \
|
||||
@@ -1013,8 +1019,11 @@ void wxPyCBH_delete(wxPyCallbackHelper* cbh);
|
||||
bool CLASS::CBNAME(const wxString& a) { \
|
||||
bool rval=FALSE; \
|
||||
wxPyBeginBlockThreads(); \
|
||||
if (wxPyCBH_findCallback(m_myInst, #CBNAME)) \
|
||||
rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", wx2PyString(a))); \
|
||||
if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
|
||||
PyObject* s = wx2PyString(a); \
|
||||
rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", s)); \
|
||||
Py_DECREF(s); \
|
||||
} \
|
||||
wxPyEndBlockThreads(); \
|
||||
return rval; \
|
||||
} \
|
||||
@@ -1030,7 +1039,9 @@ void wxPyCBH_delete(wxPyCallbackHelper* cbh);
|
||||
wxPyBeginBlockThreads(); \
|
||||
if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
|
||||
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) { \
|
||||
rval = Py2wxString(ro); \
|
||||
Py_DECREF(ro); \
|
||||
@@ -1051,7 +1062,9 @@ void wxPyCBH_delete(wxPyCallbackHelper* cbh);
|
||||
wxPyBeginBlockThreads(); \
|
||||
if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
|
||||
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) { \
|
||||
rval = Py2wxString(ro); \
|
||||
Py_DECREF(ro); \
|
||||
@@ -1072,9 +1085,13 @@ void wxPyCBH_delete(wxPyCallbackHelper* cbh);
|
||||
bool rval=FALSE; \
|
||||
bool found; \
|
||||
wxPyBeginBlockThreads(); \
|
||||
if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
|
||||
rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(OO)", \
|
||||
wx2PyString(a), wx2PyString(b))); \
|
||||
if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
|
||||
PyObject* s1 = wx2PyString(a); \
|
||||
PyObject* s2 = wx2PyString(b); \
|
||||
rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(OO)",s1,s2)); \
|
||||
Py_DECREF(s1); \
|
||||
Py_DECREF(s2); \
|
||||
} \
|
||||
wxPyEndBlockThreads(); \
|
||||
if (! found) \
|
||||
rval = PCLASS::CBNAME(a, b); \
|
||||
@@ -1362,13 +1379,15 @@ void wxPyCBH_delete(wxPyCallbackHelper* cbh);
|
||||
if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
|
||||
PyObject* ro; \
|
||||
PyObject* obj = wxPyMake_wxObject(&a); \
|
||||
PyObject* s = wx2PyString(b); \
|
||||
ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(OO)",\
|
||||
obj, wx2PyString(b))); \
|
||||
obj, s)); \
|
||||
if (ro) { \
|
||||
SWIG_GetPtrObj(ro, (void **)&rval, "_wxFSFILE_p"); \
|
||||
Py_DECREF(ro); \
|
||||
} \
|
||||
Py_DECREF(obj); \
|
||||
Py_DECREF(s); \
|
||||
} \
|
||||
wxPyEndBlockThreads(); \
|
||||
return rval; \
|
||||
@@ -1422,8 +1441,11 @@ void wxPyCBH_delete(wxPyCallbackHelper* cbh);
|
||||
bool CLASS::CBNAME(int a, int b, const wxString& c) { \
|
||||
bool rval=FALSE; \
|
||||
wxPyBeginBlockThreads(); \
|
||||
if (wxPyCBH_findCallback(m_myInst, #CBNAME)) \
|
||||
rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iiO)",a,b, wx2PyString(c)));\
|
||||
if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
|
||||
PyObject* s = wx2PyString(c); \
|
||||
rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iiO)",a,b,s));\
|
||||
Py_DECREF(s); \
|
||||
} \
|
||||
wxPyEndBlockThreads(); \
|
||||
return rval; \
|
||||
} \
|
||||
|
@@ -514,7 +514,9 @@ wxHtmlOpeningStatus wxPyHtmlWindow::OnOpeningURL(wxHtmlURLType type,
|
||||
wxPyBeginBlockThreads();
|
||||
if ((found = wxPyCBH_findCallback(m_myInst, "OnOpeningURL"))) {
|
||||
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 PYTHON_API_VERSION >= 1009
|
||||
|| PyUnicode_Check(ro)
|
||||
|
@@ -696,9 +696,11 @@ public:
|
||||
virtual void DoLog(wxLogLevel level, const wxChar *szString, time_t t) {
|
||||
bool found;
|
||||
wxPyBeginBlockThreads();
|
||||
if ((found = wxPyCBH_findCallback(m_myInst, "DoLog")))
|
||||
wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iOi)", level,
|
||||
wx2PyString(szString), t));
|
||||
if ((found = wxPyCBH_findCallback(m_myInst, "DoLog"))) {
|
||||
PyObject* s = wx2PyString(szString);
|
||||
wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iOi)", level, s, t));
|
||||
Py_DECREF(s);
|
||||
}
|
||||
wxPyEndBlockThreads();
|
||||
if (! found)
|
||||
wxLog::DoLog(level, szString, t);
|
||||
@@ -707,9 +709,11 @@ public:
|
||||
virtual void DoLogString(const wxChar *szString, time_t t) {
|
||||
bool found;
|
||||
wxPyBeginBlockThreads();
|
||||
if ((found = wxPyCBH_findCallback(m_myInst, "DoLogString")))
|
||||
wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oi)",
|
||||
wx2PyString(szString), t));
|
||||
if ((found = wxPyCBH_findCallback(m_myInst, "DoLogString"))) {
|
||||
PyObject* s = wx2PyString(szString);
|
||||
wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oi)", s, t));
|
||||
Py_DECREF(s);
|
||||
}
|
||||
wxPyEndBlockThreads();
|
||||
if (! found)
|
||||
wxLog::DoLogString(szString, t);
|
||||
@@ -1412,20 +1416,13 @@ public:
|
||||
PyObject* so = wxPyConstructObject((void*)&size, "wxSize", 0);
|
||||
PyObject* ro;
|
||||
wxBitmap* ptr;
|
||||
#if 0
|
||||
ro = wxPyCBH_callCallbackObj(
|
||||
m_myInst, Py_BuildValue("(OOO)",
|
||||
wx2PyString(id),
|
||||
wx2PyString(client),
|
||||
so));
|
||||
#else // testing...
|
||||
PyObject *args, *s1, *s2;
|
||||
PyObject* s1, *s2;
|
||||
s1 = wx2PyString(id);
|
||||
s2 = wx2PyString(client);
|
||||
args = Py_BuildValue("(OOO)", s1, s2, so);
|
||||
ro = wxPyCBH_callCallbackObj(m_myInst, args);
|
||||
#endif
|
||||
ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(OOO)", s1, s2, so));
|
||||
Py_DECREF(so);
|
||||
Py_DECREF(s1);
|
||||
Py_DECREF(s2);
|
||||
if (ro) {
|
||||
if (!SWIG_GetPtrObj(ro, (void**)&ptr, "_wxBitmap_p"))
|
||||
rval = *ptr;
|
||||
|
@@ -191,8 +191,9 @@ wxBitmap wxPyBitmapDataObject::GetBitmap() {
|
||||
void wxPyBitmapDataObject::SetBitmap(const wxBitmap& bitmap) {
|
||||
wxPyBeginBlockThreads();
|
||||
if (m_myInst.findCallback("SetBitmap")) {
|
||||
m_myInst.callCallback(Py_BuildValue("(O)",
|
||||
wxPyConstructObject((void*)&bitmap, "wxBitmap")));
|
||||
PyObject* bo = wxPyConstructObject((void*)&bitmap, "wxBitmap");
|
||||
m_myInst.callCallback(Py_BuildValue("(O)", bo));
|
||||
Py_DECREF(bo);
|
||||
}
|
||||
wxPyEndBlockThreads();
|
||||
}
|
||||
@@ -293,10 +294,11 @@ bool wxPyFileDropTarget::OnDropFiles(wxCoord x, wxCoord y,
|
||||
const wxArrayString& filenames) {
|
||||
bool rval = FALSE;
|
||||
wxPyBeginBlockThreads();
|
||||
if (m_myInst.findCallback("OnDropFiles")) {
|
||||
PyObject* list = wxArrayString2PyList_helper(filenames);
|
||||
if (m_myInst.findCallback("OnDropFiles"))
|
||||
rval = m_myInst.callCallback(Py_BuildValue("(iiO)",x,y,list));
|
||||
Py_DECREF(list);
|
||||
}
|
||||
wxPyEndBlockThreads();
|
||||
return rval;
|
||||
}
|
||||
|
@@ -213,11 +213,13 @@ public:
|
||||
int rval = 0;
|
||||
bool found;
|
||||
wxPyBeginBlockThreads();
|
||||
if ((found = m_myInst.findCallback("OnCompareItems")))
|
||||
rval = m_myInst.callCallback(Py_BuildValue(
|
||||
"(OO)",
|
||||
wxPyConstructObject((void*)&item1, "wxTreeItemId"),
|
||||
wxPyConstructObject((void*)&item2, "wxTreeItemId")));
|
||||
if ((found = m_myInst.findCallback("OnCompareItems"))) {
|
||||
PyObject *o1 = wxPyConstructObject((void*)&item1, "wxTreeItemId");
|
||||
PyObject *o2 = wxPyConstructObject((void*)&item2, "wxTreeItemId");
|
||||
rval = m_myInst.callCallback(Py_BuildValue("(OO)",o1,o2));
|
||||
Py_DECREF(o1);
|
||||
Py_DECREF(o2);
|
||||
}
|
||||
wxPyEndBlockThreads();
|
||||
if (! found)
|
||||
rval = wxTreeCtrl::OnCompareItems(item1, item2);
|
||||
|
@@ -91,6 +91,39 @@ static PyObject* t_output_helper(PyObject* target, PyObject* o) {
|
||||
DECLARE_DEF_STRING2(DateTimeFormatStr, wxT("%c"));
|
||||
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) \
|
||||
wxGridCellAttr* CBNAME(int a, int b, wxGridCellAttr::wxAttrKind c) { \
|
||||
wxGridCellAttr* rval = NULL; \
|
||||
@@ -122,7 +155,7 @@ static PyObject* t_output_helper(PyObject* target, PyObject* o) {
|
||||
wxPyBeginBlockThreads(); \
|
||||
bool found; \
|
||||
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)); \
|
||||
Py_DECREF(obj); \
|
||||
} \
|
||||
@@ -141,7 +174,7 @@ static PyObject* t_output_helper(PyObject* target, PyObject* o) {
|
||||
wxPyBeginBlockThreads(); \
|
||||
bool found; \
|
||||
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)); \
|
||||
Py_DECREF(obj); \
|
||||
} \
|
||||
@@ -198,8 +231,11 @@ static PyObject* t_output_helper(PyObject* target, PyObject* o) {
|
||||
#define PYCALLBACK__INTINTSTRING_pure(CBNAME) \
|
||||
void CBNAME(int a, int b, const wxString& c) { \
|
||||
wxPyBeginBlockThreads(); \
|
||||
if (wxPyCBH_findCallback(m_myInst, #CBNAME)) \
|
||||
wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iiO)",a,b,wx2PyString(c)));\
|
||||
if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
|
||||
PyObject* s = wx2PyString(c); \
|
||||
rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iiO)",a,b,s));\
|
||||
Py_DECREF(s); \
|
||||
} \
|
||||
wxPyEndBlockThreads(); \
|
||||
}
|
||||
|
||||
@@ -232,8 +268,11 @@ static PyObject* t_output_helper(PyObject* target, PyObject* o) {
|
||||
bool rval = 0; \
|
||||
bool found; \
|
||||
wxPyBeginBlockThreads(); \
|
||||
if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
|
||||
rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iiO)", a,b,wx2PyString(c)));\
|
||||
if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
|
||||
PyObject* s = wx2PyString(c); \
|
||||
rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iiO)",a,b,s));\
|
||||
Py_DECREF(s); \
|
||||
} \
|
||||
wxPyEndBlockThreads(); \
|
||||
if (! found) \
|
||||
rval = PCLASS::CBNAME(a,b,c); \
|
||||
@@ -386,8 +425,11 @@ static PyObject* t_output_helper(PyObject* target, PyObject* o) {
|
||||
void CBNAME(int a, const wxString& c) { \
|
||||
bool found; \
|
||||
wxPyBeginBlockThreads(); \
|
||||
if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
|
||||
wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iO)", a, wx2PyString(c))); \
|
||||
if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
|
||||
PyObject* s = wx2PyString(c); \
|
||||
wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iO)",a,s)); \
|
||||
Py_DECREF(s); \
|
||||
} \
|
||||
wxPyEndBlockThreads(); \
|
||||
if (! found) \
|
||||
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
|
||||
{
|
||||
public:
|
||||
@@ -529,13 +538,17 @@ public:
|
||||
int row, int col, bool isSelected) {
|
||||
wxPyBeginBlockThreads();
|
||||
if (wxPyCBH_findCallback(m_myInst, "Draw")) {
|
||||
wxPyCBH_callCallback(m_myInst,
|
||||
Py_BuildValue("(OOOOiii)",
|
||||
wxPyConstructObject((void*)&grid, "wxGrid", 0),
|
||||
wxPyConstructObject((void*)&attr, "wxGridCellAttr", 0),
|
||||
wxPyConstructObject((void*)&dc, "wxDC", 0),
|
||||
wxPyConstructObject((void*)&rect, "wxRect", 0),
|
||||
PyObject* go = wxPyMake_wxObject(&grid);
|
||||
PyObject* dco = wxPyMake_wxObject(&dc);
|
||||
PyObject* ao = wxPyMake_wxGridCellAttr(&attr);
|
||||
PyObject* ro = wxPyConstructObject((void*)&rect, "wxRect", 0);
|
||||
|
||||
wxPyCBH_callCallback(m_myInst, Py_BuildValue("(OOOOiii)", go, ao, dco, ro,
|
||||
row, col, isSelected));
|
||||
Py_DECREF(go);
|
||||
Py_DECREF(ao);
|
||||
Py_DECREF(dco);
|
||||
Py_DECREF(ro);
|
||||
}
|
||||
wxPyEndBlockThreads();
|
||||
}
|
||||
@@ -547,12 +560,17 @@ public:
|
||||
if (wxPyCBH_findCallback(m_myInst, "GetBestSize")) {
|
||||
PyObject* ro;
|
||||
wxSize* ptr;
|
||||
ro = wxPyCBH_callCallbackObj(m_myInst,
|
||||
Py_BuildValue("(OOOii)",
|
||||
wxPyConstructObject((void*)&grid, "wxGrid", 0),
|
||||
wxPyConstructObject((void*)&attr, "wxGridCellAttr", 0),
|
||||
wxPyConstructObject((void*)&dc, "wxDC", 0),
|
||||
PyObject* go = wxPyMake_wxObject(&grid);
|
||||
PyObject* dco = wxPyMake_wxObject(&dc);
|
||||
PyObject* ao = wxPyMake_wxGridCellAttr(&attr);
|
||||
|
||||
ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(OOOii)",
|
||||
go, ao, dco,
|
||||
row, col));
|
||||
Py_DECREF(go);
|
||||
Py_DECREF(ao);
|
||||
Py_DECREF(dco);
|
||||
|
||||
if (ro) {
|
||||
const char* errmsg = "GetBestSize should return a 2-tuple of integers or a wxSize object.";
|
||||
if (!SWIG_GetPtrObj(ro, (void **)&ptr, "_wxSize_p")) {
|
||||
@@ -612,11 +630,12 @@ public:
|
||||
void Create(wxWindow* parent, wxWindowID id, wxEvtHandler* evtHandler) {
|
||||
wxPyBeginBlockThreads();
|
||||
if (wxPyCBH_findCallback(m_myInst, "Create")) {
|
||||
wxPyCBH_callCallback(m_myInst,
|
||||
Py_BuildValue("(OiO)",
|
||||
wxPyConstructObject((void*)parent, "wxWindow", 0),
|
||||
id,
|
||||
wxPyConstructObject((void*)evtHandler, "wxEvtHandler", 0)));
|
||||
PyObject* po = wxPyMake_wxObject(parent);
|
||||
PyObject* eo = wxPyMake_wxObject(evtHandler);
|
||||
|
||||
wxPyCBH_callCallback(m_myInst, Py_BuildValue("(OiO)", po, id, eo));
|
||||
Py_DECREF(po);
|
||||
Py_DECREF(eo);
|
||||
}
|
||||
wxPyEndBlockThreads();
|
||||
}
|
||||
@@ -625,9 +644,9 @@ public:
|
||||
void BeginEdit(int row, int col, wxGrid* grid) {
|
||||
wxPyBeginBlockThreads();
|
||||
if (wxPyCBH_findCallback(m_myInst, "BeginEdit")) {
|
||||
wxPyCBH_callCallback(m_myInst,
|
||||
Py_BuildValue("(iiO)", row, col,
|
||||
wxPyConstructObject((void*)grid, "wxGrid", 0)));
|
||||
PyObject* go = wxPyMake_wxObject(grid);
|
||||
wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iiO)", row, col, go));
|
||||
Py_DECREF(go);
|
||||
}
|
||||
wxPyEndBlockThreads();
|
||||
}
|
||||
@@ -637,9 +656,9 @@ public:
|
||||
bool rv = FALSE;
|
||||
wxPyBeginBlockThreads();
|
||||
if (wxPyCBH_findCallback(m_myInst, "EndEdit")) {
|
||||
rv = wxPyCBH_callCallback(m_myInst,
|
||||
Py_BuildValue("(iiO)", row, col,
|
||||
wxPyConstructObject((void*)grid, "wxGrid", 0)));
|
||||
PyObject* go = wxPyMake_wxObject(grid);
|
||||
rv = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iiO)", row, col, go));
|
||||
Py_DECREF(go);
|
||||
}
|
||||
wxPyEndBlockThreads();
|
||||
return rv;
|
||||
@@ -667,10 +686,11 @@ public:
|
||||
void Show(bool show, wxGridCellAttr *attr) {
|
||||
bool found;
|
||||
wxPyBeginBlockThreads();
|
||||
if ((found = wxPyCBH_findCallback(m_myInst, "Show")))
|
||||
wxPyCBH_callCallback(m_myInst,
|
||||
Py_BuildValue("(iO)", show,
|
||||
wxPyConstructObject((void*)attr, "wxGridCellAttr", 0)));
|
||||
if ((found = wxPyCBH_findCallback(m_myInst, "Show"))) {
|
||||
PyObject* ao = wxPyMake_wxGridCellAttr(attr);
|
||||
wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iO)", show, ao));
|
||||
Py_DECREF(ao);
|
||||
}
|
||||
wxPyEndBlockThreads();
|
||||
if (! found)
|
||||
wxGridCellEditor::Show(show, attr);
|
||||
@@ -681,13 +701,17 @@ public:
|
||||
|
||||
|
||||
void PaintBackground(const wxRect& rectCell, wxGridCellAttr *attr) {
|
||||
bool found; \
|
||||
bool found;
|
||||
wxPyBeginBlockThreads();
|
||||
if ((found = wxPyCBH_findCallback(m_myInst, "PaintBackground)")))
|
||||
wxPyCBH_callCallback(m_myInst,
|
||||
Py_BuildValue("(OO)",
|
||||
wxPyConstructObject((void*)&rectCell, "wxRect", 0),
|
||||
wxPyConstructObject((void*)attr, "wxGridCellAttr", 0)));
|
||||
if ((found = wxPyCBH_findCallback(m_myInst, "PaintBackground)"))) {
|
||||
PyObject* ao = wxPyMake_wxGridCellAttr(attr);
|
||||
PyObject* ro = wxPyConstructObject((void*)&rectCell, "wxRect", 0);
|
||||
|
||||
wxPyCBH_callCallback(m_myInst, Py_BuildValue("(OO)", ro, ao));
|
||||
|
||||
Py_DECREF(ro);
|
||||
Py_DECREF(ao);
|
||||
}
|
||||
wxPyEndBlockThreads();
|
||||
if (! found)
|
||||
wxGridCellEditor::PaintBackground(rectCell, attr);
|
||||
@@ -780,7 +804,9 @@ public:
|
||||
void SetValue(int row, int col, const wxString& val) {
|
||||
wxPyBeginBlockThreads();
|
||||
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();
|
||||
}
|
||||
|
@@ -264,7 +264,9 @@ wxHtmlOpeningStatus wxPyHtmlWindow::OnOpeningURL(wxHtmlURLType type,
|
||||
wxPyBeginBlockThreads();
|
||||
if ((found = wxPyCBH_findCallback(m_myInst, "OnOpeningURL"))) {
|
||||
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 PYTHON_API_VERSION >= 1009
|
||||
|| PyUnicode_Check(ro)
|
||||
|
@@ -145,9 +145,11 @@ public:
|
||||
virtual void DoLog(wxLogLevel level, const wxChar *szString, time_t t) {
|
||||
bool found;
|
||||
wxPyBeginBlockThreads();
|
||||
if ((found = wxPyCBH_findCallback(m_myInst, "DoLog")))
|
||||
wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iOi)", level,
|
||||
wx2PyString(szString), t));
|
||||
if ((found = wxPyCBH_findCallback(m_myInst, "DoLog"))) {
|
||||
PyObject* s = wx2PyString(szString);
|
||||
wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iOi)", level, s, t));
|
||||
Py_DECREF(s);
|
||||
}
|
||||
wxPyEndBlockThreads();
|
||||
if (! found)
|
||||
wxLog::DoLog(level, szString, t);
|
||||
@@ -156,9 +158,11 @@ public:
|
||||
virtual void DoLogString(const wxChar *szString, time_t t) {
|
||||
bool found;
|
||||
wxPyBeginBlockThreads();
|
||||
if ((found = wxPyCBH_findCallback(m_myInst, "DoLogString")))
|
||||
wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oi)",
|
||||
wx2PyString(szString), t));
|
||||
if ((found = wxPyCBH_findCallback(m_myInst, "DoLogString"))) {
|
||||
PyObject* s = wx2PyString(szString);
|
||||
wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oi)", s, t));
|
||||
Py_DECREF(s);
|
||||
}
|
||||
wxPyEndBlockThreads();
|
||||
if (! found)
|
||||
wxLog::DoLogString(szString, t);
|
||||
@@ -289,20 +293,13 @@ public:
|
||||
PyObject* so = wxPyConstructObject((void*)&size, "wxSize", 0);
|
||||
PyObject* ro;
|
||||
wxBitmap* ptr;
|
||||
#if 0
|
||||
ro = wxPyCBH_callCallbackObj(
|
||||
m_myInst, Py_BuildValue("(OOO)",
|
||||
wx2PyString(id),
|
||||
wx2PyString(client),
|
||||
so));
|
||||
#else // testing...
|
||||
PyObject *args, *s1, *s2;
|
||||
PyObject* s1, *s2;
|
||||
s1 = wx2PyString(id);
|
||||
s2 = wx2PyString(client);
|
||||
args = Py_BuildValue("(OOO)", s1, s2, so);
|
||||
ro = wxPyCBH_callCallbackObj(m_myInst, args);
|
||||
#endif
|
||||
ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(OOO)", s1, s2, so));
|
||||
Py_DECREF(so);
|
||||
Py_DECREF(s1);
|
||||
Py_DECREF(s2);
|
||||
if (ro) {
|
||||
if (!SWIG_GetPtrObj(ro, (void**)&ptr, "_wxBitmap_p"))
|
||||
rval = *ptr;
|
||||
|
@@ -1788,8 +1788,6 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = {
|
||||
{ "_uint","_int",0},
|
||||
{ "_uint","_wxWindowID",0},
|
||||
{ "_wxChar","_char",0},
|
||||
{ "_wxString","_wxArtID",0},
|
||||
{ "_wxString","_wxArtClient",0},
|
||||
{ "_char","_wxChar",0},
|
||||
{ "_struct_wxNativeFontInfo","_wxNativeFontInfo",0},
|
||||
{ "_EBool","_wxCoord",0},
|
||||
@@ -1863,11 +1861,7 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = {
|
||||
{ "_wxCoord","_size_t",0},
|
||||
{ "_wxCoord","_time_t",0},
|
||||
{ "_wxCoord","_wxPrintQuality",0},
|
||||
{ "_wxArtClient","_wxArtID",0},
|
||||
{ "_wxArtClient","_wxString",0},
|
||||
{ "_wxEvtHandler","_wxPyApp",SwigwxPyAppTowxEvtHandler},
|
||||
{ "_wxArtID","_wxString",0},
|
||||
{ "_wxArtID","_wxArtClient",0},
|
||||
{0,0,0}};
|
||||
|
||||
static PyObject *SWIG_globals;
|
||||
|
Reference in New Issue
Block a user