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:
Robin Dunn
2004-06-30 20:12:14 +00:00
parent 488256e0a1
commit 6d450e1a20
11 changed files with 111 additions and 115 deletions

View File

@@ -285,7 +285,7 @@ public:
bool found; bool found;
bool blocked = wxPyBeginBlockThreads(); bool blocked = wxPyBeginBlockThreads();
if ((found = wxPyCBH_findCallback(m_myInst, "DrawItem"))) { if ((found = wxPyCBH_findCallback(m_myInst, "DrawItem"))) {
PyObject* dcobj = wxPyMake_wxObject(&dc); PyObject* dcobj = wxPyMake_wxObject(&dc,false);
PyObject* idobj = wxPyConstructObject((void*)&id, wxT("wxTreeItemId"), False); PyObject* idobj = wxPyConstructObject((void*)&id, wxT("wxTreeItemId"), False);
PyObject* recobj= wxPyConstructObject((void*)&rect, wxT("wxRect"), False); PyObject* recobj= wxPyConstructObject((void*)&rect, wxT("wxRect"), False);
wxPyCBH_callCallback(m_myInst, Py_BuildValue("(OOO)", dcobj, idobj, recobj)); wxPyCBH_callCallback(m_myInst, Py_BuildValue("(OOO)", dcobj, idobj, recobj));
@@ -951,7 +951,7 @@ public:
wxTreeItemId FindItem (const wxTreeItemId& item, const wxString& str, int flags = 0); wxTreeItemId FindItem (const wxTreeItemId& item, const wxString& str, int flags = 0);
wxWindow* GetHeaderWindow() const; wxWindow* GetHeaderWindow() const;
wxWindow* GetMainWindow() const; wxScrolledWindow* GetMainWindow() const;
}; };

View File

@@ -16,15 +16,15 @@
// OOR Support // OOR Support
%typemap(out) wxPyShape* { $result = wxPyMake_wxShapeEvtHandler($1); } %typemap(out) wxPyShape* { $result = wxPyMake_wxShapeEvtHandler($1, $owner); }
%typemap(out) wxPyShapeEvtHandler* { $result = wxPyMake_wxShapeEvtHandler($1); } %typemap(out) wxPyShapeEvtHandler* { $result = wxPyMake_wxShapeEvtHandler($1, $owner); }
%typemap(out) wxPyDivisionShape* { $result = wxPyMake_wxShapeEvtHandler($1); } %typemap(out) wxPyDivisionShape* { $result = wxPyMake_wxShapeEvtHandler($1, $owner); }
%typemap(out) wxPyShapeCanvas* { $result = wxPyMake_wxObject($1); } %typemap(out) wxPyShapeCanvas* { $result = wxPyMake_wxObject($1, $owner); }
%typemap(out) wxDiagram* { $result = wxPyMake_wxObject($1); } %typemap(out) wxDiagram* { $result = wxPyMake_wxObject($1, $owner); }
%typemap(out) wxOGLConstraint* { $result = wxPyMake_wxObject($1); } %typemap(out) wxOGLConstraint* { $result = wxPyMake_wxObject($1, $owner); }
%typemap(out) wxPseudoMetaFile* { $result = wxPyMake_wxObject($1); } %typemap(out) wxPseudoMetaFile* { $result = wxPyMake_wxObject($1, $owner); }
%typemap(out) wxArrowHead* { $result = wxPyMake_wxObject($1); } %typemap(out) wxArrowHead* { $result = wxPyMake_wxObject($1, $owner); }

View File

