]>
Commit | Line | Data |
---|---|---|
484523cf | 1 | ///////////////////////////////////////////////////////////////////////////// |
40ff126a | 2 | // Name: wx/treebase.h |
484523cf JS |
3 | // Purpose: wxTreeCtrl base classes and types |
4 | // Author: Julian Smart et al | |
5 | // Modified by: | |
6 | // Created: 01/02/97 | |
484523cf | 7 | // Copyright: (c) 1997,1998 Robert Roebling |
65571936 | 8 | // Licence: wxWindows licence |
484523cf JS |
9 | ///////////////////////////////////////////////////////////////////////////// |
10 | ||
11 | #ifndef _WX_TREEBASE_H_ | |
12 | #define _WX_TREEBASE_H_ | |
13 | ||
484523cf JS |
14 | // ---------------------------------------------------------------------------- |
15 | // headers | |
16 | // ---------------------------------------------------------------------------- | |
17 | ||
2ecf902b WS |
18 | #include "wx/defs.h" |
19 | ||
1e6feb95 | 20 | #if wxUSE_TREECTRL |
33737618 | 21 | |
618a5e38 | 22 | #include "wx/window.h" // for wxClientData |
484523cf | 23 | #include "wx/event.h" |
ed39ff57 | 24 | #include "wx/dynarray.h" |
87df1c87 | 25 | #include "wx/itemid.h" |
484523cf | 26 | |
40ff126a WS |
27 | #if WXWIN_COMPATIBILITY_2_6 |
28 | ||
e2effeb9 WS |
29 | // flags for deprecated `Expand(int action)', will be removed in next versions |
30 | enum | |
31 | { | |
32 | wxTREE_EXPAND_EXPAND, | |
33 | wxTREE_EXPAND_COLLAPSE, | |
34 | wxTREE_EXPAND_COLLAPSE_RESET, | |
35 | wxTREE_EXPAND_TOGGLE | |
36 | }; | |
37 | ||
40ff126a WS |
38 | #endif // WXWIN_COMPATIBILITY_2_6 |
39 | ||
484523cf | 40 | // ---------------------------------------------------------------------------- |
87df1c87 VZ |
41 | // wxTreeItemId identifies an element of the tree. It's opaque for the |
42 | // application and the only method which can be used by user code is IsOk(). | |
484523cf JS |
43 | // ---------------------------------------------------------------------------- |
44 | ||
87df1c87 VZ |
45 | // This is a class and not a typedef because existing code may forward declare |
46 | // wxTreeItemId as a class and we don't want to break it without good reason. | |
47 | class wxTreeItemId : public wxItemId<void*> | |
484523cf | 48 | { |
484523cf | 49 | public: |
87df1c87 VZ |
50 | wxTreeItemId() : wxItemId<void*>() { } |
51 | wxTreeItemId(void* pItem) : wxItemId<void*>(pItem) { } | |
484523cf JS |
52 | }; |
53 | ||
54 | // ---------------------------------------------------------------------------- | |
55 | // wxTreeItemData is some (arbitrary) user class associated with some item. The | |
56 | // main advantage of having this class (compared to old untyped interface) is | |
57 | // that wxTreeItemData's are destroyed automatically by the tree and, as this | |
58 | // class has virtual dtor, it means that the memory will be automatically | |
59 | // freed. OTOH, we don't just use wxObject instead of wxTreeItemData because | |
60 | // the size of this class is critical: in any real application, each tree leaf | |
61 | // will have wxTreeItemData associated with it and number of leaves may be | |
62 | // quite big. | |
63 | // | |
64 | // Because the objects of this class are deleted by the tree, they should | |
65 | // always be allocated on the heap! | |
66 | // ---------------------------------------------------------------------------- | |
67 | ||
53a2db12 | 68 | class WXDLLIMPEXP_CORE wxTreeItemData: public wxClientData |
484523cf | 69 | { |
b5dbe15d VS |
70 | friend class WXDLLIMPEXP_FWD_CORE wxTreeCtrl; |
71 | friend class WXDLLIMPEXP_FWD_CORE wxGenericTreeCtrl; | |
484523cf JS |
72 | public: |
73 | // creation/destruction | |
74 | // -------------------- | |
75 | // default ctor | |
76 | wxTreeItemData() { } | |
77 | ||
78 | // default copy ctor/assignment operator are ok | |
79 | ||
80 | // accessor: get the item associated with us | |
81 | const wxTreeItemId& GetId() const { return m_pItem; } | |
82 | void SetId(const wxTreeItemId& id) { m_pItem = id; } | |
83 | ||
84 | protected: | |
85 | wxTreeItemId m_pItem; | |
86 | }; | |
87 | ||
87df1c87 VZ |
88 | typedef void *wxTreeItemIdValue; |
89 | ||
d5d29b8a | 90 | WX_DEFINE_EXPORTED_ARRAY_PTR(wxTreeItemIdValue, wxArrayTreeItemIdsBase); |
f888d614 | 91 | |
14ba002a | 92 | // this is a wrapper around the array class defined above which allow to wok |
87df1c87 | 93 | // with values of natural wxTreeItemId type instead of using wxTreeItemIdValue |
14ba002a | 94 | // and does it without any loss of efficiency |
53a2db12 | 95 | class WXDLLIMPEXP_CORE wxArrayTreeItemIds : public wxArrayTreeItemIdsBase |
f888d614 VZ |
96 | { |
97 | public: | |
98 | void Add(const wxTreeItemId& id) | |
99 | { wxArrayTreeItemIdsBase::Add(id.m_pItem); } | |
14ba002a VZ |
100 | void Insert(const wxTreeItemId& id, size_t pos) |
101 | { wxArrayTreeItemIdsBase::Insert(id.m_pItem, pos); } | |
102 | wxTreeItemId Item(size_t i) const | |
103 | { return wxTreeItemId(wxArrayTreeItemIdsBase::Item(i)); } | |
104 | wxTreeItemId operator[](size_t i) const { return Item(i); } | |
f888d614 | 105 | }; |
484523cf JS |
106 | |
107 | // ---------------------------------------------------------------------------- | |
108 | // constants | |
109 | // ---------------------------------------------------------------------------- | |
110 | ||
111 | // enum for different images associated with a treectrl item | |
112 | enum wxTreeItemIcon | |
113 | { | |
114 | wxTreeItemIcon_Normal, // not selected, not expanded | |
115 | wxTreeItemIcon_Selected, // selected, not expanded | |
116 | wxTreeItemIcon_Expanded, // not selected, expanded | |
117 | wxTreeItemIcon_SelectedExpanded, // selected, expanded | |
118 | wxTreeItemIcon_Max | |
119 | }; | |
120 | ||
03966fcb RR |
121 | // special values for the 'state' parameter of wxTreeCtrl::SetItemState() |
122 | static const int wxTREE_ITEMSTATE_NONE = -1; // not state (no display state image) | |
123 | static const int wxTREE_ITEMSTATE_NEXT = -2; // cycle to the next state | |
124 | static const int wxTREE_ITEMSTATE_PREV = -3; // cycle to the previous state | |
125 | ||
9c7f49f5 VZ |
126 | // ---------------------------------------------------------------------------- |
127 | // wxTreeCtrl flags | |
128 | // ---------------------------------------------------------------------------- | |
129 | ||
c6f4913a | 130 | #define wxTR_NO_BUTTONS 0x0000 // for convenience |
9c7f49f5 VZ |
131 | #define wxTR_HAS_BUTTONS 0x0001 // draw collapsed/expanded btns |
132 | #define wxTR_NO_LINES 0x0004 // don't draw lines at all | |
c6f4913a | 133 | #define wxTR_LINES_AT_ROOT 0x0008 // connect top-level nodes |
99cea4b3 | 134 | #define wxTR_TWIST_BUTTONS 0x0010 // still used by wxTreeListCtrl |
c6f4913a VS |
135 | |
136 | #define wxTR_SINGLE 0x0000 // for convenience | |
137 | #define wxTR_MULTIPLE 0x0020 // can select multiple items | |
d642a722 VZ |
138 | |
139 | #if WXWIN_COMPATIBILITY_2_8 | |
140 | #define wxTR_EXTENDED 0x0040 // deprecated, don't use | |
141 | #endif // WXWIN_COMPATIBILITY_2_8 | |
142 | ||
9c7f49f5 | 143 | #define wxTR_HAS_VARIABLE_ROW_HEIGHT 0x0080 // what it says |
c6f4913a VS |
144 | |
145 | #define wxTR_EDIT_LABELS 0x0200 // can edit item labels | |
146 | #define wxTR_ROW_LINES 0x0400 // put border around items | |
147 | #define wxTR_HIDE_ROOT 0x0800 // don't display root node | |
618a5e38 | 148 | |
9c7f49f5 VZ |
149 | #define wxTR_FULL_ROW_HIGHLIGHT 0x2000 // highlight full horz space |
150 | ||
6621957f VZ |
151 | // make the default control appearance look more native-like depending on the |
152 | // platform | |
153 | #if defined(__WXGTK20__) | |
154 | #define wxTR_DEFAULT_STYLE (wxTR_HAS_BUTTONS | wxTR_NO_LINES) | |
155 | #elif defined(__WXMAC__) | |
156 | #define wxTR_DEFAULT_STYLE \ | |
157 | (wxTR_HAS_BUTTONS | wxTR_NO_LINES | wxTR_FULL_ROW_HIGHLIGHT) | |
c7f73af4 | 158 | #else |
6621957f | 159 | #define wxTR_DEFAULT_STYLE (wxTR_HAS_BUTTONS | wxTR_LINES_AT_ROOT) |
c7f73af4 | 160 | #endif |
9c7f49f5 | 161 | |
40ff126a | 162 | #if WXWIN_COMPATIBILITY_2_6 |
9c7f49f5 | 163 | // deprecated, don't use |
9c7f49f5 VZ |
164 | #define wxTR_MAC_BUTTONS 0 |
165 | #define wxTR_AQUA_BUTTONS 0 | |
40ff126a | 166 | #endif // WXWIN_COMPATIBILITY_2_6 |
9c7f49f5 | 167 | |
484523cf JS |
168 | |
169 | // values for the `flags' parameter of wxTreeCtrl::HitTest() which determine | |
170 | // where exactly the specified point is situated: | |
171 | ||
172 | static const int wxTREE_HITTEST_ABOVE = 0x0001; | |
173 | static const int wxTREE_HITTEST_BELOW = 0x0002; | |
174 | static const int wxTREE_HITTEST_NOWHERE = 0x0004; | |
175 | // on the button associated with an item. | |
176 | static const int wxTREE_HITTEST_ONITEMBUTTON = 0x0008; | |
177 | // on the bitmap associated with an item. | |
178 | static const int wxTREE_HITTEST_ONITEMICON = 0x0010; | |
179 | // on the indent associated with an item. | |
180 | static const int wxTREE_HITTEST_ONITEMINDENT = 0x0020; | |
181 | // on the label (string) associated with an item. | |
182 | static const int wxTREE_HITTEST_ONITEMLABEL = 0x0040; | |
183 | // on the right of the label associated with an item. | |
184 | static const int wxTREE_HITTEST_ONITEMRIGHT = 0x0080; | |
185 | // on the label (string) associated with an item. | |
186 | static const int wxTREE_HITTEST_ONITEMSTATEICON = 0x0100; | |
187 | // on the left of the wxTreeCtrl. | |
188 | static const int wxTREE_HITTEST_TOLEFT = 0x0200; | |
189 | // on the right of the wxTreeCtrl. | |
190 | static const int wxTREE_HITTEST_TORIGHT = 0x0400; | |
191 | // on the upper part (first half) of the item. | |
192 | static const int wxTREE_HITTEST_ONITEMUPPERPART = 0x0800; | |
193 | // on the lower part (second half) of the item. | |
194 | static const int wxTREE_HITTEST_ONITEMLOWERPART = 0x1000; | |
195 | ||
196 | // anywhere on the item | |
197 | static const int wxTREE_HITTEST_ONITEM = wxTREE_HITTEST_ONITEMICON | | |
198 | wxTREE_HITTEST_ONITEMLABEL; | |
199 | ||
200 | // tree ctrl default name | |
53a2db12 | 201 | extern WXDLLIMPEXP_DATA_CORE(const char) wxTreeCtrlNameStr[]; |
484523cf JS |
202 | |
203 | // ---------------------------------------------------------------------------- | |
204 | // wxTreeItemAttr: a structure containing the visual attributes of an item | |
205 | // ---------------------------------------------------------------------------- | |
206 | ||
53a2db12 | 207 | class WXDLLIMPEXP_CORE wxTreeItemAttr |
484523cf JS |
208 | { |
209 | public: | |
210 | // ctors | |
211 | wxTreeItemAttr() { } | |
212 | wxTreeItemAttr(const wxColour& colText, | |
213 | const wxColour& colBack, | |
214 | const wxFont& font) | |
215 | : m_colText(colText), m_colBack(colBack), m_font(font) { } | |
216 | ||
217 | // setters | |
218 | void SetTextColour(const wxColour& colText) { m_colText = colText; } | |
219 | void SetBackgroundColour(const wxColour& colBack) { m_colBack = colBack; } | |
220 | void SetFont(const wxFont& font) { m_font = font; } | |
221 | ||
222 | // accessors | |
a1b806b9 DS |
223 | bool HasTextColour() const { return m_colText.IsOk(); } |
224 | bool HasBackgroundColour() const { return m_colBack.IsOk(); } | |
225 | bool HasFont() const { return m_font.IsOk(); } | |
484523cf JS |
226 | |
227 | const wxColour& GetTextColour() const { return m_colText; } | |
228 | const wxColour& GetBackgroundColour() const { return m_colBack; } | |
229 | const wxFont& GetFont() const { return m_font; } | |
230 | ||
231 | private: | |
232 | wxColour m_colText, | |
233 | m_colBack; | |
234 | wxFont m_font; | |
235 | }; | |
236 | ||
237 | // ---------------------------------------------------------------------------- | |
238 | // wxTreeEvent is a special class for all events associated with tree controls | |
239 | // | |
240 | // NB: note that not all accessors make sense for all events, see the event | |
241 | // descriptions below | |
242 | // ---------------------------------------------------------------------------- | |
243 | ||
b5dbe15d | 244 | class WXDLLIMPEXP_FWD_CORE wxTreeCtrlBase; |
2388d9b3 | 245 | |
53a2db12 | 246 | class WXDLLIMPEXP_CORE wxTreeEvent : public wxNotifyEvent |
484523cf | 247 | { |
484523cf | 248 | public: |
e47859da | 249 | wxTreeEvent(wxEventType commandType = wxEVT_NULL, int id = 0); |
2388d9b3 VZ |
250 | wxTreeEvent(wxEventType commandType, |
251 | wxTreeCtrlBase *tree, | |
252 | const wxTreeItemId &item = wxTreeItemId()); | |
253 | wxTreeEvent(const wxTreeEvent& event); | |
0cd936a4 WS |
254 | |
255 | virtual wxEvent *Clone() const { return new wxTreeEvent(*this); } | |
484523cf JS |
256 | |
257 | // accessors | |
258 | // get the item on which the operation was performed or the newly | |
ce7fe42e | 259 | // selected item for wxEVT_TREE_SEL_CHANGED/ING events |
484523cf | 260 | wxTreeItemId GetItem() const { return m_item; } |
8adb5d45 | 261 | void SetItem(const wxTreeItemId& item) { m_item = item; } |
484523cf | 262 | |
ce7fe42e | 263 | // for wxEVT_TREE_SEL_CHANGED/ING events, get the previously |
484523cf JS |
264 | // selected item |
265 | wxTreeItemId GetOldItem() const { return m_itemOld; } | |
8adb5d45 | 266 | void SetOldItem(const wxTreeItemId& item) { m_itemOld = item; } |
484523cf JS |
267 | |
268 | // the point where the mouse was when the drag operation started (for | |
ce7fe42e | 269 | // wxEVT_TREE_BEGIN_(R)DRAG events only) or click position |
484523cf | 270 | wxPoint GetPoint() const { return m_pointDrag; } |
8adb5d45 | 271 | void SetPoint(const wxPoint& pt) { m_pointDrag = pt; } |
484523cf | 272 | |
ce7fe42e | 273 | // keyboard data (for wxEVT_TREE_KEY_DOWN only) |
b09bda68 | 274 | const wxKeyEvent& GetKeyEvent() const { return m_evtKey; } |
1944ad76 | 275 | int GetKeyCode() const { return m_evtKey.GetKeyCode(); } |
8adb5d45 | 276 | void SetKeyEvent(const wxKeyEvent& evt) { m_evtKey = evt; } |
484523cf JS |
277 | |
278 | // label (for EVT_TREE_{BEGIN|END}_LABEL_EDIT only) | |
279 | const wxString& GetLabel() const { return m_label; } | |
8adb5d45 | 280 | void SetLabel(const wxString& label) { m_label = label; } |
484523cf | 281 | |
dd23c25c JS |
282 | // edit cancel flag (for EVT_TREE_{BEGIN|END}_LABEL_EDIT only) |
283 | bool IsEditCancelled() const { return m_editCancelled; } | |
8adb5d45 | 284 | void SetEditCanceled(bool editCancelled) { m_editCancelled = editCancelled; } |
dd23c25c | 285 | |
156194e1 JS |
286 | // Set the tooltip for the item (for EVT\_TREE\_ITEM\_GETTOOLTIP events) |
287 | void SetToolTip(const wxString& toolTip) { m_label = toolTip; } | |
3dd67a18 | 288 | wxString GetToolTip() { return m_label; } |
8bc3ec1f | 289 | |
484523cf | 290 | private: |
b09bda68 VZ |
291 | // not all of the members are used (or initialized) for all events |
292 | wxKeyEvent m_evtKey; | |
484523cf JS |
293 | wxTreeItemId m_item, |
294 | m_itemOld; | |
295 | wxPoint m_pointDrag; | |
296 | wxString m_label; | |
dd23c25c | 297 | bool m_editCancelled; |
b09bda68 | 298 | |
b5dbe15d VS |
299 | friend class WXDLLIMPEXP_FWD_CORE wxTreeCtrl; |
300 | friend class WXDLLIMPEXP_FWD_CORE wxGenericTreeCtrl; | |
b09bda68 | 301 | |
0cd936a4 | 302 | DECLARE_DYNAMIC_CLASS(wxTreeEvent) |
484523cf JS |
303 | }; |
304 | ||
305 | typedef void (wxEvtHandler::*wxTreeEventFunction)(wxTreeEvent&); | |
306 | ||
307 | // ---------------------------------------------------------------------------- | |
2e4df4bf | 308 | // tree control events and macros for handling them |
484523cf JS |
309 | // ---------------------------------------------------------------------------- |
310 | ||
ce7fe42e VZ |
311 | wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_TREE_BEGIN_DRAG, wxTreeEvent ); |
312 | wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_TREE_BEGIN_RDRAG, wxTreeEvent ); | |
313 | wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_TREE_BEGIN_LABEL_EDIT, wxTreeEvent ); | |
314 | wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_TREE_END_LABEL_EDIT, wxTreeEvent ); | |
315 | wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_TREE_DELETE_ITEM, wxTreeEvent ); | |
316 | wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_TREE_GET_INFO, wxTreeEvent ); | |
317 | wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_TREE_SET_INFO, wxTreeEvent ); | |
318 | wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_TREE_ITEM_EXPANDED, wxTreeEvent ); | |
319 | wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_TREE_ITEM_EXPANDING, wxTreeEvent ); | |
320 | wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_TREE_ITEM_COLLAPSED, wxTreeEvent ); | |
321 | wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_TREE_ITEM_COLLAPSING, wxTreeEvent ); | |
322 | wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_TREE_SEL_CHANGED, wxTreeEvent ); | |
323 | wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_TREE_SEL_CHANGING, wxTreeEvent ); | |
324 | wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_TREE_KEY_DOWN, wxTreeEvent ); | |
325 | wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_TREE_ITEM_ACTIVATED, wxTreeEvent ); | |
326 | wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_TREE_ITEM_RIGHT_CLICK, wxTreeEvent ); | |
327 | wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_TREE_ITEM_MIDDLE_CLICK, wxTreeEvent ); | |
328 | wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_TREE_END_DRAG, wxTreeEvent ); | |
329 | wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_TREE_STATE_IMAGE_CLICK, wxTreeEvent ); | |
330 | wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_TREE_ITEM_GETTOOLTIP, wxTreeEvent ); | |
331 | wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_TREE_ITEM_MENU, wxTreeEvent ); | |
2e4df4bf | 332 | |
7fa03f04 | 333 | #define wxTreeEventHandler(func) \ |
3c778901 | 334 | wxEVENT_HANDLER_CAST(wxTreeEventFunction, func) |
7fa03f04 VZ |
335 | |
336 | #define wx__DECLARE_TREEEVT(evt, id, fn) \ | |
ce7fe42e | 337 | wx__DECLARE_EVT1(wxEVT_TREE_ ## evt, id, wxTreeEventHandler(fn)) |
7fa03f04 | 338 | |
484523cf JS |
339 | // GetItem() returns the item being dragged, GetPoint() the mouse coords |
340 | // | |
341 | // if you call event.Allow(), the drag operation will start and a | |
342 | // EVT_TREE_END_DRAG event will be sent when the drag is over. | |
7fa03f04 VZ |
343 | #define EVT_TREE_BEGIN_DRAG(id, fn) wx__DECLARE_TREEEVT(BEGIN_DRAG, id, fn) |
344 | #define EVT_TREE_BEGIN_RDRAG(id, fn) wx__DECLARE_TREEEVT(BEGIN_RDRAG, id, fn) | |
484523cf | 345 | |
3103e8a9 | 346 | // GetItem() is the item on which the drop occurred (if any) and GetPoint() the |
484523cf | 347 | // current mouse coords |
7fa03f04 | 348 | #define EVT_TREE_END_DRAG(id, fn) wx__DECLARE_TREEEVT(END_DRAG, id, fn) |
484523cf JS |
349 | |
350 | // GetItem() returns the itme whose label is being edited, GetLabel() returns | |
351 | // the current item label for BEGIN and the would be new one for END. | |
352 | // | |
353 | // Vetoing BEGIN event means that label editing won't happen at all, | |
354 | // vetoing END means that the new value is discarded and the old one kept | |
7fa03f04 VZ |
355 | #define EVT_TREE_BEGIN_LABEL_EDIT(id, fn) wx__DECLARE_TREEEVT(BEGIN_LABEL_EDIT, id, fn) |
356 | #define EVT_TREE_END_LABEL_EDIT(id, fn) wx__DECLARE_TREEEVT(END_LABEL_EDIT, id, fn) | |
484523cf JS |
357 | |
358 | // provide/update information about GetItem() item | |
7fa03f04 VZ |
359 | #define EVT_TREE_GET_INFO(id, fn) wx__DECLARE_TREEEVT(GET_INFO, id, fn) |
360 | #define EVT_TREE_SET_INFO(id, fn) wx__DECLARE_TREEEVT(SET_INFO, id, fn) | |
484523cf JS |
361 | |
362 | // GetItem() is the item being expanded/collapsed, the "ING" versions can use | |
7fa03f04 VZ |
363 | #define EVT_TREE_ITEM_EXPANDED(id, fn) wx__DECLARE_TREEEVT(ITEM_EXPANDED, id, fn) |
364 | #define EVT_TREE_ITEM_EXPANDING(id, fn) wx__DECLARE_TREEEVT(ITEM_EXPANDING, id, fn) | |
365 | #define EVT_TREE_ITEM_COLLAPSED(id, fn) wx__DECLARE_TREEEVT(ITEM_COLLAPSED, id, fn) | |
366 | #define EVT_TREE_ITEM_COLLAPSING(id, fn) wx__DECLARE_TREEEVT(ITEM_COLLAPSING, id, fn) | |
484523cf JS |
367 | |
368 | // GetOldItem() is the item which had the selection previously, GetItem() is | |
369 | // the item which acquires selection | |
7fa03f04 VZ |
370 | #define EVT_TREE_SEL_CHANGED(id, fn) wx__DECLARE_TREEEVT(SEL_CHANGED, id, fn) |
371 | #define EVT_TREE_SEL_CHANGING(id, fn) wx__DECLARE_TREEEVT(SEL_CHANGING, id, fn) | |
484523cf | 372 | |
1944ad76 | 373 | // GetKeyCode() returns the key code |
484523cf JS |
374 | // NB: this is the only message for which GetItem() is invalid (you may get the |
375 | // item from GetSelection()) | |
7fa03f04 | 376 | #define EVT_TREE_KEY_DOWN(id, fn) wx__DECLARE_TREEEVT(KEY_DOWN, id, fn) |
484523cf JS |
377 | |
378 | // GetItem() returns the item being deleted, the associated data (if any) will | |
379 | // be deleted just after the return of this event handler (if any) | |
7fa03f04 | 380 | #define EVT_TREE_DELETE_ITEM(id, fn) wx__DECLARE_TREEEVT(DELETE_ITEM, id, fn) |
484523cf JS |
381 | |
382 | // GetItem() returns the item that was activated (double click, enter, space) | |
7fa03f04 | 383 | #define EVT_TREE_ITEM_ACTIVATED(id, fn) wx__DECLARE_TREEEVT(ITEM_ACTIVATED, id, fn) |
484523cf | 384 | |
f7c6f947 | 385 | // GetItem() returns the item for which the context menu shall be shown |
7fa03f04 | 386 | #define EVT_TREE_ITEM_MENU(id, fn) wx__DECLARE_TREEEVT(ITEM_MENU, id, fn) |
f7c6f947 | 387 | |
484523cf | 388 | // GetItem() returns the item that was clicked on |
7fa03f04 VZ |
389 | #define EVT_TREE_ITEM_RIGHT_CLICK(id, fn) wx__DECLARE_TREEEVT(ITEM_RIGHT_CLICK, id, fn) |
390 | #define EVT_TREE_ITEM_MIDDLE_CLICK(id, fn) wx__DECLARE_TREEEVT(ITEM_MIDDLE_CLICK, id, fn) | |
484523cf | 391 | |
ae8c4b33 | 392 | // GetItem() returns the item whose state image was clicked on |
7fa03f04 | 393 | #define EVT_TREE_STATE_IMAGE_CLICK(id, fn) wx__DECLARE_TREEEVT(STATE_IMAGE_CLICK, id, fn) |
ae8c4b33 | 394 | |
156194e1 | 395 | // GetItem() is the item for which the tooltip is being requested |
7fa03f04 | 396 | #define EVT_TREE_ITEM_GETTOOLTIP(id, fn) wx__DECLARE_TREEEVT(ITEM_GETTOOLTIP, id, fn) |
156194e1 | 397 | |
ce7fe42e VZ |
398 | // old wxEVT_COMMAND_* constants |
399 | #define wxEVT_COMMAND_TREE_BEGIN_DRAG wxEVT_TREE_BEGIN_DRAG | |
400 | #define wxEVT_COMMAND_TREE_BEGIN_RDRAG wxEVT_TREE_BEGIN_RDRAG | |
401 | #define wxEVT_COMMAND_TREE_BEGIN_LABEL_EDIT wxEVT_TREE_BEGIN_LABEL_EDIT | |
402 | #define wxEVT_COMMAND_TREE_END_LABEL_EDIT wxEVT_TREE_END_LABEL_EDIT | |
403 | #define wxEVT_COMMAND_TREE_DELETE_ITEM wxEVT_TREE_DELETE_ITEM | |
404 | #define wxEVT_COMMAND_TREE_GET_INFO wxEVT_TREE_GET_INFO | |
405 | #define wxEVT_COMMAND_TREE_SET_INFO wxEVT_TREE_SET_INFO | |
406 | #define wxEVT_COMMAND_TREE_ITEM_EXPANDED wxEVT_TREE_ITEM_EXPANDED | |
407 | #define wxEVT_COMMAND_TREE_ITEM_EXPANDING wxEVT_TREE_ITEM_EXPANDING | |
408 | #define wxEVT_COMMAND_TREE_ITEM_COLLAPSED wxEVT_TREE_ITEM_COLLAPSED | |
409 | #define wxEVT_COMMAND_TREE_ITEM_COLLAPSING wxEVT_TREE_ITEM_COLLAPSING | |
410 | #define wxEVT_COMMAND_TREE_SEL_CHANGED wxEVT_TREE_SEL_CHANGED | |
411 | #define wxEVT_COMMAND_TREE_SEL_CHANGING wxEVT_TREE_SEL_CHANGING | |
412 | #define wxEVT_COMMAND_TREE_KEY_DOWN wxEVT_TREE_KEY_DOWN | |
413 | #define wxEVT_COMMAND_TREE_ITEM_ACTIVATED wxEVT_TREE_ITEM_ACTIVATED | |
414 | #define wxEVT_COMMAND_TREE_ITEM_RIGHT_CLICK wxEVT_TREE_ITEM_RIGHT_CLICK | |
415 | #define wxEVT_COMMAND_TREE_ITEM_MIDDLE_CLICK wxEVT_TREE_ITEM_MIDDLE_CLICK | |
416 | #define wxEVT_COMMAND_TREE_END_DRAG wxEVT_TREE_END_DRAG | |
417 | #define wxEVT_COMMAND_TREE_STATE_IMAGE_CLICK wxEVT_TREE_STATE_IMAGE_CLICK | |
418 | #define wxEVT_COMMAND_TREE_ITEM_GETTOOLTIP wxEVT_TREE_ITEM_GETTOOLTIP | |
419 | #define wxEVT_COMMAND_TREE_ITEM_MENU wxEVT_TREE_ITEM_MENU | |
420 | ||
1e6feb95 | 421 | #endif // wxUSE_TREECTRL |
33737618 | 422 | |
618a5e38 | 423 | #endif // _WX_TREEBASE_H_ |