]> git.saurik.com Git - wxWidgets.git/blame - include/wx/msw/treectrl.h
Unicode fix.
[wxWidgets.git] / include / wx / msw / treectrl.h
CommitLineData
2bda0e17
KB
1/////////////////////////////////////////////////////////////////////////////
2// Name: treectrl.h
3// Purpose: wxTreeCtrl class
4// Author: Julian Smart
08b7c251 5// Modified by: Vadim Zeitlin to be less MSW-specific on 10/10/98
2bda0e17
KB
6// Created: 01/02/97
7// RCS-ID: $Id$
8// Copyright: (c) Julian Smart and Markus Holzem
08b7c251 9// Licence: wxWindows license
2bda0e17
KB
10/////////////////////////////////////////////////////////////////////////////
11
bbcdf8bc
JS
12#ifndef _WX_TREECTRL_H_
13#define _WX_TREECTRL_H_
2bda0e17 14
08b7c251
VZ
15// ----------------------------------------------------------------------------
16// headers
17// ----------------------------------------------------------------------------
2bda0e17 18#ifdef __GNUG__
08b7c251 19 #pragma interface "treectrl.h"
2bda0e17
KB
20#endif
21
22#include "wx/control.h"
23#include "wx/event.h"
ad5c34f3 24#include "wx/textctrl.h"
2bda0e17 25
08b7c251
VZ
26// the type for "untyped" data
27typedef long wxDataType;
28
29// fwd decl
06e38c8e
JS
30class WXDLLEXPORT wxImageList;
31struct WXDLLEXPORT wxTreeViewItem;
08b7c251
VZ
32
33// a callback function used for sorting tree items, it should return -1 if the
34// first item precedes the second, +1 if the second precedes the first or 0 if
35// they're equivalent
36class wxTreeItemData;
08b7c251
VZ
37
38// ----------------------------------------------------------------------------
39// constants
40// ----------------------------------------------------------------------------
41
42// values for the `flags' parameter of wxTreeCtrl::HitTest() which determine
43// where exactly the specified point is situated:
44 // above the client area.
45static const int wxTREE_HITTEST_ABOVE = 0x0001;
46 // below the client area.
47static const int wxTREE_HITTEST_BELOW = 0x0002;
48 // in the client area but below the last item.
49static const int wxTREE_HITTEST_NOWHERE = 0x0004;
50 // on the button associated with an item.
51static const int wxTREE_HITTEST_ONITEMBUTTON = 0x0010;
52 // on the bitmap associated with an item.
53static const int wxTREE_HITTEST_ONITEMICON = 0x0020;
54 // in the indentation associated with an item.
55static const int wxTREE_HITTEST_ONITEMINDENT = 0x0040;
56 // on the label (string) associated with an item.
57static const int wxTREE_HITTEST_ONITEMLABEL = 0x0080;
58 // in the area to the right of an item.
59static const int wxTREE_HITTEST_ONITEMRIGHT = 0x0100;
60 // on the state icon for a tree view item that is in a user-defined state.
61static const int wxTREE_HITTEST_ONITEMSTATEICON = 0x0200;
62 // to the right of the client area.
63static const int wxTREE_HITTEST_TOLEFT = 0x0400;
64 // to the left of the client area.
65static const int wxTREE_HITTEST_TORIGHT = 0x0800;
66 // anywhere on the item
67static const int wxTREE_HITTEST_ONITEM = wxTREE_HITTEST_ONITEMICON |
68 wxTREE_HITTEST_ONITEMLABEL |
69 wxTREE_HITTEST_ONITEMSTATEICON;
70
71// NB: all the following flags are for compatbility only and will be removed in the
72// next versions
73
74// flags for deprecated `Expand(int action)'
75enum
76{
2bda0e17
KB
77 wxTREE_EXPAND_EXPAND,
78 wxTREE_EXPAND_COLLAPSE,
79 wxTREE_EXPAND_COLLAPSE_RESET,
80 wxTREE_EXPAND_TOGGLE
81};
82
08b7c251 83// flags for deprecated InsertItem() variant
3197ed26
VZ
84#define wxTREE_INSERT_FIRST 0xFFFF0001
85#define wxTREE_INSERT_LAST 0xFFFF0002
2bda0e17 86
08b7c251
VZ
87// ----------------------------------------------------------------------------
88// wxTreeItemId identifies an element of the tree. In this implementation, it's
89// just a trivial wrapper around Win32 HTREEITEM. It's opaque for the
90// application.
91// ----------------------------------------------------------------------------
92class WXDLLEXPORT wxTreeItemId
2bda0e17 93{
2bda0e17 94public:
08b7c251
VZ
95 // ctors
96 // 0 is invalid value for HTREEITEM
97 wxTreeItemId() { m_itemId = 0; }
98
99 // default copy ctor/assignment operator are ok for us
100
101 // accessors
102 // is this a valid tree item?
103 bool IsOk() const { return m_itemId != 0; }
104
105 // conversion to/from either real (system-dependent) tree item id or
106 // to "long" which used to be the type for tree item ids in previous
107 // versions of wxWindows
108
08b7c251 109 // for wxTreeCtrl usage only
06e38c8e
JS
110 wxTreeItemId(WXHTREEITEM itemId) { m_itemId = (long)itemId; }
111 operator WXHTREEITEM() const { return (WXHTREEITEM)m_itemId; }
112
add28c55 113 void operator=(WXHTREEITEM item) { m_itemId = (long) item; }
08b7c251
VZ
114
115protected:
116 long m_itemId;
2bda0e17
KB
117};
118
08b7c251
VZ
119// ----------------------------------------------------------------------------
120// wxTreeItemData is some (arbitrary) user class associated with some item. The
121// main advantage of having this class (compared to old untyped interface) is
122// that wxTreeItemData's are destroyed automatically by the tree and, as this
123// class has virtual dtor, it means that the memory will be automatically
124// freed. OTOH, we don't just use wxObject instead of wxTreeItemData because
125// the size of this class is critical: in any real application, each tree leaf
126// will have wxTreeItemData associated with it and number of leaves may be
127// quite big.
128//
129// Because the objects of this class are deleted by the tree, they should
130// always be allocated on the heap!
131// ----------------------------------------------------------------------------
3a5a2f56 132class WXDLLEXPORT wxTreeItemData : private wxTreeItemId
08b7c251 133{
08b7c251 134public:
3a5a2f56 135 // default ctor/copy ctor/assignment operator are ok
08b7c251 136
3a5a2f56
VZ
137 // dtor is virtual and all the items are deleted by the tree control when
138 // it's deleted, so you normally don't have to care about freeing memory
139 // allocated in your wxTreeItemData-derived class
08b7c251
VZ
140 virtual ~wxTreeItemData() { }
141
3a5a2f56
VZ
142 // accessors: set/get the item associated with this node
143 void SetId(const wxTreeItemId& id) { m_itemId = id; }
8a2c6ef8
JS
144#ifdef __WATCOMC__
145 const wxTreeItemId GetId() const { return m_itemId; }
146#else
a7e594b2 147 const wxTreeItemId& GetId() const { return (wxTreeItemId&) m_itemId; }
8a2c6ef8 148#endif
08b7c251
VZ
149};
150
151// ----------------------------------------------------------------------------
152// wxTreeCtrl
153// ----------------------------------------------------------------------------
154class WXDLLEXPORT wxTreeCtrl : public wxControl
2bda0e17 155{
092bddef 156public:
092bddef
VZ
157 // creation
158 // --------
08b7c251
VZ
159 wxTreeCtrl() { Init(); }
160
161 wxTreeCtrl(wxWindow *parent, wxWindowID id = -1,
162 const wxPoint& pos = wxDefaultPosition,
163 const wxSize& size = wxDefaultSize,
164 long style = wxTR_HAS_BUTTONS | wxTR_LINES_AT_ROOT,
165 const wxValidator& validator = wxDefaultValidator,
166 const wxString& name = "wxTreeCtrl")
092bddef
VZ
167 {
168 Create(parent, id, pos, size, style, validator, name);
169 }
08b7c251
VZ
170
171 virtual ~wxTreeCtrl();
172
092bddef
VZ
173 bool Create(wxWindow *parent, wxWindowID id = -1,
174 const wxPoint& pos = wxDefaultPosition,
175 const wxSize& size = wxDefaultSize,
08b7c251 176 long style = wxTR_HAS_BUTTONS | wxTR_LINES_AT_ROOT,
092bddef
VZ
177 const wxValidator& validator = wxDefaultValidator,
178 const wxString& name = "wxTreeCtrl");
08b7c251 179
092bddef
VZ
180 // accessors
181 // ---------
092bddef 182
08b7c251
VZ
183 // get the total number of items in the control
184 size_t GetCount() const;
185
186 // indent is the number of pixels the children are indented relative to
187 // the parents position. SetIndent() also redraws the control
188 // immediately.
189 unsigned int GetIndent() const;
190 void SetIndent(unsigned int indent);
191
cf724bce
RR
192 // spacing is the number of pixels between the start and the Text
193 // not implemented under wxMSW
194 unsigned int GetSpacing() const { return 18; } // return wxGTK default
195 void SetSpacing(unsigned int ) {}
196
08b7c251
VZ
197 // image list: these functions allow to associate an image list with
198 // the control and retrieve it. Note that the control does _not_ delete
199 // the associated image list when it's deleted in order to allow image
200 // lists to be shared between different controls.
201 //
202 // The normal image list is for the icons which correspond to the
203 // normal tree item state (whether it is selected or not).
204 // Additionally, the application might choose to show a state icon
205 // which corresponds to an app-defined item state (for example,
206 // checked/unchecked) which are taken from the state image list.
207 wxImageList *GetImageList() const;
208 wxImageList *GetStateImageList() const;
209
210 void SetImageList(wxImageList *imageList);
211 void SetStateImageList(wxImageList *imageList);
212
213 // Functions to work with tree ctrl items. Unfortunately, they can _not_ be
214 // member functions of wxTreeItem because they must know the tree the item
215 // belongs to for Windows implementation and storing the pointer to
216 // wxTreeCtrl in each wxTreeItem is just too much waste.
217
218 // accessors
219 // ---------
220
221 // retrieve items label
222 wxString GetItemText(const wxTreeItemId& item) const;
223 // get the normal item image
224 int GetItemImage(const wxTreeItemId& item) const;
225 // get the selected item image
226 int GetItemSelectedImage(const wxTreeItemId& item) const;
227 // get the data associated with the item
228 wxTreeItemData *GetItemData(const wxTreeItemId& item) const;
229
230 // modifiers
231 // ---------
232
233 // set items label
234 void SetItemText(const wxTreeItemId& item, const wxString& text);
235 // set the normal item image
236 void SetItemImage(const wxTreeItemId& item, int image);
237 // set the selected item image
238 void SetItemSelectedImage(const wxTreeItemId& item, int image);
239 // associate some data with the item
240 void SetItemData(const wxTreeItemId& item, wxTreeItemData *data);
241
3a5a2f56
VZ
242 // force appearance of [+] button near the item. This is useful to
243 // allow the user to expand the items which don't have any children now
244 // - but instead add them only when needed, thus minimizing memory
245 // usage and loading time.
246 void SetItemHasChildren(const wxTreeItemId& item, bool has = TRUE);
247
add28c55
VZ
248 // the item will be shown in bold
249 void SetItemBold(const wxTreeItemId& item, bool bold = TRUE);
250
58a8ab88
JS
251 // the item will be shown with a drop highlight
252 void SetItemDropHighlight(const wxTreeItemId& item, bool highlight = TRUE);
253
08b7c251
VZ
254 // item status inquiries
255 // ---------------------
256
257 // is the item visible (it might be outside the view or not expanded)?
258 bool IsVisible(const wxTreeItemId& item) const;
259 // does the item has any children?
260 bool ItemHasChildren(const wxTreeItemId& item) const;
261 // is the item expanded (only makes sense if HasChildren())?
262 bool IsExpanded(const wxTreeItemId& item) const;
263 // is this item currently selected (the same as has focus)?
264 bool IsSelected(const wxTreeItemId& item) const;
add28c55
VZ
265 // is item text in bold font?
266 bool IsBold(const wxTreeItemId& item) const;
08b7c251 267
4832f7c0
VZ
268 // number of children
269 // ------------------
270
271 // if 'recursively' is FALSE, only immediate children count, otherwise
272 // the returned number is the number of all items in this branch
273 size_t GetChildrenCount(const wxTreeItemId& item, bool recursively = TRUE);
274
08b7c251
VZ
275 // navigation
276 // ----------
277
278 // wxTreeItemId.IsOk() will return FALSE if there is no such item
279
280 // get the root tree item
281 wxTreeItemId GetRootItem() const;
282
283 // get the item currently selected (may return NULL if no selection)
284 wxTreeItemId GetSelection() const;
285
286 // get the parent of this item (may return NULL if root)
287 wxTreeItemId GetParent(const wxTreeItemId& item) const;
288
289 // for this enumeration function you must pass in a "cookie" parameter
290 // which is opaque for the application but is necessary for the library
291 // to make these functions reentrant (i.e. allow more than one
292 // enumeration on one and the same object simultaneously). Of course,
293 // the "cookie" passed to GetFirstChild() and GetNextChild() should be
294 // the same!
295
296 // get the first child of this item
06e38c8e 297 wxTreeItemId GetFirstChild(const wxTreeItemId& item, long& _cookie) const;
08b7c251 298 // get the next child
06e38c8e 299 wxTreeItemId GetNextChild(const wxTreeItemId& item, long& _cookie) const;
978f38c2
VZ
300 // get the last child of this item - this method doesn't use cookies
301 wxTreeItemId GetLastChild(const wxTreeItemId& item) const;
08b7c251
VZ
302
303 // get the next sibling of this item
304 wxTreeItemId GetNextSibling(const wxTreeItemId& item) const;
305 // get the previous sibling
306 wxTreeItemId GetPrevSibling(const wxTreeItemId& item) const;
307
308 // get first visible item
309 wxTreeItemId GetFirstVisibleItem() const;
310 // get the next visible item: item must be visible itself!
311 // see IsVisible() and wxTreeCtrl::GetFirstVisibleItem()
312 wxTreeItemId GetNextVisible(const wxTreeItemId& item) const;
313 // get the previous visible item: item must be visible itself!
314 wxTreeItemId GetPrevVisible(const wxTreeItemId& item) const;
315
092bddef
VZ
316 // operations
317 // ----------
08b7c251
VZ
318
319 // add the root node to the tree
320 wxTreeItemId AddRoot(const wxString& text,
321 int image = -1, int selectedImage = -1,
322 wxTreeItemData *data = NULL);
323
324 // insert a new item in as the first child of the parent
325 wxTreeItemId PrependItem(const wxTreeItemId& parent,
326 const wxString& text,
327 int image = -1, int selectedImage = -1,
328 wxTreeItemData *data = NULL);
329
330 // insert a new item after a given one
331 wxTreeItemId InsertItem(const wxTreeItemId& parent,
332 const wxTreeItemId& idPrevious,
333 const wxString& text,
334 int image = -1, int selectedImage = -1,
335 wxTreeItemData *data = NULL);
336
337 // insert a new item in as the last child of the parent
338 wxTreeItemId AppendItem(const wxTreeItemId& parent,
339 const wxString& text,
340 int image = -1, int selectedImage = -1,
341 wxTreeItemData *data = NULL);
342
343 // delete this item and associated data if any
344 void Delete(const wxTreeItemId& item);
372edb9d
VZ
345 // delete all children (but don't delete the item itself)
346 // NB: this won't send wxEVT_COMMAND_TREE_ITEM_DELETED events
347 void DeleteChildren(const wxTreeItemId& item);
08b7c251 348 // delete all items from the tree
372edb9d 349 // NB: this won't send wxEVT_COMMAND_TREE_ITEM_DELETED events
08b7c251
VZ
350 void DeleteAllItems();
351
352 // expand this item
353 void Expand(const wxTreeItemId& item);
354 // collapse the item without removing its children
355 void Collapse(const wxTreeItemId& item);
356 // collapse the item and remove all children
357 void CollapseAndReset(const wxTreeItemId& item);
358 // toggles the current state
359 void Toggle(const wxTreeItemId& item);
360
361 // remove the selection from currently selected item (if any)
362 void Unselect();
363 // select this item
364 void SelectItem(const wxTreeItemId& item);
365 // make sure this item is visible (expanding the parent item and/or
366 // scrolling to this item if necessary)
367 void EnsureVisible(const wxTreeItemId& item);
368 // scroll to this item (but don't expand its parent)
369 void ScrollTo(const wxTreeItemId& item);
370
371 // start editing the item label: this (temporarily) replaces the item
372 // with a one line edit control. The item will be selected if it hadn't
373 // been before. textCtrlClass parameter allows you to create an edit
374 // control of arbitrary user-defined class deriving from wxTextCtrl.
375 wxTextCtrl* EditLabel(const wxTreeItemId& item,
376 wxClassInfo* textCtrlClass = CLASSINFO(wxTextCtrl));
377 // returns the same pointer as StartEdit() if the item is being edited,
378 // NULL otherwise (it's assumed that no more than one item may be
379 // edited simultaneously)
380 wxTextCtrl* GetEditControl() const;
381 // end editing and accept or discard the changes to item label
382 void EndEditLabel(const wxTreeItemId& item, bool discardChanges = FALSE);
383
95aabccc
VZ
384 // sorting
385 // this function is called to compare 2 items and should return -1, 0
386 // or +1 if the first item is less than, equal to or greater than the
387 // second one. The base class version performs alphabetic comparaison
388 // of item labels (GetText)
389 virtual int OnCompareItems(const wxTreeItemId& item1,
390 const wxTreeItemId& item2);
391 // sort the children of this item using OnCompareItems
08b7c251 392 //
95aabccc
VZ
393 // NB: this function is not reentrant and not MT-safe (FIXME)!
394 void SortChildren(const wxTreeItemId& item);
08b7c251
VZ
395
396 // helpers
397 // -------
398
add28c55
VZ
399 // determine to which item (if any) belongs the given point (the
400 // coordinates specified are relative to the client area of tree ctrl)
401 // and fill the flags parameter with a bitmask of wxTREE_HITTEST_xxx
402 // constants.
403 //
404 // The first function is more portable (because easier to implement
405 // on other platforms), but the second one returns some extra info.
406 wxTreeItemId HitTest(const wxPoint& point)
407 { int dummy; return HitTest(point, dummy); }
408 wxTreeItemId HitTest(const wxPoint& point, int& flags);
08b7c251
VZ
409
410 // get the bounding rectangle of the item (or of its label only)
f7c832a7 411 bool GetBoundingRect(const wxTreeItemId& item,
16e93305 412 wxRect& rect,
08b7c251
VZ
413 bool textOnly = FALSE) const;
414
08b7c251
VZ
415 // deprecated
416 // ----------
417
418 // these methods are deprecated and will be removed in future versions of
419 // wxWindows, they're here for compatibility only, don't use them in new
420 // code (the comments indicate why these methods are now useless and how to
421 // replace them)
422
423 // use Expand, Collapse, CollapseAndReset or Toggle
424 void ExpandItem(const wxTreeItemId& item, int action);
425
426 // use AddRoot, PrependItem or AppendItem
427 wxTreeItemId InsertItem(const wxTreeItemId& parent,
428 const wxString& text,
429 int image = -1, int selImage = -1,
430 long insertAfter = wxTREE_INSERT_LAST);
431
432 // use Set/GetImageList and Set/GetStateImageList
433 wxImageList *GetImageList(int) const
434 { return GetImageList(); }
435 void SetImageList(wxImageList *imageList, int)
436 { SetImageList(imageList); }
437
438 // implementation
439 // --------------
fd3f686c 440 virtual bool MSWCommand(WXUINT param, WXWORD id);
a23fd0e1 441 virtual bool MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result);
08b7c251 442
2bda0e17 443protected:
08b7c251
VZ
444 // SetImageList helper
445 void SetAnyImageList(wxImageList *imageList, int which);
446
447 wxTextCtrl* m_textCtrl; // used while editing the item label
448 wxImageList *m_imageListNormal, // images for tree elements
449 *m_imageListState; // special images for app defined states
450
451private:
452 // the common part of all ctors
453 void Init();
454
455 // helper functions
456 inline bool DoGetItem(wxTreeViewItem *tvItem) const;
457 inline void DoSetItem(wxTreeViewItem *tvItem);
458
459 inline void DoExpand(const wxTreeItemId& item, int flag);
460
461 wxTreeItemId DoInsertItem(const wxTreeItemId& parent,
462 wxTreeItemId hInsertAfter,
463 const wxString& text,
464 int image, int selectedImage,
465 wxTreeItemData *data);
466
467 void DeleteTextCtrl();
092bddef
VZ
468
469 DECLARE_DYNAMIC_CLASS(wxTreeCtrl)
2bda0e17
KB
470};
471
08b7c251
VZ
472// ----------------------------------------------------------------------------
473// wxTreeEvent is a special class for all events associated with tree controls
474//
475// NB: note that not all accessors make sense for all events, see the event
476// descriptions below
477// ----------------------------------------------------------------------------
fd3f686c 478class WXDLLEXPORT wxTreeEvent : public wxNotifyEvent
2bda0e17 479{
08b7c251
VZ
480friend wxTreeCtrl;
481public:
482 wxTreeEvent(wxEventType commandType = wxEVT_NULL, int id = 0);
483
484 // accessors
485 // get the item on which the operation was performed or the newly
486 // selected item for wxEVT_COMMAND_TREE_SEL_CHANGED/ING events
487 wxTreeItemId GetItem() const { return m_item; }
2bda0e17 488
08b7c251
VZ
489 // for wxEVT_COMMAND_TREE_SEL_CHANGED/ING events, get the previously
490 // selected item
491 wxTreeItemId GetOldItem() const { return m_itemOld; }
2bda0e17 492
08b7c251
VZ
493 // the point where the mouse was when the drag operation started (for
494 // wxEVT_COMMAND_TREE_BEGIN_(R)DRAG events only)
495 wxPoint GetPoint() const { return m_pointDrag; }
64693098 496
08b7c251
VZ
497 // keyboard code (for wxEVT_COMMAND_TREE_KEY_DOWN only)
498 int GetCode() const { return m_code; }
499
08b7c251
VZ
500private:
501 // @@ we could save some space by using union here
502 int m_code;
503 wxTreeItemId m_item,
504 m_itemOld;
505 wxPoint m_pointDrag;
506
507 DECLARE_DYNAMIC_CLASS(wxTreeEvent)
2bda0e17
KB
508};
509
510typedef void (wxEvtHandler::*wxTreeEventFunction)(wxTreeEvent&);
511
08b7c251
VZ
512// ----------------------------------------------------------------------------
513// macros for handling tree control events
514// ----------------------------------------------------------------------------
515
516// GetItem() returns the item being dragged, GetPoint() the mouse coords
c67daf87
UR
517#define EVT_TREE_BEGIN_DRAG(id, fn) { wxEVT_COMMAND_TREE_BEGIN_DRAG, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxTreeEventFunction) & fn, (wxObject *) NULL },
518#define EVT_TREE_BEGIN_RDRAG(id, fn) { wxEVT_COMMAND_TREE_BEGIN_RDRAG, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxTreeEventFunction) & fn, (wxObject *) NULL },
08b7c251
VZ
519
520// GetItem() returns the itme whose label is being edited
c67daf87
UR
521#define EVT_TREE_BEGIN_LABEL_EDIT(id, fn) { wxEVT_COMMAND_TREE_BEGIN_LABEL_EDIT, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxTreeEventFunction) & fn, (wxObject *) NULL },
522#define EVT_TREE_END_LABEL_EDIT(id, fn) { wxEVT_COMMAND_TREE_END_LABEL_EDIT, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxTreeEventFunction) & fn, (wxObject *) NULL },
08b7c251
VZ
523
524// provide/update information about GetItem() item
c67daf87
UR
525#define EVT_TREE_GET_INFO(id, fn) { wxEVT_COMMAND_TREE_GET_INFO, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxTreeEventFunction) & fn, (wxObject *) NULL },
526#define EVT_TREE_SET_INFO(id, fn) { wxEVT_COMMAND_TREE_SET_INFO, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxTreeEventFunction) & fn, (wxObject *) NULL },
08b7c251
VZ
527
528// GetItem() is the item being expanded/collapsed, the "ING" versions can use
c67daf87
UR
529#define EVT_TREE_ITEM_EXPANDED(id, fn) { wxEVT_COMMAND_TREE_ITEM_EXPANDED, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxTreeEventFunction) & fn, (wxObject *) NULL },
530#define EVT_TREE_ITEM_EXPANDING(id, fn) { wxEVT_COMMAND_TREE_ITEM_EXPANDING, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxTreeEventFunction) & fn, (wxObject *) NULL },
531#define EVT_TREE_ITEM_COLLAPSED(id, fn) { wxEVT_COMMAND_TREE_ITEM_COLLAPSED, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxTreeEventFunction) & fn, (wxObject *) NULL },
092bddef 532#define EVT_TREE_ITEM_COLLAPSING(id, fn) { wxEVT_COMMAND_TREE_ITEM_COLLAPSING, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxTreeEventFunction) & fn, NULL },
08b7c251
VZ
533
534// GetOldItem() is the item which had the selection previously, GetItem() is
535// the item which acquires selection
fe71f65c
RR
536#define EVT_TREE_SEL_CHANGED(id, fn) { wxEVT_COMMAND_TREE_SEL_CHANGED, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxTreeEventFunction) & fn, NULL },
537#define EVT_TREE_SEL_CHANGING(id, fn) { wxEVT_COMMAND_TREE_SEL_CHANGING, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxTreeEventFunction) & fn, NULL },
08b7c251
VZ
538
539// GetCode() returns the key code
540// NB: this is the only message for which GetItem() is invalid (you may get the
541// item from GetSelection())
fe71f65c 542#define EVT_TREE_KEY_DOWN(id, fn) { wxEVT_COMMAND_TREE_KEY_DOWN, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxTreeEventFunction) & fn, NULL },
2bda0e17 543
08b7c251
VZ
544// GetItem() returns the item being deleted, the associated data (if any) will
545// be deleted just after the return of this event handler (if any)
546#define EVT_TREE_DELETE_ITEM(id, fn) { wxEVT_COMMAND_TREE_DELETE_ITEM, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxTreeEventFunction) & fn, (wxObject *) NULL },
547
435fe83e
RR
548// GetItem() returns the item that was activated (double click, enter, space)
549#define EVT_TREE_ITEM_ACTIVATED(id, fn) { wxEVT_COMMAND_TREE_ITEM_ACTIVATED, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxTreeEventFunction) & fn, NULL },
550
2bda0e17 551#endif
bbcdf8bc 552 // _WX_TREECTRL_H_