@@ -245,7 +245,7 @@ wxList* wxPy_wxRealPoint_ListHelper(PyObject* pyList) {
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
PyObject* wxPyMake_wxShapeEvtHandler(wxShapeEvtHandler* source) { PyObject* wxPyMake_wxShapeEvtHandler(wxShapeEvtHandler* source, bool setThisOwn) {
PyObject* target = NULL; PyObject* target = NULL;
if (source && wxIsKindOf(source, wxShapeEvtHandler)) { if (source && wxIsKindOf(source, wxShapeEvtHandler)) {
@@ -260,7 +260,7 @@ PyObject* wxPyMake_wxShapeEvtHandler(wxShapeEvtHandler* source) {
} }
} }
if (! target) { if (! target) {
target = wxPyMake_wxObject2(source, FALSE); target = wxPyMake_wxObject2(source, setThisOwn, false);
if (target != Py_None) if (target != Py_None)
((wxShapeEvtHandler*)source)->SetClientObject(new wxPyOORClientData(target)); ((wxShapeEvtHandler*)source)->SetClientObject(new wxPyOORClientData(target));
} }
@@ -301,7 +301,7 @@ PyObject* wxPy_ConvertShapeList(wxListBase* listbase) {
pyList = PyList_New(0); pyList = PyList_New(0);
while (node) { while (node) {
wxObj = node->GetData(); wxObj = node->GetData();
pyObj = wxPyMake_wxShapeEvtHandler((wxShapeEvtHandler*)wxObj); pyObj = wxPyMake_wxShapeEvtHandler((wxShapeEvtHandler*)wxObj, false);
PyList_Append(pyList, pyObj); PyList_Append(pyList, pyObj);
node = node->GetNext(); node = node->GetNext();
} }

View File

@@ -115,9 +115,9 @@ inline wxPyCoreAPI* wxPyGetCoreAPIPtr()
#define wxPyCBH_callCallbackObj(a, b) (wxPyGetCoreAPIPtr()->p_wxPyCBH_callCallbackObj(a, b)) #define wxPyCBH_callCallbackObj(a, b) (wxPyGetCoreAPIPtr()->p_wxPyCBH_callCallbackObj(a, b))
#define wxPyCBH_delete(a) (wxPyGetCoreAPIPtr()->p_wxPyCBH_delete(a)) #define wxPyCBH_delete(a) (wxPyGetCoreAPIPtr()->p_wxPyCBH_delete(a))
#define wxPyMake_wxObject(a) (wxPyGetCoreAPIPtr()->p_wxPyMake_wxObject(a,True)) #define wxPyMake_wxObject(a,b) (wxPyGetCoreAPIPtr()->p_wxPyMake_wxObject(a,b,True))
#define wxPyMake_wxObject2(a,b) (wxPyGetCoreAPIPtr()->p_wxPyMake_wxObject(a,b)) #define wxPyMake_wxObject2(a,b,c) (wxPyGetCoreAPIPtr()->p_wxPyMake_wxObject(a,b,c))
#define wxPyMake_wxSizer(a) (wxPyGetCoreAPIPtr()->p_wxPyMake_wxSizer(a)) #define wxPyMake_wxSizer(a,b) (wxPyGetCoreAPIPtr()->p_wxPyMake_wxSizer(a,b))
#define wxPyPtrTypeMap_Add(a, b) (wxPyGetCoreAPIPtr()->p_wxPyPtrTypeMap_Add(a, b)) #define wxPyPtrTypeMap_Add(a, b) (wxPyGetCoreAPIPtr()->p_wxPyPtrTypeMap_Add(a, b))
#define wxPy2int_seq_helper(a, b, c) (wxPyGetCoreAPIPtr()->p_wxPy2int_seq_helper(a, b, c)) #define wxPy2int_seq_helper(a, b, c) (wxPyGetCoreAPIPtr()->p_wxPy2int_seq_helper(a, b, c))
#define wxPy4int_seq_helper(a, b, c, d, e) (wxPyGetCoreAPIPtr()->p_wxPy4int_seq_helper(a, b, c, d, e)) #define wxPy4int_seq_helper(a, b, c, d, e) (wxPyGetCoreAPIPtr()->p_wxPy4int_seq_helper(a, b, c, d, e))

View File

@@ -109,8 +109,8 @@ PyObject* wxPyMakeSwigPtr(void* ptr, const wxChar* classname);
PyObject* wx2PyString(const wxString& src); PyObject* wx2PyString(const wxString& src);
wxString Py2wxString(PyObject* source); wxString Py2wxString(PyObject* source);
PyObject* wxPyMake_wxObject(wxObject* source, bool checkEvtHandler=True); PyObject* wxPyMake_wxObject(wxObject* source, bool setThisOwn, bool checkEvtHandler=True);
PyObject* wxPyMake_wxSizer(wxSizer* source); PyObject* wxPyMake_wxSizer(wxSizer* source, bool setThisOwn);
void wxPyPtrTypeMap_Add(const char* commonName, const char* ptrName); void wxPyPtrTypeMap_Add(const char* commonName, const char* ptrName);
PyObject* wxPy_ConvertList(wxListBase* list); PyObject* wxPy_ConvertList(wxListBase* list);
@@ -414,8 +414,8 @@ struct wxPyCoreAPI {
PyObject* (*p_wxPyCBH_callCallbackObj)(const wxPyCallbackHelper& cbh, PyObject* argTuple); PyObject* (*p_wxPyCBH_callCallbackObj)(const wxPyCallbackHelper& cbh, PyObject* argTuple);
void (*p_wxPyCBH_delete)(wxPyCallbackHelper* cbh); void (*p_wxPyCBH_delete)(wxPyCallbackHelper* cbh);
PyObject* (*p_wxPyMake_wxObject)(wxObject* source, bool checkEvtHandler); PyObject* (*p_wxPyMake_wxObject)(wxObject* source, bool setThisOwn, bool checkEvtHandler);
PyObject* (*p_wxPyMake_wxSizer)(wxSizer* source); PyObject* (*p_wxPyMake_wxSizer)(wxSizer* source, bool setThisOwn);
void (*p_wxPyPtrTypeMap_Add)(const char* commonName, const char* ptrName); void (*p_wxPyPtrTypeMap_Add)(const char* commonName, const char* ptrName);
bool (*p_wxPy2int_seq_helper)(PyObject* source, int* i1, int* i2); bool (*p_wxPy2int_seq_helper)(PyObject* source, int* i1, int* i2);
bool (*p_wxPy4int_seq_helper)(PyObject* source, int* i1, int* i2, int* i3, int* i4); bool (*p_wxPy4int_seq_helper)(PyObject* source, int* i1, int* i2, int* i3, int* i4);
@@ -939,7 +939,7 @@ extern wxPyApp *wxPythonApp;
bool found; \ bool found; \
bool blocked = wxPyBeginBlockThreads(); \ bool blocked = 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,false); \
wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \ wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
Py_DECREF(obj); \ Py_DECREF(obj); \
} \ } \
@@ -965,7 +965,7 @@ extern wxPyApp *wxPythonApp;
bool found; \ bool found; \
bool blocked = wxPyBeginBlockThreads(); \ bool blocked = 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,false); \
wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oi)", obj, (int)b)); \ wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oi)", obj, (int)b)); \
Py_DECREF(obj); \ Py_DECREF(obj); \
} \ } \
@@ -989,7 +989,7 @@ extern wxPyApp *wxPythonApp;
bool found; \ bool found; \
bool blocked = wxPyBeginBlockThreads(); \ bool blocked = 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,false); \
wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oi)", obj, (int)b)); \ wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oi)", obj, (int)b)); \
Py_DECREF(obj); \ Py_DECREF(obj); \
} \ } \
@@ -1056,7 +1056,7 @@ extern wxPyApp *wxPythonApp;
bool found; \ bool found; \
bool blocked = wxPyBeginBlockThreads(); \ bool blocked = 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,false); \
wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oddddi)", obj, b, c, d, e, (int)f)); \ wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oddddi)", obj, b, c, d, e, (int)f)); \
Py_DECREF(obj); \ Py_DECREF(obj); \
} \ } \
@@ -1081,7 +1081,7 @@ extern wxPyApp *wxPythonApp;
bool blocked = wxPyBeginBlockThreads(); \ bool blocked = wxPyBeginBlockThreads(); \
bool rval=False; \ bool rval=False; \
if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \ if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
PyObject* obj = wxPyMake_wxObject(&a); \ PyObject* obj = wxPyMake_wxObject(&a,false); \
rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oddddi)", obj, b, c, d, e, (int)f));\ rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oddddi)", obj, b, c, d, e, (int)f));\
Py_DECREF(obj); \ Py_DECREF(obj); \
} \ } \
@@ -1128,7 +1128,7 @@ extern wxPyApp *wxPythonApp;
bool found; \ bool found; \
bool blocked = wxPyBeginBlockThreads(); \ bool blocked = 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,false); \
wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Odddd)", obj, b, c, d, e)); \ wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Odddd)", obj, b, c, d, e)); \
Py_DECREF(obj); \ Py_DECREF(obj); \
} \ } \
@@ -1152,7 +1152,7 @@ extern wxPyApp *wxPythonApp;
bool found; \ bool found; \
bool blocked = wxPyBeginBlockThreads(); \ bool blocked = 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,false); \
wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oi)", obj, (int)b)); \ wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oi)", obj, (int)b)); \
Py_DECREF(obj); \ Py_DECREF(obj); \
} \ } \
@@ -1177,7 +1177,7 @@ extern wxPyApp *wxPythonApp;
bool found; \ bool found; \
bool blocked = wxPyBeginBlockThreads(); \ bool blocked = 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,false); \
wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oiddii)", obj, (int)b, c, d, e, f));\ wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oiddii)", obj, (int)b, c, d, e, f));\
Py_DECREF(obj); \ Py_DECREF(obj); \
} \ } \
@@ -1202,7 +1202,7 @@ extern wxPyApp *wxPythonApp;
bool found; \ bool found; \
bool blocked = wxPyBeginBlockThreads(); \ bool blocked = 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,false); \
wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oddii)", obj, b, c, d, e)); \ wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oddii)", obj, b, c, d, e)); \
Py_DECREF(obj); \ Py_DECREF(obj); \
} \ } \
@@ -1679,7 +1679,7 @@ extern wxPyApp *wxPythonApp;
bool found; \ bool found; \
bool blocked = wxPyBeginBlockThreads(); \ bool blocked = 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,false); \
rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \ rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
Py_DECREF(obj); \ Py_DECREF(obj); \
} \ } \
@@ -1705,8 +1705,8 @@ extern wxPyApp *wxPythonApp;
bool found; \ bool found; \
bool blocked = wxPyBeginBlockThreads(); \ bool blocked = wxPyBeginBlockThreads(); \
if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \ if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
PyObject* win = wxPyMake_wxObject(a); \ PyObject* win = wxPyMake_wxObject(a,false); \
PyObject* dc = wxPyMake_wxObject(&b); \ PyObject* dc = wxPyMake_wxObject(&b,false); \
rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(OO)", win, dc));\ rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(OO)", win, dc));\
Py_DECREF(win); \ Py_DECREF(win); \
Py_DECREF(dc); \ Py_DECREF(dc); \
@@ -1732,7 +1732,7 @@ extern wxPyApp *wxPythonApp;
bool found; \ bool found; \
bool blocked = wxPyBeginBlockThreads(); \ bool blocked = 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,false); \
wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \ wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
Py_DECREF(obj); \ Py_DECREF(obj); \
} \ } \
@@ -1824,7 +1824,7 @@ extern wxPyApp *wxPythonApp;
wxFSFile* rval=0; \ wxFSFile* rval=0; \
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,false); \
PyObject* s = wx2PyString(b); \ PyObject* s = wx2PyString(b); \
ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(OO)", \ ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(OO)", \
obj, s)); \ obj, s)); \
@@ -2367,7 +2367,7 @@ extern wxPyApp *wxPythonApp;
bool found; \ bool found; \
bool blocked = wxPyBeginBlockThreads(); \ bool blocked = 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,false); \
PyObject* ro = wxPyConstructObject((void*)&b, wxT("wxRect"), 0); \ PyObject* ro = wxPyConstructObject((void*)&b, wxT("wxRect"), 0); \
wxPyCBH_callCallback(m_myInst, Py_BuildValue("(OOi)", obj, ro, (int)c)); \ wxPyCBH_callCallback(m_myInst, Py_BuildValue("(OOi)", obj, ro, (int)c)); \
Py_DECREF(obj); \ Py_DECREF(obj); \
@@ -2387,7 +2387,7 @@ extern wxPyApp *wxPythonApp;
bool found; \ bool found; \
bool blocked = wxPyBeginBlockThreads(); \ bool blocked = 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,false); \
PyObject* ro = wxPyConstructObject((void*)&b, wxT("wxRect"), 0); \ PyObject* ro = wxPyConstructObject((void*)&b, wxT("wxRect"), 0); \
wxPyCBH_callCallback(m_myInst, Py_BuildValue("(OOi)", obj, ro, (int)c)); \ wxPyCBH_callCallback(m_myInst, Py_BuildValue("(OOi)", obj, ro, (int)c)); \
Py_DECREF(obj); \ Py_DECREF(obj); \

