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