]> git.saurik.com Git - wxWidgets.git/blame - interface/wx/treebase.h
Somehow, setting a tint color makes gauge work :/.
[wxWidgets.git] / interface / wx / treebase.h
CommitLineData
23324ae1
FM
1/////////////////////////////////////////////////////////////////////////////
2// Name: treebase.h
e54c96f1 3// Purpose: interface of wxTreeItemId
23324ae1 4// Author: wxWidgets team
526954c5 5// Licence: wxWindows licence
23324ae1
FM
6/////////////////////////////////////////////////////////////////////////////
7
8/**
9 @class wxTreeItemId
7c913512 10
23324ae1 11 An opaque reference to a tree item.
7c913512 12
23324ae1 13 @library{wxcore}
3c99e2fd 14 @category{data}
7c913512 15
7977b62a 16 @see wxTreeCtrl, wxTreeItemData, @ref overview_treectrl
23324ae1 17*/
7c913512 18class wxTreeItemId
23324ae1
FM
19{
20public:
21 /**
7977b62a
BP
22 Default constructor. A wxTreeItemId is not meant to be constructed
23 explicitly by the user; only those returned by the wxTreeCtrl functions
24 should be used.
23324ae1
FM
25 */
26 wxTreeItemId();
27
28 /**
29 Returns @true if this instance is referencing a valid tree item.
30 */
328f5751 31 bool IsOk() const;
23324ae1 32
2c033d4a
RD
33 void* GetID() const;
34 void Unset();
23324ae1 35};
e54c96f1 36
2c033d4a
RD
37bool operator==(const wxTreeItemId& left, const wxTreeItemId& right);
38bool operator!=(const wxTreeItemId& left, const wxTreeItemId& right);
39
40
41
7977b62a
BP
42/**
43 @class wxTreeItemData
7977b62a
BP
44
45 wxTreeItemData is some (arbitrary) user class associated with some item. The
46 main advantage of having this class is that wxTreeItemData objects are
47 destroyed automatically by the tree and, as this class has virtual
48 destructor, it means that the memory and any other resources associated with
49 a tree item will be automatically freed when it is deleted. Note that we
50 don't use wxObject as the base class for wxTreeItemData because the size of
51 this class is critical: in many applications, each tree leaf will have
52 wxTreeItemData associated with it and the number of leaves may be quite big.
53
54 Also please note that because the objects of this class are deleted by the
55 tree using the operator @c delete, they must always be allocated on the heap
56 using @c new.
57
58 @library{wxcore}
59 @category{containers}
60
61 @see wxTreeCtrl
62*/
63class wxTreeItemData : public wxClientData
64{
65public:
66 /**
67 Default constructor.
68
1058f652
MB
69 @beginWxPerlOnly
70 In wxPerl the constructor accepts a scalar as an optional parameter
71 and stores it as client data; use
72 - GetData() to retrieve the value.
73 - SetData(data) to set it.
74 @endWxPerlOnly
7977b62a
BP
75 */
76 wxTreeItemData();
77
78 /**
79 Virtual destructor.
80 */
adaaa686 81 virtual ~wxTreeItemData();
7977b62a
BP
82
83 /**
84 Returns the item associated with this node.
85 */
cfbe5614 86 const wxTreeItemId& GetId() const;
7977b62a
BP
87
88 /**
89 Sets the item associated with this node.
727539d8
VZ
90
91 Notice that this function is automatically called by wxTreeCtrl methods
92 associating an object of this class with a tree control item such as
93 wxTreeCtrl::AppendItem(), wxTreeCtrl::InsertItem() and
94 wxTreeCtrl::SetItemData() so there is usually no need to call it
95 yourself.
7977b62a
BP
96 */
97 void SetId(const wxTreeItemId& id);
98};
99
100/**
101 Indicates which type to associate an image with a wxTreeCtrl item.
cfbe5614 102
7977b62a
BP
103 @see wxTreeCtrl::GetItemImage(), wxTreeCtrl::SetItemImage()
104*/
105enum wxTreeItemIcon
106{
107 /**
108 To get/set the item image for when the item is
109 @b not selected and @b not expanded.
110 */
111 wxTreeItemIcon_Normal,
112 /**
113 To get/set the item image for when the item is
114 @b selected and @b not expanded.
115 */
116 wxTreeItemIcon_Selected,
117 /**
118 To get/set the item image for when the item is
119 @b not selected and @b expanded.
120 */
121 wxTreeItemIcon_Expanded,
122 /**
123 To get/set the item image for when the item is
124 @b selected and @b expanded.
125 */
126 wxTreeItemIcon_SelectedExpanded,
127 wxTreeItemIcon_Max
128};
2c033d4a
RD
129
130
131/// special values for the 'state' parameter of wxTreeCtrl::SetItemState()
132static const int wxTREE_ITEMSTATE_NONE = -1; // not state (no display state image)
133static const int wxTREE_ITEMSTATE_NEXT = -2; // cycle to the next state
134static const int wxTREE_ITEMSTATE_PREV = -3; // cycle to the previous state
135
136#define wxTR_NO_BUTTONS 0x0000 // for convenience
137#define wxTR_HAS_BUTTONS 0x0001 // draw collapsed/expanded btns
138#define wxTR_NO_LINES 0x0004 // don't draw lines at all
139#define wxTR_LINES_AT_ROOT 0x0008 // connect top-level nodes
140#define wxTR_TWIST_BUTTONS 0x0010 // still used by wxTreeListCtrl
141
142#define wxTR_SINGLE 0x0000 // for convenience
143#define wxTR_MULTIPLE 0x0020 // can select multiple items
144
145#define wxTR_HAS_VARIABLE_ROW_HEIGHT 0x0080 // what it says
146
147#define wxTR_EDIT_LABELS 0x0200 // can edit item labels
148#define wxTR_ROW_LINES 0x0400 // put border around items
149#define wxTR_HIDE_ROOT 0x0800 // don't display root node
150
151#define wxTR_FULL_ROW_HIGHLIGHT 0x2000 // highlight full horz space
152
153// make the default control appearance look more native-like depending on the
154// platform
155#define wxTR_DEFAULT_STYLE (wxTR_HAS_BUTTONS | wxTR_LINES_AT_ROOT)
156
157
158// values for the `flags' parameter of wxTreeCtrl::HitTest() which determine
159// where exactly the specified point is situated:
160
161static const int wxTREE_HITTEST_ABOVE = 0x0001;
162static const int wxTREE_HITTEST_BELOW = 0x0002;
163static const int wxTREE_HITTEST_NOWHERE = 0x0004;
164 // on the button associated with an item.
165static const int wxTREE_HITTEST_ONITEMBUTTON = 0x0008;
166 // on the bitmap associated with an item.
167static const int wxTREE_HITTEST_ONITEMICON = 0x0010;
168 // on the indent associated with an item.
169static const int wxTREE_HITTEST_ONITEMINDENT = 0x0020;
170 // on the label (string) associated with an item.
171static const int wxTREE_HITTEST_ONITEMLABEL = 0x0040;
172 // on the right of the label associated with an item.
173static const int wxTREE_HITTEST_ONITEMRIGHT = 0x0080;
174 // on the label (string) associated with an item.
175static const int wxTREE_HITTEST_ONITEMSTATEICON = 0x0100;
176 // on the left of the wxTreeCtrl.
177static const int wxTREE_HITTEST_TOLEFT = 0x0200;
178 // on the right of the wxTreeCtrl.
179static const int wxTREE_HITTEST_TORIGHT = 0x0400;
180 // on the upper part (first half) of the item.
181static const int wxTREE_HITTEST_ONITEMUPPERPART = 0x0800;
182 // on the lower part (second half) of the item.
183static const int wxTREE_HITTEST_ONITEMLOWERPART = 0x1000;
184
185 // anywhere on the item
186static const int wxTREE_HITTEST_ONITEM = wxTREE_HITTEST_ONITEMICON |
187 wxTREE_HITTEST_ONITEMLABEL;
188
189