Since the wxPyMake_wxObject typemap is also used for constructors we
need to allow it to use the $owner value to specify if the thisown attribute shoudl be set to true. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@28110 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -45,17 +45,17 @@ MAKE_CONST_WXSTRING2(DateTimeFormatStr, wxT("%c"));
|
||||
//---------------------------------------------------------------------------
|
||||
// OOR related typemaps and helper functions
|
||||
|
||||
%typemap(out) wxGridCellRenderer* { $result = wxPyMake_wxGridCellRenderer($1); }
|
||||
%typemap(out) wxGridCellEditor* { $result = wxPyMake_wxGridCellEditor($1); }
|
||||
%typemap(out) wxGridCellAttr* { $result = wxPyMake_wxGridCellAttr($1); }
|
||||
%typemap(out) wxGridCellAttrProvider* { $result = wxPyMake_wxGridCellAttrProvider($1); }
|
||||
%typemap(out) wxGridTableBase* { $result = wxPyMake_wxGridTableBase($1); }
|
||||
%typemap(out) wxGridCellRenderer* { $result = wxPyMake_wxGridCellRenderer($1, $owner); }
|
||||
%typemap(out) wxGridCellEditor* { $result = wxPyMake_wxGridCellEditor($1, $owner); }
|
||||
%typemap(out) wxGridCellAttr* { $result = wxPyMake_wxGridCellAttr($1, $owner); }
|
||||
%typemap(out) wxGridCellAttrProvider* { $result = wxPyMake_wxGridCellAttrProvider($1, $owner); }
|
||||
%typemap(out) wxGridTableBase* { $result = wxPyMake_wxGridTableBase($1, $owner); }
|
||||
|
||||
|
||||
%{
|
||||
|
||||
#define wxPyMake_TEMPLATE(TYPE) \
|
||||
PyObject* wxPyMake_##TYPE(TYPE* source) { \
|
||||
PyObject* wxPyMake_##TYPE(TYPE* source, bool setThisOwn) { \
|
||||
PyObject* target = NULL; \
|
||||
if (source) { \
|
||||
/* Check if there is already a pointer to a Python object in the \
|
||||
@@ -68,7 +68,7 @@ PyObject* wxPyMake_##TYPE(TYPE* source) { \
|
||||
/* Otherwise make a new wrapper for it the old fashioned way and \
|
||||
give it the OOR treatment */ \
|
||||
if (! target) { \
|
||||
target = wxPyConstructObject(source, wxT(#TYPE), False); \
|
||||
target = wxPyConstructObject(source, wxT(#TYPE), setThisOwn); \
|
||||
if (target) \
|
||||
source->SetClientObject(new wxPyOORClientData(target)); \
|
||||
} \
|
||||
@@ -126,7 +126,7 @@ wxPyMake_TEMPLATE(wxGridTableBase)
|
||||
bool blocked = wxPyBeginBlockThreads(); \
|
||||
bool found; \
|
||||
if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
|
||||
PyObject* obj = wxPyMake_wxGridCellAttr(attr); \
|
||||
PyObject* obj = wxPyMake_wxGridCellAttr(attr,false); \
|
||||
wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oii)", obj, a, b)); \
|
||||
Py_DECREF(obj); \
|
||||
} \
|
||||
@@ -145,7 +145,7 @@ wxPyMake_TEMPLATE(wxGridTableBase)
|
||||
bool blocked = wxPyBeginBlockThreads(); \
|
||||
bool found; \
|
||||
if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
|
||||
PyObject* obj = wxPyMake_wxGridCellAttr(attr); \
|
||||
PyObject* obj = wxPyMake_wxGridCellAttr(attr,false); \
|
||||
wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oi)", obj, val)); \
|
||||
Py_DECREF(obj); \
|
||||
} \
|
||||
@@ -566,9 +566,9 @@ public:
|
||||
int row, int col, bool isSelected) {
|
||||
bool blocked = wxPyBeginBlockThreads();
|
||||
if (wxPyCBH_findCallback(m_myInst, "Draw")) {
|
||||
PyObject* go = wxPyMake_wxObject(&grid);
|
||||
PyObject* dco = wxPyMake_wxObject(&dc);
|
||||
PyObject* ao = wxPyMake_wxGridCellAttr(&attr);
|
||||
PyObject* go = wxPyMake_wxObject(&grid,false);
|
||||
PyObject* dco = wxPyMake_wxObject(&dc,false);
|
||||
PyObject* ao = wxPyMake_wxGridCellAttr(&attr,false);
|
||||
PyObject* ro = wxPyConstructObject((void*)&rect, wxT("wxRect"), 0);
|
||||
|
||||
wxPyCBH_callCallback(m_myInst, Py_BuildValue("(OOOOiii)", go, ao, dco, ro,
|
||||
@@ -588,9 +588,9 @@ public:
|
||||
if (wxPyCBH_findCallback(m_myInst, "GetBestSize")) {
|
||||
PyObject* ro;
|
||||
wxSize* ptr;
|
||||
PyObject* go = wxPyMake_wxObject(&grid);
|
||||
PyObject* dco = wxPyMake_wxObject(&dc);
|
||||
PyObject* ao = wxPyMake_wxGridCellAttr(&attr);
|
||||
PyObject* go = wxPyMake_wxObject(&grid,false);
|
||||
PyObject* dco = wxPyMake_wxObject(&dc,false);
|
||||
PyObject* ao = wxPyMake_wxGridCellAttr(&attr,false);
|
||||
|
||||
ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(OOOii)",
|
||||
go, ao, dco,
|
||||
@@ -782,8 +782,8 @@ public:
|
||||
void Create(wxWindow* parent, wxWindowID id, wxEvtHandler* evtHandler) {
|
||||
bool blocked = wxPyBeginBlockThreads();
|
||||
if (wxPyCBH_findCallback(m_myInst, "Create")) {
|
||||
PyObject* po = wxPyMake_wxObject(parent);
|
||||
PyObject* eo = wxPyMake_wxObject(evtHandler);
|
||||
PyObject* po = wxPyMake_wxObject(parent,false);
|
||||
PyObject* eo = wxPyMake_wxObject(evtHandler,false);
|
||||
|
||||
wxPyCBH_callCallback(m_myInst, Py_BuildValue("(OiO)", po, id, eo));
|
||||
Py_DECREF(po);
|
||||
@@ -796,7 +796,7 @@ public:
|
||||
void BeginEdit(int row, int col, wxGrid* grid) {
|
||||
bool blocked = wxPyBeginBlockThreads();
|
||||
if (wxPyCBH_findCallback(m_myInst, "BeginEdit")) {
|
||||
PyObject* go = wxPyMake_wxObject(grid);
|
||||
PyObject* go = wxPyMake_wxObject(grid,false);
|
||||
wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iiO)", row, col, go));
|
||||
Py_DECREF(go);
|
||||
}
|
||||
@@ -808,7 +808,7 @@ public:
|
||||
bool rv = False;
|
||||
bool blocked = wxPyBeginBlockThreads();
|
||||
if (wxPyCBH_findCallback(m_myInst, "EndEdit")) {
|
||||
PyObject* go = wxPyMake_wxObject(grid);
|
||||
PyObject* go = wxPyMake_wxObject(grid,false);
|
||||
rv = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iiO)", row, col, go));
|
||||
Py_DECREF(go);
|
||||
}
|
||||
@@ -839,7 +839,7 @@ public:
|
||||
bool found;
|
||||
bool blocked = wxPyBeginBlockThreads();
|
||||
if ((found = wxPyCBH_findCallback(m_myInst, "Show"))) {
|
||||
PyObject* ao = wxPyMake_wxGridCellAttr(attr);
|
||||
PyObject* ao = wxPyMake_wxGridCellAttr(attr,false);
|
||||
wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iO)", show, ao));
|
||||
Py_DECREF(ao);
|
||||
}
|
||||
@@ -856,7 +856,7 @@ public:
|
||||
bool found;
|
||||
bool blocked = wxPyBeginBlockThreads();
|
||||
if ((found = wxPyCBH_findCallback(m_myInst, "PaintBackground)"))) {
|
||||
PyObject* ao = wxPyMake_wxGridCellAttr(attr);
|
||||
PyObject* ao = wxPyMake_wxGridCellAttr(attr,false);
|
||||
PyObject* ro = wxPyConstructObject((void*)&rectCell, wxT("wxRect"), 0);
|
||||
|
||||
wxPyCBH_callCallback(m_myInst, Py_BuildValue("(OO)", ro, ao));
|
||||
|
Reference in New Issue
Block a user