Files
Phoenix/src/treeitemdata.sip
Robin Dunn 35fd2e16bf Update copyright year
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxPython/Phoenix/trunk@73416 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2013-01-21 02:13:03 +00:00

52 lines
1.4 KiB
Plaintext

//--------------------------------------------------------------------------
// 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) 2013 by Total Control Software
// Licence: wxWindows license
//--------------------------------------------------------------------------
%ModuleHeaderCode
#include <wx/treebase.h>
// A wxTreeItemData that knows what to do with PyObjects for maintianing 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
};