]> git.saurik.com Git - wxWidgets.git/blob - interface/wx/treebase.h
fixing text matrix (dataview custom renderer showed problems) and reordering SaveGState
[wxWidgets.git] / interface / wx / treebase.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: treebase.h
3 // Purpose: interface of wxTreeItemId
4 // Author: wxWidgets team
5 // RCS-ID: $Id$
6 // Licence: wxWindows license
7 /////////////////////////////////////////////////////////////////////////////
8
9 /**
10 @class wxTreeItemId
11
12 An opaque reference to a tree item.
13
14 @library{wxcore}
15 @category{data}
16
17 @see wxTreeCtrl, wxTreeItemData, @ref overview_treectrl
18 */
19 class wxTreeItemId
20 {
21 public:
22 /**
23 Default constructor. A wxTreeItemId is not meant to be constructed
24 explicitly by the user; only those returned by the wxTreeCtrl functions
25 should be used.
26 */
27 wxTreeItemId();
28
29 /**
30 Returns @true if this instance is referencing a valid tree item.
31 */
32 bool IsOk() const;
33
34 //@{
35 /**
36 Operators for comparison between wxTreeItemId objects.
37 */
38 bool operator ==(const wxTreeItemId& item) const;
39 bool operator !=(const wxTreeItemId& item) const;
40 //@}
41
42 /**
43 Antonym of IsOk(), i.e. returns @true only if the item is not valid.
44 */
45 bool operator !() const;
46 };
47
48 /**
49 @class wxTreeItemData
50
51 wxTreeItemData is some (arbitrary) user class associated with some item. The
52 main advantage of having this class is that wxTreeItemData objects are
53 destroyed automatically by the tree and, as this class has virtual
54 destructor, it means that the memory and any other resources associated with
55 a tree item will be automatically freed when it is deleted. Note that we
56 don't use wxObject as the base class for wxTreeItemData because the size of
57 this class is critical: in many applications, each tree leaf will have
58 wxTreeItemData associated with it and the number of leaves may be quite big.
59
60 Also please note that because the objects of this class are deleted by the
61 tree using the operator @c delete, they must always be allocated on the heap
62 using @c new.
63
64 @library{wxcore}
65 @category{containers}
66
67 @see wxTreeCtrl
68 */
69 class wxTreeItemData : public wxClientData
70 {
71 public:
72 /**
73 Default constructor.
74
75 @beginWxPythonOnly
76 The following methods are added in wxPython for accessing the object:
77 - GetData(): Returns a reference to the Python Object.
78 - SetData(obj): Associates a new Python Object with the wxTreeItemData.
79 @endWxPythonOnly
80 */
81 wxTreeItemData();
82
83 /**
84 Virtual destructor.
85 */
86 virtual ~wxTreeItemData();
87
88 /**
89 Returns the item associated with this node.
90 */
91 const wxTreeItemId& GetId() const;
92
93 /**
94 Sets the item associated with this node.
95
96 Notice that this function is automatically called by wxTreeCtrl methods
97 associating an object of this class with a tree control item such as
98 wxTreeCtrl::AppendItem(), wxTreeCtrl::InsertItem() and
99 wxTreeCtrl::SetItemData() so there is usually no need to call it
100 yourself.
101 */
102 void SetId(const wxTreeItemId& id);
103 };
104
105 /**
106 Indicates which type to associate an image with a wxTreeCtrl item.
107
108 @see wxTreeCtrl::GetItemImage(), wxTreeCtrl::SetItemImage()
109 */
110 enum wxTreeItemIcon
111 {
112 /**
113 To get/set the item image for when the item is
114 @b not selected and @b not expanded.
115 */
116 wxTreeItemIcon_Normal,
117 /**
118 To get/set the item image for when the item is
119 @b selected and @b not expanded.
120 */
121 wxTreeItemIcon_Selected,
122 /**
123 To get/set the item image for when the item is
124 @b not selected and @b expanded.
125 */
126 wxTreeItemIcon_Expanded,
127 /**
128 To get/set the item image for when the item is
129 @b selected and @b expanded.
130 */
131 wxTreeItemIcon_SelectedExpanded,
132 wxTreeItemIcon_Max
133 };