Changes needed to be able to build with SWIG 1.3.24, 1.3.27 as well as
the upcoming 1.3.28, using #if statements on SWIG_VERSION. Adjustments to ownership of SWIG objects, add some destructors and explicitly disown non-window objects when their ownership is transfered to a C++ object. Since all window objects are owned by their parent, or by themselves, always set their thisown attribute to False. Explicitly set thisown to False after any Destroy() methods are called, so SWIG doesn't try to destroy them again. Etc. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@37203 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -121,13 +121,15 @@ public:
|
||||
class wxPyTreeItemData {
|
||||
public:
|
||||
wxPyTreeItemData(PyObject* obj = NULL);
|
||||
|
||||
~wxPyTreeItemData();
|
||||
|
||||
PyObject* GetData();
|
||||
void SetData(PyObject* obj);
|
||||
|
||||
const wxTreeItemId& GetId();
|
||||
void SetId(const wxTreeItemId& id);
|
||||
|
||||
%pythonAppend Destroy "args[0].thisown = 0"
|
||||
%extend { void Destroy() { delete self; } }
|
||||
};
|
||||
|
||||
@@ -144,7 +146,8 @@ public:
|
||||
wxTreeItemAttr(const wxColour& colText = wxNullColour,
|
||||
const wxColour& colBack = wxNullColour,
|
||||
const wxFont& font = wxNullFont);
|
||||
|
||||
~wxTreeItemAttr();
|
||||
|
||||
// setters
|
||||
void SetTextColour(const wxColour& colText);
|
||||
void SetBackgroundColour(const wxColour& colBack);
|
||||
@@ -159,6 +162,7 @@ public:
|
||||
wxColour GetBackgroundColour();
|
||||
wxFont GetFont();
|
||||
|
||||
%pythonAppend Destroy "args[0].thisown = 0"
|
||||
%extend { void Destroy() { delete self; } }
|
||||
};
|
||||
|
||||
@@ -372,10 +376,10 @@ public:
|
||||
void SetImageList(wxImageList *imageList);
|
||||
void SetStateImageList(wxImageList *imageList);
|
||||
|
||||
%apply SWIGTYPE *DISOWN { wxImageList *imageList };
|
||||
%disownarg( wxImageList *imageList );
|
||||
void AssignImageList(wxImageList *imageList);
|
||||
void AssignStateImageList(wxImageList *imageList);
|
||||
%clear wxImageList *imageList;
|
||||
%cleardisown( wxImageList *imageList );
|
||||
|
||||
|
||||
// retrieve items label
|
||||
@@ -430,10 +434,12 @@ public:
|
||||
|
||||
%extend {
|
||||
// associate a wxPyTreeItemData with the tree item
|
||||
%disownarg( wxPyTreeItemData* data );
|
||||
void SetItemData(const wxTreeItemId& item, wxPyTreeItemData* data) {
|
||||
data->SetId(item); // set the id
|
||||
self->SetItemData(item, data);
|
||||
}
|
||||
%cleardisown( wxPyTreeItemData* data );
|
||||
|
||||
// associate a Python object with the tree item
|
||||
void SetItemPyData(const wxTreeItemId& item, PyObject* obj) {
|
||||
@@ -582,6 +588,7 @@ public:
|
||||
wxTreeItemId GetPrevVisible(const wxTreeItemId& item) const;
|
||||
|
||||
|
||||
%disownarg( wxPyTreeItemData* data );
|
||||
|
||||
// add the root node to the tree
|
||||
wxTreeItemId AddRoot(const wxString& text,
|
||||
@@ -616,7 +623,8 @@ public:
|
||||
wxPyTreeItemData *data = NULL);
|
||||
|
||||
|
||||
|
||||
%cleardisown( wxPyTreeItemData* data );
|
||||
|
||||
// delete this item and associated data if any
|
||||
void Delete(const wxTreeItemId& item);
|
||||
|
||||
|
Reference in New Issue
Block a user