View File

@@ -550,8 +550,8 @@ public:
bool found; \ bool found; \
bool blocked = wxPyBeginBlockThreads(); \ bool blocked = wxPyBeginBlockThreads(); \
if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \ if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
PyObject* win = wxPyMake_wxObject(a); \ PyObject* win = wxPyMake_wxObject(a,false); \
PyObject* dc = wxPyMake_wxObject(&b); \ PyObject* dc = wxPyMake_wxObject(&b,false); \
rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(OO)", win, dc));\ rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(OO)", win, dc));\
Py_DECREF(win); \ Py_DECREF(win); \
Py_DECREF(dc); \ Py_DECREF(dc); \

View File

@@ -1302,7 +1302,7 @@ themes represent the appearance chosen by the user to be used for all
applications on the system.", ""); applications on the system.", "");
DocDeclStr( DocDeclStr(
void , SetOwnBackroundColour(const wxColour& colour), void , SetOwnBackgroundColour(const wxColour& colour),
"", ""); "", "");

View File

@@ -45,17 +45,17 @@ MAKE_CONST_WXSTRING2(DateTimeFormatStr, wxT("%c"));
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
// OOR related typemaps and helper functions // OOR related typemaps and helper functions
%typemap(out) wxGridCellRenderer* { $result = wxPyMake_wxGridCellRenderer($1); } %typemap(out) wxGridCellRenderer* { $result = wxPyMake_wxGridCellRenderer($1, $owner); }
%typemap(out) wxGridCellEditor* { $result = wxPyMake_wxGridCellEditor($1); } %typemap(out) wxGridCellEditor* { $result = wxPyMake_wxGridCellEditor($1, $owner); }
%typemap(out) wxGridCellAttr* { $result = wxPyMake_wxGridCellAttr($1); } %typemap(out) wxGridCellAttr* { $result = wxPyMake_wxGridCellAttr($1, $owner); }
%typemap(out) wxGridCellAttrProvider* { $result = wxPyMake_wxGridCellAttrProvider($1); } %typemap(out) wxGridCellAttrProvider* { $result = wxPyMake_wxGridCellAttrProvider($1, $owner); }
%typemap(out) wxGridTableBase* { $result = wxPyMake_wxGridTableBase($1); } %typemap(out) wxGridTableBase* { $result = wxPyMake_wxGridTableBase($1, $owner); }
%{ %{
#define wxPyMake_TEMPLATE(TYPE) \ #define wxPyMake_TEMPLATE(TYPE) \
PyObject* wxPyMake_##TYPE(TYPE* source) { \ PyObject* wxPyMake_##TYPE(TYPE* source, bool setThisOwn) { \
PyObject* target = NULL; \ PyObject* target = NULL; \
if (source) { \ if (source) { \
/* Check if there is already a pointer to a Python object in the \ /* 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 \ /* Otherwise make a new wrapper for it the old fashioned way and \
give it the OOR treatment */ \ give it the OOR treatment */ \
if (! target) { \ if (! target) { \
target = wxPyConstructObject(source, wxT(#TYPE), False); \ target = wxPyConstructObject(source, wxT(#TYPE), setThisOwn); \
if (target) \ if (target) \
source->SetClientObject(new wxPyOORClientData(target)); \ source->SetClientObject(new wxPyOORClientData(target)); \
} \ } \
@@ -126,7 +126,7 @@ wxPyMake_TEMPLATE(wxGridTableBase)
bool blocked = wxPyBeginBlockThreads(); \ bool blocked = wxPyBeginBlockThreads(); \
bool found; \ bool found; \
if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \ 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)); \ wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oii)", obj, a, b)); \
Py_DECREF(obj); \ Py_DECREF(obj); \
} \ } \
@@ -145,7 +145,7 @@ wxPyMake_TEMPLATE(wxGridTableBase)
bool blocked = wxPyBeginBlockThreads(); \ bool blocked = wxPyBeginBlockThreads(); \
bool found; \ bool found; \
if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \ 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)); \ wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oi)", obj, val)); \
Py_DECREF(obj); \ Py_DECREF(obj); \
} \ } \
@@ -566,9 +566,9 @@ public:
int row, int col, bool isSelected) { int row, int col, bool isSelected) {
bool blocked = wxPyBeginBlockThreads(); bool blocked = wxPyBeginBlockThreads();
if (wxPyCBH_findCallback(m_myInst, "Draw")) { if (wxPyCBH_findCallback(m_myInst, "Draw")) {
PyObject* go = wxPyMake_wxObject(&grid); PyObject* go = wxPyMake_wxObject(&grid,false);
PyObject* dco = wxPyMake_wxObject(&dc); PyObject* dco = wxPyMake_wxObject(&dc,false);
PyObject* ao = wxPyMake_wxGridCellAttr(&attr); PyObject* ao = wxPyMake_wxGridCellAttr(&attr,false);
PyObject* ro = wxPyConstructObject((void*)&rect, wxT("wxRect"), 0); PyObject* ro = wxPyConstructObject((void*)&rect, wxT("wxRect"), 0);
wxPyCBH_callCallback(m_myInst, Py_BuildValue("(OOOOiii)", go, ao, dco, ro, wxPyCBH_callCallback(m_myInst, Py_BuildValue("(OOOOiii)", go, ao, dco, ro,
@@ -588,9 +588,9 @@ public:
if (wxPyCBH_findCallback(m_myInst, "GetBestSize")) { if (wxPyCBH_findCallback(m_myInst, "GetBestSize")) {
PyObject* ro; PyObject* ro;
wxSize* ptr; wxSize* ptr;
PyObject* go = wxPyMake_wxObject(&grid); PyObject* go = wxPyMake_wxObject(&grid,false);
PyObject* dco = wxPyMake_wxObject(&dc); PyObject* dco = wxPyMake_wxObject(&dc,false);
PyObject* ao = wxPyMake_wxGridCellAttr(&attr); PyObject* ao = wxPyMake_wxGridCellAttr(&attr,false);
ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(OOOii)", ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(OOOii)",
go, ao, dco, go, ao, dco,
@@ -782,8 +782,8 @@ public:
void Create(wxWindow* parent, wxWindowID id, wxEvtHandler* evtHandler) { void Create(wxWindow* parent, wxWindowID id, wxEvtHandler* evtHandler) {
bool blocked = wxPyBeginBlockThreads(); bool blocked = wxPyBeginBlockThreads();
if (wxPyCBH_findCallback(m_myInst, "Create")) { if (wxPyCBH_findCallback(m_myInst, "Create")) {
PyObject* po = wxPyMake_wxObject(parent); PyObject* po = wxPyMake_wxObject(parent,false);
PyObject* eo = wxPyMake_wxObject(evtHandler); PyObject* eo = wxPyMake_wxObject(evtHandler,false);
wxPyCBH_callCallback(m_myInst, Py_BuildValue("(OiO)", po, id, eo)); wxPyCBH_callCallback(m_myInst, Py_BuildValue("(OiO)", po, id, eo));
Py_DECREF(po); Py_DECREF(po);
@@ -796,7 +796,7 @@ public:
void BeginEdit(int row, int col, wxGrid* grid) { void BeginEdit(int row, int col, wxGrid* grid) {
bool blocked = wxPyBeginBlockThreads(); bool blocked = wxPyBeginBlockThreads();
if (wxPyCBH_findCallback(m_myInst, "BeginEdit")) { 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)); wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iiO)", row, col, go));
Py_DECREF(go); Py_DECREF(go);
} }
@@ -808,7 +808,7 @@ public:
bool rv = False; bool rv = False;
bool blocked = wxPyBeginBlockThreads(); bool blocked = wxPyBeginBlockThreads();
if (wxPyCBH_findCallback(m_myInst, "EndEdit")) { 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)); rv = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iiO)", row, col, go));
Py_DECREF(go); Py_DECREF(go);
} }
@@ -839,7 +839,7 @@ public:
bool found; bool found;
bool blocked = wxPyBeginBlockThreads(); bool blocked = wxPyBeginBlockThreads();
if ((found = wxPyCBH_findCallback(m_myInst, "Show"))) { 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)); wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iO)", show, ao));
Py_DECREF(ao); Py_DECREF(ao);
} }
@@ -856,7 +856,7 @@ public:
bool found; bool found;
bool blocked = wxPyBeginBlockThreads(); bool blocked = wxPyBeginBlockThreads();
if ((found = wxPyCBH_findCallback(m_myInst, "PaintBackground)"))) { 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); PyObject* ro = wxPyConstructObject((void*)&rectCell, wxT("wxRect"), 0);
wxPyCBH_callCallback(m_myInst, Py_BuildValue("(OO)", ro, ao)); wxPyCBH_callCallback(m_myInst, Py_BuildValue("(OO)", ro, ao));

View File

@@ -953,7 +953,7 @@ void wxPyPtrTypeMap_Add(const char* commonName, const char* ptrName) {
PyObject* wxPyMake_wxObject(wxObject* source, bool checkEvtHandler) { PyObject* wxPyMake_wxObject(wxObject* source, bool setThisOwn, bool checkEvtHandler) {
PyObject* target = NULL; PyObject* target = NULL;
bool isEvtHandler = False; bool isEvtHandler = False;
@@ -986,7 +986,7 @@ PyObject* wxPyMake_wxObject(wxObject* source, bool checkEvtHandler) {
exists = wxPyCheckSwigType(name); exists = wxPyCheckSwigType(name);
} }
if (info) { if (info) {
target = wxPyConstructObject((void*)source, name, False); target = wxPyConstructObject((void*)source, name, setThisOwn);
if (target && isEvtHandler) if (target && isEvtHandler)
((wxEvtHandler*)source)->SetClientObject(new wxPyOORClientData(target)); ((wxEvtHandler*)source)->SetClientObject(new wxPyOORClientData(target));
} else { } else {
@@ -1003,7 +1003,7 @@ PyObject* wxPyMake_wxObject(wxObject* source, bool checkEvtHandler) {
} }
PyObject* wxPyMake_wxSizer(wxSizer* source) { PyObject* wxPyMake_wxSizer(wxSizer* source, bool setThisOwn) {
PyObject* target = NULL; PyObject* target = NULL;
if (source && wxIsKindOf(source, wxSizer)) { if (source && wxIsKindOf(source, wxSizer)) {
@@ -1018,7 +1018,7 @@ PyObject* wxPyMake_wxSizer(wxSizer* source) {
} }
} }
if (! target) { if (! target) {
target = wxPyMake_wxObject(source, False); target = wxPyMake_wxObject(source, setThisOwn, False);
if (target != Py_None) if (target != Py_None)
((wxSizer*)source)->SetClientObject(new wxPyOORClientData(target)); ((wxSizer*)source)->SetClientObject(new wxPyOORClientData(target));
} }
@@ -1841,7 +1841,7 @@ PyObject* wxPy_ConvertList(wxListBase* listbase) {
pyList = PyList_New(0); pyList = PyList_New(0);
while (node) { while (node) {
wxObj = node->GetData(); wxObj = node->GetData();
pyObj = wxPyMake_wxObject(wxObj); pyObj = wxPyMake_wxObject(wxObj,false);
PyList_Append(pyList, pyObj); PyList_Append(pyList, pyObj);
node = node->GetNext(); node = node->GetNext();
} }

View File

@@ -636,7 +636,7 @@ public:
bool found; bool found;
bool blocked = wxPyBeginBlockThreads(); bool blocked = wxPyBeginBlockThreads();
if ((found = wxPyCBH_findCallback(m_myInst, "CanRead"))) { if ((found = wxPyCBH_findCallback(m_myInst, "CanRead"))) {
PyObject* obj = wxPyMake_wxObject((wxFSFile*)&file); // cast away const PyObject* obj = wxPyMake_wxObject((wxFSFile*)&file,false); // cast away const
rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj));
Py_DECREF(obj); Py_DECREF(obj);
} }
@@ -652,7 +652,7 @@ public:
bool found; bool found;
bool blocked = wxPyBeginBlockThreads(); bool blocked = wxPyBeginBlockThreads();
if ((found = wxPyCBH_findCallback(m_myInst, "ReadFile"))) { if ((found = wxPyCBH_findCallback(m_myInst, "ReadFile"))) {
PyObject* obj = wxPyMake_wxObject((wxFSFile*)&file); // cast away const PyObject* obj = wxPyMake_wxObject((wxFSFile*)&file,false); // cast away const
PyObject* ro; PyObject* ro;
ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(O)", obj)); ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(O)", obj));
Py_DECREF(obj); Py_DECREF(obj);

View File

@@ -247,7 +247,7 @@
// Typemaps to convert an array of ints to a list for return values // Typemaps to convert an array of strings to a list for return values
%typemap(out) wxArrayString& { %typemap(out) wxArrayString& {
$result = wxArrayString2PyList_helper(*$1); $result = wxArrayString2PyList_helper(*$1);
} }
@@ -340,58 +340,54 @@ SWIG_AsDouble(PyObject *obj)
// to the real derived type, if possible. See wxPyMake_wxObject in // to the real derived type, if possible. See wxPyMake_wxObject in
// helpers.cpp // helpers.cpp
%typemap(out) wxEvtHandler* { $result = wxPyMake_wxObject($1); } %typemap(out) wxEvtHandler* { $result = wxPyMake_wxObject($1, $owner); }
%typemap(out) wxMenu* { $result = wxPyMake_wxObject($1); } %typemap(out) wxMenu* { $result = wxPyMake_wxObject($1, $owner); }
%typemap(out) wxValidator* { $result = wxPyMake_wxObject($1); } %typemap(out) wxValidator* { $result = wxPyMake_wxObject($1, $owner); }
%typemap(out) wxApp* { $result = wxPyMake_wxObject($1); } %typemap(out) wxApp* { $result = wxPyMake_wxObject($1, $owner); }
%typemap(out) wxPyApp* { $result = wxPyMake_wxObject($1); } %typemap(out) wxPyApp* { $result = wxPyMake_wxObject($1, $owner); }
%typemap(out) wxDC* { $result = wxPyMake_wxObject($1); } %typemap(out) wxDC* { $result = wxPyMake_wxObject($1, $owner); }
%typemap(out) wxFSFile* { $result = wxPyMake_wxObject($1); } %typemap(out) wxFSFile* { $result = wxPyMake_wxObject($1, $owner); }
%typemap(out) wxFileSystem* { $result = wxPyMake_wxObject($1); } %typemap(out) wxFileSystem* { $result = wxPyMake_wxObject($1, $owner); }
%typemap(out) wxGridTableBase* { $result = wxPyMake_wxObject($1); } %typemap(out) wxGridTableBase* { $result = wxPyMake_wxObject($1, $owner); }
%typemap(out) wxImageList* { $result = wxPyMake_wxObject($1); } %typemap(out) wxImageList* { $result = wxPyMake_wxObject($1, $owner); }
%typemap(out) wxListItem* { $result = wxPyMake_wxObject($1); } %typemap(out) wxListItem* { $result = wxPyMake_wxObject($1, $owner); }
%typemap(out) wxMenuItem* { $result = wxPyMake_wxObject($1); } %typemap(out) wxMenuItem* { $result = wxPyMake_wxObject($1, $owner); }
%typemap(out) wxMouseEvent* { $result = wxPyMake_wxObject($1); } %typemap(out) wxMouseEvent* { $result = wxPyMake_wxObject($1, $owner); }
%typemap(out) wxObject* { $result = wxPyMake_wxObject($1); } %typemap(out) wxObject* { $result = wxPyMake_wxObject($1, $owner); }
%typemap(out) wxPyPrintout* { $result = wxPyMake_wxObject($1); } %typemap(out) wxPyPrintout* { $result = wxPyMake_wxObject($1, $owner); }
%typemap(out) wxToolBarToolBase* { $result = wxPyMake_wxObject($1); } %typemap(out) wxToolBarToolBase* { $result = wxPyMake_wxObject($1, $owner); }
%typemap(out) wxToolTip* { $result = wxPyMake_wxObject($1); } %typemap(out) wxToolTip* { $result = wxPyMake_wxObject($1, $owner); }
%typemap(out) wxBitmapButton* { $result = wxPyMake_wxObject($1); } %typemap(out) wxBitmapButton* { $result = wxPyMake_wxObject($1, $owner); }
%typemap(out) wxButton* { $result = wxPyMake_wxObject($1); } %typemap(out) wxButton* { $result = wxPyMake_wxObject($1, $owner); }
%typemap(out) wxControl* { $result = wxPyMake_wxObject($1); } %typemap(out) wxControl* { $result = wxPyMake_wxObject($1, $owner); }
%typemap(out) wxFrame* { $result = wxPyMake_wxObject($1); } %typemap(out) wxFrame* { $result = wxPyMake_wxObject($1, $owner); }
%typemap(out) wxGrid* { $result = wxPyMake_wxObject($1); } %typemap(out) wxGrid* { $result = wxPyMake_wxObject($1, $owner); }
%typemap(out) wxListCtrl* { $result = wxPyMake_wxObject($1); } %typemap(out) wxListCtrl* { $result = wxPyMake_wxObject($1, $owner); }
%typemap(out) wxMDIChildFrame* { $result = wxPyMake_wxObject($1); } %typemap(out) wxMDIChildFrame* { $result = wxPyMake_wxObject($1, $owner); }
%typemap(out) wxMDIClientWindow* { $result = wxPyMake_wxObject($1); } %typemap(out) wxMDIClientWindow* { $result = wxPyMake_wxObject($1, $owner); }
%typemap(out) wxMenuBar* { $result = wxPyMake_wxObject($1); } %typemap(out) wxMenuBar* { $result = wxPyMake_wxObject($1, $owner); }
%typemap(out) wxNotebook* { $result = wxPyMake_wxObject($1); } %typemap(out) wxNotebook* { $result = wxPyMake_wxObject($1, $owner); }
%typemap(out) wxStaticBox* { $result = wxPyMake_wxObject($1); } %typemap(out) wxStaticBox* { $result = wxPyMake_wxObject($1, $owner); }
%typemap(out) wxStatusBar* { $result = wxPyMake_wxObject($1); } %typemap(out) wxStatusBar* { $result = wxPyMake_wxObject($1, $owner); }
%typemap(out) wxTextCtrl* { $result = wxPyMake_wxObject($1); } %typemap(out) wxTextCtrl* { $result = wxPyMake_wxObject($1, $owner); }
%typemap(out) wxToolBar* { $result = wxPyMake_wxObject($1); } %typemap(out) wxToolBar* { $result = wxPyMake_wxObject($1, $owner); }
%typemap(out) wxToolBarBase* { $result = wxPyMake_wxObject($1); } %typemap(out) wxToolBarBase* { $result = wxPyMake_wxObject($1, $owner); }
%typemap(out) wxTreeCtrl* { $result = wxPyMake_wxObject($1); } %typemap(out) wxTreeCtrl* { $result = wxPyMake_wxObject($1, $owner); }
%typemap(out) wxPyTreeCtrl* { $result = wxPyMake_wxObject($1); } %typemap(out) wxPyTreeCtrl* { $result = wxPyMake_wxObject($1, $owner); }
%typemap(out) wxWindow* { $result = wxPyMake_wxObject($1); } %typemap(out) wxWindow* { $result = wxPyMake_wxObject($1, $owner); }
%typemap(out) wxHtmlWindow* { $result = wxPyMake_wxObject($1); } %typemap(out) wxHtmlWindow* { $result = wxPyMake_wxObject($1, $owner); }
%typemap(out) wxPyHtmlWindow* { $result = wxPyMake_wxObject($1); } %typemap(out) wxPyHtmlWindow* { $result = wxPyMake_wxObject($1, $owner); }
%typemap(out) wxWizardPage* { $result = wxPyMake_wxObject($1); } %typemap(out) wxWizardPage* { $result = wxPyMake_wxObject($1, $owner); }
%typemap(out) wxPanel* { $result = wxPyMake_wxObject($1); } %typemap(out) wxPanel* { $result = wxPyMake_wxObject($1, $owner); }
%typemap(out) wxDialog* { $result = wxPyMake_wxObject($1); } %typemap(out) wxDialog* { $result = wxPyMake_wxObject($1, $owner); }
%typemap(out) wxScrolledWindow* { $result = wxPyMake_wxObject($1, $owner); }
%typemap(out) wxSizer* { $result = wxPyMake_wxSizer($1); } %typemap(out) wxSizer* { $result = wxPyMake_wxSizer($1, $owner); }
//%typemap(python, out) wxHtmlCell* { $target = wxPyMake_wxObject($source); }
//%typemap(python, out) wxHtmlContainerCell* { $target = wxPyMake_wxObject($source); }
//%typemap(python, out) wxHtmlParser* { $target = wxPyMake_wxObject($source); }
//%typemap(python, out) wxHtmlWinParser* { $target = wxPyMake_wxObject($source); }
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------