A bunch of little tweaks
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_2_BRANCH@8401 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -380,7 +380,7 @@ public:
|
||||
|
||||
%addmethods {
|
||||
int __cmp__(wxTreeItemId* other) {
|
||||
if (! other) return 0;
|
||||
if (! other) return -1;
|
||||
return *self != *other;
|
||||
}
|
||||
}
|
||||
@@ -392,15 +392,15 @@ public:
|
||||
class wxPyTreeItemData : public wxTreeItemData {
|
||||
public:
|
||||
wxPyTreeItemData(PyObject* obj = NULL) {
|
||||
if (obj == NULL)
|
||||
if (obj == NULL)
|
||||
obj = Py_None;
|
||||
Py_INCREF(obj);
|
||||
m_obj = obj;
|
||||
Py_INCREF(obj);
|
||||
m_obj = obj;
|
||||
}
|
||||
|
||||
~wxPyTreeItemData() {
|
||||
bool doSave = wxPyRestoreThread();
|
||||
Py_DECREF(m_obj);
|
||||
Py_DECREF(m_obj);
|
||||
wxPySaveThread(doSave);
|
||||
}
|
||||
|
||||
@@ -517,8 +517,8 @@ public:
|
||||
void SetItemHasChildren(const wxTreeItemId& item, bool hasChildren = TRUE);
|
||||
|
||||
%addmethods {
|
||||
// [Get|Set]ItemData substitutes. Automatically create wxPyTreeItemData
|
||||
// if needed.
|
||||
// [Get|Set]ItemData substitutes. Automatically create wxPyTreeItemData
|
||||
// if needed.
|
||||
wxPyTreeItemData* GetItemData(const wxTreeItemId& item) {
|
||||
wxPyTreeItemData* data = (wxPyTreeItemData*)self->GetItemData(item);
|
||||
if (data == NULL) {
|
||||
@@ -532,11 +532,11 @@ public:
|
||||
void SetItemData(const wxTreeItemId& item, wxPyTreeItemData* data) {
|
||||
data->SetId(item); // set the id
|
||||
self->SetItemData(item, data);
|
||||
}
|
||||
}
|
||||
|
||||
// [Get|Set]PyData are short-cuts. Also made somewhat crash-proof by
|
||||
// automatically creating data classes.
|
||||
PyObject* GetPyData(const wxTreeItemId& item) {
|
||||
// [Get|Set]PyData are short-cuts. Also made somewhat crash-proof by
|
||||
// automatically creating data classes.
|
||||
PyObject* GetPyData(const wxTreeItemId& item) {
|
||||
wxPyTreeItemData* data = (wxPyTreeItemData*)self->GetItemData(item);
|
||||
if (data == NULL) {
|
||||
data = new wxPyTreeItemData();
|
||||
@@ -544,7 +544,7 @@ public:
|
||||
self->SetItemData(item, data);
|
||||
}
|
||||
return data->GetData();
|
||||
}
|
||||
}
|
||||
|
||||
void SetPyData(const wxTreeItemId& item, PyObject* obj) {
|
||||
wxPyTreeItemData* data = (wxPyTreeItemData*)self->GetItemData(item);
|
||||
@@ -554,7 +554,7 @@ public:
|
||||
self->SetItemData(item, data);
|
||||
} else
|
||||
data->SetData(obj);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user