]>
Commit | Line | Data |
---|---|---|
1fded56b RD |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: pytree.h | |
3 | // Purpose: Common declarations of tree stuff for wxTreeCtrl in the core | |
4 | // and wxTreeListCtrl in gizmos | |
5 | // | |
6 | // Author: Robin Dunn | |
7 | // | |
8 | // Created: 30-April-2003 | |
9 | // RCS-ID: $Id$ | |
10 | // Copyright: (c) 2003 by Total Control Software | |
11 | // Licence: wxWindows license | |
12 | ///////////////////////////////////////////////////////////////////////////// | |
13 | ||
d14a1e28 RD |
14 | #ifndef __pytree_h__ |
15 | #define __pytree_h__ | |
1fded56b RD |
16 | |
17 | ||
18 | class wxPyTreeItemData : public wxTreeItemData { | |
19 | public: | |
20 | wxPyTreeItemData(PyObject* obj = NULL) { | |
21 | if (obj == NULL) | |
22 | obj = Py_None; | |
23 | Py_INCREF(obj); | |
24 | m_obj = obj; | |
25 | } | |
26 | ||
27 | ~wxPyTreeItemData() { | |
da32eb53 | 28 | bool blocked = wxPyBeginBlockThreads(); |
1fded56b | 29 | Py_DECREF(m_obj); |
da32eb53 | 30 | wxPyEndBlockThreads(blocked); |
1fded56b RD |
31 | } |
32 | ||
33 | PyObject* GetData() { | |
34 | Py_INCREF(m_obj); | |
35 | return m_obj; | |
36 | } | |
37 | ||
38 | void SetData(PyObject* obj) { | |
da32eb53 | 39 | bool blocked = wxPyBeginBlockThreads(); |
1fded56b | 40 | Py_DECREF(m_obj); |
da32eb53 | 41 | wxPyEndBlockThreads(blocked); |
1fded56b RD |
42 | m_obj = obj; |
43 | Py_INCREF(obj); | |
44 | } | |
45 | ||
46 | PyObject* m_obj; | |
47 | }; | |
48 | ||
d14a1e28 RD |
49 | |
50 | ||
51 | #endif |