forked from wxWidgets/Phoenix
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtreeitemdata.sip
51 lines (41 loc) · 1.41 KB
/
treeitemdata.sip
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
//--------------------------------------------------------------------------
// Name: treeitemdata.sip
// Purpose: A MappedType for wxTreeItemData that handles containing
// arbitrary PyObjects, dealing with their refcounts, etc.
//
// Author: Robin Dunn
//
// Created: 28-Mar-2012
// Copyright: (c) 2012-2017 by Total Control Software
// Licence: wxWindows license
//--------------------------------------------------------------------------
%ModuleHeaderCode
#include <wx/treebase.h>
// A wxTreeItemData that knows what to do with PyObjects for maintaining the refcount
class wxPyTreeItemData : public wxPyUserDataHelper<wxTreeItemData>
{
public:
wxPyTreeItemData(PyObject* obj = NULL)
: wxPyUserDataHelper<wxTreeItemData>(obj)
{ }
};
%End
%MappedType wxTreeItemData
{
%ConvertToTypeCode
// Code to test a PyObject for compatibility
if (!sipIsErr) {
return TRUE; // any python object is valid
}
// Code to create a new wxTreeItemData from the PyObject
wxPyTreeItemData* data = new wxPyTreeItemData(sipPy);
*sipCppPtr = data;
return sipGetState(sipTransferObj);
%End
%ConvertFromTypeCode
// Code to convert a wxPyTreeItemData back to the PyObject.
PyObject* obj;
obj = wxPyTreeItemData::SafeGetData(static_cast<wxPyTreeItemData*>(sipCpp));
return obj;
%End
};