]>
git.saurik.com Git - wxWidgets.git/blob - include/wx/treectrl.h
1 #ifndef _WX_TREECTRL_H_BASE_
2 #define _WX_TREECTRL_H_BASE_
4 // ----------------------------------------------------------------------------
6 // ----------------------------------------------------------------------------
8 #include "wx/control.h"
11 // ----------------------------------------------------------------------------
12 // include the platform-dependent wxTreeCtrl class
13 // ----------------------------------------------------------------------------
15 #if defined(__WXMSW__)
17 #include "wx/generic/treectrl.h"
19 #include "wx/msw/treectrl.h"
21 #elif defined(__WXMOTIF__)
22 #include "wx/generic/treectrl.h"
23 #elif defined(__WXGTK__)
24 #include "wx/generic/treectrl.h"
25 #elif defined(__WXQT__)
26 #include "wx/qt/treectrl.h"
27 #elif defined(__WXMAC__)
28 #include "wx/generic/treectrl.h"
29 #elif defined(__WXPM__)
30 #include "wx/generic/treectrl.h"
31 #elif defined(__WXSTUBS__)
32 #include "wx/generic/treectrl.h"
35 // ----------------------------------------------------------------------------
36 // wxTreeEvent is a special class for all events associated with tree controls
38 // NB: note that not all accessors make sense for all events, see the event
40 // ----------------------------------------------------------------------------
42 class WXDLLEXPORT wxTreeEvent
: public wxNotifyEvent
46 wxTreeEvent(wxEventType commandType
= wxEVT_NULL
, int id
= 0);
49 // get the item on which the operation was performed or the newly
50 // selected item for wxEVT_COMMAND_TREE_SEL_CHANGED/ING events
51 wxTreeItemId
GetItem() const { return m_item
; }
53 // for wxEVT_COMMAND_TREE_SEL_CHANGED/ING events, get the previously
55 wxTreeItemId
GetOldItem() const { return m_itemOld
; }
57 // the point where the mouse was when the drag operation started (for
58 // wxEVT_COMMAND_TREE_BEGIN_(R)DRAG events only)
59 wxPoint
GetPoint() const { return m_pointDrag
; }
61 // keyboard code (for wxEVT_COMMAND_TREE_KEY_DOWN only)
62 int GetCode() const { return m_code
; }
64 // label (for EVT_TREE_{BEGIN|END}_LABEL_EDIT only)
65 const wxString
& GetLabel() const { return m_label
; }
68 // TODO we could save some space by using union here
75 DECLARE_DYNAMIC_CLASS(wxTreeEvent
)
78 typedef void (wxEvtHandler::*wxTreeEventFunction
)(wxTreeEvent
&);
80 // ----------------------------------------------------------------------------
81 // macros for handling tree control events
82 // ----------------------------------------------------------------------------
84 // GetItem() returns the item being dragged, GetPoint() the mouse coords
85 #define EVT_TREE_BEGIN_DRAG(id, fn) { wxEVT_COMMAND_TREE_BEGIN_DRAG, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxTreeEventFunction) & fn, (wxObject *) NULL },
86 #define EVT_TREE_BEGIN_RDRAG(id, fn) { wxEVT_COMMAND_TREE_BEGIN_RDRAG, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxTreeEventFunction) & fn, (wxObject *) NULL },
88 // GetItem() returns the itme whose label is being edited, GetLabel() returns
89 // the current item label for BEGIN and the would be new one for END.
91 // Vetoing BEGIN event means that label editing won't happen at all,
92 // vetoing END means that the new value is discarded and the old one kept
93 #define EVT_TREE_BEGIN_LABEL_EDIT(id, fn) { wxEVT_COMMAND_TREE_BEGIN_LABEL_EDIT, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxTreeEventFunction) & fn, (wxObject *) NULL },
94 #define EVT_TREE_END_LABEL_EDIT(id, fn) { wxEVT_COMMAND_TREE_END_LABEL_EDIT, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxTreeEventFunction) & fn, (wxObject *) NULL },
96 // provide/update information about GetItem() item
97 #define EVT_TREE_GET_INFO(id, fn) { wxEVT_COMMAND_TREE_GET_INFO, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxTreeEventFunction) & fn, (wxObject *) NULL },
98 #define EVT_TREE_SET_INFO(id, fn) { wxEVT_COMMAND_TREE_SET_INFO, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxTreeEventFunction) & fn, (wxObject *) NULL },
100 // GetItem() is the item being expanded/collapsed, the "ING" versions can use
101 #define EVT_TREE_ITEM_EXPANDED(id, fn) { wxEVT_COMMAND_TREE_ITEM_EXPANDED, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxTreeEventFunction) & fn, (wxObject *) NULL },
102 #define EVT_TREE_ITEM_EXPANDING(id, fn) { wxEVT_COMMAND_TREE_ITEM_EXPANDING, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxTreeEventFunction) & fn, (wxObject *) NULL },
103 #define EVT_TREE_ITEM_COLLAPSED(id, fn) { wxEVT_COMMAND_TREE_ITEM_COLLAPSED, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxTreeEventFunction) & fn, (wxObject *) NULL },
104 #define EVT_TREE_ITEM_COLLAPSING(id, fn) { wxEVT_COMMAND_TREE_ITEM_COLLAPSING, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxTreeEventFunction) & fn, NULL },
106 // GetOldItem() is the item which had the selection previously, GetItem() is
107 // the item which acquires selection
108 #define EVT_TREE_SEL_CHANGED(id, fn) { wxEVT_COMMAND_TREE_SEL_CHANGED, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxTreeEventFunction) & fn, NULL },
109 #define EVT_TREE_SEL_CHANGING(id, fn) { wxEVT_COMMAND_TREE_SEL_CHANGING, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxTreeEventFunction) & fn, NULL },
111 // GetCode() returns the key code
112 // NB: this is the only message for which GetItem() is invalid (you may get the
113 // item from GetSelection())
114 #define EVT_TREE_KEY_DOWN(id, fn) { wxEVT_COMMAND_TREE_KEY_DOWN, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxTreeEventFunction) & fn, NULL },
116 // GetItem() returns the item being deleted, the associated data (if any) will
117 // be deleted just after the return of this event handler (if any)
118 #define EVT_TREE_DELETE_ITEM(id, fn) { wxEVT_COMMAND_TREE_DELETE_ITEM, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxTreeEventFunction) & fn, (wxObject *) NULL },
120 // GetItem() returns the item that was activated (double click, enter, space)
121 #define EVT_TREE_ITEM_ACTIVATED(id, fn) { wxEVT_COMMAND_TREE_ITEM_ACTIVATED, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxTreeEventFunction) & fn, NULL },
124 // _WX_TREECTRL_H_BASE_